# Staking

## Get info about address

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get info about your address.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description         |
| ---------------- | ------ | ------------------- |
| `currencySymbol` | string | Must be "ETH"       |
| `action`         | string | Must be "info"      |
| `address`        | string | Your wallet address |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  eth: {
    assets: string; // staked ETH amount (in wei)
    maxUnstakeAssets: string; // max allowed amount to unstake (in wei)
  }
  osEth: {
    shares: string; // minted osETH (in wei)
    maxMintShares: string; // max allowed amount to mint (in wei)
  }
  withdraw: {
    isAvailable: boolean; // is withdraw available
    availableAt: string | null; // ISO timestamp indicating when withdraw will be available
    withdrawableAssets: string; // ETH amount available to withdraw (in wei)
    requestedAssets: string; // ETH amount requested to withdraw (in wei)
  }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Stake ETH

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for stake ETH.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description              |
| ---------------- | ------ | ------------------------ |
| `currencySymbol` | string | Must be "ETH"            |
| `action`         | string | Must be "stake"          |
| `address`        | string | Your wallet address      |
| `amount`         | string | Amount to stake (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "INVALID_AMOUNT"
}
```

{% endtab %}
{% endtabs %}

## Unstake ETH

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for unstake ETH.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description                |
| ---------------- | ------ | -------------------------- |
| `currencySymbol` | string | Must be "ETH"              |
| `action`         | string | Must be "unstake"          |
| `address`        | string | Your wallet address        |
| `amount`         | string | Amount to unstake (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "AMOUNT_EXCEEDS_MAX_UNSTAKEABLE_ASSETS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw ETH (after unstaking period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw unstaked ETH.

**Current unstaking period**: 1 - 10 days.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description         |
| ---------------- | ------ | ------------------- |
| `currencySymbol` | string | Must be "ETH"       |
| `action`         | string | Must be "withdraw"  |
| `address`        | string | Your wallet address |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "WITHDRAW_NOT_AVAILABLE"
}
```

{% endtab %}
{% endtabs %}

## Mint osETH token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for mint osETH token.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description             |
| ---------------- | ------ | ----------------------- |
| `currencySymbol` | string | Must be "ETH"           |
| `action`         | string | Must be "mint-os-eth"   |
| `address`        | string | Your wallet address     |
| `amount`         | string | Amount to mint (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "AMOUNT_EXCEEDS_MAX_MINT_SHARES"
}
```

{% endtab %}
{% endtabs %}

## Burn osETH token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for burn osETH token.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description             |
| ---------------- | ------ | ----------------------- |
| `currencySymbol` | string | Must be "ETH"           |
| `action`         | string | Must be "burn-os-eth"   |
| `address`        | string | Your wallet address     |
| `amount`         | string | Amount to burn (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "AMOUNT_EXCEEDS_OS_ETH_SHARES"
}
```

{% endtab %}
{% endtabs %}
