import type { TradeRow, SettlementRow, BackfillStateRow, WatchlistSnapshotRow, QueryOptions, PositionSummary, CacheStats, EntityType } from './types.js'; import type { SettlementEvent } from '../types/events.js'; import type { ViewBackend } from './views.js'; /** * Storage backend interface for the cache. * SQLite is the built-in implementation. Users can implement this * for Postgres or other databases. */ export interface StorageBackend extends ViewBackend { open(): void; close(): void; upsertSettlement(event: SettlementEvent): void; upsertTrade(trade: TradeRow): void; upsertTrades(trades: TradeRow[]): void; upsertPositions(wallet: string, positions: Record[]): void; upsertOnchainPositions(wallet: string, positions: Array<{ token_id: string; size: number; avg_price: number; realized_pnl: number; total_bought: number; }>): void; walletTrades(wallet: string, opts?: QueryOptions): TradeRow[]; walletPositions(wallet: string): PositionSummary[]; multiWalletPositions(wallets: string[]): Record; marketTrades(conditionId: string, opts?: QueryOptions): TradeRow[]; marketPositions(conditionId: string): PositionSummary[]; tokenTrades(tokenId: string, opts?: QueryOptions): TradeRow[]; walletSettlements(wallet: string, opts?: QueryOptions): SettlementRow[]; tradeByTxHash(txHash: string): TradeRow[]; walletTokenIds(wallet: string): string[]; walletTokenTrades(wallet: string, tokenId: string): TradeRow[]; getBackfillState(entityType: EntityType, entityId: string): BackfillStateRow | null; getPendingBackfills(): BackfillStateRow[]; resetStaleInProgress(): number; setBackfillState(state: BackfillStateRow): void; updateBackfillProgress(entityType: EntityType, entityId: string, offset: number, fetched: number): void; completeBackfill(entityType: EntityType, entityId: string): void; failBackfill(entityType: EntityType, entityId: string, error: string): void; getWatchlistSnapshot(): WatchlistSnapshotRow[]; setWatchlistSnapshot(entries: WatchlistSnapshotRow[]): void; prune(maxAgeSeconds: number): number; purgeEntity(type: EntityType, id: string): number; analyze(): void; stats(): CacheStats; } //# sourceMappingURL=storage.d.ts.map