zetrix_test_transaction
Evaluate transaction fees before submitting to the Zetrix blockchain to verify costs and validate transaction parameters without network execution.
Instructions
Evaluate transaction fees without blockchain submission
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Array of test transaction items |
Implementation Reference
- src/zetrix-client.ts:590-607 (handler)Core implementation of the zetrix_test_transaction tool: sends POST /testTransaction to Zetrix RPC endpoint with input 'items' array and returns the test result (actual_fee, hash, logs, etc.)async testTransaction(items: any[]): Promise<ZetrixTestTransactionResult> { try { const response = await this.client.post("/testTransaction", { items }); if (response.data.error_code !== 0) { throw new Error( response.data.error_desc || `API Error: ${response.data.error_code}` ); } return response.data.result; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Failed to test transaction: ${error.message}`); } throw error; } }
- src/index.ts:1042-1055 (handler)MCP server CallToolRequest handler for 'zetrix_test_transaction': validates args, calls ZetrixClient.testTransaction, formats response as JSON text contentcase "zetrix_test_transaction": { if (!args) { throw new Error("Missing arguments"); } const result = await zetrixClient.testTransaction(args.items as any[]); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:341-354 (registration)Registers the tool with MCP server.setRequestHandler(ListToolsRequestSchema), defining name, description, and inputSchema (requires 'items' array){ name: "zetrix_test_transaction", description: "Evaluate transaction fees without blockchain submission", inputSchema: { type: "object", properties: { items: { type: "array", description: "Array of test transaction items", }, }, required: ["items"], }, },
- src/zetrix-client.ts:126-133 (schema)TypeScript interface defining the output schema for testTransaction result (actual_fee, hash, logs, query_rets, stat, txs)export interface ZetrixTestTransactionResult { actual_fee: string; hash: string; logs: any; query_rets: any[]; stat: any; txs: any[]; }