Market Data

The dex resource provides access to DexScreener market data.

Trending Pairs

const trending = await wallet.dex.trending({
  chain: 'solana',
  limit: 10,
});
 
for (const pair of trending.pairs) {
  console.log(`${pair.baseToken.symbol}/${pair.quoteToken.symbol}`);
  console.log(`  Price: $${pair.priceUsd}`);
  console.log(`  24h Volume: $${pair.volume24h}`);
  console.log(`  24h Change: ${pair.priceChange24h}%`);
}

Market Movers

// Top gainers
const gainers = await wallet.dex.gainers({ chain: 'solana', limit: 10 });
 
// Top losers
const losers = await wallet.dex.losers({ chain: 'solana', limit: 10 });
 
// Highest volume
const volume = await wallet.dex.volume({ chain: 'solana', limit: 10 });
 
// New pairs
const newPairs = await wallet.dex.new({ chain: 'solana', limit: 10 });

Custom Queries

Search with specific filters:

const results = await wallet.dex.query({
  query: 'meme',
  chain: 'solana',
  filters: {
    minLiquidity: 10000,
    minVolume: 50000,
    priceChange24h: { min: 0 }, // Only gainers
  },
});

Token Search

Search for specific tokens:

const tokens = await wallet.tokens.search({
  query: 'bonk',
  chain: 'solana',
});
 
for (const token of tokens.tokens) {
  console.log(`${token.name} (${token.symbol})`);
  console.log(`  Address: ${token.address}`);
  console.log(`  Safety score: ${token.safety.score}`);
  console.log(`  Verified: ${token.safety.verified}`);
}

Pump.fun Tokens

Get Pump.fun specific data:

const pumpfun = await wallet.dex.pumpfun({ limit: 20 });
 
for (const token of pumpfun.tokens) {
  console.log(`${token.name}: ${token.marketCap}`);
}

Pair Details

Get detailed info for a specific pair:

const pair = await wallet.dex.getPair({
  chain: 'solana',
  pairAddress: 'pair_address_here',
});
 
console.log('Base token:', pair.baseToken.symbol);
console.log('Quote token:', pair.quoteToken.symbol);
console.log('Liquidity:', pair.liquidity);
console.log('Created:', pair.createdAt);

Type Definitions

interface DexPair {
  pairAddress: string;
  baseToken: TokenInfo;
  quoteToken: TokenInfo;
  priceUsd: string;
  priceNative: string;
  volume24h: string;
  liquidity: string;
  priceChange24h: number;
  priceChange1h: number;
  txCount24h: number;
}
 
interface TokenInfo {
  address: string;
  name: string;
  symbol: string;
}
 
interface TokenSafety {
  score: number;
  flags: string[];
  verified: boolean;
}