ethjs-contract
ethjs-contract copied to clipboard
Better Log features (comparible to web3)
Issue Type
- [x] Feature
Description
We want to be able to grab logs like web3. Just a getLogs kind of method, but with topic filtering:
Currently one has to do something like this:
eth.getLogs({
address: 'CONTRACT_ADDRESS',
topics: [`0x${Eth.keccak256(`${abi[0].name}(${abi[0].inputs.map(v => v.type).join(',')})`)}`],
})
.then(console.log);
We can bind that into that contract object like so:
contractObject.filterName.getLogs with the contract address and topic array predefined/filled.
we can also pre-define the topic name output as so:
contractObject.fitlerName.topic which will produce the sha3 hash.