forked from cerc-io/cosmos-explorer
feat: add Slashing andDistribution Param
This commit is contained in:
parent
881ab4260c
commit
921536983d
@ -32,7 +32,9 @@ onMounted(() => {
|
|||||||
<!-- Governance Parameters -->
|
<!-- Governance Parameters -->
|
||||||
|
|
||||||
<!-- Distribution Parameters -->
|
<!-- Distribution Parameters -->
|
||||||
|
<CardParameter :cardItem="store.distribution"/>
|
||||||
<!-- Slashing Parameters -->
|
<!-- Slashing Parameters -->
|
||||||
|
<CardParameter :cardItem="store.slashing"/>
|
||||||
<!-- Application Version -->
|
<!-- Application Version -->
|
||||||
<!-- Node Information -->
|
<!-- Node Information -->
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,9 +18,7 @@ const {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const changeTheme = () => {
|
const changeTheme = () => {
|
||||||
theme.value = getNextThemeName();
|
theme.value = getNextThemeName();
|
||||||
console.log(theme.value, 'theme.value', window.matchMedia('(prefers-color-scheme: dark)').matches)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeMode = (val: 'dark' | 'light' | 'system') => {
|
const changeMode = (val: 'dark' | 'light' | 'system') => {
|
||||||
|
@ -71,6 +71,7 @@ export interface ChainConfig {
|
|||||||
tendermint?: string,
|
tendermint?: string,
|
||||||
},
|
},
|
||||||
exponent: string,
|
exponent: string,
|
||||||
|
excludes?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LocalConfig {
|
export interface LocalConfig {
|
||||||
|
@ -18,10 +18,10 @@ export const useParamStore = defineStore("paramstore", {
|
|||||||
title: '',
|
title: '',
|
||||||
class: 'border-primary',
|
class: 'border-primary',
|
||||||
items: [
|
items: [
|
||||||
{ subtitle: 'height', icon: 'BoxIcon', color: 'light-success', value: '' },
|
{ subtitle: 'height', icon: 'BoxIcon', color: 'light-success', value: '-' },
|
||||||
{ subtitle: 'bonded_and_supply', icon: 'DollarSignIcon', color: 'light-danger', value: '' },
|
{ subtitle: 'bonded_and_supply', icon: 'DollarSignIcon', color: 'light-danger', value: '-' },
|
||||||
{ subtitle: 'bonded_ratio', icon: 'PercentIcon', color: 'light-warning', value: '' },
|
{ subtitle: 'bonded_ratio', icon: 'PercentIcon', color: 'light-warning', value: '-' },
|
||||||
{ subtitle: 'inflation', icon: 'TrendingUpIcon', color: 'light-primary', value: '' },
|
{ subtitle: 'inflation', icon: 'TrendingUpIcon', color: 'light-primary', value: '-' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
mint: {
|
mint: {
|
||||||
@ -48,13 +48,18 @@ export const useParamStore = defineStore("paramstore", {
|
|||||||
getters: {
|
getters: {
|
||||||
blockchain() {
|
blockchain() {
|
||||||
return useBlockchain()
|
return useBlockchain()
|
||||||
|
},
|
||||||
|
excludes() {
|
||||||
|
return this.blockchain().current?.excludes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
initial() {
|
initial() {
|
||||||
this.handleBaseBlockLatest()
|
this.handleBaseBlockLatest()
|
||||||
this.handleMintParam()
|
// this.handleMintParam()
|
||||||
this.handleStakingParams()
|
this.handleStakingParams()
|
||||||
|
this.handleSlashingParams()
|
||||||
|
this.handleDistributionParams()
|
||||||
},
|
},
|
||||||
async handleBaseBlockLatest() {
|
async handleBaseBlockLatest() {
|
||||||
try {
|
try {
|
||||||
@ -93,9 +98,33 @@ export const useParamStore = defineStore("paramstore", {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async handleMintParam() {
|
async handleMintParam() {
|
||||||
|
const excludes = this.blockchain.current?.excludes
|
||||||
|
if(excludes && excludes.indexOf('mint') > -1){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// this.getMintingInflation().then(res => {
|
||||||
|
// const chainIndex = this.chain.items.findIndex(x => x.subtitle === 'inflation')
|
||||||
|
// this.chain.items[chainIndex].value = `${percent(res)}%`
|
||||||
|
// })
|
||||||
const res = await this.getMintParam()
|
const res = await this.getMintParam()
|
||||||
console.log(res, 'mint')
|
console.log(res, 'mint')
|
||||||
|
},
|
||||||
|
async handleSlashingParams(){
|
||||||
|
const res = await this.getSlashingParams()
|
||||||
|
this.slashing.items = Object.entries(res.params).map(([key, value]) => ({ subtitle:key,
|
||||||
|
value: value }))
|
||||||
|
console.log('Slashing', res)
|
||||||
|
},
|
||||||
|
async handleDistributionParams(){
|
||||||
|
const res = await this.getDistributionParams()
|
||||||
|
this.distribution.items = Object.entries(res.params).map(([key, value]) => ({ subtitle: key,
|
||||||
|
value: value }))
|
||||||
|
},
|
||||||
|
async handleGovernanceParams() {
|
||||||
|
if(this.excludes && this.excludes.indexOf('governance') > -1){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
async getBaseTendermintBlockLatest() {
|
async getBaseTendermintBlockLatest() {
|
||||||
return await this.blockchain.rpc.getBaseBlockLatest()
|
return await this.blockchain.rpc.getBaseBlockLatest()
|
||||||
@ -118,7 +147,23 @@ export const useParamStore = defineStore("paramstore", {
|
|||||||
// return this.get(`/supply/total/${denom}`).then(data => ({ amount: commonProcess(data), denom }))
|
// return this.get(`/supply/total/${denom}`).then(data => ({ amount: commonProcess(data), denom }))
|
||||||
// }
|
// }
|
||||||
// return this.get(`/cosmos/bank/v1beta1/supply/${denom}`).then(data => commonProcess(data).amount)
|
// return this.get(`/cosmos/bank/v1beta1/supply/${denom}`).then(data => commonProcess(data).amount)
|
||||||
}
|
},
|
||||||
|
async getSlashingParams() {
|
||||||
|
return await this.blockchain.rpc.getSlashingParams()
|
||||||
|
},
|
||||||
|
async getDistributionParams() {
|
||||||
|
return await this.blockchain.rpc.getDistributionParams()
|
||||||
|
},
|
||||||
|
async getGovParamsVoting() {
|
||||||
|
return await this.blockchain.rpc.getGovParamsVoting()
|
||||||
|
},
|
||||||
|
async getGovParamsDeposit() {
|
||||||
|
return await this.blockchain.rpc.getGovParamsDeposit()
|
||||||
|
},
|
||||||
|
async getGovParamsTally() {
|
||||||
|
return await this.blockchain.rpc.getGovParamsTally()
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user