2021-06-08 17:25:48 +02:00
|
|
|
import { addHexPrefix } from 'ethereumjs-util';
|
2021-10-19 21:31:56 +02:00
|
|
|
import { MIN_GAS_LIMIT_HEX } from '../../ui/pages/send/send.constants';
|
2021-06-08 22:15:28 +02:00
|
|
|
|
|
|
|
const ONE_HUNDRED_THOUSAND = 100000;
|
2021-06-08 17:25:48 +02:00
|
|
|
|
|
|
|
export const GAS_LIMITS = {
|
|
|
|
// maximum gasLimit of a simple send
|
2021-10-19 21:31:56 +02:00
|
|
|
SIMPLE: addHexPrefix(MIN_GAS_LIMIT_HEX),
|
2021-06-08 17:25:48 +02:00
|
|
|
// a base estimate for token transfers.
|
2021-06-08 22:15:28 +02:00
|
|
|
BASE_TOKEN_ESTIMATE: addHexPrefix(ONE_HUNDRED_THOUSAND.toString(16)),
|
2021-06-08 17:25:48 +02:00
|
|
|
};
|
2021-07-08 22:23:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* These are already declared in @metamask/controllers but importing them from
|
|
|
|
* that module and re-exporting causes the UI bundle size to expand beyond 4MB
|
|
|
|
*/
|
|
|
|
export const GAS_ESTIMATE_TYPES = {
|
|
|
|
FEE_MARKET: 'fee-market',
|
|
|
|
LEGACY: 'legacy',
|
|
|
|
ETH_GASPRICE: 'eth_gasPrice',
|
|
|
|
NONE: 'none',
|
|
|
|
};
|
2021-07-12 18:16:03 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* These represent gas recommendation levels presented in the UI
|
|
|
|
*/
|
|
|
|
export const GAS_RECOMMENDATIONS = {
|
|
|
|
LOW: 'low',
|
|
|
|
MEDIUM: 'medium',
|
|
|
|
HIGH: 'high',
|
|
|
|
};
|
2021-07-14 18:45:37 +02:00
|
|
|
|
2021-11-18 20:08:29 +01:00
|
|
|
/**
|
|
|
|
* These represent types of gas estimation
|
|
|
|
*/
|
|
|
|
export const PRIORITY_LEVELS = {
|
2022-01-06 23:40:31 +01:00
|
|
|
TEN_PERCENT_INCREASED: 'tenPercentIncreased',
|
2021-11-18 20:08:29 +01:00
|
|
|
LOW: 'low',
|
|
|
|
MEDIUM: 'medium',
|
|
|
|
HIGH: 'high',
|
|
|
|
CUSTOM: 'custom',
|
|
|
|
DAPP_SUGGESTED: 'dappSuggested',
|
|
|
|
};
|
|
|
|
|
2021-11-06 01:59:23 +01:00
|
|
|
/**
|
|
|
|
* Represents the user customizing their gas preference
|
|
|
|
*/
|
|
|
|
export const CUSTOM_GAS_ESTIMATE = 'custom';
|
|
|
|
|
2021-07-14 18:45:37 +02:00
|
|
|
/**
|
|
|
|
* These represent the different edit modes presented in the UI
|
|
|
|
*/
|
|
|
|
export const EDIT_GAS_MODES = {
|
|
|
|
SPEED_UP: 'speed-up',
|
|
|
|
CANCEL: 'cancel',
|
|
|
|
MODIFY_IN_PLACE: 'modify-in-place',
|
2021-07-30 13:35:30 +02:00
|
|
|
SWAPS: 'swaps',
|
2021-07-14 18:45:37 +02:00
|
|
|
};
|
2022-01-07 20:18:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents levels for `networkCongestion` (calculated along with gas fee
|
|
|
|
* estimates; represents a number between 0 and 1) that we use to render the
|
|
|
|
* network status slider on the send transaction screen and inform users when
|
|
|
|
* gas fees are high
|
|
|
|
*/
|
|
|
|
export const NETWORK_CONGESTION_THRESHOLDS = {
|
|
|
|
NOT_BUSY: 0,
|
|
|
|
STABLE: 0.33,
|
|
|
|
BUSY: 0.66,
|
|
|
|
};
|