Skip to content

Commit 1bfc76c

Browse files
authored
Merge pull request #646 from burnt-labs/chore/addtypes
separate types from useDashBoard
2 parents 4622de5 + 4578301 commit 1bfc76c

File tree

14 files changed

+994
-210
lines changed

14 files changed

+994
-210
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"type-check": "vue-tsc --noEmit"
1414
},
1515
"dependencies": {
16+
"@chain-registry/types": "^0.50.162",
1617
"@chenfengyuan/vue-countdown": "2",
1718
"@cosmjs/amino": "^0.32.3",
1819
"@cosmjs/crypto": "^0.32.3",

src/layouts/components/ChainProfile.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
2-
import { useBlockchain, useBaseStore, type Endpoint } from '@/stores';
2+
import { useBlockchain, useBaseStore } from '@/stores';
3+
import type { Endpoint } from '@/types/chaindata';
34
import { useRouter } from 'vue-router';
45
const chainStore = useBlockchain();
56
const baseStore = useBaseStore();

src/layouts/components/DefaultLayout.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import NavbarSearch from '@/layouts/components/NavbarSearch.vue';
99
import ChainProfile from '@/layouts/components/ChainProfile.vue';
1010
import Sponsors from '@/layouts/components/Sponsors.vue';
1111
12-
import { NetworkType, useDashboard } from '@/stores/useDashboard';
12+
import { useDashboard } from '@/stores/useDashboard';
13+
import { NetworkType } from '@/types/chaindata';
1314
import { useBaseStore, useBlockchain } from '@/stores';
1415
1516
import NavBarI18n from './NavBarI18n.vue';

src/modules/[chain]/staking/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const list = computed(() => {
144144
if (endpoint) {
145145
endpoint.push('ping');
146146
return staking.validators
147-
.filter((x) => isFeatured(endpoint, x.description))
147+
.filter((x) => isFeatured(endpoint.filter(Boolean) as string[], x.description))
148148
.map((x, i) => ({ v: x, rank: 'primary', logo: logo(x.description.identity) }));
149149
}
150150
return [];

src/modules/[chain]/supply/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
type DenomMetadata,
99
} from '@/types';
1010
import { onMounted } from 'vue';
11-
import type { Asset } from '@ping-pub/chain-registry-client/dist/types';
11+
import type { Asset } from '@/types/chaindata';
1212
import PaginationBar from '@/components/PaginationBar.vue';
1313
const props = defineProps(['chain']);
1414
@@ -45,7 +45,7 @@ async function mergeDenomMetadata(denom: string, denomsMetadatas: DenomMetadata[
4545
if (asset && denomMetadata) {
4646
asset = { ...denomMetadata, ...asset };
4747
asset.display = denomMetadata.display;
48-
asset.logo = asset.logo_URIs?.svg || asset.logo_URIs?.png || asset.logo_URIs?.jpeg || undefined;
48+
asset.logo = asset.logo_URIs?.svg || asset.logo_URIs?.png || undefined;
4949
} else if (denomMetadata) {
5050
return denomMetadata as SupplyAsset;
5151
}
@@ -65,7 +65,7 @@ function pageload(p: number) {
6565
amount: format.tokenAmountNumber({ amount: coin.amount, denom: denom }).toString(),
6666
base: asset.base || coin.denom,
6767
info: asset.display || coin.denom,
68-
logo: asset?.logo_URIs?.svg || asset?.logo_URIs?.png || asset?.logo_URIs?.jpeg || '/logo.svg',
68+
logo: asset?.logo_URIs?.svg || asset?.logo_URIs?.png || '/logo.svg',
6969
};
7070
})
7171
);

src/modules/wallet/keplr.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { ref } from 'vue';
3-
import { useDashboard, type ChainConfig, useBlockchain } from '@/stores';
3+
import { useDashboard, useBlockchain } from '@/stores';
4+
import type { ChainConfig, DenomUnit } from '@/types/chaindata';
45
import { CosmosRestClient } from '@/libs/client';
56
import { onMounted } from 'vue';
67
import AdBanner from '@/components/ad/AdBanner.vue';
@@ -29,7 +30,7 @@ async function initParamsForKeplr() {
2930
high: 0.03,
3031
};
3132
const coinDecimals =
32-
chain.assets[0].denom_units.find((x) => x.denom === chain.assets[0].symbol.toLowerCase())?.exponent || 6;
33+
chain.assets[0].denom_units.find((x: DenomUnit) => x.denom === chain.assets[0].symbol.toLowerCase())?.exponent || 6;
3334
conf.value = JSON.stringify(
3435
{
3536
chainId: chainid,

src/modules/wallet/suggest.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { computed, ref } from 'vue';
33
import { suggestChain } from '@leapwallet/cosmos-snap-provider';
44
import {
55
useDashboard,
6-
type ChainConfig,
76
useBlockchain,
8-
NetworkType,
97
} from '@/stores';
8+
import type { ChainConfig } from '@/types/chaindata';
9+
import { NetworkType } from '@/types/chaindata';
1010
import { CosmosRestClient } from '@/libs/client';
1111
import { onMounted } from 'vue';
1212
import AdBanner from '@/components/ad/AdBanner.vue';

src/modules/wallet/unisat.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { ref } from 'vue';
3-
import { useDashboard, type ChainConfig, useBlockchain } from '@/stores';
3+
import { useDashboard, useBlockchain } from '@/stores';
4+
import type { ChainConfig } from '@/types/chaindata';
45
import { CosmosRestClient } from '@/libs/client';
56
import { onMounted } from 'vue';
67
import AdBanner from '@/components/ad/AdBanner.vue';

src/pages/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts" setup>
22
import { Icon } from '@iconify/vue';
3-
import { useDashboard, LoadingStatus, type ChainConfig } from '@/stores/useDashboard';
3+
import { useDashboard, LoadingStatus } from '@/stores';
4+
import type { ChainConfig } from '@/types/chaindata';
45
import ChainSummary from '@/components/ChainSummary.vue';
56
import AdBanner from '@/components/ad/AdBanner.vue';
67

src/stores/useBlockchain.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineStore } from 'pinia';
2-
import { useDashboard, type ChainConfig, type Endpoint, EndpointType } from './useDashboard';
2+
import type { ChainConfig, Endpoint } from '@/types/chaindata';
3+
import { useDashboard} from './useDashboard';
34
import type { NavGroup, NavLink, NavSectionTitle, VerticalNavItems } from '@/layouts/types';
45
import { useRouter } from 'vue-router';
56
import { CosmosRestClient } from '@/libs/client';
@@ -22,11 +23,7 @@ export const useBlockchain = defineStore('blockchain', {
2223
status: {} as Record<string, string>,
2324
rest: '',
2425
chainName: '',
25-
endpoint: {} as {
26-
type?: EndpointType;
27-
address: string;
28-
provider: string;
29-
},
26+
endpoint: {} as Endpoint,
3027
connErr: '',
3128
};
3229
},

0 commit comments

Comments
 (0)