When I have IDL and instruction data, how can I decode that into struct?
For example, I have IDL file and its corresponding instruction data encoded with bs58 like 368Yh7EEPvKQfQdCFA3GKqgk
.
Given these, can I decode it into struct using anchor?
ChatGPT gives me code like this:
const { Buffer } = require('buffer');
const bs58 = require('bs58');
const instructionDataBase58 = '368Yh7EEPvKQfQdCFA3GKqgk';
const instructionDataBuffer = bs58.decode(instructionDataBase58);
...
const decodedInstruction = program.decodeInstruction(instructionDataBuffer);
console.log(decodedInstruction);
But I can't find method decodeInstruction
.
Anyone can help me?