> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monei.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Token Swaps

> Swap SOL and SPL tokens seamlessly using Jupiter aggregator

## Overview

Monei integrates with Jupiter, Solana's leading DEX aggregator, to provide the best swap rates across all Solana DEXs. Get optimal prices with minimal slippage.

**What you'll learn:**

* Get swap quotes with Jupiter
* Swap SOL to SPL tokens
* Swap SPL tokens to SOL
* Swap between SPL tokens
* Understand slippage and price impact
* Optimize swap routes

***

## Swap Types

<CardGroup cols={3}>
  <Card title="SOL → Token" icon="right-long">
    Swap SOL to any SPL token (USDC, USDT, etc.)
  </Card>

  <Card title="Token → Token" icon="arrow-right-arrow-left">
    Swap between any two SPL tokens
  </Card>

  <Card title="Token → SOL" icon="left-long">
    Swap SPL tokens back to native SOL
  </Card>
</CardGroup>

***

## Get Swap Quote

Always get a quote before swapping to see the exchange rate and estimated output.

### SOL to Token Quote

<CodeGroup>
  ```javascript Node.js theme={null}
  import MoneiSDK from 'monei-sdk';

  const monei = new MoneiSDK({
    apiKey: process.env.MONEI_API_KEY,
  });

  // Get quote for swapping 1 SOL to USDC
  const quote = await monei.solExchange.getSolToTokenQuote({
    outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC mint
    amount: 1.0, // 1 SOL
  });

  console.log('Quote ID:', quote.quoteId);
  console.log('Swap Mode:', quote.swapMode);
  console.log('\nFrom:', quote.fromToken.symbol, '(SOL)');
  console.log('To:', quote.toToken.symbol, '(USDC)');
  console.log('\nInput Amount:', quote.amounts.inputAmount, 'SOL');
  console.log('Output Amount:', quote.amounts.outputAmount, 'USDC');
  console.log('Min Output:', quote.amounts.minOutputAmount, 'USDC (with slippage)');
  console.log('\nExchange Rate:', quote.rates.rate, 'USDC per SOL');
  console.log('Reverse Rate:', quote.rates.reverseRate, 'SOL per USDC');
  console.log('USD Rate:', quote.rates.usdRate);
  console.log('\nPrice Impact:', quote.priceImpact + '%');
  console.log('Slippage Tolerance:', quote.slippageTolerance + '%');
  console.log('\nGas Fee:', quote.fees.gasFee, 'SOL');
  console.log('Total Fee:', quote.fees.totalFeeAmount, 'SOL');
  console.log('\nRoute:', quote.route.hops, 'hops via', quote.route.dexes.join(', '));
  console.log('Efficiency Score:', quote.route.efficiencyScore + '/100');
  console.log('\nExpires in:', quote.expiresIn, 'seconds');
  console.log('Executable:', quote.executable ? 'Yes' : 'No');
  ```

  ```python Python theme={null}
  from monei import MoneiClient

  monei = MoneiClient(
      api_key=os.getenv('MONEI_API_KEY')
  )

  # Get quote
  quote = monei.sol_exchange.get_sol_to_token_quote(
      output_mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      amount=1.0
  )

  print(f'Quote ID: {quote.quote_id}')
  print(f'\nFrom: {quote.from_token.symbol} (SOL)')
  print(f'To: {quote.to_token.symbol} (USDC)')
  print(f'\nInput: {quote.amounts.input_amount} SOL')
  print(f'Output: {quote.amounts.output_amount} USDC')
  print(f'Min Output: {quote.amounts.min_output_amount} USDC')
  print(f'\nRate: {quote.rates.rate} USDC per SOL')
  print(f'Price Impact: {quote.price_impact}%')
  print(f'\nGas Fee: {quote.fees.gas_fee} SOL')
  print(f'Route: {quote.route.hops} hops via {", ".join(quote.route.dexes)}')
  print(f'\nExpires in: {quote.expires_in}s')
  ```

  ```bash cURL theme={null}
  curl "https://api.monei.cc/api/v1/solana-exchange/quote/sol-to-token?outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1.0" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "statusCode": 200,
  "message": "Quote retrieved successfully",
  "data": {
    "quoteId": "quote_abc123xyz",
    "swapMode": "ExactIn",
    "fromToken": {
      "address": "So11111111111111111111111111111111111111112",
      "symbol": "SOL",
      "decimals": 9,
      "name": "Solana",
      "logoUri": "https://..."
    },
    "toToken": {
      "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "symbol": "USDC",
      "decimals": 6,
      "name": "USD Coin"
    },
    "amounts": {
      "inputAmount": "1.0",
      "outputAmount": "100.50",
      "minOutputAmount": "99.99",
      "inputAmountRaw": "1000000000",
      "outputAmountRaw": "100500000"
    },
    "rates": {
      "rate": "100.50",
      "reverseRate": "0.00995",
      "usdRate": "100.50"
    },
    "fees": {
      "protocolFeePercent": "0.02",
      "protocolFeeAmount": "0.0002",
      "platformFeePercent": "0.02",
      "totalFeePercent": "0.04",
      "totalFeeAmount": "0.0004",
      "gasFee": "0.000005",
      "totalCost": "0.000405"
    },
    "route": {
      "hops": 2,
      "dexes": ["Raydium CLMM", "Orca"],
      "tokens": ["SOL", "USDT", "USDC"],
      "efficiencyScore": 98
    },
    "priceImpact": "0.05",
    "usdValues": {
      "inputValue": 100.50,
      "outputValue": 100.50,
      "netValue": 100.09
    },
    "slippageTolerance": "0.5",
    "expiryTimestamp": 1698765732,
    "expiresIn": 300,
    "estimatedSwapTime": 30,
    "network": "Solana Mainnet",
    "executable": true,
    "warnings": []
  }
}
```

### Token to SOL Quote

<CodeGroup>
  ```javascript Node.js theme={null}
  // Get quote for swapping 100 USDC to SOL
  const quote = await monei.solExchange.getTokenToSolQuote({
    inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
    amount: 100
  });

  console.log('Swap 100 USDC → SOL');
  console.log('Output:', quote.amounts.outputAmount, 'SOL');
  console.log('Min Output:', quote.amounts.minOutputAmount, 'SOL');
  console.log('Rate:', quote.rates.rate, 'SOL per USDC');
  console.log('Price Impact:', quote.priceImpact + '%');
  ```

  ```python Python theme={null}
  # Get token-to-SOL quote
  quote = monei.sol_exchange.get_token_to_sol_quote(
      input_mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      amount=100
  )

  print(f'Swap 100 USDC → SOL')
  print(f'Output: {quote.amounts.output_amount} SOL')
  print(f'Min Output: {quote.amounts.min_output_amount} SOL')
  print(f'Rate: {quote.rates.rate}')
  ```

  ```bash cURL theme={null}
  curl "https://api.monei.cc/api/v1/solana-exchange/quote/token-to-sol?inputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=100" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

### Token to Token Quote

<CodeGroup>
  ```javascript Node.js theme={null}
  // Get quote for swapping USDC to USDT
  const quote = await monei.solExchange.getTokenToTokenQuote({
    inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
    outputMint: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', // USDT
    amount: 100
  });

  console.log('Swap 100 USDC → USDT');
  console.log('Output:', quote.amounts.outputAmount, 'USDT');
  console.log('Rate:', quote.rates.rate);
  console.log('Price Impact:', quote.priceImpact + '%');
  ```

  ```python Python theme={null}
  # Get token-to-token quote
  quote = monei.sol_exchange.get_token_to_token_quote(
      input_mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      output_mint='Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
      amount=100
  )

  print(f'Swap 100 USDC → USDT')
  print(f'Output: {quote.amounts.output_amount} USDT')
  ```

  ```bash cURL theme={null}
  curl "https://api.monei.cc/api/v1/solana-exchange/quote/token-to-token?inputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&outputMint=Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB&amount=100" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

***

## Execute Swap

### Swap SOL to Token

<CodeGroup>
  ```javascript Node.js theme={null}
  // Swap 1 SOL to USDC
  const swap = await monei.solExchange.swapSolToToken({
    outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
    amount: 1.0,
    slippageBps: 50 // 0.5% slippage (optional)
  });

  console.log('Transaction Signature:', swap.signature);
  console.log('Transaction URL:', swap.txUrl);
  console.log('View on Solscan:', `https://solscan.io/tx/${swap.signature}`);

  // Wait for confirmation
  await monei.solana.waitForConfirmation(swap.signature);
  console.log('Swap completed!');
  ```

  ```python Python theme={null}
  # Execute swap
  swap = monei.sol_exchange.swap_sol_to_token(
      output_mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      amount=1.0,
      slippage_bps=50
  )

  print(f'Signature: {swap.signature}')
  print(f'URL: {swap.tx_url}')
  print(f'Solscan: https://solscan.io/tx/{swap.signature}')

  # Wait for confirmation
  monei.solana.wait_for_confirmation(swap.signature)
  print('Completed!')
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.monei.cc/api/v1/solana-exchange/swap-sol-to-token \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "amount": 1.0,
      "slippageBps": 50
    }'
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "statusCode": 200,
  "message": "Swap executed successfully",
  "data": {
    "signature": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnTPLgTLpjvS3yJG3TBhVLiYt5mMXe4EH7zJ2VSkQfpYjG",
    "txUrl": "https://solscan.io/tx/5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnTPLgTLpjvS3yJG3TBhVLiYt5mMXe4EH7zJ2VSkQfpYjG"
  }
}
```

### Swap Token to Token

<CodeGroup>
  ```javascript Node.js theme={null}
  // Swap 100 USDC to USDT
  const swap = await monei.solExchange.swapTokenToToken({
    inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
    outputMint: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', // USDT
    amount: 100,
    slippageBps: 50
  });

  console.log('Swap completed!');
  console.log('Signature:', swap.signature);
  ```

  ```python Python theme={null}
  # Execute token-to-token swap
  swap = monei.sol_exchange.swap_token_to_token(
      input_mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      output_mint='Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
      amount=100,
      slippage_bps=50
  )

  print(f'Signature: {swap.signature}')
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.monei.cc/api/v1/solana-exchange/swap-token-to-token \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
      "amount": 100,
      "slippageBps": 50
    }'
  ```
</CodeGroup>

### Swap Token to SOL

<CodeGroup>
  ```javascript Node.js theme={null}
  // Swap 100 USDC to SOL
  const swap = await monei.solExchange.swapTokenToSol({
    inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
    amount: 100,
    slippageBps: 50
  });

  console.log('Swap completed!');
  console.log('Signature:', swap.signature);
  ```

  ```python Python theme={null}
  # Execute token-to-SOL swap
  swap = monei.sol_exchange.swap_token_to_sol(
      input_mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      amount=100,
      slippage_bps=50
  )

  print(f'Signature: {swap.signature}')
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.monei.cc/api/v1/solana-exchange/swap-token-to-sol \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "amount": 100,
      "slippageBps": 50
    }'
  ```
</CodeGroup>

***

## Understanding Quote Details

### Key Quote Fields

| Field                     | Description                                          |
| ------------------------- | ---------------------------------------------------- |
| `quoteId`                 | Unique ID for this quote (valid for \~5 minutes)     |
| `swapMode`                | ExactIn (specify input) or ExactOut (specify output) |
| `amounts.outputAmount`    | Expected output amount                               |
| `amounts.minOutputAmount` | Minimum output after slippage                        |
| `rates.rate`              | Exchange rate (1 input = X output)                   |
| `rates.reverseRate`       | Reverse rate (1 output = Y input)                    |
| `priceImpact`             | How much this trade affects market price             |
| `fees.gasFee`             | Estimated gas cost in SOL                            |
| `route.hops`              | Number of swaps in the route                         |
| `route.dexes`             | DEXs used for routing                                |
| `route.efficiencyScore`   | Route quality score (1-100)                          |
| `slippageTolerance`       | Allowed slippage percentage                          |
| `expiresIn`               | Seconds until quote expires                          |

### Slippage (in Basis Points)

Slippage is specified in basis points (bps):

* 1 bps = 0.01%
* 50 bps = 0.5%
* 100 bps = 1.0%

| Slippage (bps) | Percentage | Use Case                       |
| -------------- | ---------- | ------------------------------ |
| 10             | 0.1%       | Stablecoin swaps (USDC ↔ USDT) |
| 50             | 0.5%       | Normal volatility              |
| 100            | 1.0%       | Higher volatility              |
| 300            | 3.0%       | Very volatile or low liquidity |

<CodeGroup>
  ```javascript Node.js theme={null}
  // Calculate slippage in basis points
  function toBps(percent) {
    return percent * 100;
  }

  console.log('0.5%:', toBps(0.5), 'bps'); // 50 bps
  console.log('1.0%:', toBps(1.0), 'bps'); // 100 bps
  console.log('3.0%:', toBps(3.0), 'bps'); // 300 bps

  // Use custom slippage
  const swap = await monei.solExchange.swapSolToToken({
    outputMint: usdcMint,
    amount: 1.0,
    slippageBps: toBps(1.0) // 1% slippage = 100 bps
  });
  ```

  ```python Python theme={null}
  # Calculate basis points
  def to_bps(percent):
      return percent * 100

  print(f'0.5%: {to_bps(0.5)} bps')  # 50
  print(f'1.0%: {to_bps(1.0)} bps')  # 100
  print(f'3.0%: {to_bps(3.0)} bps')  # 300

  # Use custom slippage
  swap = monei.solana_exchange.swap_sol_to_token(
      output_mint=usdc_mint,
      amount=1.0,
      slippage_bps=to_bps(1.0)  # 1% = 100 bps
  )
  ```
</CodeGroup>

***

## Price Impact

Price impact shows how much your trade will move the market price:

| Price Impact | Interpretation | Action                    |
| ------------ | -------------- | ------------------------- |
| \< 0.1%      | Negligible     | Safe to proceed           |
| 0.1% - 1%    | Low            | Good trade                |
| 1% - 3%      | Moderate       | Acceptable                |
| 3% - 5%      | High           | Consider splitting        |
| > 5%         | Very high      | Split into smaller trades |

<CodeGroup>
  ```javascript Node.js theme={null}
  // Check price impact before swapping
  const quote = await monei.solExchange.getSolToTokenQuote({
    outputMint: tokenMint,
    amount: 10.0
  });

  const priceImpact = parseFloat(quote.priceImpact);

  if (priceImpact > 5) {
    console.log('⚠️ WARNING: Very high price impact!');
    console.log('Price Impact:', priceImpact + '%');
    console.log('Consider splitting into smaller trades');
  } else if (priceImpact > 3) {
    console.log('⚠️ High price impact:', priceImpact + '%');
  } else if (priceImpact > 1) {
    console.log('ℹ️ Moderate price impact:', priceImpact + '%');
  } else {
    console.log('✓ Low price impact:', priceImpact + '%');
    console.log('Safe to proceed');
  }
  ```

  ```python Python theme={null}
  # Check price impact
  quote = monei.sol_exchange.get_sol_to_token_quote(
      output_mint=token_mint,
      amount=10.0
  )

  price_impact = float(quote.price_impact)

  if price_impact > 5:
      print('⚠️ WARNING: Very high price impact!')
      print(f'Impact: {price_impact}%')
      print('Consider splitting trade')
  elif price_impact > 3:
      print(f'⚠️ High impact: {price_impact}%')
  elif price_impact > 1:
      print(f'ℹ️ Moderate impact: {price_impact}%')
  else:
      print(f'✓ Low impact: {price_impact}%')
  ```
</CodeGroup>

***

## Route Optimization

Monei finds the best route across multiple DEXs:

### Supported DEXs

* Raydium
* Orca
* Meteora
* Phoenix
* Lifinity
* Openbook
* And 20+ more

### Route Example

```
Input: 1 SOL
Route: SOL → USDT (Raydium) → USDC (Orca)
Hops: 2
Output: 100.50 USDC
Efficiency: 98/100
```

<CodeGroup>
  ```javascript Node.js theme={null}
  // Analyze swap route
  const quote = await monei.solExchange.getSolToTokenQuote({
    outputMint: usdcMint,
    amount: 1.0
  });

  console.log('Swap Route Analysis:');
  console.log('==================');
  console.log('Hops:', quote.route.hops);
  console.log('Path:', quote.route.tokens.join(' → '));
  console.log('DEXs:', quote.route.dexes.join(', '));
  console.log('Efficiency Score:', quote.route.efficiencyScore + '/100');
  console.log('\nInput:', quote.amounts.inputAmount, quote.fromToken.symbol);
  console.log('Output:', quote.amounts.outputAmount, quote.toToken.symbol);
  console.log('Rate:', quote.rates.rate);

  // High efficiency routes are better
  if (quote.route.efficiencyScore >= 95) {
    console.log('\n✓ Excellent route!');
  } else if (quote.route.efficiencyScore >= 85) {
    console.log('\n✓ Good route');
  } else {
    console.log('\n⚠️ Suboptimal route - low liquidity?');
  }
  ```

  ```python Python theme={null}
  # Analyze route
  quote = monei.sol_exchange.get_sol_to_token_quote(
      output_mint=usdc_mint,
      amount=1.0
  )

  print('Swap Route Analysis:')
  print('=' * 20)
  print(f'Hops: {quote.route.hops}')
  print(f'Path: {" → ".join(quote.route.tokens)}')
  print(f'DEXs: {", ".join(quote.route.dexes)}')
  print(f'Efficiency: {quote.route.efficiency_score}/100')

  if quote.route.efficiency_score >= 95:
      print('\n✓ Excellent route!')
  elif quote.route.efficiency_score >= 85:
      print('\n✓ Good route')
  else:
      print('\n⚠️ Suboptimal route')
  ```
</CodeGroup>

***

## Common Token Pairs

### Popular Swaps on Solana

<Tabs>
  <Tab title="SOL ↔ USDC">
    ```javascript theme={null}
    // SOL to USDC
    const swap = await monei.solExchange.swapSolToToken({
      outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      amount: 1.0,
      slippageBps: 50
    });

    // USDC to SOL
    const reverseSwap = await monei.solExchange.swapTokenToSol({
      inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
      amount: 100,
      slippageBps: 50
    });
    ```
  </Tab>

  <Tab title="USDC ↔ USDT">
    ```javascript theme={null}
    // USDC to USDT (stablecoin swap)
    const swap = await monei.solExchange.swapTokenToToken({
      inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
      outputMint: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', // USDT
      amount: 1000,
      slippageBps: 10 // Low slippage for stablecoins
    });
    ```
  </Tab>

  <Tab title="SOL ↔ JUP">
    ```javascript theme={null}
    // SOL to Jupiter Token
    const swap = await monei.solExchange.swapSolToToken({
      outputMint: 'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN',
      amount: 1.0,
      slippageBps: 100 // Higher slippage for volatile tokens
    });
    ```
  </Tab>
</Tabs>

***

## Swap Fees

Solana swaps have extremely low fees compared to EVM:

| Component        | Cost                        | Description          |
| ---------------- | --------------------------- | -------------------- |
| **Gas Fee**      | ~~0.000005 SOL (~~\$0.0005) | Transaction fee      |
| **Protocol Fee** | 0.02% - 0.04%               | Jupiter/DEX fees     |
| **Price Impact** | Variable                    | Depends on liquidity |

**Total Cost Example:**

```
Swap: 1 SOL → USDC
- Gas Fee: 0.000005 SOL ($0.0005)
- Protocol Fee: 0.02% = 0.0002 SOL ($0.02)
- Total: ~0.0002 SOL ($0.02)
```

<CodeGroup>
  ```javascript Node.js theme={null}
  // Calculate total swap cost
  const quote = await monei.solExchange.getSolToTokenQuote({
    outputMint: usdcMint,
    amount: 1.0
  });

  console.log('Swap Cost Breakdown:');
  console.log('===================');
  console.log('Gas Fee:', quote.fees.gasFee, 'SOL');
  console.log('Protocol Fee:', quote.fees.protocolFeePercent + '%');
  console.log('Protocol Fee Amount:', quote.fees.protocolFeeAmount, 'SOL');
  console.log('Platform Fee:', quote.fees.platformFeePercent + '%');
  console.log('Total Fee:', quote.fees.totalFeeAmount, 'SOL');
  console.log('Total Cost:', quote.fees.totalCost, 'SOL');
  console.log('\nNet Output:', quote.usdValues.netValue, 'USD');
  ```

  ```python Python theme={null}
  # Calculate cost
  quote = monei.sol_exchange.get_sol_to_token_quote(
      output_mint=usdc_mint,
      amount=1.0
  )

  print('Swap Cost Breakdown:')
  print('=' * 20)
  print(f'Gas Fee: {quote.fees.gas_fee} SOL')
  print(f'Protocol Fee: {quote.fees.protocol_fee_percent}%')
  print(f'Total Fee: {quote.fees.total_fee_amount} SOL')
  print(f'Total Cost: {quote.fees.total_cost} SOL')
  print(f'\nNet Output: ${quote.usd_values.net_value}')
  ```
</CodeGroup>

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Always Get Quote" icon="quote-left">
    Get fresh quote before each swap (quotes expire in \~5 min)
  </Card>

  <Card title="Check Price Impact" icon="chart-line">
    Avoid swaps with price impact > 5%
  </Card>

  <Card title="Set Appropriate Slippage" icon="shield">
    Use low slippage for stablecoins, higher for volatile tokens
  </Card>

  <Card title="Monitor Route Efficiency" icon="route">
    Choose routes with efficiency score > 90
  </Card>

  <Card title="Split Large Trades" icon="scissors">
    Break up trades with high price impact
  </Card>

  <Card title="Keep SOL for Fees" icon="gas-pump">
    Maintain minimum 0.01 SOL for gas
  </Card>
</CardGroup>

***

## Troubleshooting

<AccordionGroup>
  <Accordion icon="circle-xmark" title="Swap Failed - Slippage Exceeded">
    **Error:** Slippage tolerance exceeded

    **Cause:** Price moved more than allowed slippage

    **Solution:**

    * Increase slippage tolerance
    * Get fresh quote
    * Split into smaller trades
    * Wait for less volatile market

    ```javascript theme={null}
    // Increase slippage
    const swap = await monei.solExchange.swapSolToToken({
      outputMint: tokenMint,
      amount: 1.0,
      slippageBps: 100 // Increase from 50 to 100 bps (1%)
    });
    ```
  </Accordion>

  <Accordion icon="circle-xmark" title="Insufficient Liquidity">
    **Error:** Not enough liquidity

    **Solutions:**

    * Reduce swap amount
    * Try different token pair
    * Use more liquid tokens (USDC/USDT)
    * Check quote route efficiency

    ```javascript theme={null}
    const quote = await monei.solExchange.getSolToTokenQuote({
      outputMint: tokenMint,
      amount: 1.0
    });

    if (quote.route.efficiencyScore < 80) {
      console.log('Low liquidity detected');
      console.log('Consider reducing amount or using different token');
    }
    ```
  </Accordion>

  <Accordion icon="clock" title="Quote Expired">
    **Error:** Quote ID invalid or expired

    **Cause:** Quotes expire after \~5 minutes

    **Solution:**

    * Get fresh quote immediately before swapping
    * Don't reuse old quotes
    * Execute swap right after getting quote
  </Accordion>

  <Accordion icon="ban" title="Insufficient SOL for Fees">
    **Error:** Not enough SOL for transaction

    **Solution:**

    * Keep minimum 0.01 SOL for fees
    * Account for gas + protocol fees
    * Don't swap all your SOL

    ```javascript theme={null}
    // Check SOL balance before swap
    const balance = await monei.solana.getBalance();
    const minReserve = 0.01; // Keep for fees

    if (parseFloat(balance.balance) < minReserve) {
      console.log('Need to keep SOL for fees');
    }
    ```
  </Accordion>

  <Accordion icon="exclamation-triangle" title="High Price Impact Warning">
    **Warning:** Price impact > 5%

    **Recommendations:**

    * Split into 2-3 smaller swaps
    * Wait for better liquidity
    * Use different DEX route
    * Consider limit orders
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Wallet Operations" icon="wallet" href="/solana/wallet-operations">
    Manage your Solana wallet
  </Card>

  <Card title="Transactions" icon="arrow-right-arrow-left" href="/solana/transactions">
    Learn about Solana transactions
  </Card>

  <Card title="EVM Swaps" icon="ethereum" href="/evm-blockchain/token-swaps">
    Compare with EVM token swaps
  </Card>

  <Card title="Networks" icon="network-wired" href="/core-concepts/networks">
    Explore supported networks
  </Card>
</CardGroup>
