Open
Conversation
AxelGes
reviewed
Mar 4, 2026
| } | ||
| return buyWidget; | ||
| } catch { | ||
| return null; |
Contributor
There was a problem hiding this comment.
The catch here swallows everything silently. From the caller's perspective it just returns null and there's no way to know if it was a missing buyURL or a failed network request. Worth at least logging the error before returning null.
AxelGes
reviewed
Mar 4, 2026
| ? orderId.split('/orders/')[1] | ||
| : orderId; | ||
| const normalizedProviderCode = providerCode.replace('/providers/', ''); | ||
|
|
Contributor
There was a problem hiding this comment.
This providerCode normalization (stripping /providers/) is also done in BuildQuote.tsx before calling addPrecreatedOrder. Two copies of the same logic means they can drift apart. Worth extracting into a shared util.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Summary of Changes
Controller
getBuyWidgetData(quote)returnsBuyWidget | null(url, browser?, orderId?) instead ofstring | nulladdPrecreatedOrder(params)added — accepts{ orderId, providerCode, walletAddress, chainId? }, parses order ID, creates stub order withstatus: Precreated, adds to controller for pollingMobile
getBuyWidgetData, callsaddPrecreatedOrderbefore opening external browser (PayPal), passesorderIdto Checkout for WebView flows; debug instrumentation removedaddPrecreatedOrderinstead of ReduxaddFiatCustomIdData; supportsorderIdandcustomOrderId; removedremoveFiatCustomIdDatafrom callback handlingHooks
addPrecreatedOrder,AddPrecreatedOrderParamsgetBuyWidgetDatareturnsPromise<BuyWidget | null>getBuyWidgetDataandaddPrecreatedOrderRenames
Files Modified
References
Checklist
Note
Medium Risk
Introduces a breaking API change (
getWidgetUrl→getBuyWidgetData) and adds new order-state mutation viaaddPrecreatedOrder, which could affect downstream consumers and order polling behavior.Overview
Updates the redirect-provider widget fetch API by replacing
getWidgetUrl()withgetBuyWidgetData(), returning the fullBuyWidgetpayload (includingbrowser/orderId) and treating missing/nullableurlasnull.Adds support for polling pre-created orders via
addPrecreatedOrder(), which inserts a minimal stubRampsOrderinPrecreatedstatus (parsingorderIdand normalizingproviderCode) so existing polling can later hydrate it. Tests were updated/added to cover the new return type, null handling, and stub-order creation.Written by Cursor Bugbot for commit 292cc29. This will update automatically on new commits. Configure here.