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

# Solana Swap API SDKs: JavaScript, Python, Rust, Go

> Official Solana Tracker Swap API SDKs for JavaScript, Python, Rust, and Go. Install, configure, and execute swaps on Pump.fun, Raydium, Orca, and more.

> [!NOTE]
>
> These SDKs are for the older Solana Tracker Swap API at `swap-v2.solanatracker.io`. It is still live and charges a platform fee on each swap. [Raptor](https://docs.solanatracker.io/raptor/overview.md) is a separate swap API at `raptor.solanatracker.io`, currently free with no API key.

Official client libraries for integrating Solana token swaps into your application.

> [!NOTE]
>
> All SDKs support Pump.fun, PumpSwap, Orca, Meteora, Moonshot, Raydium, and Jupiter.

## Available SDKs

> [card] [JavaScript / TypeScript](https://github.com/YZYLAB/solana-swap)
>
> For Node.js, React, Next.js, and browsers

> [card] [Python](https://github.com/YZYLAB/solana-swap-python)
>
> For Python applications and scripts

## Installation

```bash npm theme={null}
npm install solana-swap
```

```bash Python theme={null}
pip install solana-swap
```

## Quick Start

### JavaScript

```javascript theme={null}
import { SolanaTracker } from 'solana-swap';

const tracker = new SolanaTracker('YOUR_API_KEY', 'YOUR_PRIVATE_KEY');

// Get quote
const quote = await tracker.getRate({
  from: 'So11111111111111111111111111111111111111112',
  to: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
  amount: 1,
  slippage: 10
});

// Execute swap
const swap = await tracker.swap({
  from: 'So11111111111111111111111111111111111111112',
  to: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
  fromAmount: 0.1,
  slippage: 10,
  payer: 'YOUR_WALLET_ADDRESS'
});
```

### Python

```python theme={null}
from solana_swap import SolanaTracker

tracker = SolanaTracker('YOUR_API_KEY', 'YOUR_PRIVATE_KEY')

# Get quote
quote = tracker.get_rate(
    from_token='So11111111111111111111111111111111111111112',
    to_token='4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
    amount=1,
    slippage=10
)

# Execute swap
swap = tracker.swap(
    from_token='So11111111111111111111111111111111111111112',
    to_token='4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
    from_amount=0.1,
    slippage=10,
    payer='YOUR_WALLET_ADDRESS'
)
```

## React Integration

This example is quote-only. Execute swaps from a backend or from a wallet-integrated flow that can safely sign transactions.

```javascript theme={null}
import { useState } from 'react';
import { SolanaTracker } from 'solana-swap';

function SwapComponent() {
  const [quote, setQuote] = useState(null);
  const tracker = new SolanaTracker(process.env.NEXT_PUBLIC_API_KEY);
  
  async function getQuote(amount) {
    const result = await tracker.getRate({
      from: 'So11111111111111111111111111111111111111112',
      to: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
      amount: parseFloat(amount),
      slippage: 10
    });
    setQuote(result);
  }
  
  return (
    <div>
      <input 
        type="number" 
        onChange={(e) => getQuote(e.target.value)}
        placeholder="Amount"
      />
      {quote && (
        <div>
          <p>Expected: {quote.amountOut}</p>
          <p>Minimum: {quote.minAmountOut}</p>
          <p>Impact: {(quote.priceImpact * 100).toFixed(2)}%</p>
          <p>Connect a wallet-backed signing flow before executing swaps.</p>
        </div>
      )}
    </div>
  );
}
```

## Python Trading Example

```python theme={null}
from solana_swap import SolanaTracker

tracker = SolanaTracker(
    api_key='YOUR_API_KEY',
    private_key='YOUR_PRIVATE_KEY'
)

SOL = 'So11111111111111111111111111111111111111112'
TARGET = '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R'

# Get quote
quote = tracker.get_rate(
    from_token=SOL,
    to_token=TARGET,
    amount=0.1,
    slippage=10
)

# Check price impact
if quote['priceImpact'] < 0.03:  # < 3%
    # Execute swap
    swap = tracker.swap(
        from_token=SOL,
        to_token=TARGET,
        from_amount=0.1,
        slippage=10,
        payer='YOUR_WALLET',
        priority_fee='auto',
        priority_fee_level='high'
    )
    print(f"Swap completed: {swap['txn']}")
else:
    print("Price impact too high")
```

## Features

* **Zero-Delay Trading** - Sub-second execution
* **Multi-DEX Routing** - Optimal prices across DEXs
* **Priority Control** - Manual or automatic fee optimization
* **Custom Fees** - Monetization with add/deduct modes
* **Flexible Amounts** - Numeric, auto, or percentage

## Common Token Addresses

| Token | Symbol | Address |
| - | - | - |
| Wrapped SOL | SOL | `So11111111111111111111111111111111111111112` |
| USD Coin | USDC | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |
| Tether | USDT | `Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB` |
| Raydium | RAY | `4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R` |

## Support

> [card] [Discord](https://discord.gg/JH2e9rR9fc)
>
> Community support

> [card] [Email](mailto:swap-api@solanatracker.io)
>
> Direct API support

> [card] [Swap API](https://docs.solanatracker.io/swap-api/swap.md)
>
> Swap endpoint docs

> [card] [Rate API](https://docs.solanatracker.io/swap-api/rate.md)
>
> Rate endpoint docs


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.