자금 인출

Withdraw Program에서 사용자의 채널 측 토큰 잔액을 소각하여 대기 중인 인출을 신호합니다. 이후 운영자는 에스크로 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
});

중요 참고 사항

  • 이 명령어는 에스크로 Program이 아닌 Withdraw Program (J231K9UEpS4y4KAPwGc4gsMNCjKFRMYcQBcjVW7vBhVi 데브넷)에 있습니다
  • 채널 측에서 토큰을 소각해도 메인넷에서 자금이 자동으로 해제되지는 않습니다. 운영자는 이후 유효한 SMT 배제 증명과 함께 에스크로 Program에서 ReleaseFunds를 호출해야 합니다
  • amount가 0이면 ZeroAmount 오류가 발생합니다
  • destination이 None이면 운영자의 ReleaseFunds 호출 시 서명자의 지갑으로 자금이 해제됩니다

두 프로그램의 전체 오류 코드 참조는 Instructions -> Error Codes를 참조하세요.

Is this page helpful?

목차

페이지 편집