I'm trying to get the account data using Rust and the solana_sdk.I have the following code where account.data is a Vec.
let pubkey = Pubkey::from_str("...").unwrap(); let account = client.get_account(&pubkey).unwrap(); println!("{:?}", account.data); enter code here
When trying to decode the byte array:
let data = String::from_utf8(account.data).unwrap();
I get an error:
error: Utf8Error { valid_up_to: 1, error_len: Some(1) } }
How can I decode account data using Rust?