mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
refresh web3 on accounts changed
This commit is contained in:
parent
180b30ac5c
commit
469ce2721a
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user