createMasterEditionV3 function
Future<AnchorInstruction>
createMasterEditionV3({
- required Ed25519HDPublicKey mint,
- required Ed25519HDPublicKey updateAuthority,
- required Ed25519HDPublicKey mintAuthority,
- required Ed25519HDPublicKey payer,
- required CreateMasterEditionV3Data data,
Implementation
Future<AnchorInstruction> createMasterEditionV3({
required Ed25519HDPublicKey mint,
required Ed25519HDPublicKey updateAuthority,
required Ed25519HDPublicKey mintAuthority,
required Ed25519HDPublicKey payer,
required CreateMasterEditionV3Data data,
}) async {
final programAddress = await findMetaplexEditionProgramAddress(mint);
final metadataAccount = await findMetaplexMetadataProgramAddress(mint);
return AnchorInstruction.withDiscriminator(
programId: Ed25519HDPublicKey.fromBase58(metaplexMetadataProgramId),
discriminator: ByteArray(const [17]),
accounts: [
AccountMeta.writeable(pubKey: programAddress, isSigner: false),
AccountMeta.writeable(pubKey: mint, isSigner: false),
AccountMeta.readonly(pubKey: updateAuthority, isSigner: true),
AccountMeta.readonly(pubKey: mintAuthority, isSigner: true),
AccountMeta.writeable(pubKey: payer, isSigner: true),
AccountMeta.writeable(pubKey: metadataAccount, isSigner: false),
AccountMeta.readonly(pubKey: TokenProgram.id, isSigner: false),
AccountMeta.readonly(pubKey: SystemProgram.id, isSigner: false),
AccountMeta.readonly(
pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.rent),
isSigner: false,
),
],
arguments: ByteArray(data.toBorsh()),
);
}