v1 only
Every transaction the router builds is v1 (SIMD-0385, active on mainnet since slot 447,120,000). There is no v0 and no legacy form:txVersion: 0 and asLegacyTransaction: true answer 400.
Getting a transaction
The build answers instructions by default. Two ways to a transaction:- Let the router serialize it: send
"serialize": true. You getswapTransaction(base64, unsigned) andlastValidBlockHeight. The blockhash is the router’s, at most a few seconds old; send before it expires. - Assemble it yourself: put
setupInstructions, then every instruction ofswapInstructions, thencleanupInstruction, thenotherInstructions, and set the header fromtransactionConfig. Or post them toPOST /tx/v1, which serializes any instructions you give it as an unsigned v1 transaction (useful to add your own instructions).
Compute budget
transactionConfig carries what goes in the v1 header:
A limit left out of a v1 header counts as zero, not as a default: keep every field the router gives you. The compute-unit limit is sized from the route’s steps (
walkSteps in the quote); if you strip walkSteps from a quoteResponse, the build declares the maximum for those hops and you pay priority fee on it.
Priority fee
The first of these that the build body sets decides the fee:
Nothing set means no priority fee: absent is not
auto. The fee is charged on the declared compute-unit limit, not on the units the swap ends up using. costs.priorityFeeSource says where the number came from (client, chain, floor, ceiling, none).
Tips
prioritizationFeeLamports: {"jitoTipLamports": N}adds a transfer ofNlamports to a Jito tip account inotherInstructions(and no priority fee from that field).tipWallet+tipLamportstip any wallet you choose, and win over the Jito field.
What the user pays
costs estimates the lamports the transaction costs the user, as decimal strings:
rentLamports is an upper bound: it counts every account the setup creates as if the user had none of them. A user who already has the token account pays less.