/** * Type-only exports for the DALP SDK. * * Import from `@settlemint/dalp-sdk/types` when you only need types * (e.g., for function signatures) without pulling in runtime code. * * Related: kit/sdk/src/client.ts * * @module */ import type { ContractRouterClient } from "@orpc/contract"; import type { JsonifiedClient } from "@orpc/openapi-client"; import type { rpcContract } from "./contract.js"; /** * Fully typed DALP API client. * * Uses `JsonifiedClient` because the SDK communicates via the OpenAPI/REST * endpoint where values are serialized as standard JSON (e.g., Date → string, * BigInt → string). * * Provides auto-completed access to all v2 API namespaces: * `account`, `actions`, `addons`, `admin`, `contacts`, `exchangeRates`, * `externalToken`, `identityRecovery`, `monitoring`, `search`, * `settings`, `system`, `token`, `transaction`, `user`. */ export type DalpClient = JsonifiedClient>; /** * Per-call client context threaded into individual SDK operations as the second * argument, e.g. `client.token.create(input, { context: { idempotencyKey } })`. * Every field is optional and scoped to the single call, unlike the client-level * {@link BaseDalpClientConfig.idempotencyKey} which applies to every request. */ export interface DalpClientCallContext { /** * Idempotency key sent as the `Idempotency-Key` header for this call only, * overriding any client-level key. Use a fresh value per genuine retry of a * failed mutation: dapi burns the key of a failed transaction, so re-sending * under the same key is rejected ("previously failed. Use a new idempotency * key to retry"). A stable value within one logical attempt keeps network-level * fetch retries deduplicated. */ idempotencyKey?: string; /** * oRPC error codes the caller treats as expected for this call and does not * want surfaced by its own error logging (e.g. an existence probe that accepts * `NOT_FOUND`). A client-side hint scoped to the single call; it is not sent to * the server. */ skipLoggingFor?: readonly string[]; } interface BaseDalpClientConfig { /** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */ url: string; /** * Organization ID for multi-tenant setups. * Required when the API key is scoped to multiple organizations. */ organizationId?: string; /** * Additional headers merged into every request. * Accepts a static object or a (possibly async) function for dynamic headers. * Can override defaults like `User-Agent` but cannot override security headers (`x-api-key`, `x-organization-id`). */ headers?: Record | (() => Record | Promise>); /** * Validate outgoing requests against the contract before sending. * Catches schema violations client-side for faster feedback. * @defaultValue false */ requestValidation?: boolean; /** * Validate incoming responses against the contract. * Useful during development to catch API drift. * @defaultValue false */ responseValidation?: boolean; /** * Custom `fetch` implementation. * Use this to inject logging, proxy configuration, or test doubles. */ fetch?: typeof globalThis.fetch; /** * Idempotency key sent as the `Idempotency-Key` header on every request. * * **Warning:** This value is sent on _every_ request made by the client. * If you reuse the same client instance for multiple mutations, the server * will deduplicate all but the first — subsequent mutations silently return * the first response. Only set this when the client is used for a single * mutation (e.g., a one-shot script). For multi-mutation workflows, set the * header per-request via the `headers` callback instead. * * When omitted, no idempotency key header is sent. */ idempotencyKey?: string; } /** * Configuration for creating an authenticated DALP API client. */ export interface DalpClientConfig extends BaseDalpClientConfig { /** API key for authenticated routes (issued via the DALP dashboard or CLI). */ apiKey: string; } /** * Configuration for creating a public DALP API client. */ export interface PublicDalpClientConfig extends BaseDalpClientConfig { apiKey?: undefined; } export type { WalletAuthEndpointPath } from "./auth-wallet-plugins.js"; //# sourceMappingURL=types.d.ts.map