1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

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

This commit is contained in:
Adnan Sahovic 2022-07-28 15:46:20 +02:00 committed by GitHub
parent aea5c5824f
commit 6723608173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -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 = {

View File

@ -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,

View File

@ -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