get_transaction
Retrieve transaction details by hash from Arbitrum networks to analyze blockchain activity and verify transaction status.
Instructions
Get transaction details by hash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rpcUrl | No | The RPC URL of the chain (optional if default is set) | |
| txHash | Yes | Transaction hash |
Implementation Reference
- src/index.ts:270-286 (handler)Main handler for the 'get_transaction' MCP tool. Resolves the RPC URL using chain name or provided URL, creates an EthereumAccountClient instance, fetches the transaction by hash, and returns the JSON-formatted transaction details.case "get_transaction": { const rpcUrl = await this.resolveRpcUrl( (args.rpcUrl as string) || (args.chainName as string) ); const ethereumAccountClient = new EthereumAccountClient(rpcUrl); const tx = await ethereumAccountClient.getTransaction( args.txHash as string ); return { content: [ { type: "text", text: JSON.stringify(tx, null, 2), }, ], }; }
- src/index.ts:981-999 (schema)Tool schema definition including input schema for 'get_transaction', specifying parameters rpcUrl (optional) and required txHash. Used in list tools response for registration.{ name: "get_transaction", description: "Get transaction details by hash", inputSchema: { type: "object" as const, properties: { rpcUrl: { type: "string", description: "The RPC URL of the chain (optional if default is set)", }, txHash: { type: "string", description: "Transaction hash", }, }, required: ["txHash"], }, },
- Core helper function that performs the eth_getTransactionByHash RPC call, parses the raw transaction response into a typed Transaction object, and handles missing transaction errors.async getTransaction(txHash: string): Promise<Transaction> { const tx = await this.makeRpcCall('eth_getTransactionByHash', [txHash]); if (!tx) { throw new Error(`Transaction ${txHash} not found`); } return { hash: tx.hash, nonce: parseInt(tx.nonce, 16), blockHash: tx.blockHash, blockNumber: tx.blockNumber ? parseInt(tx.blockNumber, 16) : null, transactionIndex: tx.transactionIndex ? parseInt(tx.transactionIndex, 16) : null, from: tx.from, to: tx.to, value: tx.value, gasPrice: tx.gasPrice, gas: parseInt(tx.gas, 16), input: tx.input }; }
- TypeScript interface defining the structure of the Transaction object returned by the getTransaction helper.export interface Transaction { hash: string; nonce: number; blockHash: string | null; blockNumber: number | null; transactionIndex: number | null; from: string; to: string | null; value: string; gasPrice: string; gas: number; input: string; }