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 <jadhavpranav89@gmail.com>
Reviewed-on: LaconicNetwork/cosmos-explorer#4
This commit is contained in:
nabarun 2025-11-07 08:26:12 +00:00
parent b5a4a60759
commit f28cba9e82
9 changed files with 21 additions and 14 deletions

View File

@ -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": {

View File

@ -6,7 +6,7 @@
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.05 12.623A15.378 15.378 0 0 0 8.57 1.714C8.573 1.136 8.54.564 8.477 0H0v16.287c0 1.974.752 3.949 2.258 5.454A7.69 7.69 0 0 0 7.714 24L24 24v-8.477a15.636 15.636 0 0 0-1.715-.095c-4.258 0-8.115 1.73-10.908 4.523-2.032 1.981-5.291 1.982-7.299-.026-2.006-2.006-2.007-5.266-.029-7.302Zm18.192-10.86a6.004 6.004 0 0 0-8.485 0 6.003 6.003 0 0 0 0 8.484 6.003 6.003 0 0 0 8.485 0 6.002 6.002 0 0 0 0-8.485Z" fill="var(--color-white)"></path>
</svg>
<div class="text-sm capitalize flex-1 text-gray-600 dark:text-gray-200">
Laconic Network
Zenith Network
</div>
</a>
</div>

View File

@ -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',

View File

@ -23,7 +23,7 @@
"links": "Links"
},
"pages": {
"title": "Ping Dashboard",
"title": "Zenith Dashboard",
"title_all": "404",
"tag": "Beta",
"tag_all": "Seite nicht gefunden",

View File

@ -21,7 +21,7 @@
"links": "Tautan"
},
"pages": {
"title": "Laconic Explorer",
"title": "Zenith Explorer",
"title_all": "404",
"tag": "Beta",
"tag_all": "Halaman Tidak Ditemukan",

View File

@ -23,7 +23,7 @@
"links": "リンク"
},
"pages": {
"title": "Ping ダッシュボード",
"title": "Zenith ダッシュボード",
"title_all": "404",
"tag": "ベータ",
"tag_all": "ページが見つかりません",

View File

@ -23,7 +23,7 @@
"links": "링크"
},
"pages": {
"title": " 대시보드",
"title": "제니스 대시보드",
"title_all": "404",
"tag": "베타",
"tag_all": "페이지를 찾을 수 없습니다",

View File

@ -22,7 +22,7 @@
"links": "链接"
},
"pages": {
"title": "Laconic Explorer",
"title": "Zenith Explorer",
"slogan": "Ping Dashboard 是一个区块链浏览器,也是一个网页钱包,还有更多 ... 🛠",
"description": "Cosmos Ecosystem Blockchains 🚀",
"search_placeholder": "搜索区块链",

View File

@ -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);
}
},
},