markets
This module provides market configuration data for the GMX protocol across different blockchain networks. It contains predefined market configurations including token addresses and swap limits for trading pairs on supported chains.
Constants
SWAP_GRAPH_MAX_MARKETS_PER_TOKEN: number- Maximum number of markets per token for swap graph calculations (value: 5)
import { SWAP_GRAPH_MAX_MARKETS_PER_TOKEN } from "@gmx-ui/sdk/configs/markets";
console.log(SWAP_GRAPH_MAX_MARKETS_PER_TOKEN); // 5
MARKETS: Record<ContractsChainId, Record<string, MarketConfig>>- Complete market configuration mapping for all supported chains
import { MARKETS, ARBITRUM } from "@gmx-ui/sdk/configs/markets";
// Get all markets for Arbitrum
const arbitrumMarkets = MARKETS[ARBITRUM];
// Get specific market configuration
const btcUsdMarket = MARKETS[ARBITRUM]["0x47c031236e19d024b42f8AE6780E44A573170703"];
console.log(btcUsdMarket.indexTokenAddress); // BTC index token address
Methods
getMarketByLabel
getMarketByLabel(chainId, label): MarketConfig
Parameters
chainId: ContractsChainId- The blockchain network identifierlabel: MarketLabel- Market label in format "SYMBOL/USD [LONG-SHORT]"
Retrieves a market configuration by its human-readable label format.
import { getMarketByLabel, ARBITRUM } from "@gmx-ui/sdk/configs/markets";
const market = getMarketByLabel(ARBITRUM, "BTC/USD [WBTC.e-USDC]");
console.log(market.marketTokenAddress); // Market token contract address
fixTokenSymbolFromMarketLabel
fixTokenSymbolFromMarketLabel(chainId, symbol): string
Parameters
chainId: ContractsChainId- The blockchain network identifiersymbol: string- Token symbol to normalize
Normalizes token symbols from market labels to match the token configuration format.
import { fixTokenSymbolFromMarketLabel, ARBITRUM } from "@gmx-ui/sdk/configs/markets";
const normalizedSymbol = fixTokenSymbolFromMarketLabel(ARBITRUM, "WBTC");
console.log(normalizedSymbol); // "BTC"
Types
MarketConfig
Represents the configuration for a single market.
Properties:
marketTokenAddress: string- Address of the market token contractindexTokenAddress: string- Address of the index token (underlying asset)longTokenAddress: string- Address of the long token for the marketshortTokenAddress: string- Address of the short token for the market
Usage:
import { MarketConfig, MARKETS, ARBITRUM } from "@gmx-ui/sdk/configs/markets";
const marketConfig: MarketConfig = MARKETS[ARBITRUM]["0x47c031236e19d024b42f8AE6780E44A573170703"];
console.log({
market: marketConfig.marketTokenAddress,
index: marketConfig.indexTokenAddress,
long: marketConfig.longTokenAddress,
short: marketConfig.shortTokenAddress
});
MarketLabel
Represents a market label string in the format "SYMBOL/USD [LONG-SHORT]".
Usage:
import { MarketLabel, getMarketByLabel, ARBITRUM } from "@gmx-ui/sdk/configs/markets";
const label: MarketLabel = "BTC/USD [WBTC.e-USDC]";
const market = getMarketByLabel(ARBITRUM, label);