Skip to content

Commit 674e9a8

Browse files
authored
Merge pull request #1397 from AmbireTech/fix/eoa-batching-no-simulation
Fix/ EOA batching has no simulation
2 parents 845ec46 + 36d175f commit 674e9a8

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/controllers/main/main.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import {
6363
getHumanReadableEstimationError
6464
} from '../../libs/errorHumanizer'
6565
import { insufficientPaymasterFunds } from '../../libs/errorHumanizer/errors'
66-
import { getEstimation, getEstimationSummary } from '../../libs/estimate/estimate'
66+
import { getEstimation } from '../../libs/estimate/estimate'
6767
import { GasRecommendation, getGasPriceRecommendations } from '../../libs/gasPrice/gasPrice'
6868
import { humanizeAccountOp } from '../../libs/humanizer'
6969
import { KeyIterator } from '../../libs/keyIterator/keyIterator'
@@ -767,8 +767,7 @@ export class MainController extends EventEmitter {
767767
const accountOpsForSimulation = getAccountOpsForSimulation(
768768
account,
769769
this.actions.visibleActionsQueue,
770-
network,
771-
accountOp
770+
network
772771
)
773772
// update the portfolio only if new tokens were found through tracing
774773
if (learnedNewTokens || learnedNewNfts) {
@@ -1187,8 +1186,7 @@ export class MainController extends EventEmitter {
11871186
const accountOpsToBeSimulatedByNetwork = getAccountOpsForSimulation(
11881187
this.selectedAccount.account,
11891188
this.actions.visibleActionsQueue,
1190-
networkData,
1191-
this.signAccountOp?.accountOp
1189+
networkData
11921190
)
11931191

11941192
await this.portfolio.updateSelectedAccount(
@@ -2316,8 +2314,7 @@ export class MainController extends EventEmitter {
23162314
const accOpsForSimulation = getAccountOpsForSimulation(
23172315
this.accounts.accounts.find((acc) => acc.addr === op.accountAddr)!,
23182316
this.actions.visibleActionsQueue,
2319-
network,
2320-
op
2317+
network
23212318
)
23222319
return this.portfolio.updateSelectedAccount(
23232320
op.accountAddr,

src/libs/main/main.ts

+5-10
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,17 @@ export const makeAccountOpAction = ({
148148
export const getAccountOpsForSimulation = (
149149
account: Account,
150150
visibleActionsQueue: Action[],
151-
network?: Network,
152-
op?: AccountOp | null
151+
network?: Network
153152
):
154153
| {
155154
[key: string]: AccountOp[]
156155
}
157156
| undefined => {
158157
const isSmart = isSmartAccount(account)
159158

160-
// if there's an op and the account is either smart or the network supports
161-
// state override, we pass it along. We do not support simulation for
162-
// EOAs on networks without state override (but it works for SA)
163-
if (op && (isSmart || (network && !network.rpcNoStateOverride)))
164-
return { [op.chainId.toString()]: [op] }
159+
// Simulation isn't supported by EOAs if the network doesn't support state override
160+
if (!isSmart && (!network || network.rpcNoStateOverride)) return undefined
165161

166-
if (isSmart) return getAccountOpsByNetwork(account.addr, visibleActionsQueue) || undefined
167-
168-
return undefined
162+
// Simulate all account ops for the account
163+
return getAccountOpsByNetwork(account.addr, visibleActionsQueue) || undefined
169164
}

0 commit comments

Comments
 (0)