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

Error: invalid value for value.data #4737

Open
mateja176 opened this issue May 20, 2024 · 1 comment
Open

Error: invalid value for value.data #4737

mateja176 opened this issue May 20, 2024 · 1 comment
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@mateja176
Copy link

Ethers Version

6.12.1

Search Terms

No response

Describe the Problem

Given the following contract:

          const contractToken = new Contract(
            tokenAddress,
            [
              'function decimals() view returns (uint8)',
              'function allowance(address owner, address spender) view returns (uint)',
              'function approve(address spender, uint value)',
            ],
            signingWallet,
          )

The approve operation works.

But throws the below described error.

Code Snippet

await (await contractToken.approve(swap.tx.txTo, MaxUint256)).wait()

Contract ABI

[
              'function decimals() view returns (uint8)',
              'function allowance(address owner, address spender) view returns (uint)',
              'function approve(address spender, uint value)',
            ],

Errors

index.ts:927 Error: invalid value for value.data (invalid data (argument="value", value="095ea7b300000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", code=INVALID_ARGUMENT, version=6.12.1)) (value={ "accessList": [  ], "blockHash": null, "blockNumber": null, "chainId": "0x1", "from": "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8", "gas": "0xb7d0", "gasPrice": "0xee6b2800", "hash": "0x19be58d0e90632e55df97db55d1a5aaf21c856d5a58725fcf141cdccb323c51b", "input": "095ea7b300000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "maxFeePerGas": "0xee6b2800", "maxPriorityFeePerGas": "0x3b9aca00", "nonce": "0x5", "r": "0x0", "s": "0x0", "to": "0x40B38765696e3d5d8d9d834D8AaD4bB6e418E489", "transactionIndex": null, "type": "0x2", "v": "0x0", "value": "0x0" }, code=BAD_DATA, version=6.12.1)
    at makeError (chunk-3CWJQINT.js?v=37e953ff:121:15)
    at assert (chunk-3CWJQINT.js?v=37e953ff:134:11)
    at ethers.js?v=37e953ff:800:9
    at formatTransactionResponse (ethers.js?v=37e953ff:951:5)
    at BrowserProvider._wrapTransactionResponse (ethers.js?v=37e953ff:2008:36)
    at BrowserProvider.getTransaction (ethers.js?v=37e953ff:2433:17)
    at async checkTx (ethers.js?v=37e953ff:3463:23)

Environment

Ethereum (mainnet/ropsten/rinkeby/goerli)

Environment (Other)

No response

@mateja176 mateja176 added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels May 20, 2024
@mateja176
Copy link
Author

This is possibly an xdefi browser wallet bug given that the tx.input aka tx.data is failing the isHexString check because it doesn't start with 0x. Can you confirm this assumption @ricmoo?

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