transaction
Fetch and decode blockchain transaction details including logs, internal transactions, and state changes for comprehensive analysis across multiple networks.
Instructions
Commonly used to fetch and render a single transaction including its decoded log events. Required: chainName (blockchain network), txHash (transaction hash). Optional: quoteCurrency (currency to convert to, USD by default), noLogs (exclude event logs, true by default), withInternal (include internal transactions, false by default), withState (include state changes, false by default), withInputData (include input data, false by default). Tracing features (withInternal, withState, withInputData) supported on the following chains: eth-mainnet Returns comprehensive details about the specified transaction.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainName | Yes | The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet'). | |
| txHash | Yes | The transaction hash to get details for. Must be a valid transaction hash. | |
| quoteCurrency | No | Currency to quote transaction values in (e.g., 'USD', 'EUR'). If not specified, uses default quote currency. | |
| noLogs | No | Exclude event logs from the response for faster performance. Default is true. | |
| withInternal | No | Include internal transaction traces. Only supported on eth-mainnet. Default is false. | |
| withState | No | Include state changes in the response. Only supported on eth-mainnet. Default is false. | |
| withInputData | No | Include transaction input data in the response. Only supported on eth-mainnet. Default is false. |
Implementation Reference
- The "transaction" tool is registered using `server.tool` and defined with Zod schemas for validation. The handler function calls `goldRushClient.TransactionService.getTransaction` to fetch the transaction details.
server.tool( "transaction", "Commonly used to fetch and render a single transaction including its decoded log events.\n" + "Required: chainName (blockchain network), txHash (transaction hash).\n" + "Optional: quoteCurrency (currency to convert to, USD by default), " + "noLogs (exclude event logs, true by default), " + "withInternal (include internal transactions, false by default), " + "withState (include state changes, false by default), " + "withInputData (include input data, false by default).\n" + "Tracing features (withInternal, withState, withInputData) supported on the following chains: eth-mainnet\n" + "Returns comprehensive details about the specified transaction.", { chainName: z .enum(Object.values(ChainName) as [string, ...string[]]) .describe( "The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')." ), txHash: z .string() .describe( "The transaction hash to get details for. Must be a valid transaction hash." ), quoteCurrency: z .enum(Object.values(validQuoteValues) as [string, ...string[]]) .optional() .describe( "Currency to quote transaction values in (e.g., 'USD', 'EUR'). If not specified, uses default quote currency." ), noLogs: z .boolean() .optional() .default(true) .describe( "Exclude event logs from the response for faster performance. Default is true." ), withInternal: z .boolean() .optional() .describe( "Include internal transaction traces. Only supported on eth-mainnet. Default is false." ), withState: z .boolean() .optional() .describe( "Include state changes in the response. Only supported on eth-mainnet. Default is false." ), withInputData: z .boolean() .optional() .describe( "Include transaction input data in the response. Only supported on eth-mainnet. Default is false." ), }, async (params) => { try { const response = await goldRushClient.TransactionService.getTransaction( params.chainName as Chain, params.txHash, { quoteCurrency: params.quoteCurrency as Quote, noLogs: params.noLogs, withInternal: params.withInternal, withState: params.withState, withInputData: params.withInputData, } ); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } } );