feat: add interface request and html dom
This commit is contained in:
parent
b0b7066e10
commit
51f95e187f
@ -1,16 +1,44 @@
|
||||
<script lang="ts" setup>
|
||||
import { useParamStore } from '@/stores';
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
const store = useParamStore()
|
||||
const chain = ref(store.chain)
|
||||
onMounted(() => {
|
||||
// fetch the data
|
||||
// store.handleBaseBlockLatest()
|
||||
store.initial()
|
||||
console.log(4444)
|
||||
})
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<!-- Chain ID -->
|
||||
<div class="bg-card px-4 pt-3 pb-4 rounded-sm">
|
||||
<div class="text-base mb-3 text-main">Minting Parameters</div>
|
||||
<div class="text-base mb-3 text-main">{{ chain.title }}</div>
|
||||
<div class="grid grid-cols-5 gap-4">
|
||||
<div v-for="item in 10" :key="item" class="rounded-sm bg-active px-4 py-2">
|
||||
<div class="text-xs mb-2 text-secondary">Blocks Per Year</div>
|
||||
<div class="text-base text-main">4,360,000</div>
|
||||
<div v-for="(item,index) of chain.items" :key="index" class="rounded-sm bg-active px-4 py-2">
|
||||
<div class="text-xs mb-2 text-secondary">{{ item.subtitle }}</div>
|
||||
<div class="text-base text-main">{{ item.value }}</div>
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-6"></div>
|
||||
<!-- Staking Parameters -->
|
||||
<div class="bg-card px-4 pt-3 pb-4 rounded-sm">
|
||||
<div class="text-base mb-3 text-main">{{ store.staking.title }}</div>
|
||||
<div class="grid grid-cols-5 gap-4">
|
||||
<div v-for="(item,index) of store.staking.items" :key="index" class="rounded-sm bg-active px-4 py-2">
|
||||
<div class="text-xs mb-2 text-secondary">{{ item.subtitle }}</div>
|
||||
<div class="text-base text-main">{{ item.value }}</div>
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<route>
|
||||
{
|
||||
|
@ -75,14 +75,18 @@ export const useParamStore = defineStore("paramstore", {
|
||||
},
|
||||
async handleStakingParams() {
|
||||
console.log('handleStakingParams', 99999)
|
||||
try {
|
||||
|
||||
const res = await this.getStakingParams()
|
||||
this.staking.items = Object.entries(res.params).map(([key, value]) => ({ subtitle:key,
|
||||
value: value }))
|
||||
console.log(res, 9999, this.staking.items)
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
Promise.all([this.getStakingPool(), this.getBankTotal(res?.params.bond_denom)])
|
||||
.then(resArr => {
|
||||
console.log(resArr, 'ddd')
|
||||
})
|
||||
// const totalRes = await this.getBankTotal(res?.params.bond_denom)
|
||||
// console.log(res, 9999, totalRes)
|
||||
|
||||
},
|
||||
// normalize(data: {}, title:string) {
|
||||
// if (!data) return null
|
||||
@ -113,7 +117,14 @@ export const useParamStore = defineStore("paramstore", {
|
||||
return await this.blockchain.rpc.getStakingPool()
|
||||
},
|
||||
async getBankTotal(denom: string){
|
||||
// return
|
||||
return await this.blockchain.rpc.getBankSupplyByDenom(denom)
|
||||
// if (compareVersions(this.config.sdk_version, '0.46.2') > 0) {
|
||||
// return this.get(`/cosmos/bank/v1beta1/supply/by_denom?denom=${denom}`).then(data => commonProcess(data).amount)
|
||||
// }
|
||||
// if (compareVersions(this.config.sdk_version, '0.40') < 0) {
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user