Merge pull request #18 from ping-pub/master

merge
This commit is contained in:
Alisa
2023-06-08 17:22:19 +08:00
committed by GitHub
29 changed files with 388 additions and 110 deletions
+1
View File
@@ -10,6 +10,7 @@ export const useBankStore = defineStore('bankstore', {
supply: {} as Coin,
balances: {} as Record<string, Coin[]>,
totalSupply: { supply: [] as Coin[] },
ibcDenoms: {} as Record<string, DenomTrace>
};
},
getters: {
+4 -4
View File
@@ -5,7 +5,7 @@ import {
type Endpoint,
EndpointType,
} from './useDashboard';
import type { VerticalNavItems } from '@/@layouts/types';
import type { NavGroup, NavLink, NavSectionTitle, VerticalNavItems } from '@/layouts/types';
import { useRouter } from 'vue-router';
import { CosmosRestClient } from '@/libs/client';
import {
@@ -107,7 +107,7 @@ export const useBlockchain = defineStore('blockchain', {
// combine all together
return [
...currNavItem,
{ heading: 'Ecosystem' },
{ heading: 'Ecosystem' } as NavSectionTitle,
{
title: 'Favorite',
children: favNavItems,
@@ -115,7 +115,7 @@ export const useBlockchain = defineStore('blockchain', {
badgeClass: 'bg-primary',
i18n: true,
icon: { icon: 'mdi-star', size: '22' },
},
} as NavGroup,
{
title: 'All Blockchains',
to: { path: '/' },
@@ -123,7 +123,7 @@ export const useBlockchain = defineStore('blockchain', {
badgeClass: 'bg-primary',
i18n: true,
icon: { icon: 'mdi-grid', size: '22' },
},
} as NavLink,
];
},
},
+2 -1
View File
@@ -147,6 +147,7 @@ export const useFormatter = defineStore('formatter', {
}
const conf = mode === 'local'? this.blockchain.current?.assets?.find(
// @ts-ignore
(x) => x.base === token.denom || x.base.denom === token.denom
): this.findGlobalAssetConfig(token.denom)
@@ -226,7 +227,7 @@ export const useFormatter = defineStore('formatter', {
numberAndSign(input: number, fmt = '+0,0') {
return numeral(input).format(fmt);
},
toDay(time?: string, format = 'long') {
toDay(time?: string | number, format = 'long') {
if (!time) return '';
if (format === 'long') {
return dayjs(time).format('YYYY-MM-DD HH:mm');
+4 -4
View File
@@ -17,7 +17,7 @@ export const useWalletStore = defineStore('walletStore', {
balances: [] as Coin[],
delegations: [] as Delegation[],
unbonding: [] as UnbondingResponses[],
rewards: {} as DelegatorRewards,
rewards: {total: [], rewards: []} as DelegatorRewards,
walletIsConnected: {} as WalletConnected
};
},
@@ -28,7 +28,7 @@ export const useWalletStore = defineStore('walletStore', {
connectedWallet() {
const chainStore = useBlockchain();
const key = chainStore.defaultHDPath;
let connected = this.walletIsConnected
let connected = {} as WalletConnected
if (!this.walletIsConnected?.cosmosAddress){
connected = JSON.parse(localStorage.getItem(key) || '{}');
}
@@ -54,8 +54,9 @@ export const useWalletStore = defineStore('walletStore', {
},
rewardAmount() {
const stakingStore = useStakingStore();
// @ts-ignore
const reward = this.rewards.total?.find(
(x) => x.denom === stakingStore.params.bond_denom
(x: Coin) => x.denom === stakingStore.params.bond_denom
);
return reward || { amount: '0', denom: stakingStore.params.bond_denom };
},
@@ -125,7 +126,6 @@ export const useWalletStore = defineStore('walletStore', {
console.log(key, 'key')
console.log(localStorage.getItem(key))
localStorage.removeItem(key);
this.walletIsConnected = null
this.$reset()
},
setConnectedWallet(value: any) {