Burns a user's channel-side token balance on the Withdraw Program to signal a
pending withdrawal; an operator must subsequently call ReleaseFunds on the
Escrow Program to complete settlement.
Accounts
| Account | Writable | Signer | Description |
|---|---|---|---|
user | ✓ | Token owner initiating the withdrawal | |
mint | ✓ | SPL token mint (burned against) | |
token_account | ✓ | User's channel-side token account (source) | |
token_program | SPL Token Program | ||
associated_token_program | Associated Token Program |
Parameters
| Parameter | Type | Description |
|---|---|---|
amount | u64 | Amount of tokens to withdraw, in the token's smallest unit |
destination | Option<Pubkey> | Target wallet on Mainnet; if None, defaults to the signer's wallet |
Returns
Returns a TransactionBuilder that can be used to build and send the
transaction.
Example
import { getWithdrawFundsInstruction } from "../private-channel-withdraw-program/clients/typescript/src/generated";const withdrawIx = getWithdrawFundsInstruction({user: userSigner,mint: mintAddress,tokenAccount: channelTokenAccount,tokenProgram: TOKEN_PROGRAM_ID,associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,amount: 1_000_000n,destination: null // null = release to signer's Mainnet wallet});
Important Notes
- This instruction is on the Withdraw Program
(
J231K9UEpS4y4KAPwGc4gsMNCjKFRMYcQBcjVW7vBhVidevnet), not the Escrow Program - Burning tokens on the channel side does not automatically release funds on
Mainnet; an operator must subsequently call
ReleaseFundson the Escrow Program with a valid SMT exclusion proof ZeroAmounterror is thrown ifamountis 0- If
destinationisNone, the operator'sReleaseFundscall will release funds to the signer's wallet
For the full error code reference for both programs, see Instructions -> Error Codes.
Is this page helpful?