From 8ec5a9822a2de1693f4f1b42a782b78a0fb435f7 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 12 Jun 2023 10:33:47 +0800 Subject: [PATCH] format total value --- src/modules/[chain]/account/[address].vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/modules/[chain]/account/[address].vue b/src/modules/[chain]/account/[address].vue index ac4dcffe..409687b0 100644 --- a/src/modules/[chain]/account/[address].vue +++ b/src/modules/[chain]/account/[address].vue @@ -67,7 +67,22 @@ const totalAmount = computed(() => { }); const totalValue = computed(() => { - return 0; + let value = 0; + delegations.value?.forEach((x) => { + value += format.tokenValueNumber(x.balance); + }); + rewards.value?.total?.forEach((x) => { + value += format.tokenValueNumber(x); + }); + balances.value?.forEach((x) => { + value += format.tokenValueNumber(x); + }); + unbonding.value?.forEach((x) => { + x.entries?.forEach((y) => { + value += format.tokenValueNumber({amount: y.balance, denom: stakingStore.params.bond_denom}); + }); + }); + return format.formatNumber(value, '0,0.00'); });