{"path":"oracle/src/store.ts","size":969,"locked":false,"binary":false,"truncated":false,"content":"import { PublicKey } from \"@solana/web3.js\";\nimport { StoredJob, GigEscrow } from \"./types\";\n\nclass JobStore {\n  private readonly jobs = new Map<string, StoredJob>();\n\n  upsert(jobId: string, escrowPubkey: PublicKey, escrow: GigEscrow): void {\n    this.jobs.set(jobId, {\n      escrowPubkey,\n      escrow,\n      detectedAt: this.jobs.get(jobId)?.detectedAt ?? Date.now(),\n    });\n  }\n\n  get(jobId: string): StoredJob | undefined {\n    return this.jobs.get(jobId);\n  }\n\n  remove(jobId: string): void {\n    this.jobs.delete(jobId);\n  }\n\n  hasPending(jobId: string): boolean {\n    const job = this.jobs.get(jobId);\n    if (!job) return false;\n    return \"pending\" in job.escrow.status;\n  }\n\n  allPending(): StoredJob[] {\n    return Array.from(this.jobs.values()).filter(\n      (j) => \"pending\" in j.escrow.status\n    );\n  }\n\n  size(): number {\n    return this.jobs.size;\n  }\n}\n\n// Singleton — shared across listener and HTTP handlers\nexport const store = new JobStore();\n"}