Skip to content

x402 facilitator: implement GET /supported #124

Description

@Miracle656

Context

Lens is currently an x402 resource server — a seller. src/middleware/x402.ts builds an x402ResourceServer around an HTTPFacilitatorClient pointed at https://facilitator.stellar.org, and delegates both verify and settle to it.

We are going to implement the other side of that interface: a facilitator, served from Lens.

The contract is not guesswork — it is published and typed in @x402/core:

interface FacilitatorClient {
  verify(paymentPayload: PaymentPayload, paymentRequirements: PaymentRequirements): Promise<VerifyResponse>;
  settle(paymentPayload: PaymentPayload, paymentRequirements: PaymentRequirements): Promise<SettleResponse>;
  getSupported(): Promise<SupportedResponse>;
}

HTTPFacilitatorClient calls exactly three routes off its base URL: POST {url}/verify, POST {url}/settle, GET {url}/supported.

This issue: GET /supported

Start here because it moves no money and holds no keys — it is pure metadata, and it is the route every client hits first to decide whether we can serve them at all.

Return the payment kinds and extensions this facilitator supports, shaped as SupportedResponse from @x402/core. At minimum the exact scheme on Stellar, for both networks — the RFP requires mainnet and testnet, and Lens is already dual-network (docs/DUAL_NETWORK.md), so read the same config rather than inventing a second source of truth.

Where to look

  • node_modules/@x402/core/dist/cjs/**/*.d.tsSupportedResponse, PaymentPayload, PaymentRequirements are all typed there. Read them; do not infer the shape from blog posts.
  • src/middleware/x402.ts — how Lens registers ExactStellarScheme today.
  • The real https://facilitator.stellar.org/supported is live. Call it and match its shape.

Acceptance criteria

  • GET /supported returns a valid SupportedResponse, type-checked against @x402/core rather than hand-rolled
  • Both networks appear, driven by existing dual-network config
  • Response matches the shape returned by facilitator.stellar.org/supported (include the comparison in the PR)
  • Tests cover the response shape
  • Route is not x402-gated — a facilitator cannot charge for its own capability discovery

Drips Wave · Complexity: Easy · 100 points


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions