x402_facilitator/
lib.rs

1//! Rust implementation of the x402 protocol.
2//!
3//! This crate provides the core data structures and logic for working with the x402 protocol,
4//! including a reference facilitator implementation for on-chain verification and settlement.
5//!
6//! It is designed for reuse across all x402 roles:
7//! - _Facilitator_: a server that verifies and settles x402 payments (see [`facilitator`] and [`facilitator_local`])
8//! - _Seller_: a payment-gated service that consumes shared types from [`types`]
9//! - _Buyer_: a client that constructs and submits x402-compliant payments
10//!
11//! Modules:
12//! - [`facilitator`] — defines the [`facilitator::Facilitator`] trait used to validate and settle x402 payments.
13//! - [`facilitator_local`] — a concrete implementation of [`facilitator::Facilitator`].
14//! - [`network`] — enumerates supported Ethereum-compatible networks and known token deployments.
15//! - [`provider_cache`] — dynamic initialization and caching of Ethereum JSON-RPC providers.
16//! - [`telemetry`] — OpenTelemetry instrumentation setup for tracing and observability.
17//! - [`types`] — all shared x402 protocol structures and payload formats.
18
19pub mod chain;
20pub mod facilitator;
21pub mod facilitator_local;
22pub mod from_env;
23pub mod handlers;
24pub mod network;
25pub mod provider_cache;
26pub mod sig_down;
27pub mod telemetry;
28pub mod timestamp;
29pub mod types;
30
31// Hidden re-exports just for macro expansion.
32#[doc(hidden)]
33pub mod __reexports {
34    pub use alloy;
35    pub use solana_sdk;
36}