import type { APIPromise, HttpClient } from "../http.js"; import type { NetworkId } from "../chains/index.js"; import { type SpendControls } from "@x402/core/client"; export type { SpendControls } from "@x402/core/client"; import { type ClientEvmSigner } from "@x402/evm"; import type { PaymentMode, Receipt, FacilitatorChainsResponse, FacilitatorSupportedResponse, ModelMeterInput, ModelMeterQuote, PaymentAbortInput, PaymentAbortResponse, PaymentPayload, PaymentPrepareInput, PaymentPrepareResponse, PaymentRequired, PaymentRequirements, PaymentSettleInput, PaymentSettleResponse, SettleResponse, VerifyResponse, X402PaymentSigner } from "../types/index.js"; export declare function encodePaymentPayload(payload: PaymentPayload): string; export declare function encodePaymentSignature(value: string | PaymentPayload): string; export declare function createX402EvmSigner(signer: ClientEvmSigner, options?: { rpcUrl?: string; schemes?: Array<"batch-settlement" | "upto" | "exact">; spendControls?: SpendControls | false; channelSalt?: `0x${string}`; }): X402PaymentSigner; export declare function createPrivateKeyX402EvmSigner(input: { privateKey: string; rpcUrl?: string; schemes?: Array<"batch-settlement" | "upto" | "exact">; spendControls?: SpendControls | false; }): X402PaymentSigner; export declare function createPrivateKeyX402EvmWallet(input: { privateKey: string; rpcUrl?: string; schemes?: Array<"batch-settlement" | "upto" | "exact">; spendControls?: SpendControls | false; channelSalt?: `0x${string}`; }): { address: `0x${string}`; x402Signer: X402PaymentSigner; }; export declare class FacilitatorResource { private readonly client; constructor(client: HttpClient); supported(): APIPromise; chains(): APIPromise; verify(body: { x402Version: 2; paymentPayload: PaymentPayload; paymentRequirements: PaymentRequirements; }): APIPromise; settle(body: { x402Version: 2; paymentPayload: PaymentPayload; paymentRequirements: PaymentRequirements; }): APIPromise; } export declare class PaymentsResource { private readonly client; private readonly ctx; constructor(client: HttpClient, ctx: { getWalletMaybe(): { address: string | null; network: NetworkId | null; }; getTokenMaybe(): string | null; }); /** * Authorize a reusable Compose Key payment intent. The server owns budget * reservation, idempotency, x402 challenge headers, and live budget headers. */ prepare(input: PaymentPrepareInput, options?: { signal?: AbortSignal; timeoutMs?: number; }): APIPromise; /** * Settle a prepared payment intent with either an explicit final amount or * an authoritative meter. The API rejects settlement above the authorized * cap; the SDK only forwards the typed contract. */ settle(input: PaymentSettleInput, options?: { signal?: AbortSignal; timeoutMs?: number; }): APIPromise; abort(input: PaymentAbortInput, options?: { signal?: AbortSignal; timeoutMs?: number; }): APIPromise; /** * Ask the server to resolve the authoritative model-meter quote from the * catalog and metering telemetry. No model/provider allowlists live here. */ meterModel(input: ModelMeterInput, options?: { signal?: AbortSignal; timeoutMs?: number; }): APIPromise; } export declare class X402 { private readonly fetchWithPayment?; readonly facilitator: FacilitatorResource; readonly payments: PaymentsResource; constructor(client: HttpClient, ctx: { getWalletMaybe(): { address: string | null; network: NetworkId | null; }; getTokenMaybe(): string | null; }, fetchWithPayment?: ((input: RequestInfo | URL, init?: RequestInit & { paymentMode?: PaymentMode; }) => Promise) | undefined); fetch(input: RequestInfo | URL, init?: RequestInit): Promise; /** * Decode the base64-url PAYMENT-REQUIRED header into a typed * `PaymentRequired` body. Throws on malformed input. */ decodePaymentRequired(headerValue: string): PaymentRequired; /** * Decode the base64-url PAYMENT-RESPONSE header into a typed * `SettleResponse` body. Throws on malformed input. */ decodePaymentResponse(headerValue: string): SettleResponse; /** * Encode a signed x402 `PaymentPayload` for the PAYMENT-SIGNATURE header. * If a signer already returned a string, this returns it unchanged. */ encodePaymentSignature(value: string | PaymentPayload): string; /** * Decode the base64-url X-Receipt header. Throws on malformed input. */ decodeReceipt(headerValue: string): Receipt; } //# sourceMappingURL=x402.d.ts.map