import { type JSONColumnType, type Selectable } from 'kysely'; import type * as Db from '../Db.js'; import type * as db_Schema from '../Schema.js'; /** Columns of the `funding_deposit_addresses` table. */ export type Table = Omit & { /** Private provider request identifiers stored as JSON. */ providerRequestIds: JSONColumnType; }; /** A stored funding deposit address. */ export type Record = Selectable; /** Ownership filter derived from the authenticated API key. */ export type Owner = { /** Key environment. */ environment: Record['environment']; /** Owning organization id (`org_…`). */ orgId: string; /** Attributed project id for project-scoped API keys. */ projectId?: string | undefined; }; /** Identity fields that make one reusable address match a caller request. */ export type Match = Owner & { /** Customer destination token key. */ destinationTokenKey: string; /** Tempo account that receives completed deposits. */ recipient: string; /** Source-chain account that receives refunds. */ refundAddress: string; /** Source chain CAIP-2 id. */ sourceChainId: string; /** Source token key. */ sourceTokenKey: string; /** Whether Tempo guarantees normalized 1:1 delivery. */ subsidize: boolean; }; /** Inserts a provisioned funding deposit address. */ export declare function insert(db: Db.Db, record: Record): Promise; /** Inserts an address or returns the concurrently-created matching resource. */ export declare function insertOrGet(db: Db.Db, options: insertOrGet.Options): Promise; export declare namespace insertOrGet { /** Record and stable identity used by create-or-get. */ type Options = { /** Stable customer-visible address identity. */ match: Match; /** Provisioned address record to insert. */ record: Record; }; } /** Gets a funding deposit address without ownership scoping. */ export declare function get(db: Db.Db, id: string): Promise; /** Gets a funding deposit address by its provider-owned address. */ export declare function getByProviderAddress(db: Db.Db, options: getByProviderAddress.Options): Promise; export declare namespace getByProviderAddress { /** Provider address identity received from a reconciliation trigger. */ type Options = { /** Provider-owned reusable deposit address. */ address: string; /** Funding provider id. */ providerId: string; }; } /** Gets an owner-visible funding deposit address. */ export declare function getOwned(db: Db.Db, owner: Owner, id: string): Promise; /** Lists owner-visible funding deposit addresses newest-first. */ export declare function list(db: Db.Db, options: list.Options): Promise; export declare namespace list { /** Ownership and paging options for funding deposit addresses. */ type Options = { /** Exclusive lower bound from the previous page. */ cursor?: Cursor | undefined; /** Maximum rows to return. */ limit: number; /** Ownership filter derived from the authenticated API key. */ owner: Owner; }; /** Cursor fields for the last address returned by the previous page. */ type Cursor = { /** Deposit address creation time. */ createdAt: string; /** Deposit address id, used as a deterministic tie-breaker. */ id: string; }; } /** Gets the reusable address that matches one owner and route identity. */ export declare function getMatching(db: Db.Db, match: Match): Promise; /** Lists active provider addresses for one source-chain token. */ export declare function listActiveSources(db: Db.Db, options: listActiveSources.Options): Promise; export declare namespace listActiveSources { /** Provider and source asset identifying one observer shard. */ type Options = { /** Funding provider that owns the deposit addresses. */ providerId: string; /** Source chain CAIP-2 id. */ sourceChainId: string; /** Source token key. */ sourceTokenKey: string; }; } /** Claims a bounded batch of active addresses due for provider reconciliation. */ export declare function claimDue(db: Db.Db, options: claimDue.Options): Promise; export declare namespace claimDue { /** Provider and lease bounds for one reconciliation claim. */ type Options = { /** Exclusive upper bound on rows claimed in one tick. */ limit: number; /** Expiry time assigned to each claimed lease. */ leaseUntil: string; /** Current time used for due and expired-lease comparisons. */ now: string; /** Funding provider whose addresses should be claimed. */ providerId: string; }; } /** Claims one active address unless another reconciliation owns its lease. */ export declare function claim(db: Db.Db, options: claim.Options): Promise; export declare namespace claim { /** Identity and lease bounds for one reconciliation claim. */ type Options = { /** Funding deposit address id (`fda_…`). */ id: string; /** Expiry time assigned to the claimed lease. */ leaseUntil: string; /** Current time used for expired-lease comparison. */ now: string; }; } /** Extends an active reconciliation lease without changing its fence. */ export declare function renewPoll(db: Db.Db, options: renewPoll.Options): Promise; export declare namespace renewPoll { /** Lease identity and renewed expiry guarded by the current fence. */ type Options = { /** Funding deposit address id (`fda_…`). */ id: string; /** Replacement reconciliation lease expiry. */ leaseUntil: string; /** Fencing token returned by the claim operation. */ pollLeaseVersion: number; }; } /** Completes an owned reconciliation lease and schedules the address again. */ export declare function completePoll(db: Db.Db, options: completePoll.Options): Promise; export declare namespace completePoll { /** Successful reconciliation result guarded by the claimed lease version. */ type Options = { /** Funding deposit address id (`fda_…`). */ id: string; /** Time when provider reconciliation completed. */ lastPolledAt: string; /** Time when this address becomes due again. */ nextPollAt: string; /** Fencing token returned by {@link claimDue}. */ pollLeaseVersion: number; /** Provider request identifiers retained from address provisioning. */ providerRequestIds: readonly string[]; /** Bounded provider reconciliation state. */ providerState: Record['providerState']; }; } /** Releases an owned reconciliation lease after failure and schedules a retry. */ export declare function failPoll(db: Db.Db, options: failPoll.Options): Promise; export declare namespace failPoll { /** Failed reconciliation result guarded by the claimed lease version. */ type Options = { /** Funding deposit address id (`fda_…`). */ id: string; /** Time when this address becomes eligible for retry. */ nextPollAt: string; /** Fencing token returned by {@link claimDue}. */ pollLeaseVersion: number; }; } /** Applies a version-guarded deposit address status update. */ export declare function update(db: Db.Db, options: update.Options): Promise; export declare namespace update { /** Guarded address update fields. */ type Options = { /** Stored version required for the update. */ expectedVersion: number; /** Funding deposit address id (`fda_…`). */ id: string; /** Replacement lifecycle status. */ status: Record['status']; /** New material update time. */ updatedAt: string; /** New material version. */ version: number; }; } /** Provider address conflicted with a different customer-visible identity. */ export declare class ConflictError extends Error { name: string; } //# sourceMappingURL=fundingDepositAddresses.d.ts.map