forked from cerc-io/cosmos-explorer
hardcode sdk_version in config
This commit is contained in:
parent
b5d52f1d90
commit
be82fd5a1b
@ -87,6 +87,13 @@ export function formatToken(token) {
|
||||
}
|
||||
return `${parseFloat(amount)} ${denom}`
|
||||
}
|
||||
if (denom === 'BASECRO') {
|
||||
const amount = token.amount / 1000000
|
||||
if (amount > 10) {
|
||||
return `${parseFloat(amount.toFixed())} CRO`
|
||||
}
|
||||
return `${parseFloat(amount)} CRO`
|
||||
}
|
||||
return `${parseFloat(token.amount)} ${denom}`
|
||||
}
|
||||
return token
|
||||
|
@ -19,23 +19,6 @@ export function keybase(identity) {
|
||||
.then(res => res.json())
|
||||
}
|
||||
|
||||
async function refetchVersion(chain) {
|
||||
await fetch(`${chain.api}/node_info`)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
const { build_deps } = json.application_version
|
||||
// eslint-disable-next-line camelcase
|
||||
if (build_deps) {
|
||||
const sdk = build_deps.find(e => e.startsWith('github.com/cosmos/cosmos-sdk'))
|
||||
const re = /(\d+(\.\d+)*)/i
|
||||
const version = sdk.match(re)
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
return version[0]
|
||||
}
|
||||
return json.node_info.version
|
||||
}).catch(() => null)
|
||||
}
|
||||
|
||||
const chainAPI = class ChainFetch {
|
||||
getSelectedConfig() {
|
||||
let chain = store.state.chains.selected
|
||||
@ -43,9 +26,6 @@ const chainAPI = class ChainFetch {
|
||||
if (lschains) {
|
||||
chain = JSON.parse(lschains)[chain.chain_name]
|
||||
}
|
||||
if (!chain.sdk_version) {
|
||||
chain.sdk_version = refetchVersion(chain)
|
||||
}
|
||||
if (!chain.sdk_version) {
|
||||
chain.sdk_version = '0.33'
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"chain_name": "akash",
|
||||
"api": "https://akash.api.ping.pub",
|
||||
"sdk_version": "0.41.3",
|
||||
"logo": "https://dl.airtable.com/.attachments/52586702dd8352d97834fce5c2d83614/969b4d53/akash-network.png"
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"chain_name": "band",
|
||||
"api": "https://api-gm-lb.bandchain.org",
|
||||
"logo": "https://dl.airtable.com/.attachments/472ae99a508e32b4439b416beddd4eb9/c5166f62/band-symbol-blue-bg.75a3ad91.svg"
|
||||
"logo": "https://dl.airtable.com/.attachments/472ae99a508e32b4439b416beddd4eb9/c5166f62/band-symbol-blue-bg.75a3ad91.svg",
|
||||
"sdk_version": "0.33.8"
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"chain_name": "cosmos",
|
||||
"api":"https://lcd-cosmoshub.keplr.app",
|
||||
"sdk_version": "0.42.6",
|
||||
"logo": "https://dl.airtable.com/.attachments/e54f814bba8c0f9af8a3056020210de0/2d1155fb/cosmos-hub.svg"
|
||||
}
|
@ -2,5 +2,6 @@
|
||||
{
|
||||
"chain_name": "crypto",
|
||||
"api": "https://mainnet.crypto.org:1317",
|
||||
"sdk_version": "0.39.2",
|
||||
"logo": "https://dl.airtable.com/.attachments/b2e638424ea09dccd4f11b04dc53872a/844d11dc/LOGO.png"
|
||||
}
|
@ -13,27 +13,30 @@ if (localChains) {
|
||||
chains = JSON.parse(localChains)
|
||||
} else {
|
||||
chains = update
|
||||
localStorage.setItem('chains', JSON.stringify(update))
|
||||
}
|
||||
|
||||
Object.keys(update).forEach(key => {
|
||||
const chain = update[key]
|
||||
fetch(`${chain.api}/node_info`)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
const { build_deps } = json.application_version
|
||||
// eslint-disable-next-line camelcase
|
||||
if (build_deps) {
|
||||
const sdk = build_deps.find(e => e.startsWith('github.com/cosmos/cosmos-sdk'))
|
||||
const re = /(\d+(\.\d+)*)/i
|
||||
const version = sdk.match(re)
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
chain.sdk_version = version[0]
|
||||
} else {
|
||||
chain.sdk_version = json.node_info.version
|
||||
}
|
||||
localStorage.setItem('chains', JSON.stringify(update))
|
||||
})
|
||||
})
|
||||
// Object.keys(update).forEach(key => {
|
||||
// const chain = update[key]
|
||||
// if (!chain.sdk_version) {
|
||||
// fetch(`${chain.api}/node_info`)
|
||||
// .then(res => res.json())
|
||||
// .then(json => {
|
||||
// const { build_deps } = json.application_version
|
||||
// // eslint-disable-next-line camelcase
|
||||
// if (build_deps) {
|
||||
// const sdk = build_deps.find(e => e.startsWith('github.com/cosmos/cosmos-sdk'))
|
||||
// const re = /(\d+(\.\d+)*)/i
|
||||
// const version = sdk.match(re)
|
||||
// // eslint-disable-next-line prefer-destructuring
|
||||
// chain.sdk_version = version[0]
|
||||
// } else {
|
||||
// chain.sdk_version = json.node_info.version
|
||||
// }
|
||||
// localStorage.setItem('chains', JSON.stringify(update))
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"chain_name": "iris",
|
||||
"api": "https://iris.api.ping.pub",
|
||||
"sdk_version": "0.42.4",
|
||||
"logo": "https://dl.airtable.com/.attachments/2d6d51b1b262db00ecc51616ffc3bdf5/90ff00d0/IRISnet.svg"
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"chain_name": "kava",
|
||||
"chain_id": "kava-7",
|
||||
"api": "https://kava4.data.kava.io",
|
||||
"sdk_version": "0.39.2",
|
||||
"logo": "https://dl.airtable.com/.attachments/f25737491bd0034240093a7b4e039b15/afec77ff/logo.png"
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"chain_name": "okexchain",
|
||||
"api": "https://exchainrpc.okex.org/okexchain/v1",
|
||||
"sdk_version": "0.39.2",
|
||||
"logo": "https://dl.airtable.com/.attachments/4620a173477efece7f459a3d6fc770c0/9f6618ad/OKexchain.svg",
|
||||
"unload_module": ["minting", "slashing"]
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"chain_name": "osmosis",
|
||||
"api": "https://lcd-osmosis.keplr.app",
|
||||
"sdk_version": "0.42.5",
|
||||
"logo": "https://dl.airtable.com/.attachments/4ef30ec4008bc86cc3c0f74a6bb84050/0eeb4d64/aQ5W3zaT_400x400.jpg"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user