add new Dashboard

This commit is contained in:
liangping
2022-08-24 21:51:45 +08:00
parent 0fb20ce4f3
commit da77476827
29 changed files with 1022 additions and 145 deletions
+12
View File
@@ -416,6 +416,10 @@ export default class ChainFetch {
return this.get('/bank/balances/'.concat(address), config).then(data => commonProcess(data))
}
async getCommunityPool(config = null) {
return this.get('/cosmos/distribution/v1beta1/community_pool', config).then(data => commonProcess(data))
}
async getAllIBCDenoms(config = null) {
const conf = config || this.getSelectedConfig()
const sdkVersion = conf.sdk_version
@@ -470,6 +474,14 @@ export default class ChainFetch {
return null
}
async getCoinInfo(coin = null) {
const conf = this.getSelectedConfig()
if (conf.assets[0] && conf.assets[0].coingecko_id) {
return ChainFetch.fetch(' https://api.coingecko.com', `/api/v3/coins/${coin || conf.assets[0].coingecko_id}`)
}
return null
}
// CoinMarketCap
static async fetchCoinMarketCap(url) {
const host = 'https://price.ping.pub'
+2 -2
View File
@@ -439,9 +439,9 @@ export function formatNumber(count, withAbbr = false, decimals = 2) {
return result
}
export function tokenFormatter(tokens, denoms = {}) {
export function tokenFormatter(tokens, denoms = {}, decimal = 2) {
if (Array.isArray(tokens)) {
return tokens.map(t => formatToken(t, denoms, 2)).join(', ')
return tokens.map(t => formatToken(t, denoms, decimal)).join(', ')
}
return formatToken(tokens, denoms, 2)
}