feat(mobile): send — build, sign, submit + poll - #589
Conversation
Add the send screen and its transaction flow. `lib/sendPayment.ts` ports the web send path: a classic G… recipient goes through a Horizon native payment; a C… contract goes through the native-SAC transfer over Soroban RPC — simulate, assemble, sign, submit, then poll getTransaction to a terminal status (success returns the hash, failure/timeout throw). `app/send.tsx` drives it with recipient/amount inputs and authorizing → submitting → done (tx hash) / error states. The signer that authorizes and pays is injected as WalletSigner, so the flow stays testable and free of native code. Its one native dependency — the passkey-derived key, whose secret is never persisted (see backup.ts) — is isolated behind requireSigner in `lib/signer.ts`, which fails closed with a typed SignerUnavailableError until the mobile passkey module is wired. Swapping in a real signer there is the only change needed to confirm payments on testnet. Closes Miracle656#465
|
@kaylachi is attempting to deploy a commit to the miracle656's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@kaylachi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Heads-up before this can land: |
Summary
Implements the send flow (backlog #37 / #465): build the transfer, authorize it, submit, and poll for the result. Two destinations, mirroring the web send path (
frontend/wallet/app/send/page.tsx,lib/sorobanTx.ts):G…recipient → a Horizon native XLM payment.C…contract recipient → a native-SACtransferover Soroban RPC: simulate → assemble → sign → submit → pollgetTransactionto a terminal status (success returns the hash; failure/timeout throw).Added
lib/sendPayment.ts—sendPayment(recipient, amount, signer)plus the pure pieces it's built from:validateSend,isClassicAddress,toStroops, andpollForResult(injectable clock).app/send.tsx— recipient + amount inputs with authorizing → submitting → done (tx hash) / error states.lib/signer.ts— the signer seam.The passkey signer
The signer that authorizes and pays is injected as
WalletSigner, keeping the flow testable and free of native code. Its one native dependency is the passkey-derived key — and on this wallet the signer secret is never persisted (seelib/backup.ts, which refuses secret material); it must be produced live from the device passkey. React Native has no passkey/WebAuthn module wired yet, sorequireSigner()fails closed with a typedSignerUnavailableError(consistent with the existing mobile-port stubs, e.g.bulk-payout). The rest of the flow is complete — returning a real signer from that one function is all that's needed to confirm payments on testnet.Testing
tsc --noEmit✅jest lib/__tests__/sendPayment.test.ts✅ (10/10 — validation, address classification, stroop conversion, and the poll's success / failure / timeout terminal handling)Closes #465