From 250c1b994b9cf90b843a9825de6474ad57408347 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 17 Nov 2021 16:08:54 +0800 Subject: [PATCH 01/12] fix issue --- src/store/chains/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/chains/index.js b/src/store/chains/index.js index aba18098..319d60d4 100644 --- a/src/store/chains/index.js +++ b/src/store/chains/index.js @@ -1,7 +1,7 @@ let chains = {} let configs = require.context('../../chains/mainnet', false, /\.json$/) -if (window.location.hostname.startsWith('testnet') || window.location.search.indexOf('testnet')) { +if (window.location.hostname.startsWith('testnet') || window.location.search.indexOf('testnet') > -1) { configs = require.context('../../chains/testnet', false, /\.json$/) } From a0b774464922db886652dc6a84fa5eb261159d70 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 17 Nov 2021 20:53:05 +0800 Subject: [PATCH 02/12] add ki chain --- src/chains/mainnet/kichain.json | 7 +++++++ src/lang/locales/en.json | 1 + 2 files changed, 8 insertions(+) create mode 100644 src/chains/mainnet/kichain.json diff --git a/src/chains/mainnet/kichain.json b/src/chains/mainnet/kichain.json new file mode 100644 index 00000000..6828384d --- /dev/null +++ b/src/chains/mainnet/kichain.json @@ -0,0 +1,7 @@ +{ + "chain_name": "kichain", + "api": "https://ki.api.ping.pub", + "sdk_version": "0.42.10", + "addr_prefix": "ki", + "logo": "https://dl.airtable.com/.attachments/b1f670d31bf69d7ca9906df8437d91a7/b2667ad1/ki.png" +} \ No newline at end of file diff --git a/src/lang/locales/en.json b/src/lang/locales/en.json index 21fe09fd..83138473 100644 --- a/src/lang/locales/en.json +++ b/src/lang/locales/en.json @@ -27,6 +27,7 @@ "stargaze": "Stargaze", "injective": "Injective Protocal", "vidulum": "Vidulum", + "kichain": "KI Chain", "staking": "Staking", "governance": "Governance", From 5c82c2c562af8dc14c725a79879a10c492cc7477 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 13:42:50 +0800 Subject: [PATCH 03/12] update CI deploy --- .github/workflows/deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index fd8613c8..5147dc8f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -3,14 +3,14 @@ name: Ping Deploy on: push: - branches: [ master ] + branches: [ master, testnet ] pull_request: - branches: [ master ] + branches: [ master, testnet ] jobs: deploy: name: Ping deploy - runs-on: self-hosted + runs-on: ${GITHUB_REF#refs/heads/} steps: - name: Git Checkout Latest uses: actions/checkout@v2 From 284f255838961e1fb897fe95fc5ee025cf16eca2 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 13:49:30 +0800 Subject: [PATCH 04/12] update --- .github/workflows/deploy.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 5147dc8f..bebe682a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -10,8 +10,10 @@ on: jobs: deploy: name: Ping deploy - runs-on: ${GITHUB_REF#refs/heads/} + runs-on: self-hosted steps: + - name: print + run: echo ${GITHUB_REF#refs/heads/} - name: Git Checkout Latest uses: actions/checkout@v2 From 83d6ad28c1523833d0e191dc356c498c7c409cf0 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 14:16:28 +0800 Subject: [PATCH 05/12] debug --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index bebe682a..d2f56cf4 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -10,7 +10,7 @@ on: jobs: deploy: name: Ping deploy - runs-on: self-hosted + runs-on: ${GITHUB_REF_NAME} steps: - name: print run: echo ${GITHUB_REF#refs/heads/} From 5b116a4c902467f31384de58ad73b8722520f9c6 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 14:20:11 +0800 Subject: [PATCH 06/12] debug --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index d2f56cf4..656a185e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -10,7 +10,7 @@ on: jobs: deploy: name: Ping deploy - runs-on: ${GITHUB_REF_NAME} + runs-on: ${{ GITHUB_REF_NAME }} steps: - name: print run: echo ${GITHUB_REF#refs/heads/} From b5b606bd08a7a1a6da8ea30671f1d1431617318c Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 14:24:47 +0800 Subject: [PATCH 07/12] debug --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 656a185e..a3517bef 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -10,7 +10,7 @@ on: jobs: deploy: name: Ping deploy - runs-on: ${{ GITHUB_REF_NAME }} + runs-on: ${{ GITHUB_REF#refs/heads/ }} steps: - name: print run: echo ${GITHUB_REF#refs/heads/} From 5b18d947dfb5578acd2d6277b63e8d80ef34c52c Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 14:34:58 +0800 Subject: [PATCH 08/12] Update deploy --- .../{deploy.yaml => mainnet-deploy.yaml} | 6 ++--- .github/workflows/testnet-deploy.yaml | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) rename .github/workflows/{deploy.yaml => mainnet-deploy.yaml} (77%) create mode 100644 .github/workflows/testnet-deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/mainnet-deploy.yaml similarity index 77% rename from .github/workflows/deploy.yaml rename to .github/workflows/mainnet-deploy.yaml index a3517bef..d1ae0be5 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/mainnet-deploy.yaml @@ -3,14 +3,14 @@ name: Ping Deploy on: push: - branches: [ master, testnet ] + branches: [ master ] pull_request: - branches: [ master, testnet ] + branches: [ master ] jobs: deploy: name: Ping deploy - runs-on: ${{ GITHUB_REF#refs/heads/ }} + runs-on: mainnet steps: - name: print run: echo ${GITHUB_REF#refs/heads/} diff --git a/.github/workflows/testnet-deploy.yaml b/.github/workflows/testnet-deploy.yaml new file mode 100644 index 00000000..988ab846 --- /dev/null +++ b/.github/workflows/testnet-deploy.yaml @@ -0,0 +1,27 @@ + +name: Ping Deploy + +on: + push: + branches: [ testnet ] + pull_request: + branches: [ testnet ] + +jobs: + deploy: + name: Ping deploy + runs-on: testnet + steps: + - name: print + run: echo ${GITHUB_REF#refs/heads/} + - name: Git Checkout Latest + uses: actions/checkout@v2 + + - name: Install + run: yarn install + + - name: Build + run: yarn run vue-cli-service build + + - name: Deploy + run: cp -rf ./dist/* /var/www/html/ \ No newline at end of file From 2b0d691a10f9ad0ab9f9ed1626e0c5372e307175 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 15:35:50 +0800 Subject: [PATCH 09/12] move omniflix to testnet --- src/chains/{mainnet => testnet}/omniflix.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/chains/{mainnet => testnet}/omniflix.json (100%) diff --git a/src/chains/mainnet/omniflix.json b/src/chains/testnet/omniflix.json similarity index 100% rename from src/chains/mainnet/omniflix.json rename to src/chains/testnet/omniflix.json From bb87305e8439f95821da6a7a6b3ba6864f68a77b Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 16:45:28 +0800 Subject: [PATCH 10/12] update price chart/configs --- src/chains/mainnet/akash.json | 1 + src/chains/mainnet/band.json | 1 + src/chains/mainnet/bitsong.json | 1 + src/chains/mainnet/certik.json | 1 + src/chains/mainnet/cosmos.json | 1 + src/chains/mainnet/crypto.json | 1 + src/chains/mainnet/desmos.json | 1 + src/chains/mainnet/emoney.json | 1 + src/chains/mainnet/injective.json | 1 + src/chains/mainnet/iris.json | 1 + src/chains/mainnet/juno.json | 1 + src/chains/mainnet/kava.json | 1 + src/chains/mainnet/kichain.json | 1 + src/chains/mainnet/likecoin.json | 1 + src/chains/mainnet/okexchain.json | 1 + src/chains/mainnet/osmosis.json | 1 + src/chains/mainnet/persistence.json | 1 + src/chains/mainnet/regen.json | 1 + src/chains/mainnet/secret.json | 1 + src/chains/mainnet/sentinel.json | 1 + src/chains/mainnet/sifchain.json | 1 + src/chains/mainnet/stargaze.json | 1 + src/chains/mainnet/starname.json | 1 + src/chains/mainnet/terra.json | 1 + src/chains/mainnet/vidulum.json | 3 ++- src/libs/fetch.js | 5 ++++- 26 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/chains/mainnet/akash.json b/src/chains/mainnet/akash.json index 72652a60..ce72b085 100644 --- a/src/chains/mainnet/akash.json +++ b/src/chains/mainnet/akash.json @@ -1,5 +1,6 @@ { "chain_name": "akash-network", + "coingecko": "akash-network", "api": "https://akash.api.ping.pub", "sdk_version": "0.41.3", "addr_prefix": "akash", diff --git a/src/chains/mainnet/band.json b/src/chains/mainnet/band.json index e52bd8b9..0f5c9c7e 100644 --- a/src/chains/mainnet/band.json +++ b/src/chains/mainnet/band.json @@ -1,5 +1,6 @@ { "chain_name": "band-protocol", + "coingecko": "band-protocol", "api": "https://laozi1.bandchain.org/api", "addr_prefix": "band", "logo": "https://dl.airtable.com/.attachments/472ae99a508e32b4439b416beddd4eb9/c5166f62/band-symbol-blue-bg.75a3ad91.svg", diff --git a/src/chains/mainnet/bitsong.json b/src/chains/mainnet/bitsong.json index 372a2656..ba785a33 100644 --- a/src/chains/mainnet/bitsong.json +++ b/src/chains/mainnet/bitsong.json @@ -1,5 +1,6 @@ { "chain_name": "bitsong", + "coingecko": "bitsong", "api": "https://lcd.explorebitsong.com", "addr_prefix": "bitsong", "logo": "https://dl.airtable.com/.attachments/8016b71b69fb108f0ff33eb9af1c943f/f5fe4ef4/bitsong.svg", diff --git a/src/chains/mainnet/certik.json b/src/chains/mainnet/certik.json index c2205b6a..d1f349b2 100644 --- a/src/chains/mainnet/certik.json +++ b/src/chains/mainnet/certik.json @@ -1,6 +1,7 @@ { "chain_name": "certik", + "coingecko": "certik", "api":"https://azuredragon.noopsbycertik.com", "sdk_version": "0.42.9", "addr_prefix": "certik", diff --git a/src/chains/mainnet/cosmos.json b/src/chains/mainnet/cosmos.json index 5f25b43a..8ce64577 100644 --- a/src/chains/mainnet/cosmos.json +++ b/src/chains/mainnet/cosmos.json @@ -1,5 +1,6 @@ { "chain_name": "cosmos", + "coingecko": "cosmos", "api":"https://cosmos.api.ping.pub", "sdk_version": "0.42.6", "addr_prefix": "cosmos", diff --git a/src/chains/mainnet/crypto.json b/src/chains/mainnet/crypto.json index d2f0fd76..98e69ac2 100644 --- a/src/chains/mainnet/crypto.json +++ b/src/chains/mainnet/crypto.json @@ -1,6 +1,7 @@ { "chain_name": "crypto-com-chain", + "coingecko": "crypto-com-chain", "api": "https://mainnet.crypto.org:1317", "sdk_version": "0.39.2", "addr_prefix": "cro", diff --git a/src/chains/mainnet/desmos.json b/src/chains/mainnet/desmos.json index 8c38efe9..f8a5fe98 100644 --- a/src/chains/mainnet/desmos.json +++ b/src/chains/mainnet/desmos.json @@ -1,5 +1,6 @@ { "chain_name": "desmos", + "coingecko": "", "api": "https://api.mainnet.desmos.network", "sdk_version": "0.42.0", "addr_prefix": "desmos", diff --git a/src/chains/mainnet/emoney.json b/src/chains/mainnet/emoney.json index dad033e6..9761c65e 100644 --- a/src/chains/mainnet/emoney.json +++ b/src/chains/mainnet/emoney.json @@ -1,5 +1,6 @@ { "chain_name": "e-money", + "coingecko": "e-money", "api": "https://emoney.validator.network/api", "addr_prefix": "emoney", "logo": "https://dl.airtable.com/.attachments/276e4d6de567b073a5e400240d7d83e9/9bb49806/yoR2r25W_400x400.jpg", diff --git a/src/chains/mainnet/injective.json b/src/chains/mainnet/injective.json index e066086f..55849b3a 100644 --- a/src/chains/mainnet/injective.json +++ b/src/chains/mainnet/injective.json @@ -1,5 +1,6 @@ { "chain_name": "injective", + "coingecko": "injective-protocol", "api": "https://lcd.injective.network", "sdk_version": "0.42.4", "addr_prefix": "inj", diff --git a/src/chains/mainnet/iris.json b/src/chains/mainnet/iris.json index f7471262..fe45c2f4 100644 --- a/src/chains/mainnet/iris.json +++ b/src/chains/mainnet/iris.json @@ -1,5 +1,6 @@ { "chain_name": "iris-network", + "coingecko": "iris-network", "api": "https://iris.api.ping.pub", "sdk_version": "0.42.4", "addr_prefix": "iaa", diff --git a/src/chains/mainnet/juno.json b/src/chains/mainnet/juno.json index e599128a..cddd230d 100644 --- a/src/chains/mainnet/juno.json +++ b/src/chains/mainnet/juno.json @@ -1,5 +1,6 @@ { "chain_name": "juno", + "coingecko": "juno-network", "api": "https://juno.api.ping.pub", "sdk_version": "0.42.4", "addr_prefix": "juno", diff --git a/src/chains/mainnet/kava.json b/src/chains/mainnet/kava.json index c75bacf3..5ad69c61 100644 --- a/src/chains/mainnet/kava.json +++ b/src/chains/mainnet/kava.json @@ -1,5 +1,6 @@ { "chain_name": "kava", + "coingecko": "kava", "api": "https://api.data.kava.io", "sdk_version": "0.39.2", "addr_prefix": "kava", diff --git a/src/chains/mainnet/kichain.json b/src/chains/mainnet/kichain.json index 6828384d..7cbf548f 100644 --- a/src/chains/mainnet/kichain.json +++ b/src/chains/mainnet/kichain.json @@ -1,5 +1,6 @@ { "chain_name": "kichain", + "coingecko": "ki", "api": "https://ki.api.ping.pub", "sdk_version": "0.42.10", "addr_prefix": "ki", diff --git a/src/chains/mainnet/likecoin.json b/src/chains/mainnet/likecoin.json index 05c48fe4..c6ee0fa0 100644 --- a/src/chains/mainnet/likecoin.json +++ b/src/chains/mainnet/likecoin.json @@ -1,5 +1,6 @@ { "chain_name": "likecoin", + "coingecko": "likecoin", "api": "https://mainnet-node.like.co", "sdk_version": "0.42.0", "addr_prefix": "cosmos", diff --git a/src/chains/mainnet/okexchain.json b/src/chains/mainnet/okexchain.json index 4791fbd2..1b5be0df 100644 --- a/src/chains/mainnet/okexchain.json +++ b/src/chains/mainnet/okexchain.json @@ -1,5 +1,6 @@ { "chain_name": "okexchain", + "coingecko": "okexchain", "api": "https://exchainrpc.okex.org/okexchain/v1", "sdk_version": "0.39.2", "addr_prefix": "ex", diff --git a/src/chains/mainnet/osmosis.json b/src/chains/mainnet/osmosis.json index 5fcc106e..de886553 100644 --- a/src/chains/mainnet/osmosis.json +++ b/src/chains/mainnet/osmosis.json @@ -1,5 +1,6 @@ { "chain_name": "osmosis", + "coingecko": "osmosis", "api": "https://lcd-osmosis.keplr.app", "sdk_version": "0.42.5", "addr_prefix": "osmo", diff --git a/src/chains/mainnet/persistence.json b/src/chains/mainnet/persistence.json index e22139b9..5323430a 100644 --- a/src/chains/mainnet/persistence.json +++ b/src/chains/mainnet/persistence.json @@ -1,5 +1,6 @@ { "chain_name": "persistence", + "coingecko": "persistence", "api": "https://rest.core.persistence.one", "sdk_version": "0.42.4", "addr_prefix": "persistence", diff --git a/src/chains/mainnet/regen.json b/src/chains/mainnet/regen.json index 8799b560..5850a3f9 100644 --- a/src/chains/mainnet/regen.json +++ b/src/chains/mainnet/regen.json @@ -1,5 +1,6 @@ { "chain_name": "regen", + "coingecko": "regen", "api": "https://regen.api.ping.pub", "sdk_version": "0.42.4", "addr_prefix": "regen", diff --git a/src/chains/mainnet/secret.json b/src/chains/mainnet/secret.json index 18865aa6..649c9357 100644 --- a/src/chains/mainnet/secret.json +++ b/src/chains/mainnet/secret.json @@ -1,5 +1,6 @@ { "chain_name": "secret", + "coingecko": "secret", "api": "https://api.scrt.network", "sdk_version": "0.33.8", "addr_prefix": "secret", diff --git a/src/chains/mainnet/sentinel.json b/src/chains/mainnet/sentinel.json index cfbf37e7..30a94875 100644 --- a/src/chains/mainnet/sentinel.json +++ b/src/chains/mainnet/sentinel.json @@ -1,5 +1,6 @@ { "chain_name": "sentinel", + "coingecko": "sentinel", "api": "https://lcd.sentinel.co", "sdk_version": "0.42.6", "addr_prefix": "sent", diff --git a/src/chains/mainnet/sifchain.json b/src/chains/mainnet/sifchain.json index ec26103e..e6385c0e 100644 --- a/src/chains/mainnet/sifchain.json +++ b/src/chains/mainnet/sifchain.json @@ -1,5 +1,6 @@ { "chain_name": "sifchain", + "coingecko": "sifchain", "api": "https://api.sifchain.finance", "sdk_version": "0.42.6", "addr_prefix": "sif", diff --git a/src/chains/mainnet/stargaze.json b/src/chains/mainnet/stargaze.json index b491ade7..a2ab2be5 100644 --- a/src/chains/mainnet/stargaze.json +++ b/src/chains/mainnet/stargaze.json @@ -1,5 +1,6 @@ { "chain_name": "stargaze", + "coingecko": "stargaze-protocol", "api": "https://rest.stargaze.publicawesome.dev", "sdk_version": "0.44.3", "addr_prefix": "stars", diff --git a/src/chains/mainnet/starname.json b/src/chains/mainnet/starname.json index 86509c65..5b33ad85 100644 --- a/src/chains/mainnet/starname.json +++ b/src/chains/mainnet/starname.json @@ -1,5 +1,6 @@ { "chain_name": "starname", + "coingecko": "starname", "api": "https://api.iov-mainnet-ibc.iov.one", "sdk_version": "0.42.6", "addr_prefix": "star", diff --git a/src/chains/mainnet/terra.json b/src/chains/mainnet/terra.json index 2249eae8..6881374e 100644 --- a/src/chains/mainnet/terra.json +++ b/src/chains/mainnet/terra.json @@ -1,5 +1,6 @@ { "chain_name": "terra-luna", + "coingecko": "terra-luna", "api": "https://fcd.terra.dev", "sdk_version": "0.44.2", "addr_prefix": "terra", diff --git a/src/chains/mainnet/vidulum.json b/src/chains/mainnet/vidulum.json index 5f106162..b2fbbd83 100644 --- a/src/chains/mainnet/vidulum.json +++ b/src/chains/mainnet/vidulum.json @@ -1,6 +1,7 @@ { "chain_name": "vidulum", - "api": "https://mainnet-lcd.vidulum.app/", + "coingecko": "vidulum", + "api": "https://mainnet-lcd.vidulum.app", "sdk_version": "0.44.0", "addr_prefix": "vdl", "logo": "/logos/VDL.png" diff --git a/src/libs/fetch.js b/src/libs/fetch.js index db8c74f5..244c8c24 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -355,7 +355,10 @@ export default class ChainFetch { async getMarketChart(days = 14, coin = null) { const conf = this.getSelectedConfig() const currency = getUserCurrency() - return ChainFetch.fetch(' https://api.coingecko.com', `/api/v3/coins/${coin || conf.chain_name}/market_chart?vs_currency=${currency}&days=${days}`) + if (conf.coingecko && conf.coingecko.length > 0) { + return ChainFetch.fetch(' https://api.coingecko.com', `/api/v3/coins/${coin || conf.coingecko}/market_chart?vs_currency=${currency}&days=${days}`) + } + return null } // CoinMarketCap From e4dab58683637601e0a0f7027302680508c4657a Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 17:49:26 +0800 Subject: [PATCH 11/12] improve UX --- src/views/Uptime.vue | 2 +- src/views/UptimeMyValidators.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/Uptime.vue b/src/views/Uptime.vue index 3a0db17d..9f91bfed 100644 --- a/src/views/Uptime.vue +++ b/src/views/Uptime.vue @@ -14,7 +14,7 @@ class="mb-1" > Browse favourate only diff --git a/src/views/UptimeMyValidators.vue b/src/views/UptimeMyValidators.vue index 69da36f6..e5dc1bb9 100644 --- a/src/views/UptimeMyValidators.vue +++ b/src/views/UptimeMyValidators.vue @@ -51,7 +51,7 @@ export default { const validators = [] pinned[x].forEach(address => { const val = cached.find(v => address === consensusPubkeyToHexAddress(v.consensus_pubkey)) - validators.push({ address, validator: val.description }) + if (val) validators.push({ address, validator: val.description }) }) chainVals[x] = validators }) From d7160ee5006274646b121629a4716e731e2d3d3b Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 18 Nov 2021 22:01:19 +0800 Subject: [PATCH 12/12] add links to menu --- src/libs/data/data.js | 5 +++++ src/navigation/vertical/index.js | 31 +++++++++++++++++++++++++++++++ src/store/chains/index.js | 4 +++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/libs/data/data.js b/src/libs/data/data.js index 88ce163a..3d91ac45 100644 --- a/src/libs/data/data.js +++ b/src/libs/data/data.js @@ -321,6 +321,11 @@ export function formatTokenAmount(tokenAmount, fraction = 2, denom = 'uatom') { return parseFloat(amount) } +export function isTestnet() { + return (window.location.hostname.startsWith('testnet') + || window.location.search.indexOf('testnet') > -1) +} + export function formatToken(token, IBCDenom = {}, decimals = 2) { if (token) { return `${formatTokenAmount(token.amount, decimals, token.denom)} ${formatTokenDenom(IBCDenom[token.denom] || token.denom)}` diff --git a/src/navigation/vertical/index.js b/src/navigation/vertical/index.js index 52cc34e6..9ad9da77 100644 --- a/src/navigation/vertical/index.js +++ b/src/navigation/vertical/index.js @@ -1,4 +1,5 @@ import store from '@/store' +import { isTestnet } from '../../libs/data/data' const modules = [ { @@ -71,6 +72,36 @@ function processMenu() { menu.children = children chainMenus.push(menu) }) + chainMenus.push({ header: 'LINKS' }) + if (isTestnet()) { + chainMenus.push({ + title: 'Mainnet Explorer', + href: 'https://ping.pub', + icon: 'ChromeIcon', + }) + } else { + chainMenus.push({ + title: 'Testnet Explorer', + href: 'http://testnet.ping.pub', + icon: 'LifeBuoyIcon', + }) + } + chainMenus.push({ + title: 'Discord', + href: 'https://discord.gg/CmjYVSr6GW', + icon: 'EyeIcon', + }) + chainMenus.push({ + title: 'Twitter', + href: 'https://twitter.com/ping_pub', + icon: 'TwitterIcon', + }) + chainMenus.push({ + title: 'Github', + href: 'https://github.com/ping-pub/explorer', + icon: 'GithubIcon', + }) + return chainMenus } diff --git a/src/store/chains/index.js b/src/store/chains/index.js index 319d60d4..38f82692 100644 --- a/src/store/chains/index.js +++ b/src/store/chains/index.js @@ -1,7 +1,9 @@ +import { isTestnet } from '@/libs/data/data' + let chains = {} let configs = require.context('../../chains/mainnet', false, /\.json$/) -if (window.location.hostname.startsWith('testnet') || window.location.search.indexOf('testnet') > -1) { +if (isTestnet()) { configs = require.context('../../chains/testnet', false, /\.json$/) }