Skip to content

Invalid Hexlify Value when using Filters #3013

@adriandelgg

Description

@adriandelgg

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

Metadata

Metadata

Assignees

Labels

bugVerified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions