Skip to main content

Crate r402_evm

Crate r402_evm 

Source
Expand description

EIP-155 (EVM) chain support for the x402 payment protocol.

This crate provides implementations of the x402 payment protocol for EVM chains with the “exact” payment scheme based on ERC-3009 transferWithAuthorization.

§Features

  • CAIP-2 Addressing: Uses CAIP-2 chain IDs (e.g., eip155:8453) for chain identification
  • ERC-3009 Payments: Gasless token transfers using transferWithAuthorization
  • Smart Wallet Support: EIP-1271 for deployed wallets, EIP-6492 for counterfactual wallets
  • Multiple Signers: Round-robin signer selection for load distribution
  • Nonce Management: Automatic nonce tracking with pending transaction awareness

§Architecture

The crate is organized into several modules:

  • chain - Core EVM chain types, providers, and configuration
  • exact - EIP-155 “exact” payment scheme

§Feature Flags

  • server - Server-side price tag generation
  • client - Client-side payment signing
  • facilitator - Facilitator-side payment verification and settlement
  • telemetry - OpenTelemetry tracing support

Re-exports§

pub use exact::Eip155Exact;
pub use exact::client::Eip155ExactClient;client
pub use exact::client::Eip155ExactClientBuilder;client
pub use exact::client::Permit2Approver;client

Modules§

chain
EVM chain support for x402 payments via EIP-155.
exact
EIP-155 “exact” payment scheme implementation.

Structs§

USDC
Ergonomic accessors for USDC token deployments on well-known EVM chains.
USDM
Ergonomic accessors for USDM (MegaUSD) token deployments on EVM chains.

Statics§

EVM_NETWORKS
Well-known EVM (EIP-155) networks with their names and CAIP-2 identifiers.

Functions§

usdc_evm_deployment
Returns the USDC deployment for a specific EVM chain, if known.
usdc_evm_deployments
Returns all known USDC deployments on EVM chains.
usdm_evm_deployment
Returns the USDM deployment for a specific EVM chain, if known.
usdm_evm_deployments
Returns all known USDM deployments on EVM chains.