To onboard users to a new chain they need both tokens they can bridge via LI.FI and some gas to be able to submit their first transactions. LI.Fuel helps to do both in one transaction.
Note: currently enabled only for ETH, POL, Gnosis and SOL.
LI.Fuel allows to receive a part of the bridged tokens as gas on the destination chain. This is possible by adding the fromAmountForGas
to a quote or routes request:
Add fromAmountForGas
to the quote
Sending out 0.01 ETH on Ethereum and use 0.001 of it for LI.Fuel: https://etherscan.io/tx/0x4f7dd60440d43800ed0f81410720d3f206ff11bcc80c375478f2c54b8f51d136
Delivered gas (0.287 MATIC on Polygon): https://polygonscan.com/tx/0x66011514291d69f4c05be15de207f7ba887f7beaceb0dec504cda28a28f6c96b
Delivered token (0.00899 WETH on Polygon): https://polygonscan.com/tx/0x0da187e326e3914ac3390270faaf78352eed557c8b336f8a4d1b98d2373966ea
A user is on Ethereum and wants to transfer 5 USDC to Polygon.
Check if a user has gas on the destination chain (Polygon):
If a user has no gas on the destination chain we need to find out how much gas would be good to have on Polygon. The /gas/suggestion
endpoint provides that information. Optionally, the token a user is currently sending can be added to the request to calculate how much of that token should be swapped into gas:
Knowing these recommendations, any value between the USD amount of the service fee and the limit can be chosen. We would suggest using the recommended amount as default. As we passed the token (USDC) the user wants to pay with, we can use the received fromAmount
parameter which is the amount of USDC the user needs to pay on Ethereum to get the recommended amount of gas on the destination chain. In this example, it is 240000
. To include this in a route add the value as fromAmountForGas: 240000
.
In a quote request:
In a routes request:
Submit the quote/route as any other cross-chain route. In the transaction the funds are split automatically to send the requested amount to LI.Fuel, and the rest to the selected bridge. Monitor the transfer using the status endpoint.
(optional) LI.Fuel is designed to pay out gas to the user quickly, so he already has the gas when the other bridged assets arrive. It is not required to check the status of the gas delivery but it can be done by passing the transaction hash from the source chain to this endpoint: