GeckoTerminal API client Provides methods to interact with GeckoTerminal's API endpoints

This is the main class for interacting with the GeckoTerminal API. It provides typed methods for all API endpoints and handles authentication and request formatting.

const client = new GeckoTerminal();

// Get all networks
const networks = await client.getNetworks();

// Get DEXes for Conflux network
const dexes = await client.getNetworkDexes('cfx');

Hierarchy (View Summary)

Constructors

  • Creates a new GeckoTerminal API client

    Parameters

    • network: string = "cfx"

      Network identifier (defaults to cfx)

    • OptionalapiKey: string

      Optional API key for authenticated requests

    • OptionalcustomBaseUrl: string

      Optional custom base URL for the API

    Returns GeckoTerminal

Methods

  • Get information about multiple pools

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • poolAddresses: string[]

      Array of pool addresses

    Returns Promise<MultiPoolResponse>

    Promise with information about multiple pools

    const pools = await client.getMultiPoolInfo('cfx', ['0x123...', '0x456...']);
    console.log(pools.data.map(p => p.attributes.name));
  • Get information about multiple tokens

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • tokenAddresses: string[]

      Array of token addresses (max 30)

    Returns Promise<MultiTokenResponse>

    Promise with information about multiple tokens

    Error if more than 30 token addresses are provided

    const tokens = await client.getMultiTokenInfo('cfx', ['0x123...', '0x456...']);
    console.log(tokens.data.map(t => t.attributes.symbol));
  • Get all DEXes for a specific network

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<NetworkDexesResponse>

    Promise with array of DEXes and pagination metadata

    const dexes = await client.getNetworkDexes('cfx');
    console.log(dexes.data[0].attributes.name);
  • Get all networks supported by GeckoTerminal

    Parameters

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<NetworksResponse>

    Promise with array of networks and pagination metadata

    const networks = await client.getNetworks(1);
    console.log(networks.data[0].attributes.name);
  • Get new pools for a specific network

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<PoolsResponse>

    Promise with array of new pools and pagination metadata

    const newPools = await client.getNewPools('cfx');
    console.log(newPools.data[0].attributes.pool_created_at);
  • Get information about a specific pool

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • poolAddress: string

      Address of the pool

    Returns Promise<MultiPoolResponse>

    Promise with detailed pool information

    const pool = await client.getPoolInfo('cfx', '0x123...');
    console.log(pool.data[0].attributes.reserve_in_usd);
  • Get OHLCV data for a specific pool

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • poolAddress: string

      Address of the pool

    • timeframe: "minute" | "hour" | "day"

      Timeframe for OHLCV data

    • params: {
          aggregate?: string;
          before_timestamp?: string;
          currency?: "usd" | "token";
          limit?: string;
          token?: string;
      } = {}

      Additional parameters for the request

    Returns Promise<OHLCVResponse>

    Promise with OHLCV data

    const ohlcv = await client.getPoolOHLCV('cfx', '0x123...', 'hour', { limit: '24' });
    console.log(ohlcv.data.attributes.map(d => d.close));
  • Get token info for pool tokens

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • poolAddress: string

      Address of the pool

    Returns Promise<TokenInfoMetadataResponse[]>

    Promise with detailed token information

    const info = await client.getPoolTokensMetadata('cfx', '0x123...');
    console.log(info[0].attributes.name);
  • Get trades for a specific pool

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • poolAddress: string

      Address of the pool

    • OptionalminVolumeUsd: number

      Minimum trade volume in USD

    Returns Promise<TradesResponse>

    Promise with pool trades

    const trades = await client.getPoolTrades('cfx', '0x123...', 1000);
    console.log(trades.data[0].attributes.volume_in_usd);
  • Get information about tokens that were recently updated

    Parameters

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<TokenInfoMetadataResponse[]>

    Promise with array of recently updated token information

    const recentTokens = await client.getRecentlyUpdatedTokenInfo();
    console.log(recentTokens[0].data.attributes.name);
  • Get simple token prices

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • addresses: string[]

      Array of token addresses (max 30)

    • include_24hr_vol: boolean = false

      Whether to include 24h volume

    • include_market_cap: boolean = false

      Whether to include market cap

    Returns Promise<SimpleTokenPriceResponse>

    Promise with token prices

    Error if more than 30 addresses are provided

    const prices = await client.getSimpleTokenPrices('cfx', ['0x123...'], true, true);
    console.log(prices.data['0x123...'].price_usd);
  • Get information about a specific token

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • tokenAddress: string

      Address of the token

    Returns Promise<TokenInfo>

    Promise with token information

    const token = await client.getTokenInfo('cfx', '0x123...');
    console.log(token.data.attributes.symbol);
  • Get pools for a specific token

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • tokenAddress: string

      Address of the token

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<PoolsResponse>

    Promise with token pools

    const pools = await client.getTokenPools('cfx', '0x123...');
    console.log(pools.data.map(p => p.attributes.name));
  • Get token info for pool tokens

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • tokenAddress: string

      Address of the token

    Returns Promise<TokenInfoMetadataResponse>

    Promise with detailed token information

    const info = await client.getTokensMetadata('cfx', '0x123...');
    console.log(info[0].attributes.name);
  • Get top pools for a specific network and DEX

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • dex: string = ...

      DEX identifier (defaults to DEFAULT_DEX)

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<PoolsResponse>

    Promise with array of pools and pagination metadata

    const pools = await client.getTopPools('cfx', 'swappi');
    console.log(pools.data[0].attributes.name);
  • Get trending pools for a specific network

    Parameters

    • network: string = ...

      Network identifier (defaults to constructor network)

    • duration: "5m" | "1h" | "6h" | "24h" = "24h"

      Time duration for trending calculation

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<TrendingPoolsResponse>

    Promise with array of trending pools and pagination metadata

    const trending = await client.getTrendingPools('cfx', '24h');
    console.log(trending.data[0].attributes.volume_usd.h24);
  • Search for pools

    Parameters

    • query: string

      Search query (pool address, token address, or token symbol)

    • Optionalnetwork: string

      Network identifier (optional)

    • page: number = 1

      Page number for pagination (starts at 1)

    Returns Promise<PoolsResponse>

    Promise with search results

    const results = await client.searchPools('WETH', 'cfx');
    console.log(results.data.map(p => p.attributes.name));