SPLTokenProgram.initializeAccount2 constructor
SPLTokenProgram.initializeAccount2({
- required SPLTokenInitializeAccount2Layout layout,
- required SolAddress account,
- required SolAddress mint,
- SolAddress programId = SPLTokenProgramConst.tokenProgramId,
Like InitializeAccount, but the owner pubkey is passed via instruction data rather than the accounts list. This variant may be preferable when using Cross Program Invocation from an instruction that does not need the owner's AccountInfo otherwise.
Implementation
factory SPLTokenProgram.initializeAccount2(
{required SPLTokenInitializeAccount2Layout layout,
/// The account to initialize.
required SolAddress account,
/// The mint this account will be associated with.
required SolAddress mint,
SolAddress programId = SPLTokenProgramConst.tokenProgramId}) {
return SPLTokenProgram(
layout: layout,
keys: [
account.toWritable(),
mint.toReadOnly(),
SystemProgramConst.sysvarRentPubkey.toReadOnly(),
],
programId: programId);
}