eth-json-rpc-filters
eth-json-rpc-filters copied to clipboard
fix: add workaround that `intToHex` produce valid `Quantity` format
Hi and thank you for maintaining this library! I would like to fix an issue where event hooks are not working in MetaMask.
Specification
- geth and the spec no longer support leading zero
- Reference:
- https://github.com/ethereum/execution-apis/issues/40#issuecomment-906400324
- https://github.com/NomicFoundation/hardhat/issues/1585#issuecomment-906638245
Issue Description
- Events emitted by the contract aren't being received when subscribing with
.contract.on("EventName", callback) - Event hooks occasionally fail to arrive
- This issue is specific to MetaMask (works fine with other wallets)
- Many dApps are affected by MetaMask's subscription functionality issues
- Related issues:
- https://github.com/MetaMask/eth-json-rpc-filters/issues/70
- https://github.com/MetaMask/eth-json-rpc-filters/issues/152
- https://github.com/MetaMask/metamask-extension/issues/8220
Proposed Solution
- This PR is intended as a temporary workaround until the
intToHexfunction inhexUtils.jsis properly audited- Reference for auditing function:
- https://github.com/MetaMask/eth-json-rpc-filters/pull/71#issuecomment-1240001443
- Reference for auditing function:
- Added local intToHex implementation to
log-filter.js- Following the same approach already used in
getBlocksForRange.js
- Following the same approach already used in