Add Rampnow as a fiat onramp provider#8764
Conversation
Add support for the new "rampnow" onramp provider across the codebase. Updates include: adding "rampnow" to Onramp types and API request body, adding it to the FiatProviders list and provider->onramp mapping, including it in the useBuyWithFiatQuotesForProviders hook, and adding the provider entry (icon/description) plus selection typing/handlers in the Bridge UI and payment types.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2e47528 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThis PR adds RampNow as a fourth supported fiat onramp provider in the thirdweb SDK. Type definitions, quote mapping, React hooks, and UI components are updated to accept and handle the new ChangesRampnow Provider Addition
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
size-limit report 📦
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/thirdweb/src/pay/buyWithFiat/getQuote.ts (1)
468-468:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winFix hardcoded provider value to use lowercase.
The fallback value
"COINBASE"is uppercase butFiatProviderexpects lowercase"coinbase". This causes a type mismatch that is masked by theas FiatProvidercast.🐛 Proposed fix
- provider: (params.preferredProvider ?? "COINBASE") as FiatProvider, + provider: params.preferredProvider ?? "coinbase",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/thirdweb/src/pay/buyWithFiat/getQuote.ts` at line 468, The fallback provider value is incorrectly hardcoded as uppercase "COINBASE" which conflicts with the FiatProvider lowercase enum; update the provider default in the getQuote creation/params object (the line using provider: (params.preferredProvider ?? "COINBASE") as FiatProvider) to use the lowercase string "coinbase" and remove the unnecessary type cast so the expression becomes provider: params.preferredProvider ?? "coinbase" (ensuring it matches the FiatProvider type).
🧹 Nitpick comments (2)
packages/thirdweb/src/bridge/Onramp.ts (2)
131-131: ⚡ Quick winUpdate documentation to include the new provider.
The JSDoc comment should list all supported providers including
"rampnow"for completeness.📝 Suggested documentation update
- * `@param` options.onramp - The onramp provider to use (e.g., "stripe", "coinbase", "transak"). + * `@param` options.onramp - The onramp provider to use (e.g., "stripe", "coinbase", "transak", "rampnow").🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/thirdweb/src/bridge/Onramp.ts` at line 131, Update the JSDoc for the onramp parameter in Onramp.ts to list all supported providers and include the new "rampnow" provider; locate the comment describing the options.onramp parameter (near the function or type that defines Onramp or the onramp option) and add "rampnow" to the example provider list alongside "stripe", "coinbase", and "transak" so the docs reflect the new supported provider.
275-276: ⚡ Quick winUpdate documentation to include the new provider.
The JSDoc comment should list all supported providers including
"rampnow"for completeness.📝 Suggested documentation update
- /** The onramp provider to use (e.g., "stripe", "coinbase", "transak") */ - onramp: "stripe" | "coinbase" | "transak" | "rampnow"; + /** The onramp provider to use (e.g., "stripe", "coinbase", "transak", "rampnow") */ + onramp: "stripe" | "coinbase" | "transak" | "rampnow";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/thirdweb/src/bridge/Onramp.ts` around lines 275 - 276, Update the JSDoc for the onramp property in Onramp.ts so it enumerates all supported providers including "rampnow"; locate the onramp declaration (onramp: "stripe" | "coinbase" | "transak" | "rampnow") and change the comment to list "stripe", "coinbase", "transak", and "rampnow" so the doc matches the type definition.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/thirdweb/src/pay/buyWithFiat/getQuote.ts`:
- Line 468: The fallback provider value is incorrectly hardcoded as uppercase
"COINBASE" which conflicts with the FiatProvider lowercase enum; update the
provider default in the getQuote creation/params object (the line using
provider: (params.preferredProvider ?? "COINBASE") as FiatProvider) to use the
lowercase string "coinbase" and remove the unnecessary type cast so the
expression becomes provider: params.preferredProvider ?? "coinbase" (ensuring it
matches the FiatProvider type).
---
Nitpick comments:
In `@packages/thirdweb/src/bridge/Onramp.ts`:
- Line 131: Update the JSDoc for the onramp parameter in Onramp.ts to list all
supported providers and include the new "rampnow" provider; locate the comment
describing the options.onramp parameter (near the function or type that defines
Onramp or the onramp option) and add "rampnow" to the example provider list
alongside "stripe", "coinbase", and "transak" so the docs reflect the new
supported provider.
- Around line 275-276: Update the JSDoc for the onramp property in Onramp.ts so
it enumerates all supported providers including "rampnow"; locate the onramp
declaration (onramp: "stripe" | "coinbase" | "transak" | "rampnow") and change
the comment to list "stripe", "coinbase", "transak", and "rampnow" so the doc
matches the type definition.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2f15c213-bd1b-4545-a1c5-17f97bab24a3
📒 Files selected for processing (8)
.changeset/chatty-peaches-drop.mdpackages/thirdweb/src/bridge/Onramp.tspackages/thirdweb/src/pay/buyWithFiat/getQuote.tspackages/thirdweb/src/pay/utils/commonTypes.tspackages/thirdweb/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.tspackages/thirdweb/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsxpackages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsxpackages/thirdweb/src/react/web/ui/Bridge/types.ts
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8764 +/- ##
==========================================
+ Coverage 52.76% 52.78% +0.01%
==========================================
Files 934 934
Lines 62970 62976 +6
Branches 4142 4137 -5
==========================================
+ Hits 33228 33241 +13
+ Misses 29642 29635 -7
Partials 100 100
🚀 New features to boost your workflow:
|
- Fix uppercase 'COINBASE' fallback to lowercase 'coinbase' in getBuyWithFiatQuote, matching the FiatProvider enum and dropping the redundant cast. - Add 'rampnow' to the @param options.onramp JSDoc example list in bridge/Onramp.ts. - Add useBuyWithFiatQuotesForProviders.test.tsx that mocks prepareOnramp/getToken and asserts the hook fans out to all four providers (coinbase, stripe, transak, rampnow) plus disabled-when-no-params. - Add a useBridgePrepare.test.ts case that iterates over all four onramp providers including 'rampnow' to validate the BridgePrepareRequest discriminated union. - Add a Rampnow case to bridge/Onramp.test.ts gated on TW_BRIDGE_RAMPNOW for once the bridge backend deploys with rampnow support.
Add support for the new "rampnow" onramp provider across the codebase. Updates include: adding "rampnow" to Onramp types and API request body, adding it to the FiatProviders list and provider->onramp mapping, including it in the useBuyWithFiatQuotesForProviders hook, and adding the provider entry (icon/description) plus selection typing/handlers in the Bridge UI and payment types.
PR-Codex overview
This PR introduces
RampNowas a new onramp provider in thethirdwebSDK, enhancing the payment options available for users. It updates various types and interfaces to include this new provider and adds related tests to ensure functionality.Detailed summary
RampNowas an onramp provider inpackages/thirdweb/src/react/web/ui/Bridge/types.ts.FiatProvidersto includerampnowinpackages/thirdweb/src/pay/utils/commonTypes.ts.PaymentSelection.tsxandFiatProviderSelection.tsxto supportrampnow.useBuyWithFiatQuotesForProvidersto includerampnowin quotes retrieval.getQuote.tsto maprampnowcorrectly.RampNowfunctionality inuseBuyWithFiatQuotesForProviders.test.tsxandOnramp.test.ts.Summary by CodeRabbit
New Features
Tests