Skip to content

Commit

Permalink
fix: use staticJsonRpcProvider (#333)
Browse files Browse the repository at this point in the history
change all json rpc provider to static rpc provider
  • Loading branch information
zhongeric authored Nov 6, 2023
1 parent 0725838 commit 270b275
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/handlers/check-order-status/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface RequestInjected extends BaseRInj {
orderStatus: string
getFillLogAttempts: number
retryCount: number
provider: ethers.providers.JsonRpcProvider
provider: ethers.providers.StaticJsonRpcProvider
orderWatcher: EventWatcher
orderQuoter: OrderValidator
}
Expand Down Expand Up @@ -47,7 +47,7 @@ export class CheckOrderStatusInjector extends SfnInjector<ContainerInjected, Req

const chainId = event.chainId
const rpcURL = process.env[`RPC_${chainId}`]
const provider = new ethers.providers.JsonRpcProvider(rpcURL)
const provider = new ethers.providers.StaticJsonRpcProvider(rpcURL)
const quoter = new OrderValidator(provider, parseInt(chainId as string))
// TODO: use different reactor address for different order type
const watcher = new EventWatcher(provider, REACTOR_ADDRESS_MAPPING[chainId as number][OrderType.Dutch])
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/post-order/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class PostOrderInjector extends ApiInjector<ContainerInjected, ApiRInj, P
if (typeof chainId === 'number') {
const rpc = process.env[`RPC_${chainId}`]
if (rpc) {
onchainValidatorByChainId[chainId] = new OnchainValidator(new ethers.providers.JsonRpcProvider(rpc), chainId)
onchainValidatorByChainId[chainId] = new OnchainValidator(new ethers.providers.StaticJsonRpcProvider(rpc), chainId)
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions test/integ/order.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('/dutch-auction/order', () => {
jest.retryTimes(2)
let alice: Wallet
let filler: Wallet
let provider: ethers.providers.JsonRpcProvider
let provider: ethers.providers.StaticJsonRpcProvider
let aliceAddress: string
let nonce: BigNumber
let URL: string
Expand All @@ -69,7 +69,7 @@ describe('/dutch-auction/order', () => {
}
URL = process.env.UNISWAPX_SERVICE_URL

provider = new ethers.providers.JsonRpcProvider(process.env.RPC_5)
provider = new ethers.providers.StaticJsonRpcProvider(process.env.RPC_5)
alice = new ethers.Wallet(process.env.TEST_WALLET_PK).connect(provider)
filler = new ethers.Wallet(process.env.TEST_FILLER_PK).connect(provider)
aliceAddress = (await alice.getAddress()).toLowerCase()
Expand Down

0 comments on commit 270b275

Please sign in to comment.