|
1 | 1 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ |
2 | | -import { BigNumber, ethers, providers } from "ethers"; |
| 2 | +import { BigNumber, BigNumberish, ethers, providers } from "ethers"; |
3 | 3 | import { NetworkName } from "types/lib"; |
4 | 4 | import { EntryPoint__factory } from "types/lib/executor/contracts/factories"; |
5 | 5 | import { EntryPoint } from "types/lib/executor/contracts/EntryPoint"; |
6 | 6 | import { Mutex } from "async-mutex"; |
7 | 7 | import { SendBundleReturn } from "types/lib/executor"; |
8 | 8 | import { IMulticall3__factory } from "types/lib/executor/contracts/factories/IMulticall3__factory"; |
| 9 | +import { chainsWithoutEIP1559 } from "params/lib"; |
9 | 10 | import { getAddr } from "../utils"; |
10 | 11 | import { MempoolEntry } from "../entities/MempoolEntry"; |
11 | 12 | import { ReputationStatus } from "../entities/interfaces"; |
@@ -71,27 +72,27 @@ export class BundlingService { |
71 | 72 | "handleOps", |
72 | 73 | [bundle.map((entry) => entry.userOp), beneficiary] |
73 | 74 | ); |
74 | | - this.logger.debug( |
75 | | - JSON.stringify( |
76 | | - { |
77 | | - to: entryPoint, |
78 | | - data: txRequest, |
79 | | - type: 2, |
80 | | - maxPriorityFeePerGas: gasFee.maxPriorityFeePerGas ?? 0, |
81 | | - maxFeePerGas: gasFee.maxFeePerGas ?? 0, |
82 | | - }, |
83 | | - undefined, |
84 | | - 2 |
85 | | - ) |
86 | | - ); |
87 | 75 |
|
88 | | - const gasLimit = await this.estimateBundleGas(bundle); |
89 | | - const tx = await wallet.sendTransaction({ |
| 76 | + const transaction = { |
90 | 77 | to: entryPoint, |
91 | 78 | data: txRequest, |
92 | 79 | type: 2, |
93 | | - maxPriorityFeePerGas: gasFee.maxPriorityFeePerGas ?? 0, |
94 | | - maxFeePerGas: gasFee.maxFeePerGas ?? 0, |
| 80 | + maxPriorityFeePerGas: gasFee.maxPriorityFeePerGas, |
| 81 | + maxFeePerGas: gasFee.maxFeePerGas, |
| 82 | + gasPrice: undefined as BigNumberish | undefined, |
| 83 | + }; |
| 84 | + if (chainsWithoutEIP1559.some((network) => network === this.network)) { |
| 85 | + transaction.type = 1; |
| 86 | + transaction.gasPrice = gasFee.gasPrice; |
| 87 | + delete transaction.maxPriorityFeePerGas; |
| 88 | + delete transaction.maxFeePerGas; |
| 89 | + } |
| 90 | + |
| 91 | + this.logger.debug(JSON.stringify(transaction, undefined, 2)); |
| 92 | + |
| 93 | + const gasLimit = await this.estimateBundleGas(bundle); |
| 94 | + const tx = await wallet.sendTransaction({ |
| 95 | + ...transaction, |
95 | 96 | gasLimit, |
96 | 97 | }); |
97 | 98 |
|
|
0 commit comments