Stake your SUI tokens with native staking to earn staking rewards. This creates liquid staking positions using SUI token.

Usage

// Stake 1 SUI
const result = await agent.stake(1, "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89");

// Stake 0.5 SUI
const result = await agent.stake(0.5, "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89");

Parameters

ParameterTypeRequiredDescription
amountnumberYesAmount to be staked
poolIdstringYesPool address to stake to

Example Prompts

Natural Language Prompts

"Stake 1 SUI to pool  0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89"

LangChain Tool Prompts

// Stake 1 SUI
{
 "amount": 1,
 "poolId": "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89"
}

Example Implementation

import { SuiAgentKit } from "@getnimbus/sui-agent-kit";

async function stakeSUI(agent: SuiAgentKit) {
  try {
    // Stake 1 SOL
    const result = await agent.stake(1, "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89");
    console.log("Staking successful:", result);
  } catch (error) {
    console.error("Staking failed:", error);
  }
}

Implementation Details

  • Uses sui system for staking
  • Automatically handles transaction versioning
  • Includes proper transaction confirmation
  • Provides liquid staking position

Response Format

// Successful response
{
  tx_hash: "DHGKz1EZDnDHbiRC2P3dZd7xuLnfGdncDaBvaExyTAfM",
  tx_status: "success",
}

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

Error Handling

try {
  const result = await agent.stake(amount, poolId);
} catch (error) {
  if (error.message.includes("Insufficient balance")) {
    // Handle insufficient balance
  } else {
    // Handle other transaction failures
  }  
}

Best Practices

  1. Balance Verification
  • Check SUI balance before staking
  • Account for transaction fees
  • Consider minimum stake amounts
  1. Transaction Management
  • Monitor transaction status
  • Implement proper error handling
  • Use appropriate commitment levels
  1. Security
  • Verify transaction details
  • Double-check amounts
  • Keep private keys secure
  1. User Experience
  • Show transaction progress
  • Display staking rewards

Important Notes

  • Minimum staking amount: 1 SUI
  • Staking rewards auto-compound
  • No unbonding period required
  • get_holding: Check token balances