import type { ToolEntry } from '../types.js';
import type { PaymentHeaders, PaymentMeta, PaymentProvider, RequestHeaders } from './types.js';
/**
 * x402 payment requirements returned by the Apify API.
 * Decoded from the base64 `payment-required` response header.
 */
export type X402PaymentRequirements = Record<string, unknown>;
/**
 * Fetches x402 payment requirements from the Apify API.
 * Uses a module-level cache with a 30-minute TTL to prevent blocking SSE setup on every connection.
 *
 * Sends a request with `x-apify-payment-protocol: x402` header which triggers
 * a 402 response containing the payment requirements in the `payment-required` header.
 *
 * @returns The decoded payment requirements, or undefined if the fetch fails.
 */
export declare function fetchX402PaymentRequirements(): Promise<X402PaymentRequirements | undefined>;
/**
 * x402 payment provider.
 *
 * Reads x402 payment signatures from MCP `_meta["x402/payment"]` or the incoming
 * HTTP `PAYMENT-SIGNATURE` header, and forwards them as `PAYMENT-SIGNATURE`
 * headers to the Apify API.
 *
 * Protocol flow:
 * 1. Client reads `_meta.x402` from tool definitions to know payment is required
 * 2. Client signs an EIP-3009 TransferWithAuthorization and includes it in
 *    `_meta["x402/payment"]` (JSON object) and/or the `PAYMENT-SIGNATURE` HTTP header (base64)
 * 3. This provider extracts the payment (preferring `_meta`, falling back to HTTP header),
 *    base64-encodes it if needed, and forwards as PAYMENT-SIGNATURE header
 * 4. The Apify API verifies and settles the payment
 */
export declare class X402PaymentProvider implements PaymentProvider {
    private readonly requirements?;
    readonly id: "x402";
    readonly allowsUnauthenticated = true;
    constructor(requirements?: X402PaymentRequirements | undefined);
    /**
     * Creates an X402PaymentProvider, fetching payment requirements from the Apify API.
     * Falls back to a provider without full requirements if the fetch fails.
     */
    static create(): Promise<X402PaymentProvider>;
    /**
     * Extracts the first accept entry from the full payment requirements.
     * This is the flattened payment info that goes into _meta.x402 for tool schemas.
     */
    private getFirstAcceptEntry;
    decorateToolSchema(tool: ToolEntry): ToolEntry;
    validatePayment(_args: Record<string, unknown>, meta?: PaymentMeta, requestHeaders?: RequestHeaders): string | null;
    getPaymentHeaders(_args: Record<string, unknown>, meta?: PaymentMeta, requestHeaders?: RequestHeaders): PaymentHeaders;
    removePaymentFields(args: Record<string, unknown>): Record<string, unknown>;
    getPaymentRequiredData(): X402PaymentRequirements | undefined;
    getUsageGuide(): string | null;
    redactForLogging(args: unknown): unknown;
}
//# sourceMappingURL=x402.d.ts.map