1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00
metamask-extension/ui/helpers/constants/gas.js

44 lines
1.5 KiB
JavaScript
Raw Normal View History

export const GAS_FORM_ERRORS = {
GAS_LIMIT_OUT_OF_BOUNDS: 'editGasLimitOutOfBounds',
MAX_PRIORITY_FEE_TOO_LOW: 'editGasMaxPriorityFeeLow',
MAX_FEE_TOO_LOW: 'editGasMaxFeeLow',
MAX_PRIORITY_FEE_BELOW_MINIMUM: 'editGasMaxPriorityFeeBelowMinimum',
MAX_PRIORITY_FEE_HIGH_WARNING: 'editGasMaxPriorityFeeHigh',
MAX_FEE_HIGH_WARNING: 'editGasMaxFeeHigh',
MAX_FEE_IMBALANCE: 'editGasMaxFeeImbalance',
GAS_PRICE_TOO_LOW: 'editGasPriceTooLow',
};
export function getGasFormErrorText(type, t, { minimumGasLimit } = {}) {
switch (type) {
case GAS_FORM_ERRORS.GAS_LIMIT_OUT_OF_BOUNDS:
return t('editGasLimitOutOfBounds', [minimumGasLimit]);
case GAS_FORM_ERRORS.MAX_PRIORITY_FEE_TOO_LOW:
return t('editGasMaxPriorityFeeLow');
case GAS_FORM_ERRORS.MAX_FEE_TOO_LOW:
return t('editGasMaxFeeLow');
case GAS_FORM_ERRORS.MAX_PRIORITY_FEE_BELOW_MINIMUM:
return t('editGasMaxPriorityFeeBelowMinimum');
case GAS_FORM_ERRORS.MAX_PRIORITY_FEE_HIGH_WARNING:
return t('editGasMaxPriorityFeeHigh');
case GAS_FORM_ERRORS.MAX_FEE_HIGH_WARNING:
return t('editGasMaxFeeHigh');
case GAS_FORM_ERRORS.MAX_FEE_IMBALANCE:
return t('editGasMaxFeePriorityImbalance');
case GAS_FORM_ERRORS.GAS_PRICE_TOO_LOW:
return t('editGasPriceTooLow');
default:
return '';
}
}
export const PRIORITY_LEVEL_ICON_MAP = {
low: '🐢',
medium: '🦊',
high: '🦍',
dappSuggested: '🌐',
When gas fees suggested by dapp is too high, show warning color and icon (#19088) * When gas fees suggested by dapp is too high, show warning color and icon Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> tests Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> Fix tests Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> set a default for high gas fees Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> Fix test cases where transaction is undefined. Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> Fix locale error Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> Fix error where dappSuggestedGasFees is null Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> Fix icon for site suggested Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> Fix unit tests snapshot Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> * Fix QA Comments Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> * lint:fix Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> * Fix unit tests Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> * Fix PR comments Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> * Lint fix Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> * Fix PR comment. - call setEstimateUsed only once. Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> * use constants for Priority levels. Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com> --------- Signed-off-by: Olusegun Akintayo <akintayo.segun@gmail.com>
2023-06-08 12:26:18 +02:00
dappSuggestedHigh: '🌐',
2021-12-12 00:26:28 +01:00
swapSuggested: '🔄',
2022-01-06 23:40:31 +01:00
custom: '⚙️',
};