How to download contents of an account in Solana?

Viewed 20

I need to download and deserialize an account with data in Solana from my javascript client. I could not find this in cookbook. Please advise.

1 Answers

You use the connection object method (example in typescript)

let account_data = await connection.getAccountInfo(account, "processed");

However; this will return a base64 encoded, and program serialized, data block in account_data.data.

What you will need to do is to understand how the account data is both structured and serialized in order to deserialize it.

Related