-
Notifications
You must be signed in to change notification settings - Fork 5.4k
chore: update accounts metric payload #38420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (2 files, +85 -13)
|
Builds ready [44fe130]
UI Startup Metrics (1212 ± 107 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [0544a0f]
UI Startup Metrics (1204 ± 96 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [7962b6c]
UI Startup Metrics (1273 ± 107 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| [HardwareDeviceNames.qr]: KeyringTypes.qr, | ||
| }; | ||
|
|
||
| export const KEYRING_DEVICE_PROPERTY_MAP = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of duplication in here. It might be too complex to refactor now but maybe something we can aim to do later on.
|
Not sure whats going wrong here but when I perform a send with my Ledger Flex, these are the events and properties that I see in my debugger. First, I am not sure why but I am seeing the |
Builds ready [4d831ba]
UI Startup Metrics (1280 ± 123 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [4c0a990]
UI Startup Metrics (1218 ± 105 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| case KeyringType.qr: | ||
| case KeyringType.ledger: | ||
| return 'hardware'; | ||
| return KEYRING_DEVICE_PROPERTY_MAP[keyringType]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Map key mismatch causes undefined return for hardware wallets
The getAccountType function uses KEYRING_DEVICE_PROPERTY_MAP[keyringType] to look up the hardware wallet display name. However, KEYRING_DEVICE_PROPERTY_MAP is keyed by KeyringTypes.xxx values from @metamask/keyring-controller, while keyringType comes from the switch case which matches against KeyringType.xxx values (like 'Ledger Hardware'). If these values differ (e.g., KeyringTypes.ledger = 'ledger' vs KeyringType.ledger = 'Ledger Hardware'), the map lookup will return undefined instead of the expected display name like 'Ledger'. The PR discussion mentions missing account_hardware_type properties, which aligns with this lookup returning falsy values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's ok, the keyringType should always be valid, so as long as KEYRING_DEVICE_PROPERTY_MAP uses KeyringTypes (and is exhaustive and complete) that should be fine.
owencraston
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ledger Testing Results
- "account_hardware_type": "Ledger", ✅
- "account_type": "Ledger", ✅
- "device_model": "ledger", ✅
events that fired:
[mock-segment]: Track event received: Send Started
{
"account_type": "eip155:eoa",
"token_symbol": "ETH",
"location": "Home",
"text": "Send",
"chain_id": "0x1",
"category": "Navigation",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Send Asset Selected
{
"asset_type": "native",
"asset_list_position": 1,
"asset_list_size": "13",
"chain_id": null,
"chain_id_caip": "eip155:1",
"filter_method": [
"none"
],
"category": "Send",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Send Amount Selected
{
"account_type": "hardware",
"input_method": "manual",
"input_type": "token",
"chain_id": "0x1",
"category": "Send",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Send Recipient Selected
{
"account_type": "hardware",
"input_method": "select_account",
"chain_id": null,
"chain_id_caip": "eip155:1",
"category": "Send",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Page event received: Confirmation Root Page
{
"params": {},
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Transaction Added Anon
{
"transaction_envelope_type": "fee-market",
"first_seen": 1764732942852,
"gas_limit": "0x7b0c",
"transaction_contract_address": [],
"max_fee_per_gas": "2.047826162",
"max_priority_fee_per_gas": "2",
"default_estimate": "medium",
"default_max_fee_per_gas": "2.047826162",
"default_max_priority_fee_per_gas": "2",
"default_gas": "0.0000315",
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "unapproved",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": false,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_insufficient_native_asset": false,
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Added
{
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "unapproved",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": false,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_insufficient_native_asset": false,
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Petname Displayed
{
"petname_category": "ethereumAddress",
"has_petname": true,
"category": "Petnames",
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Petname Displayed
{
"petname_category": "ethereumAddress",
"has_petname": true,
"category": "Petnames",
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Page event received: Confirmation Root Page
{
"params": {
"id": "25537c40-cff9-11f0-ba09-f754b012d2d4"
},
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Page event received: Home
{
"params": {},
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: STX Status Updated
{
"account_hardware_type": "Ledger",
"account_type": "Ledger",
"device_model": "ledger",
"stx_status": "pending",
"type": "simpleSend",
"processing_time": 0,
"is_smart_transaction": true,
"stx_enabled": true,
"current_stx_enabled": true,
"stx_user_opt_in": true,
"category": "Transactions",
"locale": "en",
"chain_id": "0x1",
"environment_type": "background"
}
[mock-segment]: Track event received: STX Status Updated
{
"stx_status": "pending",
"type": "simpleSend",
"processing_time": 0,
"is_smart_transaction": true,
"stx_enabled": true,
"current_stx_enabled": true,
"stx_user_opt_in": true,
"category": "Transactions",
"locale": "en",
"chain_id": "0x1",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Submitted Anon
{
"transaction_envelope_type": "fee-market",
"first_seen": 1764732942852,
"gas_limit": "0x7b0c",
"transaction_contract_address": [],
"max_fee_per_gas": "2.053716814",
"max_priority_fee_per_gas": "2",
"default_estimate": "medium",
"default_max_fee_per_gas": "2.053716814",
"default_max_priority_fee_per_gas": "2",
"default_gas": "0.0000315",
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH",
"USDC"
],
"gas_insufficient_native_asset": false,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Submitted
{
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH",
"USDC"
],
"gas_insufficient_native_asset": false,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Approved Anon
{
"transaction_envelope_type": "fee-market",
"first_seen": 1764732942852,
"gas_limit": "0x7b0c",
"transaction_contract_address": [],
"max_fee_per_gas": "2.053716814",
"max_priority_fee_per_gas": "2",
"default_estimate": "medium",
"default_max_fee_per_gas": "2.053716814",
"default_max_priority_fee_per_gas": "2",
"default_gas": "0.0000315",
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH",
"USDC"
],
"gas_insufficient_native_asset": false,
"sending_value": 0.2126439,
"simulation_response": "balance_change",
"simulation_receiving_assets_petname": [],
"simulation_receiving_assets_quantity": 0,
"simulation_receiving_assets_type": [],
"simulation_receiving_assets_value": [],
"simulation_sending_assets_petname": [
"default"
],
"simulation_sending_assets_quantity": 1,
"simulation_sending_assets_type": [
"native"
],
"simulation_sending_assets_value": [
"available"
],
"is_send_max": false,
"address_alert_response": "Benign",
"simulation_latency": 0.625,
"simulation_sending_assets_total_value": 0.2126439,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Approved
{
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH",
"USDC"
],
"gas_insufficient_native_asset": false,
"sending_value": 0.2126439,
"simulation_response": "balance_change",
"simulation_receiving_assets_petname": [],
"simulation_receiving_assets_quantity": 0,
"simulation_receiving_assets_type": [],
"simulation_receiving_assets_value": [],
"simulation_sending_assets_petname": [
"default"
],
"simulation_sending_assets_quantity": 1,
"simulation_sending_assets_type": [
"native"
],
"simulation_sending_assets_value": [
"available"
],
"is_send_max": false,
"address_alert_response": "Benign",
"simulation_latency": 0.625,
"simulation_sending_assets_total_value": 0.2126439,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Finalized Anon
{
"transaction_envelope_type": "fee-market",
"first_seen": 1764732942852,
"gas_limit": "0x7b0c",
"transaction_contract_address": [],
"max_fee_per_gas": "2.053716814",
"max_priority_fee_per_gas": "2",
"default_estimate": "medium",
"default_max_fee_per_gas": "2.051669267",
"default_max_priority_fee_per_gas": "2",
"default_gas": "0.0000315",
"gas_used": "0.000021",
"block_number": "23930282",
"completion_time": "10",
"completion_time_onchain": "7.5",
"sending_value": 0.2126439,
"simulation_response": "balance_change",
"simulation_receiving_assets_petname": [],
"simulation_receiving_assets_quantity": 0,
"simulation_receiving_assets_type": [],
"simulation_receiving_assets_value": [],
"simulation_sending_assets_petname": [
"default"
],
"simulation_sending_assets_quantity": 1,
"simulation_sending_assets_type": [
"native"
],
"simulation_sending_assets_value": [
"available"
],
"is_send_max": false,
"address_alert_response": "Benign",
"simulation_latency": 0.625,
"simulation_sending_assets_total_value": 0.2126439,
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "confirmed",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH",
"USDC"
],
"gas_insufficient_native_asset": false,
"rpc_domain": "mainnet.infura.io",
"transaction_hash": "0x1b1a0c9c84faa0763ead4f7f7bb653f3dd7a66f0ec19a1ac67b6b6fc5fbbe746",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Finalized
{
"sending_value": 0.2126439,
"simulation_response": "balance_change",
"simulation_receiving_assets_petname": [],
"simulation_receiving_assets_quantity": 0,
"simulation_receiving_assets_type": [],
"simulation_receiving_assets_value": [],
"simulation_sending_assets_petname": [
"default"
],
"simulation_sending_assets_quantity": 1,
"simulation_sending_assets_type": [
"native"
],
"simulation_sending_assets_value": [
"available"
],
"is_send_max": false,
"address_alert_response": "Benign",
"simulation_latency": 0.625,
"simulation_sending_assets_total_value": 0.2126439,
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "confirmed",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Ledger",
"device_model": "ledger",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "25537c40-cff9-11f0-ba09-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Ledger",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH",
"USDC"
],
"gas_insufficient_native_asset": false,
"rpc_domain": "mainnet.infura.io",
"transaction_hash": "0x1b1a0c9c84faa0763ead4f7f7bb653f3dd7a66f0ec19a1ac67b6b6fc5fbbe746",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
owencraston
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trezor Testing steps
- "account_hardware_type": "Trezor", ✅
- "account_type": "Trezor", ✅
- device_model missing ❌ but this is not a big issue since I believe we determined getting the device model was not easy.
events that were fired:
[mock-segment]: Track event received: Send Started
{
"account_type": "eip155:eoa",
"token_symbol": "ETH",
"location": "Home",
"text": "Send",
"chain_id": "0x1",
"category": "Navigation",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Send Asset Selected
{
"asset_type": "native",
"asset_list_position": 1,
"asset_list_size": "12",
"chain_id": null,
"chain_id_caip": "eip155:1",
"filter_method": [
"none"
],
"category": "Send",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Send Amount Selected
{
"account_type": "hardware",
"input_method": "manual",
"input_type": "token",
"chain_id": "0x1",
"category": "Send",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Send Recipient Selected
{
"account_type": "hardware",
"input_method": "select_account",
"chain_id": null,
"chain_id_caip": "eip155:1",
"category": "Send",
"locale": "en",
"environment_type": "fullscreen"
}
[mock-segment]: Page event received: Confirmation Root Page
{
"params": {},
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Transaction Added Anon
{
"transaction_envelope_type": "fee-market",
"first_seen": 1764734048178,
"gas_limit": "0x7b0c",
"transaction_contract_address": [],
"max_fee_per_gas": "2.049991634",
"max_priority_fee_per_gas": "2",
"default_estimate": "medium",
"default_max_fee_per_gas": "2.049991634",
"default_max_priority_fee_per_gas": "2",
"default_gas": "0.0000315",
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "unapproved",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Trezor",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "b826d920-cffb-11f0-bbc2-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Trezor",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_insufficient_native_asset": false,
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Added
{
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "unapproved",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Trezor",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "b826d920-cffb-11f0-bbc2-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Trezor",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_insufficient_native_asset": false,
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Petname Displayed
{
"petname_category": "ethereumAddress",
"has_petname": true,
"category": "Petnames",
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: Petname Displayed
{
"petname_category": "ethereumAddress",
"has_petname": true,
"category": "Petnames",
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Page event received: Confirmation Root Page
{
"params": {
"id": "b826d920-cffb-11f0-bbc2-f754b012d2d4"
},
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Page event received: Home
{
"params": {},
"locale": "en",
"chain_id": "0x1",
"environment_type": "fullscreen"
}
[mock-segment]: Track event received: STX Status Updated
{
"account_hardware_type": "Trezor",
"account_type": "Trezor",
"stx_status": "pending",
"type": "simpleSend",
"processing_time": 0,
"is_smart_transaction": true,
"stx_enabled": true,
"current_stx_enabled": true,
"stx_user_opt_in": true,
"category": "Transactions",
"locale": "en",
"chain_id": "0x1",
"environment_type": "background"
}
[mock-segment]: Track event received: STX Status Updated
{
"stx_status": "pending",
"type": "simpleSend",
"processing_time": 0,
"is_smart_transaction": true,
"stx_enabled": true,
"current_stx_enabled": true,
"stx_user_opt_in": true,
"category": "Transactions",
"locale": "en",
"chain_id": "0x1",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Submitted Anon
{
"transaction_envelope_type": "fee-market",
"first_seen": 1764734048178,
"gas_limit": "0x7b0c",
"transaction_contract_address": [],
"max_fee_per_gas": "2.049991634",
"max_priority_fee_per_gas": "2",
"default_estimate": "medium",
"default_max_fee_per_gas": "2.045137005",
"default_max_priority_fee_per_gas": "2",
"default_gas": "0.0000315",
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Trezor",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "b826d920-cffb-11f0-bbc2-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Trezor",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH"
],
"gas_insufficient_native_asset": false,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Submitted
{
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Trezor",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "b826d920-cffb-11f0-bbc2-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Trezor",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH"
],
"gas_insufficient_native_asset": false,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Approved Anon
{
"transaction_envelope_type": "fee-market",
"first_seen": 1764734048178,
"gas_limit": "0x7b0c",
"transaction_contract_address": [],
"max_fee_per_gas": "2.049991634",
"max_priority_fee_per_gas": "2",
"default_estimate": "medium",
"default_max_fee_per_gas": "2.045137005",
"default_max_priority_fee_per_gas": "2",
"default_gas": "0.0000315",
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Trezor",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "b826d920-cffb-11f0-bbc2-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Trezor",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH"
],
"gas_insufficient_native_asset": false,
"sending_value": 0.1517475,
"simulation_response": "balance_change",
"simulation_receiving_assets_petname": [],
"simulation_receiving_assets_quantity": 0,
"simulation_receiving_assets_type": [],
"simulation_receiving_assets_value": [],
"simulation_sending_assets_petname": [
"default"
],
"simulation_sending_assets_quantity": 1,
"simulation_sending_assets_type": [
"native"
],
"simulation_sending_assets_value": [
"available"
],
"is_send_max": false,
"address_alert_response": "Benign",
"simulation_latency": 0.2,
"simulation_sending_assets_total_value": 0.1517475,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
[mock-segment]: Track event received: Transaction Approved
{
"chain_id": "0x1",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "1",
"eip_1559_version": "2",
"gas_edit_type": "none",
"gas_edit_attempted": "none",
"gas_estimation_failed": false,
"account_type": "Trezor",
"asset_type": "NATIVE",
"token_standard": "NONE",
"transaction_type": "simpleSend",
"transaction_speed_up": false,
"transaction_internal_id": "b826d920-cffb-11f0-bbc2-f754b012d2d4",
"gas_fee_selected": "medium",
"ui_customizations": [
"redesigned_confirmation"
],
"transaction_advanced_view": false,
"transaction_contract_method": [],
"is_smart_transaction": true,
"account_hardware_type": "Trezor",
"api_method": "eth_sendTransaction",
"eip7702_upgrade_transaction": false,
"gas_payment_tokens_available": [
"ETH"
],
"gas_insufficient_native_asset": false,
"sending_value": 0.1517475,
"simulation_response": "balance_change",
"simulation_receiving_assets_petname": [],
"simulation_receiving_assets_quantity": 0,
"simulation_receiving_assets_type": [],
"simulation_receiving_assets_value": [],
"simulation_sending_assets_petname": [
"default"
],
"simulation_sending_assets_quantity": 1,
"simulation_sending_assets_type": [
"native"
],
"simulation_sending_assets_value": [
"available"
],
"is_send_max": false,
"address_alert_response": "Benign",
"simulation_latency": 0.2,
"simulation_sending_assets_total_value": 0.1517475,
"rpc_domain": "mainnet.infura.io",
"category": "Transactions",
"locale": "en",
"environment_type": "background"
}
Builds ready [bf76d61]
UI Startup Metrics (1222 ± 105 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
QR Testing results
events that fired: |
owencraston
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving since all the tests came back positive.
|
Created an issue to update the schema. I can handle this one. |
ccharly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left some nits but they are not so important:
[mock-segment]: Track event received: Account Added
{
"account_type": "hardware",
"account_hardware_type": "ledger",
"is_suggested_name": true,
"category": "Accounts",
"locale": "en",
"chain_id": "0xaa36a7",
"environment_type": "fullscreen"
}
...
[mock-segment]: Track event received: Hardware Wallet Account Connected
{
"device_type": "Ledger",
"hd_path": "m/44'/60'/0'/0/0",
"connected_device_count": 1,
"locale": "en",
"chain_id": "0xaa36a7",
"environment_type": "fullscreen"
}
...
[mock-segment]: Track event received: STX Status Updated
{
"account_hardware_type": "Ledger",
"account_type": "Ledger",
"device_model": "ledger",
"stx_status": "pending",
"type": "simpleSend",
...
"chain_id": "0xaa36a7",
"environment_type": "background"
}
...
[mock-segment]: Track event received: Transaction Submitted
{
"chain_id": "0xaa36a7",
"referrer": "metamask",
"source": "user",
"status": "submitted",
"network": "11155111",
...
"transaction_type": "simpleSend",
...
"environment_type": "background"
}| case KeyringType.qr: | ||
| case KeyringType.ledger: | ||
| return 'hardware'; | ||
| return KEYRING_DEVICE_PROPERTY_MAP[keyringType]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: But the jsdoc is now wrong, since we're not returning 'hardware' anymore!
| await metamaskController.getHardwareTypeForMetric('0x123'); | ||
|
|
||
| expect(result).toBe(HardwareKeyringType[type]); | ||
| expect(result).toBe(KEYRING_DEVICE_PROPERTY_MAP[type]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We could have used Object.keys(KEYRING_DEVICE_PROPERTY_MAP) for this test (in it.each, instead of enumerating each hardware keyring types now that we have a proper mapping for it!
<!-- 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 -->




Description
Updates the send events to use the updated properties for hardware wallets as they're described in MUL-1257
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/MUL-1257
Manual testing steps
hardware_wallet_typeandaccount_typereflect the following values:Ledger || Trezor || QR Hardware || Lattice || OneKeyfor the events Transaction Added, Transaction Approved, Transaction Submitted, and Transaction FinalizedScreenshots/Recordings
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Maps hardware keyring types to human-readable device names for metrics and only includes
account_hardware_typewhen present; updates tests accordingly.app/scripts/lib/snap-keyring/metrics.ts):account_hardware_typeonly when resolved.account_type,device_model, and snap fields unchanged.app/scripts/metamask-controller.js):KEYRING_DEVICE_PROPERTY_MAPto map keyring types to device names ingetHardwareTypeForMetricandgetAccountType.shared/constants/hardware-wallets.ts):KEYRING_DEVICE_PROPERTY_MAPmapping fromKeyringTypesto device labels (Ledger, Trezor, OneKey, Lattice, QR Hardware).account_hardware_type.Written by Cursor Bugbot for commit bf76d61. This will update automatically on new commits. Configure here.