Expand description
MPP (Machine Payments Protocol) HTTP transport.
Wraps a standard reqwest HTTP transport with automatic 402 Payment Required handling via the MPP protocol. When the RPC endpoint returns a 402 response, this transport automatically pays the challenge and retries the request.
StructsΒ§
- Funding
Context π - Lazy
Session Provider - A payment provider that lazily initializes a
SessionProviderfrom the Tempo wallet configuration on first use. - MppHttp
Transport - HTTP transport with automatic MPP (Machine Payments Protocol) 402 handling.
ConstantsΒ§
- DEFAULT_
DEPOSIT π - Default deposit amount for new channels (in base units).
- MPP_
RETRY_ πTIMEOUT - Timeout for MPP retry requests (open/topUp may wait for on-chain settlement).
StaticsΒ§
- GLOBAL_
PAY_ πLOCKS - Process-wide payment serialization locks, keyed by origin URL.
TraitsΒ§
- Resolve
Provider π - Trait for resolving a concrete
PaymentProviderfrom a potentially lazy wrapper.
FunctionsΒ§
- can_
run_ πinteractive_ tempo_ fund - default_
deposit π - Resolve the deposit amount from
MPP_DEPOSITenv var or the default. - extract_
challenge_ πchain_ and_ currency - Extract
(chainId, currency)from a parsed MPP challenge. - format_
http_ πdiagnostics - format_
mpp_ πpayment_ failure - interactive_
tempo_ πfund_ allowed - Decide whether the interactive
tempo wallet fundflow may be launched. - maybe_
auto_ πfund - Single-attempt guard around
run_interactive_tempo_fund. - parse_
challenges π - Extract all parseable MPP challenges from a 402 responseβs
WWW-Authenticateheaders. - pick_
chain_ πneeding_ auth - Inner logic of
tempo_chain_needing_auth, factored out for testing. - run_
interactive_ πtempo_ fund - should_
suggest_ πtempo_ fund - Returns true iff a 402 response carries a structured insufficient-balance
problem (RFC 9457
PaymentErrorDetails). - tempo_
bin π - tempo_
chain_ πneeding_ auth - Returns
Some(chain_id)when a 402 response should trigger thewallet.tempo.xyzdevice-code authorization flow. - tempo_
wallet_ πfund_ help
Type AliasesΒ§
- Lazy
MppHttp Transport - Production transport: lazily discovers MPP keys from the Tempo wallet on first 402 response.