wallet & account login flow bugfixes; pinned mdi icons 6.9.96 because it's the last version to include a Discord icon

This commit is contained in:
Tim Olson
2023-11-10 20:52:23 -04:00
parent 71a8dd8c18
commit 5aaeb1461d
5 changed files with 28 additions and 27 deletions

View File

@@ -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",

View File

@@ -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()
}
})
}

View File

@@ -3,11 +3,11 @@
<phone-card v-if="!walletOk">
<v-card-title>Install Wallet</v-card-title>
<v-card-text>
A cryptocurrency wallet such as <a href="https://metamask.io/download/">MetaMask</a> is required to use Dexorder.
Please install a crypto wallet into your browser to experience the power of Dexorder.
A cryptocurrency wallet such as <a href="https://metamask.io/download/" target="MetaMask">MetaMask</a> is
required to use Dexorder. Please install a crypto wallet into your browser to experience the power of Dexorder.
</v-card-text>
<v-card-actions>
<v-btn prepend-icon="mdi-reload" text="Reload After Installing Wallet"/>
<v-btn prepend-icon="mdi-reload" text="Reload After Installing Wallet" @click="reload"/>
</v-card-actions>
</phone-card>
<phone-card v-if="walletOk && !providerOk">
@@ -36,13 +36,12 @@
<li>Click in the upper-left to choose a Network</li>
<li>Click the "Add Network" button</li>
<li>Choose "Add a Network Manually"</li>
<li>Choose "Add a network manually"</li>
<li>Enter the following information:
<ul>
<li>Name: Dexorder Alpha</li>
<li>New RPC URL: https://rpc.alpha.dexorder.trade</li>
<li>Chain ID: 31337</li>
<li>Currency Symbol: ETH</li>
<li>Currency Symbol: TETH</li>
</ul>
</li>
<li>
@@ -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()
}
</script>
<style scoped lang="scss">

View File

@@ -7,7 +7,7 @@
Please select an account to use from your wallet.
</v-card-text>
<v-card-actions>
<v-btn @click="connectWallet">Connect Wallet</v-btn>
<btn icon="mdi-wallet-outline" color="warning" @click="connectWallet">Connect Wallet</btn>
</v-card-actions>
</phone-card>
</NeedsProvider>
@@ -19,6 +19,7 @@ import NeedsProvider from "@/components/NeedsProvider.vue";
import {computed} from "vue";
import PhoneCard from "@/components/PhoneCard.vue";
import {connectWallet} from "@/blockchain/wallet.js";
import Btn from "@/components/Btn.vue";
const s = useStore()

View File

@@ -183,10 +183,10 @@
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
"@mdi/font@7.0.96":
version "7.0.96"
resolved "https://registry.yarnpkg.com/@mdi/font/-/font-7.0.96.tgz#9853c222623072f5575b4039c8c195ea929b61fc"
integrity sha512-rzlxTfR64hqY8yiBzDjmANfcd8rv+T5C0Yedv/TWk2QyAQYdc66e0kaN1ipmnYU3RukHRTRcBARHzzm+tIhL7w==
"@mdi/font@6.9.96":
version "6.9.96"
resolved "https://registry.yarnpkg.com/@mdi/font/-/font-6.9.96.tgz#c68da7e0895885dd09e60dc08c5ecc0d77f67efb"
integrity sha512-z3QVZStyHVwkDsFR7A7F2PIvZJPWgdSFw4BEEy2Gc9HUN5NfK9mGbjgaYClRcbMWiYEV45srmiYtczmBtCqR8w==
"@noble/hashes@1.1.2":
version "1.1.2"