Skip to main content
This recipe shows how to add swaps of Ripio’s wFiat stablecoins to your product with LI.FI, a routing layer that aggregates DEXs, solvers and bridges behind one API. With a single quote endpoint you can let users swap wFiat against USDC, swap one local stablecoin for another, or pay from any token on any chain and deliver wFiat on the destination.
Ripio doesn’t operate LI.FI or the venues it routes through. Swaps execute on third-party protocols at the prices they offer, so the amount received depends on the route LI.FI selects at quote time and can differ from the estimate.

What you can build

Swap wFiat and USDC

Let users move between their local currency and dollars on-chain: wARS to USDC, USDC to wBRL.

Local-to-local FX

Swap one local stablecoin for another in one transaction, for example wARS to wBRL.

Receive wFiat from any chain

The payer sends any token on any chain, and the recipient gets wMXN on Base.

How it works

1

Get a quote

GET /v1/quote returns a route for the pair and amount, the estimated and minimum output, the fees, and a transactionRequest ready to sign.
2

Approve the token

If the source token is an ERC-20, the user approves the approvalAddress from the quote to spend fromAmount.
3

Send the transaction

The user signs and sends the transactionRequest. Same-chain swaps settle in that transaction.
4

Track the status

For cross-chain routes, poll GET /v1/status until the transfer is DONE or FAILED.
LI.FI’s API doesn’t require an API key: one only raises your rate limits. LI.FI charges a fixed 0.25% fee on each transaction, and you can add your own fee on top (see Monetize the integration).

Token addresses

LI.FI recognizes the wFiat token addresses on Ethereum, Base, World Chain, BNB Smart Chain, Polygon, Gnosis and Celo. Each token uses the same address on every EVM chain, with 18 decimals. See Contracts for the full network list.

Recipe

The examples below use the LI.FI REST API with viem, on Base and Arbitrum. The same calls work on any chain above: add it to the client map and change the chain IDs and token addresses. LI.FI quotes run against mainnet and wFiat isn’t deployed on testnets, so test with small amounts.

0. Setup

Resolve token addresses from your own config or from LI.FI’s GET /v1/token, never from a symbol alone.

1. Get a quote

quote.ts
A quote for 100,000 wARS to USDC on Base:
Show toAmount and the fees before the user confirms, and request a new quote if they wait: prices move. A 0.5% slippage is a reasonable starting point for wFiat and USDC pairs; a lower value protects the user more but reverts more often. LI.FI also skips routes above 10% price impact by default (maxPriceImpact).

2. Approve the source token

approve.ts

3. Send the transaction

execute.ts
For a same-chain swap, the user has the output token once this transaction is confirmed. If the market moved past slippage the transaction reverts and the user keeps the source token, minus the gas paid for the failed transaction: request a new quote and try again.

4. Swap one local stablecoin for another

Local-to-local FX is the same call with two wFiat. For example, wARS to wBRL on Base:
LI.FI picks the route: a direct pool or solver when one exists, or a path through USDC.

5. Receive wFiat from any chain

To let someone pay from another chain and deliver wFiat to a recipient, set a different toChain and the recipient as toAddress. For example, a payer sends 50 USDC on Arbitrum and a merchant receives wMXN on Base. executeQuote switches the payer’s wallet to Arbitrum, the source chain, before signing:
Then track the transfer until it lands:
status.ts
DONE and FAILED are final. Check substatus on a DONE transfer: COMPLETED means the recipient got the requested token, while PARTIAL or REFUNDED mean they received a different token or the payer got the funds back. Compare receiving.amount with the quote’s toAmountMin. See LI.FI’s status tracking guide.
Moving the same wFiat between chains? Use the Ripio Bridge instead: it burns the token on the source chain and mints it on the destination, with a single contract call.

Embed the LI.FI widget

If you’d rather not build the swap UI, LI.FI’s React widget handles quotes, approvals, execution and status. Preconfigure it with wFiat as the destination, and add the wFiat you want users to pick, since the widget’s default token list doesn’t include every wFiat on every chain:
swap-widget.tsx
In Next.js, render the widget on the client only, and connect wallets through your existing wagmi setup or LI.FI’s Ethereum provider package. See the widget’s install and compatibility guides.

LI.FI Widget docs

Install the widget and configure chains, tokens, theme and wallet management.

Monetize the integration

Add fee to the quote (for example fee=0.003 for 0.3%) together with your integrator string to take a commission on every swap. The fee is deducted from the source token and appears in feeCosts next to LI.FI’s. Create an integrator account and set the wallet that receives your fees in the LI.FI Partner Portal. See Monetizing the integration.

Rate limits and API key

Without an API key, /quote allows 75 requests per two hours, which is enough to test but not for production. An API key defaults to 100 requests per minute, applied over a two-hour rolling window. Request a key in the Partner Portal and send it as the x-lifi-api-key header from your backend only: never expose it in the browser. A 429 response with error code 1005 means you hit the limit. See LI.FI’s rate limits.

Resources

Questions about wFiat? Write to [email protected]. For routing and integration questions, contact LI.FI.