SPLTokenProgram.createNativeMint constructor
SPLTokenProgram.createNativeMint({
- required SolAddress payer,
- SolAddress nativeMintId = SPLTokenProgramConst.nativeMint2022,
- SolAddress programId = SPLTokenProgramConst.token2022ProgramId,
Creates the native mint.
Implementation
factory SPLTokenProgram.createNativeMint(
{
/// Funding account (must be a system account)
required SolAddress payer,
/// The native mint address
SolAddress nativeMintId = SPLTokenProgramConst.nativeMint2022,
SolAddress programId = SPLTokenProgramConst.token2022ProgramId}) {
if (programId == SPLTokenProgramConst.tokenProgramId) {
throw MessageException("Token program id does not support extensions");
}
return SPLTokenProgram(
layout: SPLTokenCreateNativeMintLayout(),
keys: [
payer.toSignerAndWritable(),
nativeMintId.toWritable(),
SystemProgramConst.programId.toReadOnly()
],
programId: programId);
}