feat(mpp): advertise Tempo MPP session intent + thread settlementOverrides#183
Open
badjer wants to merge 2 commits into
Open
feat(mpp): advertise Tempo MPP session intent + thread settlementOverrides#183badjer wants to merge 2 commits into
badjer wants to merge 2 commits into
Conversation
…rides Phase 4 SDK wire contract for TIP-1034 Tempo MPP sessions. Backwards-compatible: the session intent is advertised only when the auth server exposes a settler, and charge stays the default. - omniChallenge.ts: fetchMppSupported() (GET /mpp/supported, TTL-cached like the x402 /supported fetch); buildMppChallenges advertises a tempo intent:'session' challenge (methodDetails: escrowContract/authorizedSigner/operator) alongside charge when mppSession is present; threaded through buildOmniChallenge + buildPaymentOptions. - protocol.ts: MPP buildRequestBody threads actualAmount -> settlementOverrides .amount (raw uUSDC) for session credentials so auth settles the metered actual; removed the settle_actual_dropped warning. - requirePayment.ts: fetch /mpp/supported alongside /x402/supported, threaded in. Verified E2E on Tempo mainnet with accounts + auth (session settles the actual). Pairs with accounts + auth PRs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…iled settle retryable A TIP-1034 session opens an on-chain channel (deposit locked) at authorize, so it must settle even at spent=0 to refund the deposit -- the spent<=0 early-return stranded it. Scope that to channel sessions via PaymentSessionState.requiresClose; one-shot atxp/x402 keep the no-op-at-zero-spend behavior. On settle failure, leave a channel session unsettled so the locked deposit can be re-driven later (on-chain close is idempotent); one-shot protocols still mark settled (nothing to re-drive). Add a re-entrancy (settling) guard. Share isMppSessionCredential between protocol.ts and paymentSession.ts so both classify a credential identically. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 4 — SDK wire contract for Tempo MPP sessions
Lets a resource server advertise the TIP-1034 session intent and settle the metered actual for MPP. Backwards-compatible: the session intent is advertised only when the auth server exposes a settler (
/mpp/supported), andchargestays the default.omniChallenge.ts:fetchMppSupported()(GET/mpp/supported, TTL-cached, same pattern as the x402/supportedfetch);buildMppChallengesadvertises a tempointent:'session'challenge (withmethodDetails: escrowContract / authorizedSigner / operator) alongsidechargewhenmppSessionis present; threaded throughbuildOmniChallenge+buildPaymentOptions.protocol.ts: MPPbuildRequestBodythreadsactualAmount → settlementOverrides.amount(raw µUSDC) for session credentials so auth settles the metered actual; removed thesettle_actual_droppedwarning.requirePayment.ts: fetch/mpp/supportedalongside/x402/supported, threaded into the challenge.Verified
Local E2E on Tempo mainnet with the accounts + auth PRs: session metered locally and settled the actual ($0.003, txHash
0x88f97ba7…).Pairs with the accounts + auth PRs.
🤖 Generated with Claude Code