Skip to main content
This picks up where Setup left off and uses the 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

Store 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

The funds now sit in the position’s one-time wallet, and the position is open until you settle it.

Settle the Position

Settling returns the advanced funds and, with cleanup_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/settle requests is correct, including split_repay, loan_additional_sol, and cleanup_leftover_sol
  • Your signing format matches the exact message for each endpoint, and the value order is right - timestamp is 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_id rather than creating a new transaction
  • You call /account/pending and /borrow/pending on 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.