Commit 0cee394
authored
fix: add token_symbol_source, token_symbol_destination to Unified Swa… (#9213)
## Explanation
<!--
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?
-->
The `Unified SwapBridge Quotes Received` analytics event is expected to
include `token_symbol_source` and `token_symbol_destination` as part of
`RequestParams`, but clients building the event payload via
`getQuotesReceivedProperties` were not getting those fields. The helper
only returned quote/trade-specific properties (gas, provider, warnings,
etc.).
`getQuotesReceivedProperties` now derives token symbols from the active
quote's asset metadata (`activeQuote.quote.srcAsset.symbol` and
`activeQuote.quote.destAsset.symbol`). When no active quote is available
(e.g. polling stopped while quotes are still loading), fallbacks match
`RequestParams`: `''` for source and `null` for destination.
`RequiredEventContextFromClient` for `QuotesReceived` is updated to
include the symbol fields so the client context type aligns with the
full event payload. The `getRequestParams` JSDoc is updated to point
callers to `getQuotesReceivedProperties` for symbols, since the quote
request only stores addresses.
No dependency upgrades in this PR.
Extension
<img width="853" height="941" alt="Screenshot 2026-06-19 at 12 06 35 PM"
src="https://github.com/user-attachments/assets/9c6067b5-fbc3-457a-8472-33cecf971283"
/>
Mobile
<img width="1539" height="811" alt="Screenshot 2026-06-17 at 1 23 28 PM"
src="https://github.com/user-attachments/assets/22ff0021-c8c7-47ae-a029-7e5d058564ec"
/>
## 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
[SWAPS-4538](https://consensyssoftware.atlassian.net/browse/SWAPS-4538)
## 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/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
[SWAPS-4538]:
https://consensyssoftware.atlassian.net/browse/SWAPS-4538?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Analytics-only payload fix in bridge metrics helpers; no transaction
or auth logic changes.
>
> **Overview**
> Fixes **Unified SwapBridge Quotes Received** analytics so
`token_symbol_source` and `token_symbol_destination` are included when
clients build the event via `getQuotesReceivedProperties`.
>
> `getQuotesReceivedProperties` now sets those fields from the active
quote’s `srcAsset` / `destAsset` symbols (`''` and `null` when there is
no active quote). The `QuotesReceived` event context type is updated to
require the symbol fields, and `getRequestParams` docs point callers at
`getQuotesReceivedProperties` for symbols. Tests and a
bridge-status-controller snapshot reflect the new payload shape.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
e1137f3. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 9214097 commit 0cee394
5 files changed
Lines changed: 112 additions & 14 deletions
File tree
- packages
- bridge-controller
- src/utils/metrics
- bridge-status-controller/src/__snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
Lines changed: 91 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
364 | 381 | | |
365 | | - | |
| 382 | + | |
| 383 | + | |
366 | 384 | | |
367 | 385 | | |
368 | 386 | | |
| |||
407 | 425 | | |
408 | 426 | | |
409 | 427 | | |
410 | | - | |
| 428 | + | |
411 | 429 | | |
412 | 430 | | |
413 | 431 | | |
| |||
433 | 451 | | |
434 | 452 | | |
435 | 453 | | |
| 454 | + | |
| 455 | + | |
436 | 456 | | |
437 | 457 | | |
438 | 458 | | |
439 | 459 | | |
440 | 460 | | |
441 | 461 | | |
442 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
443 | 530 | | |
444 | 531 | | |
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| 182 | + | |
| 183 | + | |
181 | 184 | | |
182 | 185 | | |
183 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1282 | 1282 | | |
1283 | 1283 | | |
1284 | 1284 | | |
| 1285 | + | |
| 1286 | + | |
1285 | 1287 | | |
1286 | 1288 | | |
1287 | 1289 | | |
| |||
0 commit comments