Stake your SUI on Suilend to receive liquid staking tokens (LST). Use LSTs to earn trading fees in liquidity pools or as collateral to borrow stablecoins.

Example Prompts

Natural Language Prompts

"stake suilend 1 msui"

LangChain Tool Prompts

// Stake 1 SUI
{
 amount: 1;
 symbol: 'msui';
}

Example Implementation

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

async function stakeSuilend(agent: SuiAgentKit) {
  try {
    const result = await agent.stakeSuilend({
      type: "STAKING",
      amount: 1,
      symbol: "msui",
    });
    console.log("Result:", result);
  } catch (error) {
    console.error("Stake failed:", error);
  }
}

Implementation Details

  • Check user balance
  • Initialize data from Suilend SDK
  • Prepare the transaction payload
  • Sign & execute the transaction

Response Format

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

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

Error Handling

try {
  const res = await agent.stakeSuilend({
    type: "STAKING",
    amount: 1,
    symbol: "msui",
  });
} 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