Commit a729e80
feat: enable tx submission before swap quotes are loaded + bug fixes (#37963)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Bumping the bridge controllers to implement these fixes:
- replace the LowReturn banner with a warning font-color change to
prevent swap page from auto-scrolling while streaming quotes. Also added
an e2e test to verify the QuotesReceived event is published if the trade
is submitted before quotes finish loading
- fixes USDT approval reset condition + tx generation
- publish `usd_amount_source` property for QuotesRequested event
- propagates gas parameters for 7702 gasIncluded transactions
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
[](https://codespaces.new/MetaMask/metamask-extension/pull/37963?quickstart=1)
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: feat: enable tx submission before swap quotes are
loaded
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3421,
https://consensyssoftware.atlassian.net/browse/SWAPS-3427
## **Manual testing steps**
1. Go to this page...
2.
3.
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Enables submitting swaps before quote streaming completes, updates
telemetry and UI warnings, and bumps bridge controllers with related
policy changes and tests.
>
> - **UX/Submit Flow**:
> - Allow submitting swaps without waiting for all quotes; CTA no longer
disabled during loading when a quote exists.
> - Replace low-return banner with warning text color; prevent
auto-scroll; refine no-quotes banner display.
> - Add `getWarningLabels` selector and `getValidatedFromValue`;
validation uses input-derived amounts.
> - **Telemetry**:
> - Use `getQuotesReceivedProperties` to track `Unified SwapBridge`
events; include `usd_amount_source`.
> - Pass QuotesReceived context into `submitBridgeTx`.
> - **Controllers/Deps**:
> - Bump `@metamask/bridge-controller` to `^64.0.0` and
`@metamask/bridge-status-controller` to `^64.0.1` (and related deps);
update `yarn.lock`.
> - Bridge status messenger: remove
`BridgeController:getBridgeERC20Allowance` action; add TS expects in
controller init.
> - **Security Policy**:
> - Update LavaMoat policies for nested `@metamask/network-controller`,
`eth-json-rpc-*`, `multichain-network-controller`, and add
`@ethersproject/bignumber`.
> - **Tests/E2E**:
> - Add/adjust SSE-based tests to assert
QuotesReceived/Submitted/Completed sequences; update mocks to `.once()`
and expectations/snapshots.
> - Update unit tests for new validation, inputs as strings, and event
payload assertions.
> - **Misc**:
> - Color network fee text based on low return; minor TS and provider
notes.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
cb87cd1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: MetaMask Bot <[email protected]>1 parent 5a2b80e commit a729e80
File tree
26 files changed
+651
-244
lines changed- app/scripts/controller-init
- messengers
- lavamoat
- browserify
- beta
- experimental
- flask
- main
- webpack
- mv2
- mv3
- test/e2e/tests/bridge
- ui
- ducks
- bridge-status
- bridge
- hooks/bridge
- pages/bridge
- hooks
- __snapshots__
- prepare
- quotes
26 files changed
+651
-244
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | | - | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
| 906 | + | |
906 | 907 | | |
907 | 908 | | |
908 | 909 | | |
909 | 910 | | |
910 | 911 | | |
911 | 912 | | |
912 | | - | |
| 913 | + | |
913 | 914 | | |
914 | 915 | | |
915 | 916 | | |
| |||
1179 | 1180 | | |
1180 | 1181 | | |
1181 | 1182 | | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1182 | 1197 | | |
1183 | 1198 | | |
1184 | 1199 | | |
| |||
1215 | 1230 | | |
1216 | 1231 | | |
1217 | 1232 | | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1218 | 1239 | | |
1219 | 1240 | | |
1220 | 1241 | | |
| |||
1631 | 1652 | | |
1632 | 1653 | | |
1633 | 1654 | | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
1634 | 1668 | | |
1635 | 1669 | | |
1636 | 1670 | | |
| |||
1693 | 1727 | | |
1694 | 1728 | | |
1695 | 1729 | | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1696 | 1757 | | |
1697 | 1758 | | |
1698 | 1759 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
| 906 | + | |
906 | 907 | | |
907 | 908 | | |
908 | 909 | | |
909 | 910 | | |
910 | 911 | | |
911 | 912 | | |
912 | | - | |
| 913 | + | |
913 | 914 | | |
914 | 915 | | |
915 | 916 | | |
| |||
1179 | 1180 | | |
1180 | 1181 | | |
1181 | 1182 | | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1182 | 1197 | | |
1183 | 1198 | | |
1184 | 1199 | | |
| |||
1215 | 1230 | | |
1216 | 1231 | | |
1217 | 1232 | | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1218 | 1239 | | |
1219 | 1240 | | |
1220 | 1241 | | |
| |||
1631 | 1652 | | |
1632 | 1653 | | |
1633 | 1654 | | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
1634 | 1668 | | |
1635 | 1669 | | |
1636 | 1670 | | |
| |||
1693 | 1727 | | |
1694 | 1728 | | |
1695 | 1729 | | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1696 | 1757 | | |
1697 | 1758 | | |
1698 | 1759 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
| 906 | + | |
906 | 907 | | |
907 | 908 | | |
908 | 909 | | |
909 | 910 | | |
910 | 911 | | |
911 | 912 | | |
912 | | - | |
| 913 | + | |
913 | 914 | | |
914 | 915 | | |
915 | 916 | | |
| |||
1179 | 1180 | | |
1180 | 1181 | | |
1181 | 1182 | | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1182 | 1197 | | |
1183 | 1198 | | |
1184 | 1199 | | |
| |||
1215 | 1230 | | |
1216 | 1231 | | |
1217 | 1232 | | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1218 | 1239 | | |
1219 | 1240 | | |
1220 | 1241 | | |
| |||
1631 | 1652 | | |
1632 | 1653 | | |
1633 | 1654 | | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
1634 | 1668 | | |
1635 | 1669 | | |
1636 | 1670 | | |
| |||
1693 | 1727 | | |
1694 | 1728 | | |
1695 | 1729 | | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1696 | 1757 | | |
1697 | 1758 | | |
1698 | 1759 | | |
| |||
0 commit comments