zetrix_sdk_get_nonce
Retrieve the transaction sequence number for a Zetrix blockchain account to ensure proper transaction ordering and prevent replay attacks.
Instructions
Get account nonce (transaction sequence number)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | The Zetrix account address |
Implementation Reference
- src/index.ts:1181-1194 (handler)Handler for zetrix_sdk_get_nonce tool: extracts address argument, calls zetrixSDK.getNonce, and returns formatted response.case "zetrix_sdk_get_nonce": { if (!args) { throw new Error("Missing arguments"); } const nonce = await zetrixSDK.getNonce(args.address as string); return { content: [ { type: "text", text: JSON.stringify({ address: args.address, nonce }, null, 2), }, ], }; }
- src/index.ts:456-468 (registration)Registers the tool in the MCP server with name, description, and input schema requiring address.{ name: "zetrix_sdk_get_nonce", description: "Get account nonce (transaction sequence number)", inputSchema: { type: "object", properties: { address: { type: "string", description: "The Zetrix account address", }, }, required: ["address"], },
- src/index.ts:459-468 (schema)Input schema definition for the tool.inputSchema: { type: "object", properties: { address: { type: "string", description: "The Zetrix account address", }, }, required: ["address"], },
- src/zetrix-sdk.ts:270-286 (helper)ZetrixSDK.getNonce implementation: initializes SDK if needed, calls underlying SDK's account.getNonce, handles errors, returns nonce.async getNonce(address: string): Promise<number> { await this.initSDK(); try { const result = await this.sdk.account.getNonce(address); if (result.errorCode !== 0) { throw new Error(result.errorDesc || `SDK Error: ${result.errorCode}`); } return result.result.nonce; } catch (error) { throw new Error( `Failed to get nonce: ${error instanceof Error ? error.message : String(error)}` ); } }