2

The first field for the MetadataAccount struct is key which is commented as being the account discriminator.

What is MPL token metadata using this field for?

1 Answer 1

3

The MPL Token Metadata program works with several types of accounts not just the Metadata Account, so it needs a simple way to determine what type a certain account is.

One common pattern to do this is to use a field as a discriminator that works as a key/id that represents the type. Anchor does the same thing under the hood and the documentation explains the benefits of this approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.