-
Notifications
You must be signed in to change notification settings - Fork 619
[SDK] Add fundWalletLink prop to x402 responses #8443
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
[SDK] Add fundWalletLink prop to x402 responses #8443
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 69a9eff The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis PR extends the X402 payment module by adding an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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. |
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: 0
🧹 Nitpick comments (3)
packages/thirdweb/src/x402/types.ts (1)
61-62: Consider clarifying the comment wording.The comment "link to a wallet to fund the wallet of the payer" is slightly redundant. Consider simplifying to "link to fund the payer's wallet" for improved clarity.
- /** Optional link to a wallet to fund the wallet of the payer */ + /** Optional link to fund the payer's wallet */ fundWalletLink?: string;packages/thirdweb/src/x402/verify-payment.ts (1)
115-115: LGTM! Consider adding fundWalletLink to the catch block for consistency.The
fundWalletLinkis correctly added to the error response when verification fails. However, note that the catch block (lines 120-135) doesn't includefundWalletLinkin its error response, which creates an inconsistency. If the facilitator can provide a funding link in exception scenarios, consider adding it there as well.packages/thirdweb/src/x402/settle-payment.ts (1)
170-170: LGTM! Consider adding fundWalletLink to the catch block for consistency.The
fundWalletLinkis correctly added to the error response when settlement fails. However, note that the catch block (lines 175-190) doesn't includefundWalletLinkin its error response, which creates an inconsistency. If the facilitator can provide a funding link in exception scenarios, consider adding it there as well.
📜 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 (5)
.changeset/real-bugs-boil.md(1 hunks)packages/thirdweb/src/x402/schemas.ts(1 hunks)packages/thirdweb/src/x402/settle-payment.ts(1 hunks)packages/thirdweb/src/x402/types.ts(1 hunks)packages/thirdweb/src/x402/verify-payment.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-26T19:46:04.024Z
Learnt from: gregfromstl
Repo: thirdweb-dev/js PR: 7450
File: packages/thirdweb/src/bridge/Webhook.ts:57-81
Timestamp: 2025-06-26T19:46:04.024Z
Learning: In the onramp webhook schema (`packages/thirdweb/src/bridge/Webhook.ts`), the `currencyAmount` field is intentionally typed as `z.number()` while other amount fields use `z.string()` because `currencyAmount` represents fiat currency amounts in decimals (like $10.50), whereas other amount fields represent token amounts in wei (very large integers that benefit from bigint representation). The different naming convention (`currencyAmount` vs `amount`) reflects this intentional distinction.
Applied to files:
packages/thirdweb/src/x402/schemas.ts
📚 Learning: 2025-08-28T20:50:33.170Z
Learnt from: joaquim-verges
Repo: thirdweb-dev/js PR: 7922
File: apps/playground-web/src/app/ai/ai-sdk/components/chat-container.tsx:167-181
Timestamp: 2025-08-28T20:50:33.170Z
Learning: The thirdweb-dev/ai-sdk-provider schemas use snake_case field naming convention (e.g., chain_id, transaction_hash) rather than camelCase, as defined in the zod schemas in packages/ai-sdk-provider/src/tools.ts.
Applied to files:
packages/thirdweb/src/x402/schemas.ts
⏰ 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). (8)
- GitHub Check: Size
- GitHub Check: Unit Tests
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Lint Packages
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
.changeset/real-bugs-boil.md (1)
1-5: LGTM!The changeset correctly documents the addition of the
fundWalletLinkproperty as a patch-level update.packages/thirdweb/src/x402/schemas.ts (2)
44-44: LGTM!The
fundWalletLinkfield is correctly added to the settlement response schema as an optional string, consistent with the type definitions.
52-52: LGTM!The
fundWalletLinkfield is correctly added to the verification response schema as an optional string, consistent with the type definitions.
size-limit report 📦
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8443 +/- ##
=======================================
Coverage 54.83% 54.83%
=======================================
Files 919 919
Lines 60868 60868
Branches 4141 4142 +1
=======================================
+ Hits 33375 33379 +4
+ Misses 27391 27387 -4
Partials 102 102
🚀 New features to boost your workflow:
|

PR-Codex overview
This PR introduces a new optional property,
fundWalletLink, to the x402 responses in thethirdwebpackage, enhancing the functionality of payment settlement and verification processes.Detailed summary
fundWalletLinkto the response insettle-payment.ts.fundWalletLinkto the response inverify-payment.ts.types.tsto includefundWalletLinkas an optional string.schemas.tsto addfundWalletLinkinFacilitatorSettleResponseSchemaandFacilitatorVerifyResponseSchema.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.