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

# Unstake

> Withdraw tokens from the staking pool

Unstaking is a two-step process:

1. **Initiate Unstake**: Request to withdraw funds. This starts the 7-day unbonding period.
2. **Unstake**: Claim the funds after the 7-day unbonding period has passed.

## 1. Initiate Unstake

```typescript theme={null}
import { executeInitiateUnstake } from '@avnu/avnu-sdk';
import { parseUnits } from 'ethers';

const result = await executeInitiateUnstake({
  provider: account,
  poolAddress: '0x...',
  amount: parseUnits('50', 18),
});
```

## 2. Claim Unstaked Funds

```typescript theme={null}
import { executeUnstake } from '@avnu/avnu-sdk';

const result = await executeUnstake({
  provider: account,
  poolAddress: '0x...',
});
```

## Parameters

### Initiate Unstake

<ParamField path="amount" type="bigint" required>
  Amount to withdraw.
</ParamField>

### Common Parameters

<ParamField path="provider" type="AccountInterface" required>
  The Starknet account.
</ParamField>

<ParamField path="poolAddress" type="string" required>
  The staking pool address.
</ParamField>

<ParamField path="paymaster" type="object">
  Optional paymaster configuration for gasless staking.
</ParamField>
