SPLToken2022ExtensionsProgram.withdrawWithheldTokensFromAccounts constructor
SPLToken2022ExtensionsProgram.withdrawWithheldTokensFromAccounts({
- required SolAddress mint,
- required SolAddress destination,
- required SolAddress authority,
- required List<
SolAddress> sources, - SolAddress programId = SPLTokenProgramConst.token2022ProgramId,
- List<
SolAddress> multiSigners = const [],
Transfer all withheld tokens to an account. Signed by the mint's withdraw withheld tokens authority.
Implementation
factory SPLToken2022ExtensionsProgram.withdrawWithheldTokensFromAccounts(
{
/// The token mint.
required SolAddress mint,
/// The fee receiver account.
required SolAddress destination,
/// The mint's withdraw withheld authority.
required SolAddress authority,
/// The source accounts to withdraw from.
required List<SolAddress> sources,
SolAddress programId = SPLTokenProgramConst.token2022ProgramId,
List<SolAddress> multiSigners = const []}) {
if (programId == SPLTokenProgramConst.tokenProgramId) {
throw const MessageException("Token program does not support extensions");
}
return SPLToken2022ExtensionsProgram(
keys: [
...SPLTokenUtils.buildKeys(
keys: [mint.toWritable(), destination.toWritable()],
owner: authority,
multiSigners: multiSigners),
...sources.map((e) => e.toWritable())
],
programId: programId,
layout: SPLToken2022WithdrawWithheldTokensFromAccountsLayout(
numTokenAccounts: sources.length));
}