Skip to content

Latest commit

 

History

History
100 lines (76 loc) · 2.72 KB

File metadata and controls

100 lines (76 loc) · 2.72 KB

PumpSwap SDK

Lightweight SDK for trading PumpSwap coins (Pump.fun migrated coins) with optional low-latency transaction landing for HFT/algo/sniping workflows.

Highlights

Low-Latency / HFT / Sniping / Copy trading Integration

This SDK can route signed transactions to one or more landing providers in parallel for faster inclusion.

Operational notes:

  • Providers often require API keys and may expose health endpoints or WebSockets for tip data.
  • For best latency, deploy close to your selected providers and use HTTP keep-alive every 60s.

Best Practices

  • Warm up connections (health pings) before burst submissions.
  • Use fresh recent blockhashes and avoid reusing expired ones.
  • Prefer parallel submission for time-sensitive trades.
  • Monitor provider responses and adjust routing in real time.

Getting Started

  1. Install
npm i
  1. Configure
  • Copy .env.copy to .env
  • Fill in required keys:
    • Private key (base58 or JSON array depending on your setup)
    • RPC (Helius or any performant mainnet endpoint)
    • Any provider API keys you plan to use (Jito/Nozomi/0slot/etc.)
  1. Build/Run
  • Use the examples below in your own script or integrate the SDK in your app.

Usage

Buy / Sell on PumpSwap

import { PublicKey } from '@solana/web3.js';
import { wallet_1 } from './constants';
import { PumpSwapSDK } from './pumpswap';

async function main() {
  const mint = 'your-pumpfun-token-address';
  const solAmt = 0.99; // buy ~1 SOL worth using WSOL
  const sellPercentage = 0.5; // sell 50%

  const sdk = new PumpSwapSDK();
  await sdk.buy(new PublicKey(mint), wallet_1.publicKey, solAmt);
  await sdk.sell_percentage(new PublicKey(mint), wallet_1.publicKey, sellPercentage);
  await sdk.sell_exactAmount(new PublicKey(mint), wallet_1.publicKey, 1000); // sell exact tokens
}

Fetch Price

import { PublicKey } from '@solana/web3.js';
import { getPrice } from './pool';

async function main() {
  const mint = new PublicKey('your-pumpfun-token-address');
  console.log(await getPrice(mint));
}

Fetch Pool

import { PublicKey } from '@solana/web3.js';
import { getPumpSwapPool } from './pool';

async function main() {
  const mint = new PublicKey('your-pumpfun-token-address');
  console.log(await getPumpSwapPool(mint));
}

Community

Credits