add alias support

This commit is contained in:
liangping 2022-08-27 21:14:16 +08:00
parent ebad319fcd
commit bc25fce1cc
4 changed files with 13 additions and 10 deletions

View File

@ -1,5 +1,6 @@
{ {
"chain_name": "akash-network", "chain_name": "akash",
"alias": "akash-network",
"api": ["https://akash.c29r3.xyz:443/api", "https://akash.api.ping.pub"], "api": ["https://akash.c29r3.xyz:443/api", "https://akash.api.ping.pub"],
"rpc": ["http://rpc.akash.forbole.com:80", "http://akashsentry01.skynetvalidators.com:26657"], "rpc": ["http://rpc.akash.forbole.com:80", "http://akashsentry01.skynetvalidators.com:26657"],
"snapshot_provider": "", "snapshot_provider": "",

View File

@ -1,5 +1,6 @@
{ {
"chain_name": "band-protocol", "chain_name": "band",
"alias": "band-protocol",
"api": "https://laozi1.bandchain.org/api", "api": "https://laozi1.bandchain.org/api",
"rpc": ["http://rpc.laozi1.bandchain.org:80", "http://rpc.laozi1.bandchain.org:80"], "rpc": ["http://rpc.laozi1.bandchain.org:80", "http://rpc.laozi1.bandchain.org:80"],
"snapshot_provider": "", "snapshot_provider": "",

View File

@ -1,5 +1,6 @@
{ {
"chain_name": "iris-network", "chain_name": "iris",
"alias": "iris-network",
"api": "https://iris.api.ping.pub", "api": "https://iris.api.ping.pub",
"rpc": ["http://34.82.96.8:26657","http://34.77.68.145:26657"], "rpc": ["http://34.82.96.8:26657","http://34.77.68.145:26657"],
"snapshot_provider": "fcc1d9bc43163b20ce5163cf41a302b33f25375f@34.82.96.8:26656", "snapshot_provider": "fcc1d9bc43163b20ce5163cf41a302b33f25375f@34.82.96.8:26656",

View File

@ -403,14 +403,14 @@ const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const c = to.params.chain const c = String(to.params.chain).toLowerCase()
if (c) {
store.commit('select', { chain_name: String(c).toLowerCase() })
}
const config = JSON.parse(localStorage.getItem('chains')) const configs = JSON.parse(localStorage.getItem('chains'))
// const has = Object.keys(config).findIndex(i => i === c) const conf = Object.values(configs).find(i => i.chain_name === c || i.alias === c)
if (!config || Object.keys(config).findIndex(i => i === String(c).toLowerCase()) > -1) { if (!configs || conf) {
if (conf) {
store.commit('select', { chain_name: conf.chain_name })
}
next() next()
} else if (c) { } else if (c) {
if (c === 'index.php') { if (c === 'index.php') {