Skip to main content

Create Client

To get started, you need to create an SDK client for the LI.FI SDK. This client contains the shared settings and data required for the proper functioning of other SDK features that developers will use. The client can be configured with providers and used throughout your application.

Parameters

To learn how to use routeOptions for monetization, including configuring fees, see the Monetize the SDK guide.
Setting up providers is not required if you are using the SDK solely to access the LI.FI API without quote/route SDK execution functionality and plan to handle the execution independently. Providers can be added later using the client.setProviders() method.

Setting custom RPC URLs

In a production app, it is recommended to pass through your authenticated RPC provider URL (Alchemy, Infura, Ankr, etc).If no RPC URLs are provided, LI.FI SDK will default to public RPC providers.Public RPC endpoints (especially Solana) can sometimes rate-limit users depending on location or during periods of heavy load, leading to issues such as incorrectly displaying balances or errors with transaction simulation.

Client Methods

The SDK client provides various methods to access configuration and manage providers. All methods are called on the client instance.

Client API

Example: Using Client Methods