From 7a4be6061a1b64b8101209a961d302da93722f66 Mon Sep 17 00:00:00 2001 From: skylarbarrera Date: Thu, 26 Oct 2023 10:02:57 -0400 Subject: [PATCH] mints: l1fee + value fix --- src/screens/mints/MintSheet.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/screens/mints/MintSheet.tsx b/src/screens/mints/MintSheet.tsx index 1682a368b15..fc56141c662 100644 --- a/src/screens/mints/MintSheet.tsx +++ b/src/screens/mints/MintSheet.tsx @@ -334,18 +334,35 @@ const MintSheet = () => { return; } step.items?.forEach(async item => { + const value = multiply( + mintCollection.publicMintInfo?.price?.amount?.raw || '0', + quantity + ); // could add safety here if unable to calc gas limit const tx = { to: item.data?.to, from: item.data?.from, data: item.data?.data, - value: multiply(price.amount || '0', quantity), + value, }; const gas = await estimateGas(tx, provider); + + let l1GasFeeOptimism = null; + // add l1Fee for OP Chains + if (getNetworkObj(currentNetwork).gas.OptimismTxFee) { + l1GasFeeOptimism = await ethereumUtils.calculateL1FeeOptimism( + tx, + provider + ); + } if (gas) { setGasError(false); - updateTxFee(gas, null); + if (l1GasFeeOptimism) { + updateTxFee(gas, null, l1GasFeeOptimism); + } else { + updateTxFee(gas, null); + } } }); });