Support for a custom
key in TransactionRequest
and CallOverrides
#1761
Labels
enhancement
New feature or improvement.
fixed/complete
This Bug is fixed or Enhancement is complete and published.
minor-bump
Planned for the next minor version bump.
Currently,
Signer.checkTransaction
andcontracts.populateTransaction
reject custom override keys to prevent typos or unsupported options as seen here and here.While the former method can be overridden by a derived class, there is no such option for the latter, as it is not a method of any class. Moreover, it is not exported, so there is no way to utilize the existing implementation without copy-pasting it.
The problem here is that when extending a
Signer
or aWallet
to be used to call contracts on networks that also useweb3
API, but have additional options that must be specified to modify transaction calldata prior to sending, there is no way to pass those options intoSigner.signTransaction
or other methods that accept aTransactionRequest
from the context of a contract, sincecontracts.populateTransaction
used by theContract
class does not allow strayCallOverrides
.To give an example, I want to be able to do something like
which is currently impossible due to checks in
contracts.populateTransaction
which I linked above.Alternatively, the way to do this is by extending
ethers.Contract
using a lot of copy-pasted code to overrideContract.populateTransacton
, which is not pretty.Adding a single
custom
field (or any other suitable name) would be a major help and will not compromise typo checks that are in place.Maybe there is a much simpler way to do this which I am not seeing, in which case I would be very grateful for suggestions.
If not, then my suggested way is fairly straightforward to implement and I would gladly make a PR if this solution looks fine.
The text was updated successfully, but these errors were encountered: