Cannot execute ethers.js contract method without specifying optional transaction overrides argument
See original GitHub issueDescription
When I try to run EthereumGatewayV2.withdrawAsync
method without providing overrides
argument (which is marked as optional in loom-js
code) it throws this error:
Error: incorrect number of arguments
at Object.withdrawETH (node_modules/loom-js/node_modules/ethers/contract.js:130:19)
at EthereumGatewayV2.<anonymous> (node_modules/loom-js/dist/ethereum-gateways.js:78:66)
at step (node_modules/tslib/tslib.js:136:27)
at Object.next (node_modules/tslib/tslib.js:117:57)
at fulfilled (node_modules/tslib/tslib.js:107:62)
at process._tickCallback (internal/process/next_tick.js:68:7)
When I pass an overrides
object with a gasLimit
property specified, everything works fine. At least, this argument have to be marked as required in withdrawAsync
function signature.
Versions
- ethers:
4.0.38
- loom-js:
1.70.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Sending an argument with an ethers contract object
I need to pass an argument userTeamChosen with a appendUserBet() function which I both set the values for through html forms but get...
Read more >Contract with function overloading · Issue #407 · ethers-io ...
I'm getting the error: Error: incorrect number of arguments when I'm trying call the second function. Seems that when Contract is reading ...
Read more >Documentation - Ethers.js
A second optional parameter allows API keys to be specified to each Provider created ... Returns the result of executing the transaction, using...
Read more >Contracts — ethers.js 4.0.0 documentation
Every Contract method may take one additional (optional) parameter which specifies the transaction (or call) overrides. Contract Transaction Overrides¶. // All ...
Read more >Set gas limit on contract method in ethers.js - Stack Overflow
You can set the gas limit with an object as the last argument, for a simple transfer transaction, you could do something like...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@enlight Same issue reported by Sorare. They’re using ethers 4.0.37 and they tried to call the
withdrawAsync
function with a single argument like:This resulted in the following error:
I asked them to pass the
gasLimit
as the second argument:and this worked.
I don’t know if there’s an issue with loom-js or ethers though.
I also can mention that when using our own contracts with ethers.js and loom-js we also need to provide the gas limit. So, in my opinion it’s because
LoomProvider
instances doesn’t have the default gas limit at all and it’s quite logical that ethers.js forces developers to provide some gas value to send transactions with.