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:
const lifi = new LIFI(config)
The optional config parameter can be used to pass custom configuration to the SDK:
type ConfigUpdate = {
apiUrl?: string
rpcs?: Record<number, string[]>
multicallAddresses?: Record<number, string | undefined>
defaultExecutionSettings?: ExecutionSettings
defaultRouteOptions?: RouteOptions
}
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