Skip to content

Commit 643dc94

Browse files
runway-github[bot]dawnseeker8AkaryatrhchloeYue
authored
chore(runway): cherry-pick fix(BETR-413): pass originalTransactionId for intent bridge history cp-7.76.0 (#29728)
- fix(BETR-413): pass originalTransactionId for intent bridge history cp-7.76.0 (#29670) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until this PR meets the canonical Definition of Ready For Review in `docs/readme/ready-for-review.md`. In short: the template must be materially complete (not just section titles present), all status checks must be currently passing, and the only expected follow-up commits must be reviewer-driven. --> ## **Description** Patches `@metamask/bridge-status-controller@71.1.0` so that when recording intent-based bridge transactions in history, `originalTransactionId` is passed as a top-level argument to `addTxToHistory`. `getInitialHistoryItem` reads that field from the top-level args, not from `bridgeTxMeta`; without this, it fell back to `bridgeTxMeta.id` (the `orderUid`), which broke the link between the bridge history row and the synthetic `TransactionController` entry. That mismatch showed up in the activity tab for Ondo RWA swap flows (see BETR-413). Dependency wiring: `package.json` / `yarn.lock` updated to apply the Yarn patch. ## **Changelog** CHANGELOG entry: Fixed bridge activity tab not correctly linking intent-based swaps to their underlying transaction for some bridge flows. ## **Related issues** Refs: [BETR-413](https://consensyssoftware.atlassian.net/browse/BETR-413) ## **Manual testing steps** ```gherkin Feature: Bridge / swap activity after intent-based flow Scenario: Activity shows consistent status for Ondo RWA swap Given a wallet that completes an intent-based bridge swap affected by BETR-413 When the user opens the activity tab for that account Then the bridge / swap entry reflects the correct status and ties to the expected transaction metadata ``` ## **Screenshots/Recordings** ### **Before** <img width="692" height="1365" alt="image" src="https://github.com/user-attachments/assets/9e6a8a33-4df9-4cb8-8fdb-d73ed210bc78" /> ### **After** <img width="1080" height="2340" alt="image" src="https://github.com/user-attachments/assets/24d65f9f-6a57-4ae6-9e1c-60620700e309" /> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) - [ ] I've tested on Android - Ideally on a mid-range device; emulator is acceptable - [ ] I've tested with a power user scenario - Use these [power-user SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93) to import wallets with many accounts and tokens - [ ] I've instrumented key operations with Sentry traces for production performance metrics - See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example For performance guidelines and tooling, see the [Performance Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers). ## **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. [BETR-413]: https://consensyssoftware.atlassian.net/browse/BETR-413?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Medium risk because it changes how intent-based bridge transactions are keyed/linked between bridge history and `TransactionController`, which could affect activity/status rendering for those flows. > > **Overview** > Fixes intent-based bridge history entries so they retain a stable link to the underlying synthetic transaction by passing `originalTransactionId` as a top-level argument to `addTxToHistory` (instead of embedding it in `bridgeTxMeta`). > > Wires this via a Yarn patch for `@metamask/bridge-status-controller@71.1.0` (updates `package.json` resolutions/dependency and `yarn.lock`) so the patched `dist/bridge-status-controller` code is used at build time. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit db8990e. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net> [e15e997](e15e997) [BETR-413]: https://consensyssoftware.atlassian.net/browse/BETR-413?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Xiaoming Wang <7315988+dawnseeker8@users.noreply.github.com> Co-authored-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net> Co-authored-by: chloeYue <105063779+chloeYue@users.noreply.github.com>
1 parent 38d122b commit 643dc94

3 files changed

Lines changed: 97 additions & 4 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
diff --git a/dist/bridge-status-controller.cjs b/dist/bridge-status-controller.cjs
2+
index c8dcd1f18fd4395b13ac7945e533ae1a92553950..ced9b35dc96c65ffe7ac59d198f4ab2737ae24ac 100644
3+
--- a/dist/bridge-status-controller.cjs
4+
+++ b/dist/bridge-status-controller.cjs
5+
@@ -863,16 +863,27 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
6+
};
7+
// Record in bridge history with actual transaction metadata
8+
try {
9+
- // Create a bridge transaction metadata that includes the original txId
10+
+ /**
11+
+ * Patch to fix ondo swap activity tab status issue logged at
12+
+ * https://consensyssoftware.atlassian.net/browse/BETR-413
13+
+ *
14+
+ */
15+
+ // Create a bridge transaction metadata keyed by orderUid for intent polling
16+
const bridgeTxMetaForHistory = {
17+
...syntheticMeta,
18+
id: orderUid,
19+
- originalTransactionId: syntheticMeta.id, // Keep original txId for TransactionController updates
20+
};
21+
// Use orderId as the history key for intent transactions
22+
+ // IMPORTANT: pass originalTransactionId as a top-level argument so
23+
+ // `getInitialHistoryItem` reads it. Setting it on `bridgeTxMeta` is a no-op
24+
+ // because `getInitialHistoryItem` destructures `originalTransactionId` from
25+
+ // the top-level args, not from `bridgeTxMeta`. Without this, the field
26+
+ // falls back to `bridgeTxMeta.id` (the orderUid), severing the link between
27+
+ // the bridge history record and the synthetic TransactionController entry.
28+
const historyKey = __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
29+
accountAddress,
30+
bridgeTxMeta: bridgeTxMetaForHistory,
31+
+ originalTransactionId: syntheticMeta.id, // Keep original txId for TransactionController updates
32+
quoteResponse,
33+
slippagePercentage: 0,
34+
isStxEnabled: false,
35+
diff --git a/dist/bridge-status-controller.mjs b/dist/bridge-status-controller.mjs
36+
index 3c285a68a35e69b6898f5c811a000324044213c8..9e0b4ef973b167c39e142b60ca28cf32ea89f41a 100644
37+
--- a/dist/bridge-status-controller.mjs
38+
+++ b/dist/bridge-status-controller.mjs
39+
@@ -860,16 +860,27 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
40+
};
41+
// Record in bridge history with actual transaction metadata
42+
try {
43+
- // Create a bridge transaction metadata that includes the original txId
44+
+ /**
45+
+ * Patch to fix ondo swap activity tab status issue logged at
46+
+ * https://consensyssoftware.atlassian.net/browse/BETR-413
47+
+ *
48+
+ */
49+
+ // Create a bridge transaction metadata keyed by orderUid for intent polling
50+
const bridgeTxMetaForHistory = {
51+
...syntheticMeta,
52+
id: orderUid,
53+
- originalTransactionId: syntheticMeta.id, // Keep original txId for TransactionController updates
54+
};
55+
// Use orderId as the history key for intent transactions
56+
+ // IMPORTANT: pass originalTransactionId as a top-level argument so
57+
+ // `getInitialHistoryItem` reads it. Setting it on `bridgeTxMeta` is a no-op
58+
+ // because `getInitialHistoryItem` destructures `originalTransactionId` from
59+
+ // the top-level args, not from `bridgeTxMeta`. Without this, the field
60+
+ // falls back to `bridgeTxMeta.id` (the orderUid), severing the link between
61+
+ // the bridge history record and the synthetic TransactionController entry.
62+
const historyKey = __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
63+
accountAddress,
64+
bridgeTxMeta: bridgeTxMetaForHistory,
65+
+ originalTransactionId: syntheticMeta.id, // Keep original txId for TransactionController updates
66+
quoteResponse,
67+
slippagePercentage: 0,
68+
isStxEnabled: false,

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@
209209
"@metamask/keyring-api@npm:^21.5.0": "21.6.0",
210210
"@metamask/keyring-api@npm:^21.6.0": "23.0.1",
211211
"@metamask/keyring-api@npm:^22.0.0": "23.0.1",
212-
"@metamask/keyring-api@npm:^23.0.1": "23.0.1"
212+
"@metamask/keyring-api@npm:^23.0.1": "23.0.1",
213+
"@metamask/bridge-status-controller@npm:^71.0.0": "patch:@metamask/bridge-status-controller@npm%3A71.1.0#~/.yarn/patches/@metamask-bridge-status-controller-npm-71.1.0-6140a0bdf3.patch"
213214
},
214215
"dependencies": {
215216
"@braze/react-native-sdk": "patch:@braze/react-native-sdk@npm%3A19.1.0#~/.yarn/patches/@braze-react-native-sdk-npm-19.1.0-076-reactmoduleinfo.patch",
@@ -241,7 +242,7 @@
241242
"@metamask/base-controller": "^9.0.1",
242243
"@metamask/bitcoin-wallet-snap": "^1.10.1",
243244
"@metamask/bridge-controller": "^71.0.0",
244-
"@metamask/bridge-status-controller": "^71.1.0",
245+
"@metamask/bridge-status-controller": "patch:@metamask/bridge-status-controller@npm%3A71.1.0#~/.yarn/patches/@metamask-bridge-status-controller-npm-71.1.0-6140a0bdf3.patch",
245246
"@metamask/chain-agnostic-permission": "^1.5.0",
246247
"@metamask/client-controller": "^1.0.1",
247248
"@metamask/compliance-controller": "2.0.0",

yarn.lock

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8195,7 +8195,7 @@ __metadata:
81958195
languageName: node
81968196
linkType: hard
81978197

8198-
"@metamask/bridge-status-controller@npm:^71.0.0, @metamask/bridge-status-controller@npm:^71.1.0":
8198+
"@metamask/bridge-status-controller@npm:71.1.0":
81998199
version: 71.1.0
82008200
resolution: "@metamask/bridge-status-controller@npm:71.1.0"
82018201
dependencies:
@@ -8219,6 +8219,30 @@ __metadata:
82198219
languageName: node
82208220
linkType: hard
82218221

8222+
"@metamask/bridge-status-controller@patch:@metamask/bridge-status-controller@npm%3A71.1.0#~/.yarn/patches/@metamask-bridge-status-controller-npm-71.1.0-6140a0bdf3.patch":
8223+
version: 71.1.0
8224+
resolution: "@metamask/bridge-status-controller@patch:@metamask/bridge-status-controller@npm%3A71.1.0#~/.yarn/patches/@metamask-bridge-status-controller-npm-71.1.0-6140a0bdf3.patch::version=71.1.0&hash=d27fd3"
8225+
dependencies:
8226+
"@metamask/accounts-controller": "npm:^37.2.0"
8227+
"@metamask/base-controller": "npm:^9.1.0"
8228+
"@metamask/bridge-controller": "npm:^71.0.0"
8229+
"@metamask/controller-utils": "npm:^11.20.0"
8230+
"@metamask/gas-fee-controller": "npm:^26.1.1"
8231+
"@metamask/keyring-controller": "npm:^25.2.0"
8232+
"@metamask/messenger": "npm:^1.1.1"
8233+
"@metamask/network-controller": "npm:^30.0.1"
8234+
"@metamask/polling-controller": "npm:^16.0.4"
8235+
"@metamask/profile-sync-controller": "npm:^28.0.2"
8236+
"@metamask/snaps-controllers": "npm:^19.0.0"
8237+
"@metamask/superstruct": "npm:^3.1.0"
8238+
"@metamask/transaction-controller": "npm:^65.0.0"
8239+
"@metamask/utils": "npm:^11.9.0"
8240+
bignumber.js: "npm:^9.1.2"
8241+
uuid: "npm:^8.3.2"
8242+
checksum: 10/530cc836eb0bc921092538b8253d9d673a1470360f4715510aa1d25d91d14fcad576df77ad5d131f7708d89fd129ace000a4682ce53108d4b560db3cf8e36469
8243+
languageName: node
8244+
linkType: hard
8245+
82228246
"@metamask/browser-passworder@npm:^5.0.0":
82238247
version: 5.0.0
82248248
resolution: "@metamask/browser-passworder@npm:5.0.0"
@@ -35707,7 +35731,7 @@ __metadata:
3570735731
"@metamask/base-controller": "npm:^9.0.1"
3570835732
"@metamask/bitcoin-wallet-snap": "npm:^1.10.1"
3570935733
"@metamask/bridge-controller": "npm:^71.0.0"
35710-
"@metamask/bridge-status-controller": "npm:^71.1.0"
35734+
"@metamask/bridge-status-controller": "patch:@metamask/bridge-status-controller@npm%3A71.1.0#~/.yarn/patches/@metamask-bridge-status-controller-npm-71.1.0-6140a0bdf3.patch"
3571135735
"@metamask/browser-passworder": "npm:^5.0.0"
3571235736
"@metamask/browser-playground": "npm:0.3.0"
3571335737
"@metamask/build-utils": "npm:^3.0.0"

0 commit comments

Comments
 (0)