-
Notifications
You must be signed in to change notification settings - Fork 6
Open
9 / 109 of 10 issues completedOpen
9 / 109 of 10 issues completed
Copy link
Description
We plan to upgrade x402x’s x402 dependency to official x402 v2, but the migration is large and should be delivered incrementally without breaking existing v1 consumers (including the showcase and facilitator).
This issue tracks the agreed delivery plan and package-splitting strategy.
Context
- Current repo depends on x402 via a patched alias (
x402: npm:@x402x/x402@...) while official v2 is published as@x402/*. - The main risk is not package-name conflicts, but mixing v1/v2 types and protocol semantics (headers, network IDs, Payment* structures) inside the same TypeScript package.
- Upstream x402 v1 compatibility is layered (core/http client is version-aware; framework wrappers have
legacy/*), so we’ll be explicit about boundaries in x402x as well.
Decisions (confirmed)
- Create
@x402x/core_v2that re-exports official v2 types from@x402/core/types. - v2 packages are workspace-only (
private: true), not published to npm during migration. - No changes to existing public packages and runtime behavior for now:
@x402x/core,@x402x/fetch,@x402x/hono,@x402x/express- showcase and facilitator remain on v1 behavior until v2 is complete.
- New v2 packages participate in CI (
pnpm -r --filter "@x402x/*" test).
Proposed package split (migration period)
v1 (unchanged)
@x402x/corecontinues to depend on patchedx402and can importx402/*.@x402x/fetch,@x402x/hono,@x402x/expresscontinue using v1 semantics and dependencies.- Showcase/facilitator keep current behavior (headers etc.).
v2 (new, workspace-only)
@x402x/core_v2:- depends only on
@x402/*(at least@x402/core) +viem - MUST NOT depend on patched
x402. - provides helper for
x402x-router-settlementextension and structuredPaymentRequirements.extra.
- depends only on
@x402x/fetch_v2:- thin wrapper over
@x402/fetch - registers a custom x402x exact-EVM
SchemeNetworkClientto support router settlement (commitment + EIP-712) and delegates to official exact EVM otherwise.
- thin wrapper over
@x402x/hono_v2/@x402x/express_v2:- thin wrappers over
@x402/hono/@x402/express - implement/override
SchemeNetworkServer.enhancePaymentRequirementsto inject extension + extra and supporteip155:*wildcard.
- thin wrappers over
- (optional) a v2 facilitator mechanism package can be added later using the same separation.
Guardrails
- Enforce import boundaries with lint:
*_v2packages: forbidx402/*imports.- v1 packages: forbid
@x402/*imports.
Milestones (incremental)
- Add
@x402x/core_v2(private) + re-export@x402/core/types; implementx402x-router-settlementhelpers andextrautilities. - Add
@x402x/fetch_v2(private): wrapper over@x402/fetch+ custom x402x exact-EVM client scheme. - Add
@x402x/hono_v2and@x402x/express_v2(private): wrapper over official middleware + custom server scheme. - Implement v2 router settlement mechanism in facilitator (SchemeNetworkFacilitator.verify/settle calling SettlementRouter).
- After v2 feature-complete: switch public
@x402x/*default implementations to v2 and remove v1 patch/alias + clean docs.
Testing expectations
- Add v2 e2e coverage (client/server/facilitator, incl. settlement) within the new v2 packages.
- Keep CI green for both v1 and v2 workspace-only packages throughout.
Reference
docs/x402x-v2-plan.md(updated with this plan and decisions).
Reactions are currently unavailable
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels