SPLToken2022ExtensionsProgram.withdrawWithheldTokensFromMint constructor

SPLToken2022ExtensionsProgram.withdrawWithheldTokensFromMint({
  1. required SolAddress mint,
  2. required SolAddress destination,
  3. required SolAddress authority,
  4. SolAddress programId = SPLTokenProgramConst.token2022ProgramId,
  5. List<SolAddress> multiSigners = const [],
})

Transfer all withheld tokens in the mint to an account. Signed by the mint's withdraw withheld tokens authority.

Implementation

factory SPLToken2022ExtensionsProgram.withdrawWithheldTokensFromMint({
  /// The token mint.
  required SolAddress mint,

  /// The fee receiver account.
  required SolAddress destination,

  /// The mint's withdraw withheld authority.
  required SolAddress authority,
  SolAddress programId = SPLTokenProgramConst.token2022ProgramId,

  /// Multisignature owner/delegate
  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),
      programId: programId,
      layout: SPLToken2022WithdrawWithheldTokensFromMintLayout());
}