Skip to content

SDK: add multi-network EVM x402 buyer - #40

Closed
erikzrekz wants to merge 2 commits into
mainfrom
feat/evm-multinetwork-client
Closed

erikzrekz wants to merge 2 commits into
mainfrom
feat/evm-multinetwork-client

Conversation

@erikzrekz

@erikzrekz erikzrekz commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

A buyer can receive Base USDC, Radius SBC and other EVM offers in one x402 challenge. Add createEvmFetch in radius-sdk/client with explicit chains, tokens, per-asset caps, RPCs and optional per-chain signers.

The adapter uses one upstream @x402/core client to register networks and schemes, apply spend controls and policies, select an offer and create its payload. Its public onBeforePaymentCreation hook applies SDK approval policy before signing. @x402/evm supplies exact/upto signing, sponsored permits, signer adaptation and Permit2 allowance/approval helpers. Selection follows upstream payment-flow preference, then server order. A strict token policy prevents upstream's implicit default-token allowance from widening the configured assets.

The SDK retains configuration, bounded signing deadlines, typed errors, receipt validation, onchain reconciliation and one guarded HTTP retry. @x402/fetch 2.25.0 inherits redirect-following, wraps typed policy errors and permits recovery signing; preserving the SDK's manual paid redirects and one-attempt contract requires the guarded transport. The v1 CAIP-2 compatibility adapter remains, with signatures delegated upstream.

createRadiusFetch and its wallet/faucet helpers remain available. The new adapter defaults unsponsored Permit2 approval to never; explicit auto approval is subject to the policy hook. Includes documentation, a Radius + Base example and a minor changeset.

Validation on Node 24.9.0: pnpm build, pnpm typecheck, pnpm test — 144 SDK tests, 26 CLI tests and 3 runtime import checks passed. The 33 new tests cover recoverable signatures on Radius, Base, Arbitrum, Polygon, Monad and Arc testnet; strict assets/caps; upstream flow selection; policy before signing; concurrent requests; receipts and redirects; and actual approval/transfer execution in the local EVM.

No live payments. Operators must verify provider facilitator support and deployed contracts. Caps are per request. Non-EVM networks and named v1 aliases are outside this adapter.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 2e45e70

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
radius-sdk Minor
radius-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@erikzrekz erikzrekz closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant