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/zetrix-client.ts:269-300 (handler)Core handler function that performs HTTP GET to Zetrix API /getTransactionHistory endpoint with transaction hash, handles errors, parses response, constructs and returns ZetrixTransaction object with details like blockNumber, sourceAddress, feeLimit, etc.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/index.ts:831-844 (handler)MCP server tool handler case that validates input arguments, calls ZetrixClient.getTransaction, serializes result to JSON and returns as text content.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/index.ts:105-118 (schema)Tool definition including name, description, and input schema requiring a 'hash' string parameter for validation in MCP ListTools and CallTool requests.{ 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/zetrix-client.ts:35-45 (schema)TypeScript interface defining the structure of the transaction object returned by getTransaction.export interface ZetrixTransaction { hash: string; blockNumber: number; timestamp: number; sourceAddress: string; feeLimit: string; gasPrice: string; nonce: number; operations?: any[]; status: string; }