GET_TRANSACTION
Retrieve transaction details from the OpenOcean MCP server to verify swap status and confirm blockchain execution using the transaction hash.
Instructions
Get Transaction
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | The blockchain network to execute the transaction on. uses fraxtal as default | fraxtal |
| hash | Yes | Hash from the OpenOcean contract on the blockchain. |
Implementation Reference
- src/tools/chain.ts:84-106 (handler)The handler function that executes the GET_TRANSACTION tool logic. Resolves chain, fetches transaction via ChainService, returns JSON or error.export const getTransaction = async (args: z.infer<typeof hashParamsSchema>) => { try { const inputChain = args.chain.toLowerCase(); const chainObject = getChainFromName(inputChain); console.error(`[GET_TRANSACTION] Using chain: ${chainObject.name}`, args); const service = new ChainService(); const tx = await service.getTransaction(chainObject.id, args.hash); if (tx instanceof Error) { return `Error fetching getTransaction: ${tx.message}`; } return JSON.stringify(tx, null, 2); } catch (error: unknown) { const message = error instanceof Error ? error.message : "An unknown error occurred while fetching getTransaction."; console.error(`[GET_TRANSACTION] Error: ${message}`); throw new Error(`Failed to fetch getTransaction: ${message}`); } }
- src/types.ts:14-26 (schema)Zod input schema for GET_TRANSACTION tool: chain (optional string, default 'fraxtal'), hash (validated transaction hash string).export const hashParamsSchema = z.object({ chain: z .string() .optional() .describe( "The blockchain network to execute the transaction on. uses fraxtal as default", ) .default("fraxtal"), hash: z .string() .refine(isHash, { message: "Invalid hash" }) .describe("Hash from the OpenOcean contract on the blockchain."), });
- src/tools/index.ts:28-32 (registration)Tool registration object defining name, description, input parameters schema, and execute handler reference.getTransaction: { name: "GET_TRANSACTION", description: "Get Transaction", parameters: hashParamsSchema, execute: chainExecute.getTransaction