> ## Documentation Index
> Fetch the complete documentation index at: https://anypay-docs-sdk-0-15-0-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Route Providers

> Configure and optimize route providers for cross-chain interactions

## Route Providers

Trails integrates with multiple liquidity sources and bridge providers to find the best routes for your cross-chain transactions. You can specify preferred providers for swapping and bridging, or let Trails automatically select the optimal ones.

## Available Providers

* **`AUTO`** (recommended): Automatically selects the best provider based on the route
* **`RELAY`**: Uses Relay for fast bridging operations
* **`CCTP`**: Uses Circle's Cross-Chain Transfer Protocol for USDC transfers
* **`SUSHI`**: Uses SushiSwap for on-chain swaps
* **`ZEROX`**: Uses 0x protocol for DEX aggregation
* **`LZ_OFT`**: Uses LayerZero Omnichain Fungible Token bridge
* **`LZ_STARGATE`**: Uses LayerZero Stargate for native asset bridging
* **`GASZIP`**: Uses Gas.zip for gas-optimized routing

## Configuration

### Widget-level configuration

Specify route providers on any focused component:

```tsx theme={null}
import { Swap } from '0xtrails/widget'

<Swap
  apiKey="YOUR_API_KEY"
  swapProvider="SUSHI"    // Provider for on-chain swaps
  bridgeProvider="RELAY"  // Provider for cross-chain bridging
  from={{ currency: "USDC", chain: "ethereum" }}
  to={{ currency: "USDC", chain: "base" }}
/>
```

### Hook-level configuration

When using the `useQuote` hook, you can specify both swap and bridge providers:

```tsx theme={null}
import { useQuote, RouteProvider } from '0xtrails'

const { quote, send } = useQuote({
  walletClient,
  from: {
    token: 'USDC',
    chain: 'ethereum',
    amount: '1', // human-readable USDC amount
  },
  to: {
    token: 'USDC',
    chain: 'base',
  },
  swapProvider: 'AUTO',    // Optional: defaults to AUTO
  bridgeProvider: 'RELAY', // Optional: specify preferred bridge
})
```

## Provider Details

### AUTO (recommended)

The `AUTO` setting lets Trails intelligently select the best provider for each transaction based on cost, speed, liquidity, and reliability. Use this unless you have a specific reason to lock to a particular provider.

```tsx theme={null}
<Swap
  apiKey="YOUR_API_KEY"
  swapProvider="AUTO"    // Default
  bridgeProvider="AUTO"  // Default
/>
```

### Relay

Relay provides fast cross-chain transfers through an intent-based filler network. Fillers front the destination execution and settle asynchronously.

* Fast finality on most routes
* Competitive fees
* Good coverage across major EVM chains

```tsx theme={null}
<Swap apiKey="YOUR_API_KEY" bridgeProvider="RELAY" />
```

### CCTP

Circle's Cross-Chain Transfer Protocol enables native USDC bridging without wrapped tokens. There is no slippage — 1 USDC in equals 1 USDC out.

* Available on Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche
* No wrapped USDC; transfers use Circle's burn-and-mint mechanism
* Best choice when users need exact USDC amounts at destination

```tsx theme={null}
<Swap
  apiKey="YOUR_API_KEY"
  bridgeProvider="CCTP"
  to={{ currency: "USDC" }}
/>
```

### SushiSwap

SushiSwap provides on-chain swap routing using its V3 concentrated liquidity pools across multiple EVM chains.

* Available on most major chains
* Works well when deep Sushi liquidity exists for the token pair

```tsx theme={null}
<Swap apiKey="YOUR_API_KEY" swapProvider="SUSHI" />
```

### 0x Protocol

0x aggregates liquidity across multiple DEXs to find optimal swap rates. It optimizes for both price and gas.

```tsx theme={null}
<Swap apiKey="YOUR_API_KEY" swapProvider="ZEROX" />
```

### LayerZero (LZ\_OFT / LZ\_STARGATE)

LayerZero is an omnichain messaging protocol that powers two distinct bridge providers:

**LZ\_OFT** — Omnichain Fungible Token bridge. Used for tokens that have native OFT deployments across chains (no wrapping, direct cross-chain transfers). Live since late February 2025.

**LZ\_STARGATE** — Stargate protocol routes native assets across chains using a unified liquidity pool model, minimizing slippage on stable assets.

* Both providers expand coverage to chains and tokens not served by Relay or CCTP
* AUTO will select the appropriate LayerZero route when it is optimal

```tsx theme={null}
<Swap apiKey="YOUR_API_KEY" bridgeProvider="LZ_OFT" />    // For OFT-enabled tokens
<Swap apiKey="YOUR_API_KEY" bridgeProvider="LZ_STARGATE" /> // For Stargate native asset routes
```

### Gas.zip

Gas.zip is a gas-optimized routing provider that reduces the total gas cost of cross-chain transactions. Shipping with v1.5.

* Useful when minimizing gas costs is the priority over speed
* AUTO will select Gas.zip when it provides the best cost efficiency

```tsx theme={null}
<Swap apiKey="YOUR_API_KEY" bridgeProvider="GASZIP" />
```

## Best Practices

1. **Use `AUTO` by default**: Let Trails optimize the route for you.
2. **USDC transfers**: Use `CCTP` for guaranteed 1:1 native USDC bridging.
3. **Fast bridging**: Use `RELAY` when speed is the priority.
4. **Gas-sensitive routes**: Use `GASZIP` or leave as `AUTO` to minimize fees.
5. **Separate swap and bridge**: `swapProvider` controls same-chain DEX routing; `bridgeProvider` controls the cross-chain transport layer.
6. **Fallback support**: Set `swapProviderFallback: true` or `bridgeProviderFallback: true` to automatically fall back to another provider if your preferred one is unavailable.
