dex-skills v0.1.0

TypeScript SDK

The primary way to use dex-skills is as a TypeScript library. This page covers installation, import paths, initialization patterns, and build configuration.

Installation

Terminal
npm install dex-skills

Initialization

Using createSkills() and getSkill()

The recommended approach. createSkills() returns a registry of all available platform skills. Use getSkill() to invoke a specific operation by name.

using-registry.ts
import { createSkills, getSkill } from "dex-skills";

const skills = createSkills({
  wallets: {
    solana: {
      privateKey: process.env.SOLANA_PRIVATE_KEY,
      rpcUrl: "https://api.mainnet-beta.solana.com",
    },
  },
});

// Query token info
const pumpfun = getSkill(skills, "pumpfun");
const info = await pumpfun.getTokenInfo("So11111111111111111111111111111111111111112");

// Launch a token
const letsbonk = getSkill(skills, "letsbonk");
const result = await letsbonk.launch({
  name: "Example",
  symbol: "EX",
  imageUrl: "https://example.com/logo.png",
  initialBuyAmount: "0.1",
});

Direct class instantiation

If you only need a single platform, you can import and instantiate its skill class directly. This avoids loading all platforms into memory.

direct-instantiation.ts
import { PumpFunSkill } from "dex-skills/platforms/pumpfun";

const pumpfun = new PumpFunSkill({
  privateKey: process.env.SOLANA_PRIVATE_KEY,
  rpcUrl: "https://api.mainnet-beta.solana.com",
});

const result = await pumpfun.launch({
  name: "My Token",
  symbol: "MTK",
});

const info = await pumpfun.getTokenInfo("So11111111111111111111111111111111111111112");
const tokens = await pumpfun.listTokens({ limit: 10 });

Import Paths

imports.ts
// Main entry point -- registry helpers and all types
import { createSkills, getSkill } from "dex-skills";

// Types only
import type {
  Platform,
  Chain,
  LaunchParams,
  LaunchResult,
  TokenInfo,
  ListTokensParams,
  PlatformSkill,
  WalletConfig,
} from "dex-skills";

// Individual platform classes
import { PumpFunSkill } from "dex-skills/platforms/pumpfun";
import { LetsBonkSkill } from "dex-skills/platforms/letsbonk";
import { MoonshotSkill } from "dex-skills/platforms/moonshot";
import { ZoraSkill } from "dex-skills/platforms/zora";
import { ClankerSkill } from "dex-skills/platforms/clanker";
import { FourMemeSkill } from "dex-skills/platforms/fourmeme";
import { SunPumpSkill } from "dex-skills/platforms/sunpump";

// Tool definitions (for function calling integrations)
import { toolDefinitions } from "dex-skills";

// OpenAPI spec
import { openApiSpec } from "dex-skills";

Build Configuration

dex-skills is published as ESM with TypeScript declaration files. Your tsconfig.json should use the following settings at minimum:

tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "strict": true,
    "resolveJsonModule": true,
    "declaration": true
  }
}
Node.js version
dex-skills requires Node.js 18 or later. The SDK uses top-level await and other ES2022+ features internally.

Environment Variables

Platform skills read RPC endpoint URLs from environment variables when no explicit rpcUrl is provided in the wallet config:

.env
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
BASE_RPC_URL=https://mainnet.base.org
BNB_RPC_URL=https://bsc-dataseed.binance.org
TRON_RPC_URL=https://api.trongrid.io