Skip to main content

Crate r402_tron

Crate r402_tron 

Source
Expand description

Tron chain support for the x402 payment protocol.

This crate provides implementations of the x402 payment protocol for Tron chains with the “exact” payment scheme based on EIP-3009 transferWithAuthorization and SUN.io Permit2 via x402ExactPermit2Proxy.

§Features

  • CAIP-2 Addressing: Uses CAIP-2 chain IDs (e.g., tron:0x2b6653dc) for chain identification
  • Base58Check Addresses: Tron-native T-prefixed addresses with 0x41 prefix
  • TIP-712 Signing: Byte-compatible with EIP-712, using secp256k1 ECDSA
  • EIP-3009 Payments: Gasless token transfers using transferWithAuthorization
  • Permit2 Payments: SUN.io Permit2 fallback for tokens without EIP-3009 (e.g. USDT)
  • TronGrid API: HTTP REST API for chain interaction (no JSON-RPC)

§Architecture

The crate is organized into two modules:

  • chain - Core Tron chain types, providers, and contract bindings
  • exact - Tron “exact” payment scheme

§Feature Flags

  • server - Server-side price tag generation
  • client - Client-side payment signing
  • facilitator - Facilitator-side payment verification and settlement
  • telemetry - OpenTelemetry tracing support

Re-exports§

pub use exact::TronExact;
pub use exact::client::Eip3009SigningParams;client
pub use exact::client::Permit2SigningParams;client
pub use exact::client::SignerLike;client
pub use exact::client::TronExactClient;client

Modules§

chain
Tron chain support for x402 payments.
exact
Tron “exact” payment scheme implementation.

Structs§

USDT
Ergonomic accessors for USDT token deployments on well-known Tron chains.

Constants§

TRON_DEFAULT_CLOCK_SKEW_TOLERANCE_SECS
Default clock-skew tolerance (seconds) applied to TIP-712 time-window checks.

Statics§

TRON_NETWORKS
Well-known Tron networks with their names and CAIP-2 identifiers.

Functions§

usdt_tron_deployment
Returns the USDT deployment for a specific Tron chain, if known.
usdt_tron_deployments
Returns all known USDT deployments on Tron chains.