SPLTokenProgram.transferChecked constructor

SPLTokenProgram.transferChecked({
  1. required SPLTokenTransferCheckedLayout layout,
  2. required SolAddress source,
  3. required SolAddress mint,
  4. required SolAddress destination,
  5. required SolAddress owner,
  6. SolAddress programId = SPLTokenProgramConst.tokenProgramId,
  7. List<SolAddress> multiSigners = const [],
})

Transfers tokens from one account to another either directly or via a delegate. If this account is associated with the native mint then equal amounts of SOL and Tokens will be transferred to the destination account.

This instruction differs from Transfer in that the token mint and decimals value is checked by the caller.

Implementation

factory SPLTokenProgram.transferChecked({
  required SPLTokenTransferCheckedLayout layout,

  /// The source account.
  required SolAddress source,

  /// The token mint.
  required SolAddress mint,

  /// The destination account.
  required SolAddress destination,

  /// The source account's owner/delegate.
  required SolAddress owner,
  SolAddress programId = SPLTokenProgramConst.tokenProgramId,

  /// Multisignature owner/delegate
  List<SolAddress> multiSigners = const [],
}) {
  return SPLTokenProgram(
      layout: layout,
      keys: SPLTokenUtils.buildKeys(keys: [
        source.toWritable(),
        mint.toReadOnly(),
        destination.toWritable(),
      ], owner: owner, multiSigners: multiSigners),
      programId: programId);
}