Commit ea93cae
authored
chore: update accounts metric payload (#38420)
<!--
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**
<!--
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/38420?quickstart=1)
Updates the send events to use the updated properties for hardware
wallets as they're described in
[MUL-1257](https://consensyssoftware.atlassian.net/browse/MUL-1257)
## **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: null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/MUL-1257
## **Manual testing steps**
1. Perform a send transaction using a hardware wallet device
2. Check that the properties `hardware_wallet_type` and `account_type`
reflect the following values: `Ledger || Trezor || QR Hardware ||
Lattice || OneKey` for the events Transaction Added, Transaction
Approved, Transaction Submitted, and Transaction Finalized
## **Screenshots/Recordings**
<img width="750" alt="Screenshot 2025-12-01 at 12 07 02 PM"
src="https://github.com/user-attachments/assets/70e349bd-8190-49cb-945f-df4bfebd35c4"
/>
## **Pre-merge author checklist**
- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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.
[MUL-1257]:
https://consensyssoftware.atlassian.net/browse/MUL-1257?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Maps hardware keyring types to human-readable device names for metrics
and only includes `account_hardware_type` when present; updates tests
accordingly.
>
> - **Metrics payload (`app/scripts/lib/snap-keyring/metrics.ts`)**:
> - Conditionally include `account_hardware_type` only when resolved.
> - Keep `account_type`, `device_model`, and snap fields unchanged.
> - **Controller (`app/scripts/metamask-controller.js`)**:
> - Use `KEYRING_DEVICE_PROPERTY_MAP` to map keyring types to device
names in `getHardwareTypeForMetric` and `getAccountType`.
> - **Constants (`shared/constants/hardware-wallets.ts`)**:
> - Add `KEYRING_DEVICE_PROPERTY_MAP` mapping from `KeyringTypes` to
device labels (Ledger, Trezor, OneKey, Lattice, QR Hardware).
> - **Tests**:
> - Update expectations to use device-name mapping and conditional
`account_hardware_type`.
> - Add hardware wallet account test; adjust HD and snap account tests.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bf76d61. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 642d0ad commit ea93cae
File tree
5 files changed
+98
-18
lines changed- app/scripts
- lib/snap-keyring
5 files changed
+98
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
| |||
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 88 | | |
94 | 89 | | |
95 | 90 | | |
96 | 91 | | |
97 | 92 | | |
98 | 93 | | |
99 | 94 | | |
100 | | - | |
| 95 | + | |
101 | 96 | | |
102 | 97 | | |
103 | | - | |
104 | 98 | | |
105 | 99 | | |
106 | 100 | | |
| |||
138 | 132 | | |
139 | 133 | | |
140 | 134 | | |
141 | | - | |
142 | 135 | | |
143 | 136 | | |
144 | 137 | | |
| |||
161 | 154 | | |
162 | 155 | | |
163 | 156 | | |
164 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
165 | 226 | | |
166 | 227 | | |
167 | 228 | | |
168 | 229 | | |
169 | 230 | | |
170 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
171 | 235 | | |
172 | 236 | | |
173 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | 154 | | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
5452 | 5452 | | |
5453 | 5453 | | |
5454 | 5454 | | |
5455 | | - | |
| 5455 | + | |
5456 | 5456 | | |
5457 | 5457 | | |
5458 | 5458 | | |
| |||
5490 | 5490 | | |
5491 | 5491 | | |
5492 | 5492 | | |
5493 | | - | |
| 5493 | + | |
5494 | 5494 | | |
5495 | 5495 | | |
5496 | 5496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
1630 | 1630 | | |
1631 | 1631 | | |
1632 | 1632 | | |
1633 | | - | |
| 1633 | + | |
1634 | 1634 | | |
1635 | 1635 | | |
1636 | 1636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
150 | 158 | | |
151 | 159 | | |
152 | 160 | | |
| |||
0 commit comments