TransactionEnvelope.
Prerequisites
| Requirement | Why |
|---|---|
| Stellar wallet or signer | The Aggregator returns an envelope; it does not sign for the user. |
| Token metadata | Amounts are raw atomic unit strings. |
| Execution plane decision | Soroban and Classic routes are not interchangeable. |
| Submission path | Use your Stellar RPC or wallet flow after signing. |
Flow
Load token metadata
Call
/api/v1/tokens and store the canonical id, decimals, kind, and sacPeer.Choose the execution plane
Use
platform=aggregator for Soroban composition. Use platform=all only when a direct-user UI can accept either plane.Quote for display
Call
/api/v1/quote without sender for price display.Requote with sender at confirmation
Pass
sender to receive transaction.envelopeXdr. Keep simulate=true unless your client prepares Soroban resources itself.Implementation Checklist
| Check | Required handling |
|---|---|
| Token alias selected | Store the returned canonical id; aliases can resolve differently across snapshots. |
| Contract-to-contract flow | Use platform=aggregator. |
| Direct-user comparison | Use platform=all, then inspect the returned platform. |
simulate=true | Do not rerun simulateTransaction on the prepared envelope. |
simulate=false | Your client must simulate and prepare resources before signing. |
HTTP 409 | Snapshot freshness gate failed; retry after the snapshot catches up. |
HTTP 422 | Budget, referral, or simulation failure; lower maxSplits or maxHops, or fix referral config. |
Minimal TypeScript Shape
Verify Before Signing
- The selected token has
degree > 0in/api/v1/tokens. - Amounts are raw atomic unit strings.
platformmatches the flow you can execute.transaction.envelopeXdris present.simulatedistruewhen you rely on the server-prepared Soroban footprint.- The quote was requested after the latest user change to token, amount, sender, slippage, or platform.

