getMasterEdition method

Future<MasterEdition?> getMasterEdition({
  1. required Ed25519HDPublicKey mint,
  2. Commitment commitment = Commitment.finalized,
})

Implementation

Future<MasterEdition?> getMasterEdition({
  required Ed25519HDPublicKey mint,
  Commitment commitment = Commitment.finalized,
}) async {
  final programAddress = await findMetaplexEditionProgramAddress(mint);
  final account = await getAccountInfo(
    programAddress.toBase58(),
    encoding: Encoding.base64,
    commitment: commitment,
  ).value;
  if (account == null) {
    return null;
  }

  final data = account.data;

  return data is BinaryAccountData
      ? MasterEdition.fromBorsh(Uint8List.fromList(data.data))
      : null;
}