From 12e7089363e4b68c86ce25b1c6abc04668c62ce6 Mon Sep 17 00:00:00 2001 From: Brad Decker Date: Mon, 12 Jul 2021 17:30:35 -0500 Subject: [PATCH] moving some properties to identifiable payload (#11506) --- app/scripts/controllers/transactions/index.js | 10 ++-- .../controllers/transactions/index.test.js | 48 +++++++++++-------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 518e463ea..942fa5906 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -1087,13 +1087,15 @@ export default class TransactionController extends EventEmitter { this._trackMetaMetricsEvent({ event, category: 'Transactions', - sensitiveProperties: { - type, - status, + properties: { + chain_id: chainId, referrer, source, network, - chain_id: chainId, + type, + }, + sensitiveProperties: { + status, transaction_envelope_type: isEIP1559Transaction(txMeta) ? 'fee-market' : 'legacy', diff --git a/app/scripts/controllers/transactions/index.test.js b/app/scripts/controllers/transactions/index.test.js index 1a5d6697d..b0cfa04f9 100644 --- a/app/scripts/controllers/transactions/index.test.js +++ b/app/scripts/controllers/transactions/index.test.js @@ -1212,17 +1212,19 @@ describe('Transaction Controller', function () { const expectedPayload = { event: 'Transaction Added', category: 'Transactions', - sensitiveProperties: { + properties: { chain_id: '0x2a', + network: '42', + referrer: 'metamask', + source: 'user', + type: 'sentEther', + }, + sensitiveProperties: { gas_price: '2', gas_limit: '0x7b0d', first_seen: 1624408066355, transaction_envelope_type: 'legacy', - network: '42', - referrer: 'metamask', - source: 'user', status: 'unapproved', - type: 'sentEther', }, }; @@ -1257,17 +1259,19 @@ describe('Transaction Controller', function () { const expectedPayload = { event: 'Transaction Added', category: 'Transactions', - sensitiveProperties: { + properties: { chain_id: '0x2a', + network: '42', + referrer: 'other', + source: 'dapp', + type: 'sentEther', + }, + sensitiveProperties: { gas_price: '2', gas_limit: '0x7b0d', first_seen: 1624408066355, transaction_envelope_type: 'legacy', - network: '42', - referrer: 'other', - source: 'dapp', status: 'unapproved', - type: 'sentEther', }, }; @@ -1302,19 +1306,21 @@ describe('Transaction Controller', function () { const expectedPayload = { event: 'Transaction Added', category: 'Transactions', + properties: { + network: '42', + referrer: 'other', + source: 'dapp', + type: 'sentEther', + chain_id: '0x2a', + }, sensitiveProperties: { baz: 3.0, foo: 'bar', - chain_id: '0x2a', gas_price: '2', gas_limit: '0x7b0d', first_seen: 1624408066355, transaction_envelope_type: 'legacy', - network: '42', - referrer: 'other', - source: 'dapp', status: 'unapproved', - type: 'sentEther', }, }; @@ -1354,20 +1360,22 @@ describe('Transaction Controller', function () { const expectedPayload = { event: 'Transaction Added', category: 'Transactions', + properties: { + chain_id: '0x2a', + network: '42', + referrer: 'other', + source: 'dapp', + type: 'sentEther', + }, sensitiveProperties: { baz: 3.0, foo: 'bar', - chain_id: '0x2a', max_fee_per_gas: '2', max_priority_fee_per_gas: '2', gas_limit: '0x7b0d', first_seen: 1624408066355, transaction_envelope_type: 'fee-market', - network: '42', - referrer: 'other', - source: 'dapp', status: 'unapproved', - type: 'sentEther', }, };