From 469ce2721a44b70c35341801016363e7985f6f22 Mon Sep 17 00:00:00 2001 From: Georges KABBOUCHI Date: Wed, 11 Aug 2021 22:43:46 +0300 Subject: [PATCH] refresh web3 on accounts changed --- composables/useWeb3.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composables/useWeb3.ts b/composables/useWeb3.ts index e335e78..83a5af7 100644 --- a/composables/useWeb3.ts +++ b/composables/useWeb3.ts @@ -110,6 +110,7 @@ export function useWeb3() { // Subscribe to chainId change provider.on("chainChanged", refreshWeb3); + provider.on("accountsChanged", refreshWeb3); }; const refreshWeb3 = async () => { @@ -119,7 +120,6 @@ export function useWeb3() { let newWeb3 = new Web3(web3Provider); chainId.value = await newWeb3.eth.getChainId(); web3.value = newWeb3; - window.web3 = web3.value; }; return {