Skip to content

feat: add confirmSend RPC#76

Merged
stanleyyconsensys merged 24 commits into
mainfrom
feat/confirm-send
May 28, 2026
Merged

feat: add confirmSend RPC#76
stanleyyconsensys merged 24 commits into
mainfrom
feat/confirm-send

Conversation

@stanleyyconsensys
Copy link
Copy Markdown
Collaborator

@stanleyyconsensys stanleyyconsensys commented May 21, 2026

Explanation

Adds a new confirmSend client-request/RPC flow for Stellar “Unified Non‑EVM Send”, including a dedicated confirmation UI and handler wiring so a client can validate, confirm, sign, submit, and track a send transaction.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@stanleyyconsensys stanleyyconsensys changed the title Feat/confirm send feat: add confirmSend RPC May 22, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new confirmSend client-request/RPC flow for Stellar “Unified Non‑EVM Send”, including a dedicated confirmation UI and handler wiring so a client can validate, confirm, sign, submit, and track a send transaction.

Changes:

  • Introduces ConfirmSendHandler and JSON-RPC structs/types for confirmSend, plus unit tests.
  • Adds a new confirmation view (ConfirmSendTransaction) and user-input event handlers to resolve confirm/cancel.
  • Updates routing/wiring (controller, context, dev-site) to expose and exercise stellar_confirmSend.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/snap/src/ui/confirmation/views/ConfirmSendTransaction/events.tsx Adds user-input handlers + form names for the confirm/cancel buttons.
packages/snap/src/ui/confirmation/views/ConfirmSendTransaction/ConfirmSendTransaction.tsx Implements the confirmation UI for send transactions (to/from/amount/network/fees).
packages/snap/src/ui/confirmation/utils.ts Adds getAccountExplorerUrl and updates fee formatting to use toDisplayBalance.
packages/snap/src/ui/confirmation/controller.tsx Registers the new confirmation interface key as a fee-bearing dialog and renders the new view.
packages/snap/src/ui/confirmation/api.ts Adds ConfirmSendTransaction to ConfirmationInterfaceKey.
packages/snap/src/index.ts Routes dev-only stellar_confirmSend (and related methods) through clientRequestHandler.
packages/snap/src/handlers/user-input/userInput.ts Registers the new confirm-send UI event handlers.
packages/snap/src/handlers/clientRequest/onAmountInput.ts Consumes coerced scope from request params rather than deriving it in-handler.
packages/snap/src/handlers/clientRequest/onAmountInput.test.ts Updates tests for new scope derivation + adds additional assertions.
packages/snap/src/handlers/clientRequest/confirmSend.ts New handler: builds validated send tx, renders confirmation UI, signs, submits, saves pending tx, schedules tracking.
packages/snap/src/handlers/clientRequest/confirmSend.test.ts Adds unit tests covering success, rejection, and error mappings.
packages/snap/src/handlers/clientRequest/api.ts Adds ConfirmSend method + request/response structs; coerces scope and accountId.
packages/snap/src/handlers/clientRequest/api.test.ts Adds request/response struct tests for confirmSend; updates onAmountInput coercion tests.
packages/snap/src/context.ts Wires ConfirmSendHandler into the client request method map.
packages/site/src/pages/index.tsx Adds a dev-dapp card/workflow to validate address/amount and call stellar_confirmSend.
Comments suppressed due to low confidence (1)

packages/snap/src/ui/confirmation/views/ConfirmSendTransaction/events.tsx:25

  • The JSDoc says the handler context is from confirmSend, but these UI event handlers are invoked via the Snap onUserInput entrypoint. Consider updating the reference to onUserInput for consistency and accuracy.
 * Handles the click event for the confirm button.
 *
 * @param options - The user input handler context from `confirmSend`.
 * @returns A promise that resolves when the interface has been updated.
 */

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/snap/src/handlers/clientRequest/confirmSend.ts
Comment thread packages/snap/src/handlers/clientRequest/confirmSend.ts Outdated
Comment thread packages/snap/src/handlers/clientRequest/api.ts Outdated
Comment on lines +8 to +12
* Handles the click event for the cancel button.
*
* @param options - The user input handler context from `confirmSend`.
* @returns A promise that resolves when the interface has been updated.
*/
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it is make sense and correct

@stanleyyconsensys stanleyyconsensys marked this pull request as ready for review May 22, 2026 00:57
@stanleyyconsensys stanleyyconsensys requested a review from a team as a code owner May 22, 2026 00:57
}

const transaction =
await this.#transactionService.createValidatedSendTransaction({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We build and validate the send tx before the confirmation dialog, then sign that same envelope after the user clicks Confirm. If they wait on the dialog, sequence/balance/fees can change. Can we move createValidatedSendTransaction to after confirm (or rebuild + re-validate right before sign)?

Copy link
Copy Markdown
Collaborator Author

@stanleyyconsensys stanleyyconsensys May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats good idea, but it will invalid the idea that u sign what you are seeing (fee change)

like sol / btc, they didnt do that too
created a spike in JIRA https://consensyssoftware.atlassian.net/browse/NEB-1259 to discuss

});

const ConfirmSendParamsStruct = object({
fromAccountId: UuidStruct,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small API nit: onAmountInput uses accountId, confirmSend uses fromAccountId. Can we align on one name across the send flow?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can not, it is shared across all non-evm, they using that name


wallet.signTransaction(transaction);
// refresh the account to get the latest balance and sequence to validate the transaction.
const finalizedTransaction =
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will regenerate the txn with latest

fee
account sequence
validation with latest account state (include sep41 balance)

This reverts commit b86ddd4.
@stanleyyconsensys stanleyyconsensys merged commit 25f0b4a into main May 28, 2026
10 checks passed
@stanleyyconsensys stanleyyconsensys deleted the feat/confirm-send branch May 28, 2026 14:27
@stanleyyconsensys
Copy link
Copy Markdown
Collaborator Author

Follow up:

Adding transaction refresh if transaction confirm it is necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants