> For the complete documentation index, see [llms.txt](https://docs.non-obvious.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.non-obvious.ai/sdks-guide/blockchain-sdks/tokenomics-sdk/swapvlry.md).

# swapVlry

## Description

The `swapVlry` function swaps a specified amount of tokens for an equivalent value of the Volary token using Uniswap or Sushiswap DEXes.&#x20;

## Parameters

| Name         | Type   | Description                                                                                |
| ------------ | ------ | ------------------------------------------------------------------------------------------ |
| `inAmount`   | string | The amount of Ethereum to swap for Vlry tokens.                                            |
| `privateKey` | string | The private key of the wallet performing the transaction.                                  |
| `exchange`   | string | The decentralized exchange to use for the swap. It can be either "uniswap" or "sushiswap". |
| `slippage`   | string | The maximum percentage of slippage that can occur during the swap. Defaults to 50 (0.5%).  |

## Response

<table><thead><tr><th>Property</th><th width="128">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>receipt</code> </td><td>object</td><td>Returns a transaction receipt of the swap implementation</td></tr></tbody></table>

## Example Request and Response

### Prerequisites

Before making requests with NO.AI SDK, you must have it installed.

You can install NO.AI SDK using either **`npm`** or **`yarn`**. Use the following commands to install NO.AI SDK:

```jsx
npm install @nest25/tokenomics-lib
OR
yarn add @nest25/tokenomics-lib
```

### Request

Here is an example of how to make a `getSwapAmountVolary` request using the NO.AI SDK:

````
```javascript
// import Nest SDK library
const { dex } = require('@nest25/tokenomics-lib');

// create a new instance of the dex class
const Dex = new dex();

async function main() {
  // swap 0.001 VLRY for ETH on Uniswap
  const result = await Dex.swapVlry('0.001', TEST_PRIVATE_KEY, 'uniswap');
  // print the result
  console.log(result);
}
```
````

### Response

```
Received 262895397847755609 VLRY
```

## Use Cases

* **Crypto Wallets:** The function can be used by crypto wallets to swap Ether for Volary tokens on supported DEX platforms like Uniswap, Sushiswap and Pancakeswap.
* **Cryptocurrency Exchanges:** The function can be used by cryptocurrency exchanges to facilitate the buying and selling of Volary tokens using Ether on supported DEX platforms.
* **Crypto Traders:** The function can be used by crypto traders to swap Ether for Volary tokens on supported DEX platforms and potentially gain profit from price differences between platforms.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.non-obvious.ai/sdks-guide/blockchain-sdks/tokenomics-sdk/swapvlry.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
