import { PaymentOptions, PaymentScheme } from '../common/types.js'; import { EnvironmentInfo, EnvironmentName } from '../environments.js'; /** * Header used by the Nevermined backend to resolve the active organization * context for an authenticated request. Resolution priority is: * path `:orgId` > this header > API-key tag > fallback membership > personal. * See `apps/api/src/common/guards/current-org-context.guard.ts` in nvm-monorepo. */ export declare const CURRENT_ORG_ID_HEADER = "X-Current-Org-Id"; /** * Options accepted by publication methods (`registerAgent`, * `registerAgentAndPlan`, `registerPlan`, …) that want to override the * active organization workspace for a single call. */ export type PublicationOptions = { /** * Organization id (e.g. `org-…`) to publish into. When set, the SDK * sends an `X-Current-Org-Id` header for this call only — the caller's * instance-level pin (set via `Payments.setOrganizationId`) is not * affected. */ organizationId?: string; }; /** * Builds the `extraHeaders` argument for `getBackendHTTPOptions` from * publication options. Returns `undefined` when no override is requested * so existing callers receive identical request shapes. */ export declare function resolvePublicationHeaders(options?: PublicationOptions): Record | undefined; /** * Base class extended by all Payments API classes. * It provides common functionality such as parsing the NVM API Key and getting the account address. */ export declare abstract class BasePaymentsAPI { protected nvmApiKey: string; protected scheme: PaymentScheme; protected environment: EnvironmentInfo; protected environmentName: EnvironmentName; protected returnUrl: string; protected appId?: string; /** * Backend API version (MAJOR.MINOR) pinned by this instance, set from * `options.version`. When unset, every request defaults to * {@link LOCKED_API_VERSION}. */ protected version?: string; protected accountAddress: string; protected heliconeApiKey: string; protected currentOrganizationId: string | null; isBrowserInstance: boolean; constructor(options: PaymentOptions); /** * Resolves the active environment for this instance. * * The environment is derived from the NVM API key prefix * (`:`); the key wins whenever its prefix is recognized. The * deprecated `environment` option is still honored as a fallback when the * key has no recognized prefix (e.g. local/custom dev), and ultimately * defaults to `custom`. Passing `environment` emits a one-time deprecation * warning. */ private resolveEnvironmentName; /** * Parses the NVM API Key to extract the account address. * @throws PaymentsError if the API key is invalid. */ protected parseNvmApiKey(): { accountAddress: string; heliconeApiKey: string; }; /** * Returns the environment name used to initialize the Payments instance. * @returns The environment name (e.g. 'sandbox', 'live') */ getEnvironmentName(): EnvironmentName; /** * It returns the account address associated with the NVM API Key used to initialize the Payments Library instance. * @returns The account address extracted from the NVM API Key */ getAccountAddress(): string | undefined; /** * Returns the current organization context applied to every authenticated * backend request via the `X-Current-Org-Id` header. * * `null` means "no pinned workspace" — the backend falls back to the * caller's API-key tag or most-recent active membership. */ getOrganizationId(): string | null; /** * Sets the organization context applied to every subsequent authenticated * backend request via the `X-Current-Org-Id` header. * * Pass `null` to clear the pin and fall back to the backend default. * * @param organizationId - Org ID (e.g. `org-…`) or `null` to clear. */ setOrganizationId(organizationId: string | null): void; /** * Returns the HTTP options required to query the backend. * @param method - HTTP method. * @param body - Optional request body. * @param extraHeaders - Optional per-call header overrides. Use * `{ 'X-Current-Org-Id': orgId }` to target a specific workspace for * one call without mutating the instance-level pin. * @returns HTTP options object. * @internal */ protected getBackendHTTPOptions(method: string, body?: any, extraHeaders?: Record): any; /** * Get HTTP options for public backend requests (no authorization header). * Converts body keys from snake_case to camelCase for consistency. * * @param method - HTTP method * @param body - Optional request body (keys will be converted to camelCase) * @returns HTTP options object * @internal */ protected getPublicHTTPOptions(method: string, body?: any): { method: string; headers: Record; body?: string; }; } //# sourceMappingURL=base-payments.d.ts.map