/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { constructionConstructionParse } from "../../funcs/constructionConstructionParse.js";
import * as models from "../../models/index.js";
import { formatResult, ToolDefinition } from "../tools.js";
const args = {
request: models.ConstructionParseRequest$inboundSchema,
};
export const tool$constructionConstructionParse: ToolDefinition<typeof args> = {
name: "construction-construction-parse",
description: `Parse a Transaction
Parse is called on both unsigned and signed transactions to understand the intent of the formulated transaction. This is run as a sanity check before signing (after \`/construction/payloads\`) and before broadcast (after \`/construction/combine\`). `,
args,
tool: async (client, args, ctx) => {
const [result, apiCall] = await constructionConstructionParse(
client,
args.request,
{ fetchOptions: { signal: ctx.signal } },
).$inspect();
if (!result.ok) {
return {
content: [{ type: "text", text: result.error.message }],
isError: true,
};
}
const value = result.value;
return formatResult(value, apiCall);
},
};