LifiQuote
Documentation for eth_defi.lifi.quote.LifiQuote Python class.
- class LifiQuote
Bases:
objectLI.FI cross-chain quote response.
Contains all information needed to execute a cross-chain transfer, including the ready-to-sign transaction request.
Attributes summary
source_chain_idtarget_chain_idfrom_tokento_tokenfrom_amountestimate_to_amountestimate_to_amount_mingas_cost_usdexecution_durationfetched_atdataMethods summary
__init__(source_chain_id, target_chain_id, ...)Seconds elapsed since this quote was fetched.
Get the transaction request from the quote.
is_valid([max_age_seconds])Check if this quote is still fresh enough to execute.
- __init__(source_chain_id, target_chain_id, from_token, to_token, from_amount, estimate_to_amount, estimate_to_amount_min, gas_cost_usd, execution_duration, fetched_at, data)
- Parameters
- Return type
None
- get_age_seconds()
Seconds elapsed since this quote was fetched.
- Returns
Age of the quote in seconds.
- Return type
- get_transaction_request()
Get the transaction request from the quote.
This is the ready-to-sign transaction with
from,to,data,value,gasLimit,gasPrice, andchainId.- Returns
Transaction request dict from LI.FI API
- Return type
- is_valid(max_age_seconds=120)
Check if this quote is still fresh enough to execute.
The LI.FI
/v1/quoteendpoint does not return an explicit expiry timestamp. This method uses a time-based heuristic: quotes older thanmax_age_secondsare considered stale because gas prices and bridge liquidity change rapidly.