on master help sign in
devex: cleanup

Move formatWait function to where it's actually used. Addresses PR feedback.

commit788cba340ffa10dc0ae548231d4244e0c6921af9 authortomholford <tomholford@users.noreply.github.com> dateMon 12 Dec 2022, 15:10 (4 years ago) parent2cab269
2 files changed+3−3
src/components/L2/Dropdowns/FeeDropdown.tsx−2 src/lib/getSuggestedGasPrice.js+3−1
src/components/L2/Dropdowns/FeeDropdown.tsx−2
@@ -17,8 +17,6 @@ export interface GasPriceData {
1717 suggestedBaseFeePerGas: number;
1818}
1919
20−// Convert seconds to minutes prettily
21−export const formatWait = (wait: number) => Math.round((wait * 100) / 60) / 100;
2220export const formatDisplay = ({ price, wait }: GasPriceData) =>
2321 `${price} gwei (${wait} min)`;
2422
src/lib/getSuggestedGasPrice.js+3−1
@@ -1,6 +1,5 @@
11import { NETWORK_TYPES } from './network';
22import { DEFAULT_GAS_PRICE_GWEI, MAX_GAS_PRICE_GWEI } from './constants';
3−import { formatWait } from 'components/L2/Dropdowns/FeeDropdown';
43import Web3 from 'web3';
54
65// ethgasstation returns values in floating point, one order of magitude
@@ -14,6 +13,9 @@ const feeToWei = (fee) => Web3.utils.toHex(Web3.utils.toWei(String(fee), 'gwei'
1413
1514const calculateMaxFee = (baseFee, maxPriorityFee) => feeToWei(Math.round((2 * baseFee) + maxPriorityFee))
1615
16+// Convert seconds to minutes prettily
17+const formatWait = (wait) => Math.round((wait * 100) / 60) / 100;
18+
1719export const defaultGasValues = value => ({
1820 fast: {
1921 price: value,