/** * Single audit surface for the optional paid-fetch dependency stack. * * Every `viem` / `@x402/*` / `mppx` import the SDK performs flows through * this file. Concentrating the imports here lets a reviewer enumerate the * SDK's direct attack surface to those packages from one place, and lets * the package.json declare them as `optionalPeerDependencies` — consumers * who never make on-chain paid requests do not need to install them. * * Adding a new import here is the only way to grow the surface; doing so * also widens what consumers must install to enable paid fetch. Keep this * list minimal. When a symbol is small enough to inline (e.g. the * `viem/chains` constants are ~5-line objects), prefer inlining over * adding a new dependency edge. */ type FetchFn = typeof globalThis.fetch; export declare class PaidStackUnavailable extends Error { readonly missingPackages: readonly string[]; constructor(missing: readonly string[]); } export interface X402Stack { privateKeyToAccount: (pk: `0x${string}`) => unknown; createPublicClient: (opts: unknown) => { readContract: (args: unknown) => Promise; }; http: (url?: string) => unknown; base: unknown; baseSepolia: unknown; x402Client: new () => { setSpendControls?: (controls: unknown) => unknown; register: (network: string, scheme: unknown) => void; registerPolicy: (fn: (version: number, reqs: unknown[]) => unknown[]) => void; createPaymentPayload: (required: unknown) => Promise; }; wrapFetchWithPayment: (fetch: FetchFn, client: unknown) => FetchFn; ExactEvmScheme: new (signer: unknown) => unknown; toClientEvmSigner: (account: unknown, client: unknown) => unknown; offerReceipt: { extractOffersFromPaymentRequired: (required: unknown) => unknown[]; decodeSignedOffers: (offers: unknown[]) => unknown[]; findAcceptsObjectFromSignedOffer: (offer: unknown, accepts: unknown[]) => unknown | undefined; isEIP712SignedOffer: (offer: unknown) => boolean; isEIP712SignedReceipt: (receipt: unknown) => boolean; verifyOfferSignatureEIP712: (offer: unknown) => Promise<{ signer: `0x${string}`; payload: Record; }>; verifyReceiptSignatureEIP712: (receipt: unknown) => Promise<{ signer: `0x${string}`; payload: Record; }>; extractReceiptFromResponse: (response: Response) => unknown | undefined; }; } export interface MppStack { privateKeyToAccount: (pk: `0x${string}`) => unknown; Mppx: { create: (opts: unknown) => { fetch: FetchFn; }; }; tempo: (opts: unknown) => unknown; } export declare function loadX402Stack(): Promise; export interface LightningStack { Challenge: { deserialize: (value: string) => { method: string; intent: string; expires?: string; request?: Record; }; serialize: (challenge: unknown) => string; }; Credential: { from: (parameters: { challenge: unknown; payload: unknown; }) => unknown; serialize: (credential: unknown) => string; }; } /** The MPP challenge/credential codecs the Lightning rail needs (no Tempo, no viem). */ export declare function loadLightningStack(): Promise; export declare function loadMppStack(): Promise; export {}; //# sourceMappingURL=_paid-stack.d.ts.map