SPLToken2022ExtensionsProgram.harvestWithheldTokensToMint constructor

SPLToken2022ExtensionsProgram.harvestWithheldTokensToMint({
  1. required SolAddress mint,
  2. required List<SolAddress> sources,
  3. SolAddress programId = SPLTokenProgramConst.token2022ProgramId,
})

Permissionless instruction to transfer all withheld tokens to the mint.

Implementation

factory SPLToken2022ExtensionsProgram.harvestWithheldTokensToMint(
    {
    /// The mint.
    required SolAddress mint,

    /// The source accounts to harvest from.
    required List<SolAddress> sources,
    SolAddress programId = SPLTokenProgramConst.token2022ProgramId}) {
  if (programId == SPLTokenProgramConst.tokenProgramId) {
    throw const MessageException("Token program does not support extensions");
  }
  return SPLToken2022ExtensionsProgram(
      keys: [mint.toWritable(), ...sources.map((e) => e.toWritable())],
      programId: programId,
      layout: SPLToken2022HarvestWithheldTokensToMintLayout());
}