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