-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: enable tx submission before swap quotes are loaded #22905
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
base: main
Are you sure you want to change the base?
Conversation
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.
Bug: Metamask Bridge Controller Dependency Mismatch
The @metamask/assets-controllers dependency is pinned to ^88.0.0, but the preview versions of @metamask/bridge-controller and @metamask/bridge-status-controller have a peer dependency requirement of ^89.0.0. This creates a version mismatch that will likely cause runtime errors or unexpected behavior. Update @metamask/assets-controllers to ^89.0.0 to satisfy the peer dependency constraints of the new bridge controller versions.
package.json#L169-L170
Lines 169 to 170 in 84e4f6b
| "@metamask/keyring-controller/@ethereumjs/tx": "npm:@ethereumjs/[email protected]", | |
| "metro/image-size": "^1.2.1", |
…itted (#7182) ## Explanation Publishes the `QuotesReceived` event when submitting a trade before all quotes load Extension PR: MetaMask/metamask-extension#37963 Mobilie PR: MetaMask/metamask-mobile#22905 <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Fixes https://consensyssoftware.atlassian.net/browse/SWAPS-3427 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Publishes a QuotesReceived event on early trade submission and adds a helper and types to standardize its payload and warnings. > > - **Bridge Status Controller**: > - Change `submitTx` to accept optional `isLoading` and `warnings`; when `isLoading=true`, publish `Unified SwapBridge Quotes Received` using `getQuotesReceivedProperties` before stopping quote polling. > - Allow tracking of `QuotesReceived` in internal tracking helper. > - **Bridge Controller**: > - Add and export `getQuotesReceivedProperties` to build QuotesReceived metrics payload; re-export from `index.ts`. > - Introduce `QuoteWarning` type and use it for `warnings` across events/tests; update snapshots to standardized values (e.g., `low_return`, `insufficient_balance`). > - Selector/tests: refine `gasIncluded` vs `gasIncluded_7702` handling and add scenario where fees come from dest token under 7702. > - Tests: add BTC fee error handling (return `undefined` fees on failure) and validate BTC/SOL fee behaviors. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 89bb4b5. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
84e4f6b to
254cad9
Compare
app/components/UI/Bridge/hooks/useBridgeQuoteEvents/useBridgeQuoteEvents.test.tsx
Show resolved
Hide resolved
| await submitBridgeTx({ | ||
| quoteResponse: activeQuote, | ||
| isLoading, | ||
| warnings, |
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.
Bug: Navigation occurs even when transaction submission fails
The navigation.navigate(Routes.TRANSACTIONS_VIEW) call in the finally block (line 347) executes regardless of whether the transaction was actually submitted. If a user clicks "Continue" while activeQuote is undefined (e.g., before quotes finish loading, which is now possible since isLoading was removed from isSubmitDisabled), the if (activeQuote) check fails silently and nothing is submitted. However, the finally block still navigates away, causing the user to be taken to an empty transactions view instead of remaining on the bridge screen.
c56283c to
464a5d9
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsSummary of ChangesThe PR updates the bridge-related controllers and refactors how bridge quote warnings and analytics events are tracked: Package Updates (package.json)
Code ChangesAll changes are focused on the Bridge functionality:
Impact AnalysisDirect Impact:
Risk Assessment:
Why SmokeTrade Tag:
Other Tags Considered but Not Selected:
Confidence: 85%High confidence because:
Lower than 90% because:
|
|



Description
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Allow submitting bridge transactions while quotes are still loading and propagate quote warnings through analytics and transaction submission, upgrading bridge controllers.
BridgeView):isLoadingfromisSubmitDisabled.warningsviauseMemoand pass touseBridgeQuoteEventsandsubmitBridgeTx; also passisLoadingtosubmitBridgeTx.useBridgeQuoteEvents):warningsand generate event payload viagetQuotesReceivedProperties.useSubmitBridgeTx):submitBridgeTxto accept{ isLoading, warnings }and forward toBridgeStatusController.submitTx.warnings/isLoadingplumbing.@metamask/bridge-controllerand@metamask/bridge-status-controllerto^63.0.0.Written by Cursor Bugbot for commit a4c5251. This will update automatically on new commits. Configure here.