Getting an error from flipper.js: bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
reselbob opened this issue · 1 comments
reselbob commented
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- What ledger are you using, e.g. Solana or Polkadot
solana-cli 1.14.23 (src:68c6fd13; feat:1879391783)
-
Here is the Solidity code I converted to Solana bytecode.
-
Provide both Solidity source and client code (e.g. TypeScript)
const { readFileSync } = require('fs');
const anchor = require('@coral-xyz/anchor');
const IDL = JSON.parse(readFileSync('./flipper.json', 'utf8'));
const PROGRAM_SO = readFileSync('./flipper.so');
(async function () {
const provider = anchor.AnchorProvider.env();
const dataAccount = anchor.web3.Keypair.generate();
const programId = new anchor.web3.PublicKey(IDL.metadata.address);
const wallet = provider.wallet.publicKey;
const program = new anchor.Program(IDL, programId, provider);
await program.methods.new(wallet, true)
.accounts({ dataAccount: dataAccount.publicKey })
.signers([dataAccount]).rpc();
const val1 = await program.methods.get()
.accounts({ dataAccount: dataAccount.publicKey })
.view();
console.log();
await program.methods.flip()
.accounts({ dataAccount: dataAccount.publicKey })
.rpc();
const val2 = await program.methods.get()
.accounts({ dataAccount: dataAccount.publicKey })
.view();
console.log();
})();
- Provide Solang version number (output of
solang --version
)
solang version v0.3.1
- What behavior are you seeing?
$ node flipper.js
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
/root/solang/node_modules/@coral-xyz/anchor/dist/cjs/program/context.js:10
throw new Error(`provided too many arguments ${args} to instruction ${idlIx === null || idlIx === void 0 ? void 0 : idlIx.name} expecting: ${(_b = (_a = idlIx.args) === null || _a === void 0 ? void 0 : _a.map((a) => a.name)) !== null && _b !== void 0 ? _b : []}`);
^
Error: provided too many arguments BsgMENHQRC2EszoTDcy6ZM9wZSWCeH18jsBwni3doSJ1,true,[object Object] to instruction new expecting: initvalue
at splitArgsAndCtx (/root/solang/node_modules/@coral-xyz/anchor/dist/cjs/program/context.js:10:19)
at txFn (/root/solang/node_modules/@coral-xyz/anchor/dist/cjs/program/namespace/transaction.js:9:62)
at MethodsBuilder.rpc [as _rpcFn] (/root/solang/node_modules/@coral-xyz/anchor/dist/cjs/program/namespace/rpc.js:9:24)
at MethodsBuilder.rpc (/root/solang/node_modules/@coral-xyz/anchor/dist/cjs/program/namespace/methods.js:93:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /root/solang/flipper.js:18:5
Node.js v18.16.1
- What behavior did you expect?
Expected behavior
I was hoping for the behavior that goes with the instructions provided in the readme.md file
Help?
seanyoung commented
You are right, there is a problem in this example. Line 18-20 should be:
await program.methods.new(true)
.accounts({ dataAccount: dataAccount.publicKey })
.signers([dataAccount]).rpc();
However I recommend you follow the Getting Started with Solang Guide which is a much better experience.