Skip to content

Commit

Permalink
fix: specify chainId on StaticJsonRpcProvider instantiation (#339)
Browse files Browse the repository at this point in the history
specify chainId
  • Loading branch information
ConjunctiveNormalForm authored Nov 13, 2023
1 parent d64a9f3 commit 3fc04f3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/handlers/check-order-status/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BaseOrdersRepository } from '../../repositories/base'
import { DynamoOrdersRepository } from '../../repositories/orders-repository'
import { setGlobalMetrics } from '../../util/metrics'
import { BaseRInj, SfnInjector, SfnStateInputOutput } from '../base/index'
import { checkDefined } from '../../preconditions/preconditions';

export interface RequestInjected extends BaseRInj {
chainId: number
Expand Down Expand Up @@ -45,12 +46,12 @@ export class CheckOrderStatusInjector extends SfnInjector<ContainerInjected, Req
serializers: bunyan.stdSerializers,
})

const chainId = event.chainId
const chainId = checkDefined(event.chainId, 'chainId not defined') as number
const rpcURL = process.env[`RPC_${chainId}`]
const provider = new ethers.providers.StaticJsonRpcProvider(rpcURL)
const quoter = new OrderValidator(provider, parseInt(chainId as string))
const provider = new ethers.providers.StaticJsonRpcProvider(rpcURL, chainId)
const quoter = new OrderValidator(provider, chainId)
// TODO: use different reactor address for different order type
const watcher = new EventWatcher(provider, REACTOR_ADDRESS_MAPPING[chainId as number][OrderType.Dutch])
const watcher = new EventWatcher(provider, REACTOR_ADDRESS_MAPPING[chainId][OrderType.Dutch])

return {
log,
Expand Down

0 comments on commit 3fc04f3

Please sign in to comment.