Skip to main content
Use getUserBalances to check what funds are available in your orderbook escrow and understand how to access each type.

Usage

import { PublicKey } from "@solana/web3.js";

const balances = orderbook.getUserBalances(wallet.publicKey);

// These can be withdrawn directly with ixWrapperWithdrawFunds
console.log("Withdrawable PT:", balances.pt);
console.log("Withdrawable YT:", balances.yt);
console.log("Withdrawable SY:", balances.sy);

// This requires ixWrapperCollectInterest first
console.log("Staged interest (collect separately):", balances.staged);

// This is locked in active sell orders
console.log("Staked YT (in open orders):", balances.stakedYt);

Understanding Each Balance

FieldWithdrawable?How to Access
ptYesixWrapperWithdrawFunds with ptAmount
ytYesixWrapperWithdrawFunds with ytAmount
syYesixWrapperWithdrawFunds with syAmount
stagedNoUse ixWrapperCollectInterest to transfer to your wallet
stakedYtNoRemove the sell order first with ixWrapperRemoveOffer
stakedYt represents YT locked in active sell orders. Remove those orders first with ixWrapperRemoveOffer — the YT will move to yt, which is then withdrawable.
staged interest must be collected via ixWrapperCollectInterest — it cannot be withdrawn with ixWrapperWithdrawFunds. Interest is paid in SY tokens.

Parameters

ParameterTypeDescription
userPublicKeyThe trader’s wallet public key

Returns

Returns an object with the following string fields (token amounts as strings):
  • pt — PT tokens from filled buy orders, available for withdrawal
  • yt — YT tokens from filled or removed orders, available for withdrawal
  • sy — SY tokens from filled sell orders, available for withdrawal
  • stakedYt — YT locked in active sell orders (not directly withdrawable)
  • staged — Accrued interest from YT in orders (collect separately)