4

I'm currently trying to initialize a selling resource and can't get past the masterEdition attribute.

enter image description here

Whenever I try to fetch the masterEdition PDA using the referenced seeds [“metadata”, tokenMetadataProgramID, resource_mint, “edition”] I get following error: TypeError: Max seed length exceeded

This is a snippet of the code I'm using:

  const [masterEdition] = await PublicKey.findProgramAddress(
    [
      Buffer.from('metadata'),
      Buffer.from('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'),
      Buffer.from('5JdQ2GsY5dKeGtAw941bb8Kp5UKi3yZV2PkMfjyHX35a'),
      Buffer.from('edition')
    ],
    toPublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s')
  )

I'm assuming the error it's because the seed is to long but how can I do if that's the required seed? Any help is appreciated, thanks in advance.

1 Answer 1

3

use this

PublicKey.findProgramAddress(
          [
            Buffer.from("metadata"),
            TOKEN_METADATA_PROGRAM_ID.toBuffer(),
            mint.toBuffer(),
            Buffer.from("edition"),
          ],
          TOKEN_METADATA_PROGRAM_ID
        )

Buffer.from()is only used for strings, for pubkeys use toBuffer()

0

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.