Skip to content

Event listener does not catch anything from provider or contract when using multiple topics in a filter. #5

@creamcroutons

Description

@creamcroutons

When using a contract or provider event listener, the listener will NOT catch any logs if there are multiple topics in the filter.
Ex. 1:

const filter = {
	address: contract_address,
	topics: [
		utils.id('Transfer(address,address,uint256)'),
		utils.hexZeroPad(address, 32)
	]
}

This will not catch any logs/events at all. Whereas just one topic will work as expected.
Ex. 2:

const filter = {
	address: contract_address,
	topics: [
		utils.id('Transfer(address,address,uint256)')
	]
}

This returns the expected transaction. I have tried with more topics, null placeholders, and ensured proper formatting. When using the second provided filter, the topics in the returned transaction match exactly what the topics of the first filter would look like.
I was stumped on this for a long time before I switched to a BscScan JsonRpcProvider where the first filter worked as intended. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions