import type { InterceptedRequest } from "../gateway/InterceptedRequest.js"; import type { ExposureActionType, ExposureDeclaration, ExposureRouteSubject } from "./ExposureDeclaration.js"; /** * What a money-releasing request states, as the ledger counts it: the action * type, the amount in integer minor units, the currency, and each subject's * identifier. The identifiers stay in this process: the ledger receives * only their digests (ExposureGate). */ export interface ExposureFacts { readonly actionType: ExposureActionType; readonly amount: number; readonly currency: string; readonly subjects: Readonly>>; } /** Why a declared fact could not be read; the request is never counted on a guess. */ export type ExposureFactsRefusal = "EXPOSURE_AMOUNT_UNREADABLE" | "EXPOSURE_CURRENCY_UNREADABLE" | "EXPOSURE_SUBJECT_UNREADABLE"; export type ExposureFactsResult = { readonly ok: true; readonly facts: ExposureFacts; } | { readonly ok: false; readonly code: ExposureFactsRefusal; }; /** The longest identifier a subject may be: an identifier, never a payload. */ export declare const MAX_SUBJECT_LENGTH = 200; type Json = null | boolean | number | string | readonly Json[] | { readonly [key: string]: Json; }; /** The minor-unit exponent of a currency. */ export declare function currencyExponent(currency: string): number; /** * Walks an RFC 6901 pointer, one token per segment and nothing that * backtracks. Only an object's own keys and an array's decimal indexes are * followed, so a pointer cannot reach a prototype. */ export declare function walkPointer(root: Json | undefined, pointer: string): Json | undefined; /** * An amount as integer minor units, exactly: a minor amount is an integer; * a major amount is a decimal with no more fractional digits than the * currency has. A negative, fractional-minor, exponent-notation or * over-precise amount is unreadable rather than rounded. */ export declare function minorUnits(value: Json | undefined, unit: ExposureDeclaration["amountUnit"], currency: string): number | null; /** * Reads what a route declares from the request it governs. The agent, when * the route names no pointer for it, is the gateway's own configured actor: * the identity the intent already names, which the caller cannot choose. */ export declare function readExposureFacts(declaration: ExposureDeclaration, request: InterceptedRequest, routePath: string, actorId: string): ExposureFactsResult; /** * The amount a committed payment's answer says moved, when the route names * where: in the route's unit and the request's currency, and only when it is * no more than was reserved. Anything else settles the reserved amount, which * errs toward the cap. */ export declare function readSettledAmount(declaration: ExposureDeclaration, facts: ExposureFacts, answer: { readonly headers: readonly (readonly [string, string])[]; readonly body: Buffer; }): number | null; export {}; //# sourceMappingURL=ExposureFacts.d.ts.map