diff --git a/components/balance/MultipleBalances.vue b/components/balance/MultipleBalances.vue index cfb18aa513..ebaca55e02 100644 --- a/components/balance/MultipleBalances.vue +++ b/components/balance/MultipleBalances.vue @@ -1,29 +1,46 @@ @@ -50,7 +67,7 @@ import { calculateExactUsdFromToken } from '@/utils/calculation' import { getAssetIdByAccount } from '@/utils/api/bsx/query' import { toDefaultAddress } from '@/utils/account' -import { useIdentityStore } from '@/stores/identity' +import { ChainToken, useIdentityStore } from '@/stores/identity' import type { PalletBalancesAccountData } from '@polkadot/types/lookup' @@ -73,6 +90,26 @@ const networkToPrefix = { 'basilisk-testnet': 'snek', } +const isBalanceLoading = computed( + () => identityStore.getStatusMultiBalances === 'loading' +) +const filterEmptyBalanceChains = (chain: ChainToken = {}) => { + const tokens = Object.keys(chain) + return tokens + .filter((token) => chain[token].balance !== '0') + .map((token) => ({ + name: token, + details: chain[token], + })) +} + +const isEmptyBalanceOnAllChains = computed(() => { + const chains = Object.keys(multiBalances.value.chains) + return !chains.some( + (chain) => + filterEmptyBalanceChains(multiBalances.value.chains[chain]).length !== 0 + ) +}) const currentNetwork = computed(() => isTestnet.value ? 'test-network' : 'main-network' ) diff --git a/locales/en.json b/locales/en.json index 55d049fc48..7b9225ac8d 100644 --- a/locales/en.json +++ b/locales/en.json @@ -947,7 +947,8 @@ "table": { "balance": "Balance", "empty": "There are currently no assets for this user." - } + }, + "emptyAsset": "You've got zero balance on this address across chains we are monitoring. If you want to buy small amount of crypto, click on Add funds through our verified on-ramp partner." }, "ramp": { "selectAccount": "Select your account and click on buy.", diff --git a/stores/identity.ts b/stores/identity.ts index a8ca7003dc..705725c35f 100644 --- a/stores/identity.ts +++ b/stores/identity.ts @@ -43,7 +43,7 @@ type ChainDetail = { selected: boolean address: string } -type ChainToken = Partial> +export type ChainToken = Partial> interface MultiBalances { address: string