dex-skills v0.1.0

sell()

Sell tokens on a supported platform. Specify the token address, the amount of tokens to sell, and an optional slippage tolerance. This method requires a configured wallet with a private key.

Signature

const skill = getSkill(skills, "pumpfun");
const result: TradeResult = await skill.sell({
  tokenAddress: "TokenMintAddress...",
  amount: "1000000",
  slippage: 10,
});

Parameters

Parameter Type Description
tokenAddress * string The address of the token to sell.
amount * string Amount of tokens to sell (in token units).
slippage number Slippage tolerance as a percentage (e.g. 10 for 10%). Platform default if omitted.

Return Value

Returns a Promise<TradeResult>. See the Types reference for the full TradeResult definition.

Platform Support

Platform Supported
Pump.fun Yes
LetsBonk Yes
Moonshot Yes
Zora Yes
Clanker Yes
Four.meme Yes
SunPump Yes

Example

sell-token.ts
import { createSkills, getSkill } from "dex-skills";

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

// Sell tokens on Pump.fun
const pumpfun = getSkill(skills, "pumpfun");
const result = await pumpfun.sell({
  tokenAddress: "TokenMintAddress...",
  amount: "1000000",
  slippage: 10,
});

console.log("Platform:", result.platform);
console.log("Tx Hash:", result.txHash);
console.log("Action:", result.action);
console.log("Native Amount Received:", result.nativeAmount);
Private key required
The sell() method submits an on-chain transaction and requires a wallet with a private key configured for the target platform's chain.
Token amount
The amount parameter represents the number of tokens to sell, not the native currency value. Ensure you have sufficient token balance in your wallet before calling sell().