Skip to content

Commit 28edd95

Browse files
committed
fix(orap): revert signle level context, should keep context at the task level only
1 parent 6d6716f commit 28edd95

File tree

6 files changed

+6
-9
lines changed

6 files changed

+6
-9
lines changed

packages/orap/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export * from './signal'
22
export * from './store'
33
export * from './task'
44
export * from './orap'
5-
export * from './context'

packages/orap/orap.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { RekuProviderManager } from '@ora-io/reku'
33
import type { Logger } from '@ora-io/utils'
44
import { logger } from '@ora-io/utils'
55
import { EventSignal } from './signal/event'
6-
import type { Context } from './context'
76

87
export interface ListenOptions {
98
wsProvider: Providers
@@ -23,8 +22,8 @@ export class Orap {
2322
}
2423
}
2524

26-
event(options: any, fn: any, context?: Context) {
27-
const es = new EventSignal(options, fn, this.logger, context)
25+
event(options: any, fn: any) {
26+
const es = new EventSignal(options, fn, this.logger)
2827
this.routes.event.push(es)
2928
return es
3029
}

packages/orap/signal/event.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ethers } from 'ethers'
33
import { AutoCrossChecker, ONE_MINUTE_MS, RekuProviderManager } from '@ora-io/reku'
44
import type { AutoCrossCheckParam, Providers } from '@ora-io/reku'
55
import type { Logger } from '@ora-io/utils'
6-
import type { Context } from '../context'
76
import type { Signal } from './type'
87

98
export interface EventSignalRegisterParams {
@@ -31,7 +30,6 @@ export class EventSignal implements Signal {
3130
public params: EventSignalRegisterParams,
3231
public callback: EventSignalCallback,
3332
public logger: Logger,
34-
public context?: Context,
3533
) {
3634
this.contract = new ethers.Contract(
3735
params.address,
@@ -50,14 +48,14 @@ export class EventSignal implements Signal {
5048
// to align with crosschecker onMissing, parse the last arg from ContractEventPayload to EventLog
5149
this.subscribeCallback = async (...args: Array<any>) => {
5250
const _contractEventPayload = args.pop()
53-
await this.callback(...args, _contractEventPayload.log, context)
51+
await this.callback(...args, _contractEventPayload.log)
5452
await this.crosschecker?.cache!.addLog(_contractEventPayload.log)
5553
}
5654
// to align with subscribe listener, parse event params and add EventLog to the last
5755
this.crosscheckCallback = async (log: Log) => {
5856
const parsedLog = this.contract.interface.decodeEventLog(this.eventFragment, log.data, log.topics)
5957
this.logger.info('crosschecker capture a missing event! processing...', log.transactionHash, log.index)
60-
await this.callback(...parsedLog, log, context)
58+
await this.callback(...parsedLog, log)
6159
}
6260
}
6361

File renamed without changes.

packages/orap/task/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './base'
22
export * from './storable'
3+
export * from './context'

packages/orap/task/storable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Constructor } from '@ora-io/utils'
22
import type { StoreManager } from '../store/storemanager'
3-
import type { Context } from '../context'
3+
import type { Context } from './context'
44
import { TaskBase } from './base'
55

66
export abstract class TaskStorable extends TaskBase {

0 commit comments

Comments
 (0)