From 551816e0edf6418657f264354499eb7cc4ec7b08 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Fri, 9 Jun 2023 18:32:25 +0800 Subject: [PATCH] add accounts and supply --- package.json | 2 +- src/layouts/components/NavBarWallet.vue | 2 +- src/libs/client.ts | 11 ++-- src/modules/[chain]/account/index.vue | 86 +++++++++++++++++++++++++ src/modules/[chain]/supply/index.vue | 59 +++++++++++++++++ src/plugins/i18n/locales/cn.json | 4 +- src/plugins/i18n/locales/en.json | 4 +- yarn.lock | 8 +-- 8 files changed, 164 insertions(+), 12 deletions(-) create mode 100644 src/modules/[chain]/account/index.vue create mode 100644 src/modules/[chain]/supply/index.vue diff --git a/package.json b/package.json index 3b8aa610..f235d5cb 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "md-editor-v3": "^2.8.1", "numeral": "^2.0.6", "osmojs": "^14.0.0-rc.0", - "ping-widget": "^0.0.38", + "ping-widget": "^0.0.39", "pinia": "^2.0.28", "postcss": "^8.4.23", "qrcode": "^1.5.3", diff --git a/src/layouts/components/NavBarWallet.vue b/src/layouts/components/NavBarWallet.vue index 55588b8b..96b0a545 100644 --- a/src/layouts/components/NavBarWallet.vue +++ b/src/layouts/components/NavBarWallet.vue @@ -108,7 +108,7 @@ const tipMsg = computed(() => { diff --git a/src/libs/client.ts b/src/libs/client.ts index 442d605b..49841250 100644 --- a/src/libs/client.ts +++ b/src/libs/client.ts @@ -31,8 +31,10 @@ export class CosmosRestClient extends BaseRestClient { return new CosmosRestClient(endpoint, DEFAULT) } // Auth Module - async getAuthAccounts() { - return this.request(this.registry.auth_accounts, {}); + async getAuthAccounts(page?: PageRequest) { + if(!page) page = new PageRequest() + const query =`?${page.toQueryString()}`; + return this.request(this.registry.auth_accounts, {}, query); } async getAuthAccount(address: string) { return this.request(this.registry.auth_account_address, { address }); @@ -47,8 +49,9 @@ export class CosmosRestClient extends BaseRestClient { async getBankDenomMetadata() { return this.request(this.registry.bank_denoms_metadata, {}); } - async getBankSupply() { - return this.request(this.registry.bank_supply, {}); + async getBankSupply(page?: PageRequest) { if(!page) page = new PageRequest() + const query =`?${page.toQueryString()}`; + return this.request(this.registry.bank_supply, {}, query); } async getBankSupplyByDenom(denom: string) { return this.request(this.registry.bank_supply_by_denom, { denom }); diff --git a/src/modules/[chain]/account/index.vue b/src/modules/[chain]/account/index.vue new file mode 100644 index 00000000..3ba552bd --- /dev/null +++ b/src/modules/[chain]/account/index.vue @@ -0,0 +1,86 @@ + + + + + + + Type + Address + Account Number + Sequence + Public Key + + + + {{ showType(acc['@type']) }} + {{ showAddress(acc) }} + {{ showAccountNumber(acc) }} + {{ showSequence(acc) }} + {{ showPubkey(acc) }} + + + + + + + + { + meta: { + i18n: 'account', + order: 16 + } + } + 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/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/yarn.lock b/yarn.lock index b254c7c7..c7697ed7 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.39: + version "0.0.39" + resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.39.tgz#53e8807186f363c08c4921e50aa972a8be0b7a7c" + integrity sha512-2PRXs+CNOA5G6Qq3bQeIENctj9h1v9ZBNfP1GQJYHfsFcAXAW0JcKcdPwbX7kEyx9gYNctUIB6NkUflHeLWAsg== dependencies: "@cosmjs/amino" "^0.30.1" "@cosmjs/cosmwasm-stargate" "^0.30.1"