ixWrapperWithdrawFunds instruction withdraws trading balances from your orderbook escrow.
When you post an order, tokens enter the escrow. As orders fill, balances shift between token types (e.g., SY becomes YT on a filled BuyYT). After removing unfilled orders, the remaining balances become withdrawable. Use this instruction to transfer PT, YT, and SY from your escrow to your wallet.
Staged interest from YT accrual is not included in these balances. Collect it separately with ixWrapperCollectInterest.
Usage
Required Parameters
| Parameter | Type | Description |
|---|---|---|
trader | PublicKey | The trader’s wallet public key |
mintSy | PublicKey | The SY token mint address |
ptAmount | Amount | Amount of PT tokens to withdraw |
ytAmount | Amount | Amount of YT tokens to withdraw |
syAmount | Amount | Amount of SY tokens to withdraw |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
ptSrc | PublicKey | PT token source account |
ytSrc | PublicKey | YT token source account |
sySrc | PublicKey | SY token source account |
tokenBaseTrader | PublicKey | Base token account for the trader |
Amount Helper
Theamount helper from @exponent-labs/exponent-sdk creates the discriminated union used for withdrawal amounts:
Returns
Returns aTransactionInstruction that executes the withdraw call.
Checking Withdrawable Funds
Before withdrawing, you can check the available balances usinggetUserBalances: