Requesting a Quote
Get a quote and a prefilled transaction for a desired token transfer.
The full API documentation for our /quote endpoint can be found here.
After having found a suitable connection, all you need to send a transaction to your or your user's wallet is our /quote endpoint.
1
const getQuote = async (fromChain, toChain, fromToken, toToken, fromAmount, fromAddress) => {
2
const result = await axios.get('https://li.quest/v1/quote', {
3
params: {
4
fromChain,
5
toChain,
6
fromToken,
7
toToken,
8
fromAmount,
9
fromAddress,
10
}
11
});
12
return result.data;
13
}
14
​
15
const fromChain = 'DAI';
16
const fromToken = 'USDC';
17
const toChain = 'POL';
18
const toToken = 'USDC';
19
const fromAmount = '1000000';
20
const fromAddress = YOUR_WALLET_ADDRESS;
21
​
22
const quote = await getQuote(fromChain, toChain, fromToken, toToken, fromAmount, fromAddress);
Copied!
If a quote for this transfer can be found, it looks like the following:
1
{
2
"id": "0x26c3922540d49bb76c12d665ea8304e976fcdce167f6b4ccec5bb5c3a2a372c1",
3
"type": "lifi", // this can be a 'cross' (across chains), a 'swap' (same chain), or a 'lifi' (can wrap both types of transactions internally) transaction
4
"tool": "hop", // the bridge or exchanged used for this transaction
5
"action": {
6
"fromChainId": 100,
7
"fromAmount": "1000000",
8
"fromToken": { ... }, // information about the token being sent
9
"fromAddress": ..., // the sender's address
10
"toChainId": 137,
11
"toToken": { ... }, // information about the token being received
12
"toAddress": ..., // the receiver's address
13
"slippage": 0.03
14
},
15
"estimate": {
16
"fromAmount": "1000000",
17
"toAmount": "700186",
18
"toAmountMin": "679180",
19
"approvalAddress": "0x5A9Fd7c39a6C488E715437D7b1f3C823d5596eD1",
20
"gasCosts": [
21
{
22
"type": "SEND",
23
"price": "1500000000",
24
"estimate": "430000",
25
"limit": "537500",
26
"amount": "645000000000000",
27
"amountUSD": "0.00",
28
"token": { ... } // information about the token that the gas is payed in
29
}
30
],
31
"executionDuration": 150, // estimated duration in seconds
32
"fromAmountUSD": "1.00",
33
"toAmountUSD": "0.70"
34
},
35
"includedSteps": [ // steps that will be executed internally as part of this transaction
36
{
37
"id": "7efd153c-4c25-402c-8389-5d4d3229e253",
38
"type": "swap",
39
"tool": "sushiswap-dai",
40
"action": {
41
"fromChainId": 100,
42
"toChainId": 100,
43
"fromToken": { ... },
44
"toToken": { ... },
45
"fromAmount": "1000000",
46
"slippage": 0.03,
47
"fromAddress": ...,
48
"toAddress": ...
49
},
50
"estimate": {
51
"fromAmount": "1000000",
52
"toAmount": "999839",
53
"toAmountMin": "969844",
54
"approvalAddress": "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
55
"executionDuration": 30,
56
"feeCosts": [
57
{
58
"name": "LP Fee",
59
"percentage": "0.003",
60
"token": { ... },
61
"amount": "3000"
62
}
63
],
64
"gasCosts": [
65
{
66
"type": "SEND",
67
"price": "1500000000",
68
"estimate": "200000",
69
"limit": "250000",
70
"amount": "300000000000000",
71
"amountUSD": "0.00",
72
"token": { ... }
73
}
74
],
75
"fromAmountUSD": "1.00",
76
"toAmountUSD": "1.00"
77
}
78
},
79
{
80
"id": "0x26c3922540d49bb76c12d665ea8304e976fcdce167f6b4ccec5bb5c3a2a372c1",
81
"type": "cross",
82
"tool": "hop",
83
"action": {
84
"fromChainId": 100,
85
"toChainId": 137,
86
"fromToken": { ... },
87
"toToken": { ... },
88
"fromAmount": "969844",
89
"slippage": 0.03,
90
"fromAddress": ...,
91
"toAddress": ...
92
},
93
"estimate": {
94
"fromAmount": "969844",
95
"toAmount": "700186",
96
"toAmountMin": "679180",
97
"approvalAddress": "0x76b22b8C1079A44F1211D867D68b1eda76a635A7",
98
"executionDuration": 120,
99
"feeCosts": [
100
{
101
"name": "LP Fee",
102
"percentage": "0.00079909758682839714",
103
"token": { ... },
104
"amount": "775"
105
},
106
{
107
"name": "Bonder Fee",
108
"percentage": "0.25792807915499812341",
109
"token": { ... },
110
"amount": "250150"
111
},
112
{
113
"name": "Destination Tx Fee",
114
"percentage": "0.01867001290929262851",
115
"token": { ... },
116
"amount": "18107"
117
}
118
],
119
"gasCosts": [
120
{
121
"type": "SEND",
122
"price": "1500000000",
123
"estimate": "230000",
124
"limit": "287500",
125
"amount": "345000000000000",
126
"amountUSD": "0.00",
127
"token": { ... }
128
}
129
],
130
"fromAmountUSD": "0.97",
131
"toAmountUSD": "0.70"
132
}
133
}
134
],
135
"transactionRequest": { // the ethers.js transaction request
136
"data": "0x2722a4a80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000003c0bcf9d7814f1a44a9311e91c7780332f1f2ea0604170a80713f9ffc6fcd3bf547000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004ecaba5870353805a9f068101a40e0f32ed605c60000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000552008c0f6870c2f77e5cc1d2eb9bdff03e30ea0000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000004ecaba5870353805a9f068101a40e0f32ed605c6000000000000000000000000ddafbb505ad214d7b80b1f830fccc89b60fb7a8300000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010438ed173900000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000ecc7400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000005a9fd7c39a6c488e715437d7b1f3c823d5596ed100000000000000000000000000000000000000000000000000000000626020a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000004ecaba5870353805a9f068101a40e0f32ed605c6000000000000000000000000ddafbb505ad214d7b80b1f830fccc89b60fb7a83000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000552008c0f6870c2f77e5cc1d2eb9bdff03e30ea0000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000000000000ecc7400000000000000000000000000000000000000000000000000000000000417e100000000000000000000000000000000000000000000000000000000000a5d0c0000000000000000000000000000000000000000000000000000000062616d7100000000000000000000000000000000000000000000000000000000000a5d0c0000000000000000000000000000000000000000000000000000000062616d7100000000000000000000000000000000000000000000000000000000000000045553444300000000000000000000000000000000000000000000000000000000",
137
"to": ..., // the contract address
138
"value": "0x00",
139
"from": ..., // the sender
140
"chainId": 100,
141
"gasLimit": "0x149970",
142
"gasPrice": "0x59682f00"
143
}
144
}
Copied!
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 how this can look like, check out or Transferring Tokens guide.

Possible Query Parameters

The /quote endpoints offers 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
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
integrator
​
❌
​
A string containing tracking information about the integrator of the API
`SirSwapALot`
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.
The connext bridge is disabled unless it is explicitly requested via the allowBridges parameter. This is due to the extended calculation time that we need for connext transfers.
The quote request will take around 8 seconds longer when connext is enabled.
Copy link