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 configurationsigner/permit2/asset/signature- primitives shared by every schemeexact- EIP-155 “exact” payment schemeupto- EIP-155 “upto” payment scheme (Permit2, usage-based)auth_capture- authorize / capture / charge (commerce-payments escrow)batch_settlement- capital-backed channel vouchers
§Feature Flags
server- Server-side price tag generationclient- Client-side payment signingfacilitator- Facilitator-side payment verification and settlementtelemetry-OpenTelemetrytracing support
Re-exports§
pub use error::Eip155ExactError;facilitatorpub use asset::AssetTransferMethod;pub use asset::VALIDATOR_ADDRESS;pub use auth_capture::Eip155AuthCapture;pub use auth_capture::Eip155AuthCaptureFacilitator;facilitatorpub use auth_capture::Eip155AuthCaptureClient;clientpub use auth_capture::sign_auth_capture;clientpub use batch_settlement::Eip155BatchSettlement;pub use batch_settlement::ChannelStore;facilitatorpub use batch_settlement::Eip155BatchSettlementFacilitator;facilitatorpub use batch_settlement::MemoryChannelStore;facilitatorpub use batch_settlement::compute_channel_id;facilitatorpub use batch_settlement::Eip155BatchSettlementClient;clientpub use batch_settlement::sign_voucher;clientpub use batch_settlement::sign_voucher_payload;clientpub use eip2612::EIP2612_GAS_SPONSORING_KEY;pub use eip2612::EIP2612_GAS_SPONSORING_VERSION;pub use eip2612::Eip2612ParseError;pub use eip2612::Eip2612SignedPermit;pub use erc20_approval::ERC20_APPROVAL_GAS_SPONSORING_KEY;pub use erc20_approval::ERC20_APPROVAL_GAS_SPONSORING_VERSION;pub use erc20_approval::Erc20ApprovalGasSponsoringInfo;pub use erc20_approval::Erc20ApprovalParseError;pub use exact::Eip155Exact;pub use exact::client::Eip155ExactClient;clientpub use exact::client::Eip155ExactClientBuilder;clientpub use permit2::PERMIT2_ADDRESS;pub use permit2::Permit2TokenPermissions;pub use permit2::Permit2Approver;clientpub use permit2::permit2_allowance_calldata;clientpub use permit2::permit2_approval_calldata;clientpub use signature::StructuredSignatureFormatError;facilitatorpub use signer::SignerLike;clientpub use upto::Eip155Upto;pub use upto::client::Eip155UptoClient;clientpub use upto::client::Eip2612SigningParams;clientpub use upto::client::sign_eip2612_permit;client
Modules§
- asset
- Shared EVM transfer-method and validator constants.
- auth_
capture - EIP-155
auth-capturescheme (Base commerce-payments escrow). - batch_
settlement - EIP-155
batch-settlementscheme (request-path voucher accounting). - chain
- EVM chain support for x402 payments via EIP-155.
- eip2612
- EIP-2612 gas-sponsoring extension wire types (exact + upto).
- erc20_
approval erc20ApprovalGasSponsoringextension wire types.- error
facilitator - Shared EVM facilitator errors (
exactandupto). - exact
- EIP-155 “exact” payment scheme implementation.
- permit2
- Canonical Uniswap Permit2 address, wire permissions, and client auto-approve.
- signature
facilitator - Shared EOA / EIP-1271 / EIP-6492 signature parsing and payment time windows.
- signer
client - Alloy signer abstraction used by every EVM scheme client.
- upto
- EIP-155 “upto” 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.
Constants§
- EVM_
DEFAULT_ CLOCK_ SKEW_ TOLERANCE_ SECS - Default clock-skew tolerance (seconds) applied to EIP-712 time-window checks.
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.