import type { PolyNode } from '../client.js'; import type { CacheConfig, TradeRow, SettlementRow, QueryOptions, PositionSummary, CacheStats, StorageEstimate, EntityType } from './types.js'; import type { WatchlistSummaryEntry, WalletDashboard, LeaderboardEntry, LeaderboardMetric, MarketOverview } from './views.js'; import type { RealizedPnlResult } from './types.js'; import { LeaderboardBuilder } from './leaderboard-builder.js'; import type { ExportTable, ExportFilter } from './export.js'; import { CacheQueryBuilder } from './query-builder.js'; export type CacheChangeType = 'trade' | 'settlement' | 'position_refresh'; export interface CacheChangeEvent { type: CacheChangeType; wallet: string; data: TradeRow | SettlementRow; } export type CacheChangeCallback = (event: CacheChangeEvent) => void; export declare class PolyNodeCache { private readonly client; private readonly storage; private readonly watchlist; private readonly config; private backfill; private subscription; private pruneTimer; private started; private _globalListeners; private _walletListeners; constructor(client: PolyNode, config?: CacheConfig); /** Start the cache: open DB, load watchlist, start streaming + backfill. */ start(): Promise; /** Stop the cache: close streams, stop backfill, close DB. */ stop(): Promise; 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[]; stats(): CacheStats; /** Manually trigger a prune of old data. */ prune(): number; onChange(callback: CacheChangeCallback): () => void; onWalletChange(wallet: string, callback: CacheChangeCallback): () => void; private _emit; watchlistSummary(): WatchlistSummaryEntry[]; walletDashboard(wallet: string): WalletDashboard; computeRealizedPnl(wallet: string): RealizedPnlResult; leaderboard(metric: LeaderboardMetric): LeaderboardEntry[]; leaderboard(): LeaderboardBuilder; marketOverview(conditionId: string): MarketOverview; exportCSV(table: ExportTable, filter?: ExportFilter): string; exportJSON(table: ExportTable, filter?: ExportFilter): string; exportRows(table: ExportTable, filter?: ExportFilter): Array; query(table: 'trades'): CacheQueryBuilder; query(table: 'positions'): CacheQueryBuilder; addToWatchlist(entries: Array<{ type: EntityType; id: string; label: string; backfill?: boolean; }>): void; removeFromWatchlist(entries: Array<{ type: EntityType; id: string; }>): void; static estimateStorage(watchlistPath: string, ttlDays?: number): StorageEstimate; private _startSubscription; private _restartSubscription; private _handleWatchlistChange; } export { SqliteBackend } from './sqlite-backend.js'; export { WatchlistManager } from './watchlist.js'; export { BackfillOrchestrator } from './backfill.js'; export { estimateStorage } from './estimator.js'; export { CacheQueryBuilder } from './query-builder.js'; export type { StorageBackend } from './storage.js'; export { LeaderboardBuilder } from './leaderboard-builder.js'; export { computeRealizedPnl } from './views.js'; export type { WatchlistSummaryEntry, WalletDashboard, LeaderboardEntry, LeaderboardMetric, LeaderboardRow, LeaderboardQuery, LeaderboardCategory, MarketOverview } from './views.js'; export type { ExportTable, ExportFilter } from './export.js'; export * from './types.js'; //# sourceMappingURL=index.d.ts.map