Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EtherscanProvider _getTransactionPostData has invalid TransactionOverrides #4899

Open
Nakasar opened this issue Dec 17, 2024 · 0 comments
Open
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@Nakasar
Copy link

Nakasar commented Dec 17, 2024

Ethers Version

6.13.14

Search Terms

Etherscan, maxFeePerGs, maxFeePerGas, transaction overrides

Describe the Problem

Hello!

When using transaction override property "maxFeePerGas", the following cast error is raised:

TypeError: invalid BytesLike value (argument="value", value=60000000015, code=INVALID_ARGUMENT, version=6.13.4)

The error occurs sometimes only (when using the getDefaultProvider). And everytimes when using the EtherscanProvider.

This seems to be caused by this check in EtherscanProvider: https://github.com/ethers-io/ethers.js/blob/48cdcef2925ffca4f60412697791dac268f06d0d/src.ts/providers/provider-etherscan.ts#L341C69-L341C80

Where the keys of the override properties are checked to defined if they need to be cast using toQuantity or hexlify.

In the list of properties keys maxFeePerGs is used instead of maxFeePerGas.

The line of properties to match for toQuantity should probably be:

if ((<any>{ type: true, gasLimit: true, gasPrice: true, maxFeePerGas: true, maxPriorityFeePerGas: true, nonce: true, value: true })[key]) {

Have a nice day!

Code Snippet

const etherscan = new ethers.EtherscanProvider('matic-amoy');
    
    const wallet = new ethers.Wallet('<>', etherscan);
    const signer = new ethers.NonceManager(wallet);

    const contract = new ethers.Contract('address', ["function someFunction(address old, address new)"], signer);

    const tx = await contract.someFunction('0x8701766278803a9b3460c78d8cb22df0ab132952', '0x70b98e54160bd632b404d329951d371d8fe647bd', {
        maxFeePerGas: 6500000000n,
    });

Contract ABI

- Non relevant.

Errors

TypeError: invalid BytesLike value (argument="value", value=60000000015, code=INVALID_ARGUMENT, version=6.13.4)

Environment

Altcoin - Please specify (e.g. Polygon)

Environment (Other)

Polygon Amoy

@Nakasar Nakasar added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants