From f28cba9e824765ace44d9a4ecea08f54b8f7ea86 Mon Sep 17 00:00:00 2001 From: nabarun Date: Fri, 7 Nov 2025 08:26:12 +0000 Subject: [PATCH] Handle network errors for cosmos-sdk modules that are not enabled (#4) Part of https://plan.wireit.in/deepstack/browse/VUL-61/ Co-authored-by: Pranav Reviewed-on: https://git.vdb.to/LaconicNetwork/cosmos-explorer/pulls/4 --- package.json | 2 +- src/layouts/components/Sponsors.vue | 2 +- src/modules/[chain]/indexStore.ts | 5 +++-- src/plugins/i18n/locales/de.json | 2 +- src/plugins/i18n/locales/id.json | 2 +- src/plugins/i18n/locales/ja.json | 2 +- src/plugins/i18n/locales/ko.json | 2 +- src/plugins/i18n/locales/zh.json | 2 +- src/stores/useMintStore.ts | 16 +++++++++++----- 9 files changed, 21 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index e5647a49..786f292e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ping.pub", - "version": "3.0.0-zenith-0.1.1", + "version": "3.0.1-zenith-0.1.2", "private": true, "target": "", "scripts": { diff --git a/src/layouts/components/Sponsors.vue b/src/layouts/components/Sponsors.vue index 2dbe163a..a3cb37e1 100644 --- a/src/layouts/components/Sponsors.vue +++ b/src/layouts/components/Sponsors.vue @@ -6,7 +6,7 @@
- Laconic Network + Zenith Network
diff --git a/src/modules/[chain]/indexStore.ts b/src/modules/[chain]/indexStore.ts index 3164cfae..c2cd39c5 100644 --- a/src/modules/[chain]/indexStore.ts +++ b/src/modules/[chain]/indexStore.ts @@ -185,13 +185,14 @@ export const useIndexModule = defineStore('module-index', { }), change: 0, }, - { + // Only show Inflation if mint module is enabled + ...(mintStore.mintModuleEnabled ? [{ title: 'Inflation', color: 'success', icon: 'mdi-chart-multiple', stats: formatter.formatDecimalToPercent(mintStore.inflation), change: 0, - }, + }] : []), { title: 'Community Pool', color: 'primary', diff --git a/src/plugins/i18n/locales/de.json b/src/plugins/i18n/locales/de.json index 32fa894e..d6042035 100644 --- a/src/plugins/i18n/locales/de.json +++ b/src/plugins/i18n/locales/de.json @@ -23,7 +23,7 @@ "links": "Links" }, "pages": { - "title": "Ping Dashboard", + "title": "Zenith Dashboard", "title_all": "404", "tag": "Beta", "tag_all": "Seite nicht gefunden", diff --git a/src/plugins/i18n/locales/id.json b/src/plugins/i18n/locales/id.json index 261eadcd..07efe4e3 100644 --- a/src/plugins/i18n/locales/id.json +++ b/src/plugins/i18n/locales/id.json @@ -21,7 +21,7 @@ "links": "Tautan" }, "pages": { - "title": "Laconic Explorer", + "title": "Zenith Explorer", "title_all": "404", "tag": "Beta", "tag_all": "Halaman Tidak Ditemukan", diff --git a/src/plugins/i18n/locales/ja.json b/src/plugins/i18n/locales/ja.json index c0ac1c8a..d3d46f24 100644 --- a/src/plugins/i18n/locales/ja.json +++ b/src/plugins/i18n/locales/ja.json @@ -23,7 +23,7 @@ "links": "リンク" }, "pages": { - "title": "Ping ダッシュボード", + "title": "Zenith ダッシュボード", "title_all": "404", "tag": "ベータ", "tag_all": "ページが見つかりません", diff --git a/src/plugins/i18n/locales/ko.json b/src/plugins/i18n/locales/ko.json index 8fe5b77b..02aee007 100644 --- a/src/plugins/i18n/locales/ko.json +++ b/src/plugins/i18n/locales/ko.json @@ -23,7 +23,7 @@ "links": "링크" }, "pages": { - "title": "핑 대시보드", + "title": "제니스 대시보드", "title_all": "404", "tag": "베타", "tag_all": "페이지를 찾을 수 없습니다", diff --git a/src/plugins/i18n/locales/zh.json b/src/plugins/i18n/locales/zh.json index 7627ceac..41069407 100644 --- a/src/plugins/i18n/locales/zh.json +++ b/src/plugins/i18n/locales/zh.json @@ -22,7 +22,7 @@ "links": "链接" }, "pages": { - "title": "Laconic Explorer", + "title": "Zenith Explorer", "slogan": "Ping Dashboard 是一个区块链浏览器,也是一个网页钱包,还有更多 ... 🛠", "description": "Cosmos Ecosystem Blockchains 🚀", "search_placeholder": "搜索区块链", diff --git a/src/stores/useMintStore.ts b/src/stores/useMintStore.ts index fff1680e..f9b1c26d 100644 --- a/src/stores/useMintStore.ts +++ b/src/stores/useMintStore.ts @@ -5,6 +5,7 @@ export const useMintStore = defineStore('mintStore', { state: () => { return { inflation: '0', + mintModuleEnabled: false, }; }, getters: { @@ -18,14 +19,19 @@ export const useMintStore = defineStore('mintStore', { }, async fetchInflation() { try { - const res = await this.blockchain?.rpc?.getMintInflation().catch(() => { - this.inflation = '0'; - }); + const res = await this.blockchain?.rpc?.getMintInflation(); if (res) { this.inflation = res.inflation; + this.mintModuleEnabled = true; + } + } catch (e: any) { + // Check if module is not implemented/enabled + if (e?.status === 501) { + // Module not enabled + this.mintModuleEnabled = false; + } else { + console.error(e); } - } catch (e) { - console.log(e); } }, },