Skip to content

Commit

Permalink
mints: l1fee + value fix (#5162)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylarbarrera authored Oct 27, 2023
1 parent a405721 commit 8224e4c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/screens/mints/MintSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,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);
}
}
});
});
Expand Down

0 comments on commit 8224e4c

Please sign in to comment.