2021-07-20 21:34:32 +02:00
|
|
|
export const GAS_FORM_ERRORS = {
|
|
|
|
GAS_LIMIT_OUT_OF_BOUNDS: 'editGasLimitOutOfBounds',
|
|
|
|
MAX_PRIORITY_FEE_TOO_LOW: 'editGasMaxPriorityFeeLow',
|
|
|
|
MAX_FEE_TOO_LOW: 'editGasMaxFeeLow',
|
2021-08-05 00:07:17 +02:00
|
|
|
MAX_PRIORITY_FEE_BELOW_MINIMUM: 'editGasMaxPriorityFeeBelowMinimum',
|
2021-07-20 21:34:32 +02:00
|
|
|
MAX_PRIORITY_FEE_HIGH_WARNING: 'editGasMaxPriorityFeeHigh',
|
|
|
|
MAX_FEE_HIGH_WARNING: 'editGasMaxFeeHigh',
|
2021-08-02 16:07:29 +02:00
|
|
|
MAX_FEE_IMBALANCE: 'editGasMaxFeeImbalance',
|
2021-08-03 17:54:49 +02:00
|
|
|
GAS_PRICE_TOO_LOW: 'editGasPriceTooLow',
|
2021-07-20 21:34:32 +02:00
|
|
|
};
|
|
|
|
|
2021-07-30 13:35:30 +02:00
|
|
|
export function getGasFormErrorText(type, t, { minimumGasLimit } = {}) {
|
2021-07-20 21:34:32 +02:00
|
|
|
switch (type) {
|
|
|
|
case GAS_FORM_ERRORS.GAS_LIMIT_OUT_OF_BOUNDS:
|
2021-07-30 13:35:30 +02:00
|
|
|
return t('editGasLimitOutOfBounds', [minimumGasLimit]);
|
2021-07-20 21:34:32 +02:00
|
|
|
case GAS_FORM_ERRORS.MAX_PRIORITY_FEE_TOO_LOW:
|
|
|
|
return t('editGasMaxPriorityFeeLow');
|
|
|
|
case GAS_FORM_ERRORS.MAX_FEE_TOO_LOW:
|
|
|
|
return t('editGasMaxFeeLow');
|
2021-08-04 15:23:52 +02:00
|
|
|
case GAS_FORM_ERRORS.MAX_PRIORITY_FEE_BELOW_MINIMUM:
|
|
|
|
return t('editGasMaxPriorityFeeBelowMinimum');
|
2021-07-20 21:34:32 +02:00
|
|
|
case GAS_FORM_ERRORS.MAX_PRIORITY_FEE_HIGH_WARNING:
|
|
|
|
return t('editGasMaxPriorityFeeHigh');
|
|
|
|
case GAS_FORM_ERRORS.MAX_FEE_HIGH_WARNING:
|
|
|
|
return t('editGasMaxFeeHigh');
|
2021-08-02 16:07:29 +02:00
|
|
|
case GAS_FORM_ERRORS.MAX_FEE_IMBALANCE:
|
|
|
|
return t('editGasMaxFeePriorityImbalance');
|
2021-08-03 17:54:49 +02:00
|
|
|
case GAS_FORM_ERRORS.GAS_PRICE_TOO_LOW:
|
|
|
|
return t('editGasPriceTooLow');
|
2021-07-20 21:34:32 +02:00
|
|
|
default:
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|