// Convenience helper to create an A2AHubClient with x402-fetch payments wired in. // Note: Uses x402-fetch directly to construct a paid fetch wrapper. import { A2AHubClient } from "./a2a"; import { createSigner, wrapFetchWithPayment } from "x402-fetch"; export type PaidClientOptions = { hubUrl: string; privateKey: string; network: string; // e.g., 'base-sepolia', 'solana-devnet' headers?: HeadersInit; }; export async function createPaidA2AHubClient( opts: PaidClientOptions ): Promise { const signer = await createSigner( opts.network as any, opts.privateKey as any ); const paidFetch = wrapFetchWithPayment(fetch as any, signer) as typeof fetch; return new A2AHubClient(opts.hubUrl, { headers: opts.headers, fetch: paidFetch, }); }