Skip to main content

Module session

Module session 

Source
Expand description

Tempo session payment provider with expiring nonces.

Custom implementation that mirrors tempoxyz/wallet’s approach: uses expiring nonces (nonce=0, nonceKey=MAX, validBefore=now+25s) for channel open transactions instead of fetching sequential nonces via eth_getTransactionCount. This avoids the chicken-and-egg problem when the RPC endpoint is itself 402-gated.

StructsΒ§

SessionProvider
Tempo session provider using expiring nonces.

EnumsΒ§

PendingAction πŸ”’
Tracks uncommitted channel state from the most recent payment.

ConstantsΒ§

EXPIRING_NONCE_KEY πŸ”’
Expiring nonce key (U256::MAX) β€” matches the charge flow.
MAX_FEE_PER_GAS πŸ”’
Max fee per gas (20 gwei β€” Tempo’s fixed base fee).
MAX_PRIORITY_FEE_PER_GAS πŸ”’
Max priority fee per gas.
MAX_PRIORITY_FEE_PER_GAS_FEE_PAYER πŸ”’
Priority fee per gas when the sponsor pays (feePayer: true). Must stay under the server-enforced MAX_PRIORITY_FEE_PER_GAS_DEFAULT (10 gwei) defined by the mpp-rs FeePayerPolicy.
SESSION_OPEN_FEE_PAYER_GAS_LIMIT πŸ”’
Gas limit for session open transactions when the sponsor pays (feePayer: true). Set to the mpp-rs FeePayerPolicy::max_gas ceiling (MAX_FEE_PAYER_GAS_LIMIT = 2_000_000, inclusive); exceeding it causes the sponsor to reject the tx with verification-failed. The previous value of 1M was too tight for Tempo mainnet passkey-wallet escrow.open, which together with the inner approve consumes ~1.2M gas and ran out of gas on-chain (tx reverted, sponsor returned generic verification-failed).
SESSION_OPEN_GAS_LIMIT πŸ”’
Default gas limit for session open transactions.
VALID_BEFORE_SECS πŸ”’
Validity window (in seconds) for expiring nonce transactions.

StaticsΒ§

GLOBAL_CHANNELS πŸ”’
Process-wide channel state registry, keyed by origin URL.
GLOBAL_PERSISTED πŸ”’
Process-wide persisted channel state, shared across ALL origins.

Type AliasesΒ§

SharedChannelState πŸ”’
Shared per-origin in-memory channel state: (channels, precompile descriptors, key_provisioned).