Skip to content

feat(bridge): split withdrawal into request, confirm, and cancel steps#387

Open
heyolaniran wants to merge 5 commits into
lnflash:tmp/bridge-rebase-pr-readyfrom
heyolaniran:request-withdrawal-before-initiation
Open

feat(bridge): split withdrawal into request, confirm, and cancel steps#387
heyolaniran wants to merge 5 commits into
lnflash:tmp/bridge-rebase-pr-readyfrom
heyolaniran:request-withdrawal-before-initiation

Conversation

@heyolaniran
Copy link
Copy Markdown
Contributor

Summary

  • Split Bridge off-ramp into a two-step flow: bridgeRequestWithdrawal validates and stores a pending record, then bridgeInitiateWithdrawal(withdrawalId) submits to Bridge after user confirmation; bridgeCancelWithdrawalRequest cancels before submission.
  • Reuses existing pending withdrawals for the same account/amount/external account to avoid duplicate confirmation screens.
  • Adds cancelled withdrawal push notifications (EN/ES), GraphQL error mappings, Bruno requests, and updates FLOWS.md / API.md.

Breaking change

bridgeInitiateWithdrawal input changed from { amount, externalAccountId } to { withdrawalId }. Clients must call bridgeRequestWithdrawal first.

Commits

  1. feat(bridge): split withdrawal into request, confirm, and cancel steps
  2. docs(bridge): document two-step withdrawal flow in FLOWS and API
  3. chore(bruno): add GraphQL requests for bridge withdrawal flow
  4. fix(config): add external_account webhook public key to dev config
  5. chore(graphql): regenerate supergraph for bridge withdrawal mutations

Test plan

  • TEST="test/flash/unit/services/bridge/index.spec.ts test/flash/unit/app/bridge/send-withdrawal-notification.spec.ts" yarn test:unit (37 tests pass)
  • bridgeRequestWithdrawal with valid amount + verified external account returns pending withdrawal
  • Duplicate request for same amount/account reuses existing pending row
  • bridgeInitiateWithdrawal(withdrawalId) submits transfer and sets bridgeTransferId
  • bridgeCancelWithdrawalRequest(withdrawalId) marks withdrawal cancelled and sends push notification
  • Wrong-owner withdrawalId returns BridgeWithdrawalNotFoundError
  • Already-initiated withdrawal returns BridgeWithdrawalAlreadyInitiatedError
  • Bruno: run request → query → initiate/cancel flow against local GraphQL API

Introduce a two-step off-ramp flow so users review a pending withdrawal
before Bridge is called, with deduplication, cancellation, and push
notifications for the cancelled outcome.
Update bridge-integration docs to describe bridgeRequestWithdrawal,
bridgeInitiateWithdrawal(withdrawalId), and bridgeCancelWithdrawalRequest.
Add Bruno mutations and query for request, initiate, cancel, and fetch
pending withdrawal, with local env vars for bridgeWithdrawalId.
Required by the Bridge webhook schema so local write-sdl and config
validation succeed.
Add bridgeRequestWithdrawal, bridgeCancelWithdrawalRequest, and
bridgeWithdrawalRequest to the federated supergraph schema.
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.

1 participant