forked from LaconicNetwork/cosmos-explorer
improve
This commit is contained in:
@@ -265,7 +265,7 @@ export const useDashboard = defineStore('dashboard', {
|
||||
favorite: fav as string[],
|
||||
favoriteMap: favMap as Record<string, boolean>,
|
||||
chains: {} as Record<string, ChainConfig>,
|
||||
prices: {},
|
||||
prices: {} as Record<string, any>,
|
||||
coingecko: {} as Record<string, {coinId: string, exponent: number, symbol: string}>,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -69,7 +69,7 @@ export const useFormatter = defineStore('formatter', {
|
||||
return trace;
|
||||
},
|
||||
priceInfo(denom: string) {
|
||||
const id = this.dashboard.coingecko[denom]?.coinId;
|
||||
const id = this.dashboard.coingecko[denom]?.coinId || "";
|
||||
const prices = this.dashboard.prices[id];
|
||||
return prices;
|
||||
},
|
||||
@@ -96,7 +96,10 @@ export const useFormatter = defineStore('formatter', {
|
||||
return v!==0 ? numeral(v).format("+0,0.[00]"): ""
|
||||
},
|
||||
tokenValue(token?: Coin) {
|
||||
return token ? numeral(this.formatTokenAmount(token)).format('0,0.[00]') : ""
|
||||
if(token) {
|
||||
return numeral(this.tokenValueNumber(token)).format("0,0.[00]")
|
||||
}
|
||||
return ""
|
||||
},
|
||||
tokenValueNumber(token?: Coin) {
|
||||
if(!token) return 0
|
||||
@@ -129,7 +132,7 @@ export const useFormatter = defineStore('formatter', {
|
||||
formatToken(
|
||||
token?: { denom: string; amount: string },
|
||||
withDenom = true,
|
||||
fmt = '0.0a',
|
||||
fmt = '0,0.[0]',
|
||||
mode = 'local'
|
||||
): string {
|
||||
if (token && token.amount && token?.denom) {
|
||||
|
||||
@@ -42,8 +42,9 @@ export const useWalletStore = defineStore('walletStore', {
|
||||
);
|
||||
},
|
||||
stakingAmount() {
|
||||
const stakingStore = useStakingStore();
|
||||
let amt = 0;
|
||||
let denom = '';
|
||||
let denom = stakingStore.params.bond_denom;
|
||||
this.delegations.forEach((i) => {
|
||||
amt += Number(i.balance.amount);
|
||||
denom = i.balance.denom;
|
||||
|
||||
Reference in New Issue
Block a user