- {{ formatDenom(b.denom) }}
+ {{ formatAmount(b.amount, b.denom) }} {{ formatDenom(b.denom) }}
+ {{ currency }}{{ formatCurrency(b.amount, b.denom) }}
+
+
+ {{ currency }}{{ formatPrice(b.denom) }}
{{ formatChanges(b.denom) }}
-
- {{ formatAmount(b.amount, b.denom) }}
- {{ currency }}{{ formatCurrency(b.amount, b.denom) }}
-
- {{ formatDenom(b.denom) }}
+ {{ formatAmount(b.amount, b.denom) }} {{ formatDenom(b.denom) }}
+ {{ currency }}{{ formatCurrency(b.amount, b.denom) }}
+
+
+ {{ currency }}{{ formatPrice(b.denom) }}
{{ formatChanges(b.denom) }}
-
- {{ formatAmount(b.amount, b.denom) }}
- {{ currency }}{{ formatCurrency(b.amount, b.denom) }}
-
@@ -515,8 +515,16 @@ export default {
})
this.$http.getStakingDelegations(add.addr, chains[add.chain]).then(res => {
if (res.delegation_responses) {
- const delegation = res.delegation_responses.map(x => x.balance)
- this.$set(this.delegations, add.addr, delegation)
+ const delegation = res.delegation_responses.map(x => x.balance).reduce((t, c) => {
+ const t1 = t
+ if (t1[c.denom]) {
+ t1[c.denom] += Number(c.amount)
+ } else {
+ t1[c.denom] = Number(c.amount)
+ }
+ return t1
+ }, {})
+ this.$set(this.delegations, add.addr, Object.keys(delegation).map(x => ({ amount: String(delegation[x]), denom: x })))
}
}).catch(() => {})
})
@@ -536,10 +544,12 @@ export default {
this.$bvModal.hide('add-account')
},
formatDenom(v) {
+ if (!v) return ''
const denom = (v.startsWith('ibc') ? this.ibcDenom[v] : v)
return formatTokenDenom(denom)
},
formatAmount(v, denom = 'uatom') {
+ if (!v) return ''
return formatTokenAmount(v, 2, denom)
},
formatAddr(v) {
@@ -577,6 +587,15 @@ export default {
const price = this.getChanges(denom)
return price === 0 ? '' : `${parseFloat(price.toFixed(2))}%`
},
+ formatPrice(denom) {
+ const d2 = this.formatDenom(denom)
+ const quote = this.$store.state.chains.quotes[d2]
+ if (quote) {
+ const price = quote[this.currency2]
+ return price
+ }
+ return 0
+ },
formatBalance(v) {
let total = 0
const balance = this.balances[v]