/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { constructionConstructionSubmit } from "../../funcs/constructionConstructionSubmit.js";
import * as models from "../../models/index.js";
import { formatResult, ToolDefinition } from "../tools.js";
const args = {
request: models.ConstructionSubmitRequest$inboundSchema,
};
export const tool$constructionConstructionSubmit: ToolDefinition<typeof args> =
{
name: "construction-construction-submit",
description: `Submit a Signed Transaction
Submit a pre-signed transaction to the node. This call should not block on the transaction being included in a block. Rather, it should return immediately with an indication of whether or not the transaction was included in the mempool. The transaction submission response should only return a 200 status if the submitted transaction could be included in the mempool. Otherwise, it should return an error.`,
args,
tool: async (client, args, ctx) => {
const [result, apiCall] = await constructionConstructionSubmit(
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);
},
};