import type { AithosAuth } from "./auth.js"; import { type AithosSdkEndpoints } from "./endpoints.js"; /** * Canonical credit-pack identifiers. Pricing and microcredit amounts are * authoritative server-side; the SDK only forwards the pack id. * * - `credits-100k` — 100K microcredits (S, ~5 €) * - `credits-1m` — 1M microcredits + 10 % bonus (M, ~45 €) * - `credits-5m` — 5M microcredits + 20 % bonus (L, ~200 €) */ export type CreditPackId = "credits-100k" | "credits-1m" | "credits-5m"; export interface CreateTopupSessionArgs { /** Pack to purchase. */ readonly packId: CreditPackId; /** Where Stripe redirects after a successful payment. */ readonly successUrl: string; /** Where Stripe redirects if the user cancels. */ readonly cancelUrl: string; /** Abort signal to cancel the request. */ readonly signal?: AbortSignal; } export interface CreateTopupSessionResult { /** Hosted Stripe Checkout URL — redirect the user there. */ readonly checkoutUrl: string; /** Stripe Checkout session id (for diagnostics). */ readonly sessionId: string; } export interface GetBalanceArgs { /** Abort signal to cancel the request. */ readonly signal?: AbortSignal; } export interface GetBalanceResult { /** Current wallet balance in microcredits. 0 if the wallet does not yet exist. */ readonly balance: number; /** * Microcredits spent today. Resets server-side at midnight UTC. * Useful for showing "X / daily cap" UI. */ readonly dailySpent: number; /** * Whether a wallet row exists for this DID. False on a never-funded * identity — `balance` will be 0 in that case. */ readonly exists: boolean; } export interface WalletNamespaceDeps { /** Auth instance — the wallet reads the active owner DID + signing key from here. */ readonly auth: AithosAuth; /** App DID — sent as audit attribution alongside the balance request. */ readonly appDid: string; readonly endpoints: AithosSdkEndpoints; readonly fetch: typeof fetch; } /** * `sdk.wallet` namespace. */ export declare class WalletNamespace { #private; constructor(deps: WalletNamespaceDeps); /** * Create a Stripe Checkout session for a credit-pack purchase. Returns the * hosted URL — the caller is responsible for redirecting the user (e.g. * `window.location.href = result.checkoutUrl`). * * On success, the Stripe webhook will credit the user's wallet once the * payment clears. Wallet balances are shared across all Aithos apps that * use the same DID. */ createTopupSession(args: CreateTopupSessionArgs): Promise; /** * Read the user's current wallet balance. * * Routed through the compute proxy at `${compute}/v1/invoke` because * that's where the Aithos-platform DDB IAM lives — keeps the wallet * Lambda focused on Stripe and avoids granting read-on-wallet to a * second function. The call is gated by the same signed-envelope * verification as `invokeBedrock`: only the owner of the user's * `#public` key can read their balance. * * Returns `{ balance: 0, exists: false, dailySpent: 0 }` for an * identity that has never been funded — the call still succeeds, * the row just doesn't exist yet. * * @throws {AithosSDKError} on protocol errors (network, http, * envelope-verify failures from the proxy). */ getBalance(args?: GetBalanceArgs): Promise; } //# sourceMappingURL=wallet.d.ts.map