From 0d74521b2d634e731ed3252f51f8c771809ae86c Mon Sep 17 00:00:00 2001 From: Pavel Zaborskii Date: Tue, 4 Feb 2025 17:57:34 +0300 Subject: [PATCH] index.ts --- packages/web3-react-agw/src/index.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/web3-react-agw/src/index.ts b/packages/web3-react-agw/src/index.ts index 6ca2f61..66c704e 100644 --- a/packages/web3-react-agw/src/index.ts +++ b/packages/web3-react-agw/src/index.ts @@ -62,12 +62,7 @@ export class AbstractGlobalWallet extends Connector { this.actions.resetState(); this.onError?.(error); }); - - this.provider.on('disconnect', (error: ProviderRpcError): void => { - this.actions.resetState(); - this.onError?.(error); - }); - + this.provider.on('chainChanged', (chainId: string): void => { this.actions.update({ chainId: parseChainId(chainId) }); }); @@ -148,7 +143,7 @@ export class AbstractGlobalWallet extends Connector { method: 'wallet_switchEthereumChain', params: [{ chainId: desiredChainIdHex }], }); - this.activate(desiredChainId); + await this.activate(desiredChainId); } else { throw new Error('Invalid chain'); }