-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpl_token_metadata::accounts::Metadata::from_bytes() fails #68
Comments
Can you try |
That does work, at least for the ones I tried. |
how are you fetching metadata for the token? Tried using |
@taimurey See: pub fn decode_metadata(client: &RpcClient, pubkey: &Pubkey) -> Result<Metadata, DecodeError> {
let account_data = client
.get_account_data(pubkey)
.map_err(|e| DecodeError::ClientError(e.kind))?;
Metadata::safe_deserialize(&mut account_data.as_ref())
.map_err(|e| DecodeError::DecodeMetadataFailed(e.to_string()))
} |
Thanks a lot, Kartik! |
I can see this issue is till open this is how i manage to get to work, incase anyone still needs it let metadata = Metadata::find_pda(&token_a_pub);
let account_data = connection.get_account_data(&metadata.0).unwrap();
let safe_deserialize_data = Metadata::safe_deserialize(&account_data); |
I'm trying to decode some token metadata, and
mpl_token_metadata::accounts::Metadata::from_bytes()
works for most tokens, but it's failing for 2 that I've found.The raw data is encoded in base64, so I've written a function like this:
But the last line
Metadata::from_bytes(&decoded_base64).unwrap()
is panicking when I call the function with these two strings:BIujMfe1f4+f62sriKcmF5frjExh19LNVTFjEoOTb4ZALGkR7Ylov5UYZr/5UvSvSNprO4d+aL0S4JjpVvWiOb4VAAAATG9sbGFwYWxvb3phIDIwMTggQXJ0BgAAADExNDgzMxAAAABsb2xsYXBhbG9vemFhcnQzAAABAQAAAIujMfe1f4+f62sriKcmF5frjExh19LNVTFjEoOTb4ZAAWQAASAgICAgAAABAQAAAIujMfe1f4+f62sriKcmF5frjExh19LNVTFjEoOTb4ZAAWQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
If you attempt to decode these using https://www.base64decode.org/, then you'll see in the text that they correspond to
Flunk Donkey #5284
,BOB IS THE TICKER
, andLollapalooza 2018 Art
I'm using the latest version of the mpl-token-metadata crate (3.2.3) and the latest version of the base64 crate (0.21.5).
The text was updated successfully, but these errors were encountered: