forked from cerc-io/cosmos-explorer
improve wallet change
This commit is contained in:
parent
e83e38355f
commit
1082d56251
@ -110,19 +110,23 @@
|
||||
v-for="(item,k) in accounts"
|
||||
:key="k"
|
||||
:disabled="!item.address"
|
||||
:to="`/${selected_chain.chain_name}/account/${item.address.addr}`"
|
||||
@click="updateDefaultWallet(item.wallet)"
|
||||
>
|
||||
<div class="d-flex flex-column">
|
||||
<span class="font-weight-bolder">{{ item.wallet }}
|
||||
<b-avatar
|
||||
v-if="item.wallet===walletName"
|
||||
variant="success"
|
||||
size="sm"
|
||||
>
|
||||
<feather-icon icon="CheckIcon" />
|
||||
</b-avatar>
|
||||
</span>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="font-weight-bolder">{{ item.wallet }}
|
||||
<b-avatar
|
||||
v-if="item.wallet===walletName"
|
||||
variant="success"
|
||||
size="sm"
|
||||
>
|
||||
<feather-icon icon="CheckIcon" />
|
||||
</b-avatar>
|
||||
</span>
|
||||
<b-link :to="`/${selected_chain.chain_name}/account/${item.address.addr}`">
|
||||
<feather-icon icon="ArrowRightIcon" />
|
||||
</b-link>
|
||||
</div>
|
||||
<small>{{ item.address ? formatAddr(item.address.addr) : `Not available on ${selected_chain.chain_name}` }}</small>
|
||||
</div>
|
||||
</b-dropdown-item>
|
||||
|
@ -248,6 +248,16 @@ export default {
|
||||
computed: {
|
||||
walletName() {
|
||||
const key = this.$store?.state?.chains?.defaultWallet
|
||||
if (key) {
|
||||
const accounts = getLocalAccounts() || {}
|
||||
const account = Object.entries(accounts)
|
||||
.map(v => ({ wallet: v[0], address: v[1].address.find(x => x.chain === this.$store.state.chains.selected.chain_name) }))
|
||||
.filter(v => v.address)
|
||||
.find(x => x.wallet === key)
|
||||
if (account) {
|
||||
this.fetchAccount(account.address.addr)
|
||||
}
|
||||
}
|
||||
return key || 'Wallet'
|
||||
},
|
||||
},
|
||||
@ -290,15 +300,6 @@ export default {
|
||||
this.$http.getGovernanceListByStatus(2).then(res => {
|
||||
this.proposals = res.proposals
|
||||
})
|
||||
|
||||
const accounts = getLocalAccounts() || {}
|
||||
const account = Object.entries(accounts)
|
||||
.map(v => ({ wallet: v[0], address: v[1].address.find(x => x.chain === this.$store.state.chains.selected.chain_name) }))
|
||||
.filter(v => v.address)
|
||||
.find(x => x.wallet === this.walletName)
|
||||
if (account) {
|
||||
this.fetchAccount(account.address.addr)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatToken(tokens) {
|
||||
|
Loading…
Reference in New Issue
Block a user