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_deposits` table. */ export type Table = Omit & { /** Private provider request identifiers stored as JSON. */ providerRequestIds: JSONColumnType; /** Private provider transaction references stored as JSON. */ providerTransactionHashes: JSONColumnType; }; /** A stored funding deposit. */ export type Record = Selectable; /** Ownership filter inherited from the deposit address. */ 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; }; /** Optional filters shared by funding deposit list and count queries. */ export type Filters = { /** Reusable source-chain address that received the funds. */ depositAddress?: string | undefined; /** Canonical destination token keys accepted by the filter. */ destinationTokenKeys?: readonly string[] | undefined; /** Funding provider id. */ providerId?: string | undefined; /** Tempo account that receives completed deposits. */ recipient?: string | undefined; /** Canonical source chain ids accepted by the filter. */ sourceChainIds?: readonly string[] | undefined; /** Canonical source token keys accepted by the filter. */ sourceTokenKeys?: readonly string[] | undefined; /** Deposit lifecycle status. */ status?: Record['status'] | undefined; }; /** Inserts one provider-observed source transfer as a funding deposit. */ export declare function insert(db: Db.Db, record: Record): Promise; /** Inserts a chain-observed source transfer or returns its existing deposit. */ export declare function insertOrGetSource(db: Db.Db, record: Record & { sourceTransferIndex: number; }): Promise; export declare namespace insertOrGetSource { /** Result of idempotently persisting one verified source transfer. */ type Result = { record: Record; type: 'created' | 'existing'; }; } /** Serializes source attribution for one address and transaction. */ export declare function withSourceTransaction(db: Db.Db, options: withSourceTransaction.Options): Promise; export declare namespace withSourceTransaction { /** Source identity and transaction-scoped work protected by its advisory lock. */ type Options = { /** Funding deposit address that received the transfer. */ depositAddressId: string; /** Database work serialized for the source transaction. */ fn: (db: Db.Db) => Promise; /** Source transaction whose deposit attribution must not race. */ sourceTransactionHash: string; }; } /** Gets deposits created from one provider-observed source transaction. */ export declare function listByProviderObservation(db: Db.Db, options: listByProviderObservation.Options): Promise; export declare namespace listByProviderObservation { /** Provider observation fields that identify one source transaction. */ type Options = { /** Funding deposit address that received the transfer. */ depositAddressId: string; /** Provider request that reported the transfer. */ providerRequestId: string; /** Provider-observed source transaction reference. */ sourceTransactionHash: string; }; } /** Attaches first-observation timestamps to every deposit from one provider request. */ export declare function recordRequestObservation(db: Db.Db, options: recordRequestObservation.Options): Promise; export declare namespace recordRequestObservation { /** First observations associated with one provider request. */ type Options = { /** Funding deposit address id (`fda_…`). */ depositAddressId: string; /** When polling first observed the provider request. */ pollObservedAt?: string | undefined; /** Provider request identifier. */ providerRequestId: string; /** When Tempo first received an authenticated provider webhook. */ webhookReceivedAt?: string | undefined; }; } /** Gets deposits associated with one address and source transaction. */ export declare function listBySourceTransaction(db: Db.Db, options: listBySourceTransaction.Options): Promise; export declare namespace listBySourceTransaction { /** Source transaction fields scoped to one deposit address. */ type Options = { /** Funding deposit address that received the transfer. */ depositAddressId: string; /** Provider-observed source transaction reference. */ sourceTransactionHash: string; }; } /** Lists nonterminal source transfers that await provider attribution. */ export declare function listUnattributed(db: Db.Db, depositAddressId: string): Promise; /** Returns whether an address has a source transfer awaiting provider attribution. */ export declare function hasUnattributed(db: Db.Db, depositAddressId: string): Promise; /** Gets a funding deposit without ownership scoping. */ export declare function get(db: Db.Db, id: string): Promise; /** Gets an owner-visible funding deposit. */ export declare function getOwned(db: Db.Db, owner: Owner, id: string): Promise; /** Lists owner-visible funding deposits newest-first. */ export declare function list(db: Db.Db, options: list.Options): Promise; export declare namespace list { /** Ownership and paging options for funding deposits. */ type Options = Filters & { /** Exclusive lower bound from the previous page. */ cursor?: listByAddress.Cursor | undefined; /** Maximum rows to return. */ limit: number; /** Ownership filter derived from the authenticated API key. */ owner: Owner; }; } /** Counts owner-visible funding deposits through the list's shared filters. */ export declare function count(db: Db.Db, options: count.Options): Promise; export declare namespace count { /** Ownership, filter, and cap options for counting funding deposits. */ type Options = Filters & { /** Maximum exact count before returning the cap plus one. */ cap: number; /** Ownership filter derived from the authenticated API key. */ owner: Owner; }; } /** Lists one owner-visible address's deposits newest-first. */ export declare function listByAddress(db: Db.Db, owner: Owner, addressId: string, options: listByAddress.Options): Promise; export declare namespace listByAddress { /** Cursor fields for the last deposit returned by the previous page. */ type Cursor = { /** Deposit creation time. */ createdAt: string; /** Deposit id, used as a deterministic tie-breaker. */ id: string; }; /** Paging options for one address's deposits. */ type Options = { /** Exclusive lower bound from the previous page. */ cursor?: Cursor | undefined; /** Maximum rows to return. */ limit: number; }; } /** Lists deposits for one reusable source-chain address newest-first. */ export declare function listByDepositAddress(db: Db.Db, options: listByDepositAddress.Options): Promise; export declare namespace listByDepositAddress { /** Deposit address filter, ownership, and paging options. */ type Options = { /** Exclusive lower bound from the previous page. */ cursor?: listByAddress.Cursor | undefined; /** Reusable source-chain address that received the funds. */ depositAddress: string; /** Maximum rows to return. */ limit: number; /** Ownership filter derived from the authenticated API key. */ owner: Owner; }; } /** Lists one recipient's owner-visible deposits newest-first. */ export declare function listByRecipient(db: Db.Db, options: listByRecipient.Options): Promise; export declare namespace listByRecipient { /** Recipient filter, ownership, and paging options. */ type Options = { /** Exclusive lower bound from the previous page. */ cursor?: listByAddress.Cursor | undefined; /** Maximum rows to return. */ limit: number; /** Ownership filter derived from the authenticated API key. */ owner: Owner; /** Tempo account that receives completed deposits. */ recipient: string; }; } /** Applies a version-guarded deposit update. */ export declare function update(db: Db.Db, options: update.Options): Promise; export declare namespace update { /** Guarded deposit update fields. */ type Options = { /** Stored version required for the update. */ expectedVersion: number; /** Funding deposit id (`fdp_…`). */ id: string; /** Provider output amount confirmed on Tempo. */ providerOutputAmount: Record['providerOutputAmount']; /** Provider request that first reported the deposit. */ providerRequestId: Record['providerRequestId']; /** Private provider request identifiers. */ providerRequestIds: Record['providerRequestIds']; /** Bounded private provider state. */ providerState: Record['providerState']; /** Provider-leg transaction references. */ providerTransactionHashes: Record['providerTransactionHashes']; /** Deposit position within the provider request. */ providerTransferIndex: Record['providerTransferIndex']; /** Bounded private retry state. */ retryState: Record['retryState']; /** Persisted settlement transaction bytes for exactly-once rebroadcast. */ settlementTransaction: Record['settlementTransaction']; /** Persisted settlement transaction hash. */ settlementTransactionHash: Record['settlementTransactionHash']; /** Replacement public snapshot. */ snapshot: Record['snapshot']; /** Verified transfer position in the source transaction, or null. */ sourceTransferIndex: Record['sourceTransferIndex']; /** Replacement lifecycle status. */ status: Record['status']; /** Replacement customer-safe reason. */ statusReason: Record['statusReason']; /** Destination token amount supplied by Tempo. */ subsidyAmount: Record['subsidyAmount']; /** Tempo gas paid for settlement, in base units. */ tempoGasPaid: Record['tempoGasPaid']; /** New material update time. */ updatedAt: string; /** New material version. */ version: number; }; } //# sourceMappingURL=fundingDeposits.d.ts.map