Skip to content

Conversation

@runway-github
Copy link
Contributor

@runway-github runway-github bot commented Dec 5, 2025

Description

This PR adds account_hardware_type to transaction events when the
account is a hardware account.

Changelog

CHANGELOG entry: null

Related issues

Fixes:
https://consensyssoftware.atlassian.net/browse/MUL-1259?atlOrigin=eyJpIjoiNGE0MjcyYTY0YjE0NGEyNGEwNWVjZGYwYWMzYjFkMWEiLCJwIjoiaiJ9

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

No visual changes.

After

Pre-merge author checklist

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.

Note

Adds account_hardware_type to transaction metrics for hardware accounts and renames QR account type to "QR Hardware" across code and tests.

  • Analytics/Metrics:
    • Add account_hardware_type to generateDefaultTransactionMetrics (null for non-HW; set to account type for HW via isHardwareAccount).
    • Update tests to cover hardware wallets (Ledger, QR Hardware), invalid addresses, and error cases.
  • Address Utils:
    • Change getAddressAccountType to return "QR Hardware" (was "QR").
    • Update related tests to expect "QR Hardware".
  • UI:
    • Update EditAccountName analytics mapping to treat "QR Hardware" as "hardware" for account_type.

Written by Cursor Bugbot for commit 4c200fd. This will update automatically on new commits. Configure here.


Co-authored-by: Charly Chevalier [email protected] e47bcb5

…cp-7.61.0 (#23585)

<!--
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**

This PR adds `account_hardware_type` to transaction events when the
account is a hardware account.

<!--
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?
-->

## **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-1259?atlOrigin=eyJpIjoiNGE0MjcyYTY0YjE0NGEyNGEwNWVjZGYwYWMzYjFkMWEiLCJwIjoiaiJ9

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

No visual changes. 

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **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.

## **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]
> Adds `account_hardware_type` to transaction metrics and standardizes
QR account type to "QR Hardware", updating analytics usage and tests.
> 
> - **Analytics/Transactions**:
> - Add `account_hardware_type` to `generateDefaultTransactionMetrics`
in `transaction-controller/utils.ts`; populated when
`isHardwareAccount(from)` is true, else `null`.
> - Update tests in `transaction-controller/utils.test.ts` to expect
`account_hardware_type`, add hardware wallet scenarios, and refactor
address mocks.
> - **Address utilities**:
> - Change `getAddressAccountType` to return `"QR Hardware"` for `qr`
keyrings in `app/util/address/index.ts` and update related tests.
> - **UI Analytics**:
> - In `EditAccountName.tsx`, map `account_type` to `hardware` when type
is `"QR Hardware"` for the ACCOUNT_RENAMED event.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8e4d25d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Charly Chevalier <[email protected]>
@runway-github runway-github bot requested review from a team as code owners December 5, 2025 09:37
@metamaskbot metamaskbot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions bot added the size-M label Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmationsRedesigned, SmokeAccounts, SmokeAnalytics, SmokeCore
  • Risk Level: high
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

The changes affect critical parts of the application:

  1. Transaction Controller Utils (CRITICAL FILE): These changes modify core transaction metrics generation in the Engine, which is used for ALL transaction types. The changes add new analytics properties for:

    • Gas payment token tracking (gas_paid_with, gas_payment_tokens_available)
    • Native asset sufficiency checking (gas_insufficient_native_asset)
    • Hardware wallet type identification (account_hardware_type)
  2. Address Utility Changes: The change from 'QR' to 'QR Hardware' affects account type detection throughout the app, which impacts account management, analytics, and hardware wallet flows.

  3. Scope of Impact:

    • All transaction confirmations (send, swap, approve, etc.)
    • Hardware wallet interactions (Ledger, QR-based wallets)
    • Analytics tracking for all transaction events
    • Gas fee calculations and display
    • Account management features

Selected Tags Justification:

  • SmokeConfirmationsRedesigned: Transaction confirmation flows are directly impacted by gas payment and metrics changes
  • SmokeAccounts: Hardware wallet account type changes and account management affected
  • SmokeAnalytics: New analytics properties added to transaction metrics
  • SmokeCore: Changes to Engine/transaction-controller utils affect core wallet functionality

The changes have comprehensive test coverage but touch critical transaction paths. The risk is HIGH because:

  • Engine/transaction-controller is a critical component
  • Changes affect all transaction types
  • Hardware wallet detection changes could impact account identification
  • Analytics changes span multiple transaction workflows

While the changes include thorough unit tests, E2E testing is warranted to ensure the integration works correctly across transaction flows, hardware wallet interactions, and account management.

View GitHub Actions results

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2025

@joaoloureirop joaoloureirop merged commit 3db047b into release/7.61.0 Dec 5, 2025
128 of 130 checks passed
@joaoloureirop joaoloureirop deleted the runway-cherry-pick-7.61.0-1764927438 branch December 5, 2025 12:43
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2025
@metamaskbot metamaskbot added the release-7.61.0 Issue or pull request that will be included in release 7.61.0 label Dec 5, 2025
@metamaskbot
Copy link
Collaborator

No release label on PR. Adding release label release-7.61.0 on PR, as PR was cherry-picked in branch 7.61.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.61.0 Issue or pull request that will be included in release 7.61.0 size-M team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants