add asset panel

This commit is contained in:
liangping 2023-05-10 13:04:57 +08:00
parent e011ec0691
commit c37c4cbc8d
2 changed files with 17 additions and 7 deletions

View File

@ -3,12 +3,14 @@ import { ref } from 'vue';
import { useBlockchain, useWalletStore } from '@/stores'; import { useBlockchain, useWalletStore } from '@/stores';
const walletStore = useWalletStore() const walletStore = useWalletStore()
walletStore.$subscribe((m, s) => {
console.log(m, s)
})
</script> </script>
<template> <template>
<div> <div>
<span v-if="walletStore.currentAddress">{{ walletStore.currentAddress }}</span> <span v-if="walletStore.currentAddress">{{ walletStore.currentAddress }}</span>
<ping-connect-wallet v-else class="mt-5" :chain-id="'juno-1'" :hd-path="`m/44'/118/0'/0/0`" /> <ping-connect-wallet class="mt-5" :chain-id="'juno-1'" :hd-path="`m/44'/118/0'/0/0`" />
</div> </div>
</template> </template>

View File

@ -14,6 +14,7 @@ import ProposalListItem from '@/components/ProposalListItem.vue';
const blockchain = useBlockchain(); const blockchain = useBlockchain();
const store = useIndexModule(); const store = useIndexModule();
const walletStore = useWalletStore() const walletStore = useWalletStore()
const format = useFormatter()
const coinInfo = computed(() => { const coinInfo = computed(() => {
return store.coinInfo; return store.coinInfo;
@ -21,9 +22,9 @@ const coinInfo = computed(() => {
onMounted(() => { onMounted(() => {
store.loadDashboard(); store.loadDashboard();
walletStore.loadMyAsset()
}); });
const format = useFormatter();
const ticker = computed(() => store.coinInfo.tickers[store.tickerIndex]); const ticker = computed(() => store.coinInfo.tickers[store.tickerIndex]);
blockchain.$subscribe((m, s) => { blockchain.$subscribe((m, s) => {
@ -32,6 +33,7 @@ blockchain.$subscribe((m, s) => {
['chainName', 'endpoint'].includes(m.events.key) ['chainName', 'endpoint'].includes(m.events.key)
) { ) {
store.loadDashboard(); store.loadDashboard();
walletStore.loadMyAsset()
} }
}); });
function shortName(name: string, id: string) { function shortName(name: string, id: string) {
@ -226,10 +228,16 @@ const comLinks = [
<span v-if="walletStore.currentAddress" class="float-right font-light text-sm">More</span> <span v-if="walletStore.currentAddress" class="float-right font-light text-sm">More</span>
</div> </div>
<div class="grid grid-cols-1 md:grid-cols-4 auto-cols-auto gap-4 px-4 pb-8 py-4"> <div class="grid grid-cols-1 md:grid-cols-4 auto-cols-auto gap-4 px-4 pb-8 py-4">
<div class="bg-base-100">1</div> <div class="bg-base-100">{{ format.formatToken(walletStore.balanceOfStakingToken) }}</div>
<div class="bg-base-100">2</div> <div class="bg-base-100">{{ format.formatToken(walletStore.stakingAmount) }}</div>
<div class="bg-base-100">1</div> <div class="bg-base-100">{{ format.formatToken(walletStore.rewardAmount) }}</div>
<div class="bg-base-100">2</div> <div class="bg-base-100">{{ format.formatToken(walletStore.unbondingAmount) }}</div>
</div>
<div>
<div v-for="v in walletStore.delegations">
{{ v }}
</div>
</div> </div>
<div> <div>