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

Use gas estimate type constants (#12460)

This commit is contained in:
David Walsh 2021-11-10 13:50:43 -06:00 committed by GitHub
parent a4053b6b88
commit 3f9ec40107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 8 deletions

View File

@ -26,6 +26,7 @@ import {
TRANSACTION_TYPES,
TRANSACTION_ENVELOPE_TYPES,
} from '../../../../shared/constants/transaction';
import { TRANSACTION_ENVELOPE_TYPE_NAMES } from '../../../../ui/helpers/constants/transactions';
import { METAMASK_CONTROLLER_EVENTS } from '../../metamask-controller';
import {
GAS_LIMITS,
@ -1447,8 +1448,8 @@ export default class TransactionController extends EventEmitter {
sensitiveProperties: {
status,
transaction_envelope_type: isEIP1559Transaction(txMeta)
? 'fee-market'
: 'legacy',
? TRANSACTION_ENVELOPE_TYPE_NAMES.FEE_MARKET
: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY,
first_seen: time,
gas_limit: gasLimit,
...gasParamsInGwei,

View File

@ -20,6 +20,7 @@ import {
GAS_ESTIMATE_TYPES,
GAS_RECOMMENDATIONS,
} from '../../../../shared/constants/gas';
import { TRANSACTION_ENVELOPE_TYPE_NAMES } from '../../../../ui/helpers/constants/transactions';
import { METAMASK_CONTROLLER_EVENTS } from '../../metamask-controller';
import TransactionController, { TRANSACTION_EVENTS } from '.';
@ -774,7 +775,7 @@ describe('Transaction Controller', function () {
nonce: '0x4b',
},
type: TRANSACTION_TYPES.SIMPLE_SEND,
transaction_envelope_type: 'legacy',
transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY,
origin: 'metamask',
chainId: currentChainId,
time: 1624408066355,
@ -1578,7 +1579,7 @@ describe('Transaction Controller', function () {
gas_price: '2',
gas_limit: '0x7b0d',
first_seen: 1624408066355,
transaction_envelope_type: 'legacy',
transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY,
status: 'unapproved',
},
};
@ -1625,7 +1626,7 @@ describe('Transaction Controller', function () {
gas_price: '2',
gas_limit: '0x7b0d',
first_seen: 1624408066355,
transaction_envelope_type: 'legacy',
transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY,
status: 'unapproved',
},
};
@ -1674,7 +1675,7 @@ describe('Transaction Controller', function () {
gas_price: '2',
gas_limit: '0x7b0d',
first_seen: 1624408066355,
transaction_envelope_type: 'legacy',
transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.LEGACY,
status: 'unapproved',
},
};
@ -1731,7 +1732,7 @@ describe('Transaction Controller', function () {
max_priority_fee_per_gas: '2',
gas_limit: '0x7b0d',
first_seen: 1624408066355,
transaction_envelope_type: 'fee-market',
transaction_envelope_type: TRANSACTION_ENVELOPE_TYPE_NAMES.FEE_MARKET,
status: 'unapproved',
estimate_suggested: GAS_RECOMMENDATIONS.MEDIUM,
estimate_used: GAS_RECOMMENDATIONS.HIGH,

View File

@ -19,3 +19,8 @@ export const TOKEN_CATEGORY_HASH = {
[TRANSACTION_TYPES.TOKEN_METHOD_TRANSFER]: true,
[TRANSACTION_TYPES.TOKEN_METHOD_TRANSFER_FROM]: true,
};
export const TRANSACTION_ENVELOPE_TYPE_NAMES = {
FEE_MARKET: 'fee-market',
LEGACY: 'legacy',
};

View File

@ -17,6 +17,7 @@ import {
MOCKS,
} from '../../../../test/jest';
import { MAINNET_CHAIN_ID } from '../../../../shared/constants/network';
import { TRANSACTION_ENVELOPE_TYPE_NAMES } from '../../../helpers/constants/transactions';
import FeeCard from '.';
const middleware = [thunk];
@ -35,7 +36,7 @@ const generateUseSelectorRouter = () => (selector) => {
return true;
}
if (selector === getGasEstimateType) {
return 'fee-market';
return TRANSACTION_ENVELOPE_TYPE_NAMES.FEE_MARKET;
}
if (selector === getGasFeeEstimates) {
return MOCKS.createGasFeeEstimatesForFeeMarket();