-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
Description
Context
Every write (create raffle, buy ticket, refund) follows: simulate tx → estimate fee → build XDR → request wallet signature → submit → poll confirmation. Centralize this in the SDK so modules don't duplicate logic.
Goal
- Implement a shared flow (e.g. in ContractService or a TxLifecycleService): given a built transaction, (1) simulate to get result and fee; (2) set fee (and optional resource fees); (3) get signature from WalletAdapter; (4) submit to RPC; (5) poll until confirmed or timeout.
- Return tx hash and optionally ledger; throw or return error on simulation failure, user reject, or submission failure.
Contributor guide
- Directory:
sdk/ - In contract.service.ts or a new tx-lifecycle.service.ts: implement simulate(), then build final tx with fee, call wallet.signTransaction(xdr), then submit and poll getTransaction until success/failure.
- Use Stellar SDK for simulation and submission; handle Soroban-specific response format.
- Raffle and ticket services should use this for every write; read-only calls can use simulate without signing.
References
- ARCHITECTURE.md — Transaction Lifecycle (internal).
Reactions are currently unavailable