Protects GET /weather behind x402 payment. src/index.ts is chain-agnostic;
each chain's scheme registration + accepts entry lives in src/chains/.
A resource server never signs or holds funds. It only:
- advertises
accepts(price +payToaddress) per enabled chain, and - delegates verify/settle to a facilitator over HTTP (
HTTPFacilitatorClient).
So there is no agent-wallet here — just public payout addresses. A chain is
advertised only when its *_ADDRESS is set, so you can accept EVM-only,
TRON-only, or both.
# Start a facilitator first (see ../../facilitator/basic), then:
pnpm install # from examples/typescript
pnpm dev # or: pnpm --filter @bankofai/x402-example-server-express devThen pay it with the fetch client (../../clients/fetch).
| Chain | Network | Tokens advertised | payTo env |
|---|---|---|---|
| EVM | eip155:97 (BSC testnet) |
DHLU (eip3009), USDC (permit2) | EVM_ADDRESS |
| TRON | tron:0xcd8690dc |
USDT, USDD (permit2) | TRON_ADDRESS |
Tokens are configured per network in src/chains/evm.ts (EVM_TOKENS) and
src/chains/tron.ts. BSC USDC needs a one-time Permit2 approve, advertised via
the gas-sponsoring extension; DHLU (ERC-3009) needs none.