You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, First off want to thank the authors and maintainers so bringing this project to life.
logs=ExW3.get_logs(%{fromBlock: "0x"<>Integer.to_string(fromBlock,16),toBlock: "0x"<>Integer.to_string(toBlock,16),# [A, B] topics means A and B so lets send [[A, B]] which means ORtopics: [["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0"]]})abi=File.read!(Path.join(Application.app_dir(:myapp,"priv"),"static/721abi.json"))|>Jason.decode!()|>ABI.parse_specification(include_events?: true)events=logs|>Enum.map(fnlog->[topic1,topic2,topic3,topic4]=caselength(log["topics"])do4->log["topics"]3->log["topics"]++[nil]2->log["topics"]++[nil,nil]_->raise"Invalid topics"endabi|>ABI.Event.find_and_decode(convert_hex_to_binary(topic1),convert_hex_to_binary(topic2),convert_hex_to_binary(topic3),convert_hex_to_binary(topic4),log["data"])
The above code fetches logs for a block range and tries to extract event from it. But it fails on log when its data is 0x.
Try for block range 15714764, 15714774 on mainnet and you can reproduce it. When i converted data 0x to integer the function succeeds but it returns get the wad / tokenId wrong in the event. Can the library handle topics and data in hex itself? Curious to get your thoughts as well.
So %ABI.FunctionSignature{} is querying by methodId. Can we figure out a way to add args to that calculation and query ? That way we can use the right ABI to decode the log.
The text was updated successfully, but these errors were encountered:
Hello, First off want to thank the authors and maintainers so bringing this project to life.
The above code fetches logs for a block range and tries to extract event from it. But it fails on log when its data is
0x
.Try for block range
15714764, 15714774
on mainnet and you can reproduce it. When i converted data0x
to integer the function succeeds but it returns get the wad / tokenId wrong in the event. Can the library handle topics and data in hex itself? Curious to get your thoughts as well.Just found this https://github.com/wmitsuda/topic0/blob/main/docs/gotchas.md
So %ABI.FunctionSignature{} is querying by methodId. Can we figure out a way to add args to that calculation and query ? That way we can use the right ABI to decode the log.
The text was updated successfully, but these errors were encountered: