Skip to main content

Module transport

Module transport 

Source
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Β§

FundingContext πŸ”’
LazySessionProvider
A payment provider that lazily initializes a SessionProvider from the Tempo wallet configuration on first use.
MppHttpTransport
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Β§

ResolveProvider πŸ”’
Trait for resolving a concrete PaymentProvider from a potentially lazy wrapper.

FunctionsΒ§

can_run_interactive_tempo_fund πŸ”’
default_deposit πŸ”’
Resolve the deposit amount from MPP_DEPOSIT env 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 fund flow 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-Authenticate headers.
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 the wallet.tempo.xyz device-code authorization flow.
tempo_wallet_fund_help πŸ”’

Type AliasesΒ§

LazyMppHttpTransport
Production transport: lazily discovers MPP keys from the Tempo wallet on first 402 response.