Skip to main content

Crate r402_algorand

Crate r402_algorand 

Source
Expand description

Algorand chain support for the x402 payment protocol.

This crate implements the x402 "exact" scheme for Algorand: the buyer builds an atomic transaction group containing an ASA transfer and an optional facilitator-sponsored 0-amount payment that covers the group fee via fee pooling.

§Features

  • CAIP-2 Addressing: algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k and algorand:SGO1GKSzyE7IEPItTxCByw9x8FmnrCDe
  • ASA Payments: exact transfer of a token (USDC by default)
  • Fee pooling: optional 0-amount fee-payer transaction
  • In-process facilitator: algod REST verify and settle

§Feature Flags

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

Re-exports§

pub use chain::AlgodClient;client or facilitator
pub use chain::AlgorandChainProvider;facilitator
pub use chain::AlgorandSigner;client or facilitator
pub use exact::AlgorandExact;
pub use exact::client::AlgorandExactClient;client

Modules§

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

Structs§

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

Constants§

DEFAULT_TOKEN_DECIMALS
Default USDC decimal precision.
DEFAULT_VALIDITY_ROUNDS
Default first/last-valid window in rounds (last_round + this).
DEFAULT_WAIT_ROUNDS
Default number of rounds to wait for confirmation after broadcast.
MAX_REASONABLE_FEE_PER_TXN
Per-transaction fee cap used to bound facilitator fee-payer spend (µAlgo).
MAX_TRANSACTION_GROUP_SIZE
Maximum number of top-level transactions in an Algorand atomic group.
USDC_MAINNET_ASA_ID
Mainnet USDC ASA id.
USDC_TESTNET_ASA_ID
Testnet USDC ASA id.

Statics§

ALGORAND_NETWORKS
Well-known Algorand networks with their names and CAIP-2 identifiers.

Functions§

max_reasonable_group_fee
Maximum acceptable fee-payer fee for a group of group_size transactions.
usdc_algorand_deployment
Returns the USDC deployment for a specific Algorand chain, if known.
usdc_algorand_deployments
Returns all known USDC deployments on Algorand chains.