Skip to main content

Prerequisites

  • A wallet on any of 11 supported EVM chains (Ethereum, Base, Arbitrum, Optimism, etc.)
  • USDC deposited via Circle Gateway
  • x402-fetch (Node) or x402-requests (Python) installed

TypeScript example

npm install x402-fetch viem
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
import { wrapFetchWithPayment } from "x402-fetch";

const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const client = createWalletClient({ account, chain: base, transport: http() });

// Wrap fetch with x402 payment support
const fetchWithPayment = wrapFetchWithPayment(fetch, client);

// Make a paid call — no API key needed
const res = await fetchWithPayment(
  "https://data-tools.prd.arrays.org/api/v1/crypto/funding-rate?symbol=BTCUSDT"
);

console.log(await res.json());
That’s it. The first call returns 402; wrapFetchWithPayment automatically signs, retries, and returns the data.

Python example

pip install x402-requests
import os
from x402_requests import X402Session
from eth_account import Account

account = Account.from_key(os.environ["PRIVATE_KEY"])
session = X402Session(account=account, chain="base")

res = session.get(
    "https://data-tools.prd.arrays.org/api/v1/crypto/funding-rate",
    params={"symbol": "BTCUSDT"},
)
print(res.json())

Cost math

How much will it actually cost?
Use caseCalls / monthTierCost
Daily funding-rate snapshot30$0.008$0.24
Hourly funding-rate for 10 pairs7,200$0.008$57.60
Crypto screener every 5 min8,640$0.03$259.20
At >5,000 calls/month, the Pro plan ($29/mo) becomes cheaper than basic-tier nanopayment. Mix both: Pro for steady workloads, Nanopayment for spikes.

Troubleshooting

Top up via Circle Gateway. The error response includes the exact amount needed.
Nanopayment supports 11 EVM chains. Check your wallet client is on Base, Ethereum, Arbitrum, Optimism, Polygon, or another supported chain.
Make sure your wallet client uses the same account that holds the USDC. EIP-3009 requires the signer == token holder.