Skip to content

Client extensions and CAIP 2 network#153

Merged
jolestar merged 6 commits intomainfrom
client_extensions
Dec 26, 2025
Merged

Client extensions and CAIP 2 network#153
jolestar merged 6 commits intomainfrom
client_extensions

Conversation

@jolestar
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 26, 2025 09:58
@vercel
Copy link

vercel bot commented Dec 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
x402x-web Error Error Dec 26, 2025 11:00am

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 26, 2025

Deploying x402-exec with  Cloudflare Pages  Cloudflare Pages

Latest commit: 10c0db0
Status: ✅  Deploy successful!
Preview URL: https://5038a441.x402-exec.pages.dev
Branch Preview URL: https://client-extensions.x402-exec.pages.dev

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds client-side extension support and CAIP-2 network normalization to enable x402x router settlement with the official x402 SDK. The implementation introduces a dynamic pricing mechanism using the probe-quote-replay pattern, client scheme registration utilities, and network ID normalization for v1/v2 compatibility.

Key Changes:

  • Dynamic pricing with facilitator fee calculation during probe phase and replay on retry
  • Client-side scheme (ExactEvmSchemeWithRouterSettlement) and registration helpers for x402 SDK integration
  • Network ID normalization layer supporting both v1 aliases and v2 CAIP-2 formats

Reviewed changes

Copilot reviewed 36 out of 39 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
typescript/packages/extensions/src/settlement-routes.ts Implements dynamic pricing with probe/retry flow and per-option extension generation
typescript/packages/extensions/src/client/exact-evm-scheme.ts New client scheme for router settlement with commitment-based nonces
typescript/packages/extensions/src/client/extension-handler.ts Extension handler to inject x402x parameters into x402Client
typescript/packages/facilitator-sdk/src/settlement.ts Enhanced parameter parsing with v2 extensions support and legacy fallback
facilitator/src/network-id.ts New network normalization utilities for v1/v2 compatibility
facilitator/src/routes/supported.ts Network readiness filtering based on configuration availability
examples/showcase/client/src/hooks/usePaymentV2.ts New hook using official x402 SDK with x402x scheme
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import type { AccountPoolConfig, NetworkConfig } from "./config.js";
import { getLogger } from "./telemetry.js";
import { getCanonicalNetwork, getNetworkDisplayName } from "./network-utils.js";
import { getConfigForNetwork, normalizeNetwork, hasNetworkConfig } from "./network-id.js";
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

Unused imports hasNetworkConfig, normalizeNetwork.

Suggested change
import { getConfigForNetwork, normalizeNetwork, hasNetworkConfig } from "./network-id.js";
import { getConfigForNetwork } from "./network-id.js";

Copilot uses AI. Check for mistakes.
const auth = result.payload.authorization;

// Manually calculate expected commitment
const now = Math.floor(Date.now() / 1000);
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

Unused variable now.

Suggested change
const now = Math.floor(Date.now() / 1000);

Copilot uses AI. Check for mistakes.
},
};

const result = await scheme.createPaymentPayload(2, paymentRequirements);
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

Unused variable result.

Suggested change
const result = await scheme.createPaymentPayload(2, paymentRequirements);
await scheme.createPaymentPayload(2, paymentRequirements);

Copilot uses AI. Check for mistakes.
@jolestar jolestar merged commit f97c988 into main Dec 26, 2025
4 of 5 checks passed
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