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

Invalid Hexlify Value when using Filters #3013

Closed
adriandelgg opened this issue May 23, 2022 · 3 comments
Closed

Invalid Hexlify Value when using Filters #3013

adriandelgg opened this issue May 23, 2022 · 3 comments
Assignees
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@adriandelgg
Copy link

adriandelgg commented May 23, 2022

Ethers Version

5.6.5

Search Terms

invalid hexlify

Describe the Problem

Whenever I pass in some string values that represent a number to a filters, I get an error:

Why does it fail when I pass in the '0''s to the event? When I do the '0's to null it doesn't fail. It says it has a type of BigNumberish, so I'm confused if I'm doing something wrong?

Code Snippet

event Voted(
  address indexed voter,
  uint indexed orgId,
  uint indexed pollId,
  uint[] votes
);
// account is an address properly sum-checked.
// This is where the error happens.
const filterFrom = qvRouterContract?.filters?.Voted(account, '0', '0');

Contract ABI

{
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "voter",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "uint256",
          "name": "orgId",
          "type": "uint256"
        },
        {
          "indexed": true,
          "internalType": "uint256",
          "name": "pollId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256[]",
          "name": "votes",
          "type": "uint256[]"
        }
      ],
      "name": "Voted",
      "type": "event"
}

Errors

Uncaught Error: invalid hexlify value (argument="value", value="0", code=INVALID_ARGUMENT, version=bytes/5.6.1)

Environment

node.js (v12 or newer), Browser (Chrome, Safari, etc), Hardhat

Environment (Other)

React, Linux

@adriandelgg adriandelgg added the investigate Under investigation and may be a bug. label May 23, 2022
@ricmoo ricmoo added the on-deck This Enhancement or Bug is currently being worked on. label May 25, 2022
@ricmoo
Copy link
Member

ricmoo commented May 25, 2022

You are right. This seems weird and that it should be supported. I'll look into this shortly.

@adriandelgg
Copy link
Author

Awesome, thank you! It works if I make the number string a BigNumber or a number, but not as a string.

@ricmoo ricmoo added bug Verified to be an issue. and removed investigate Under investigation and may be a bug. labels May 27, 2022
@ricmoo
Copy link
Member

ricmoo commented Jun 18, 2022

This should be fixed in 5.6.9. Please try it out and let me know if you still have any problems.

Thanks! :)

@ricmoo ricmoo closed this as completed Jun 18, 2022
@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Jun 18, 2022
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this issue Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

2 participants