remove price cache
This commit is contained in:
parent
b684059eb0
commit
676e19ed1d
@ -10,7 +10,7 @@ import { sha256 } from '@cosmjs/crypto'
|
|||||||
import { toHex } from '@cosmjs/encoding'
|
import { toHex } from '@cosmjs/encoding'
|
||||||
|
|
||||||
let chains = {}
|
let chains = {}
|
||||||
|
const coingecko = {}
|
||||||
let configs = require.context('../../chains/mainnet', false, /\.json$/)
|
let configs = require.context('../../chains/mainnet', false, /\.json$/)
|
||||||
if (isTestnet()) {
|
if (isTestnet()) {
|
||||||
configs = require.context('../../chains/testnet', false, /\.json$/)
|
configs = require.context('../../chains/testnet', false, /\.json$/)
|
||||||
@ -21,6 +21,9 @@ configs.keys().forEach(k => {
|
|||||||
const c = configs(k)
|
const c = configs(k)
|
||||||
c.chain_name = String(c.chain_name).toLowerCase()
|
c.chain_name = String(c.chain_name).toLowerCase()
|
||||||
update[c.chain_name] = c
|
update[c.chain_name] = c
|
||||||
|
c.assets.forEach(x => {
|
||||||
|
if (x.coingecko_id && x.coingecko_id !== '') coingecko[x.coingecko_id] = String(x.symbol).toUpperCase()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
chains = update
|
chains = update
|
||||||
@ -83,9 +86,24 @@ export default {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async getQuotes(context) {
|
async getQuotes(context) {
|
||||||
fetch('https://price.ping.pub/quotes').then(data => data.json()).then(data => {
|
// fetch('https://price.ping.pub/quotes').then(data => data.json()).then(data => {
|
||||||
context.commit('setQuotes', data)
|
// context.commit('setQuotes', data)
|
||||||
})
|
// console.log(data)
|
||||||
|
// })
|
||||||
|
console.log(coingecko)
|
||||||
|
const keys = Object.keys(coingecko)
|
||||||
|
if (keys.length > 0) {
|
||||||
|
const currencies = 'usd,cny,eur,jpy,krw,sgd,hkd'
|
||||||
|
fetch(`https://api.coingecko.com/api/v3/simple/price?vs_currencies=${currencies}&ids=${keys.join(',')}`).then(data => data.json()).then(data => {
|
||||||
|
// use symbol as key instead of coingecko id
|
||||||
|
const quotes = {}
|
||||||
|
Object.keys(data).forEach(k => {
|
||||||
|
quotes[coingecko[k]] = data[k]
|
||||||
|
})
|
||||||
|
context.commit('setQuotes', quotes)
|
||||||
|
console.log(quotes)
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async getAllIBCDenoms(context, _this) {
|
async getAllIBCDenoms(context, _this) {
|
||||||
|
Loading…
Reference in New Issue
Block a user