Added speed up metrics data for transaction events and properly track speed up type (#15197)

feature/default_network_editable
Adnan Sahovic 2 years ago committed by GitHub
parent aea5c5824f
commit 6723608173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      app/scripts/controllers/transactions/index.js
  2. 7
      app/scripts/controllers/transactions/index.test.js
  3. 3
      shared/constants/transaction.js

@ -1216,6 +1216,7 @@ export default class TransactionController extends EventEmitter {
loadingDefaults: false,
status: TRANSACTION_STATUSES.APPROVED,
type: TRANSACTION_TYPES.RETRY,
originalType: originalTxMeta.type,
});
if (estimatedBaseFee) {
@ -2006,6 +2007,7 @@ export default class TransactionController extends EventEmitter {
estimateUsed,
},
defaultGasEstimates,
originalType,
metamaskNetworkId: network,
} = txMeta;
const { transactions } = this.store.getState();
@ -2100,7 +2102,7 @@ export default class TransactionController extends EventEmitter {
if (type === TRANSACTION_TYPES.CANCEL) {
transactionType = TRANSACTION_TYPES.CANCEL;
} else if (type === TRANSACTION_TYPES.RETRY) {
transactionType = TRANSACTION_TYPES.RETRY;
transactionType = originalType;
} else if (type === TRANSACTION_TYPES.DEPLOY_CONTRACT) {
transactionType = TRANSACTION_TYPES.DEPLOY_CONTRACT;
} else if (contractInteractionTypes) {
@ -2121,6 +2123,7 @@ export default class TransactionController extends EventEmitter {
asset_type: assetType,
token_standard: tokenStandard,
transaction_type: transactionType,
transaction_speed_up: type === TRANSACTION_TYPES.RETRY,
};
const sensitiveProperties = {

@ -1476,6 +1476,7 @@ describe('Transaction Controller', function () {
asset_type: ASSET_TYPES.NATIVE,
token_standard: TOKEN_STANDARDS.NONE,
device_model: 'N/A',
transaction_speed_up: false,
},
sensitiveProperties: {
default_gas: '0.000031501',
@ -1556,6 +1557,7 @@ describe('Transaction Controller', function () {
asset_type: ASSET_TYPES.NATIVE,
token_standard: TOKEN_STANDARDS.NONE,
device_model: 'N/A',
transaction_speed_up: false,
},
sensitiveProperties: {
default_gas: '0.000031501',
@ -1646,6 +1648,7 @@ describe('Transaction Controller', function () {
asset_type: ASSET_TYPES.NATIVE,
token_standard: TOKEN_STANDARDS.NONE,
device_model: 'N/A',
transaction_speed_up: false,
},
sensitiveProperties: {
default_gas: '0.000031501',
@ -1728,6 +1731,7 @@ describe('Transaction Controller', function () {
asset_type: ASSET_TYPES.NATIVE,
token_standard: TOKEN_STANDARDS.NONE,
device_model: 'N/A',
transaction_speed_up: false,
},
sensitiveProperties: {
default_gas: '0.000031501',
@ -1810,6 +1814,7 @@ describe('Transaction Controller', function () {
asset_type: ASSET_TYPES.NATIVE,
token_standard: TOKEN_STANDARDS.NONE,
device_model: 'N/A',
transaction_speed_up: false,
},
sensitiveProperties: {
gas_price: '2',
@ -1874,6 +1879,7 @@ describe('Transaction Controller', function () {
asset_type: ASSET_TYPES.NATIVE,
token_standard: TOKEN_STANDARDS.NONE,
device_model: 'N/A',
transaction_speed_up: false,
},
sensitiveProperties: {
baz: 3.0,
@ -1948,6 +1954,7 @@ describe('Transaction Controller', function () {
asset_type: ASSET_TYPES.NATIVE,
token_standard: TOKEN_STANDARDS.NONE,
device_model: 'N/A',
transaction_speed_up: false,
},
sensitiveProperties: {
baz: 3.0,

@ -256,6 +256,9 @@ export const TRANSACTION_GROUP_CATEGORIES = {
* transaction contract method.
* @property {TransactionTypeString} type - The type of transaction this txMeta
* represents.
* @property {string} originalType - When we speed up a transaction,
* we set the type as Retry and we lose information about type of transaction
* that is being set up, so we use original type to track that information.
* @property {TransactionStatusString} status - The current status of the
* transaction.
* @property {string} metamaskNetworkId - The transaction's network ID, used

Loading…
Cancel
Save