refactor
This commit is contained in:
parent
9752ff1d04
commit
0ccfd3b79f
8
src/chains/testnet/iris.json
Normal file
8
src/chains/testnet/iris.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"chain_name": "iris-network",
|
||||
"api": "http://35.234.10.84:1317",
|
||||
"sdk_version": "0.42.4",
|
||||
"addr_prefix": "iaa",
|
||||
"excludes": "mint",
|
||||
"logo": "https://dl.airtable.com/.attachments/2d6d51b1b262db00ecc51616ffc3bdf5/90ff00d0/IRISnet.svg"
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
let chains = {}
|
||||
|
||||
const configs = require.context('.', false, /\.json$/)
|
||||
let configs = require.context('../../chains/mainnet', false, /\.json$/)
|
||||
if (window.location.hostname.startsWith('testnet') || window.location.search.indexOf('testnet')) {
|
||||
configs = require.context('../../chains/testnet', false, /\.json$/)
|
||||
}
|
||||
|
||||
const update = {}
|
||||
configs.keys().forEach(k => {
|
||||
@ -8,38 +11,10 @@ configs.keys().forEach(k => {
|
||||
update[c.chain_name] = c
|
||||
})
|
||||
|
||||
// const localChains = localStorage.getItem('chains')
|
||||
// if (localChains) {
|
||||
// chains = JSON.parse(localChains)
|
||||
// } else {
|
||||
chains = update
|
||||
localStorage.setItem('chains', JSON.stringify(update))
|
||||
const selected = chains.cosmos
|
||||
|
||||
// }
|
||||
|
||||
// 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,
|
||||
state: {
|
||||
|
Loading…
Reference in New Issue
Block a user