Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

swap

БесплатноЗапускает вложенные скриптыНе проверен

Buy and sell tokens on pump.fun bonding curve and pump swap AMM pool, and query SOL/token balances. Prefer runnable Node scripts in this skill folder; use…

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

Before Starting Work Critical - Ask these from user

MANDATORY — Do NOT write or modify any code until every item below is answered by the user:

  • RPC URL provided or a fallback agreed upon (for any on-chain or tx-building step)
  • Signer wallet public key (fee payer / user)
  • Framework confirmed (Next.js, Express, CLI scripts only, other)
  • Operation type confirmed (buy or sell)
  • Coin mint address provided
  • Amount confirmed (SOL lamports for buy; token smallest units for sell)
  • Front-runner protection desired? If yes, confirm tip amount (default 0.0001 SOL). Transactions will be sent only to Jito block engine endpoints.

You MUST ask the user for ALL unchecked items in your very first response. Do not assume defaults. Do not proceed until the user has explicitly answered each one.

API (preferred) — https://fun-block.pump.fun

Use the API to build swap transactions instead of running scripts directly. The API automatically determines coin state (bonding curve vs AMM) and builds the correct transaction.

POST /agents/swap

Builds a buy or sell transaction. Set inputMint to So11111111111111111111111111111111111111112 (NATIVE_MINT) for buys, or set outputMint to NATIVE_MINT for sells.

Request body:

{
  "inputMint": "So11111111111111111111111111111111111111112",
  "outputMint": "<TOKEN_MINT>",
  "amount": "1000000",
  "user": "<PUBKEY>",
  "slippagePct": 2,
  "feePayer": "<PUBKEY>",
  "frontRunningProtection": false,
  "tipAmount": 0,
  "encoding": "base64"
}

Only inputMint, outputMint, amount, and user are required. All other fields have defaults.

tipAmount is a Jito tip in SOL (e.g. 0.0001 for 100,000 lamports). Only relevant when frontRunningProtection is true.

Encoding: The API defaults to "base58" encoding. Always pass "encoding": "base64" in the request body — scripts already output base64. When sending the signed transaction to an RPC or Jito endpoint, the encoding used to serialize the transaction must match the encoding parameter passed in the send call. Mismatched encodings will cause transaction failures. Always explicitly pass encoding: "base64" in sendTransaction / simulateTransaction RPC calls — never rely on the RPC's default.

  • Buy: inputMint = NATIVE_MINT, outputMint = token mint, amount = SOL in lamports
  • Sell: inputMint = token mint, outputMint = NATIVE_MINT, amount = token amount (6 decimals)

Response:

{
  "transaction": "<base64-encoded VersionedTransaction>",
  "pumpMintInfo": { "hasGraduated": false, "expectedOutAmount": "123456", "..." : "..." }
}

Deserialize the transaction, have the user wallet sign, and submit to chain.

Runnable examples (Node scripts — only when user explicitly requests)

Use {baseDir} as the path to this skill folder (OpenClaw and Agent Skills clients often expose this placeholder).

cd {baseDir}
npm install
export SOLANA_RPC_URL=https://rpc.solanatracker.io/public
Operation Script Example
Fetch coin state (HTTP) scripts/fetch-coin.mjs node scripts/fetch-coin.mjs --mint <MINT> --subset
Buy (bonding curve) scripts/build-buy-bonding-tx.mjs node scripts/build-buy-bonding-tx.mjs --mint <MINT> --user <PUBKEY> --amount 1000000
Sell (bonding curve) scripts/build-sell-bonding-tx.mjs node scripts/build-sell-bonding-tx.mjs --mint <MINT> --user <PUBKEY> --amount 1000000
Buy (AMM) scripts/build-buy-amm-tx.mjs node scripts/build-buy-amm-tx.mjs --mint <MINT> --user <PUBKEY> --amount 1000000
Sell (AMM) scripts/build-sell-amm-tx.mjs node scripts/build-sell-amm-tx.mjs --mint <MINT> --user <PUBKEY> --amount 1000000
Balances scripts/print-balances.mjs node scripts/print-balances.mjs --wallet <PUBKEY> --mint <MINT>
  • Run any script with --help for full flags (--slippage, --compute-units, --priority-micro-lamports, --front-runner-protection, --tip-sol, --pool vs --mint for AMM, etc.).
  • Tx builders print one JSON object on stdout with transaction (base64-encoded VersionedTransaction). Never pass end-user private keys into these scripts.
  • OpenClaw: If YAML metadata ever fails to parse, collapse metadata to a single-line JSON object per OpenClaw skills; optional metadata.openclaw.requires.env: ["SOLANA_RPC_URL"] can gate load-time eligibility.

Safety Rules

  • NEVER log, print, or return private keys or secret key material.
  • NEVER sign transactions on behalf of a user — scripts build txs; the user (or their wallet) co-signs and sends.
  • Always validate that amounts are > 0 before building instructions.
  • Use the correct decimal precision: 9 decimals for SOL (1 SOL = 1,000,000,000 lamports), 6 decimals for pump tokens.
  • Always check the coin state (bonding curve vs AMM pool) before
Полный SKILL.md на GitHub

Установить swap в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.gitignoreSOURCE.mdTRUST.auto.yamlpackage.jsonpnpm-lock.yamlpnpm-workspace.yamlscripts/build-buy-amm-tx.mjsscripts/build-buy-bonding-tx.mjsscripts/build-sell-amm-tx.mjsscripts/build-sell-bonding-tx.mjsscripts/fetch-coin.mjsscripts/lib/args.mjsscripts/lib/coin-api.mjsscripts/lib/coin-resolve.mjsscripts/lib/compute.mjsscripts/lib/constants.mjsscripts/lib/env.mjsscripts/lib/jito.mjsscripts/lib/tx-build.mjsscripts/print-balances.mjs

FAQ

Что делает скилл swap?

Buy and sell tokens on pump.fun bonding curve and pump swap AMM pool, and query SOL/token balances. Prefer runnable Node scripts in this skill folder; use @pump-fun/pump-sdk and @pump-fun/pump-swap-sdk for custom integrations.

Как установить скилл swap?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл swap запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить swap с