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

1

Backend Service

Ensure your backend server is running and accessible:

SERVER_URL=http://localhost:8080/api
2

Environment Configuration

Configure Meteora-specific settings in .env.local:

SERVER_URL=your_meteora_backend_url
METEORA_PROGRAM_ID=your_program_id
3

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

TokenCreationForm - Multi-step token creation wizard

import { 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:

token_creation_config
object
swapping_trading
object
liquidity_management
object

Quick Start Example

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

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

common_issues
object

Performance Considerations

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.