The Pump.fun module provides comprehensive integration with the Pump.fun platform and PumpSwap AMM, enabling users to launch meme tokens, trade on bonding curves, and participate in automated market making.
Core Functionalities
Token Launching Create and launch new tokens on Pump.fun with metadata upload, social links, and initial liquidity
Bonding Curve Trading Buy and sell tokens using Pump.funโs bonding curve mechanism with automatic Raydium migration
AMM Operations Full PumpSwap AMM integration with swapping, liquidity management, and pool creation
RugCheck Integration Automatic token verification submission to RugCheck for community safety
Installation & Setup
Backend Configuration
Ensure your backend server is running for metadata uploads and PumpSwap SDK: SERVER_URL = http://localhost:8080/api
Environment Variables
Configure required environment variables in .env.local
: SERVER_URL = your_backend_server_url
HELIUS_STAKED_URL = your_helius_rpc_endpoint
COMMISSION_WALLET = your_commission_wallet_address
Import Module
Import the components and services you need: import {
PumpfunLaunchSection ,
PumpfunBuySection ,
PumpSwapScreen ,
usePumpFun
} from '@/modules/pump-fun' ;
Backend Dependency : This module requires a backend service for metadata uploads and PumpSwap SDK interactions. Ensure proper server configuration.
Module Architecture
src/modules/pump-fun/
โโโ components/ # UI components for both platforms
โ โโโ pump-swap/ # PumpSwap AMM specific components
โ โโโ PumpfunBuySection.tsx
โ โโโ PumpfunLaunchSection.tsx
โ โโโ PumpfunSellSection.tsx
โโโ hooks/ # React hooks for interactions
โโโ navigation/ # PumpSwap navigation setup
โโโ screens/ # Complete screen implementations
โโโ services/ # API integration and business logic
โโโ types/ # TypeScript definitions
โโโ utils/ # Helper functions and utilities
Core Components
Token Launch Token Trading PumpSwap AMM Individual AMM Components PumpfunLaunchSection
- Complete token creation interfaceimport { PumpfunLaunchSection } from '@/modules/pump-fun' ;
function TokenLaunchScreen () {
const handleTokenLaunched = ( tokenData ) => {
console . log ( 'Token launched:' , tokenData );
// Handle success (navigation, notifications, etc.)
};
return (
< PumpfunLaunchSection
onTokenLaunched = { handleTokenLaunched }
containerStyle = {styles. launchContainer }
enableSocialLinks = { true }
enableRugCheckSubmission = { true }
/>
);
}
Features:
Token metadata input (name, symbol, description)
Image upload and processing
Social media links integration
Initial buy amount configuration
Automatic metadata upload to IPFS
RugCheck verification submission
Core Hook: usePumpFun
The primary hook for Pump.fun interactions:
import { usePumpFun } from '@/modules/pump-fun' ;
import { useWallet } from '@/modules/wallet-providers' ;
function PumpfunTradingComponent () {
const { wallet } = useWallet ();
const {
launchToken ,
buyToken ,
sellToken ,
submitTokenForVerification ,
loading ,
error
} = usePumpFun ();
const handleLaunchToken = async ( tokenData ) => {
try {
const result = await launchToken ({
name: tokenData . name ,
symbol: tokenData . symbol ,
description: tokenData . description ,
image: tokenData . image ,
socialLinks: tokenData . socialLinks ,
initialBuy: tokenData . initialBuy
});
console . log ( 'Token launched:' , result );
// Automatically submit for verification
await submitTokenForVerification ( result . mint );
} catch ( error ) {
console . error ( 'Launch failed:' , error );
}
};
const handleBuyToken = async ( mint , amount ) => {
try {
const result = await buyToken ( mint , amount );
console . log ( 'Purchase successful:' , result );
} catch ( error ) {
console . error ( 'Buy failed:' , error );
}
};
return (
< View >
< TokenLaunchForm onSubmit = { handleLaunchToken } />
< TokenTradingInterface onBuy = { handleBuyToken } />
</ View >
);
}
Hook Functions:
launchToken(params)
- Create and launch new token
buyToken(mint, amount)
- Purchase tokens
sellToken(mint, amount)
- Sell tokens
submitTokenForVerification(mint)
- Submit to RugCheck
Services Overview
pumpfunService.ts
- Direct Pump.fun platform integrationimport { pumpfunService } from '@/modules/pump-fun' ;
// Create and buy token in one transaction
const launchResult = await pumpfunService . createAndBuyTokenViaPumpfun ({
name: 'My Meme Token' ,
symbol: 'MMT' ,
description: 'The best meme token ever!' ,
image: imageFile ,
website: 'https://example.com' ,
twitter: '@mymemetoken' ,
telegram: 't.me/mymemetoken' ,
initialBuy: 0.1 // SOL amount
});
// Buy existing token (auto-detects Pump.fun vs Raydium)
const buyResult = await pumpfunService . buyTokenViaPumpfun (
tokenMint ,
amountSol ,
wallet ,
onStatusUpdate
);
// Sell tokens
const sellResult = await pumpfunService . sellTokenViaPumpfun (
tokenMint ,
tokenAmount ,
wallet ,
onStatusUpdate
);
Key Features:
Metadata upload to IPFS via backend
Intelligent routing between Pump.fun and Raydium
Bonding curve interaction
Commission handling
Status update callbacks
pumpSwapService.ts
- AMM operations via backend SDK wrapperimport { pumpSwapService } from '@/modules/pump-fun' ;
// Create new liquidity pool
const pool = await pumpSwapService . createPool ({
tokenA: 'So11111111111111111111111111111111111111112' , // SOL
tokenB: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' , // USDC
initialLiquidityA: 1.0 ,
initialLiquidityB: 100.0 ,
feeBps: 30 // 0.3%
});
// Add liquidity to existing pool
const addResult = await pumpSwapService . addLiquidity ({
poolAddress: poolAddress ,
tokenAAmount: 0.5 ,
tokenBAmount: 50.0 ,
slippageBps: 100 // 1%
});
// Execute token swap
const swapResult = await pumpSwapService . swapTokens ({
poolAddress: poolAddress ,
inputToken: tokenA ,
outputToken: tokenB ,
amount: 1.0 ,
slippageBps: 50
});
// Get swap quote
const quote = await pumpSwapService . getSwapQuoteFromBase ({
poolAddress: poolAddress ,
baseAmount: 1.0
});
Key Features:
Pool creation and management
Liquidity provision and removal
Token swapping with quotes
Real-time pricing data
Slippage protection
Quick Start Examples
Complete Token Launch
Trading Interface
PumpSwap AMM Usage
import { usePumpFun } from '@/modules/pump-fun' ;
import { useWallet } from '@/modules/wallet-providers' ;
function MemeLaunchPlatform () {
const { wallet } = useWallet ();
const { launchToken , submitTokenForVerification } = usePumpFun ();
const [ launching , setLaunching ] = useState ( false );
const handleLaunchMeme = async ( formData ) => {
if ( ! wallet ) return ;
setLaunching ( true );
try {
// Launch the token
const result = await launchToken ({
name: formData . name ,
symbol: formData . symbol ,
description: formData . description ,
image: formData . image ,
website: formData . website ,
twitter: formData . twitter ,
telegram: formData . telegram ,
initialBuy: formData . initialBuy || 0.1
});
console . log ( '๐ Token launched:' , result );
// Submit for RugCheck verification
await submitTokenForVerification ( result . mint );
Alert . alert (
'Success!' ,
` ${ formData . name } launched successfully! \n Mint: ${ result . mint } `
);
} catch ( error ) {
Alert . alert ( 'Launch Failed' , error . message );
} finally {
setLaunching ( false );
}
};
return (
< View style = {styles. container } >
< Text style = {styles. title } > Launch Your Meme Token </ Text >
< TokenLaunchForm
onSubmit = { handleLaunchMeme }
loading = { launching }
disabled = {! wallet }
/>
{! wallet && (
< ConnectWalletPrompt message = "Connect wallet to launch tokens" />
)}
</ View >
);
}
Advanced Features
Intelligent Token Routing
The module automatically detects whether tokens are on Pump.fun bonding curves or have migrated to Raydium:
function useIntelligentTrading () {
const { buyToken } = usePumpFun ();
const smartBuy = async ( tokenMint , amount ) => {
try {
// Service automatically checks:
// 1. Is token still on Pump.fun bonding curve?
// 2. Has it migrated to Raydium?
// 3. Routes to appropriate platform
const result = await buyToken ( tokenMint , amount );
console . log ( `Purchased via ${ result . platform } :` , result );
return result ;
} catch ( error ) {
console . error ( 'Smart buy failed:' , error );
throw error ;
}
};
return { smartBuy };
}
Bonding Curve Visualization
function BondingCurveChart ({ tokenMint }) {
const [ curveData , setCurveData ] = useState ( null );
useEffect (() => {
loadBondingCurveData ();
}, [ tokenMint ]);
const loadBondingCurveData = async () => {
try {
const data = await pumpfunService . getBondingCurveData ( tokenMint );
setCurveData ( data );
} catch ( error ) {
console . error ( 'Failed to load bonding curve:' , error );
}
};
return (
< View style = {styles. chartContainer } >
< Text style = {styles. chartTitle } > Bonding Curve Progress </ Text >
{ curveData && (
< View >
< ProgressBar
progress = {curveData. progress }
style = {styles. progressBar }
/>
< Text style = {styles. progressText } >
{( curveData . progress * 100). toFixed (1)}% to Raydium migration
</ Text >
< Text style = {styles. priceText } >
Current Price : { curveData . currentPrice } SOL
</ Text >
</ View >
)}
</ View >
);
}
Social Integration & Verification
function useSocialTokenLaunch () {
const { launchToken , submitTokenForVerification } = usePumpFun ();
const { createPost } = useThread ();
const launchAndAnnounce = async ( tokenData ) => {
try {
// Launch the token
const result = await launchToken ( tokenData );
// Submit for verification
await submitTokenForVerification ( result . mint );
// Create social post
await createPost ({
content: `๐ Just launched ${ tokenData . name } ($ ${ tokenData . symbol } )! \n\n ${ tokenData . description } ` ,
type: 'token_launch' ,
attachments: [
{
type: 'token' ,
mint: result . mint ,
name: tokenData . name ,
symbol: tokenData . symbol ,
image: tokenData . image
}
]
});
return result ;
} catch ( error ) {
console . error ( 'Launch and announce failed:' , error );
throw error ;
}
};
return { launchAndAnnounce };
}
Utility Functions
pumpfunUtils.ts
- Pump.fun specific helpersimport {
checkIfTokenIsOnRaydium ,
buildPumpFunBuyTransaction ,
getSwapQuote
} from '@/modules/pump-fun/utils' ;
// Check if token has migrated to Raydium
const isOnRaydium = await checkIfTokenIsOnRaydium ( tokenMint );
// Build Pump.fun transaction
const transaction = await buildPumpFunBuyTransaction ({
mint: tokenMint ,
amount: amountSol ,
slippage: 0.5
});
// Get swap quote
const quote = await getSwapQuote ( inputToken , outputToken , amount );
pumpSwapUtils.ts
- AMM calculations and formattingimport {
calculateSlippage ,
formatTokenAmount ,
calculateFees
} from '@/modules/pump-fun/utils' ;
// Calculate slippage impact
const slippageImpact = calculateSlippage ( inputAmount , outputAmount , marketPrice );
// Format token amounts for display
const formatted = formatTokenAmount ( amount , decimals );
// Calculate pool fees
const fees = calculateFees ( amount , feeBps );
anchorMobilePatch.ts
- React Native wallet compatibilityimport { MobileWallet } from '@/modules/pump-fun/utils' ;
// Use instead of NodeWallet for React Native compatibility
const mobileWallet = new MobileWallet ( wallet );
Integration with Other Modules
Combined Workflow Example
import { useWallet } from '@/modules/wallet-providers' ;
import { useFetchTokens } from '@/modules/data-module' ;
import { useThread } from '@/core/thread' ;
import { usePumpFun } from '@/modules/pump-fun' ;
function IntegratedMemeplatform () {
const { wallet } = useWallet ();
const { refetch : refetchTokens } = useFetchTokens ( wallet ?. address );
const { createPost } = useThread ();
const { launchToken , submitTokenForVerification } = usePumpFun ();
const handleMemeLaunch = async ( tokenData ) => {
try {
// Launch token
const result = await launchToken ( tokenData );
// Refresh user's portfolio
await refetchTokens ();
// Submit for verification
await submitTokenForVerification ( result . mint );
// Create announcement post
await createPost ({
content: `๐ Just launched my meme token ${ tokenData . name } ! Who's ready to pump it? ๐` ,
type: 'token_launch' ,
sections: [
{
type: 'trade' ,
data: {
tokenAddress: result . mint ,
action: 'buy' ,
platform: 'pump.fun'
}
}
]
});
return result ;
} catch ( error ) {
console . error ( 'Integrated launch failed:' , error );
throw error ;
}
};
return < MemeLaunchInterface onLaunch ={ handleMemeLaunch } />;
}
Error Handling & Troubleshooting
Backend Connection Failures
Verify SERVER_URL
is correctly configured
Ensure backend service is running
Check network connectivity
Transaction Failures
Insufficient SOL for transaction fees
Slippage tolerance too low
Network congestion
Wallet connection issues
Token Launch Issues
Image upload failures
Metadata formatting errors
Invalid social media links
Commission wallet configuration
AMM Operation Failures
Pool doesnโt exist
Insufficient liquidity
Price impact too high
Invalid token addresses
function RobustPumpfunOperations () {
const [ retryCount , setRetryCount ] = useState ( 0 );
const maxRetries = 3 ;
const safeOperation = async ( operation , params ) => {
try {
return await operation ( params );
} catch ( error ) {
console . error ( 'Operation failed:' , error );
if ( retryCount < maxRetries && error . message . includes ( 'network' )) {
setRetryCount ( prev => prev + 1 );
await new Promise ( resolve => setTimeout ( resolve , 1000 * retryCount ));
return safeOperation ( operation , params );
}
throw error ;
}
};
return { safeOperation };
}
Backend Optimization : Use backend services for heavy SDK operations to improve mobile app performance and reduce bundle size.
Rate Limits : Be mindful of API rate limits when making frequent price updates or metadata requests.
API Reference
For detailed API documentation, see:
The Pump.fun module provides everything needed to build a complete meme token ecosystem, from viral token launches to sophisticated AMM trading, all with built-in social features and community verification.