-
Notifications
You must be signed in to change notification settings - Fork 620
[Docs] Simplify x402 documentation #8173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docs] Simplify x402 documentation #8173
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
WalkthroughReplace the x402 prepare/sign flow with a single POST fetch-based flow, update related documentation and facilitator content, add sponsorship-policies docs and sidebar link, and rename a portal sidebar entry from "Facilitator API" to "Facilitator". Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client as Client App
participant API as Thirdweb API (/v1/payments/x402/fetch)
participant Target as Target API (x402-protected)
participant Wallet as Authenticated Wallet
participant Facilitator as Facilitator
Client->>API: POST /v1/payments/x402/fetch?url={target}&from={wallet}\nAuthorization: Bearer {user-wallet-token}\n(body passthrough)
API->>Target: Forward request to {target} (passthrough body)
Target-->>API: 402 Payment Required (challenge)
API->>Facilitator: Request payment/settlement for challenge
Facilitator->>Wallet: Use authenticated/server wallet to authorize/submit on-chain payment
Wallet-->>Facilitator: Payment confirmation
Facilitator-->>API: Settlement result
API->>Target: Retry proxied request after payment
Target-->>API: 2xx Response
API-->>Client: Return proxied response
alt Payment failure
API-->>Client: Error (payment/authorization failed)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
🔇 Additional comments (3)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
Comment |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8173 +/- ##
=======================================
Coverage 56.29% 56.29%
=======================================
Files 906 906
Lines 59209 59209
Branches 4182 4182
=======================================
Hits 33330 33330
Misses 25774 25774
Partials 105 105
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
apps/portal/src/app/payments/sidebar.tsx(1 hunks)apps/portal/src/app/payments/x402/client/page.mdx(1 hunks)apps/portal/src/app/payments/x402/facilitator/page.mdx(2 hunks)apps/portal/src/app/payments/x402/page.mdx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes
Avoidanyandunknownunless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from@/typeswhere applicable
Prefertypealiases overinterfaceexcept for nominal shapes
Avoidanyandunknownunless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size
Files:
apps/portal/src/app/payments/sidebar.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
apps/portal/src/app/payments/sidebar.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Lint Packages
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/portal/src/app/payments/sidebar.tsx (1)
85-85: LGTM! Label simplification improves consistency.The rename from "Facilitator API" to "Facilitator" aligns with the updated documentation title and follows the naming pattern of other sidebar items (e.g., "Client Side", "Server Side").
apps/portal/src/app/payments/x402/facilitator/page.mdx (2)
4-4: LGTM! Title simplification aligns with sidebar.The title change from "Facilitator API" to "Facilitator" matches the sidebar update and maintains consistency across the documentation.
19-24: LGTM! Valuable technical clarification added.The new "Chain and token support" section provides important information about EVM chain compatibility and the required token standards (ERC-2612 permit and ERC-3009 transferWithAuthorization for USDC). This helps developers understand the technical requirements upfront.
apps/portal/src/app/payments/x402/page.mdx (2)
36-36: LGTM! Helpful addition clarifying thirdweb API usage.This paragraph adds context about using the thirdweb API directly to fetch x402-compatible endpoints, improving the documentation's completeness and guiding users to the detailed client-side documentation.
82-82: LGTM! Clear explanation of server-side architecture.This paragraph effectively explains the middleware approach for handling multiple endpoints and clarifies the facilitator's role in on-chain settlement. The links to detailed documentation are appropriate.
size-limit report 📦
|
716123e to
8f32dee
Compare

PR-Codex overview
This PR focuses on updating the payment and transaction policies within the
thirdwebplatform, enhancing the API documentation, and refining the user interface for better clarity on payment handling and sponsorship policies.Detailed summary
namefor the facilitator API inpayments/sidebar.tsx.Sponsorship Policiessection intransactions/sidebar.tsx.settings/SponsorshipPolicies/index.tsx.payments/x402/page.mdxabout payment handling and middleware.payments/x402/facilitator/page.mdx.payments/x402/client/page.mdx.Gas Sponsorship Policiesintransactions/policies/page.mdx.Summary by CodeRabbit
Style
Documentation