Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer layout #2

Open
benjiqq opened this issue Apr 18, 2024 · 2 comments
Open

buffer layout #2

benjiqq opened this issue Apr 18, 2024 · 2 comments

Comments

@benjiqq
Copy link

benjiqq commented Apr 18, 2024

instantiating coder

const coder = new RaydiumAmmCoder(idl as Idl);
const result = coder.instruction.decode(
    Buffer.from("0bf70a9c01000000006417427900000000", "hex")
);
console.log(result);

seems like issue with layout here
https://github.com/raydium-io/raydium-idl/blob/master/raydium_amm/src/coder/accounts.ts#L109

$ ts-node src/index.ts
TypeError: fields must be array of Layout instances
    at new Structure (/Users/ben/projects/polaris/monitor/node_modules/@native-to-anchor/buffer-layout/node_modules/@solana/buffer-layout/src/Layout.ts:1107:13)
    at Object.exports.struct (/Users/ben/projects/polaris/monitor/node_modules/@native-to-anchor/buffer-layout/node_modules/@solana/buffer-layout/src/Layout.ts:2615:5)
    at Object.<anonymous> (/Users/ben/projects/polaris/monitor/src/raydium/coder/accounts.ts:109:32)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module.m._compile (/Users/ben/projects/polaris/monitor/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/ben/projects/polaris/monitor/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@336fran
Copy link

336fran commented Aug 7, 2024

Same error.

Is there any solution for this issue or another way to decode the data from the program?

@YaminZheng
Copy link

Do you have a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants