wrapFetch
このコンテンツはまだ日本語訳がありません。
wrapFetch(
params):X402Fetch
Defined in: src/x402/fetch.ts:146
Returns an x402-aware fetch that pays for 402 responses on the caller’s
behalf using the provided signer.
Parameters
params
Returns
Example
import { privateKeyToAccount } from "viem/accounts";import { createX402PaymentSigner, wrapFetch } from "kawasekit";
const signer = createX402PaymentSigner({ account: privateKeyToAccount(process.env.PAYER_PK as `0x${string}`),});const fetch402 = wrapFetch({ signer });
const res = await fetch402("https://api.example.com/weather?city=Tokyo");console.log(await res.json());