From 9e7c75d06df6d5b27540fbd60352b864be20d3ca Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 29 Jul 2022 19:37:29 -1000 Subject: [PATCH] Bundle optimazation 0 (#14782) * optimism/contracts - import minimal subset * ui helpers - dont import whole of mm controllers * lint fix --- ui/helpers/utils/optimism/fetchEstimatedL1Fee.js | 9 +++++---- ui/helpers/utils/util.js | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/helpers/utils/optimism/fetchEstimatedL1Fee.js b/ui/helpers/utils/optimism/fetchEstimatedL1Fee.js index 2491f0c82..f255ab767 100644 --- a/ui/helpers/utils/optimism/fetchEstimatedL1Fee.js +++ b/ui/helpers/utils/optimism/fetchEstimatedL1Fee.js @@ -1,13 +1,14 @@ import * as ethers from 'ethers'; -import * as optimismContracts from '@eth-optimism/contracts'; +import { getContractFactory } from '@eth-optimism/contracts/dist/contract-defs'; +import { predeploys } from '@eth-optimism/contracts/dist/predeploys'; import buildUnserializedTransaction from './buildUnserializedTransaction'; // The code in this file is largely drawn from https://community.optimism.io/docs/developers/l2/new-fees.html#for-frontend-and-wallet-developers function buildOVMGasPriceOracleContract(eth) { - const OVMGasPriceOracle = optimismContracts - .getContractFactory('OVM_GasPriceOracle') - .attach(optimismContracts.predeploys.OVM_GasPriceOracle); + const OVMGasPriceOracle = getContractFactory('OVM_GasPriceOracle').attach( + predeploys.OVM_GasPriceOracle, + ); const abi = JSON.parse( OVMGasPriceOracle.interface.format(ethers.utils.FormatTypes.json), ); diff --git a/ui/helpers/utils/util.js b/ui/helpers/utils/util.js index c6943c92e..683a34ccd 100644 --- a/ui/helpers/utils/util.js +++ b/ui/helpers/utils/util.js @@ -3,7 +3,7 @@ import abi from 'human-standard-token-abi'; import BigNumber from 'bignumber.js'; import * as ethUtil from 'ethereumjs-util'; import { DateTime } from 'luxon'; -import { util } from '@metamask/controllers'; +import { getFormattedIpfsUrl } from '@metamask/controllers/dist/util'; import slip44 from '@metamask/slip44'; import { addHexPrefix } from '../../../app/scripts/lib/util'; import { @@ -557,7 +557,7 @@ export function getAssetImageURL(image, ipfsGateway) { } if (image.startsWith('ipfs://')) { - return util.getFormattedIpfsUrl(ipfsGateway, image, true); + return getFormattedIpfsUrl(ipfsGateway, image, true); } return image; }