Skip to main content

Crate r402_stellar

Crate r402_stellar 

Source
Expand description

Stellar chain support for the x402 payment protocol.

This crate implements the x402 "exact" scheme for Stellar: the buyer signs Soroban authorization entries for one SEP-41 transfer, and the facilitator is the transaction source / fee sponsor.

§Features

  • CAIP-2 Addressing: stellar:pubnet and stellar:testnet
  • SEP-41 Payments: exact transfer of a Soroban token (USDC by default)
  • Auth-entry signing: the client never spends a sequence number
  • In-process facilitator: RPC verify, rebuild, submit, and confirm

§Feature Flags

  • server — server-side price tag generation
  • client — client-side authorization-entry signing
  • facilitator — facilitator-side payment verification and settlement
  • telemetrytracing instrumentation

Re-exports§

pub use chain::StellarJsonRpc;client or facilitator
pub use chain::StellarChainProvider;facilitator
pub use chain::StellarFacilitatorError;facilitator
pub use chain::StellarRpc;client or facilitator
pub use chain::StellarRpcError;client or facilitator
pub use chain::StellarSigner;client or facilitator
pub use exact::StellarExact;
pub use exact::client::StellarExactClient;client

Modules§

chain
Stellar chain support for x402 payments.
exact
Stellar "exact" payment scheme implementation.

Structs§

USDC
Ergonomic accessors for USDC token deployments on well-known Stellar chains.

Constants§

BASE_FEE_STROOPS
Inclusion buffer in stroops (BASE_FEE in the official Stellar SDK).
DEFAULT_ESTIMATED_LEDGER_SECONDS
Fallback ledger close time when Horizon is unavailable.
DEFAULT_MAX_TRANSACTION_FEE_STROOPS
Safety ceiling for simulation-derived settlement fees (stroops).
DEFAULT_TIMEOUT_SECONDS
Default maxTimeoutSeconds when the requirement omits it.
DEFAULT_TOKEN_DECIMALS
Default USDC decimal precision on Stellar (SEP-41).
HORIZON_LEDGERS_SAMPLE_SIZE
Number of recent Horizon ledgers sampled for close-time estimation.
NULL_ACCOUNT
Dummy source used by the client so only auth entries are signed.
SIGNATURE_EXPIRATION_LEDGER_TOLERANCE
Ledger-skew tolerance applied to auth-entry expiration.
TRANSFER_FUNCTION
SEP-41 transfer method name.
USDC_PUBNET_ADDRESS
USDC contract on Stellar pubnet.
USDC_TESTNET_ADDRESS
USDC contract on Stellar testnet.

Statics§

STELLAR_NETWORKS
Well-known Stellar networks with their names and CAIP-2 identifiers.

Functions§

network_idclient or facilitator
SHA-256 of the network passphrase (Stellar network id).
timeout_ledgers
ledgerTimeout = ceil(maxTimeoutSeconds / estimatedLedgerSeconds).
usdc_stellar_deployment
Returns the USDC deployment for a specific Stellar chain, if known.
usdc_stellar_deployments
Returns all known USDC deployments on Stellar chains.