> 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/approvevolary.md).

# approveVolary

## Description

The `approveVolary` function allows for the approval of a certain amount of tokens to be spent by another address, typically a smart contract.&#x20;

## Parameters

| Name         | Type   | Description                                            |
| ------------ | ------ | ------------------------------------------------------ |
| `spender`    | string | The address of the spender, typically a smart contract |
| `amount`     | string | The amount of tokens to approve for spending           |
| `privateKey` | string | The private key of the user's wallet                   |

## Response

| Property  | Type   | Description                                                                                                            |
| --------- | ------ | ---------------------------------------------------------------------------------------------------------------------- |
| `receipt` | object | A transaction receipt object that includes information about the transaction, such as the transaction hash and status. |

## 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 `approveVolary` request using the NO.AI SDK:

```javascript
// import Nest SDK library
const { volary } = require('@nest25/tokenomics-lib');
// private key of the account you want to use
const TEST_PRIVATE_KEY = 'your-private-key';
// address of the staking contract
const STAKING_CONTRACT_ADDRESS = '0x077e4F1496693B7c45128c436eF933ccaFe6d291';

// create a new instance of staking
const Volary = new volary();

async function main() {
  // approve Volary to stake
  const result = await Volary.approveVolary(STAKING_CONTRACT_ADDRESS, '2', TEST_PRIVATE_KEY);
  // print the result
  console.log(result);
}
main();

```

### Response

```sh
{
        type: 2,
        chainId: 8888,
        nonce: 74,
        maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
        maxFeePerGas: BigNumber { _hex: '0xd09dc300', _isBigNumber: true },
        gasPrice: null,
        gasLimit: BigNumber { _hex: '0x6983', _isBigNumber: true },
        to: '0x51d93eFc7a629C6c8e61de078d71b6E5c7F84B80',
        value: BigNumber { _hex: '0x00', _isBigNumber: true },
        data: '0x095ea7b3000000000000000000000000077e4f1496693b7c45128c436ef933ccafe6d2910000000000000000000000000000000000000000000000001bc16d674ec80000',
        accessList: [],
        hash: '0xd5a8ae72ae6a21babe3c0a025f7dfb05b4e0bd20c8870cd2220d5effe91ddc09',
        v: 1,
        r: '0xd5cfb759e73ed11e0efbb7e5fea3c5d56df6fe1c0e9db4d74d8f2fc4d184becf',
        s: '0x2938514e8e57b7c89af0515004f895ab81e38dc60792971a3f684fe959579cd4',
        from: '0x5712d28795106f0105C01e99A708d018C1d70E52',
        confirmations: 0,
        wait: [Function (anonymous)]
      }he
```

## Use Cases

* **DeFi Applications:** The function can be used by DeFi applications to approve the spending of a certain amount of tokens by a smart contract.
* **DEX Platforms:** The function can be used by DEX platforms to allow users to approve the spending of their tokens for trading on the platform.
* **Lending Platforms:** The function can be used by lending platforms to allow borrowers to approve the spending of their tokens as collateral.


---

# 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/approvevolary.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.
