You can request a quote by specifying either the fromAmount (the amount you are sending) or the toAmount (the amount the recipient will receive).
Quoting by Sending Amount (fromAmount)
To generate a quote based on the amount you are sending, use the /quoteendpoint. This method is useful when you know the exact amount you want to send and need to calculate how much the recipient will receive.
To generate a quote based on the amount the recipient will receive, use the /quote/toAmountendpoint. This method is helpful when you want to ensure that the recipient receives an exact amount of tokens.
The recipient might receive slightly more toToken than requested due to slippage or rounding
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.