0

I have created a new SPLToken on DevNet and added the following account - 2ePFwPK3coTPqzirUaM9fugKnQL1V6zQp5TbPmopipiH

I am trying to add the metadata to the newly created SPL Token using the following command.

spl-token initialize-metadata 2ePFwPK3coTPqzirUaM9fugKnQL1V6zQp5TbPmopipiH NALA NALA ipfs://QmVmSfUfY36NtjgR621FhWQUwrsDt9Uif2ymvpt5rA4dEx

It is throwing the following error.

Error: Program(InvalidAccountData)

Could you please guide me to understand this issue.

1 Answer 1

1

Since you're using the spl-token CLI, then the metadata that you're trying to create is specific to spl-token-2022.

To create the metadata then, you first need to create a mint with spl-token-2022 using the --enable-metadata flag:

$ spl-token --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb create-token --enable-metadata

After that, you can initialize the metadata:

$ spl-token initialize-metadata <MINT_ADDRESS> MyTokenName TOKEN http://my.token

But be sure to use a mint address. In your case, 2ePFwPK3coTPqzirUaM9fugKnQL1V6zQp5TbPmopipiH is a user's token account, and FgWD6aipxESGpEAdm4fBCipMMiV38TQfWbR5Lree6LkN is the mint account.

More information at https://spl.solana.com/token-2022/extensions#metadata

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.