confirm_transaction
Confirm a previewed transaction to move it from PREVIEW to PENDING status for processing, enabling secure financial operations management through the Cresium Partner API.
Instructions
Confirm a previewed transaction, moving it from PREVIEW to PENDING status for processing. Only works on transactions in PREVIEW status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Transaction ID to confirm |
Implementation Reference
- src/index.ts:170-184 (schema)Tool definition/schema for confirm_transaction, including name, description, and input schema requiring an id parameter
{ name: "confirm_transaction", description: "Confirm a previewed transaction, moving it from PREVIEW to PENDING status for processing. Only works on transactions in PREVIEW status.", inputSchema: { type: "object" as const, properties: { id: { type: "number", description: "Transaction ID to confirm", }, }, required: ["id"], }, }, - src/index.ts:497-502 (handler)Handler implementation for confirm_transaction that makes a PUT request to /v3/transaction/confirm/{id} to confirm a previewed transaction
case "confirm_transaction": result = await this.request( "PUT", `/v3/transaction/confirm/${args.id}` ); break; - src/index.ts:402-563 (registration)handleToolCall method that routes tool requests to their respective handlers via switch statement, including the confirm_transaction case
private async handleToolCall(request: { params: { name: string; arguments?: Record<string, unknown> }; }) { const { name, arguments: args = {} } = request.params; try { let result: unknown; switch (name) { case "health_check": result = await this.request( "GET", "/v3/health/", undefined, undefined, false ); break; case "get_balance": result = await this.request("GET", "/v3/balance/wallets"); break; case "search_transactions": { const query: Record<string, unknown> = {}; const fields = [ "fromDate", "toDate", "externalId", "nameAmountFilter", "cursor", "pageSize", "field", "order", "sendingFromDate", "sendingToDate", "scheduledTransactions", ]; for (const f of fields) { if (args[f] !== undefined) query[f] = args[f]; } const arrayFields = [ "types", "tags", "states", "depositAddressIds", ]; for (const f of arrayFields) { if (Array.isArray(args[f])) { query[`${f}[]`] = args[f]; } } result = await this.request( "GET", "/v3/transaction/search", undefined, query ); break; } case "get_transaction": result = await this.request( "GET", `/v3/transaction/${args.id}` ); break; case "lookup_bank_address": result = await this.request( "GET", `/v3/bank-address/${args.value}`, undefined, undefined, false ); break; case "create_transfer_preview": { const body: Record<string, unknown> = { toId: args.toId, amount: args.amount, currencyCode: args.currencyCode, }; if (args.tag) body.tag = args.tag; if (args.sendingDate) body.sendingDate = args.sendingDate; if (args.description) body.description = args.description; result = await this.request( "POST", "/v3/transaction/preview", body ); break; } case "confirm_transaction": result = await this.request( "PUT", `/v3/transaction/confirm/${args.id}` ); break; case "create_signature_request": result = await this.request( "POST", `/v3/signature-request/${args.type}`, { id: args.id } ); break; case "create_payments": result = await this.request( "POST", "/v3/payment/", args.payments ); break; case "create_invoices": result = await this.request( "POST", "/v3/invoice/", args.invoices ); break; case "list_payments": result = await this.request("POST", "/v3/payment/", []); break; case "list_invoices": result = await this.request("POST", "/v3/invoice/", []); break; default: return { content: [ { type: "text" as const, text: `Unknown tool: ${name}` }, ], isError: true, }; } return { content: [ { type: "text" as const, text: this.formatResponse(result) }, ], }; } catch (error: unknown) { const message = axios.isAxiosError(error) && error.response ? `API error ${error.response.status}: ${JSON.stringify(error.response.data)}` : error instanceof Error ? error.message : String(error); return { content: [{ type: "text" as const, text: message }], isError: true, }; } } - src/index.ts:363-393 (helper)Request helper method that signs and executes API calls with authentication headers, used by confirm_transaction to make the actual API request
private async request( method: "GET" | "POST" | "PUT" | "DELETE", path: string, body?: unknown, queryParams?: Record<string, unknown>, includeCompanyId = true ): Promise<unknown> { const bodyStr = body ? JSON.stringify(body) : ""; const { timestamp, signature } = this.sign(method, path, bodyStr); const headers: Record<string, string> = { "x-api-key": this.apiKey, "x-timestamp": timestamp, "x-signature": signature, "Content-Type": "application/json", }; if (includeCompanyId) { headers["x-company-id"] = this.companyId; } const response = await this.client.request({ method, url: path, data: body, params: queryParams, headers, }); return response.data; }