Phase 3.9: ATXPAccountHandler, settle-at-start, X402 fixes#149
Merged
Conversation
Phase 3.9 SDK changes: Client: - ATXPAccountHandler: exclusive handler for ATXPAccount, delegates to /authorize/auto - ATXPAccount never falls back to push mode (errors instead) - Handler guard: tryProtocolHandlers only runs on HTTP 402 (not raw MCP 200s) - X402ProtocolHandler: static import, enriches requirements with asset/mimeType - buildPaymentHeaders supports 'atxp' protocol (X-ATXP-PAYMENT header) - checkForATXPResponse preserves original -32042 error data Server: - detectProtocol: detects X-ATXP-PAYMENT header for ATXP pull mode - Express middleware: settle-at-start (credits ledger before MCP handler runs) - buildX402Requirements: filters to X402-compatible networks (base/base_sepolia) - destinationAccountId in X402/MPP settle bodies Build fix: - Rollup dist/node_modules cleanup in client and base package build scripts - x402 static imports (fixes module resolution in workspaces) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…start docs - 7 unit tests for ATXPAccountHandler (canHandle, authorize delegation, error paths) - Replace instanceof ATXPAccount with Account.usesAccountsAuthorize interface property - Fix lazy-init race in getSettlement() (promise caching) - USDC address source comment (Circle docs link) - Remove cli-base.ts (dev test utility, doesn't belong in PR) - buildAuthorizeParams: error log with challenge keys on missing amount - Settle-at-start tradeoff documented (pay-before-serve vs serve-before-pay) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mpty accepts warning - Fix buildSyntheticResponseFromMcpError spread order (x402 fields win over errorData) - 10 settle-at-start Express middleware tests (settle→proceed, settle-fail→402, identity) - resolveIdentity ATXP: handle both base64 and raw JSON (matches MPP pattern) - buildOmniError: warn when X402 accepts is empty after filtering - Remove CLAUDE.local.md, add to .gitignore - Update PR description with usesAccountsAuthorize, tests, settle-at-start docs Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Rollout
No feature flags needed. SDK changes only take effect when developers upgrade to this version.
Breaking change for ATXPAccount users: ATXPAccount now uses
ATXPAccountHandlerexclusively (delegates to/authorize/auto). Requires the server SDK to also be upgraded (settle-at-start middleware). Old server + new client = payment failure for ATXPAccount. Upgrade both together.Non-ATXPAccount users (BaseAccount, SolanaAccount): No breaking changes. X402/MPP handlers + push-mode fallback work as before.
Summary
Client (@atxp/client):
ATXPAccountHandler: exclusive handler for ATXPAccount, delegates ALL protocol decisions to accounts/authorize/autoAccount.usesAccountsAuthorizeinterface property replaces brittleinstanceof ATXPAccountchecktryProtocolHandlersonly runs on HTTP 402 (fixes MPP handler intercepting raw MCP 200s)buildPaymentHeaderssupportsatxpprotocol →X-ATXP-PAYMENTheadercheckForATXPResponsepreserves original -32042 omni-challenge dataServer (@atxp/server, @atxp/express):
detectProtocol: detectsX-ATXP-PAYMENTheader for ATXP pull modebuildX402Requirements: filters to X402-compatible networks (base/base_sepolia), warns on empty acceptsdestinationAccountIdpassed in X402/MPP settle bodiesBuild fixes:
dist/node_modulescleanup in client and base package build scriptsx402static imports (fixes module resolution in workspaces)Test plan
npm run buildsucceeds, no dist/node_modules issues🤖 Generated with Claude Code