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