1

I am trying to get the PDA for a mint account in order to get NFT metadata. I am using solana-py library.

from solana import publickey

pda = publickey.PublicKey("AHZdk7qrX16vpw4oQgDcyhAR3SJtNS28epaznGrAvFxs").find_program_address(
seeds=[b"metadata"], program_id=publickey.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"))

But I am getting the following error:

...site-packages\solana\publickey.py", line 87, in find_program_address raise NotImplementedError("find_program_address not implemented") NotImplementedError: find_program_address not implemented

What is it wrong?

EDIT 1:

Watched some code and try this but still not working

from solana.publickey import PublicKey

METADATA_PROGRAM_ID = PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s')
mint_key = "8Rjxaxy8ZNAGTojzQSAMSPatNiop9C9PRPY5A29qhrCT"

PDA = PublicKey.find_program_address(
        [b'metadata', bytes(METADATA_PROGRAM_ID), bytes(PublicKey(mint_key))],
        METADATA_PROGRAM_ID
    )[0]

print(PDA)

EDIT 2:

It was the version of solana-py It was using! Is working now

2 Answers2

1

find_program_address is only defined on the class not on instances of it. try calling PublicKey.find_program_address

  • Hey thanks for answering. I try it but still getting same error! `from solana.publickey import PublicKey METADATA_PROGRAM_ID = PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s') mint_key = "8Rjxaxy8ZNAGTojzQSAMSPatNiop9C9PRPY5A29qhrCT" PDA = PublicKey.find_program_address( [b'metadata', bytes(METADATA_PROGRAM_ID), bytes(PublicKey(mint_key))], METADATA_PROGRAM_ID )[0] print(PDA)` – CryptoTioSam Jan 30 '22 at 15:54
1
METADATA_PROGRAM_ID = PublicKey('cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ')    
PDA = PublicKey.find_program_address(
  [b'candy_machine',  bytes(PublicKey(mint_key))],
  METADATA_PROGRAM_ID
)[0]
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Daniru
  • 11
  • 2