Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: specify chainId on StaticJsonRpcProvider instantiation #339

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading