Skip to content

Commit

Permalink
use explorer-static icons
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Jan 13, 2022
1 parent 637ec65 commit 3ecf767
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.master
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ APP_AUTO_DELEGATION_API_URL=https://autodelegator-api.minter.network/api/v1/
APP_EXPLORER_API_URL=https://explorer-api.minter.network/api/v2/
APP_EXPLORER_RTM_URL=wss://explorer-rtm.minter.network/connection/websocket
APP_EXPLORER_HOST=https://explorer.minter.network
APP_EXPLORER_STATIC_HOST=https://explorer-static.minter.network
APP_HUB_API_URL=https://hub-api.minter.network/
APP_ETHEREUM_API_URL=https://mainnet.infura.io/v3/0ab122c0f98043eda95266a862528e4c
APP_BSC_API_URL=https://bsc-dataseed.binance.org/
Expand Down
1 change: 1 addition & 0 deletions .env.taconet
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ APP_AUTO_DELEGATION_API_URL=https://autodelegator.testnet.minter.network/api/v1/
APP_EXPLORER_API_URL=https://explorer-api.taconet.minter.network/api/v2/
APP_EXPLORER_RTM_URL=wss://explorer-rtm.taconet.minter.network/connection/websocket
APP_EXPLORER_HOST=https://explorer.taconet.minter.network
APP_EXPLORER_STATIC_HOST=https://explorer-static.taconet.minter.network
APP_HUB_API_URL=http://46.101.215.17:9091
APP_ETHEREUM_API_URL=https://ropsten.infura.io/v3/7b534be6f59742f9843c7e7562924f44
APP_BSC_API_URL=https://data-seed-prebsc-1-s3.binance.org:8545/
Expand Down
1 change: 1 addition & 0 deletions .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ APP_AUTO_DELEGATION_API_URL=https://autodelegator.testnet.minter.network/api/v1/
APP_EXPLORER_API_URL=https://explorer-api.testnet.minter.network/api/v2/
APP_EXPLORER_RTM_URL=wss://explorer-rtm.testnet.minter.network/connection/websocket
APP_EXPLORER_HOST=https://explorer.testnet.minter.network
APP_EXPLORER_STATIC_HOST=https://explorer-static.testnet.minter.network
APP_HUB_API_URL=https://hub-api.kubernetes.icu/
APP_ETHEREUM_API_URL=https://ropsten.infura.io/v3/7b534be6f59742f9843c7e7562924f44
APP_BSC_API_URL=https://data-seed-prebsc-2-s3.binance.org:8545/
Expand Down
1 change: 1 addition & 0 deletions assets/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const AUTO_DELEGATION_API_URL = process.env.APP_AUTO_DELEGATION_API_URL;
export const EXPLORER_API_URL = process.env.APP_EXPLORER_API_URL;
export const EXPLORER_RTM_URL = process.env.APP_EXPLORER_RTM_URL;
export const EXPLORER_HOST = process.env.APP_EXPLORER_HOST;
export const EXPLORER_STATIC_HOST = process.env.APP_EXPLORER_STATIC_HOST;
export const MNS_API_URL = process.env.APP_MNS_API_URL;
export const MNS_PUBLIC_KEY = process.env.APP_MNS_PUBLIC_KEY;
export const CHAINIK_API_URL = 'https://chainik.io/json/';
Expand Down
11 changes: 8 additions & 3 deletions store/explorer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {isCoinId} from 'minter-js-sdk/src/utils.js';
// import {isCoinId} from 'minter-js-sdk/src/utils.js';
import {getStatus, getCoinList} from '~/api/explorer.js';
import {ACCOUNTS_API_URL, BASE_URL_PREFIX} from '~/assets/variables.js';
import {ACCOUNTS_API_URL, BASE_URL_PREFIX, EXPLORER_STATIC_HOST} from '~/assets/variables.js';

export const state = () => ({
/** @type Status|null */
status: null,
/** @type Array<CoinInfo> */
coinList: [],
/** @type {Object.<string, CoinInfo>} */
coinMap: {},
/** @type {Object.<string, string>} */
coinIconMap: {},
/** @type {Object.<string, boolean>} */
Expand All @@ -32,7 +34,7 @@ export const getters = {

// chainik icon
if (coinIcon) {
return coinIcon;
return `${EXPLORER_STATIC_HOST}/coins/${state.coinMap[coinSymbol].id}.png`;
}

// archived coins
Expand Down Expand Up @@ -66,9 +68,11 @@ export const mutations = {
state.status = statusData;
},
SET_COIN_LIST(state, data) {
let coinMap = {};
let coinIconMap = {};
let coinVerifiedMap = {};
data.forEach((coin) => {
coinMap[coin.symbol] = coin;
if (coin.icon) {
coinIconMap[coin.symbol] = coin.icon;
}
Expand All @@ -78,6 +82,7 @@ export const mutations = {
});

state.coinList = Object.freeze(data);
state.coinMap = Object.freeze(coinMap);
state.coinIconMap = Object.freeze(coinIconMap);
state.coinVerifiedMap = Object.freeze(coinVerifiedMap);
},
Expand Down

0 comments on commit 3ecf767

Please sign in to comment.