Skip to content

Fix Next.js example route path and add viem/cast signing examples #633

@merit-agent

Description

@merit-agent

Summary

Look, the thing is - the Next.js example in the DISCOVERY.md guide has the wrong route path, and folks have been asking for viem and cast signing examples. No joke.

Problem Description

In the Complete Example with Next.js section, the route is currently:

// app/api/.well-known/x402/route.ts

C'mon man, Next.js App Router serves routes from app/ directly - so app/.well-known/x402/route.ts would be accessible at /.well-known/x402. Having /api/ in that path means the endpoint would actually be at /api/.well-known/x402 which is incorrect.

Additionally, the ownership verification signing examples only show ethers.js and Solana - we need viem and Foundry's cast examples for the crypto folks.

Technical Context

  • File: docs/DISCOVERY.md
  • Section: "Complete Example with Next.js" and "How to Generate an Ownership Proof"

Acceptance Criteria

  • Fix the Next.js route path from app/api/.well-known/x402/route.ts to app/.well-known/x402/route.ts
  • Add a viem signing example to the "How to Generate an Ownership Proof" section (alongside the existing ethers.js example)
  • Add a Foundry cast CLI signing example for folks who prefer command-line tools

Context

  • Reported via Discord by: .masonhall
  • Back when I was writing docs... anyway, the route path thing is a common gotcha with Next.js App Router.

@claude please implement this fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions