ethjs / ethjs-contract

A simple contract object for the Ethereum RPC layer.
MIT License
20 stars 28 forks source link

get logs in one go (no listening) #9

Open wighawag opened 6 years ago

wighawag commented 6 years ago

ethjs-contract

Description

For my use case I like to call eth_getLogs to gather past events that match the filter parameter in one go (basically I expect to get an array of matching logs)

If this could be added to ethjs as a general method as well as contract event specific, this would be cool

web3 1.0 does this via getPastEvent for contract :

https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#getpastevents

and getPastLogs for the general case

https://web3js.readthedocs.io/en/1.0/web3-eth.html#getpastlogs

pointtoken commented 6 years ago

You may be interested in my PR on eth-js https://github.com/ethjs/ethjs/pull/5 and my comment on eth-js query https://github.com/ethjs/ethjs-query/issues/7 that demonstrates how eth_getLogs is kind of broken. I had to use web3 to serialize the event.

SilentCicero commented 6 years ago

@wighawag we can add something for this, however it would just be using as @pointtoken points out, eth_getLogs.

wighawag commented 6 years ago

eth_Logs would be good