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

# claimRewards

## Description

The `claimRewards` function allows a user to claim their rewards from a reward pool for a specific stake.&#x20;

## Parameters

| Name         | Type   | Description                                                                                          |
| ------------ | ------ | ---------------------------------------------------------------------------------------------------- |
| `stakeId`    | number | The ID of the stake for which the user wants to claim rewards                                        |
| `amount`     | string | The amount of rewards the user wants to claim. The amount should be in ether format, such as '0.01'. |
| `privateKey` | string | The private key of the user's wallet.                                                                |

## Response

| Property | Type   | Description                                                                                                      |
| -------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
| receipt  | object | The receipt object that contains the transaction hash and other details of the transaction that claimed rewards. |

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

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

// create a new instance of the rewards class
const Rewards = new rewards();

async function main() {
  // claim rewards for a given user and amount
  const result = await Rewards.claimRewards(49, '0.3', TEST_PRIVATE_KEY);
  // log the result
  console.log(result);
}
main();

```

### Response

```
 {
        type: 2,
        chainId: 8888,
        nonce: 4,
        maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
        maxFeePerGas: BigNumber { _hex: '0xd09dc300', _isBigNumber: true },
        gasPrice: null,
        gasLimit: BigNumber { _hex: '0x016917', _isBigNumber: true },
        to: '0x5A98631C9Bb0a2139D70986D96F51E5872CEF5b9',
        value: BigNumber { _hex: '0x00', _isBigNumber: true },
        data: '0x594dd43200000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000429d069189e0000',
        accessList: [],
        hash: '0x58c18fe9f282ab015d3826f91cb0a1c5b3bc141793c9da1c1947aa40dc93a6f5',
        v: 0,
        r: '0xc93fa73f99a4ca2a54dd0c1aba9d77b2fa9003665525e898b34ec13ac102f1ac',
        s: '0x01eddbc9f1b11be8d4042dce811cf3a7f205ee74710ec9db061733e800f0ba9a',
        from: '0x87658a6c698D1392d45B0AB756F969361AcB912d',
        confirmations: 0,
        wait: [Function (anonymous)]
      }
```

## Use Cases

* **Crypto Staking Platforms**: The claimRewards function can be used by crypto staking platforms to allow users to claim their rewards from the reward pool for their specific stake.
* **Decentralized Finance (DeFi) Applications**: The function can be used by DeFi applications that offer staking as one of their services, allowing users to claim their rewards from the reward pool.
* **Crypto Wallets**: The claimRewards function can be used by crypto wallets that support staking to enable their users to claim their rewards.


---

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