-1
            JSON.stringify({
            jsonrpc: '2.0',
            id: 1,
            method: 'programSubscribe',
            params: [
                address,
                {
                    encoding: 'jsonParsed',
                    commitment: 'processed',
                },
            ],
        })
    )
}

using the above payload, (as well as encoding: 'base64')

I get back something like this.

{
  context: { slot: 162051102 },
  value: {
    pubkey: '33DMmrkWEWEDWhPaXfXQxFTssreDjmkSHdo93Yp27fRV',
    account: {
      lamports: 2011440,
      data: [Array],
      owner: 'M2mx93ekt1fmXSVkTrUL9xVFHkmME8HTUi5Cyc5aF7K',
      executable: false,
      rentEpoch: 361
    }
  }
}

The data array looks like this...

['yKSZu3Y8yDPDGxjMPhSKClKTgYkg7frtqzkeSTNsC3TbZp0QRwNCS4mVGWt5DMnpawo5OX1XhzojzVpAp5AkOns3GVU1tI23CK/25BBZJGavm0hr5XZ58vaLQc3cMeAgkndKj2Ni7ROAAFliAAAAADVtgjQOEJ9Azw2AlH80qNd2MINdaKjv/nLVRWodXmGIAQAAAAAAAAD9AAAAAAAAAAA=',
  'base64']

How do I turn the above string into something that I can see.... Why is everything on Solana hidden behind more rpc calls?

Ken White
  • 123,280
  • 14
  • 225
  • 444
josh hoffer
  • 126
  • 1
  • 7

1 Answers1

0

Decode the account data using base64. This will result in a serialized byte array.

To then deserialize it as the datatype (struct, etc.) you need to know the structure of the data and how it was serialized by the program. For example: borsh and serde will produce different serialization.

Frank C.
  • 7,758
  • 4
  • 35
  • 45
  • i ask how to decode and your response is to say i need to decode it? thanks for the useless help – josh hoffer Nov 20 '22 at 15:33
  • You didn't include enough to walk you through actually decoding it. Where is the source of the program that manages the object creation and serialization? If you knew more and put it in your question I can teach you better. – Frank C. Nov 20 '22 at 16:32
  • sorry didnt mean to take it out on you... Im just so stressed about this chain =/ every endpoint takes hours and hours of research to find out how to use it.. Its the magic eden address. – josh hoffer Nov 20 '22 at 16:35
  • Then you'll need to look at the magic eden source to find out the particulars. Once you know that, you can deserialize on client side. – Frank C. Nov 24 '22 at 09:14