import { type Address } from 'viem'; import type * as Db from '../../db/Db.js'; /** One requested manual credit. */ export type Credit = { /** Base-asset reward units to add to pending rewards. */ assets: bigint; /** Registered recipient. */ recipient: Address; }; /** Requested credit annotated with whether it can be applied. */ export type Line = Credit & { /** * `pending` has a stored account and no credit under this reference yet; `applied` was already * credited under this reference; `missing_account` has no `reward_accounts` row to receive it. */ status: 'applied' | 'missing_account' | 'pending'; }; /** Result of examining one credit batch against the campaign's stored state. */ export type Report = { /** Credits already applied under this reference; replaying them is a no-op. */ appliedAssets: bigint; /** Why `ready` is false, for operator output. */ blockers: readonly string[]; /** Latest run phase, or null when the campaign never ran. */ latestRunPhase: string | null; /** Requested credits with their per-recipient status. */ lines: readonly Line[]; /** Recipients without a stored reward account. */ missing: readonly Address[]; /** Whether the campaign is paused; settlement must not commit while credits are written. */ paused: boolean; /** Credits that would be written by `apply`. */ pendingAssets: bigint; /** Whether `apply` would proceed: paused, no run in flight, and no missing accounts. */ ready: boolean; }; /** Examines a credit batch without writing anything. */ export declare function review(options: review.Options): Promise; export declare namespace review { /** Campaign identity and the credit batch to examine. */ type Options = { /** Chain containing the vault. */ chainId: number; /** Requested credits. */ credits: readonly Credit[]; /** Database owning the campaign. */ db: Db.Db; /** Batch reference that makes the credits run-once. */ reference: string; /** EarnVault address. */ vaultAddress: string; }; } /** * Writes every pending credit into `pending_reward_assets`. Refuses unless `review` reports the * campaign ready, because a settlement commit replaces `reward_accounts` wholesale. */ export declare function apply(options: apply.Options): Promise; export declare namespace apply { /** Same inputs as `review`. */ type Options = review.Options; /** Counts of what this call wrote versus found already written. */ type Result = { /** Recipients credited by this call. */ credited: number; /** Base-asset units written by this call. */ creditedAssets: bigint; /** Recipients already credited under this reference before this call. */ replayed: number; }; } /** Thrown when a credit batch cannot be examined or applied. */ export declare class CreditsError extends Error { name: string; } //# sourceMappingURL=Credits.d.ts.map