⛏️getSwapAmountVolary
Description
The getSwapAmountVolary
function is used to calculate the expected output amount of a Volary token swap based on the input amount and the selected exchange, with an optional slippage tolerance parameter.
The function uses the Uniswap or Sushiswap router contract to get the swap rate and then calculates the expected output amount.
Parameters
Name | Type | Description |
---|---|---|
| string | The input amount of Volary tokens to be swapped. |
| string | The private key of the user's wallet. |
| string | The exchange to use for the swap calculation. Supported values are "uniswap", "sushiswap", and "pancakeswap". |
| string | Optional parameter to set the slippage tolerance for the swap calculation, default is 50. |
Response
Property | Type | Description |
---|---|---|
| string | The expected output amount of tokens after the swap. |
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 getSwapAmountVolary
request using the Nest SDK:
Response
Use Cases
Automated Trading Bots: The
getSwapAmountVolary
function can be used by trading bots to calculate the expected output of a Volary token swap and execute the trade based on the predicted output.Portfolio Management: The function can be used by portfolio managers to determine the expected value of a Volary token swap before making a decision to execute the trade.
Crypto Exchanges: Crypto exchanges can use this function to calculate the expected output amount for a Volary token swap and display it to users before they execute the trade on their platform.
Last updated