diff --git a/src/views/Summary.vue b/src/views/Summary.vue index cef456b1..2aa1dbcd 100644 --- a/src/views/Summary.vue +++ b/src/views/Summary.vue @@ -227,6 +227,9 @@ export default { if (isToken(data[k])) { return { title: tokenFormatter(data[k]), subtitle: k } } + if (typeof data[k] === 'boolean') { + return { title: data[k], subtitle: k } + } const d = Number(data[k]) if (d < 1.01) { return { title: `${percent(d)}%`, subtitle: k } diff --git a/src/views/SummaryAssetsComponent.vue b/src/views/SummaryAssetsComponent.vue index 31434222..3c79cf7b 100644 --- a/src/views/SummaryAssetsComponent.vue +++ b/src/views/SummaryAssetsComponent.vue @@ -5,6 +5,7 @@ import { BTable, BCardTitle, BCard } from 'bootstrap-vue' -import { formatNumber } from '@/libs/data' +import { formatNumber, formatTokenDenom } from '@/libs/data' +import chainAPI from '@/libs/fetch' export default { components: { @@ -26,11 +28,17 @@ export default { data() { return { assets: [], - field: [ + denoms: [], + cfield: [ { key: 'denom', + formatter: this.formatDenom, tdClass: 'text-nowrap text-truncate overflow-hidden', }, + 'abbr', + { + key: 'amount', + }, ], } }, @@ -38,6 +46,11 @@ export default { this.$http.getBankTotals().then(res => { const toshow = res.sort() this.assets = toshow.reverse().map(x => { + if (x.denom.startsWith('ibc/')) { + chainAPI.getIBCDenomTraceText(this.$http.config.api, x.denom).then(denom => { + this.$set(this.denoms, x.denom, denom) + }) + } const xh = x const amount = Number(x.amount) / 1000000 xh.abbr = amount > 1 ? formatNumber(amount, true) : amount @@ -45,6 +58,11 @@ export default { }) }) }, + methods: { + formatDenom(v) { + return formatTokenDenom(this.denoms[v] ? this.denoms[v] : v) + }, + }, }