For the complete documentation index, see llms.txt. This page is also available as Markdown.

Cross-chain Swaps and Bridging

Most users don't start their journey on Somnia, their assets live on Ethereum, Arbitrum, Base, Solana, and dozens of other chains. To grow your dApp, you need a smooth way to move that liquidity into, out of, and across the Somnia ecosystem.

There are two ways to bring assets across, depending on who is doing the work:

  • For end users (no code): Somnia's official bridge partners, Relay and Stargate Finance, let anyone bridge assets through their own interfaces. If you just need users to move funds and don't want to build any UI, point them to the Bridging Info guide.

  • For developers (this section): embed swaps and bridging directly inside your dApp with the LI.FI SDK, so users never have to leave your app.


Why LI.FI for in-app bridging

LI.FI is the routing and execution layer for cross-chain liquidity. A single integration aggregates dozens of bridges and DEX aggregators across 50+ chains (including Somnia's official partners Relay and Stargate) normalises token standards, picks the optimal route, and monitors execution for you.

In other words, integrating LI.FI doesn't replace Relay or Stargate, it routes through them (and many others) and chooses the best option per transfer. A live USDC transfer from Arbitrum to Somnia, for example, is currently routed via Stargate under the hood.

LI.FI is infrastructure. It does the routing and execution, while you own the user experience. (The same way Jumper Exchange is LI.FI's own front-end, your dApp becomes its own bridge/swap interface.)

You'll learn how to:


Choosing an integration path

LI.FI offers several integration surfaces. This section focuses on the SDK, which gives you full programmatic control over the route lifecycle.

Path
Best for
Effort

SDK (@lifi/sdk)

Custom swap/bridge flows where you build the UI and control every step

Medium

Widget (@lifi/widget)

Dropping a ready-made, themeable swap/bridge UI into a React app

Low

REST API (li.quest/v1)

Backend services, bots, and AI agents that construct requests directly

Medium

Bridge UIs (Relay / Stargate)

End users moving funds manually — no integration needed

None

Whichever path you choose, LI.FI's official documentation is the source of truth for the latest implementation details: https://docs.li.fi.

Somnia at a glance — when configuring LI.FI for Somnia, use Chain ID 5031, native currency SOMI (18 decimals), RPC https://api.infra.mainnet.somnia.network/. Always confirm live route and token support with the LI.FI API before going to production (see the SDK guide).

Last updated