2️⃣Set up the SDK
After you have installed the SDK, you first need to set it up.
To get started, you have to instantiate and configure the LI.FI SDK:
The optional config
parameter can be used to pass custom configuration to the SDK:
The apiUrl
defines which backend should be called. This only has to be edited when accessing a dedicated API endpoint.
The apiKey
allows you to authenticate on the API. This will give you access to custom rate limits. Check our API documentation for information on how to apply for an API key.
rpcs
or multicallAddresses
can be passed if custom endpoints/addresses should be used, for example to prevent rate limiting.
The RouteOptions
are explained in more detail here. An explanation of ExecutionSettings
is available here.
Node.js Compatibility
SDK uses native Fetch API and in Node.js 16 and lower versions fetch
is not natively included, so it needs to be added manually. To provide access to Fetch API you need to patch global
object using node-fetch or cross-fetch.
Here is an example using cross-fetch:
Last updated