Swap
Docs · 6 of 13
One transaction: the proof spends your input note, the vault sends the input to the route, the output returns to the output token's vault, and the program writes your new note from the amount the vault actually received:
C = Poseidon(mintOut, amountReceived, Poseidon(ownerKey, blinding))
A minimum output sits in the proof's external data. Below it the whole transaction reverts and your note stays unspent. The protocol fee is 0.10%.
Any token the Book holds can be swapped for any other the route trades, legacy SPL and Token-2022 on either side; the vault on each side uses its own token program.
A swap
250 USDC
SOL
Inspent; the vault sends it to the route
Outwritten from what came back
The routesees the pair and the amounts, never whose