Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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:
X402Client→x402xClientwith backward compatibility alias - Hook rename:
useX402Client→useX402xClientwith 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.
typescript/packages/client/README.md
Outdated
| function MyComponent() { | ||
| // Uses default facilitator at https://facilitator.x402x.dev/ | ||
| const client = useX402Client(); | ||
| const client = usex402xClient(); |
There was a problem hiding this comment.
Spelling error: "usex402xClient" should be capitalized as "useX402xClient" to follow standard JavaScript/TypeScript naming conventions for React hooks.
| * ```typescript | ||
| * import { X402Client } from '@x402x/client'; | ||
| * import { x402xClient } from '@x402x/client'; | ||
| * import { TransferHook } from '@x402x/core'; |
There was a problem hiding this comment.
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.
| * import { TransferHook } from '@x402x/core'; | |
| * import { TransferHook } from '@x402x/extensions'; |
|
|
||
| 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. |
There was a problem hiding this comment.
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.
| --- | ||
|
|
||
| import { RelatedLinks } from "@/components/docs/related-links"; | ||
|
|
There was a problem hiding this comment.
Inconsistent capitalization in class name. The description mentions "x402ResourceServer" (lowercase 'x') but should use "X402ResourceServer" to follow PascalCase convention for class names.
|
|
||
| ### Compatibility with Other x402 Packages | ||
| // Create resource server with facilitator support | ||
| const server = new x402ResourceServer(facilitatorClient); |
There was a problem hiding this comment.
Inconsistent capitalization in class name. The text mentions "x402ResourceServer" (lowercase 'x') but should use "X402ResourceServer" to follow PascalCase convention for class names.
|
|
||
| ```typescript | ||
| import { wrapFetchWithPayment } from "@x402/fetch"; | ||
| import { x402Client } from "@x402/core/client"; |
There was a problem hiding this comment.
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".
| // 2. Create client and register x402x scheme | ||
| const client = new x402Client(); | ||
| registerX402xScheme(client, "eip155:84532", signer); // Base Sepolia |
There was a problem hiding this comment.
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.
typescript/packages/client/README.md
Outdated
|
|
||
| // Or specify custom facilitator | ||
| const client = useX402Client({ | ||
| const client = usex402xClient({ |
There was a problem hiding this comment.
Spelling error: "usex402xClient" should be capitalized as "useX402xClient" to follow standard JavaScript/TypeScript naming conventions for React hooks.
| 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); |
There was a problem hiding this comment.
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.
| //const percentage = Math.min((mintedAmount / totalAllocation) * 100, 100); |
typescript/packages/client/README.md
Outdated
|
|
||
| ```typescript | ||
| import { useX402Client } from '@x402x/client'; | ||
| import { usex402xClient } from '@x402x/client'; |
There was a problem hiding this comment.
Spelling error: "usex402xClient" should be capitalized as "useX402xClient" to follow standard JavaScript/TypeScript naming conventions for React hooks.
Deploying x402-exec with
|
| 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 |
edf4805 to
62aed06
Compare
No description provided.