Skip to content

[Template] Update x402 template#109

Open
AyushBherwani1998 wants to merge 5 commits into
mainfrom
chore/server-template
Open

[Template] Update x402 template#109
AyushBherwani1998 wants to merge 5 commits into
mainfrom
chore/server-template

Conversation

@AyushBherwani1998
Copy link
Copy Markdown
Member

@AyushBherwani1998 AyushBherwani1998 commented May 21, 2026

Description

  • Update x402 template to use @metamask/x402 package, and change the network to Base Sepolia.

Note

Medium Risk
Updates payment scheme wiring and network/facilitator defaults in the x402 server template, which can affect payment enforcement and compatibility. Risk is moderate since changes are confined to a template but touch core payment configuration.

Overview
Updates the Node x402-server template to use @metamask/x402’s x402ExactEvmErc7710ServerScheme instead of the custom local ERC-7710 scheme implementation (and removes src/scheme.ts).

Switches default configuration from Base mainnet to Base Sepolia (eip155:84532) and updates the example FACILITATOR_URL accordingly, alongside dependency updates (adds @metamask/x402/viem, drops @x402/express, and aligns @types/node to v18).

Reviewed by Cursor Bugbot for commit 1e7b169. Bugbot is set up for automated code reviews on this repo. Configure here.

@AyushBherwani1998 AyushBherwani1998 requested review from a team as code owners May 21, 2026 03:47
Comment thread templates/node/x402-server/package.json
"dependencies": {
"@metamask/x402": "^0.1.0",
"@x402/core": "^2.12.0",
"@x402/evm": "^2.12.0",
Copy link
Copy Markdown
Contributor

@jeffsmale90 jeffsmale90 May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@metamask/x402 declares the following peer dependencies:

  "@x402/core": "^2.12.0",
  "@x402/evm": "^2.12.0",
  "viem": "^2.31.4"

I think you'll need to add @x402/evm back in, along with viem (viem is just used to validate the address in the server side, maybe we should remove that dependency 🤔

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c9da301. Configure here.

Comment thread templates/node/x402-server/package.json Outdated
@TateLyman
Copy link
Copy Markdown

Ran a static pass on the x402 template update and found one blocking packaging issue.

templates/node/x402-server/src/index.ts still imports the middleware from @x402/express:

import { paymentMiddleware } from "@x402/express";

But the template package now drops @x402/express from templates/node/x402-server/package.json; the final dependency set keeps @metamask/x402, @x402/core, @x402/evm, viem, cors, dotenv, and express, but not @x402/express.

That means a user who generates the x402-server template and runs its own install/build will fail on module resolution. This can also be easy to miss in repo-level checks because this PR changes the root tsconfig.json to exclude ./templates.

Patch direction is either:

  • add @x402/express back to the template dependencies, or
  • switch the template code to the intended replacement middleware if @metamask/x402 is supposed to own that layer now.

No payment headers, wallets, private endpoints, or live facilitator calls were used for this pass.

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.

3 participants