mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
EIP-1559 - Prevent uncaught exception when passing fees to getGasFeeTimeEstimate (#11759)
This commit is contained in:
parent
f0daa28fac
commit
aa3d1f2341
@ -1,6 +1,7 @@
|
|||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useContext, useEffect, useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
import { GAS_ESTIMATE_TYPES } from '../../../../shared/constants/gas';
|
import { GAS_ESTIMATE_TYPES } from '../../../../shared/constants/gas';
|
||||||
|
|
||||||
@ -61,7 +62,11 @@ export default function GasTiming({
|
|||||||
(priority && priority !== previousMaxPriorityFeePerGas) ||
|
(priority && priority !== previousMaxPriorityFeePerGas) ||
|
||||||
(fee && fee !== previousMaxFeePerGas)
|
(fee && fee !== previousMaxFeePerGas)
|
||||||
) {
|
) {
|
||||||
getGasFeeTimeEstimate(priority, fee).then((result) => {
|
// getGasFeeTimeEstimate requires parameters in string format
|
||||||
|
getGasFeeTimeEstimate(
|
||||||
|
new BigNumber(priority).toString(10),
|
||||||
|
new BigNumber(fee).toString(10),
|
||||||
|
).then((result) => {
|
||||||
if (maxFeePerGas === fee && maxPriorityFeePerGas === priority) {
|
if (maxFeePerGas === fee && maxPriorityFeePerGas === priority) {
|
||||||
setCustomEstimatedTime(result);
|
setCustomEstimatedTime(result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user