TypeScript SDK for x402r refundable payments on EVM chains.
| Package | Description |
|---|---|
@x402r/sdk |
Client factory, role presets, action groups |
@x402r/core |
Types, ABIs, config, raw actions, deploy utils |
@x402r/helpers |
Payment option builder for x402 HTTP 402 flows |
pnpm add @x402r/sdk@x402r/sdk re-exports everything from @x402r/core.
import { createPublicClient, createWalletClient, http } from 'viem'
import { baseSepolia } from 'viem/chains'
import { createX402r } from '@x402r/sdk'
const publicClient = createPublicClient({ chain: baseSepolia, transport: http() })
const walletClient = createWalletClient({ chain: baseSepolia, transport: http() })
const x402r = createX402r({
publicClient,
walletClient,
operatorAddress: '0x…',
})
// paymentInfo identifies a payment (payer, receiver, token, amount, operator)
const state = await x402r.payment.getState(paymentInfo)
const config = await x402r.operator.getConfig()Base · Base Sepolia
The SDK points at the canonical commerce-payments@v1.0.0 AuthCaptureEscrow, which lives on those two chains today; other EVMs return as the canonical primitives extend coverage. See packages/core/src/config for the full registry.
pnpm install # install dependencies
pnpm build # build all packages
pnpm test # run unit tests
pnpm test:fork # run fork tests (requires Foundry)
pnpm typecheck # type-check all packages
pnpm check # biome lint + format check
pnpm format # auto-fix lint + format- @x402r/sdk — client factory, role presets, action groups → README
- @x402r/core — types, ABIs, raw actions, deploy utils → README
- @x402r/helpers — payment option builder → README
See CONTRIBUTING.md.