> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notareum.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Staking

# TypeScript: Staking

`StakingClient` wraps the `NotareumValidatorStaking` contract. It lets NOTA holders become validators, manage stake, and inspect tier assignment and daily verification allowances. Reach it through `ntm.staking`.

## Tiers

The SDK exposes tier constants as `ValidatorTier`. The underlying contract assigns tier automatically based on total staked NOTA:

```typescript theme={"system"}
enum ValidatorTier {
  NONE = 0,        // not a validator
  BRONZE = 1,      // BASIC tier, >= 10,000 NOTA
  SILVER = 2,      // PROFESSIONAL tier, >= 50,000 NOTA
  GOLD = 3,        // ENTERPRISE tier, >= 250,000 NOTA
  PLATINUM = 4,    // INSTITUTIONAL tier, >= 1,000,000 NOTA
}
```

The SDK enum names (`BRONZE`..`PLATINUM`) map one-to-one with the protocol names (`BASIC`..`INSTITUTIONAL`) documented in [Staking and Tiers](../../protocol/staking-and-tiers.md). Pick whichever naming your team prefers; the numeric values are what land on-chain.

## Write methods

### `stake(amount)`

Deposits NOTA into the staking contract. The caller must first approve the staking contract to pull at least `amount` NOTA. Tier is recomputed automatically after the deposit:

```typescript theme={"system"}
async stake(amount: bigint): Promise<string>
```

### `unstake()`

Begins the unbonding period. While unbonding, stake does not earn rewards and the validator cannot attest. The default unbonding window is 14 days; see [Staking and Tiers](../../protocol/staking-and-tiers.md):

```typescript theme={"system"}
async unstake(): Promise<string>
```

### `claimStake()`

Claims unbonded NOTA back to the caller's wallet. Reverts if called before the unbonding period completes:

```typescript theme={"system"}
async claimStake(): Promise<string>
```

## Read methods

### `getValidatorInfo(address)`

Returns a full `ValidatorInfo` struct:

```typescript theme={"system"}
async getValidatorInfo(address: string): Promise<ValidatorInfo>
```

`ValidatorInfo` fields:

```typescript theme={"system"}
interface ValidatorInfo {
  stakedAmount: bigint;
  tier: ValidatorTier;
  isActive: boolean;
  slashCount: number;
  dailyVerifications: bigint;
  lastVerificationDay: bigint;
  unbondingAmount: bigint;
  unbondingEndTime: bigint;
}
```

### `getTier(address)`

Fast path to just the tier:

```typescript theme={"system"}
async getTier(address: string): Promise<ValidatorTier>
```

### `getDailyVerificationsRemaining(address)`

How many attestations this validator may still submit in the current UTC day. Returns `2^256 - 1` for Platinum/Institutional (unlimited):

```typescript theme={"system"}
async getDailyVerificationsRemaining(address: string): Promise<bigint>
```

### `getTierThreshold(tier)`

Returns the NOTA amount required to reach a given tier:

```typescript theme={"system"}
async getTierThreshold(tier: ValidatorTier): Promise<bigint>
```

## Full example

```typescript theme={"system"}
import { Notareum, ValidatorTier } from "@notareum/sdk";
import { Contract, parseUnits } from "ethers";

const ntm = Notareum({ provider, signer, contracts });

// 1. Approve NOTA for the staking contract
const notaAbi = ["function approve(address,uint256) returns (bool)"];
const amount = parseUnits("10000", 18); // 10,000 NOTA for BASIC
const nota = new Contract(contracts.notaToken, notaAbi, signer);
await (await nota.approve(contracts.validatorStaking, amount)).wait();

// 2. Stake
const txHash = await ntm.staking.stake(amount);
console.log("Staked:", txHash);

// 3. Inspect
const me = await signer.getAddress();
const info = await ntm.staking.getValidatorInfo(me);
console.log(`Tier: ${ValidatorTier[info.tier]}, active: ${info.isActive}`);

// 4. Much later, exit
await ntm.staking.unstake();
// Wait 14 days...
await ntm.staking.claimStake();
```

## See also

* [Staking and Tiers](../../protocol/staking-and-tiers.md)
* [Becoming a Validator guide](../../guides/becoming-a-validator.md)
* [Slashing](../../protocol/slashing.md)
