solana-fm / explorer-kit

Public Solana Data Parser
GNU General Public License v3.0
105 stars 17 forks source link

Instruction parsing fails #11

Open WilfredAlmeida opened 10 months ago

WilfredAlmeida commented 10 months ago

Describe the bug I created an instruction parser for bubblegum. The parsing of innerInstructions fails with error

return str
67 |   }
68 |   function decodeUnsafe (source) {
69 |     console.log("DECODE UNSAFE");
70 |     console.log(source);
71 |     if (typeof source !== 'string') { throw new TypeError('Expected String') }
                                                 ^
TypeError: Expected String
      at decodeUnsafe (/home/almei/Documents/solana/solana-scripts/node_modules/@solanafm/utils/node_modules/bs58/node_modules/base-x/src/index.js:71:45)
      at decode (/home/almei/Documents/solana/solana-scripts/node_modules/@solanafm/utils/node_modules/bs58/node_modules/base-x/src/index.js:115:18)
      at z (/home/almei/Documents/solana/solana-scripts/node_modules/@solanafm/utils/dist/index.js:1:1956)
      at parseInstructions (/home/almei/Documents/solana/solana-scripts/node_modules/@solanafm/explorer-kit/dist/index.mjs:5018:26)
      at /home/almei/Documents/solana/solana-scripts/parsers/bubblegum.ts:61:40
      at processTicksAndRejections (:61:77)

I added log statements in:

  1. node_modules/@solanafm/utils/node_modules/bs58/node_modules/base-x/src/index.js:69

    function decodeUnsafe (source) {
    console.log("DECODE UNSAFE");
    console.log(source);
    if (typeof source !== 'string') { throw new TypeError('Expected String') }

    The output is undefined

  2. node_modules/@solanafm/utils/node_modules/bs58/node_modules/base-x/src/index.js

    function decode (string) {
    console.log("STRING TO DECODE");
    console.log(string);
    var buffer = decodeUnsafe(string)

    The output is undefined

My:

I'm using the example script from #6

Screenshots Here's a screenshot of my instruction data, accounts which exist and then the logs & error image

Desktop (please complete the following information):

Additional context I cloned the repo and added a test with the programHash & transaction mentioned above and it errored the same there as well. Can this be a dependency issue?

doodoo-aihc commented 8 months ago

Hey @WilfredAlmeida ! Really really sorry for the very very late responses.

I have took a look at your problem and I don't seem to encounter it on my end. Can you share a snippet of your code on how you are using the parsers if you are still interested?