import type { Address, TransactionRequest } from '@aboutcircles/sdk-types'; /** * Referral status lifecycle */ export type ReferralStatus = "pending" | "stale" | "confirmed" | "claimed" | "expired"; /** * Structural interface for the legacy-CRC migration builder used by the * `…WithMigration` invitation variants — satisfied by `PermissionlessGroup` * from `@aboutcircles/sdk-permissionless-groups`. Declared structurally so * this package doesn't depend on that one. */ export interface MigrationTxsBuilder { migration(params: { avatar: Address; maxEdges?: number; excludeFromTokens?: Address[]; }): Promise<{ txs: TransactionRequest[]; amount: bigint; }>; } /** * Migration knobs for the `…WithMigration` invitation variants. The migration * `avatar` is always the inviter, and `excludeFromTokens` always includes the * invitation path's source tokens (that's the point); these options only * extend that. */ export interface InviteMigrationOptions { /** Edge cap forwarded to the migration pathfinder (`maxTransfers`). */ maxEdges?: number; /** Extra exclusions merged with the invitation path's source tokens. */ excludeFromTokens?: Address[]; } /** * Referral info returned from retrieve endpoint */ export interface ReferralInfo { /** The inviter's Ethereum address (absent when key is not found on-chain) */ inviter?: string; /** Current status of the referral (absent when key is not found on-chain) */ status?: ReferralStatus; /** The Safe account address (if available) */ accountAddress?: string; /** Human-readable error message */ error?: string; } /** * Full referral record returned from my-referrals endpoint */ export interface ReferralSession { id: string; slug: string; label: string | null; } export interface Referral { id: string; privateKey: string; status: ReferralStatus; accountAddress?: string; createdAt: string; pendingAt: string; staleAt: string | null; confirmedAt: string | null; claimedAt: string | null; /** Distribution sessions this key belongs to. Empty array if not assigned. */ sessions: ReferralSession[]; } export interface ReferralList { referrals: Referral[]; count: number; total: number; limit: number; offset: number; } /** * Referral preview returned from the public list/{address} endpoint (key is masked) */ export interface ReferralPreview { id: string; /** Masked private key preview (e.g. "0x1234...7890") */ keyPreview: string; status: ReferralStatus; accountAddress: string | null; createdAt: string; pendingAt: string | null; staleAt: string | null; confirmedAt: string | null; claimedAt: string | null; /** Whether this key is also present in at least one distribution session */ inSession: boolean; } /** * Paginated response from the public list/{address} endpoint */ export interface ReferralPreviewList { referrals: ReferralPreview[]; count: number; total: number; limit: number; offset: number; /** 'synced' = fresh RPC check, 'cached' = DB-cached status (30s TTL) */ syncStatus: "synced" | "cached"; } /** * Result of a batch store operation */ export interface StoreBatchResult { success: boolean; stored: number; failed: number; errors?: Array<{ index: number; keyPreview: string; reason: string; }>; } /** * Error response from API */ export interface ApiError { error: string; } /** * Result from store-batch endpoint */ export interface StoreBatchResult { success: boolean; stored: number; failed: number; errors?: Array<{ index: number; keyPreview: string; reason: string; }>; } /** * A distribution session gates access to an inviter's key pool * via quota, expiry, and pause controls. */ export interface DistributionSession { id: string; slug: string; inviterAddress: string; label: string | null; quota: number; dispensedCount: number; expiresAt: string | null; paused: boolean; createdAt: string; updatedAt: string; /** Full URL for QR codes (only when DISTRIBUTION_BASE_URL is configured) */ distributionUrl: string | null; } /** * Paginated list of distribution sessions */ export interface DistributionSessionList { sessions: DistributionSession[]; total: number; limit: number; offset: number; } /** * Parameters for creating a distribution session */ export interface CreateSessionParams { /** Inviter's Ethereum address whose key pool this session draws from */ inviterAddress: string; /** Maximum number of keys this session can dispense */ quota: number; /** Human-readable label (e.g. "ETHDenver 2026 booth") */ label?: string; /** ISO 8601 expiry timestamp */ expiresAt?: string; } /** * Parameters for updating a distribution session */ export interface UpdateSessionParams { label?: string; quota?: number; /** New expiry (ISO 8601), or null to remove expiry */ expiresAt?: string | null; paused?: boolean; } /** * A single key entry within a distribution session */ export interface SessionKey { id: string; privateKey: string; signerAddress: string | null; accountAddress: string | null; status: "queued" | "dispatched" | "claimed"; dispatchedAt: string | null; claimedAt: string | null; addedAt: string; } /** * Paginated list of keys in a distribution session */ export interface SessionKeyList { keys: SessionKey[]; total: number; queuedCount: number; dispatchedCount: number; claimedCount: number; limit: number; offset: number; } /** * Result from adding keys to a distribution session */ export interface AddKeysResult { added: number; skipped: number; claimed: number; errors: Array<{ key: string; error: string; }>; } /** * Result from dispensing a key via a distribution session slug. */ export interface DispenseResult { /** Full private key for the invitation link */ privateKey: string; /** Inviter address that owns the key pool */ inviter: string; /** Pre-built claim URL (only when DISTRIBUTION_BASE_URL configured) */ claimUrl?: string; /** The session slug this key was dispensed through */ sessionSlug: string; } /** * Error codes returned when dispense fails. */ export type DispenseErrorCode = "SESSION_NOT_FOUND" | "POOL_EMPTY" | "SESSION_EXPIRED" | "QUOTA_EXHAUSTED" | "SESSION_PAUSED" | "RATE_LIMITED" | "UNKNOWN"; /** * Typed error thrown by dispense() with a code for programmatic handling. */ export declare class DispenseError extends Error { readonly code: DispenseErrorCode; readonly httpStatus: number; constructor(message: string, code: DispenseErrorCode, httpStatus: number); } /** * Error codes for distribution session CRUD operations. */ export type SessionErrorCode = "VALIDATION_ERROR" | "NOT_FOUND" | "CONFLICT" | "SERVER_ERROR"; /** * Typed error thrown by session CRUD methods. */ export declare class SessionError extends Error { readonly code: SessionErrorCode; readonly httpStatus: number; constructor(message: string, code: SessionErrorCode, httpStatus: number); } //# sourceMappingURL=types.d.ts.map