1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

hardened event listening

This commit is contained in:
Sebastian Gerske 2018-12-07 17:19:53 +01:00
parent 8ab5f7408b
commit 7b0d34a420

View File

@ -1,6 +1,7 @@
import GenericContract from "./contracts/GenericContract"
import EventListener from "./EventListener"
import Web3Provider from "./Web3Provider"
// import Logger from "../utils/Logger"
export default class Event {
@ -39,6 +40,7 @@ export default class Event {
private async handler(callback: any) {
const contract = await GenericContract.getInstance(this.contractName)
try {
const events = await contract.getEventData(this.eventName, {
filter: this.filter,
fromBlock: this.lastBlock,
@ -49,5 +51,8 @@ export default class Event {
this.lastBlock = events[events.length - 1].blockNumber + 1
callback(events)
}
} catch (err) {
// Logger.log("err")
}
}
}