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:
1
const lifi = new LIFI(config)
Copied!
The optional config parameter can be used to pass custom configuration to the SDK:
1
type ConfigUpdate = {
2
apiUrl?: string
3
rpcs?: Record<number, string[]>
4
multicallAddresses?: Record<number, string | undefined>
5
defaultExecutionSettings?: ExecutionSettings
6
defaultRouteOptions?: RouteOptions
7
}
Copied!
The apiUrl defines which backend should be called. This only has to be edited when having access to a dedicated API endpoint.
If you are interested in a dedicated API endpoint for your service, reach out via our Discord Channel or via Telegram: @philippzentner
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 the ExecutionSettings is available here.
Copy link