import type { Account, Fill, StoredOrder } from './model'; import type { MarketInput, StrategyCheckpoint, StrategyJournalEvent, StrategyJournalPayload, StrategyOrderIntent, } from './strategy-recovery'; export interface ExecutionTransaction { account: Account; findOrder(clientOrderId: string): Promise; getOrder(orderId: string): Promise; openOrders(): Promise; putOrder(order: StoredOrder): Promise; insertFill(orderId: string, fill: Fill): Promise; recordEvent(eventId: string, fingerprint: string): Promise; appendJournal(payload: StrategyJournalPayload): Promise; nextJournal(cursor: number): Promise; strategies(): Promise; putStrategy(checkpoint: StrategyCheckpoint): Promise; putIntent(intent: StrategyOrderIntent): Promise; nextIntent(): Promise; nextInput(): Promise; putInput(input: MarketInput): Promise; } export interface ExecutionRepository { initialize(accountId: string, initial: Account): Promise; transact(accountId: string, work: (tx: ExecutionTransaction) => Promise): Promise; } export class ExecutionConflictError extends Error {}