Subscribe to smart contract events, which is currently broken on Lotus w/ Ethers@6.
import { onContractEvent } from 'on-contract-event'
const it = onContractEvent({
contract,
provider,
rpcUrl,
rpcHeaders
})
for await (const event of it) {
console.log({
name: event.name,
args: event.args
})
}
Options:
contract
: Ethers contractprovider
: Ethers providerrpcUrl
: JSON-RPC endpoint URLrpcHeader
: JSON-RPC headers objectsignal
: OptionalAbortSignal