I'm trying to decode the account data buffer that is provided when calling methods such as getAccountInfo or getProgramAccounts with web3.js. The account in question is the account whose address is a Raydium ammid. Here is an example of such a buffer:enter image description here

The accounts is owned by Raydium Liquidity Pool V4 which doesn't have an IDL that I can use. I also have not been able to find a valid schema for the account data to deserialize with Borsh. Calling the "parsed" version of the web3 methods above doesn't deserialize the data either. I was wondering if anyone knows how to decode the data buffer in order to extract things such as token addresses associated with the ammid etc.


2 Answers 2


If the program isn’t open source and you don’t have the IDL you can start by looking for SDK provided by the project or ask the team for more details and documentation.

  • In my experience they don’t really care about small programmers.
    – wei1769
    Jan 20 at 16:31

You can use either AccountLayout.decode(account.data) or, if it's a mint address, MintLayout.decode(account.data). Given that account is the response from getAccountInfo

These two are found in @solana/spl-token.

  • This is not correct, as AccountLayout from spl-token is meant for token accounts specifically, whereas this is a Raydium account of some sort (i.e. likely not a token account).
    – Ahri
    Jan 27 at 13:29
  • Understood. What is the solution, then? I'm a new dev, so I'm learning as well. Thanks for pointing this out!
    – materwelon
    Jan 28 at 0:19
  • Like Wei said, if they don't publish their IDL there isn't really anything you can do outside of asking the team directly if you really care about the account layout. Usually you just care about calling the program, in which case youd use an sdk if they offer it.
    – Ahri
    Jan 28 at 1:20
  • (all this with the assumption that the contract is closed source obviously)
    – Ahri
    Jan 28 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.