import { type Address, type Hex } from 'viem'; import type * as Db from '../../db/Db.js'; import * as Campaigns from './Campaigns.js'; import * as Events from './Events.js'; import type * as Tidx from '../Tidx.js'; import * as Viem from '../Viem.js'; /** Compact queue reference for one Earn reward campaign. */ export type Message = { /** Tempo chain containing the campaign. */ chainId: number; /** Queue message discriminator. */ type: 'earn:reward:run'; /** Verified EarnVault address. */ vaultAddress: Address; }; /** Lists due campaigns as compact queue references. */ export declare function due(db: Db.Db, now?: number): Promise; /** Selects resumable state only when its eligibility snapshot is unchanged. */ export declare function resumeCheckpoint(checkpoint: Campaigns.RunCheckpointEvidence | undefined, options: resumeCheckpoint.Options): Campaigns.RunCheckpointEvidence | undefined; export declare namespace resumeCheckpoint { /** Current calculation identity. */ type Options = { /** Exact current eligibility snapshot identity. */ eligibilityVersion: Hex; /** Exact current effective exclusion set identity. */ exclusionVersion: Hex; }; } /** Keeps the committed campaign cursor ahead of replay-only history. */ export declare function reconciledCursor(options: reconciledCursor.Options): Campaigns.EventCursor | null; export declare namespace reconciledCursor { /** Historical and committed cursor candidates. */ type Options = { /** Cursor already committed by the campaign. */ committed?: Campaigns.EventCursor | null | undefined; /** Last event observed while replaying a new registration. */ replayed?: Campaigns.EventCursor | undefined; }; } /** Restores the target rate selected before a calculation checkpoint. */ export declare function checkpointTargetRate(checkpoint: Campaigns.RunCheckpointEvidence | undefined, config: NonNullable): { annualRateBps: number; config: { annualRate: { bps: number; } | { maxBps: number; minBps: number; morphoVault: `0x${string}`; staleAfterSeconds: number; }; endTimestamp: number; funding: ({ upToAnnualRate: { bps: number; }; wallet: `0x${string}`; } | { remainder: true; wallet: `0x${string}`; })[]; intervalSeconds: number; startTimestamp: number; }; observedAt: string; stale?: boolean; } | undefined; /** Advances one campaign through its durable, fenced execution phases. */ export declare function run(options: run.Options): Promise; export declare namespace run { /** Runtime dependencies injected by the API Worker. */ type Options = { /** Authoritative Postgres connection. */ db: Db.Db; /** Reviewed rewards factory. */ factory: Address; /** Chain-aware RPC client factory. */ getClient: Viem.GetClient; /** Chain-aware TIDX client factory. */ getTidx: Tidx.GetClient; /** HTTP implementation for external rate sources. */ fetch: typeof globalThis.fetch; /** Compact queue reference. */ message: Message; /** Clock used to determine closed interval boundaries. */ now: () => number; /** Isolated signer service transport. */ signerFetch: typeof globalThis.fetch; /** Internal lease assertion installed after a run is acquired. */ assertLease?: (() => Promise) | undefined; /** Hosted Zone metadata used to exclude infrastructure custody. */ zones: readonly { contracts?: Record | undefined; sourceId?: number | undefined; }[]; }; /** Observable queue outcome. */ type Result = { /** Confirmed run details used by operational notifications. */ notification?: Notification | undefined; /** Durable run identity when work existed. */ runId?: string | undefined; /** Whether another worker owns the lease, no work was due, or delivery completed. */ status: 'busy' | 'delivered' | 'idle'; /** Rate sources that reused a bounded prior observation. */ staleRates?: readonly ('organic' | 'target')[] | undefined; /** Confirmed target-yield transaction, when one was needed. */ targetAttempt?: Hex | undefined; }; /** Concise confirmed run details used by operational notifications. */ type Notification = { /** Base-asset decimals. */ assetDecimals: number; /** Higher of the organic and active target-yield rates at the closing boundary. */ baseRateBps: number; /** Incremental boost annual rate applied at the closing boundary. */ boostRateBps?: number | undefined; /** Number of accounting intervals covered by the run. */ intervalCount: number; /** Confirmed depositor payout, when this run pushed rewards. */ payout?: { /** Recipients retaining an unpaid cumulative entitlement. */ deferredRecipients: number; /** Recipients receiving an EarnShare transfer during this run. */ paidRecipients: number; /** Confirmed payout transaction hashes. */ transactionHashes: readonly Hex[]; }; /** Confirmed boost settlement, when this run published a root. */ settlement?: { /** Base-asset units represented by this root increment. */ assetAmount: string; /** Recipients receiving a positive allocation. */ creditedRecipients: number; /** Newly credited recipients retaining an unpaid entitlement after delivery. */ deferredRecipients: number; /** Confirmed root publication transaction hash. */ transactionHash: Hex; }; /** Target-yield evaluation for the run, including a confirmed funding transaction when needed. */ targetYield?: { /** Base-asset units funded across configured funding legs. */ assetAmount: string; /** Confirmed funding transaction hash, omitted when no top-up was needed. */ transactionHash?: Hex | undefined; }; /** Curated vault label configured by an administrator. */ vaultLabel: string; }; } /** Reads historical capital states in bounded waves, preserving order and rejecting incomplete evidence. */ export declare function capitalStates(client: Pick, options: capitalStates.Options): Promise; export declare namespace capitalStates { /** Historical blocks required for one accounting interval. */ type Options = { /** Ordered supply-change boundaries. */ boundaries: readonly Events.boundary.Result[]; /** Vault whose principal and fee-inclusive conversion are sampled. */ vaultAddress: Address; }; /** Historical principal and conversion at a supply-change boundary. */ type State = Events.boundary.Result & Omit; } //# sourceMappingURL=Runner.d.ts.map