From 0cba49a5b8434465f3f5ec55a5968e0f894708ea Mon Sep 17 00:00:00 2001 From: apporc Date: Thu, 24 Oct 2024 12:02:13 +0800 Subject: [PATCH] Fix default asset symbol in overview page --- src/routes/[network]/(account)/(staking)/staking/+page.svelte | 4 +--- src/routes/[network]/(account)/(staking)/staking/utils.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/routes/[network]/(account)/(staking)/staking/+page.svelte b/src/routes/[network]/(account)/(staking)/staking/+page.svelte index c23369eeb..e117b429f 100644 --- a/src/routes/[network]/(account)/(staking)/staking/+page.svelte +++ b/src/routes/[network]/(account)/(staking)/staking/+page.svelte @@ -13,9 +13,7 @@ const { data } = $props(); const networkName = String(data.network); - let staked: Asset = $derived( - context.account ? getStakedBalance(data.network, context.account) : Asset.from(0, '0,UNKNOWN') - ); + let staked: Asset = $derived(getStakedBalance(data.network, context.account)); let unstaking: Array = $derived( context.account ? getUnstakingBalances(data.network, context.account) : [] ); diff --git a/src/routes/[network]/(account)/(staking)/staking/utils.ts b/src/routes/[network]/(account)/(staking)/staking/utils.ts index 2ac568aee..66681458c 100644 --- a/src/routes/[network]/(account)/(staking)/staking/utils.ts +++ b/src/routes/[network]/(account)/(staking)/staking/utils.ts @@ -22,7 +22,7 @@ export function getStakableBalance(network: NetworkState, account: AccountState) return Asset.fromUnits(balance, network.chain.systemToken!.symbol); } -export function getStakedBalance(network: NetworkState, account: AccountState): Asset { +export function getStakedBalance(network: NetworkState, account?: AccountState): Asset { const staked = Int64.from(0); if (account && account.loaded) { if (account.account?.data.rex_info) {