Skip to content

X402x v2 documents#155

Merged
jolestar merged 6 commits intomainfrom
x402x_v2_documents
Dec 29, 2025
Merged

X402x v2 documents#155
jolestar merged 6 commits intomainfrom
x402x_v2_documents

Conversation

@jolestar
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 29, 2025 03:51
@vercel
Copy link

vercel bot commented Dec 29, 2025

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

Project Deployment Review Updated (UTC)
x402x-web Error Error Dec 29, 2025 4:45am

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 updates documentation and code to reflect the migration from a patched x402 version to the official x402 v2 SDK extended with @x402x/extensions. The changes rename the core package from @x402x/core to @x402x/extensions and update class/function naming conventions throughout the codebase and documentation.

Key Changes:

  • Migration from patched x402 to official x402 v2 SDK with extensions
  • Package rename: @x402x/core@x402x/extensions
  • Client class rename: X402Clientx402xClient with backward compatibility alias
  • Hook rename: useX402ClientuseX402xClient with backward compatibility alias

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
web/frontend/src/lib/token-mint.ts Updated import path from @x402x/core to @x402x/extensions
web/frontend/src/content/docs/server-guide.mdx Comprehensive rewrite to document v2 integration pattern with official SDKs
web/frontend/src/content/docs/reference-packages.mdx Updated package descriptions, marked old packages as deprecated
web/frontend/src/content/docs/integration-overview.mdx Simplified integration guide focusing on two modes (Server-Validated and Serverless)
web/frontend/src/content/docs/facilitator-fee.mdx Updated class names from X402Client to x402xClient
web/frontend/src/content/docs/client-guide.mdx Rewrote client integration guide with Mode A and Mode B patterns
web/frontend/src/constants/facilitator.ts Updated imports and reformatted code (tabs to spaces)
web/frontend/src/components/token/token-mint.tsx Commented out unused percentage calculation
web/frontend/pnpm-lock.yaml Updated dependency reference from @x402x/core to @x402x/extensions
web/frontend/package.json Updated dependency from @x402x/core to @x402x/extensions
web/frontend/README.md Updated quick start to reference official SDKs and extensions
typescript/packages/client/src/types.ts Renamed interface from X402ClientConfig to x402xClientConfig with backward compatibility
typescript/packages/client/src/index.ts Exported x402xClient as primary name with X402Client alias for backward compatibility
typescript/packages/client/src/hooks/useX402xClient.ts Renamed hook from useX402Client to useX402xClient
typescript/packages/client/src/hooks/useExecute.ts Updated to use renamed useX402xClient hook
typescript/packages/client/src/client.ts Renamed class from X402Client to x402xClient
typescript/packages/client/README.md Updated all references to use new naming conventions
examples/showcase/server/src/index.ts Added comprehensive documentation comment explaining the calling flow
examples/showcase/client/src/hooks/useX402Execute.ts Updated to use renamed useX402xClient hook
examples/showcase/client/src/components/ServerlessPaymentDialog.tsx Updated to use renamed x402xClient class
examples/showcase/client/src/code-examples/split-payment.ts Updated class name to x402xClient
examples/showcase/client/src/code-examples/points-reward.ts Updated class name to x402xClient
examples/showcase/client/src/code-examples/nft-mint.ts Updated class name to x402xClient
docs/x402-development.md Marked as deprecated with reference to new documentation
docs/third-party-integration.md Completely rewritten to document v2 integration pattern
Files not reviewed (1)
  • web/frontend/pnpm-lock.yaml: Language not supported

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

function MyComponent() {
// Uses default facilitator at https://facilitator.x402x.dev/
const client = useX402Client();
const client = usex402xClient();
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Spelling error: "usex402xClient" should be capitalized as "useX402xClient" to follow standard JavaScript/TypeScript naming conventions for React hooks.

Copilot uses AI. Check for mistakes.
* ```typescript
* import { X402Client } from '@x402x/client';
* import { x402xClient } from '@x402x/client';
* import { TransferHook } from '@x402x/core';
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The import path for TransferHook in the comment still references "@x402x/core" but should be updated to "@x402x/extensions" to match the actual package structure shown in the rest of the PR.

Suggested change
* import { TransferHook } from '@x402x/core';
* import { TransferHook } from '@x402x/extensions';

Copilot uses AI. Check for mistakes.

Notes:
- `createSettlementRouteConfig` helper simplifies creating valid v2 payment requirements with extension fields.
- The `x402ResourceServer` handles communication with the Facilitator to settle payments before passing control to your handler.
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Inconsistent capitalization in class name. The text shows "x402ResourceServer" (lowercase 'x') but should follow PascalCase convention for class names. This should be "X402ResourceServer" to be consistent with standard TypeScript/JavaScript naming conventions.

Copilot uses AI. Check for mistakes.
---

import { RelatedLinks } from "@/components/docs/related-links";

Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Inconsistent capitalization in class name. The description mentions "x402ResourceServer" (lowercase 'x') but should use "X402ResourceServer" to follow PascalCase convention for class names.

Copilot uses AI. Check for mistakes.

### Compatibility with Other x402 Packages
// Create resource server with facilitator support
const server = new x402ResourceServer(facilitatorClient);
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Inconsistent capitalization in class name. The text mentions "x402ResourceServer" (lowercase 'x') but should use "X402ResourceServer" to follow PascalCase convention for class names.

Copilot uses AI. Check for mistakes.

```typescript
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Inconsistent naming convention. The import shows "x402Client" (lowercase 'x') while the text refers to "x402xClient". Based on the context and other files in the PR, this should be "x402xClient" to maintain consistency with the package name "@x402x/client".

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +44
// 2. Create client and register x402x scheme
const client = new x402Client();
registerX402xScheme(client, "eip155:84532", signer); // Base Sepolia
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The example code references "registerX402xScheme" which is imported from "@x402x/extensions" at line 34, but this function is not documented in the reference-packages.mdx file. Consider documenting this key registration function in the Extensions API section for completeness.

Copilot uses AI. Check for mistakes.

// Or specify custom facilitator
const client = useX402Client({
const client = usex402xClient({
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Spelling error: "usex402xClient" should be capitalized as "useX402xClient" to follow standard JavaScript/TypeScript naming conventions for React hooks.

Copilot uses AI. Check for mistakes.
X402X_TOKEN_CONFIG.mintAllocationTokens || 1_000_000_000 / 10;
const mintedAmount = Math.max(totalAllocation - unsoldTokens, 0);
const percentage = Math.min((mintedAmount / totalAllocation) * 100, 100);
//const percentage = Math.min((mintedAmount / totalAllocation) * 100, 100);
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The commented-out code suggests this line was intentionally disabled but left in the codebase. Consider either removing the commented code entirely if it's no longer needed, or adding a TODO comment explaining why it was commented out and when it might be re-enabled.

Suggested change
//const percentage = Math.min((mintedAmount / totalAllocation) * 100, 100);

Copilot uses AI. Check for mistakes.

```typescript
import { useX402Client } from '@x402x/client';
import { usex402xClient } from '@x402x/client';
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Spelling error: "usex402xClient" should be capitalized as "useX402xClient" to follow standard JavaScript/TypeScript naming conventions for React hooks.

Copilot uses AI. Check for mistakes.
@cloudflare-workers-and-pages
Copy link

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

Deploying x402-exec with  Cloudflare Pages  Cloudflare Pages

Latest commit: 08f44f4
Status: ✅  Deploy successful!
Preview URL: https://9ae16147.x402-exec.pages.dev
Branch Preview URL: https://x402x-v2-documents.x402-exec.pages.dev

View logs

@jolestar jolestar merged commit 8863063 into main Dec 29, 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