MetaplexTokenMetaDataProgram.utilize constructor
MetaplexTokenMetaDataProgram.utilize({
- required SolAddress metadata,
- required SolAddress tokenAccount,
- required SolAddress mint,
- required SolAddress useAuthority,
- required SolAddress owner,
- required MetaplexTokenMetaDataUtilizeLayout layout,
- SolAddress tokenProgram = SPLTokenProgramConst.tokenProgramId,
- SolAddress ataProgram = AssociatedTokenAccountProgramConst.associatedTokenProgramId,
- SolAddress systemProgram = SystemProgramConst.programId,
- SolAddress rent = SystemProgramConst.sysvarRentPubkey,
- SolAddress? useAuthorityRecord,
- SolAddress? burner,
Implementation
factory MetaplexTokenMetaDataProgram.utilize({
required SolAddress metadata,
required SolAddress tokenAccount,
required SolAddress mint,
required SolAddress useAuthority,
required SolAddress owner,
required MetaplexTokenMetaDataUtilizeLayout layout,
SolAddress tokenProgram = SPLTokenProgramConst.tokenProgramId,
SolAddress ataProgram =
AssociatedTokenAccountProgramConst.associatedTokenProgramId,
SolAddress systemProgram = SystemProgramConst.programId,
SolAddress rent = SystemProgramConst.sysvarRentPubkey,
SolAddress? useAuthorityRecord,
SolAddress? burner,
}) {
if (burner != null) {
if (useAuthorityRecord == null) {
throw const SolanaPluginException(
"When providing 'burner' then 'accounts.useAuthorityRecord' need(s) to be provided as well.");
}
}
return MetaplexTokenMetaDataProgram(keys: [
metadata.toWritable(),
tokenAccount.toWritable(),
mint.toWritable(),
useAuthority.toSignerAndWritable(),
owner.toReadOnly(),
tokenProgram.toReadOnly(),
ataProgram.toReadOnly(),
systemProgram.toReadOnly(),
rent.toReadOnly(),
if (useAuthorityRecord != null) useAuthorityRecord.toWritable(),
if (burner != null) burner.toReadOnly()
], programId: MetaplexTokenMetaDataProgramConst.programId, layout: layout);
}