Skip to content

Commit 22cac09

Browse files
committed
move two more eval-time consts
1 parent 0a27ad1 commit 22cac09

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

wormhole-connect/src/hooks/useExternalSearch.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import { coalesceChainName } from '@certusone/wormhole-sdk';
33
import config from 'config';
44
import { useEffect, useState } from 'react';
55

6-
const VALID_CHAINS = config.chainsArr
7-
.filter((chain) => chain.key !== 'wormchain')
8-
.map((chain) => chain.key);
9-
106
type ExternalSearch = {
117
hasExternalSearch: boolean;
128
txHash?: string;
@@ -25,7 +21,12 @@ export function useExternalSearch(): ExternalSearch {
2521
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2622
config.searchTx.chainName as any,
2723
) as ChainName;
28-
if (VALID_CHAINS.includes(chainName)) {
24+
25+
const validChains = config.chainsArr
26+
.filter((chain) => chain.key !== 'wormchain')
27+
.map((chain) => chain.key);
28+
29+
if (validChains.includes(chainName)) {
2930
setHasExternalSearchtate(true);
3031
setTxHash(config.searchTx.txHash);
3132
setChainName(chainName);

wormhole-connect/src/hooks/useFetchTokenPrices.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ const PRICES_FETCH_INTERVAL = 60000 * 5; // 5 mins
88
const COINGECKO_URL = 'https://api.coingecko.com/';
99
const COINGECKO_URL_PRO = 'https://pro-api.coingecko.com/';
1010

11-
const COINGECKO_IDS = Object.values(config.tokens)
12-
.filter((config) => !!config.coinGeckoId)
13-
.map(({ coinGeckoId }) => coinGeckoId)
14-
.join(',');
15-
1611
export const useFetchTokenPrices = (): void => {
1712
const dispatch = useDispatch();
1813
useEffect(() => {
1914
let cancelled = false;
2015
const controller = new AbortController();
2116
const signal = controller.signal;
17+
18+
const coingeckoIds = Object.values(config.tokens)
19+
.filter((config) => !!config.coinGeckoId)
20+
.map(({ coinGeckoId }) => coinGeckoId)
21+
.join(',');
22+
2223
const headers = new Headers({
2324
'Content-Type': 'application/json',
2425
...(config.coinGeckoApiKey
@@ -33,7 +34,7 @@ export const useFetchTokenPrices = (): void => {
3334
const res = await fetch(
3435
`${
3536
!config.coinGeckoApiKey ? COINGECKO_URL : COINGECKO_URL_PRO
36-
}api/v3/simple/price?ids=${COINGECKO_IDS}&vs_currencies=usd${
37+
}api/v3/simple/price?ids=${coingeckoIds}&vs_currencies=usd${
3738
!config.coinGeckoApiKey
3839
? ''
3940
: `?x_cg_pro_api_key=${config.coinGeckoApiKey}`

0 commit comments

Comments
 (0)