Why Direct Trading?
When a token launches on Pump.fun, it trades on a bonding curve before graduating to Raydium. During this phase, Jupiter can't route to it. You need to interact with the bonding curve directly.
The Bonding Curve
Pump.fun uses a constant product bonding curve. The price increases as more tokens are bought.
price = virtualSolReserves / virtualTokenReserves
Direct Buy Implementation
const { Connection, PublicKey, Transaction } = require('@solana/web3.js');
async function buyOnPumpFun(mintAddress, amountSOL, wallet) {
const conn = new Connection('https://api.mainnet-beta.solana.com');
// Fetch bonding curve data
const bondingCurve = await getBondingCurveAccount(mintAddress);
// Calculate tokens received
const tokensOut = calculateTokensOut(
amountSOL,
bondingCurve.virtualSolReserves,
bondingCurve.virtualTokenReserves
);
// Apply slippage (e.g., 5%)
const minTokens = tokensOut * 0.95;
// Build transaction with Pump.fun program instruction
const tx = new Transaction();
tx.add(createBuyInstruction({
mint: new PublicKey(mintAddress),
bondingCurve: bondingCurve.address,
amount: amountSOL * 1e9, // lamports
minTokens,
wallet: wallet.publicKey,
}));
// Send via Jito for MEV protection
await sendWithJito(tx, wallet);
}
When to Use Direct vs Jupiter
| Scenario | Use |
|---|---|
| Token on bonding curve (not graduated) | Direct Pump.fun |
| Token graduated to Raydium | Jupiter V6 |
| Any token on a DEX | Jupiter V6 |
Ready-Made Solution
My trading bot handles both automatically — detects if a token is on the bonding curve or graduated, then routes accordingly.
Top comments (0)