Ethers.js: Specifying override options in contract call results in too many parameters error

Created on 24 Jan 2018  路  4Comments  路  Source: ethers-io/ethers.js

I've updated from ethers 2.1.5 to 2.2.3 and it seems the interface that generates contract abstractions has changed.

According to the documentation (and my code which worked in 2.1.5), you can override contract options like so:

// Overriding parameters; any of these are optional and get passed
// as an additional parameter adter all function parameters.
var overrideOptions = {
    gasLimit: 250000,
    gasPrice: 9000000000,
    nonce: 0,
    value: ethers.utils.parseEther('1.0')
};

var sendPromise = contract.setValue("Hello World", overrideOptions);

However attempting to do this in 2.2.3 results in Interface.js (line 590) throwing an exception of Error: too many parameters.

Is there a new way to specify override options?

bug fixed

Most helpful comment

maybe a bug..
I change contract.js line 66 :
if (params.length == method.inputs.types.length + 1) { ... }
now its ok .

All 4 comments

maybe a bug..
I change contract.js line 66 :
if (params.length == method.inputs.types.length + 1) { ... }
now its ok .

That makes complete sense. I will make this change and run the test cases, and then publish if everything looks good.

Addressed in https://github.com/ethers-io/ethers.js/commit/74c71e667799730db8afc2a3ed5544089fa9fb55.

I should also add test cases that test overrides in the near future.

This fix has been published to npm.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings