diff --git a/app/scripts/lib/transaction/metrics.test.ts b/app/scripts/lib/transaction/metrics.test.ts index 2fea8da0dcb7..8e2924a0e30f 100644 --- a/app/scripts/lib/transaction/metrics.test.ts +++ b/app/scripts/lib/transaction/metrics.test.ts @@ -18,6 +18,7 @@ import { MetaMetricsTransactionEventSource, MetaMetricsEventCategory, MetaMetricsEventUiCustomization, + MetaMetricsEventTransactionEstimateType, } from '../../../../shared/constants/metametrics'; import { TRANSACTION_ENVELOPE_TYPE_NAMES } from '../../../../shared/lib/transactions-controller-utils'; import { @@ -165,6 +166,7 @@ describe('Transaction metrics', () => { }; expectedSensitiveProperties = { + default_estimate: MetaMetricsEventTransactionEstimateType.DefaultEstimate, default_gas: '0.000031501', default_gas_price: '2', first_seen: 1624408066355, diff --git a/app/scripts/lib/transaction/metrics.ts b/app/scripts/lib/transaction/metrics.ts index 21a385307742..ee09d60259cd 100644 --- a/app/scripts/lib/transaction/metrics.ts +++ b/app/scripts/lib/transaction/metrics.ts @@ -9,12 +9,16 @@ import { TransactionType, } from '@metamask/transaction-controller'; import { ORIGIN_METAMASK } from '../../../../shared/constants/app'; -import { GasRecommendations } from '../../../../shared/constants/gas'; +import { + GasRecommendations, + PriorityLevels, +} from '../../../../shared/constants/gas'; import { MetaMetricsEventCategory, MetaMetricsEventFragment, MetaMetricsEventName, MetaMetricsEventUiCustomization, + MetaMetricsEventTransactionEstimateType, MetaMetricsPageObject, MetaMetricsReferrerObject, } from '../../../../shared/constants/metametrics'; @@ -824,12 +828,18 @@ async function buildEventFragmentProperties({ gasParams.max_priority_fee_per_gas = maxPriorityFeePerGas; } else { gasParams.gas_price = gasPrice; + gasParams.default_estimate = + MetaMetricsEventTransactionEstimateType.DefaultEstimate; } if (defaultGasEstimates) { const { estimateType } = defaultGasEstimates; if (estimateType) { - gasParams.default_estimate = estimateType; + gasParams.default_estimate = + estimateType === PriorityLevels.dAppSuggested + ? MetaMetricsEventTransactionEstimateType.DappProposed + : estimateType; + let defaultMaxFeePerGas = transactionMeta.defaultGasEstimates?.maxFeePerGas; let defaultMaxPriorityFeePerGas = diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index 700bead89320..a65c349963ec 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -1034,3 +1034,8 @@ export enum DeleteRegulationStatus { Running = 'RUNNING', Unknown = 'UNKNOWN', } + +export enum MetaMetricsEventTransactionEstimateType { + DappProposed = 'dapp_proposed', + DefaultEstimate = 'default_estimate', +}