⛏️getQuote
Description
The getQuote
function returns an object containing the contract address and quotes for a given token swap between two chains, based on the source and destination chain, source and destination tokens, and the amount to be swapped.
If the request is unsuccessful, it returns an error message.
Parameters
Parameter | Type | Description |
---|---|---|
| string | The name of the source blockchain network (e.g., ETH, AVA, BSC, Polygon, Klaytn), and all specified networks are on the mainnet. |
| string | The name of the destination blockchain network (e.g., ETH, AVA, BSC, Polygon, Klaytn), and all specified networks are on the mainnet. |
| string | The contract address of the token being swapped on the source chain |
| string | The contract address of the token being swapped on the destination chain |
| string | The amount of tokens being swapped |
Response
Property | Type | Description |
---|---|---|
| string | The contract address of the token on the destination chain |
| string | The estimated amount of tokens to receive on the destination chain after the swap |
| string | Error code if the quote is unsuccessful |
| string | Error message if the quote is unsuccessful |
Example Request and Response
Prerequisites
Before making requests with Nest SDK, you must have it installed.
You can install Nest SDK using either npm
or yarn
. Use the following commands to install Nest SDK:
Request
Here is an example of how to make a getQuote
request using the Nest SDK:
Response
Use Cases
Token swapping: The
getQuote
function can be used by decentralized exchanges to get a quote for a cross-chain token swap before initiating a trade, ensuring the accuracy of the transaction.Portfolio management: The function can be used to help portfolio managers determine the expected outcome of a token swap before making the trade.
Arbitrage opportunities: The function can be used to identify potential arbitrage opportunities by comparing the estimated swap amount with the current market price of the tokens on both chains.
Last updated