From 5aaeb1461dc33d3148d7f1eecb5c4af43cefea9c Mon Sep 17 00:00:00 2001 From: Tim Olson <> Date: Fri, 10 Nov 2023 20:52:23 -0400 Subject: [PATCH] wallet & account login flow bugfixes; pinned mdi icons 6.9.96 because it's the last version to include a Discord icon --- package.json | 2 +- src/blockchain/wallet.js | 29 ++++++++++++++--------------- src/components/NeedsProvider.vue | 13 +++++++------ src/components/NeedsSigner.vue | 3 ++- yarn.lock | 8 ++++---- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index f1b6032..9b143f0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "lint": "eslint . --fix --ignore-path .gitignore" }, "dependencies": { - "@mdi/font": "7.0.96", + "@mdi/font": "6.9.96", "core-js": "^3.29.0", "ethers": "^6.7.1", "pinia": "2.1.6", diff --git a/src/blockchain/wallet.js b/src/blockchain/wallet.js index edee68b..e6d500e 100644 --- a/src/blockchain/wallet.js +++ b/src/blockchain/wallet.js @@ -7,14 +7,14 @@ import {vaultAbi} from "@/blockchain/abi.js"; export function onChainChanged(chainId) { chainId = Number(chainId) - console.log('chain changed', chainId) const store = useStore() if( chainId !== store.chainId ) { + console.log('chain changed', chainId) + store.chainId = chainId // touch the chainId last. will cause any clients of the store's provider getter to refresh + store.account = null const provider = new ethers.BrowserProvider(window.ethereum, chainId); setProvider(provider, chainId) - store.account = null provider.listAccounts().then(changeAccounts) - store.chainId = chainId // touch the chainId last. will cause any clients of the store's provider getter to refresh } } @@ -28,18 +28,13 @@ function changeAccounts(accounts) { } else { const store = useStore() - store.account = accounts[0].address - if( pendingOrders.length ) { - if( store.vault ) - flushOrders() - else - ensureVault() - } - else - discoverVaults() + store.account = accounts[0] + console.log('set store.account to', accounts[0], store.account) + discoverVaults() flushTransactions() - socket.emit('address', store.chainId, accounts[0].address) + socket.emit('address', store.chainId, accounts[0]) } + console.log('changeAccounts ended') } function onAccountsChanged(accounts) { @@ -104,10 +99,14 @@ function discoverVaults() { s.vaults = [] else _discoverVaults(owner).then((result)=>{ + console.log('read store.account', s.account) if( s.account === owner ) { // double-check the account since it could have changed during our await s.vaults = result - if( result.length && pendingOrders.length ) - flushOrders(result[0]) + if( pendingOrders.length ) + if( result.length ) + flushOrders(result[0]) + else + ensureVault() } }) } diff --git a/src/components/NeedsProvider.vue b/src/components/NeedsProvider.vue index e8688fa..5bae2bd 100644 --- a/src/components/NeedsProvider.vue +++ b/src/components/NeedsProvider.vue @@ -3,11 +3,11 @@ Install Wallet - A cryptocurrency wallet such as MetaMask is required to use Dexorder. - Please install a crypto wallet into your browser to experience the power of Dexorder. + A cryptocurrency wallet such as MetaMask is + required to use Dexorder. Please install a crypto wallet into your browser to experience the power of Dexorder. - + @@ -36,13 +36,12 @@
  • Click in the upper-left to choose a Network
  • Click the "Add Network" button
  • Choose "Add a Network Manually"
  • -
  • Choose "Add a network manually"
  • Enter the following information:
  • @@ -70,7 +69,9 @@ const chainOk = computed(()=>providerOk.value && s.helper!==null) const ok = computed(()=>{ return walletOk && providerOk.value && chainOk.value }) - +function reload() { + window.location.reload() +}