kevinheavey / solders

A high-performance Python toolkit for Solana, written in Rust
https://kevinheavey.github.io/solders/
Apache License 2.0
232 stars 26 forks source link

Unable to import metaplex metadata program PublicKey #46

Closed GabrielePicco closed 1 year ago

GabrielePicco commented 1 year ago

Hi, I'm unable to import the metaplex metadata program PublicKey

How to reproduce

from solders.pubkey import Pubkey
Pubkey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s")

Error:

ValueError: expected a sequence of length 32 (got 43)

kevinheavey commented 1 year ago

This is because you should use Pubkey.from_string for this. Btw I strongly recommend running a type checker such as mypy 😅

GabrielePicco commented 1 year ago

Makes total sense, thanks. Closing as not relevant.

GabrielePicco commented 1 year ago

@kevinheavey some of the examples in the anchorpy documentation may be outdated, I noticed that some don't use Pubkey.from_string. I will open a PR.