Skip to main content

Crate r402_aptos

Crate r402_aptos 

Source
Expand description

Aptos chain support for the x402 payment protocol.

This crate implements the x402 "exact" scheme for Aptos: the buyer signs a 0x1::primary_fungible_store::transfer of a fungible asset, and a facilitator fee payer submits it after aptos-sdk 0.6 preflight.

§Features

  • CAIP-2 Addressing: aptos:1 (mainnet) and aptos:2 (testnet)
  • Fungible Asset payments: exact primary_fungible_store::transfer
  • Fee-payer sponsorship: extra.feePayer is copied from /supported
  • In-process facilitator: verify and settle via aptos-sdk 0.6.0

§Feature Flags

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

Re-exports§

pub use chain::AptosChainProvider;facilitator
pub use chain::AptosFeePayer;facilitator
pub use chain::DecodedAptosPayload;client or facilitator
pub use chain::SimpleTransaction;client or facilitator
pub use chain::decode_aptos_payload;client or facilitator
pub use chain::encode_aptos_payload;client or facilitator
pub use exact::AptosExact;
pub use exact::client::AptosExactClient;client
pub use exact::client::AptosSigner;client
pub use exact::facilitator::AptosExactFacilitator;facilitator
pub use exact::facilitator::AptosExactFacilitatorConfig;facilitator

Modules§

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

Structs§

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

Constants§

DEFAULT_CLIENT_MAX_GAS
Client max_gas_amount — Aptos SDK simple-tx default, under MAX_GAS_AMOUNT.
DEFAULT_GAS_UNIT_PRICE
Client gas_unit_price when estimate is unavailable.
DEFAULT_TOKEN_DECIMALS
Default USDC decimal precision.
EXPIRATION_BUFFER_SECONDS
Verify rejects expirations closer than this many seconds.
FUNGIBLE_ASSET_METADATA
Type argument on both transfer entry functions.
FUNGIBLE_ASSET_TRANSFER
0x1::fungible_asset::transfer (also accepted at verify).
MAX_GAS_AMOUNT
Sponsored-transaction cap on max_gas_amount (@x402/aptos MAX_GAS_AMOUNT).
MAX_GAS_UNIT_PRICE
Sponsored-transaction cap on gas_unit_price octas (MAX_GAS_UNIT_PRICE).
PRIMARY_FUNGIBLE_STORE_TRANSFER
0x1::primary_fungible_store::transfer (client-built path).

Statics§

APTOS_NETWORKS
Well-known Aptos networks with their names and CAIP-2 identifiers.

Functions§

usdc_aptos_deployment
Returns the USDC deployment for a specific Aptos chain, if known.
usdc_aptos_deployments
Returns all known USDC deployments on Aptos chains.