From 3a990e8dd27b9861e4c087e40e7cf1365ff78748 Mon Sep 17 00:00:00 2001 From: Marc Velmer Date: Thu, 1 Jul 2021 09:42:34 +0200 Subject: [PATCH] Changed `JsonRpcProvider` for `StaticJsonRpcProvider` in `providers.ts` and `gateway-bootnode.ts` in order to avoid calls to method `eth_chainId` --- src/net/gateway-bootnode.ts | 6 +++--- src/util/providers.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/net/gateway-bootnode.ts b/src/net/gateway-bootnode.ts index baf87f2b..58679588 100644 --- a/src/net/gateway-bootnode.ts +++ b/src/net/gateway-bootnode.ts @@ -51,13 +51,13 @@ export class GatewayBootnode { break case "xdai": if (environment === "prod") { - provider = new providers.JsonRpcProvider(XDAI_PROVIDER_URI, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_ENS_REGISTRY_ADDRESS }) + provider = new providers.StaticJsonRpcProvider(XDAI_PROVIDER_URI, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_ENS_REGISTRY_ADDRESS }) break } - provider = new providers.JsonRpcProvider(XDAI_PROVIDER_URI, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_STG_ENS_REGISTRY_ADDRESS }) + provider = new providers.StaticJsonRpcProvider(XDAI_PROVIDER_URI, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_STG_ENS_REGISTRY_ADDRESS }) break case "sokol": - provider = new providers.JsonRpcProvider(SOKOL_PROVIDER_URI, { chainId: SOKOL_CHAIN_ID, name: "sokol", ensAddress: SOKOL_ENS_REGISTRY_ADDRESS }); + provider = new providers.StaticJsonRpcProvider(SOKOL_PROVIDER_URI, { chainId: SOKOL_CHAIN_ID, name: "sokol", ensAddress: SOKOL_ENS_REGISTRY_ADDRESS }); break default: throw new Error("Invalid Network ID") } diff --git a/src/util/providers.ts b/src/util/providers.ts index 7dded6ef..dec5cca4 100644 --- a/src/util/providers.ts +++ b/src/util/providers.ts @@ -18,12 +18,12 @@ export class ProviderUtil { switch (networkId) { case "xdai": if (environment === 'prod') - return new providers.JsonRpcProvider(uri, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_ENS_REGISTRY_ADDRESS }) - return new providers.JsonRpcProvider(uri, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_STG_ENS_REGISTRY_ADDRESS }) + return new providers.StaticJsonRpcProvider(uri, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_ENS_REGISTRY_ADDRESS }) + return new providers.StaticJsonRpcProvider(uri, { chainId: XDAI_CHAIN_ID, name: "xdai", ensAddress: XDAI_STG_ENS_REGISTRY_ADDRESS }) case "sokol": - return new providers.JsonRpcProvider(uri, { chainId: SOKOL_CHAIN_ID, name: "sokol", ensAddress: SOKOL_ENS_REGISTRY_ADDRESS }) + return new providers.StaticJsonRpcProvider(uri, { chainId: SOKOL_CHAIN_ID, name: "sokol", ensAddress: SOKOL_ENS_REGISTRY_ADDRESS }) default: - return new providers.JsonRpcProvider(uri) + return new providers.StaticJsonRpcProvider(uri) } }