vanish, signMessage, broadcast, and commit helpers defined there. There is no deposit step - the funds are advanced from Vanish’s trading accounts.
Open a Position
A position advances funds from Vanish’s trading accounts into a one-time wallet and runs your own instructions against them in the same transaction.1
Get a one-time wallet for the position
smart_wallet_id against the position. Unlike a trade wallet, this one is reused for every lending action on this position.2
Build your instructions
Assemble your own deposit or open instructions into a single unsigned transaction, with the position’s one-time wallet as signer and fee payer.
3
Open the position and commit
Settle the Position
Settling returns the advanced funds and, withcleanup_leftover_sol set, closes the position. Build main_tx exactly as in the step above - unsigned, with the position’s one-time wallet as signer - using your own withdraw or close instructions.
Before Going Live
Work through the Integration pages to complete your integration, and verify:- Every field in your
/trade/create,/borrow/initiate, and/borrow/settlerequests is correct, includingsplit_repay,loan_additional_sol, andcleanup_leftover_sol - Your signing format matches the exact message for each endpoint, and the value order is right -
timestampis second from last on trade and lending, last on withdraw and settle - You’re fetching a fresh one-time wallet for every trade, and reusing the position’s wallet across lending actions
- Your transactions are unsigned before submission, timestamps are in milliseconds, and signatures are base64
- You handle every commit status, and poll with the original
tx_idrather than creating a new transaction - You call
/account/pendingand/borrow/pendingon startup to catch anything uncommitted - You understand the same-wallet-in, same-wallet-out rule for withdrawals
Next Steps
- Lending - The full reference for the lending and settle flows, and reading position state.
- Trade - Fund a balance and execute a private trade.
- Error Handling - Commit statuses and recovering interrupted flows.
