Skip to main content
Continues from Setup, using the vanish, signMessage, broadcast, and commit helpers defined there, and the balance you funded at the end of it.

Execute a Trade

Vanish wraps your swap instructions - it does not build the route itself. Fetch an unsigned transaction from your DEX aggregator of choice and pass it to POST /trade/create.
Critical: set the one-time wallet as the transaction signer - not the user’s wallet. Pass it wherever your aggregator asks for the signing wallet or user public key.
1

Get a one-time wallet and build the swap

Jupiter is an example - any aggregator works, as long as it returns an unsigned transaction with the one-time wallet as signer.
2

Create the trade and commit

/commit must be called for every transaction - success, failure, or expiry. Check /account/pending whenever a user loads their account, so nothing is left uncommitted.
Adding prefer_non_jito makes Vanish hand back a signed transaction instead of submitting one itself. You broadcast it, and the signature your RPC returns is what you commit - not trade.tx_id. See Routing Options.

Check Balances

Sign read:{timestamp} and send it as signature. The same signature is accepted for 24 hours, so you can reuse it across polls. See POST /account/balances for the full reference.

Next Steps

  • Lend - Open a position against the same funded balance, then settle it.
  • Trading - The full reference for the trade flow, including routing guidance.
  • Error Handling - Commit statuses and recovering interrupted flows.