add price in home page.

This commit is contained in:
liangping
2021-10-10 16:29:12 +08:00
parent 6e0c1c47c2
commit 5b0d2eebc0
9 changed files with 119 additions and 81 deletions
+7 -1
View File
@@ -6,7 +6,7 @@ import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx'
import { toBase64 } from '@cosmjs/encoding'
import {
Proposal, ProposalTally, Proposer, StakingPool, Votes, Deposit,
Validator, StakingParameters, Block, ValidatorDistribution, StakingDelegation, WrapStdTx,
Validator, StakingParameters, Block, ValidatorDistribution, StakingDelegation, WrapStdTx, getUserCurrency,
} from './data'
function commonProcess(res) {
@@ -318,6 +318,12 @@ const chainAPI = class ChainFetch {
return this.get('/cosmos/liquidity/v1beta1/pools').then(data => commonProcess(data))
}
async getMarketChart(days = 14, coin = null) {
const conf = this.getSelectedConfig()
const currency = getUserCurrency()
return ChainFetch.fetch(' https://api.coingecko.com', `/api/v3/coins/${coin || conf.chain_name}/market_chart?vs_currency=${currency}&days=${days}`)
}
// CoinMarketCap
static async fetchCoinMarketCap(url) {
const host = 'https://price.ping.pub'