The toolkit provides method:

  • getWalletHolding: Check balances your own wallet

Usage

// Check your wallet's asset
const balance = await agent.getWalletHolding();

Parameters

No

Example Prompts

Natural Language Prompts

"What do I have in my wallet?" / "Check my wallet"

Example Implementation

import { SuiAgentKit } from "sui-agent-kit";

async function checkBalances(agent: SuiAgentKit) {
const myWalletBalance = await agent.getWalletHolding();
  console.log("My wallet balance:", myWalletBalance);
}

Implementation Details

  • Returns balances in UI units (e.g., 0.1 SUI)
  • Returns 0 for non-existent token

Error Handling

  • Invalid privateKey
  • Empty wallet

Best Practices

  1. Error Handling
  • Handle non-existent tokens gracefully
  • Validate addresses before querying
  • Consider caching for frequent checks
  1. Performance
  • Batch balance checks when possible
  • Cache results for short periods
  1. UI Display
  • Format numbers appropriately
  • Show proper decimal places
  • Include token symbols