Vault
The vault is an optional on-chain token custody mechanism. Orders prepared via the HTTP API default to fundingSource: "wallet", which pulls tokens directly from the caller's wallet when the order is placed (up front, not at a later fill) via the pool's auto-pull flow (needs a prior ERC-20 approval to the SpotPool contract, or msg.value on native pools). Wallet auto-pull supports all order types, including resting GTC / PostOnly.
To use the vault instead, deposit tokens first and then set fundingSource: "vault" when placing orders. The vault flow is:
- Approve the pool contract to spend your tokens.
- Deposit them into the vault.
- Place orders funded from the vault balance.
Vault-funded orders support all order types including resting limit orders.
Reading a native SOMI balance directly on-chain. When you call the vault's
getWithdrawableBalance(owner, token)contract method for native SOMI, pass the sentinel0x28f34DeFd2b4CB48d9eE6d89f2Be4Bc601694c00(theNATIVE_TOKENconstant), notaddress(0)- the latter returns0and makes funds look missing. The HTTPvault/balanceendpoint below abstracts this away. SeegetWithdrawableBalance.