Skip to content

Commit

Permalink
Merge pull request #1078 from AmbireTech/fix/estimateEoa-not-required
Browse files Browse the repository at this point in the history
Make estimateEOA not required
  • Loading branch information
borislav-itskov authored Nov 7, 2024
2 parents 86df3d8 + 1ea2627 commit ecdae4b
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 ecdae4b

Please sign in to comment.