fix dashboard

This commit is contained in:
Pham Tu 2024-01-18 10:54:10 +07:00
parent 15ed3e4df1
commit dd1d2e99a8
No known key found for this signature in database
GPG Key ID: 7460FD99133ADA1C
4 changed files with 10 additions and 16 deletions

View File

@ -1,5 +1,4 @@
<script lang="ts" setup>
import { fromBase64, toBase64 } from '@cosmjs/encoding';
import { decodeTxRaw } from '@cosmjs/proto-signing';
import { computed } from '@vue/reactivity';
import { hashTx } from '@/libs';

View File

@ -253,15 +253,9 @@ export class CosmosRestClient extends BaseRestClient<RequestRegistry> {
return res;
}
async getBankSupplyByDenom(denom: string) {
let supply;
try {
supply = await this.queryClient.bank.supplyOf(denom);
console.log(supply);
} catch (err) {
// will move this to sdk version profile later
console.log('err getting bank supply: ', err);
}
return supply;
const res = await this.queryClient.bank.supplyOf(denom);
console.log(res);
return res;
}
// Distribution Module
async getDistributionParams() {

View File

@ -2,15 +2,16 @@ import { defineStore } from 'pinia';
import { useBlockchain } from './useBlockchain';
import { useStakingStore } from './useStakingStore';
import type { Coin, DenomTrace } from '@/types';
import type { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin';
import type { DenomTrace } from 'cosmjs-types/ibc/applications/transfer/v1/transfer';
export const useBankStore = defineStore('bankstore', {
state: () => {
return {
supply: {} as Coin,
supply: {} as Coin | undefined,
balances: {} as Record<string, Coin[]>,
totalSupply: { supply: [] as Coin[] },
ibcDenoms: {} as Record<string, DenomTrace>,
ibcDenoms: {} as Record<string, DenomTrace | undefined>,
};
},
getters: {
@ -26,11 +27,11 @@ export const useBankStore = defineStore('bankstore', {
this.$reset();
this.supply = {} as Coin;
const denom =
this.staking.params.bond_denom ||
this.staking.params.bondDenom ||
this.blockchain.current?.assets[0].base;
if (denom) {
this.blockchain.rpc.getBankSupplyByDenom(denom).then((res) => {
if (res.amount) this.supply = res.amount;
this.supply = res;
});
}
},

View File

@ -22,7 +22,7 @@ export const useMintStore = defineStore('mintStore', {
this.inflation = '0';
});
if (res) {
this.inflation = res.inflation;
this.inflation = res.toString();
}
} catch (e) {
console.log(e);