zetrix_get_transaction
Retrieve detailed transaction information from the Zetrix blockchain using a transaction hash to verify status, confirmations, and data.
Instructions
Get transaction details by transaction hash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | The transaction hash |
Implementation Reference
- src/index.ts:106-118 (registration)Tool registration in the MCP tools list, including name, description, and input schema definition.name: "zetrix_get_transaction", description: "Get transaction details by transaction hash", inputSchema: { type: "object", properties: { hash: { type: "string", description: "The transaction hash", }, }, required: ["hash"], }, },
- src/index.ts:831-844 (handler)MCP server request handler for the tool: extracts arguments, calls ZetrixClient.getTransaction, and formats response.case "zetrix_get_transaction": { if (!args) { throw new Error("Missing arguments"); } const result = await zetrixClient.getTransaction(args.hash as string); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- src/zetrix-client.ts:269-300 (handler)Core implementation of getTransaction: makes HTTP GET to Zetrix node /getTransactionHistory endpoint with hash parameter, processes response, extracts and formats transaction details, handles errors.async getTransaction(hash: string): Promise<ZetrixTransaction> { try { const response = await this.client.get("/getTransactionHistory", { params: { hash }, }); if (response.data.error_code !== 0) { throw new Error( response.data.error_desc || `API Error: ${response.data.error_code}` ); } const tx = response.data.result.transactions[0]; const txData = tx.transaction || tx; return { hash: tx.hash || hash, blockNumber: tx.ledger_seq || 0, timestamp: tx.close_time || 0, sourceAddress: txData.source_address || "", feeLimit: txData.fee_limit || "0", gasPrice: txData.gas_price || "0", nonce: txData.nonce || 0, operations: txData.operations, status: tx.error_code === 0 ? "success" : "failed", }; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Failed to get transaction: ${error.message}`); } throw error; } }
- src/zetrix-client.ts:35-45 (schema)TypeScript interface defining the structure of the transaction data returned by getTransaction method.export interface ZetrixTransaction { hash: string; blockNumber: number; timestamp: number; sourceAddress: string; feeLimit: string; gasPrice: string; nonce: number; operations?: any[]; status: string; }