提取资金

在 Withdraw Program 上销毁用户的通道侧代币余额,以标记 待处理的提款;操作员随后必须调用 Escrow Program 上的 ReleaseFunds 以完成结算。

账户

账户可写签名者描述
user✓发起提款的代币所有者
mint✓SPL 代币铸造账户(销毁对象)
token_account✓用户的通道侧 token account(来源)
token_programSPL Token Program
associated_token_programAssociated Token Program

参数

参数类型描述
amountu64提取的代币数量,以代币最小单位计
destinationOption<Pubkey>主网上的目标钱包;若为 None,则默认为签名者的钱包

返回值

返回一个 TransactionBuilder,可用于构建并发送 交易。

示例

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
});

重要说明

  • 此指令属于 Withdraw Program (J231K9UEpS4y4KAPwGc4gsMNCjKFRMYcQBcjVW7vBhVi 开发网),而非 Escrow Program
  • 在通道侧销毁代币不会自动释放 主网上的资金;操作员随后必须携带有效的 SMT 排除证明调用 Escrow Program 上的 ReleaseFunds
  • 若 amount 为 0,将抛出 ZeroAmount 错误
  • 若 destination 为 None,操作员的 ReleaseFunds 调用将把 资金释放至签名者的钱包

有关两个程序的完整错误代码参考,请参阅 Instructions -> Error Codes。

Is this page helpful?

Table of Contents

Edit Page
©️ 2026 Solana 基金会版权所有