Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 193096f. Configure here.
4 tasks
SteP-n-s
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
Previously, the bridge analytics pipeline tracked hardware wallet participation as a simple boolean (
is_hardware_wallet: true/false). This was sufficient to answer "did a hardware wallet user complete this swap?" but not "which hardware wallet did they use?" — a signal needed for device-specific debugging and segmentation.This PR adds an
account_hardware_typefield (typed as'Ledger' | 'Trezor' | 'QR Hardware' | 'Lattice' | null) alongside the existingis_hardware_walletboolean across all bridge/swap analytics events. The two fields are kept in sync:is_hardware_walletis now always derived asaccountHardwareType !== null, so they can never disagree.Key implementation details:
getAccountHardwareType()— new helper inbridge-controller/src/utils/metrics/properties.tsthat maps raw keyring type strings (e.g.'Ledger Hardware') to the analytics enum values.isHardwareWalletis updated to delegate to it.RequestMetadatagainsaccount_hardware_type, andEventPropertiesFromControllerState[PageViewed]is widened to include the full request-metadata subset (hardware type, slippage, swap type) since that event was previously missing those fields.BridgeController#getRequestMetadatanow resolvesaccount_hardware_typeandis_hardware_walletin one place and propagates them to all events that call it, replacing the scattered inlineisHardwareWallet(this.#getMultichainSelectedAccount())calls. The lookup is guarded by awalletAddresscheck to prevent#getMultichainSelectedAccountfrom throwing when the quote request hasn't been populated yet (which would silently suppress event tracking via the catch block).getEVMTxPropertiesFromTransactionMetagains an optionalaccountparameter so thetransactionFailedsubscription can pass the resolved account for hardware-type enrichment.#onTransactionFailedwas extracted from the constructor into a private class field to comply with the no-messenger-calls-in-constructor lint rule. It also gains an upfrontfeatureIdguard so theAccountsController:getAccountByAddresscall is never made for PERPS transactions (where tracking is intentionally skipped), and usestxParams?.fromoptional chaining to handle fixtures wheretxParamsis absent.References
mainforbridge-controllerandbridge-status-controller. Replaced Swaps 3894 normalize bridge hardware type #8155Checklist
Note
Medium Risk
Touches metrics payload construction and
transactionFailedhandling inBridgeController/BridgeStatusController, so mistakes could break analytics schema or suppress/alter event emission, but no funds movement logic is changed.Overview
Adds normalized hardware-wallet attribution to unified swap/bridge analytics by introducing
AccountHardwareTypeand emitting a newaccount_hardware_typefield (Ledger/Trezor/QR Hardware/Lattice/null) across events, withis_hardware_walletnow derived fromaccount_hardware_type !== null.Centralizes hardware-type derivation via new
getAccountHardwareType(and updatesisHardwareWalletto use it), expandsRequestMetadataandPageViewedcontroller-derived properties to include the hardware/slippage/swap-type metadata, and updatesBridgeStatusControllerpre-confirmation and transaction-failure tracking to optionally look up the submitting account and includeaccount_hardware_type(including refactoring the failure subscription into#onTransactionFailedwith an earlyfeatureIdskip). Test snapshots and unit tests are updated accordingly, andbridge-controllerexports the new type/helper.Reviewed by Cursor Bugbot for commit d931d10. Bugbot is set up for automated code reviews on this repo. Configure here.