Skip to content

Commit

Permalink
Changed JsonRpcProvider for StaticJsonRpcProvider in `providers.t…
Browse files Browse the repository at this point in the history
…s` and `gateway-bootnode.ts` in order to avoid calls to method `eth_chainId`
  • Loading branch information
marcvelmer authored and emmdim committed Jul 1, 2021
1 parent 8c61f8f commit 3a990e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/net/gateway-bootnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
8 changes: 4 additions & 4 deletions src/util/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 3a990e8

Please sign in to comment.