SPLTokenProgram.initializeAccount constructor
SPLTokenProgram.initializeAccount({
- required SolAddress account,
- required SolAddress mint,
- required SolAddress owner,
- SolAddress programId = SPLTokenProgramConst.tokenProgramId,
Initializes a new account to hold tokens. If this account is associated with the native mint then the token balance of the initialized account will be equal to the amount of SOL in the account. If this account is associated with another mint, that mint must be initialized before this command can succeed.
Implementation
factory SPLTokenProgram.initializeAccount(
{
/// The account to initialize.
required SolAddress account,
/// The mint this account will be associated with.
required SolAddress mint,
/// The new account's owner/multisignature.
required SolAddress owner,
SolAddress programId = SPLTokenProgramConst.tokenProgramId}) {
return SPLTokenProgram(
layout: SPLTokenInitializeAccountLayout(),
keys: [
account.toWritable(),
mint.toReadOnly(),
owner.toReadOnly(),
SystemProgramConst.sysvarRentPubkey.toReadOnly(),
],
programId: programId);
}