# Shiba Inu Staking

## Approve a token

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

This endpoint allows you to get transaction params for approve tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"      |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve"   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

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

{% endtab %}
{% endtabs %}

## Stake coins/tokens

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

This endpoint allows you to get transaction params for staking coins/tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"      |
| action<mark style="color:red;">\*</mark>         | string | Must be "stake"     |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |
| amount<mark style="color:red;">\*</mark>         | string | Amount to stake     |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

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

{% endtab %}
{% endtabs %}

## Approve withdraw

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

This endpoint allows you to get transaction params for approve staked tokens (needed to be executed before withdraw staked SHIBs).

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                |
| ------------------------------------------------ | ------ | -------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"             |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve-withdraw" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address        |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

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

{% endtab %}
{% endtabs %}

## Withdraw stake

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

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

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"           |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address      |
| amount<mark style="color:red;">\*</mark>         | string | Amount to withdraw       |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_EPOCHS_PASSED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

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

{% endtab %}
{% endtabs %}
