-
Delegations
-
-
-
+
+
Delegations
+
+
+
+
@@ -338,12 +363,12 @@ function updateEvent() {
{{
- format.validatorFromBech32(v.delegation.validator_address)
+ format.validatorFromBech32(v.delegation.validator_address) || v.delegation.validator_address
}}
- {{ format.formatToken(v.balance, true, '0,0.[00]') }}
+ {{ format.formatToken(v.balance, true, '0,0.[000000]') }}
|
{{
@@ -356,7 +381,7 @@ function updateEvent() {
}}
|
-
+
|
diff --git a/src/modules/[chain]/account/index.vue b/src/modules/[chain]/account/index.vue
new file mode 100644
index 00000000..9425f532
--- /dev/null
+++ b/src/modules/[chain]/account/index.vue
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+ Type |
+ Address |
+ Account Number |
+ Sequence |
+ Public Key |
+
+
+
+ {{ showType(acc['@type']) }} |
+ {{ showAddress(acc) }} |
+ {{ showAccountNumber(acc) }} |
+ {{ showSequence(acc) }} |
+ {{ showPubkey(acc) }} |
+
+
+
+
+
diff --git a/src/modules/[chain]/supply/index.vue b/src/modules/[chain]/supply/index.vue
new file mode 100644
index 00000000..22ac1ac4
--- /dev/null
+++ b/src/modules/[chain]/supply/index.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+ Token |
+ Amount |
+
+
+
+ {{ item.denom }} |
+ {{ item.amount }} |
+
+
+
+
+
+
+
+ {
+ meta: {
+ i18n: 'supply',
+ order: 17
+ }
+ }
+
diff --git a/src/pages/index.vue b/src/pages/index.vue
index e368a1ad..ce00db7b 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -11,9 +11,6 @@ import { useBlockchain } from '@/stores';
const dashboard = useDashboard();
-dashboard.$subscribe((mutation, state) => {
- localStorage.setItem('favorite', JSON.stringify(state.favorite));
-});
const keywords = ref('');
const chains = computed(() => {
if (keywords.value) {
diff --git a/src/plugins/i18n/locales/cn.json b/src/plugins/i18n/locales/cn.json
index e73441e3..699c349c 100644
--- a/src/plugins/i18n/locales/cn.json
+++ b/src/plugins/i18n/locales/cn.json
@@ -6,7 +6,9 @@
"governance": "社区治理",
"parameters": "参数",
"uptime": "状态",
- "consensus": "Consensus"
+ "consensus": "共识引擎",
+ "supply": "资产供应量",
+ "account": "账户列表"
},
"index": {
"slogan": "Ping Dashboard 是一个区块链浏览器,也是一个网页钱包,还有更多 ... 🛠",
diff --git a/src/plugins/i18n/locales/en.json b/src/plugins/i18n/locales/en.json
index 33da7d76..ecfaf020 100644
--- a/src/plugins/i18n/locales/en.json
+++ b/src/plugins/i18n/locales/en.json
@@ -10,7 +10,9 @@
"cosmwasm": "Cosmwasm",
"widget": "Widgets",
"ibc": "IBC",
- "consensus": "Consensus"
+ "consensus": "Consensus",
+ "supply": "Supply",
+ "account": "Accounts"
},
"index": {
"slogan": "Ping Dashboard is not just an explorer but also a wallet and more ... 🛠",
diff --git a/src/stores/useDashboard.ts b/src/stores/useDashboard.ts
index c9246c44..5f763a8d 100644
--- a/src/stores/useDashboard.ts
+++ b/src/stores/useDashboard.ts
@@ -252,18 +252,14 @@ export enum ConfigSource {
export const useDashboard = defineStore('dashboard', {
state: () => {
- const fav = JSON.parse(
- localStorage.getItem('favorite') || '["cosmoshub", "osmosis"]'
- );
const favMap = JSON.parse(
localStorage.getItem('favoriteMap') ||
- '{"cosmoshub":true, "osmosis":true}'
+ '{"cosmos":true, "osmosis":true}'
);
return {
status: LoadingStatus.Empty,
source: ConfigSource.MainnetCosmosDirectory,
networkType: NetworkType.Mainnet,
- favorite: fav as string[],
favoriteMap: favMap as Record
,
chains: {} as Record,
prices: {} as Record,
@@ -284,7 +280,7 @@ export const useDashboard = defineStore('dashboard', {
const coinIds = [] as string[]
Object.keys(this.favoriteMap).forEach(k => {
if(this.chains[k]) this.chains[k].assets.forEach(a => {
- if(a.coingecko_id !== undefined) {
+ if(a.coingecko_id !== undefined && a.coingecko_id.length > 0) {
coinIds.push(a.coingecko_id)
a.denom_units.forEach(u => {
this.coingecko[u.denom] = {
@@ -330,9 +326,10 @@ export const useDashboard = defineStore('dashboard', {
setupDefault() {
if (this.length > 0) {
const blockchain = useBlockchain();
- for (let i = 0; i < this.favorite.length; i++) {
- if (!blockchain.chainName && this.chains[this.favorite[i]]) {
- blockchain.setCurrent(this.favorite[i]);
+ const keys = Object.keys(this.favoriteMap)
+ for (let i = 0; i < keys.length; i++) {
+ if (!blockchain.chainName && this.chains[keys[i]] && this.favoriteMap[keys[i]]) {
+ blockchain.setCurrent(keys[i]);
break
}
}
diff --git a/src/stores/useFormatter.ts b/src/stores/useFormatter.ts
index 4c7385c3..f801adf9 100644
--- a/src/stores/useFormatter.ts
+++ b/src/stores/useFormatter.ts
@@ -85,6 +85,7 @@ export const useFormatter = defineStore('formatter', {
}
},
price(denom: string, currency = "usd") {
+ if(!denom || denom.length < 2) return 0
const info = this.priceInfo(denom);
return info ? info[currency] || 0 : 0;
},
@@ -101,13 +102,21 @@ export const useFormatter = defineStore('formatter', {
}
return ""
},
+ specialDenom(denom: string) {
+ switch(true) {
+ case denom.startsWith('u'): return 6
+ case denom.startsWith("a"): return 18
+ case denom==='inj': return 18
+ }
+ return 0
+ },
tokenValueNumber(token?: Coin) {
- if(!token) return 0
+ if(!token || !token.denom) return 0
// find the symbol,
- const symbol = this.dashboard.coingecko[token.denom]?.symbol || ""
+ const symbol = this.dashboard.coingecko[token.denom]?.symbol || token.denom
// convert denomation to to symbol
const exponent =
- this.dashboard.coingecko[symbol.toLowerCase()]?.exponent || 0;
+ this.dashboard.coingecko[symbol?.toLowerCase()]?.exponent || this.specialDenom(token.denom);
// cacualte amount of symbol
const amount = Number(token.amount) / (10 ** exponent)
const value = amount * this.price(token.denom)
diff --git a/yarn.lock b/yarn.lock
index b254c7c7..c350e469 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5675,10 +5675,10 @@ ping-widget@^0.0.33:
vue "^3.2.47"
vue3-webcomponent-wrapper "^0.2.0"
-ping-widget@^0.0.38:
- version "0.0.38"
- resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.38.tgz#ab25e3f24d1b53002c552a181431a96f4340a1e8"
- integrity sha512-x1VwKvV71Ds7BW1U4RiGCYVVb45XU4M/b09j2wpt8MdMZ8uo5y1eFnwsABJfGVQV2MuBSgXg626uhfCIBkH3TQ==
+ping-widget@^0.0.40:
+ version "0.0.40"
+ resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.40.tgz#e72f4381bd55cdc3b6bcfe7a15210d130a708b01"
+ integrity sha512-RIJ9vRA2v7ZQTsRwbUef9tSFWBH6fuCfspXc58zsLtc0yNC/kc6/C6HglNhi5wCpFWbMi+fl6Ea+GP2Jl+8iqw==
dependencies:
"@cosmjs/amino" "^0.30.1"
"@cosmjs/cosmwasm-stargate" "^0.30.1"