dex-skills v0.1.0

listTokens()

Retrieve a list of tokens from a supported platform. Results can be sorted by various criteria and paginated using a limit. This is a read-only operation that does not require a private key.

Signature

// Get a platform skill, then call listTokens() with optional params
const skill = getSkill(skills, "pumpfun");
const tokens: TokenInfo[] = await skill.listTokens({ limit: 20, sortBy: "createdAt", sortOrder: "desc" });

Parameters

Parameter Type Description
limit number Maximum number of tokens to return. Default: 20
sortBy string Field to sort results by. One of: marketCap, createdAt, volume, price. Default: createdAt
sortOrder string Sort direction. Either "asc" (ascending) or "desc" (descending). Default: desc

Return Value

Returns a Promise<TokenInfo[]> -- an array of TokenInfo objects. See the getTokenInfo() reference for the full TokenInfo type definition.

Example

list-tokens.ts
import { createSkills, getSkill } from "dex-skills";

const skills = createSkills({
  wallets: {
    solana: {
      privateKey: "your-base58-private-key",
      rpcUrl: "https://api.mainnet-beta.solana.com",
    },
    base: {
      privateKey: "0x...",
      rpcUrl: "https://mainnet.base.org",
    },
  },
});

// List the 10 most recently created tokens on Pump.fun
const pumpfun = getSkill(skills, "pumpfun");
const recent = await pumpfun.listTokens({
  limit: 10,
  sortBy: "createdAt",
  sortOrder: "desc",
});

for (const token of recent) {
  console.log(`${token.symbol} — ${token.name} (${token.tokenAddress})`);
}

// List top tokens by market cap on Zora
const zora = getSkill(skills, "zora");
const topTokens = await zora.listTokens({
  limit: 5,
  sortBy: "marketCap",
  sortOrder: "desc",
});

console.log("Top Zora tokens by market cap:");
for (const token of topTokens) {
  console.log(`  ${token.symbol}: $${token.marketCap}`);
}
Sorting availability
Not all sort fields are available on every platform. If a platform does not support the requested sortBy field, results fall back to the default sort order (createdAt desc).