Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom coingecko url #3275

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions wormhole-connect/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export function buildConfig(
Devnet: ['http://localhost:7071'],
}[network],
coinGeckoApiKey: customConfig.coinGeckoApiKey,
coinGeckoCustomUrl: customConfig.coinGeckoCustomUrl,

// Callbacks
triggerEvent: wrapEventHandler(customConfig.eventHandler),
Expand Down
2 changes: 2 additions & 0 deletions wormhole-connect/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export interface WormholeConnectConfig {
// External resources
rpcs?: ChainResourceMap;
coinGeckoApiKey?: string;
coinGeckoCustomUrl?: string;

// White lists
chains?: Chain[];
Expand Down Expand Up @@ -138,6 +139,7 @@ export interface InternalConfig<N extends Network> {
wormholeApi: string;
wormholeRpcHosts: string[];
coinGeckoApiKey?: string;
coinGeckoCustomUrl?: string;

tokens: TokenCache;
tokenWhitelist?: (string | TokenTuple)[];
Expand Down
6 changes: 5 additions & 1 deletion wormhole-connect/src/utils/coingecko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ const coingeckoRequest = async (
: {}),
});

const hostname = config.coinGeckoApiKey ? COINGECKO_URL_PRO : COINGECKO_URL;
const hostname = config.coinGeckoCustomUrl
? config.coinGeckoCustomUrl
: config.coinGeckoApiKey
? COINGECKO_URL_PRO
: COINGECKO_URL;

return fetch(`${hostname}${path}`, {
signal: params?.abort?.signal,
Expand Down
Loading