1
0
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:
David Walsh 2021-08-04 16:17:20 -05:00 committed by GitHub
parent f0daa28fac
commit aa3d1f2341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import BigNumber from 'bignumber.js';
import { GAS_ESTIMATE_TYPES } from '../../../../shared/constants/gas';
@ -61,7 +62,11 @@ export default function GasTiming({
(priority && priority !== previousMaxPriorityFeePerGas) ||
(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) {
setCustomEstimatedTime(result);
}