Skip to main content

Overview

Li.Fi is a bridging platform that allows users to swap various tokens on different chains. In this guide, we’ll walk through how to use Turnkey wallets to sign transactions that interact with Li.Fi and bridging between ETH and SOL. We’ll demonstrate this using the with-lifi example, which integrates Turnkey, Ethereum, Solana, and LiFi.

Getting started

Before you begin, make sure you’ve followed the Turnkey Quickstart guide.
You should have:
  • A Turnkey organization and Auth Proxy Config ID
  • Once you generate an account with the example, the account funded with ETH
Its not required, but it will be helpful to have a Li.Fi API key, it will prevent you from being rate limited (see the Li.Fi Partner Portal).

Install dependencies

Setting up the Turnkey wallet

We’ll use the @turnkey/react-wallet-kit package to authenticate and load a Turnkey wallet in the browser.

Setting up Li.Fi

We’ll make calls to the Li.Fi API to retrieve quotes for the bridge transaction. GetQuote is used for a price estimate and also responds with a transactionRequest which needs to be signed and broadcasted. GetStatus is used to retrieve the status and other information of the bridge transaction.

Creating a EVM -> SVM swap

Creating a SVM -> EVM swap

Check the status of a bridge

After a transaction has been sent to create a bridge transaction you can check the status of receiving the asset on the other side with this Li.Fi API endpoint: https://docs.li.fi/api-reference/check-the-status-of-a-cross-chain-transfer. This can be used to show different states in your application.

Summary

✅ You’ve now learned how to:
  • Authenticate with Turnkey via @turnkey/react-wallet-kit
  • Create EVM -> SVM swaps with Li.Fi
  • Create SVM -> EVM swaps with Li.Fi
  • Check the status of your Li.Fi bridge transaction