CrossChainSwap
Documentation for eth_defi.lifi.crosschain.CrossChainSwap Python class.
- class CrossChainSwap
Bases:
objectA prepared cross-chain gas top-up swap.
Contains all information needed to execute a bridge transaction from the source chain to a target chain.
Attributes summary
Source chain ID where funds are bridged from
Target chain ID where gas is needed
Amount of source token to send (raw units: wei for native, or token decimals for ERC-20)
Value of the bridged amount in USD
Current gas balance on the target chain in USD
Minimum gas threshold that triggered this swap (USD)
Requested top-up amount in USD
Ready-to-sign transaction request from LI.FI
The LI.FI quote used to build this swap
Methods summary
__init__(source_chain_id, target_chain_id, ...)is_valid([max_age_seconds])Check if the underlying quote is still fresh enough to execute.
- source_chain_id: int
Source chain ID where funds are bridged from
- target_chain_id: int
Target chain ID where gas is needed
- from_amount_raw: int
Amount of source token to send (raw units: wei for native, or token decimals for ERC-20)
- from_amount_usd: decimal.Decimal
Value of the bridged amount in USD
- target_balance_usd: decimal.Decimal
Current gas balance on the target chain in USD
- min_gas_usd: decimal.Decimal
Minimum gas threshold that triggered this swap (USD)
- top_up_usd: decimal.Decimal
Requested top-up amount in USD
- transaction_request: dict
Ready-to-sign transaction request from LI.FI
Contains
from,to,data,value,gasLimit,gasPrice,chainId.
- quote: eth_defi.lifi.quote.LifiQuote
The LI.FI quote used to build this swap
- is_valid(max_age_seconds=120)
Check if the underlying quote is still fresh enough to execute.
Delegates to
is_valid().
- __init__(source_chain_id, target_chain_id, from_amount_raw, from_amount_usd, target_balance_usd, min_gas_usd, top_up_usd, transaction_request, quote)
- Parameters
source_chain_id (int) –
target_chain_id (int) –
from_amount_raw (int) –
from_amount_usd (decimal.Decimal) –
target_balance_usd (decimal.Decimal) –
min_gas_usd (decimal.Decimal) –
top_up_usd (decimal.Decimal) –
transaction_request (dict) –
quote (eth_defi.lifi.quote.LifiQuote) –
- Return type
None