Description
hooks/useWallet.hook.ts exposes signTransaction(xdr) via @creit.tech/stellar-wallets-kit (it returns signedTxXdr for the testnet passphrase), but there is no code anywhere that builds an XDR, submits the signed transaction, or confirms it — a repo-wide search finds signTransaction defined and never called. This issue adds the surrounding lifecycle so a signed transaction can actually be broadcast and tracked to confirmation, completing the connect-to-confirm path begun by WalletContext/useWallet.
Requirements and context
- Add a typed transaction module (e.g.
lib/stellar/transaction.ts) with a submitTransaction(signedXdr) step and a pollForConfirmation(hash) step targeting the configured network from lib/config.ts (stellar.network).
- Extend
useWallet (or add a useTransaction hook) to orchestrate build -> signTransaction -> submit -> confirm, surfacing a discriminated status (idle | signing | submitting | confirming | success | failed) and the resulting hash/error.
- Provide toast feedback via the already-wired
sonner toaster and reuse the hook's existing error reporting pattern.
- Non-functional: handle user-rejected signing, submission failures, and confirmation timeouts distinctly; never block the UI thread; do not hardcode the network passphrase (derive from config rather than the literal
WalletNetwork.TESTNET).
- Keep the change additive — existing
connectWallet/disconnectWallet behavior must not regress.
Acceptance criteria
Suggested execution
1. Fork the repo and create a branch — git checkout -b feature/wallet-tx-lifecycle.
2. Implement changes — hooks/useWallet.hook.ts (or new hooks/useTransaction.hook.ts), new lib/stellar/transaction.ts, reuse lib/config.ts and constants/wallet-kits.constant.ts.
3. Write/extend tests — Jest + React Testing Library with pnpm; add tests mocking the kit and the submit/confirm calls, asserting each status transition and failure branch. Follow the hook-testing approach used elsewhere with mocked dependencies.
4. Test and commit —
pnpm install
pnpm type-check
pnpm test
pnpm build
Example commit message
feat(wallet): add submit/confirm lifecycle and a status state machine over signTransaction
Guidelines
- Target >=85% coverage on the new transaction code paths.
- Document the transaction flow and required network config in
docs/; ensure toasts/errors are announced accessibly.
- Timeframe: 96 hours.
Description
hooks/useWallet.hook.tsexposessignTransaction(xdr)via@creit.tech/stellar-wallets-kit(it returnssignedTxXdrfor the testnet passphrase), but there is no code anywhere that builds an XDR, submits the signed transaction, or confirms it — a repo-wide search findssignTransactiondefined and never called. This issue adds the surrounding lifecycle so a signed transaction can actually be broadcast and tracked to confirmation, completing the connect-to-confirm path begun byWalletContext/useWallet.Requirements and context
lib/stellar/transaction.ts) with asubmitTransaction(signedXdr)step and apollForConfirmation(hash)step targeting the configured network fromlib/config.ts(stellar.network).useWallet(or add auseTransactionhook) to orchestrate build ->signTransaction-> submit -> confirm, surfacing a discriminated status (idle | signing | submitting | confirming | success | failed) and the resulting hash/error.sonnertoaster and reuse the hook's existingerrorreporting pattern.WalletNetwork.TESTNET).connectWallet/disconnectWalletbehavior must not regress.Acceptance criteria
lib/config.ts.Suggested execution
1. Fork the repo and create a branch —
git checkout -b feature/wallet-tx-lifecycle.2. Implement changes —
hooks/useWallet.hook.ts(or newhooks/useTransaction.hook.ts), newlib/stellar/transaction.ts, reuselib/config.tsandconstants/wallet-kits.constant.ts.3. Write/extend tests — Jest + React Testing Library with pnpm; add tests mocking the kit and the submit/confirm calls, asserting each status transition and failure branch. Follow the hook-testing approach used elsewhere with mocked dependencies.
4. Test and commit —
pnpm install pnpm type-check pnpm test pnpm buildExample commit message
Guidelines
docs/; ensure toasts/errors are announced accessibly.