What happened
Passing an SDK HexString instance as a topic in viem's getLogs filter silently drops the topic — the request goes out as "topics": [] and returns unfiltered logs. The call succeeds, the result just quietly means something different (we concluded "the event doesn't exist" when the truth was "the filter never left the client"). Captured by wrapping fetch and comparing request bodies:
sent: {"method":"eth_getLogs","params":[{"address":"0xd2A8…","topics":[],"fromBlock":"0x2c44b19",…}]}
meant: {"method":"eth_getLogs","params":[{"address":"0xd2A8…","topics":["0xd173a1d1…"],"fromBlock":"0x2c44b19",…}]}
Cause
viem requires primitive `0x${string}` for topics; the HexString class instance is not a string, so it is dropped. HexString.hexString (the raw value) is private, so the escape hatch String(topic) reads like reaching into internals.
Suggestion
Either brand HexString so it satisfies viem's `0x${string}` (a string template type), or export a HexLike = Hex | HexString conversion helper (e.g. HexString.toHex()) and document that SDK hex wrappers must be converted before entering viem filter objects. One docs warning next to the event-class examples would have saved us a debugging round.
Versions
@1inch/aqua-sdk 0.3.1 (@1inch/sdk-core 0.1.2), viem 2.56.3
What happened
Passing an SDK
HexStringinstance as a topic in viem'sgetLogsfilter silently drops the topic — the request goes out as"topics": []and returns unfiltered logs. The call succeeds, the result just quietly means something different (we concluded "the event doesn't exist" when the truth was "the filter never left the client"). Captured by wrappingfetchand comparing request bodies:Cause
viem requires primitive
`0x${string}`for topics; theHexStringclass instance is not a string, so it is dropped.HexString.hexString(the raw value) isprivate, so the escape hatchString(topic)reads like reaching into internals.Suggestion
Either brand
HexStringso it satisfies viem's`0x${string}`(a string template type), or export aHexLike = Hex | HexStringconversion helper (e.g.HexString.toHex()) and document that SDK hex wrappers must be converted before entering viem filter objects. One docs warning next to the event-class examples would have saved us a debugging round.Versions
@1inch/aqua-sdk0.3.1 (@1inch/sdk-core0.1.2), viem 2.56.3