Introduction to SDK Ecosystem Providers
The LI.FI SDK supports different blockchain ecosystems, allowing you to integrate with EVM, Solana, Bitcoin, Sui, and Tron networks. Internally, providers act as abstractions for each ecosystem, handling crucial tasks such as address resolution, balance checking, and transaction handling during route/quote execution. These ecosystem providers are designed with modularity in mind and are fully tree-shakable, ensuring that they do not add unnecessary weight to your bundle if not used. The SDK offers five provider packages, each with similar configuration options respective to their ecosystems:@lifi/sdk-provider-ethereum- For EVM-compatible chains@lifi/sdk-provider-solana- For Solana@lifi/sdk-provider-bitcoin- For Bitcoin (UTXO)@lifi/sdk-provider-sui- For Sui@lifi/sdk-provider-tron- For Tron
Different types of wallets/accounts
To executeGET /quote or POST /advanced/routes via a specific provider, that provider must be capable of signing transactions. SDK providers support signing transactions over the following types of wallets/accounts:
- Local Accounts (e.g. private key/mnemonic wallets).
- JSON-RPC Accounts (e.g. Browser Extension Wallets, WalletConnect, etc.).
window.ethereum, and managing the user’s account within the browser or mobile context. This setup is popular among dApps UIs and is often used together with libraries like Wagmi, @solana/wallet-adapter-react, or @mysten/dapp-kit.
These account types and interaction methods allow developers to choose the most suitable approach for integrating the SDK with their applications.
Setup EVM Provider
The EVM provider execution logic is built based on theViem library, using some of its types and terminology.
Options available for configuring the EVM provider:
getWalletClient: A function that returns a ViemClientinstance (typically aWalletClientcreated viacreateWalletClient).switchChain: A hook for switching between different networks. Returns an updatedClientfor the target chain.disableMessageSigning: An optional boolean to disable EIP-712 message signing (e.g., for Permit approvals). Useful for wallets or smart accounts that do not support typed data signing.fallbackTransportConfig: Optional Viem fallback transport configuration.safeApiKey: Optional Safe API key for Safe multisig wallets.
Local Accounts
When using local accounts, developers need a predefined list of chains they plan to interact with in order to switch chains during transaction execution. These chains can be either from theviem/chains package or fetched from LI.FI API and adopted to viem’s Chain type.
Here’s a basic example using chains from viem/chains:
JSON-RPC Accounts
The best way to interact with JSON-RPC accounts and passWalletClient to the EthereumProvider is to use the Wagmi library. Developers can configure Wagmi chains either by using chains from the viem/chains package or fetching chains from the LI.FI API and adapting them to Viem’s Chain type.
Below is a simplified example of how to set up the EVM provider using chains from the LI.FI API in conjunction with Wagmi and React.
We provide a useSyncWagmiConfig hook that synchronizes fetched chains with the Wagmi configuration and updates connectors. Please note that we do not initialize the Wagmi configuration with connectors. Additionally, we set reconnectOnMount to false since the reconnect action will be called within useSyncWagmiConfig hook after the chains are synchronized with the configuration and connectors.
Update provider configuration
Additionally, providers allow for dynamic updates to its initial configuration via thesetOptions function.
Here’s an example of how to modify the initial configuration for EthereumProvider:
Support for Ethers.js and other alternatives
Developers can still use Ethers.js or any other alternative Web3 library in their project and convertSigner/Provider objects to Viem’s WalletClient before passing it to the EVM provider configuration.
Setup Solana Provider
The Solana provider execution logic is built based on the @solana/kit library and the Wallet Standard, using some of their types and terminology. Options available for configuring the Solana provider:getWallet: A function that returns a Wallet StandardWalletinstance.skipSimulation: An optional boolean to skip transaction simulation before sending (default:false).
Local Wallet
Standard Solana libraries do not offer a built-in method for creating a wallet-standard wallet directly from a private key. To address this limitation, we provide theKeypairWalletAdapter. This custom adapter enables users to create a wallet from a base58-encoded secret key.
It is worth noting that the KeypairWalletAdapter is designed specifically for backend or testing purposes and should not be used in user-facing code to prevent the risk of exposing your private key.
JSON-RPC Wallet
To interact with user wallets and pass a wallet-standardWallet to the Solana provider, we recommend using the @solana/wallet-adapter-react library. The wallet.adapter from useWallet() implements the wallet-standard Wallet interface. Unlike Wagmi, Solana configuration for React does not have global configurations. Therefore, we need to use React hooks to update the SDK configuration at runtime.
Below is a simplified example of how to set up the Solana provider.
Setup Sui Provider
The Sui provider execution logic is built based on the @mysten/sui v2 library, using some of its types and terminology. Options available for configuring the Sui provider:getClient: A function that returns aClientWithCoreApiinstance (from@mysten/sui/client).getSigner: A function that returns aSignerinstance (from@mysten/sui/cryptography).
JSON-RPC Wallet
To interact with user wallets (like Sui Wallet, etc.) and pass a client and signer to the Sui provider, we recommend using the @mysten/dapp-kit library. Below is a simplified example of how to set up the Sui provider with user wallets.Setup UTXO (Bitcoin) Provider
The Bitcoin provider execution logic is built based on the Bigmi library, using some of its types and terminology. Options available for configuring the UTXO provider:getWalletClient: A function that returns aClientinstance (from@bigmi/core).
JSON-RPC Wallet
To interact with user wallets like Phantom, Xverse, use thegetConnectorClient action to return the Bigmi Client object required by the SDK.
Setup Tron Provider
The Tron provider execution logic is built based on the TronWeb library and the @tronweb3/tronwallet-abstract-adapter adapter interface. Options available for configuring the Tron provider:getWallet: A function that returns anAdapterinstance (from@tronweb3/tronwallet-abstract-adapter).multicallBatchSize: An optional number to configure the batch size for multicall balance requests.
JSON-RPC Wallet
To interact with user wallets (like TronLink), pass anAdapter to the Tron provider using the @tronweb3/tronwallet-adapter-react-hooks library.
Below is a simplified example of how to set up the Tron provider.
SDKProviders.tsx

