Skip to content

chore(deps): migrate x402 SDK to x402-foundation/x402/go (unlocks upto + batch-settlement)#613

Closed
bussyjd wants to merge 2 commits into
mainfrom
chore/bump-coinbase-x402-go
Closed

chore(deps): migrate x402 SDK to x402-foundation/x402/go (unlocks upto + batch-settlement)#613
bussyjd wants to merge 2 commits into
mainfrom
chore/bump-coinbase-x402-go

Conversation

@bussyjd

@bussyjd bussyjd commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

Migrates the x402 Go SDK from github.com/coinbase/x402/gogithubproxy.fjygbaifeng.eu.org/x402-foundation/x402/go and pins v0.0.0-20260529172747.

This is a module-path migration, not a version bump: the SDK renamed its module path in the post-2026-03-31 releases, so a plain go get @latest fails with:

module declares its path as: github.com/x402-foundation/x402/go
        but was required as:  github.com/coinbase/x402/go

The foundation module is the maintained path (and the one where new schemes land). Only one import path is used across the tree — …/go/types (aliased x402types) — rewritten in 18 files. The types API is unchanged: PaymentRequirements, PaymentPayload, PaymentRequired, ResourceInfo all present with the same shape, so this is a pure path swap.

Why now

Unlocks the schemes we need for the demand-side / escrow direction, already shipped in this pin under mechanisms/evm/:

  • upto — usage-metered, Permit2 witness.to recipient-bound, settle ≤ authorized max (incl. 0). Entry points: NewUptoEvmScheme, CreateUptoPermit2Payload, SettleUptoPermit2.
  • batch-settlement — deferred/payment-channel batch settle (ComputeChannelId, CreateBatchedPermit2DepositPayload, deposit/claim/refund).

The funds-locked authCapture escrow scheme is still in-flight (draft x402-foundation/x402#2298; spec already on that repo's main) — not in this pin. Leveling up to it later is just a pin bump once it merges, no second migration.

Testing

  • go build ./...
  • Full unit suite: 34 packages, 0 failures ✅ (incl. internal/x402/..., internal/x402/buyer, internal/serviceoffercontroller, internal/inference)
  • go.sum clean of coinbase/x402

🤖 Generated with Claude Code

bussyjd and others added 2 commits June 9, 2026 15:13
…o + batch-settlement)

The coinbase/x402/go module renamed its path to github.com/x402-foundation/x402/go
in the post-2026-03-31 releases, so a plain version bump fails with a module-path
mismatch. Migrate imports github.com/coinbase/x402/go/types ->
github.com/x402-foundation/x402/go/types and pin v0.0.0-20260529172747.

The foundation module is the maintained path and already ships the `upto`
(usage-metered, recipient-bound, settle<=max) and `batch-settlement` (deferred
batch settle) EVM schemes; the `authCapture` funds-locked escrow scheme is still
in-flight as draft x402-foundation/x402#2298. Types API is unchanged
(PaymentRequirements/PaymentPayload/PaymentRequired/ResourceInfo); build and full
unit suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bussyjd added a commit that referenced this pull request Jun 9, 2026
Runs a local x402-paid MCP (Model Context Protocol) server. The paid tool
forwards the buyer's JSON arguments to a backend HTTP service and returns the
response, so any real service can be resold to agents per call. Buyers settle
in-band via the MCP request _meta["x402/payment"] field (per
specs/transports-v2/mcp.md); verify -> execute -> settle runs inside the tool
call, so a caller is never charged for a failed tool. Mirrors the canonical x402
paid-MCP example (a paid get_weather tool), generalising the upstream from a
stub to a real backend.

- internal/x402mcp: PaymentWrapper over the official modelcontextprotocol/go-sdk;
  proxyTool forwards args (+ optional backend auth header, set server-side, never
  sent to buyers) and returns the service response; free ping tool + /health.
- cmd/obol/sell.go: `sell mcp` subcommand (--pay-to/--price/--chain/--tool-name/
  --port/--upstream/--upstream-header/--description/--facilitator).

Built on the x402-foundation/x402/go SDK; stacked on #613 (SDK module-path
migration). go test ./internal/x402mcp/... ./cmd/obol/... green; gofmt/vet clean.
bussyjd added a commit that referenced this pull request Jun 9, 2026
Module-path migration (not a version bump): the SDK renamed its path in the
post-2026-03-31 releases. `github.com/coinbase/x402/go` →
`github.com/x402-foundation/x402/go` @ v0.0.0-20260529172747; the foundation
module is the maintained path (and where new schemes land). Pure path swap of
the single `.../go/types` import across the tree; types API unchanged. Unlocks
the upto + batch-settlement schemes already shipped under mechanisms/evm/.

Folded in from #613 so this branch is self-contained on the latest module.
@bussyjd

bussyjd commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #609. The x402 SDK module-path migration (coinbase/x402/gox402-foundation/x402/go) is folded into #609 as commit 0a8d04e, alongside the obol sell mcp feature, so it lands as a single PR off main on the latest module. Closing as superseded.

@bussyjd bussyjd closed this Jun 9, 2026
OisinKyne pushed a commit that referenced this pull request Jun 10, 2026
Module-path migration (not a version bump): the SDK renamed its path in the
post-2026-03-31 releases. `github.com/coinbase/x402/go` →
`github.com/x402-foundation/x402/go` @ v0.0.0-20260529172747; the foundation
module is the maintained path (and where new schemes land). Pure path swap of
the single `.../go/types` import across the tree; types API unchanged. Unlocks
the upto + batch-settlement schemes already shipped under mechanisms/evm/.

Folded in from #613 so this branch is self-contained on the latest module.
@OisinKyne
OisinKyne deleted the chore/bump-coinbase-x402-go branch July 1, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant