zetrix_sdk_get_balance
Retrieve account balance from the Zetrix blockchain by providing a wallet address. This tool queries the network to display current token holdings for any Zetrix account.
Instructions
Get account balance using the official SDK
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | The Zetrix account address |
Implementation Reference
- src/index.ts:1151-1164 (handler)Handler case for the zetrix_sdk_get_balance tool. It validates arguments, calls ZetrixSDK.getBalance with the provided address, and returns the formatted JSON response.case "zetrix_sdk_get_balance": { if (!args) { throw new Error("Missing arguments"); } const balance = await zetrixSDK.getBalance(args.address as string); return { content: [ { type: "text", text: JSON.stringify(balance, null, 2), }, ], }; }
- src/index.ts:428-441 (registration)Registration of the zetrix_sdk_get_balance tool in the tools array, defining its name, description, and input schema requiring an 'address' string.{ name: "zetrix_sdk_get_balance", description: "Get account balance using the official SDK", inputSchema: { type: "object", properties: { address: { type: "string", description: "The Zetrix account address", }, }, required: ["address"], }, },
- src/zetrix-sdk.ts:108-127 (helper)Core implementation of getBalance in ZetrixSDK class. Initializes the underlying zetrix-sdk-nodejs SDK and calls its account.getBalance method, handling errors and returning balance in micro units.async getBalance(address: string): Promise<ZetrixSDKBalance> { await this.initSDK(); try { const result = await this.sdk.account.getBalance(address); if (result.errorCode !== 0) { throw new Error(result.errorDesc || `SDK Error: ${result.errorCode}`); } return { address, balance: result.result.balance, }; } catch (error) { throw new Error( `Failed to get balance: ${error instanceof Error ? error.message : String(error)}` ); } }