Links

Token Transfer

After having found a suitable connection, all you need to send a transaction to your or your user's wallet is our /quote endpoint.
const getQuote = async (fromChain, toChain, fromToken, toToken, fromAmount, fromAddress) => {
const result = await axios.get('https://li.quest/v1/quote', {
params: {
fromChain,
toChain,
fromToken,
toToken,
fromAmount,
fromAddress,
}
});
return result.data;
}
const fromChain = 'DAI';
const fromToken = 'USDC';
const toChain = 'POL';
const toToken = 'USDC';
const fromAmount = '1000000';
const fromAddress = YOUR_WALLET_ADDRESS;
const quote = await getQuote(fromChain, toChain, fromToken, toToken, fromAmount, fromAddress);
If a quote for this transfer can be found, it looks like the following:
{
"id": "0x26c3922540d49bb76c12d665ea8304e976fcdce167f6b4ccec5bb5c3a2a372c1",
"type": "lifi", // this can be a 'cross' (across chains), a 'swap' (same chain), or a 'lifi' (can wrap both types of transactions internally) transaction
"tool": "hop", // the bridge or exchanged used for this transaction
"action": {
"fromChainId": 100,
"fromAmount": "1000000",
"fromToken": { ... }, // information about the token being sent
"fromAddress": ..., // the sender's address
"toChainId": 137,
"toToken": { ... }, // information about the token being received
"toAddress": ..., // the receiver's address
"slippage": 0.03
},
"estimate": {
"fromAmount": "1000000",
"toAmount": "700186",
"toAmountMin": "679180",
"approvalAddress": "0x5A9Fd7c39a6C488E715437D7b1f3C823d5596eD1",
"gasCosts": [
{
"type": "SEND",
"price": "1500000000",
"estimate": "430000",
"limit": "537500",
"amount": "645000000000000",
"amountUSD": "0.00",
"token": { ... } // information about the token that the gas is payed in
}
],
"executionDuration": 150, // estimated duration in seconds
"fromAmountUSD": "1.00",
"toAmountUSD": "0.70"
},
"includedSteps": [ // steps that will be executed internally as part of this transaction
{
"id": "7efd153c-4c25-402c-8389-5d4d3229e253",
"type": "swap",
"tool": "sushiswap-dai",
"action": {
"fromChainId": 100,
"toChainId": 100,
"fromToken": { ... },
"toToken": { ... },
"fromAmount": "1000000",
"slippage": 0.03,
"fromAddress": ...,
"toAddress": ...
},
"estimate": {
"fromAmount": "1000000",
"toAmount": "999839",
"toAmountMin": "969844",
"approvalAddress": "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
"executionDuration": 30,
"feeCosts": [
{
"name": "LP Fee",
"percentage": "0.003",
"token": { ... },
"amount": "3000"
}
],
"gasCosts": [
{
"type": "SEND",
"price": "1500000000",
"estimate": "200000",
"limit": "250000",
"amount": "300000000000000",
"amountUSD": "0.00",
"token": { ... }
}
],
"fromAmountUSD": "1.00",
"toAmountUSD": "1.00"
}
},
{
"id": "0x26c3922540d49bb76c12d665ea8304e976fcdce167f6b4ccec5bb5c3a2a372c1",
"type": "cross",
"tool": "hop",
"action": {
"fromChainId": 100,
"toChainId": 137,
"fromToken": { ... },
"toToken": { ... },
"fromAmount": "969844",
"slippage": 0.03,
"fromAddress": ...,
"toAddress": ...
},
"estimate": {
"fromAmount": "969844",
"toAmount": "700186",
"toAmountMin": "679180",
"approvalAddress": "0x76b22b8C1079A44F1211D867D68b1eda76a635A7",
"executionDuration": 120,
"feeCosts": [
{
"name": "LP Fee",
"percentage": "0.00079909758682839714",
"token": { ... },
"amount": "775"
},
{
"name": "Bonder Fee",
"percentage": "0.25792807915499812341",
"token": { ... },
"amount": "250150"
},
{
"name": "Destination Tx Fee",
"percentage": "0.01867001290929262851",
"token": { ... },
"amount": "18107"
}
],
"gasCosts": [
{
"type": "SEND",
"price": "1500000000",
"estimate": "230000",
"limit": "287500",
"amount": "345000000000000",
"amountUSD": "0.00",
"token": { ... }
}
],
"fromAmountUSD": "0.97",
"toAmountUSD": "0.70"
}
}
],
"transactionRequest": { // the ethers.js transaction request
"data": "0x2722a4a80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000003c0bcf9d7814f1a44a9311e91c7780332f1f2ea0604170a80713f9ffc6fcd3bf547000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004ecaba5870353805a9f068101a40e0f32ed605c60000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000552008c0f6870c2f77e5cc1d2eb9bdff03e30ea0000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000004ecaba5870353805a9f068101a40e0f32ed605c6000000000000000000000000ddafbb505ad214d7b80b1f830fccc89b60fb7a8300000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010438ed173900000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000ecc7400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005a9fd7c39a6c488e715437d7b1f3c823d5596ed100000000000000000000000000000000000000000000000000000000626020a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000004ecaba5870353805a9f068101a40e0f32ed605c6000000000000000000000000ddafbb505ad214d7b80b1f830fccc89b60fb7a83000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000552008c0f6870c2f77e5cc1d2eb9bdff03e30ea0000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000ecc7400000000000000000000000000000000000000000000000000000000000417e100000000000000000000000000000000000000000000000000000000000a5d0c0000000000000000000000000000000000000000000000000000000062616d7100000000000000000000000000000000000000000000000000000000000a5d0c0000000000000000000000000000000000000000000000000000000062616d7100000000000000000000000000000000000000000000000000000000000000045553444300000000000000000000000000000000000000000000000000000000",
"to": ..., // the contract address
"value": "0x00",
"from": ..., // the sender
"chainId": 100,
"gasLimit": "0x149970",
"gasPrice": "0x59682f00"
}
}
The action contains information about what exactly will happen, the estimate will contain information about the estimated outcome of the transaction.
But to send the transaction to your wallet, the transactionRequest has to be used. It is an ethers.js TransactionRequest object which can directly be passed on to a wallet.
To see what this can look like, check out the Transferring Tokens guide.

Possible Query Parameters

The /quote endpoints offer several parameters that can be used to fine-tune the result.
Parameter
Required
Description
Example
fromChain
The sending chain. Can be the chain id or chain key
DAI
toChain
The receiving chain. Can be the chain id or chain key
POL
fromToken
The token that should be transferred. Can be the address or the symbol
USDC
toToken
The token that should be transferred to. Can be the address or the symbol
MATIC
fromAddress
The sending wallet address
Your wallet address
toAddress
The receiving wallet address. If none is provided, the fromAddress will be used
Your second wallet address
fromAmount
The amount that should be sent including all decimals (e.g. 1000000 for 1 USDC (6 decimals))
1000000
order
Which kind of route should be preferred
BEST_VALUE, BEST_FEE, or BEST_FEE_GAS
slippage
The maximum allowed slippage for the transaction (0.05 represents 5%)
0.05
integrator
A string containing tracking information about the integrator of the API
SirSwapALot
fee
The percent of the integrator's fee that is taken from every transaction. 0.02 represents 2%. The maximum fee amount is 10%.
0.02
referrer
A string containing tracking information about the referrer of the integrator
ADevotedCustomer
allowBridges
List of bridges that are allowed for this transaction
multichain,connext
allowExchanges
List of exchanges that are allowed for this transaction
1inch,paraswap
denyBridges
List of bridges that are not allowed for this transaction
cbridge,optimism
denyExchanges
List of exchanges that are not allowed for this transaction
openocean
preferBridges
List of bridges that should be preferred for this transaction
connext
preferExchanges
List of exchanges that should be preferred for this transaction
1inch
The bridges we currently support are: hop, multichain, cbridge, connext, hyphen, optimism, polygon, arbitrum and avalanche.
The currently available exchanges are 1inch, paraswap, openocean, 0x and a lot of dexes.
For a complete and up-to-date list, please refer to our API documentation.