Lifi

open class Lifi(api: LifiTradingApi, signAndSendTransaction: LifiSignAndSendTransaction? = null, waitForConfirmation: LifiWaitForConfirmation? = null, stepPollOptions: LifiPollStatusOptions = LifiPollStatusOptions( everyMs = 10_000L, initialDelayMs = 10_000L, timeoutMs = 600_000L ))

Lifi provider implementation for trading functionality.

This class provides access to Lifi's cross-chain trading capabilities, including routes discovery, quotes, transaction status, and step details, as well as the high-level tradeAsset bridging method.

Parameters

api

The Lifi trading API instance.

signAndSendTransaction

Closure that signs and submits an EVM transaction (injected by Portal).

waitForConfirmation

Closure that waits for on-chain confirmation (injected by Portal).

stepPollOptions

Polling configuration used per-step while executing tradeAsset.

Constructors

Link copied to clipboard
constructor(api: LifiTradingApi, signAndSendTransaction: LifiSignAndSendTransaction? = null, waitForConfirmation: LifiWaitForConfirmation? = null, stepPollOptions: LifiPollStatusOptions = LifiPollStatusOptions( everyMs = 10_000L, initialDelayMs = 10_000L, timeoutMs = 600_000L ))

Functions

Link copied to clipboard
open suspend fun getQuote(request: LifiQuoteRequest): Result<LifiQuoteResponse>

Retrieves a quote from the Lifi integration.

Link copied to clipboard

Retrieves routes from the Lifi integration.

Link copied to clipboard

Retrieves an unsigned transaction from the Lifi integration that has yet to be signed/submitted.

Link copied to clipboard

Retrieves the status of a transaction from the Lifi integration.

Link copied to clipboard
open suspend fun pollStatus(request: LifiStatusRequest, onUpdate: (LifiStatusRawResponse) -> Boolean? = null, options: LifiPollStatusOptions = LifiPollStatusOptions()): Result<LifiStatusRawResponse>

Polls the LiFi status for a transfer until it reaches a terminal state (DONE / FAILED) or times out.

Link copied to clipboard

High-level bridging method that fetches routes, executes each step sequentially (sign, confirm on-chain, poll LiFi status until terminal), and returns the resulting transaction hashes, executed steps, and the selected route.