Withdraw Program 上でユーザーのチャネル側トークン残高をバーンし、保留中の引き出しを通知します。その後、オペレーターが Escrow Program の ReleaseFunds を呼び出して決済を完了する必要があります。
アカウント
| アカウント | 書き込み可能 | 署名者 | 説明 |
|---|---|---|---|
user | ✓ | 引き出しを開始するトークンオーナー | |
mint | ✓ | SPL トークンミント(バーン対象) | |
token_account | ✓ | ユーザーのチャネル側 token account(送信元) | |
token_program | SPL Token Program | ||
associated_token_program | Associated Token Program |
パラメーター
| パラメーター | 型 | 説明 |
|---|---|---|
amount | u64 | 引き出すトークンの量(トークンの最小単位で指定) |
destination | Option<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});
重要な注意事項
- この instructions は Withdraw Program
(
J231K9UEpS4y4KAPwGc4gsMNCjKFRMYcQBcjVW7vBhVidevnet)上にあり、Escrow Program 上にはありません - チャネル側でトークンをバーンしても、メインネット上の資金は自動的に解放されません。オペレーターが有効な SMT 除外証明とともに Escrow Program の
ReleaseFundsを呼び出す必要があります amountが 0 の場合、ZeroAmountエラーがスローされますdestinationがNoneの場合、オペレーターのReleaseFunds呼び出しにより署名者のウォレットに資金が解放されます
両プログラムの完全なエラーコードリファレンスについては、 instructions -> エラーコード を参照してください。
Is this page helpful?