Hey! I know this doesnt directly have anything to do about solidity or the ethereum chain itsself but its the closest sub I could find
I tried providing my own gas values converted to BigInts, Numbers, Strings, and JSBI's, changing the number values, ect
I looked at some other stuff but nothing could resolved the error(s)
Expected Result: Transaction goes thru and approves money for spending by routerAddress
Error:
TypeError: invalid BigNumberish value (argument="value", value={ "hex": "0xb3e3", "type": "BigNumber" }, code=INVALID_ARGUMENT, version=6.4.2) at makeError (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/utils/errors.js:113:21) at assert (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/utils/errors.js:136:15) at assertArgument (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/utils/errors.js:147:5) at getBigInt (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/utils/maths.js:90:5) at set gasLimit [as gasLimit] (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/transaction/transaction.js:327:44) at Transaction.from (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/transaction/transaction.js:667:29) at Wallet.sendTransaction (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/providers/abstract-signer.js:181:35) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async send (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/contract/contract.js:199:20) at async Proxy.approve (file:///home/celestial/Documents/projects/auto-trading/web/node_modules/ethers/lib.esm/contract/contract.js:232:16) { code: 'INVALID_ARGUMENT', argument: 'value', value: [BigNumber]
Image of Error
https://preview.redd.it/wur1flv09jrb1.png?953&format=png&auto=webp&s=1ed119b80c56514f9a2502b0b11f64452d22e02a
Code for running approval function (erroring section)
// goerli chain const wethAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6'; const routerAddress = '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45'; const provider = new JsonRpcProvider(PROVIDER_URL); const approvalContract = new Contract(wethAddress, erc20Abi, provider); console.log('approving'); await approvalContract.connect(wallet).approve( routerAddress, 6500000000000000 ); console.log('approved');
Any help would be appreciated, thanks!
EDIT: i fixed the error (kinda), what i did was i just installed web3.js and sent the actual tx with web3.js
code:
const approvalArgs = [ routerAddress, // @TODO make this change based on the input amount 6500000000000000 ]; // Populate to and data let populatedTransaction = await approvalContract.approve.populateTransaction(...approvalArgs); // Populate gas data, nonce, ect populatedTransaction = await wallet.populateTransaction(populatedTransaction); // eslint-disable-next-line no-restricted-syntax for (const [key, value] of Object.entries(populatedTransaction)) if (value?._isBigNumber) populatedTransaction[key] = Number(value._hex) || 0; const signed = await wallet.signTransaction(populatedTransaction); await web3.eth.sendSignedTransaction(signed);
submitted by
Comments