diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 00000000..55f987ce Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 00000000..78b07ba4 Binary files /dev/null and b/public/logo.png differ diff --git a/public/logo.svg b/public/logo.svg new file mode 100644 index 00000000..2e3a50df --- /dev/null +++ b/public/logo.svg @@ -0,0 +1,158 @@ + + + + diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 7ca86dac..e72a8084 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -27,7 +27,7 @@ async function refetchVersion(chain) { const re = /(\d+(\.\d+)*)/i const version = sdk.match(re) return version[0] - }) + }).catch(() => null) } const chainAPI = class ChainFetch { diff --git a/src/router/index.js b/src/router/index.js index cb277d79..c90bab8f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,6 +1,5 @@ import Vue from 'vue' import VueRouter from 'vue-router' -import fetch from 'node-fetch' import store from '../store' Vue.use(VueRouter) @@ -190,20 +189,12 @@ const router = new VueRouter({ router.beforeEach((to, from, next) => { const c = to.params.chain - const has = Object.keys(store.state.chains.config).findIndex(i => i === c) - if (has > -1) { - const chain = store.state.chains.config[c] - store.commit('select', { chain_name: c }) - if (chain.sdk_version) { - fetch(`${chain.api}/node_info`) - .then(res => res.json()) - .then(json => { - const sdk = json.application_version.build_deps.find(e => e.startsWith('github.com/cosmos/cosmos-sdk')) - const re = /(\d+(\.\d+)*)/i - const version = sdk.match(re) - store.commit('setup_sdk_version', { chain_name: c, version: version[0] }) - }) - } + store.commit('select', { chain_name: c }) + + const config = JSON.parse(localStorage.getItem('chains')) + console.log(config, c) + // const has = Object.keys(config).findIndex(i => i === c) + if (!config || Object.keys(config).findIndex(i => i === c) > -1) { next() } else if (c) { next({ name: 'chain-404' }) diff --git a/src/store/chains/index.js b/src/store/chains/index.js index d1a830a8..7a263a43 100644 --- a/src/store/chains/index.js +++ b/src/store/chains/index.js @@ -1,10 +1,5 @@ let chains = {} -const localChains = localStorage.getItem('chains') -if (localChains) { - chains = JSON.parse(localChains) -} - const configs = require.context('.', false, /\.json$/) const update = {} @@ -13,6 +8,13 @@ configs.keys().forEach(k => { update[c.chain_name] = c }) +const localChains = localStorage.getItem('chains') +if (localChains) { + chains = JSON.parse(localChains) +} else { + chains = update +} + Object.keys(update).forEach(key => { const chain = update[key] fetch(`${chain.api}/node_info`) diff --git a/src/views/Staking.vue b/src/views/Staking.vue index bf79d836..a3e16f76 100644 --- a/src/views/Staking.vue +++ b/src/views/Staking.vue @@ -130,12 +130,6 @@ export default { tdClass: 'text-right', thClass: 'text-right', }, - { - key: 'apr', - formatter: (value, i, data) => this.apr(value, i, data), - tdClass: 'text-right', - thClass: 'text-right', - }, { key: 'operation' }, ], } @@ -144,9 +138,6 @@ export default { this.$http.getStakingPool().then(res => { this.stakingPool = res }) - this.$http.getMintingInflation().then(res => { - this.mintInflation = res - }) this.$http.getStakingParameters().then(res => { this.stakingParameters = res }) @@ -181,9 +172,6 @@ export default { tokenFormatter(amount, denom) { return formatToken({ amount, denom }) }, - apr(value, i, data) { - return `${percent((1 - data.commission.rate) * this.mintInflation)} %` - }, rankBadge(data) { const { index, item } = data if (index === 0) {