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
1
Backend Configuration
Ensure your backend server is running for metadata uploads and PumpSwap SDK:
SERVER_URL=http://localhost:8080/api
2
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
3
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}
/>
);
}
- 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
PumpfunBuySection & PumpfunSellSection - Trading interfacesimport { PumpfunBuySection, PumpfunSellSection } from '@/modules/pump-fun';
function TradingInterface() {
const handleTradeComplete = (result) => {
console.log('Trade completed:', result);
};
return (
<View>
<PumpfunBuySection
onTradeComplete={handleTradeComplete}
showBondingCurve={true}
enableRaydiumFallback={true}
/>
<PumpfunSellSection
onTradeComplete={handleTradeComplete}
showPortfolio={true}
/>
</View>
);
}
- Intelligent routing (Pump.fun โ Raydium)
- Bonding curve visualization
- Portfolio integration
- Slippage configuration
- Real-time price updates
PumpSwapScreen - Complete AMM interface with tabsimport { PumpSwapScreen } from '@/modules/pump-fun';
function AMMInterface() {
return (
<PumpSwapScreen
defaultTab="swap"
enablePoolCreation={true}
enableLiquidityManagement={true}
/>
);
}
- Multi-tab interface (Swap, Add/Remove Liquidity, Create Pool)
- Real-time quotes and pricing
- Liquidity position management
- Pool analytics and stats
- Transaction status tracking
Granular control with individual AMM components
import {
SwapSection,
LiquidityAddSection,
PoolCreationSection
} from '@/modules/pump-fun/components/pump-swap';
function CustomAMMInterface() {
return (
<View>
<SwapSection onSwapComplete={handleSwap} />
<LiquidityAddSection onLiquidityAdded={handleLiquidity} />
<PoolCreationSection onPoolCreated={handlePool} />
</View>
);
}
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>
);
}
launchToken(params)- Create and launch new tokenbuyToken(mint, amount)- Purchase tokenssellToken(mint, amount)- Sell tokenssubmitTokenForVerification(mint)- Submit to RugCheck
Services Overview
object
Show Pump.fun Service
Show Pump.fun Service
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
);
- Metadata upload to IPFS via backend
- Intelligent routing between Pump.fun and Raydium
- Bonding curve interaction
- Commission handling
- Status update callbacks
Show PumpSwap Service
Show PumpSwap Service
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
});
- Pool creation and management
- Liquidity provision and removal
- Token swapping with quotes
- Real-time pricing data
- Slippage protection
Quick Start Examples
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!\nMint: ${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>
);
}
import { PumpfunBuySection, PumpfunSellSection } from '@/modules/pump-fun';
function MemeTokenTrading() {
const [activeTab, setActiveTab] = useState('buy');
const [selectedToken, setSelectedToken] = useState(null);
const handleTradeSuccess = (result, type) => {
Alert.alert(
`${type} Successful!`,
`Transaction completed: ${result.signature}`
);
// Refresh portfolio or price data
if (type === 'Buy') {
refetchPortfolio();
}
};
return (
<View style={styles.container}>
<View style={styles.tabContainer}>
<TouchableOpacity
style={[styles.tab, activeTab === 'buy' && styles.activeTab]}
onPress={() => setActiveTab('buy')}
>
<Text style={styles.tabText}>Buy</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.tab, activeTab === 'sell' && styles.activeTab]}
onPress={() => setActiveTab('sell')}
>
<Text style={styles.tabText}>Sell</Text>
</TouchableOpacity>
</View>
{activeTab === 'buy' ? (
<PumpfunBuySection
selectedToken={selectedToken}
onTokenSelect={setSelectedToken}
onTradeComplete={(result) => handleTradeSuccess(result, 'Buy')}
showBondingCurve={true}
/>
) : (
<PumpfunSellSection
onTradeComplete={(result) => handleTradeSuccess(result, 'Sell')}
showPortfolio={true}
/>
)}
</View>
);
}
import { PumpSwapScreen } from '@/modules/pump-fun';
import { useWallet } from '@/modules/wallet-providers';
function AMMPlatform() {
const { wallet } = useWallet();
const [pools, setPools] = useState([]);
useEffect(() => {
loadUserPools();
}, [wallet?.address]);
const loadUserPools = async () => {
if (!wallet) return;
try {
// Load user's liquidity positions
const userPools = await pumpSwapService.getUserLiquidityPositions(
wallet.address
);
setPools(userPools);
} catch (error) {
console.error('Failed to load pools:', error);
}
};
const handleSwapComplete = (result) => {
console.log('Swap completed:', result);
loadUserPools(); // Refresh positions
};
const handleLiquidityAdded = (result) => {
console.log('Liquidity added:', result);
loadUserPools(); // Refresh positions
};
const handlePoolCreated = (result) => {
console.log('Pool created:', result);
loadUserPools(); // Refresh positions
};
return (
<View style={styles.container}>
<Text style={styles.title}>PumpSwap AMM</Text>
<PumpSwapScreen
defaultTab="swap"
onSwapComplete={handleSwapComplete}
onLiquidityAdded={handleLiquidityAdded}
onPoolCreated={handlePoolCreated}
/>
{pools.length > 0 && (
<View style={styles.poolsSection}>
<Text style={styles.sectionTitle}>Your Liquidity Positions</Text>
{pools.map((pool, index) => (
<PoolCard key={index} pool={pool} />
))}
</View>
)}
</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
object
Show Pump.fun Utilities
Show Pump.fun Utilities
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);
Show PumpSwap Utilities
Show PumpSwap Utilities
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);
Show Mobile Wallet Patch
Show Mobile Wallet Patch
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
Embedded Wallets
Transaction signing and wallet management for token operations
Data Module
Real-time token prices and portfolio tracking
Thread Module
Social sharing of token launches and trading activity
NFT Module
Token-gated NFT access and community rewards
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
object
Show Common Issues
Show Common Issues
Backend Connection Failures
- Verify
SERVER_URLis correctly configured - Ensure backend service is running
- Check network connectivity
- Insufficient SOL for transaction fees
- Slippage tolerance too low
- Network congestion
- Wallet connection issues
- Image upload failures
- Metadata formatting errors
- Invalid social media links
- Commission wallet configuration
- 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 };
}
Performance Considerations
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.