- Integrated ECDSA for signature verification in ComboHandler. - Updated event emissions to include additional parameters for better tracking. - Improved gas tracking during execution of combo plans. - Enhanced database interactions for storing and retrieving plans, including conflict resolution and status updates. - Added new dependencies for security and database management in orchestrator.
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { Request, Response } from "express";
|
|
import { executionCoordinator } from "../services/execution";
|
|
import { asyncHandler } from "../services/errorHandler";
|
|
import { auditLog } from "../middleware";
|
|
|
|
/**
|
|
* POST /api/plans/:planId/execute
|
|
* Execute a plan
|
|
*/
|
|
export const executePlan = asyncHandler(async (req: Request, res: Response) => {
|
|
const { planId } = req.params;
|
|
|
|
const result = await executionCoordinator.executePlan(planId);
|
|
|
|
res.json(result);
|
|
});
|
|
|
|
/**
|
|
* GET /api/plans/:planId/status
|
|
* Get execution status
|
|
*/
|
|
export const getExecutionStatus = asyncHandler(async (req: Request, res: Response) => {
|
|
const { planId } = req.params;
|
|
const executionId = req.query.executionId as string;
|
|
|
|
if (executionId) {
|
|
const status = await executionCoordinator.getExecutionStatus(executionId);
|
|
return res.json(status);
|
|
}
|
|
|
|
// Get latest execution for plan
|
|
res.json({ status: "pending" });
|
|
});
|
|
|
|
/**
|
|
* POST /api/plans/:planId/abort
|
|
* Abort execution
|
|
*/
|
|
export const abortExecution = asyncHandler(async (req: Request, res: Response) => {
|
|
const { planId } = req.params;
|
|
const executionId = req.query.executionId as string;
|
|
|
|
if (executionId) {
|
|
await executionCoordinator.abortExecution(executionId, planId, "User aborted");
|
|
}
|
|
|
|
res.json({ success: true });
|
|
});
|
|
|