Skip to content

Conversation

orestiseth
Copy link
Contributor

@orestiseth orestiseth commented Oct 1, 2025

Note

Introduce a unified confirm-send flow that builds PSBTs, prompts for confirmation via a new UI, signs/broadcasts via AccountUseCases, and updates handler/tests and link safety.

  • Send Flow Use Cases:
    • Add confirmSendFlow(account, amount, toAddress) to build PSBTs (uses fee estimates or fallback, supports drain when amount equals balance), present confirmation, then sign/broadcast via AccountUseCases, returning the built Transaction.
    • Extract exchange-rate fetching into a helper; reuse in refresh.
    • Inject AccountUseCases dependency and wire in src/index.ts.
  • UI/JSX:
    • New unified confirm view UnifiedSendFormView with fees/amount display and confirm/cancel; export via infra/jsx/unified-send-flow.
    • Add isValidSnapLinkProtocol and use it to guard links in ReviewTransactionView.
  • Entities/Repository:
    • Introduce ConfirmSendFormContext and SendFlowRepository.insertConfirmSendForm.
    • Implement insertConfirmSendForm in JSXSendFlowRepository.
  • RPC Handler:
    • confirmSend now delegates to SendFlowUseCases.confirmSendFlow and maps result; normalize insufficient-fee errors to validation response.
  • Tests:
    • Update RpcHandler.test to expect delegation to confirmSendFlow and new error paths; add comprehensive tests for confirmSendFlow (build, drain, fee fallback, cancellation, errors, exchange rates).
    • Add JSX repo tests for new unified view; guard link protocols.
    • Integration test: mock snap_dialog; skip insufficient-fee test due to drain behavior.
  • Misc:
    • Update snap shasum in snap.manifest.json.

Written by Cursor Bugbot for commit 9b756c3. This will update automatically on new commits. Configure here.

};

const interfaceId =
await this.#sendFlowRepository.insertUnifiedSendForm(context);

Choose a reason for hiding this comment

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

maybe this should be something like insertConfirmation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to insertConfirmSendForm to be make the relationship with confirmSend method obvious.

@orestiseth orestiseth marked this pull request as ready for review October 3, 2025 13:07
@orestiseth orestiseth requested a review from a team as a code owner October 3, 2025 13:07
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@orestiseth orestiseth changed the title Feat/confirm send improvements Feat/implement confirm send UI Oct 3, 2025
).psbt;

const parsedPsbt = parsePsbt(signedPsbt);
return account.extractTransaction(parsedPsbt);
Copy link

Choose a reason for hiding this comment

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

Bug: Type Mismatch in PSBT Parsing

In confirmSendFlow, the parsePsbt function receives a Psbt object instead of a string. After signPsbt returns a Psbt instance, it's passed directly to parsePsbt, which expects a string representation. This type mismatch causes a runtime error, preventing transaction extraction.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is wrong. On line 150 the .psbt is a string (Promise<{ psbt: string; txid?: Txid }> {.

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.

2 participants