From ebfb8e730d1a351187b71a5a1ec12e21b76fdb40 Mon Sep 17 00:00:00 2001 From: Michael Wallace Date: Fri, 10 Nov 2023 13:04:18 +1100 Subject: [PATCH] fix: use StaticJsonRpcProvider in ethersAdapter --- javascript/engine-js/src/wallet/EthersAdapter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/engine-js/src/wallet/EthersAdapter.ts b/javascript/engine-js/src/wallet/EthersAdapter.ts index 069f44ad..e1f95ae7 100644 --- a/javascript/engine-js/src/wallet/EthersAdapter.ts +++ b/javascript/engine-js/src/wallet/EthersAdapter.ts @@ -113,7 +113,7 @@ export class EthersAdapter implements IWalletAdapter { // TODO: add all chain URLs into some configuration. const provider = stateMutability === "view" ? - new ethers.providers.JsonRpcProvider(this.getRpcUrl(chain), chain) : + new ethers.providers.StaticJsonRpcProvider(this.getRpcUrl(chain), chain) : (await this.getEthersProvider()).getSigner(); return new Contract(contractAddr, [abiData], provider); @@ -174,7 +174,7 @@ export class EthersAdapter implements IWalletAdapter { console.log("Get ethereum events. chain " + chain + "; contract " + contractAddr + "; event " + event + ";"); console.log(inputs); - const provider = new ethers.providers.JsonRpcProvider(this.getRpcUrl(chain)); + const provider = new ethers.providers.StaticJsonRpcProvider(this.getRpcUrl(chain), chain); const contract = new Contract(contractAddr, [{ name: event,