web3 / web3.js

Collection of comprehensive TypeScript libraries for Interaction with the Ethereum JSON RPC API and utility functions.
https://web3js.org/
Other
19.27k stars 4.94k forks source link

Implement at `Contract` the parsing of the logs similar to `new ethers.Interface(ABI).parseLog(...)` #7065

Open Muhammad-Altabba opened 4 months ago

Muhammad-Altabba commented 4 months ago

Currently the Contract can decode its own events. But it is helpful to enable parsing a provided logs data, similar to new ethers.Interface(ABI).parseLog(...).

(This feature is needed at https://github.com/web3/web3-plugin-zksync/blob/758df6f2cf324a7c8e17730672f2ce0a831d407b/src/utils.ts#L801)

Additionally add a static method to the Contract class similar to:

contractFunctionId(value: string): string {
    return web3Utils.keccak256(web3Utils.utf8ToBytes(value));
}
mconnelly8 commented 3 months ago

@avkos - is this still required for the plugin?