Closed veganbeef closed 2 months ago
good catch! will look into this tomorrow.
The above viem code produces the following RPC call, which includes a bunch of extra topic values:
{
"jsonrpc": "2.0",
"id": 0,
"method": "eth_getLogs",
"params": [
{
"address": "0xff6936cee101b9d08ad498db5969a3cb8ff4a77a",
"topics": [
[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000a4066534e21df54331edcb65a2f41151ed20912",
null,
"0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62",
null,
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000a4066534e21df54331edcb65a2f41151ed20912",
"0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb",
null,
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000a4066534e21df54331edcb65a2f41151ed20912"
]
],
"fromBlock": "0x10ad3ac",
"toBlock": "0x10afabc"
}
]
}
Noted! Unfortunately it is not possible with topic sets to filter based on a set of event selectors with their arguments, so the approach we are taking in #2533 is to filter logs via the ABI's event selectors (topic set of event selectors), and then filter logs w/ the matching arguments on the client side.
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.
Check existing issues
Viem Version
2.15.1
Current Behavior
When I call the
PublicClient.getContractEvents
method using Conduit's Zora RPC (at rpc.zora.energy), thefrom
andto
properties of theargs
parameter are ignored, and events are returned for txs from any address to any address. (The behavior is the same whether or not thestrict
parameter is passed to the function.)However, a raw cURL command to the same Zora RPC results in properly filtered results.
Expected Behavior
The
PublicClient.getContractEvents
should properly filter out events where thefrom
andto
args do not match.Steps To Reproduce
To reproduce this issue, install
viem
and then execute the following script using Node.js:To see proper execution (where an empty array of event logs is returned), execute this seemingly equivalent cURL command:
Link to Minimal Reproducible Example
No response
Anything else?
PublicClient.getContractEvents
method invokes theeth_getLogs
RPC method.