From f4362ec57f1874dca7f2bffd49ace53f9ec883a6 Mon Sep 17 00:00:00 2001 From: Pranav Date: Wed, 5 Nov 2025 19:06:06 +0530 Subject: [PATCH] Display Inflation only if mint module is enabled --- src/modules/[chain]/indexStore.ts | 35 ++++++++++++++++++------------- src/stores/useMintStore.ts | 17 ++++++++++----- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/modules/[chain]/indexStore.ts b/src/modules/[chain]/indexStore.ts index 3164cfae..50162967 100644 --- a/src/modules/[chain]/indexStore.ts +++ b/src/modules/[chain]/indexStore.ts @@ -152,7 +152,7 @@ export const useIndexModule = defineStore('module-index', { const mintStore = useMintStore(); const formatter = useFormatter(); - return [ + const statsArray = [ { title: 'Height', color: 'primary', @@ -185,24 +185,31 @@ export const useIndexModule = defineStore('module-index', { }), change: 0, }, - { + ]; + + // Only show Inflation if mint module is enabled + if (mintStore.mintModuleEnabled) { + statsArray.push({ title: 'Inflation', color: 'success', icon: 'mdi-chart-multiple', stats: formatter.formatDecimalToPercent(mintStore.inflation), change: 0, - }, - { - title: 'Community Pool', - color: 'primary', - icon: 'mdi-bank', - stats: formatter.formatTokens( - // @ts-ignore - this.communityPool?.filter((x: Coin) => x.denom === staking.params.bond_denom) - ), - change: 0, - }, - ]; + }); + } + + statsArray.push({ + title: 'Community Pool', + color: 'primary', + icon: 'mdi-bank', + stats: formatter.formatTokens( + // @ts-ignore + this.communityPool?.filter((x: Coin) => x.denom === staking.params.bond_denom) + ), + change: 0, + }); + + return statsArray; }, coingeckoId() { diff --git a/src/stores/useMintStore.ts b/src/stores/useMintStore.ts index fff1680e..e2f86c23 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: true, }; }, getters: { @@ -18,14 +19,20 @@ 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 + const errorMessage = e?.message || e?.toString() || ''; + if (errorMessage.includes('Not Implemented') || e?.status === 501) { + // Module not enabled + this.mintModuleEnabled = false; + } else { + console.log(e); } - } catch (e) { - console.log(e); } }, },