The Meteora module integrates Meteoraโs Dynamic Liquidity Markets (DLMM) and advanced token creation functionalities. It provides sophisticated tools for token swapping, liquidity management, and creating tokens with customizable bonding curves.
Core Functionalities
Token Swapping Execute efficient swaps using Meteoraโs advanced liquidity pools with optimal price discovery
Liquidity Management Add, view, and manage liquidity positions in Meteora pools with real-time analytics
Token Creation Create SPL or Token-2022 tokens with dynamic bonding curves and customizable parameters
Bonding Curve Visualization Real-time visualization of token price curves based on creation parameters
Installation & Setup
Backend Service
Ensure your backend server is running and accessible: SERVER_URL = http://localhost:8080/api
Environment Configuration
Configure Meteora-specific settings in .env.local
: SERVER_URL = your_meteora_backend_url
METEORA_PROGRAM_ID = your_program_id
Import Module
Import components and services: import {
MeteoraScreen ,
TokenCreationForm ,
meteoraService
} from '@/modules/meteora' ;
Backend Dependency : This module requires a backend service that implements the Meteora SDK for blockchain interactions.
Module Architecture
src/modules/meteora/
โโโ components/ # UI components for Meteora features
โโโ screens/ # Top-level screen components
โโโ services/ # Backend API integration
โโโ types/ # TypeScript definitions
โโโ index.ts # Public API exports
Core Components
Token Creation Swapping Liquidity Visualization TokenCreationForm
- Multi-step token creation wizardimport { TokenCreationForm } from '@/modules/meteora' ;
function CreateTokenScreen () {
const handleTokenCreated = ( tokenData ) => {
console . log ( 'Token created:' , tokenData );
// Handle success (navigation, notifications, etc.)
};
return (
< TokenCreationForm
onTokenCreated = { handleTokenCreated }
onCancel = {() => navigation.goBack()}
/>
);
}
Features:
Basic token information (name, symbol, description, image)
Bonding curve parameters configuration
Optional immediate token purchase
Advanced fee settings
Metadata upload to IPFS
Meteora Services
The meteoraService.ts
provides a complete API client for Meteora backend operations:
Show Token Creation & Configuration
import { meteoraService } from '@/modules/meteora' ;
// Create token configuration
const config = await meteoraService . createConfig (
configParams ,
connection ,
wallet ,
onStatusUpdate
);
// Build bonding curve by market cap
const curve = await meteoraService . buildCurveByMarketCap (
curveParams ,
connection ,
wallet ,
onStatusUpdate
);
// Complete token creation with curve
const token = await meteoraService . createTokenWithCurve (
tokenParams ,
connection ,
wallet ,
onStatusUpdate
);
Available Functions:
createConfig()
- Create DBC configuration
buildCurveByMarketCap()
- Build bonding curve
createPool()
- Create liquidity pool
uploadTokenMetadata()
- Upload to IPFS
createTokenWithCurve()
- Complete token launch
createPoolAndBuy()
- Create pool + initial purchase
// Get swap quote
const quote = await meteoraService . fetchSwapQuote (
inputToken ,
outputToken ,
amount ,
slippage ,
poolAddress
);
// Execute trade
const result = await meteoraService . executeTrade (
tradeParams ,
poolAddress ,
wallet ,
onStatusUpdate
);
Available Functions:
fetchSwapQuote()
- Get trading quotes
executeTrade()
- Execute swaps
fetchMeteoraPools()
- Get available pools
Show Liquidity Management
// Fetch user positions
const positions = await meteoraService . fetchUserLiquidityPositions (
walletAddress
);
// Add liquidity
const result = await meteoraService . addLiquidity (
poolAddress ,
tokenAAmount ,
tokenBAmount ,
slippage ,
connection ,
wallet ,
onStatusUpdate
);
// Remove liquidity
const removal = await meteoraService . removeLiquidity (
positionId ,
percentage ,
connection ,
wallet ,
onStatusUpdate
);
Available Functions:
fetchUserLiquidityPositions()
- Get user positions
addLiquidity()
- Add to pools
removeLiquidity()
- Remove from pools
Quick Start Example
Complete Token Creation
Token Swapping
Liquidity Management
import { meteoraService } from '@/modules/meteora' ;
import { useWallet , useConnection } from '@/modules/wallet-providers' ;
function CreateMeteoraBased () {
const { wallet } = useWallet ();
const { connection } = useConnection ();
const [ creating , setCreating ] = useState ( false );
const handleCreateToken = async () => {
setCreating ( true );
try {
// Step 1: Upload metadata
const metadata = await meteoraService . uploadTokenMetadata ({
name: 'My Token' ,
symbol: 'MTK' ,
description: 'A token created with Meteora' ,
image: imageFile
});
// Step 2: Create token with bonding curve
const result = await meteoraService . createTokenWithCurve (
{
tokenName: 'My Token' ,
tokenSymbol: 'MTK' ,
tokenDecimals: 9 ,
totalSupply: 1000000 ,
initialMarketCap: 10000 ,
migrationMarketCap: 100000 ,
metadataUri: metadata . uri
},
connection ,
wallet ,
( status ) => console . log ( 'Status:' , status )
);
console . log ( 'Token created successfully:' , result );
} catch ( error ) {
console . error ( 'Token creation failed:' , error );
} finally {
setCreating ( false );
}
};
return (
< View >
< Button
title = {creating ? "Creating..." : "Create Token" }
onPress = { handleCreateToken }
disabled = { creating }
/>
</ View >
);
}
TypeScript Definitions
The module provides comprehensive type definitions for all Meteora operations:
// Core types
interface MeteoraTrade {
inputToken : string ;
outputToken : string ;
amount : number ;
slippage : number ;
poolAddress ?: string ;
}
interface LiquidityPosition {
id : string ;
poolAddress : string ;
tokenA : string ;
tokenB : string ;
amountA : number ;
amountB : number ;
share : number ;
}
interface CreateConfigParams {
tokenName : string ;
tokenSymbol : string ;
tokenDecimals : number ;
totalSupply : number ;
initialMarketCap : number ;
migrationMarketCap : number ;
metadataUri ?: string ;
}
// Enums
enum TokenType {
SPL = 'spl' ,
TOKEN_2022 = 'token2022'
}
enum FeeSchedulerMode {
FIXED = 'fixed' ,
DYNAMIC = 'dynamic'
}
Advanced Features
Custom Bonding Curves
Market Cap Based Custom Parameters Create bonding curves based on target market capitalizations: const curveParams = {
initialMarketCap: 50000 , // Starting market cap
migrationMarketCap: 500000 , // Target for migration
totalSupply: 1000000 , // Total token supply
curveSteepness: 2.5 , // Curve aggressiveness
};
const curve = await meteoraService . buildCurveByMarketCap (
curveParams ,
connection ,
wallet ,
statusCallback
);
Real-time Monitoring
function useMeteoraBased ( tokenAddress ) {
const [ priceData , setPriceData ] = useState ( null );
const [ liquidityData , setLiquidityData ] = useState ( null );
useEffect (() => {
const interval = setInterval ( async () => {
try {
// Fetch real-time price data
const price = await meteoraService . fetchTokenPrice ( tokenAddress );
setPriceData ( price );
// Fetch liquidity data
const liquidity = await meteoraService . fetchPoolLiquidity ( tokenAddress );
setLiquidityData ( liquidity );
} catch ( error ) {
console . error ( 'Failed to fetch real-time data:' , error );
}
}, 10000 ); // Update every 10 seconds
return () => clearInterval ( interval );
}, [ tokenAddress ]);
return { priceData , liquidityData };
}
Integration Patterns
With Other Modules
Combined Usage Example
import { useWallet } from '@/modules/wallet-providers' ;
import { useFetchTokens } from '@/modules/data-module' ;
import { useThread } from '@/core/thread' ;
import { meteoraService } from '@/modules/meteora' ;
function IntegratedTokenLaunch () {
const { wallet } = useWallet ();
const { refetch : refetchTokens } = useFetchTokens ( wallet ?. address );
const { createPost } = useThread ();
const handleTokenLaunch = async ( tokenData ) => {
try {
// Create token with Meteora
const result = await meteoraService . createTokenWithCurve (
tokenData ,
connection ,
wallet ,
statusUpdate
);
// Refresh user's token list
await refetchTokens ();
// Create social post about the launch
await createPost ({
content: `๐ Just launched ${ tokenData . tokenName } with Meteora DLMM!` ,
type: 'token_launch' ,
attachments: [ result . tokenAddress ]
});
console . log ( 'Token launched and announced:' , result );
} catch ( error ) {
console . error ( 'Token launch failed:' , error );
}
};
return < TokenCreationForm onTokenCreated ={ handleTokenLaunch } />;
}
Error Handling & Status Updates
function MeteoraBased () {
const [ status , setStatus ] = useState ( '' );
const [ error , setError ] = useState ( null );
const handleStatusUpdate = ( update ) => {
setStatus ( update . message );
if ( update . error ) {
setError ( update . error );
}
if ( update . completed ) {
setStatus ( 'Transaction completed successfully!' );
setTimeout (() => setStatus ( '' ), 3000 );
}
};
const createToken = async () => {
setError ( null );
try {
await meteoraService . createTokenWithCurve (
tokenParams ,
connection ,
wallet ,
handleStatusUpdate
);
} catch ( error ) {
setError ( error . message );
console . error ( 'Meteora operation failed:' , error );
}
};
return (
< View >
{ status && < Text style = {styles. status } > { status } </ Text > }
{ error && < Text style = {styles. error } > { error } </ Text > }
< Button title = "Create Token" onPress = { createToken } />
</ View >
);
}
Troubleshooting
Backend Connection Issues
Verify SERVER_URL
is correctly configured
Ensure backend service is running and accessible
Check network connectivity and firewall settings
Transaction Failures
Insufficient SOL for transaction fees
Wallet connection issues
Network congestion or RPC rate limits
Bonding Curve Configuration
Invalid market cap ratios (migration must be > initial)
Supply parameters donโt match curve expectations
Fee configurations exceed maximum allowed values
Batch Operations : When possible, batch multiple operations to reduce transaction costs and improve user experience.
Gas Optimization : Meteora operations can be gas-intensive. Always provide clear fee estimates to users.
API Reference
For detailed API documentation, see:
The Meteora module provides advanced DeFi capabilities with professional-grade bonding curves and liquidity management, perfect for sophisticated token economics and trading strategies.