Skip to main content
A position moves part of the user’s balance into a one-time wallet and executes your instructions from it in the same transaction, so you can deploy into any lending provider. The wallet is provisioned once and stays with the position until you settle. This page covers opening a position and settling it. Every request except the commit needs a signature - see Signing.

Open a Position

1

Get a one-time wallet for the position

POST /borrow/smart-wallet
Response
protocol_label is free-form text identifying the provider this position belongs to - any lending provider works, since your instructions are passed through unchanged. Store smart_wallet_id against the position: every later call identifies it by that, and the wallet is provisioned once, not per action.
2

Build your instructions

Assemble your provider’s deposit or open instructions into a single unsigned transaction, with the wallet address as the signer and fee payer. Base64-encode it as main_tx.Vanish appends its own instruction, signs the result, and simulates it before returning. A transaction that fails simulation is rejected rather than submitted.
3

Open the position

POST /borrow/initiate
Response
Vanish picks the route by transaction size. You either get a signed transaction to broadcast, or transaction is null and jito_bundle_id is set, meaning Vanish submitted a two-transaction bundle itself.
4

Broadcast if needed, then commit

Broadcast transaction if it is non-null; if jito_bundle_id is set instead, Vanish has already submitted it. Then commit either way:
POST /borrow/commit
Response
/borrow/commit must be called for every lending action - success, failure, or expiry. Until it is, the action stays in a pending state. Lending returns the same statuses as a trade except rejected, which applies to deposits only - see Commit Status.
The position is now open. Advancing more into it repeats these steps with the same smart_wallet_id.
Reference: Create One-Time Wallet · Open Position · Commit Lending Action

Settle a Position

Settling returns the advanced funds to Vanish’s trading accounts, wrapped around your own withdraw or close instructions. Check Position State first.
1

Settle the position

Build main_tx exactly as when opening - unsigned, with the position’s one-time wallet as signer and fee payer - using your withdraw or close instructions.
POST /borrow/settle
Settle always returns a signed transaction - there is no bundle route here, so you always broadcast it yourself.
2

Broadcast and commit

Broadcast the signed transaction through your RPC, then commit the action:
POST /borrow/commit
The response matches the commit above with action_type set to settle. Once a settle with cleanup_leftover_sol is committed, the position’s status becomes closed.
Reference: Settle Position · Commit Lending Action

Position State

POST /borrow/positions returns every one-time wallet the user holds a position in, with balances read live from on-chain. It is read-only.
Response
status is open until a settle with cleanup_leftover_sol is committed. has_active_balance is true only when the wallet holds a non-SOL token with a positive balance, so use it instead of setting your own dust threshold. Reference: Get Positions · Get Pending Lending Actions

Next Steps

  • Trading - Execute a private swap against a funded balance.
  • Error Handling - Commit statuses and recovering interrupted flows.