project-serum / serum-ts

Project Serum TypeScript monorepo
https://projectserum.com
Apache License 2.0
270 stars 245 forks source link

Data decoding base64 (need structure) #211

Closed mage-ua closed 2 years ago

mage-ua commented 2 years ago

Hello, guys!

Please help me.

Where can I take data structure of base64 ecoded messages of programSubscribe messages type for decoding?

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programSubscribe",
  "params": [
    "someAddress",
    {
      "encoding": "base64",
      "commitment": "processed"
    }
  ]
}

Receive something like this. Need to decode data[0]

{
  "jsonrpc": "2.0",
  "method": "programNotification",
  "params": {
    "result": {
      "context": {
        "slot": 12345
      },
      "value": {
        "pubkey": "XXXXX",
        "account": {
          "lamports": 12345,
          "data": [
            "JEUwEoDhfYeue++EI97IyWHo9TiUneNoZsZALtCc7aKcAbsyPJZyUOLRWUfcuU7Dura0bVse8AR6o8VaHWQQwhGrR5oMCk7UAHQ7pAsAAAA=",
            "base64"
          ],
          "owner": "XXX",
          "executable": false,
          "rentEpoch": 12345
        }
      }
    },
    "subscription": 12345
  }
}

What fields u64, publicKey should be?