The LI.FI SDK package provides access to the LI.FI API to find and execute the best on-chain and cross-chain routes across various bridges and exchanges.
Installation
Ecosystem Providers
To execute transactions, install the provider packages for the ecosystems you need:
yarn add @lifi/sdk-provider-ethereum # For EVM chains (uses viem)
yarn add @lifi/sdk-provider-solana # For Solana (uses @solana/kit)
yarn add @lifi/sdk-provider-bitcoin # For Bitcoin (uses @bigmi/core)
yarn add @lifi/sdk-provider-sui # For Sui (uses @mysten/sui v2)
yarn add @lifi/sdk-provider-tron # For Tron (uses tronweb)
Provider packages are only required if you want to execute routes/quotes through the SDK. If you only need to request routes, quotes, or other API data, the core @lifi/sdk package is sufficient.
Check out our complete examples in the SDK repository, and feel free to file an issue if you encounter any problems.
Quick Start
Set up the SDK
Firstly, create SDK client with your integrator string.import { createClient } from '@lifi/sdk';
const client = createClient({
integrator: 'Your dApp/company name',
});
Request a quote
Now you can interact with the SDK and for example request a quote.import { ChainId, getQuote } from '@lifi/sdk';
const quote = await getQuote(client, {
fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
fromChain: ChainId.ARB,
toChain: ChainId.OPT,
fromToken: '0x0000000000000000000000000000000000000000',
toToken: '0x0000000000000000000000000000000000000000',
fromAmount: '1000000000000000000',
});
You can learn more about configuring the SDK in the next section.