@@ -3,6 +3,7 @@ import { ethers } from 'ethers'
3
3
import { AutoCrossChecker , ONE_MINUTE_MS , RekuProviderManager } from '@ora-io/reku'
4
4
import type { AutoCrossCheckParam , Providers } from '@ora-io/reku'
5
5
import type { Logger } from '@ora-io/utils'
6
+ import type { Context } from '../context'
6
7
import type { Signal } from './type'
7
8
8
9
export interface EventSignalRegisterParams {
@@ -30,6 +31,7 @@ export class EventSignal implements Signal {
30
31
public params : EventSignalRegisterParams ,
31
32
public callback : EventSignalCallback ,
32
33
public logger : Logger ,
34
+ public context ?: Context ,
33
35
) {
34
36
this . contract = new ethers . Contract (
35
37
params . address ,
@@ -48,14 +50,14 @@ export class EventSignal implements Signal {
48
50
// to align with crosschecker onMissing, parse the last arg from ContractEventPayload to EventLog
49
51
this . subscribeCallback = async ( ...args : Array < any > ) => {
50
52
const _contractEventPayload = args . pop ( )
51
- await this . callback ( ...args , _contractEventPayload . log )
53
+ await this . callback ( ...args , _contractEventPayload . log , context )
52
54
await this . crosschecker ?. cache ! . addLog ( _contractEventPayload . log )
53
55
}
54
56
// to align with subscribe listener, parse event params and add EventLog to the last
55
57
this . crosscheckCallback = async ( log : Log ) => {
56
58
const parsedLog = this . contract . interface . decodeEventLog ( this . eventFragment , log . data , log . topics )
57
59
this . logger . info ( 'crosschecker capture a missing event! processing...' , log . transactionHash , log . index )
58
- await this . callback ( ...parsedLog , log )
60
+ await this . callback ( ...parsedLog , log , context )
59
61
}
60
62
}
61
63
0 commit comments