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

# Unstake Native

> Learn how to unstake SUI - native staking

Unstake your SUI native staking

## Usage

```javascript theme={null}
// Unstake
const stakedSuiId = '0xb73a5f2fc8ee3ca60f5efcd93242921e7138ab25f02df1d59c45d94d96411623'
const result = await agent.unstake(stakedSuiId);
```

## Parameters

| Parameter   | Type   | Required | Description                         |
| ----------- | ------ | -------- | ----------------------------------- |
| stakedSuiId | string | Yes      | StakedID of the position to unstake |

## Example Prompts

### Natural Language Prompts

```javascript theme={null}
"unstake this position 0xb73a5f2fc8ee3ca60f5efcd93242921e7138ab25f02df1d59c45d94d96411623"
```

### LangChain Tool Prompts

```javascript theme={null}
{
 "stakedSuiId": "0xb73a5f2fc8ee3ca60f5efcd93242921e7138ab25f02df1d59c45d94d96411623",
}
```

## Example Implementation

```javascript theme={null}
import { SuiAgentKit } from "@getnimbus/sui-agent-kit";

async function unStake(agent: SuiAgentKit) {
  try {
    const stakeId =
      "0xb73a5f2fc8ee3ca60f5efcd93242921e7138ab25f02df1d59c45d94d96411623";
    const result = await agent.unStake(stakeId);
    console.log("Unstake result:", result);
  } catch (error) {
    console.error("Unstake failed:", error);
  }
}
```

## Implementation Details

* Uses `sui system` for unstaking
* Automatically handles transaction versioning
* Includes proper transaction confirmation
* Remove liquid staking position

## Response Format

```javascript theme={null}
// Successful response
{
  tx_hash: "DHGKz1EZDnDHbiRC2P3dZd7xuLnfGdncDaBvaExyTAfM",
  tx_status: "success",
}

// Error response
{
  tx_hash: "DHGKz1EZDnDHbiRC2P3dZd7xuLnfGdncDaBvaExyTAfM",
  tx_status: "failed",
}
```

## Error Handling

```javascript theme={null}
try {
  const stakeId =
      "0xb73a5f2fc8ee3ca60f5efcd93242921e7138ab25f02df1d59c45d94d96411623";
  const result = await agent.unStake(stakeId);
} catch (error) {
  if (error.message.includes("Insufficient balance")) {
    // Handle insufficient balance
  } else {
    // Handle other transaction failures
  }  
}
```

## Best Practices

1. Gas Verification

* Account for transaction fees

2. Transaction Management

* Monitor transaction status
* Implement proper error handling
* Use appropriate commitment levels

3. Security

* Verify transaction details
* Double-check amounts
* Keep private keys secure

4. User Experience

* Show transaction progress
* Display staking rewards

## Related Functions

* get\_holding: Check token balances
