Skip to content

Commit

Permalink
chore: finally put in right spot
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Sep 11, 2024
1 parent b129227 commit 9910e85
Showing 1 changed file with 49 additions and 19 deletions.
68 changes: 49 additions & 19 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,35 +655,65 @@ export class Executor {

let transactionHash: HexData32
try {
const isLegacyTransaction = this.legacyTransactions
const userOps = opsWithHashToBundle.map((owh) =>
isUserOpVersion06
? owh.mempoolUserOperation
: toPackedUserOperation(
owh.mempoolUserOperation as UserOperationV07
)
) as PackedUserOperation[]

const gasOptions = isLegacyTransaction
? { gasPrice: gasPriceParameters.maxFeePerGas }
: {
maxFeePerGas: gasPriceParameters.maxFeePerGas,
maxPriorityFeePerGas:
gasPriceParameters.maxPriorityFeePerGas
}
let authorizationList: Authorization[] | undefined = undefined
for (const compressedOp of userOps) {
const key = `${compressedOp.sender}:${compressedOp.nonce}:${compressedOp.callData}`
const opAuthorizationList = userOperation7702.get(key)
// if ("authorizationList" in compressedOp.inflatedOp) {
// const opAuthorizationList = compressedOp.inflatedOp.authorizationList
if (opAuthorizationList) {
if (authorizationList !== undefined) {
authorizationList.push(...opAuthorizationList)
} else {
authorizationList = opAuthorizationList
}
}
// }
}

if (authorizationList && this.legacyTransactions) {
throw new Error("AuthorizationList is not supported for legacy transactions")
}
const newGasOptions = {
maxFeePerGas: gasPriceParameters.maxFeePerGas,
maxPriorityFeePerGas:
gasPriceParameters.maxPriorityFeePerGas
}
const gasOptions = this.legacyTransactions
? {
gasPrice: gasPriceParameters.maxFeePerGas
}
: newGasOptions

const opts = {
account: wallet,
gas: gasLimit,
nonce: nonce,
...gasOptions
nonce: nonce
}

const userOps = opsWithHashToBundle.map((owh) =>
isUserOpVersion06
? owh.mempoolUserOperation
: toPackedUserOperation(
owh.mempoolUserOperation as UserOperationV07
)
) as PackedUserOperation[]
const sendTransactionParams = authorizationList
? {
...opts,
...newGasOptions,
authorizationList
}
: {
...opts,
...gasOptions
}

console.log("DOexecute: userOps: " + JSON.stringify(userOps) + " opts: " + JSON.stringify(opts))
console.log("DOexecute: userOps: " + JSON.stringify(userOps) + " opts: " + JSON.stringify(sendTransactionParams))
transactionHash = await ep.write.handleOps(
[userOps, wallet.address],
opts
sendTransactionParams
)

opsWithHashToBundle.map(({ userOperationHash }) => {
Expand Down

0 comments on commit 9910e85

Please sign in to comment.