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] 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