Skip to content

Commit

Permalink
fix: make estimateEOA not required when doing estimations
Browse files Browse the repository at this point in the history
  • Loading branch information
borislav-itskov committed Nov 6, 2024
1 parent c760777 commit 1ea2627
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/libs/estimate/estimateEOA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ export async function estimateEOA(
stateToOverride: getEOAEstimationStateOverride(account.addr)
}
)
.catch(catchEstimationFailure)
.catch((e) => {
console.log('error calling estimateEoa:')
console.log(e)
return [[0n, [], {}]]
})
: deploylessEstimator
.call('getL1GasEstimation', [encodedCallData, FEE_COLLECTOR, optimisticOracle], {
from: blockFrom,
Expand All @@ -120,8 +124,12 @@ export async function estimateEOA(
let gasUsed = 0n
if (!network.rpcNoStateOverride) {
const [gasUsedEstimateGas, [[gasUsedEstimationSol, feeTokenOutcomes, l1GasEstimation]]] = result
feePaymentOptions[0].availableAmount = feeTokenOutcomes[0][1]
feePaymentOptions[0].addedNative = l1GasEstimation.fee
if (feeTokenOutcomes.length && feeTokenOutcomes[0].length) {
feePaymentOptions[0].availableAmount = feeTokenOutcomes[0][1]
}
if (l1GasEstimation && l1GasEstimation.fee) {
feePaymentOptions[0].addedNative = l1GasEstimation.fee
}

// if it's a simple transfer, trust estimateGas as it should be 21K
// if it's a contract call, trust whichever is higher
Expand Down

0 comments on commit 1ea2627

Please sign in to comment.