import * as z from 'zod/mini'; import type * as Db from '../../db/Db.js'; import * as RoutesDepositAddresses from '../../db/tables/routesDepositAddresses.js'; import * as Provider from './Provider.js'; /** Internal route deposit address statuses. */ export declare const statuses: readonly ['action-required', 'active', 'deactivated']; /** Route deposit address statuses exposed by the existing public API. */ export declare const publicStatuses: readonly ['action-required', 'active']; /** Lifecycle status of a route deposit address. */ export type Status = (typeof statuses)[number]; /** Internal responsibility for delivering the requested destination token. */ export declare const deliveryStrategies: readonly ['provider', 'tempo']; /** Whether the provider or Tempo delivers the requested destination token. */ export type DeliveryStrategy = (typeof deliveryStrategies)[number]; /** Bounded provider state retained privately for reconciliation. */ export type ProviderState = Record; /** Matches the webhook owner cap; four 25-address poll batches complete below the five-minute overdue alert. */ export declare const maximumPerCreator = 100; /** Returns whether an address no longer needs reconciliation. */ export declare function isTerminal(status: Status): boolean; /** Returns whether the lifecycle allows moving between address statuses. */ export declare function canTransition(from: Status, to: Status): boolean; /** Generates a route deposit address id (`rda_…`, lexically time-ordered). */ export declare function generateId(now?: Date): string; /** Zod schemas owned by the route deposit address resource. */ export declare namespace schema { /** Route deposit address lifecycle status. */ const Status: z.ZodMiniEnum<{ "action-required": "action-required"; active: "active"; deactivated: "deactivated"; }>; /** Public route deposit address lifecycle status. */ const PublicStatus: z.ZodMiniEnum<{ "action-required": "action-required"; active: "active"; }>; /** Public fields persisted as the address snapshot. */ const Snapshot: z.ZodMiniObject<{ address: z.ZodMiniString; destinationChain: z.ZodMiniObject<{ addressFormat: z.ZodMiniEnum<{ base58: "base58"; base58check: "base58check"; hex: "hex"; }>; id: z.ZodMiniString; kind: z.ZodMiniEnum<{ evm: "evm"; solana: "solana"; tron: "tron"; }>; name: z.ZodMiniString; }, z.core.$strip>; destinationToken: z.ZodMiniObject<{ address: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; name: z.ZodMiniString; standard: z.ZodMiniString; symbol: z.ZodMiniString; tokenKey: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; provider: z.ZodMiniObject<{ id: z.ZodMiniString; name: z.ZodMiniString; }, z.core.$strip>; recipient: z.ZodMiniString; refundAddress: z.ZodMiniString; sourceChain: z.ZodMiniObject<{ addressFormat: z.ZodMiniEnum<{ base58: "base58"; base58check: "base58check"; hex: "hex"; }>; id: z.ZodMiniString; kind: z.ZodMiniEnum<{ evm: "evm"; solana: "solana"; tron: "tron"; }>; name: z.ZodMiniString; }, z.core.$strip>; sourceToken: z.ZodMiniObject<{ address: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; name: z.ZodMiniString; standard: z.ZodMiniString; symbol: z.ZodMiniString; tokenKey: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; subsidize: z.ZodMiniBoolean; }, z.core.$strip>; /** One reusable route deposit address. */ const RoutesDepositAddress: z.ZodMiniObject<{ address: z.ZodMiniString; createdAt: z.ZodMiniISODateTime; destinationChain: z.ZodMiniObject<{ addressFormat: z.ZodMiniEnum<{ base58: "base58"; base58check: "base58check"; hex: "hex"; }>; id: z.ZodMiniString; kind: z.ZodMiniEnum<{ evm: "evm"; solana: "solana"; tron: "tron"; }>; name: z.ZodMiniString; }, z.core.$strip>; destinationToken: z.ZodMiniObject<{ address: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; name: z.ZodMiniString; standard: z.ZodMiniString; symbol: z.ZodMiniString; tokenKey: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; id: z.ZodMiniString; provider: z.ZodMiniObject<{ id: z.ZodMiniString; name: z.ZodMiniString; }, z.core.$strip>; recipient: z.ZodMiniString; refundAddress: z.ZodMiniString; sourceChain: z.ZodMiniObject<{ addressFormat: z.ZodMiniEnum<{ base58: "base58"; base58check: "base58check"; hex: "hex"; }>; id: z.ZodMiniString; kind: z.ZodMiniEnum<{ evm: "evm"; solana: "solana"; tron: "tron"; }>; name: z.ZodMiniString; }, z.core.$strip>; sourceToken: z.ZodMiniObject<{ address: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; name: z.ZodMiniString; standard: z.ZodMiniString; symbol: z.ZodMiniString; tokenKey: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; status: z.ZodMiniEnum<{ "action-required": "action-required"; active: "active"; }>; subsidize: z.ZodMiniBoolean; updatedAt: z.ZodMiniISODateTime; }, z.core.$strip>; /** A reusable route deposit address with terms sampled during creation. */ const CreatedRoutesDepositAddress: z.ZodMiniObject<{ address: z.ZodMiniString; createdAt: z.ZodMiniISODateTime; destinationChain: z.ZodMiniObject<{ addressFormat: z.ZodMiniEnum<{ base58: "base58"; base58check: "base58check"; hex: "hex"; }>; id: z.ZodMiniString; kind: z.ZodMiniEnum<{ evm: "evm"; solana: "solana"; tron: "tron"; }>; name: z.ZodMiniString; }, z.core.$strip>; destinationToken: z.ZodMiniObject<{ address: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; name: z.ZodMiniString; standard: z.ZodMiniString; symbol: z.ZodMiniString; tokenKey: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; id: z.ZodMiniString; provider: z.ZodMiniObject<{ id: z.ZodMiniString; name: z.ZodMiniString; }, z.core.$strip>; recipient: z.ZodMiniString; refundAddress: z.ZodMiniString; sourceChain: z.ZodMiniObject<{ addressFormat: z.ZodMiniEnum<{ base58: "base58"; base58check: "base58check"; hex: "hex"; }>; id: z.ZodMiniString; kind: z.ZodMiniEnum<{ evm: "evm"; solana: "solana"; tron: "tron"; }>; name: z.ZodMiniString; }, z.core.$strip>; sourceToken: z.ZodMiniObject<{ address: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; name: z.ZodMiniString; standard: z.ZodMiniString; symbol: z.ZodMiniString; tokenKey: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; status: z.ZodMiniEnum<{ "action-required": "action-required"; active: "active"; }>; subsidize: z.ZodMiniBoolean; updatedAt: z.ZodMiniISODateTime; destinationAmount: z.ZodMiniObject<{ baseUnits: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; formatted: z.ZodMiniString; }, z.core.$strip>; destinationAmountMin: z.ZodMiniOptional; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; formatted: z.ZodMiniString; }, z.core.$strip>>; fees: z.ZodMiniArray; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; formatted: z.ZodMiniString; }, z.core.$strip>; side: z.ZodMiniEnum<{ destination: "destination"; source: "source"; }>; token: z.ZodMiniObject<{ address: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; name: z.ZodMiniString; standard: z.ZodMiniString; symbol: z.ZodMiniString; tokenKey: z.ZodMiniString; verified: z.ZodMiniBoolean; }, z.core.$strip>; type: z.ZodMiniEnum<{ provider: "provider"; }>; }, z.core.$strip>>; quote: z.ZodMiniObject<{ expiresAt: z.ZodMiniOptional; sampledAt: z.ZodMiniISODateTime; }, z.core.$strip>; sourceAmount: z.ZodMiniObject<{ baseUnits: z.ZodMiniString; currency: z.ZodMiniString; decimals: z.ZodMiniNumber; formatted: z.ZodMiniString; }, z.core.$strip>; }, z.core.$strip>; } /** Stored public snapshot of a route deposit address. */ export type Snapshot = z.output; /** A route deposit address as returned by reads. */ export type Public = z.output; /** A route deposit address returned by creation with current quoted terms. */ export type Created = z.output; /** Creates a durable route deposit address for an already-provisioned provider address. */ export declare function create(db: Db.Db, input: create.Input): Promise; /** Creates or returns the reusable address for the same owner and route. */ export declare function createOrGet(db: Db.Db, input: createOrGet.Input): Promise; export declare namespace createOrGet { /** Fields required to persist or find a provisioned deposit address. */ type Input = create.Input; /** Whether provisioning created or matched the stored reusable address. */ type ReturnType = { /** Stored reusable deposit address. */ record: RoutesDepositAddresses.Record; /** Whether the provider address was newly stored or matched an existing identity. */ type: 'created' | 'existing'; }; } export declare namespace create { /** Fields required to persist a provisioned deposit address. */ type Input = { /** Responsibility for delivering the requested destination token. */ deliveryStrategy: DeliveryStrategy; /** Key environment the address belongs to. */ environment: 'production' | 'sandbox'; /** Address id override for deterministic tests. */ id?: string | undefined; /** Creation time override for deterministic tests. */ now?: Date | undefined; /** Owning organization id (`org_…`). */ orgId: string; /** Attributed project id for a project-scoped API key. */ projectId?: string | undefined; /** Token that the provider outputs on Tempo. */ providerOutputToken: Provider.TokenRef; /** Private provider request identifiers. */ providerRequestIds?: readonly string[] | undefined; /** Private bounded provider state. */ providerState?: ProviderState | undefined; /** Public address snapshot. */ snapshot: Snapshot; }; } /** Persists or returns a reusable address already provisioned before the current capacity check. */ export declare function recoverOrGet(db: Db.Db, input: recoverOrGet.Input): Promise; export declare namespace recoverOrGet { /** Already-provisioned deposit address fields. */ type Input = create.Input; /** Whether recovery created or matched the stored reusable address. */ type ReturnType = createOrGet.ReturnType; } /** Applies a version-guarded route deposit address status transition. */ export declare function transition(db: Db.Db, options: transition.Options): Promise; export declare namespace transition { /** Fields required for a guarded status transition. */ type Options = { /** Version that the transition was computed against. */ expectedVersion: number; /** Route deposit address id (`rda_…`). */ id: string; /** New lifecycle status. */ status: Status; }; /** Outcome of a guarded address transition. */ type Result = { record: RoutesDepositAddresses.Record; type: 'applied'; } | { current: RoutesDepositAddresses.Record; type: 'invalid'; } | { current: RoutesDepositAddresses.Record; type: 'stale'; } | { type: 'not_found'; }; } /** Serializes a stored address to the public read shape. */ export declare function toPublic(record: RoutesDepositAddresses.Record): Public; /** Error thrown when a provider conflicts with a stored reusable address. */ export declare class ConflictError extends Error { name: string; } /** Organization creator's deposit-address cap reached. */ export declare class LimitExceededError extends Error { name: string; /** Maximum durable deposit addresses the canonical creator may own. */ limit: number; constructor(limit: number); } /** Owning organization disappeared before address persistence. */ export declare class OwnerNotFoundError extends Error { name: string; } //# sourceMappingURL=DepositAddress.d.ts.map