Skip to content

Commit

Permalink
fix: ethereum client issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 committed May 16, 2023
1 parent 53a0c01 commit 2605cdb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions store/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export const useOnboardStore = defineStore("onboard", () => {
);
web3modal.setDefaultChain(selectedEthereumNetwork.value);
ethereumClient.watchAccount(async (updatedAccount) => {
// There is a bug in @wagmi/core@0.10.11 or @web3modal/ethereum@^2.3.7
// On page update or after using `ethereumClient.disconnect` method
// the account state is replaced with "connecting" state
if (updatedAccount.status === "connecting" && !updatedAccount.connector) {
return;
}
account.value = updatedAccount;
connectorName.value = wagmiClient.connector?.name;
walletName.value = getWalletName();
Expand All @@ -63,14 +69,7 @@ export const useOnboardStore = defineStore("onboard", () => {

const openModal = () => web3modal.openModal();
const disconnect = () => {
ethereumClient.disconnect().then(() => {
// There is a bug in @wagmi/core@0.10.11 or @web3modal/ethereum@^2.3.7
// After using `ethereumClient.disconnect` method the account state
// is replaced with "connecting" state
setTimeout(() => {
wagmiClient.clearState();
}, 0);
});
ethereumClient.disconnect();
};

const isCorrectNetworkSet = computed(() => {
Expand Down

0 comments on commit 2605cdb

Please sign in to comment.