# removeStake

## Description

The `removeStake` function allows users to remove a previously staked amount from a staking contract and returns a transaction receipt upon successful execution.&#x20;

## Parameters

| Name         | Type   | Description                                     |
| ------------ | ------ | ----------------------------------------------- |
| `stakeId`    | number | The ID of the stake to be removed               |
| `amount`     | string | The amount of the stake to be removed           |
| `privateKey` | string | The user's private key for the staking contract |

## Response

<table><thead><tr><th>Property</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>receipt</code></td><td>object</td><td>The transaction receipt object </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 `removeStake` request using the NO.AI SDK:

```javascript
// import Nest SDK library
const { staking } = require('@nest25/tokenomics-lib');
// private key of the account you want to use
const TEST_PRIVATE_KEY = 'your-private-key';
// create a new instance of staking
const Staking = new staking();
async function main() {
  // call removeStake function
  const result = await Staking.removeStake(2, '1', TEST_PRIVATE_KEY);
  // print the result
  console.log(result);
}
main();

```

### Response

```
{
        type: 2,
        chainId: 8888,
        nonce: 72,
        maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
        maxFeePerGas: BigNumber { _hex: '0xd09dc300', _isBigNumber: true },
        gasPrice: null,
        gasLimit: BigNumber { _hex: '0x07b123', _isBigNumber: true },
        to: '0x077e4F1496693B7c45128c436eF933ccaFe6d291',
        value: BigNumber { _hex: '0x00', _isBigNumber: true },
        data: '0x2d67f0b900000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000',
        accessList: [],
        hash: '0x608b1c3a7af858d091c1717534d0a740988a3748027dd1eefcc5a9baaca69cac',
        v: 0,
        r: '0xde2811060e6cbec614ba797dee12314a0afed55c0e2e8cd40390652a46cad725',
        s: '0x21e7e26e4973e69c3c19a007cc154e2aa26fead25f74809cb1e3e3cca4ebb705',
        from: '0x5712d28795106f0105C01e99A708d018C1d70E52',
        confirmations: 0,
        wait: [Function (anonymous)]
      }
```

## Use Cases

* **Staking Platforms:** The function can be used by staking platforms to allow users to remove their staked tokens and receive rewards.
* **DeFi Applications:** The function can be used by DeFi applications that implement staking features to allow users to withdraw their staked tokens.
* **Blockchain-based Games:** The function can be used by blockchain-based games that offer staking mechanics to enable players to remove their staked tokens as needed.
