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

# Swaps

> Integrate cross-chain and same-chain swaps in your app

deBridge enables **cross-chain and same-chain swaps** from a single integration — with unified liquidity and non-custodial
execution.

Depending on your product and UX needs, you can integrate swaps in two different ways:

## deBridge Liquidity Network API

Full programmatic control over swaps using the proven DLN infrastructure. The deBridge Liquidity Network follows a familiar
**transaction-based model** — users sign and submit transactions directly, paying gas on the source chain.

* **Same-chain swaps**: Supported via [Same-Chain Swaps API](/dln-details/integration-guidelines/same-chain-swaps/executive)
* **Cross-chain swaps**: Full support with [PostHooks](/home/use-cases/hooks)
* **User experience**: Traditional — user pays gas on source chain

**Best for**: Integrations where users are comfortable with standard transaction flows

[DLN API Quickstart](/dln-details/integration-guidelines/order-creation/creating-order/quick-start) |
[API Documentation](/dln-details/integration-guidelines/order-creation/creating-order/quick-start)

## Widget

The fastest way to add swap functionality. The Widget is a drop-in UI component that uses the deBridge Liquidity Network API under
the hood.

* **Same-chain swaps**: Supported
* **Cross-chain swaps**: Supported
* **Customization**: Theme, default chains/tokens, supported assets

**Best for**: Quick integration with pre-built UI

[Widget Documentation](/dln-details/widget/deBridge-widget)

## Quick Comparison

| Aspect                | DLN API                                                                                 | Widget                                                                                  |
| --------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| **Same-chain swaps**  | Yes                                                                                     | Yes                                                                                     |
| **Cross-chain swaps** | Yes                                                                                     | Yes                                                                                     |
| **Fee structure**     | [Flat + %](/dln-details/overview/fee-structure#order%E2%80%91creation-fees-always-paid) | [Flat + %](/dln-details/overview/fee-structure#order%E2%80%91creation-fees-always-paid) |
| **Custom UI**         | Full control                                                                            | Limited                                                                                 |
| **Hooks support**     | Yes (After-trade only)                                                                  | Yes (After-trade only)                                                                  |
| **Execution model**   | Transaction-based                                                                       | Transaction-based                                                                       |

## How Swaps Work (High-Level)

1. **Define a swap** e.g. "Swap SOL on Solana to USDC on Base"
2. **deBridge finds routes & liquidity** The protocol identifies the best path for the swap, whether same-chain or cross-chain.
3. **Execution & settlement** The user signs and submits one transaction on the source chain, locking the input tokens.
4. **User receives tokens**
   * **Same-chain** swaps execute atomically, within the same transaction they were created in.
   * **Cross-chain** swaps are fulfilled by supplying the requested tokens on the destination chain, typically within a few
     seconds.

<Note>
  deBridge protocol is comlpetely decentralized, and deBridge has no way of holding user funds. Should users choose to
  [cancel](/dln-details/integration-guidelines/order-creation/cancelling-order) a cross-chain order, they can do so before the order
  is filled on the destination chain.

  Partners can also request to enable [auto-cancellations](/dln-details/affiliates/auto-cancellations) for their integrations.
</Note>

## Swap Use Cases

* **Wallets & portfolio apps** — Add cross-chain and same-chain swaps directly into wallet interfaces, letting users trade any
  token across chains without leaving the app.
* **Trading platforms & DEX aggregators** — Offer same-chain best-price execution via adaptive slippage alongside cross-chain
  swaps, all through a single API.
* **DeFi protocols routing liquidity** — Move or rebalance protocol-owned liquidity across chains programmatically, with
  guaranteed rates and zero slippage regardless of order size.
* **Cross-chain onboarding & workflows** — Combine a swap with follow-up actions using [Hooks](/home/use-cases/hooks): buy a token
  on a new chain, top up native gas, and deposit into a protocol, all in a single transaction.

## Next Steps

* [DLN API Quickstart](/dln-details/integration-guidelines/order-creation/creating-order/quick-start)
* [Widget Integration](/dln-details/widget/deBridge-widget)
* [Same-Chain Swaps](/dln-details/integration-guidelines/same-chain-swaps/executive)

<AccordionGroup>
  <Accordion title="Do swaps work for both same-chain and cross-chain?">
    Yes — both options support same-chain and cross-chain swaps.
  </Accordion>

  <Accordion title="Are swaps non-custodial?">
    Yes. deBridge never takes custody of user funds. Assets are delivered directly to the destination wallet.
  </Accordion>

  <Accordion title="What fees do users pay?">
    * DLN API / [Widget](/dln-details/widget/deBridge-widget): Flat fee + percentage fee
  </Accordion>

  <Accordion title="Can I customize the swap UI?">
    * DLN API: Full control - [Widget](/dln-details/widget/deBridge-widget): Limited customization
  </Accordion>
</AccordionGroup>
