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

# Providers

> Understanding DEX providers and their capabilities

## Overview

We aggregate liquidity from multiple decentralized exchange protocols, each with unique strengths and supported assets. Understanding providers helps you optimize your swaps for speed, cost, and availability.

## Available Providers

### THORChain

<Card className="glass-card">
  **Type:** Cross-chain Liquidity Protocol\
  **Specialty:** Native asset swaps without wrapped tokens\
  **Chains:** 12+ blockchains including Bitcoin, Ethereum, Cosmos\
  **Best for:** Large cross-chain swaps with deep liquidity
</Card>

**Key Features:**

* Native asset swaps (no wrapping required)
* Continuous Liquidity Pools (CLP)
* Streaming swaps for large amounts
* Built-in slip protection
* No impermanent loss for LPs

**Supported Chains:**

* Bitcoin, Ethereum, Binance Smart Chain
* Avalanche, Cosmos, THORChain
* Litecoin, Bitcoin Cash, Dogecoin

**When to Use:**

* Cross-chain native asset swaps
* Large swap amounts (\$10k+)
* When security is paramount
* Bitcoin to/from any chain

### Chainflip

<Card className="glass-card">
  **Type:** State Chain Protocol\
  **Specialty:** Fast cross-chain swaps with JIT liquidity\
  **Chains:** Bitcoin, Ethereum, Arbitrum, Polkadot\
  **Best for:** Speed and competitive pricing
</Card>

**Key Features:**

* Just-In-Time (JIT) AMM
* State chain architecture
* Fast finality (\~1-2 minutes)
* Competitive pricing
* Native cross-chain swaps

**Supported Chains:**

* Bitcoin, Ethereum, Arbitrum
* Polkadot (unique support)
* More chains coming soon

**When to Use:**

* Need fastest cross-chain execution
* Polkadot ecosystem swaps
* Medium-sized swaps ($1k-$100k)
* Arbitrum cross-chain swaps

### MayaChain

<Card className="glass-card">
  **Type:** THORChain Fork\
  **Specialty:** Optimized for specific asset pairs\
  **Chains:** Bitcoin, Ethereum, THORChain, Dash, Kujira\
  **Best for:** CACAO token and Dash swaps
</Card>

**Key Features:**

* Fork of THORChain with modifications
* Native CACAO token
* Specialized pools
* Unique Dash and Kujira support
* Capital efficiency improvements

**Supported Chains:**

* Bitcoin, Ethereum, THORChain
* Dash (unique support)
* Kujira (Cosmos ecosystem)
* Maya Protocol native

**When to Use:**

* Dash cryptocurrency swaps
* CACAO token trading
* Kujira ecosystem access
* Alternative to THORChain routes

### Jupiter

<Card className="glass-card">
  **Type:** Solana DEX Aggregator\
  **Specialty:** Best rates for Solana ecosystem\
  **Chains:** Solana only\
  **Best for:** SPL token swaps with optimal routing
</Card>

**Key Features:**

* Aggregates 30+ Solana DEXs
* Smart order routing
* Auto-slippage calculation
* Transaction priority fees
* Support for 2500+ SPL tokens

**Integrated DEXs:**

* Orca, Raydium, Serum
* Phoenix, Lifinity
* And many more

**When to Use:**

* Any Solana token swap
* Need best SPL token rates
* Complex token routes on Solana
* Small to large amounts

### 1inch

<Card className="glass-card">
  **Type:** EVM Chain Aggregator\
  **Specialty:** Optimal routing across EVM DEXs\
  **Chains:** Ethereum, Arbitrum, Base, BSC, Avalanche\
  **Best for:** EVM token swaps with gas optimization
</Card>

**Key Features:**

* Aggregates 300+ liquidity sources
* CHI gas token integration
* Partial fill support
* Complex routing algorithms
* MEV protection

**Supported EVM Chains:**

* Ethereum, Arbitrum, Base
* Binance Smart Chain
* Avalanche C-Chain
* 10+ other EVM chains

**When to Use:**

* EVM token-to-token swaps
* Need gas optimization
* Complex routing requirements
* Arbitrage opportunities

## DEX Aggregation Chains

We support multi-hop routes combining different providers:

### JUPITER → CHAINFLIP

* **Use Case:** Solana to Bitcoin/Ethereum
* **Path:** SPL tokens → SOL → FLIP → BTC/ETH
* **Benefits:** Access Solana liquidity for cross-chain

### ONEINCH → CHAINFLIP

* **Use Case:** EVM tokens to Bitcoin
* **Path:** ERC-20 → ETH → FLIP → BTC
* **Benefits:** Optimal EVM routing to cross-chain

### CHAINFLIP → ONEINCH

* **Use Case:** Bitcoin to EVM tokens
* **Path:** BTC → FLIP → ETH → ERC-20
* **Benefits:** Direct Bitcoin to any EVM token

## Provider Selection Strategy

### Automatic Selection

By default, the router queries all relevant providers and returns the best routes:

```javascript theme={null}
// Let the API choose the best provider
const quote = await fetch('/quote', {
  body: JSON.stringify({
    sellAsset: 'BTC.BTC',
    buyAsset: 'ETH.ETH',
    sellAmount: '1.0'
    // providers field omitted - uses all
  })
});
```

### Manual Provider Selection

Specify providers when you have specific requirements:

```javascript theme={null}
// Use only THORChain for maximum security
const quote = await fetch('/quote', {
  body: JSON.stringify({
    sellAsset: 'BTC.BTC',
    buyAsset: 'ETH.ETH',
    sellAmount: '1.0',
    providers: ['THORCHAIN']
  })
});

// Use multiple specific providers
const quote = await fetch('/quote', {
  body: JSON.stringify({
    sellAsset: 'BTC.BTC',
    buyAsset: 'ETH.ETH',
    sellAmount: '1.0',
    providers: ['THORCHAIN', 'CHAINFLIP']
  })
});
```

## Provider Comparison

| Provider  | Cross-Chain   | Speed             | Liquidity | Unique Features       |
| --------- | ------------- | ----------------- | --------- | --------------------- |
| THORChain | ✅ Excellent   | Medium (5-10 min) | Deep      | Native BTC, Streaming |
| Chainflip | ✅ Excellent   | Fast (1-3 min)    | Growing   | JIT AMM, Polkadot     |
| MayaChain | ✅ Good        | Medium (5-10 min) | Moderate  | Dash, CACAO           |
| Jupiter   | ❌ Solana only | Instant           | Excellent | 2500+ tokens          |
| 1inch     | ❌ EVM only    | Instant           | Excellent | 300+ sources          |

## Streaming Swaps

THORChain and MayaChain support streaming swaps for large amounts:

```javascript theme={null}
// Large swaps automatically use streaming
const largeSwap = {
  sellAsset: 'BTC.BTC',
  buyAsset: 'ETH.ETH',
  sellAmount: '10.0', // 10 BTC in decimal format
  providers: ['THORCHAIN']
};

// Track streaming progress
const tracking = await fetch('/track', {
  body: JSON.stringify({
    hash: txHash,
    chainId: 'BTC',
    quoteId: quoteId,
    routeIndex: 0
  })
});

if (tracking.data.isStreaming) {
  console.log(`Progress: ${tracking.data.streamingProgress.percentage}%`);
}
```

## Provider-Specific Features

### THORChain Memos

THORChain uses transaction memos for swap instructions:

```
=:ETH.ETH:0x...address:100:thor1...affiliate:100
```

Components:

* `=` : Swap identifier
* `ETH.ETH` : Target asset
* `0x...` : Destination address
* `100` : Slip limit (basis points)
* `thor1...` : Affiliate address
* `100` : Affiliate fee (basis points)

### Chainflip Deposit Channels

Chainflip uses unique deposit addresses:

```javascript theme={null}
{
  "inboundAddress": "0x123...", // Unique deposit address
  "depositChannel": {
    "id": "cf-123",
    "expiryBlock": 1234567
  }
}
```

### Jupiter Route Info

Jupiter provides detailed route information:

```javascript theme={null}
{
  "route": {
    "marketInfos": [
      {
        "id": "orca",
        "label": "Orca",
        "inputMint": "So11...",
        "outputMint": "EPjF..."
      }
    ]
  }
}
```

## Error Handling by Provider

Different providers return different error codes:

### THORChain Errors

* `INSUFFICIENT_LIQUIDITY` - Pool too shallow
* `TRADING_HALTED` - Chain halted
* `SLIP_TOLERANCE_EXCEEDED` - Price impact too high

### Chainflip Errors

* `PAIR_NOT_SUPPORTED` - Asset pair not available
* `AMOUNT_TOO_SMALL` - Below minimum
* `CHANNEL_EXPIRED` - Deposit channel expired

### Jupiter Errors

* `ROUTE_NOT_FOUND` - No route available
* `SLIPPAGE_TOO_HIGH` - Price impact exceeds limit
* `TOKEN_NOT_VERIFIED` - Unverified token

## Best Practices

### 1. Provider Fallbacks

```javascript theme={null}
const getQuoteWithFallback = async (params) => {
  // Try preferred provider first
  try {
    const preferredQuote = await getQuote({
      ...params,
      providers: ['CHAINFLIP'] // Fastest
    });
    if (preferredQuote.routes.length > 0) {
      return preferredQuote;
    }
  } catch (error) {
    console.log('Preferred provider failed, trying others');
  }
  
  // Fallback to all providers
  return await getQuote(params);
};
```

### 2. Provider-Specific Optimization

```javascript theme={null}
// Optimize for THORChain
const thorchainOptimized = {
  sellAmount: amount,
  slippage: 5, // THORChain handles slip well
  providers: ['THORCHAIN']
};

// Optimize for Jupiter
const jupiterOptimized = {
  sellAmount: amount,
  slippage: 1, // Tighter slippage for on-chain
  providers: ['JUPITER']
};
```

### 3. Multi-Provider Strategies

```javascript theme={null}
// Get quotes from all providers and compare
const getAllQuotes = async (params) => {
  const providers = ['THORCHAIN', 'CHAINFLIP', 'MAYACHAIN'];
  
  const quotes = await Promise.allSettled(
    providers.map(provider => 
      getQuote({ ...params, providers: [provider] })
    )
  );
  
  // Analyze results
  return quotes
    .filter(q => q.status === 'fulfilled')
    .map(q => q.value)
    .filter(q => q.routes.length > 0);
};
```
