const result = await myContract.methods.myMethod(1).call();
brings the error from above. There is a simmilar questions here but since I use call gas shouldn't matter. I'm using "web3": "1.0.0-beta.35", (Beta.36 doesn't work for me at all.)
const result = await myContract.methods.myMethod(1).call();
brings the error from above. There is a simmilar questions here but since I use call gas shouldn't matter. I'm using "web3": "1.0.0-beta.35", (Beta.36 doesn't work for me at all.)
Note that I believe this is fixed in the latest v3.0.0 of web3 which isn't out yet. This issue is now occuring for Binance Smart Chain. In the meantime, this fix worked for me:
https://github.com/ChainSafe/web3.js/pull/3948#issuecomment-821779691
Are you using Quorum? If you are, this is probably because you are using RAFT consensus algorithm, you have to amend web3 or change to IBFT
Try using BigInt() to resolve this issue. BigInt is an object which provides a way to represent whole numbers larger than 253 - 1, which is the largest number JavaScript can reliably represent with the Number primitive.
Example:
const balance = await contractInstance.balanceOf(accounts[0]);
console.log('Balance of Account 0 =', BigInt(balance));
Ultimate Solution
Simple install web3 latest version which is version 4
npm install web3@v4.0.1-alpha.1
That solved my problem
That is Javascript integer limitation (Number.MAX_SAFE_INTEGER).
In order to work-around it, pass a String or as BigNumber instead.
For example:
const result = await myContract.methods.myMethod("1000000000000000000000").call();
const result = await myContract.methods.myMethod(new BigNumber(2).pow(54)).call();
truffle-contract now which works fine.
– MarcS82
Sep 20 '18 at 17:49
"web3": "1.0.0-beta.35", which I sincerely doubt (though I've been using 34 for quite some time, so I'm possibly wrong on that one).
– goodvibration
Sep 20 '18 at 19:58
This will also happen if you set gasPrice to be some very large value when sending transaction like: 15e64.
In many blogs I've found it was a Truffle version problem. Truffle v5 would make problems of this type. They suggest to downgrade to truffle@4.1.15.
This has not been so for me. I have continue to use truffle v5. I've resolved by checking my gas limit when I sent a transaction. gasLimit: web3.utils.toHex( gas_limit ),//The maximum gas provided for this transaction (gas limit)
Node: v8.11.4 Truffle: 5.0.12 Web3: 1.0.0-beta.52 Truffle-contract: 4.0.11 Truffle-interface-adapter@0.1.2 │ └── web3@1.0.0-beta.37 └── web3@1.0.0-beta.37 Ganache-cli: v6.4.3 (ganache-core: 2.5.5) Ethereumjs-tx: 1.3.4
Check the contract code again please, You may have added some require(msg.sender == owner) like modifier and you code doesn't return some data which can be processed in client side.
1.0.0-beta.34or1.0.0-beta.37or (best)1.2.x(which relies on beta37 AFAIK). – goodvibration Nov 28 '19 at 10:38