fix all build checks
This commit is contained in:
parent
e2782c1e00
commit
a25dde89f5
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Ping Dashboard</title>
|
<title>Ping Dashboard - Cosmos Blockchain Explorer And Web Wallet</title>
|
||||||
<meta name="description" content="Ping Dashboard is a block explorer/web wallet for blockchains built on Cosmos SDK, Cosmoshub, Osmosis, Juno, Evmos, Injective, Canto and 70+ blockchains listed on ping.pub" />
|
<meta name="description" content="Ping Dashboard is a block explorer/web wallet for blockchains built on Cosmos SDK, Cosmoshub, Osmosis, Juno, Evmos, Injective, Canto and 70+ blockchains listed on ping.pub" />
|
||||||
<link rel="stylesheet" type="text/css" href="/loader.css" />
|
<link rel="stylesheet" type="text/css" href="/loader.css" />
|
||||||
</head>
|
</head>
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
"@types/marked": "^4.0.8",
|
"@types/marked": "^4.0.8",
|
||||||
"@types/node": "^18.11.12",
|
"@types/node": "^18.11.12",
|
||||||
"@types/numeral": "^2.0.2",
|
"@types/numeral": "^2.0.2",
|
||||||
|
"@types/semver": "7.5.0",
|
||||||
"@vitejs/plugin-vue": "^4.0.0",
|
"@vitejs/plugin-vue": "^4.0.0",
|
||||||
"@vue/tsconfig": "^0.1.3",
|
"@vue/tsconfig": "^0.1.3",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Icon } from '@iconify/vue';
|
import { Icon } from '@iconify/vue';
|
||||||
|
import { controlledComputed } from '@vueuse/core'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
total: { type: Number },
|
total: { type: String },
|
||||||
limit: { type: Number },
|
limit: { type: Number },
|
||||||
callback: { type: Function, required: true },
|
callback: { type: Function, required: true },
|
||||||
});
|
});
|
||||||
@ -10,12 +10,13 @@ const current = ref(1)
|
|||||||
const showSize = 3
|
const showSize = 3
|
||||||
const pages = computed(() => {
|
const pages = computed(() => {
|
||||||
const pages: { color: string, page: number }[] = []
|
const pages: { color: string, page: number }[] = []
|
||||||
if (props.total && props.limit && props.total > props.limit) {
|
const total = Number(props.total || 0)
|
||||||
|
if (total > 0 && props.limit && total > props.limit) {
|
||||||
let page = 0
|
let page = 0
|
||||||
while (true) {
|
while (true) {
|
||||||
if (page * props.limit > props.total) break
|
if (page * props.limit > total) break
|
||||||
page += 1
|
page += 1
|
||||||
if (props.total / props.limit > 10 && page > showSize && page < (props.total / props.limit - showSize + 1)) {
|
if (total / props.limit > 10 && page > showSize && page < (total / props.limit - showSize + 1)) {
|
||||||
if (!(page >= current.value - 1 && page <= current.value + 1)) {
|
if (!(page >= current.value - 1 && page <= current.value + 1)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { toBase64, toHex } from '@cosmjs/encoding';
|
import { toBase64, toHex } from '@cosmjs/encoding';
|
||||||
import { computed } from '@vue/reactivity';
|
import { computed } from '@vue/reactivity';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const props = defineProps(['value']);
|
const props = defineProps(['value']);
|
||||||
const format = ref('base64');
|
const format = ref('base64');
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { defineComponent, resolveComponent, h } from 'vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const routerView = resolveComponent('router-view');
|
const routerView = resolveComponent('router-view');
|
||||||
|
@ -13,6 +13,7 @@ import { useBlockchain } from '@/stores';
|
|||||||
|
|
||||||
import NavBarI18n from './NavBarI18n.vue';
|
import NavBarI18n from './NavBarI18n.vue';
|
||||||
import NavBarWallet from './NavBarWallet.vue';
|
import NavBarWallet from './NavBarWallet.vue';
|
||||||
|
import type { NavGroup, NavLink, NavSectionTitle } from '../types';
|
||||||
|
|
||||||
const dashboard = useDashboard();
|
const dashboard = useDashboard();
|
||||||
dashboard.initial();
|
dashboard.initial();
|
||||||
@ -35,6 +36,16 @@ const changeOpen = (index: Number) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const showDiscord = window.location.host.search('ping.pub') > -1;
|
const showDiscord = window.location.host.search('ping.pub') > -1;
|
||||||
|
|
||||||
|
function isNavGroup(nav: NavGroup | NavLink | NavSectionTitle | any): nav is NavGroup {
|
||||||
|
return (<NavGroup>nav).children !== undefined;
|
||||||
|
}
|
||||||
|
function isNavLink(nav: NavGroup | NavLink | NavSectionTitle | any): nav is NavLink {
|
||||||
|
return (<NavLink>nav).to !== undefined;
|
||||||
|
}
|
||||||
|
function isNavTitle(nav: NavGroup | NavLink | NavSectionTitle | any): nav is NavSectionTitle {
|
||||||
|
return (<NavSectionTitle>nav).heading !== undefined;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -62,7 +73,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
|
|||||||
class="px-2"
|
class="px-2"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="item?.title && item?.children?.length"
|
v-if="isNavGroup(item)"
|
||||||
:tabindex="index"
|
:tabindex="index"
|
||||||
class="collapse"
|
class="collapse"
|
||||||
:class="{
|
:class="{
|
||||||
@ -151,7 +162,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
|
|||||||
|
|
||||||
<RouterLink
|
<RouterLink
|
||||||
:to="item?.to"
|
:to="item?.to"
|
||||||
v-if="item?.title && !item?.children?.length && item?.to"
|
v-if="isNavGroup(item)"
|
||||||
@click="sidebarShow = false"
|
@click="sidebarShow = false"
|
||||||
class="cursor-pointer rounded-lg px-4 flex items-center py-2 hover:bg-gray-100 dark:hover:bg-[#373f59]"
|
class="cursor-pointer rounded-lg px-4 flex items-center py-2 hover:bg-gray-100 dark:hover:bg-[#373f59]"
|
||||||
>
|
>
|
||||||
@ -183,7 +194,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
|
|||||||
</div>
|
</div>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<div
|
<div
|
||||||
v-if="item?.heading"
|
v-if="isNavTitle(item)"
|
||||||
class="px-4 text-sm text-gray-400 pb-2 uppercase"
|
class="px-4 text-sm text-gray-400 pb-2 uppercase"
|
||||||
>
|
>
|
||||||
{{ item?.heading }}
|
{{ item?.heading }}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { Icon } from '@iconify/vue';
|
import { Icon } from '@iconify/vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const i18nLangs: Array<{ label: string; i18nLang: string }> = [
|
const i18nLangs: Array<{ label: string; i18nLang: string }> = [
|
||||||
{
|
{
|
||||||
label: 'English',
|
label: 'English',
|
||||||
@ -13,7 +15,7 @@ const i18nLangs: Array<{ label: string; i18nLang: string }> = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
let locale = ref(useI18n({ useScope: 'global' }).locale);
|
let locale = ref(useI18n({ useScope: 'global' }).locale);
|
||||||
watch(locale, (val: string) => {
|
watch(locale, (val) => {
|
||||||
document.documentElement.setAttribute('lang', val as string);
|
document.documentElement.setAttribute('lang', val as string);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
58
src/layouts/types.d.ts
vendored
Normal file
58
src/layouts/types.d.ts
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// 👉 Vertical nav section title
|
||||||
|
export interface NavSectionTitle extends Partial<AclProperties> {
|
||||||
|
heading: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 👉 Vertical nav link
|
||||||
|
declare type ATagTargetAttrValues = '_blank' | '_self' | '_parent' | '_top' | 'framename'
|
||||||
|
declare type ATagRelAttrValues =
|
||||||
|
| 'alternate'
|
||||||
|
| 'author'
|
||||||
|
| 'bookmark'
|
||||||
|
| 'external'
|
||||||
|
| 'help'
|
||||||
|
| 'license'
|
||||||
|
| 'next'
|
||||||
|
| 'nofollow'
|
||||||
|
| 'noopener'
|
||||||
|
| 'noreferrer'
|
||||||
|
| 'prev'
|
||||||
|
| 'search'
|
||||||
|
| 'tag'
|
||||||
|
|
||||||
|
export interface NavLinkProps {
|
||||||
|
to?: RouteLocationRaw | string | null
|
||||||
|
href?: string
|
||||||
|
target?: ATagTargetAttrValues
|
||||||
|
rel?: ATagRelAttrValues
|
||||||
|
i18n?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Icon {
|
||||||
|
icon?: string,
|
||||||
|
image?: string,
|
||||||
|
size: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NavLink extends NavLinkProps {
|
||||||
|
title: string
|
||||||
|
icon?: Icon
|
||||||
|
badgeContent?: string
|
||||||
|
badgeClass?: string
|
||||||
|
disable?: boolean
|
||||||
|
order?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
// 👉 Vertical nav group
|
||||||
|
export interface NavGroup extends NavLinkProps {
|
||||||
|
title: string
|
||||||
|
icon?: Icon
|
||||||
|
badgeContent?: string
|
||||||
|
badgeClass?: string
|
||||||
|
children: (NavLink | NavGroup)[]
|
||||||
|
disable?: boolean
|
||||||
|
order?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare type VerticalNavItems = (NavLink | NavGroup | NavSectionTitle)[]
|
||||||
|
export declare type HorizontalNavItems = (NavLink | NavGroup)[]
|
@ -51,9 +51,10 @@ export function formatTokenAmount(
|
|||||||
tokenDenom = 'uatom',
|
tokenDenom = 'uatom',
|
||||||
format = true
|
format = true
|
||||||
) {
|
) {
|
||||||
const denom = tokenDenom?.denom_trace
|
const denom = typeof tokenDenom === 'string'
|
||||||
? tokenDenom?.denom_trace?.base_denom
|
? tokenDenom
|
||||||
: tokenDenom;
|
// @ts-ignore
|
||||||
|
: tokenDenom?.denom_trace?.base_denom;
|
||||||
let amount = 0;
|
let amount = 0;
|
||||||
const asset = assets.find((a: any) => a.base === denom);
|
const asset = assets.find((a: any) => a.base === denom);
|
||||||
let exp = asset
|
let exp = asset
|
||||||
@ -79,60 +80,6 @@ export function numberWithCommas(x: any) {
|
|||||||
return parts.join('.');
|
return parts.join('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function tokenFormatter(tokens: any, denoms = {}, decimal = 2) {
|
|
||||||
if (Array.isArray(tokens)) {
|
|
||||||
return tokens.map((t) => formatToken(t, denoms, decimal)).join(', ');
|
|
||||||
}
|
|
||||||
return formatToken(tokens, denoms, 2);
|
|
||||||
}
|
|
||||||
export function formatToken(
|
|
||||||
token: any,
|
|
||||||
IBCDenom = {},
|
|
||||||
decimals = 2,
|
|
||||||
withDenom = true
|
|
||||||
) {
|
|
||||||
if (token) {
|
|
||||||
const denom = IBCDenom[token.denom] || token.denom;
|
|
||||||
if (withDenom) {
|
|
||||||
return `${formatTokenAmount(
|
|
||||||
token.amount,
|
|
||||||
decimals,
|
|
||||||
denom
|
|
||||||
)} ${formatTokenDenom(denom)}`;
|
|
||||||
}
|
|
||||||
return formatTokenAmount(token.amount, decimals, denom);
|
|
||||||
}
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
export function formatTokenDenom(tokenDenom: any) {
|
|
||||||
if (tokenDenom && tokenDenom.code === undefined) {
|
|
||||||
let denom = tokenDenom.denom_trace
|
|
||||||
? tokenDenom.denom_trace.base_denom
|
|
||||||
: tokenDenom;
|
|
||||||
const chains = getLocalChains();
|
|
||||||
const selected = localStorage.getItem('selected_chain');
|
|
||||||
const selChain = chains[selected];
|
|
||||||
const nativeAsset = selChain.assets.find((a) => a.base === denom);
|
|
||||||
if (nativeAsset) {
|
|
||||||
denom = nativeAsset.symbol;
|
|
||||||
} else {
|
|
||||||
const config = Object.values(chains);
|
|
||||||
config.forEach((x) => {
|
|
||||||
if (x.assets) {
|
|
||||||
const asset = x.assets.find((a) => a.base === denom);
|
|
||||||
if (asset) denom = asset.symbol;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return denom.length > 10
|
|
||||||
? `${denom.substring(0, 7).toUpperCase()}..${denom.substring(
|
|
||||||
denom.length - 3
|
|
||||||
)}`
|
|
||||||
: denom.toUpperCase();
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isToken(value: string) {
|
export function isToken(value: string) {
|
||||||
let is = false;
|
let is = false;
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
|
@ -7,11 +7,12 @@ import {
|
|||||||
useDashboard,
|
useDashboard,
|
||||||
useStakingStore,
|
useStakingStore,
|
||||||
} from '@/stores';
|
} from '@/stores';
|
||||||
|
import { consensusPubkeyToHexAddress } from '@/libs';
|
||||||
|
|
||||||
const format = useFormatter();
|
const format = useFormatter();
|
||||||
const chainStore = useBlockchain();
|
const chainStore = useBlockchain();
|
||||||
const dashboard = useDashboard();
|
const dashboard = useDashboard();
|
||||||
const stakingStore = useStakingStore();
|
const stakingStore = useStakingStore();
|
||||||
import { consensusPubkeyToHexAddress } from '@/libs';
|
|
||||||
const rpcList = ref(
|
const rpcList = ref(
|
||||||
chainStore.current?.endpoints?.rpc || [{ address: '', provider: '' }]
|
chainStore.current?.endpoints?.rpc || [{ address: '', provider: '' }]
|
||||||
);
|
);
|
||||||
@ -42,21 +43,24 @@ onUnmounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const newTime = computed(() => {
|
const newTime = computed(() => {
|
||||||
return format.toDay(updatetime.value || '', 'time');
|
return format.toDay(updatetime.value?.toDateString(), 'time');
|
||||||
});
|
});
|
||||||
|
|
||||||
const vals = computed(() => {
|
const vals = computed(() => {
|
||||||
return validators.value.map((x) => {
|
return validators.value.map((x) => {
|
||||||
const x2 = x;
|
const x2 = x;
|
||||||
|
// @ts-ignore
|
||||||
x2.hex = consensusPubkeyToHexAddress(x.consensus_pubkey);
|
x2.hex = consensusPubkeyToHexAddress(x.consensus_pubkey);
|
||||||
return x2;
|
return x2;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function showName(i, text) {
|
function showName(i:number, text: string) {
|
||||||
if (text === 'nil-Vote') {
|
if (text === 'nil-Vote') {
|
||||||
|
// @ts-ignore
|
||||||
if (positions.value?.[i]?.address) {
|
if (positions.value?.[i]?.address) {
|
||||||
const val = vals.value.find(
|
const val = vals.value.find(
|
||||||
|
// @ts-ignore
|
||||||
(x) => x.hex === positions.value?.[i]?.address
|
(x) => x.hex === positions.value?.[i]?.address
|
||||||
);
|
);
|
||||||
return val?.description?.moniker || i;
|
return val?.description?.moniker || i;
|
||||||
@ -65,10 +69,11 @@ function showName(i, text) {
|
|||||||
}
|
}
|
||||||
const txt = text.substring(text.indexOf(':') + 1, text.indexOf(' '));
|
const txt = text.substring(text.indexOf(':') + 1, text.indexOf(' '));
|
||||||
const sig = text.split(' ');
|
const sig = text.split(' ');
|
||||||
|
// @ts-ignore
|
||||||
const val = validators.value.find((x) => x?.hex?.startsWith(txt));
|
const val = validators.value.find((x) => x?.hex?.startsWith(txt));
|
||||||
return `${val?.description?.moniker || txt} - ${sig[2]}`;
|
return `${val?.description?.moniker || txt} - ${sig[2]}`;
|
||||||
}
|
}
|
||||||
function color(i, txt) {
|
function color(i: number, txt: string) {
|
||||||
if (i === roundState.value?.proposer?.index) {
|
if (i === roundState.value?.proposer?.index) {
|
||||||
return txt === 'nil-Vote' ? 'warning' : 'primary';
|
return txt === 'nil-Vote' ? 'warning' : 'primary';
|
||||||
}
|
}
|
||||||
@ -99,7 +104,9 @@ async function fetchPosition() {
|
|||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
positions.value = data.result.round_state.validators.validators;
|
positions.value = data.result.round_state.validators.validators;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// @ts-ignore
|
||||||
httpstatus.value = error?.status || 500;
|
httpstatus.value = error?.status || 500;
|
||||||
|
// @ts-ignore
|
||||||
httpStatusText.value = error?.message || 'Error';
|
httpStatusText.value = error?.message || 'Error';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +132,7 @@ async function update() {
|
|||||||
step.value = raw[2];
|
step.value = raw[2];
|
||||||
|
|
||||||
// find the highest onboard rate
|
// find the highest onboard rate
|
||||||
roundState.value?.height_vote_set?.forEach((element) => {
|
roundState.value?.height_vote_set?.forEach((element: any) => {
|
||||||
const rates = Number(
|
const rates = Number(
|
||||||
element.prevotes_bit_array.substring(
|
element.prevotes_bit_array.substring(
|
||||||
element.prevotes_bit_array.length - 4
|
element.prevotes_bit_array.length - 4
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
import { useDistributionStore } from '@/stores/useDistributionStore';
|
import { useDistributionStore } from '@/stores/useDistributionStore';
|
||||||
import { useMintStore } from '@/stores/useMintStore';
|
import { useMintStore } from '@/stores/useMintStore';
|
||||||
import { useStakingStore } from '@/stores/useStakingStore';
|
import { useStakingStore } from '@/stores/useStakingStore';
|
||||||
import type { Tally } from '@/types';
|
import type { Coin, Tally } from '@/types';
|
||||||
import numeral from 'numeral';
|
import numeral from 'numeral';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
@ -175,6 +175,7 @@ export const useIndexModule = defineStore('module-index', {
|
|||||||
color: 'warning',
|
color: 'warning',
|
||||||
icon: 'mdi-lock',
|
icon: 'mdi-lock',
|
||||||
stats: formatter.formatTokenAmount({
|
stats: formatter.formatTokenAmount({
|
||||||
|
// @ts-ignore
|
||||||
amount: this.pool.bonded_tokens,
|
amount: this.pool.bonded_tokens,
|
||||||
denom: staking.params.bond_denom,
|
denom: staking.params.bond_denom,
|
||||||
}),
|
}),
|
||||||
@ -192,8 +193,9 @@ export const useIndexModule = defineStore('module-index', {
|
|||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'mdi-bank',
|
icon: 'mdi-bank',
|
||||||
stats: formatter.formatTokens(
|
stats: formatter.formatTokens(
|
||||||
|
// @ts-ignore
|
||||||
this.communityPool?.filter(
|
this.communityPool?.filter(
|
||||||
(x) => x.denom === staking.params.bond_denom
|
(x: Coin) => x.denom === staking.params.bond_denom
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
change: 0,
|
change: 0,
|
||||||
@ -203,6 +205,7 @@ export const useIndexModule = defineStore('module-index', {
|
|||||||
|
|
||||||
coingeckoId() {
|
coingeckoId() {
|
||||||
this.tickerIndex = 0;
|
this.tickerIndex = 0;
|
||||||
|
// @ts-ignore
|
||||||
const [firstAsset] = this.blockchain?.assets || [];
|
const [firstAsset] = this.blockchain?.assets || [];
|
||||||
return firstAsset.coingecko_id
|
return firstAsset.coingecko_id
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { useBlockchain } from "@/stores";
|
import { useBlockchain } from "@/stores";
|
||||||
import { setupLayouts } from "virtual:generated-layouts";
|
|
||||||
import { createRouter, createWebHistory } from "vue-router";
|
import { createRouter, createWebHistory } from "vue-router";
|
||||||
|
// @ts-ignore
|
||||||
|
import { setupLayouts } from "virtual:generated-layouts";
|
||||||
|
// @ts-ignore
|
||||||
import routes from "~pages";
|
import routes from "~pages";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
@ -10,6 +10,7 @@ export const useBankStore = defineStore('bankstore', {
|
|||||||
supply: {} as Coin,
|
supply: {} as Coin,
|
||||||
balances: {} as Record<string, Coin[]>,
|
balances: {} as Record<string, Coin[]>,
|
||||||
totalSupply: { supply: [] as Coin[] },
|
totalSupply: { supply: [] as Coin[] },
|
||||||
|
ibcDenoms: {} as Record<string, DenomTrace>
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
type Endpoint,
|
type Endpoint,
|
||||||
EndpointType,
|
EndpointType,
|
||||||
} from './useDashboard';
|
} from './useDashboard';
|
||||||
import type { VerticalNavItems } from '@/@layouts/types';
|
import type { VerticalNavItems } from '@/layouts/types';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { CosmosRestClient } from '@/libs/client';
|
import { CosmosRestClient } from '@/libs/client';
|
||||||
import {
|
import {
|
||||||
|
@ -147,6 +147,7 @@ export const useFormatter = defineStore('formatter', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const conf = mode === 'local'? this.blockchain.current?.assets?.find(
|
const conf = mode === 'local'? this.blockchain.current?.assets?.find(
|
||||||
|
// @ts-ignore
|
||||||
(x) => x.base === token.denom || x.base.denom === token.denom
|
(x) => x.base === token.denom || x.base.denom === token.denom
|
||||||
): this.findGlobalAssetConfig(token.denom)
|
): this.findGlobalAssetConfig(token.denom)
|
||||||
|
|
||||||
@ -226,7 +227,7 @@ export const useFormatter = defineStore('formatter', {
|
|||||||
numberAndSign(input: number, fmt = '+0,0') {
|
numberAndSign(input: number, fmt = '+0,0') {
|
||||||
return numeral(input).format(fmt);
|
return numeral(input).format(fmt);
|
||||||
},
|
},
|
||||||
toDay(time?: string, format = 'long') {
|
toDay(time?: string | number, format = 'long') {
|
||||||
if (!time) return '';
|
if (!time) return '';
|
||||||
if (format === 'long') {
|
if (format === 'long') {
|
||||||
return dayjs(time).format('YYYY-MM-DD HH:mm');
|
return dayjs(time).format('YYYY-MM-DD HH:mm');
|
||||||
|
@ -17,7 +17,7 @@ export const useWalletStore = defineStore('walletStore', {
|
|||||||
balances: [] as Coin[],
|
balances: [] as Coin[],
|
||||||
delegations: [] as Delegation[],
|
delegations: [] as Delegation[],
|
||||||
unbonding: [] as UnbondingResponses[],
|
unbonding: [] as UnbondingResponses[],
|
||||||
rewards: {} as DelegatorRewards,
|
rewards: {total: [], rewards: []} as DelegatorRewards,
|
||||||
walletIsConnected: {} as WalletConnected
|
walletIsConnected: {} as WalletConnected
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -28,7 +28,7 @@ export const useWalletStore = defineStore('walletStore', {
|
|||||||
connectedWallet() {
|
connectedWallet() {
|
||||||
const chainStore = useBlockchain();
|
const chainStore = useBlockchain();
|
||||||
const key = chainStore.defaultHDPath;
|
const key = chainStore.defaultHDPath;
|
||||||
let connected = this.walletIsConnected
|
let connected = {} as WalletConnected
|
||||||
if (!this.walletIsConnected?.cosmosAddress){
|
if (!this.walletIsConnected?.cosmosAddress){
|
||||||
connected = JSON.parse(localStorage.getItem(key) || '{}');
|
connected = JSON.parse(localStorage.getItem(key) || '{}');
|
||||||
}
|
}
|
||||||
@ -54,8 +54,9 @@ export const useWalletStore = defineStore('walletStore', {
|
|||||||
},
|
},
|
||||||
rewardAmount() {
|
rewardAmount() {
|
||||||
const stakingStore = useStakingStore();
|
const stakingStore = useStakingStore();
|
||||||
|
// @ts-ignore
|
||||||
const reward = this.rewards.total?.find(
|
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 };
|
return reward || { amount: '0', denom: stakingStore.params.bond_denom };
|
||||||
},
|
},
|
||||||
@ -125,7 +126,6 @@ export const useWalletStore = defineStore('walletStore', {
|
|||||||
console.log(key, 'key')
|
console.log(key, 'key')
|
||||||
console.log(localStorage.getItem(key))
|
console.log(localStorage.getItem(key))
|
||||||
localStorage.removeItem(key);
|
localStorage.removeItem(key);
|
||||||
this.walletIsConnected = null
|
|
||||||
this.$reset()
|
this.$reset()
|
||||||
},
|
},
|
||||||
setConnectedWallet(value: any) {
|
setConnectedWallet(value: any) {
|
||||||
|
@ -2623,6 +2623,11 @@
|
|||||||
resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz"
|
resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz"
|
||||||
integrity sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==
|
integrity sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==
|
||||||
|
|
||||||
|
"@types/semver@7.5.0":
|
||||||
|
version "7.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a"
|
||||||
|
integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==
|
||||||
|
|
||||||
"@types/web-bluetooth@^0.0.16":
|
"@types/web-bluetooth@^0.0.16":
|
||||||
version "0.0.16"
|
version "0.0.16"
|
||||||
resolved "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz"
|
resolved "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz"
|
||||||
|
Loading…
Reference in New Issue
Block a user