1. Discover the deployment and tokens
id values from the response. They must be canonical C-strkeys, not symbols. Read the input token’s decimals and convert the amount into an integer string.
2. Request pricing
Set the shell variables to the selected contract IDs and raw input amount:amountOut, the expected output after swap fees. Use atomic strings for calculations. Human-readable numeric fields are for display.
3. Requote for execution
Ask the user to choose slippage and connect their wallet. Add the sender and explicit tolerance to a fresh quote:0.01 means 1% slippage. A live freshness check can reject a stale snapshot; retry after it catches up.
4. Inspect, sign, and confirm
For a single transaction, inspecttransaction.envelopeXdr, the network, router, input, and minimum output. When transaction.simulated is true, the server has populated the source account’s current sequence + 1 and prepared Soroban resources, fees, and authorizations: sign through your wallet and submit through Stellar RPC. When it is false, populate the sequence and prepare resources first. Wait for successful execution. Request a new quote if another transaction uses the same source account before submission.
If the response contains transactions[], follow the ordered plan procedure. If you are composing with lending, use the opaque route payload and simulate the outer transaction instead.
Integration checklist · Quote phases · Troubleshooting
