diff --git a/wormhole-connect/src/config/index.ts b/wormhole-connect/src/config/index.ts index b8e1f162b..e7cbed0c4 100644 --- a/wormhole-connect/src/config/index.ts +++ b/wormhole-connect/src/config/index.ts @@ -119,7 +119,7 @@ export function buildConfig( ], Devnet: ['http://localhost:7071'], }[network], - coinGeckoApiKey: customConfig.coinGeckoApiKey, + coingecko: customConfig.coingecko, // Callbacks triggerEvent: wrapEventHandler(customConfig.eventHandler), diff --git a/wormhole-connect/src/config/types.ts b/wormhole-connect/src/config/types.ts index 41667e686..00afe4f26 100644 --- a/wormhole-connect/src/config/types.ts +++ b/wormhole-connect/src/config/types.ts @@ -94,7 +94,10 @@ export interface WormholeConnectConfig { // External resources rpcs?: ChainResourceMap; - coinGeckoApiKey?: string; + coingecko?: { + apiKey?: string; + customUrl?: string; + }; // White lists chains?: Chain[]; @@ -137,7 +140,10 @@ export interface InternalConfig { mayanApi: string; wormholeApi: string; wormholeRpcHosts: string[]; - coinGeckoApiKey?: string; + coingecko?: { + apiKey?: string; + customUrl?: string; + }; tokens: TokenCache; tokenWhitelist?: (string | TokenTuple)[]; diff --git a/wormhole-connect/src/utils/coingecko.ts b/wormhole-connect/src/utils/coingecko.ts index 145870034..96eddff4f 100644 --- a/wormhole-connect/src/utils/coingecko.ts +++ b/wormhole-connect/src/utils/coingecko.ts @@ -45,12 +45,16 @@ const coingeckoRequest = async ( ): Promise => { const headers = new Headers({ 'Content-Type': 'application/json', - ...(config.coinGeckoApiKey - ? { 'x-cg-pro-api-key': config.coinGeckoApiKey } + ...(config.coingecko?.apiKey + ? { 'x-cg-pro-api-key': config.coingecko.apiKey } : {}), }); - const hostname = config.coinGeckoApiKey ? COINGECKO_URL_PRO : COINGECKO_URL; + const hostname = config.coingecko?.customUrl + ? config.coingecko.customUrl + : config.coingecko?.apiKey + ? COINGECKO_URL_PRO + : COINGECKO_URL; return fetch(`${hostname}${path}`, { signal: params?.abort?.signal,