@@ -43,13 +43,13 @@ export interface EstimateBatchGasOptions {
4343
4444/**
4545 * Estimate gas cost for a batch transaction
46- *
46+ *
4747 * Use this to get cost estimate before prompting user for confirmation.
4848 * Note: This provides a conservative estimate since batch transactions
4949 * through EIP-7702 can have variable costs.
5050 */
5151export async function estimateBatchGas (
52- options : EstimateBatchGasOptions ,
52+ options : EstimateBatchGasOptions
5353) : Promise < GasEstimate > {
5454 const { publicClient, executions } = options ;
5555
@@ -60,8 +60,8 @@ export async function estimateBatchGas(
6060 // Each execution adds ~50k gas, plus base cost of ~100k for the delegator call
6161 const baseGas = 100000n ;
6262 const perExecutionGas = 50000n ;
63- const estimatedGas = baseGas + ( BigInt ( executions . length ) * perExecutionGas ) ;
64-
63+ const estimatedGas = baseGas + BigInt ( executions . length ) * perExecutionGas ;
64+
6565 // Add 20% buffer for safety
6666 const gasLimit = ( estimatedGas * 120n ) / 100n ;
6767
@@ -89,14 +89,11 @@ export interface ExecuteBatchOptions {
8989 callData : Hex ;
9090 } > ;
9191 pendingMessage : string ;
92- < < << << < HEAD
93- privateKey ?: Hex ; // Private key for signing raw hash (required for authorization signing)
9492 /** Optional gas params from estimation */
9593 gas ?: {
9694 maxFeePerGas ?: bigint ;
9795 maxPriorityFeePerGas ?: bigint ;
9896 } ;
99- === === =
10097 /**
10198 * Private key for signing authorization (CLI mode).
10299 * If not provided, walletClient.signAuthorization() will be used (wallet client mode).
@@ -108,7 +105,6 @@ export interface ExecuteBatchOptions {
108105 * where the private key is not directly accessible.
109106 */
110107 useWalletClientSigning ?: boolean ;
111- > >>> >>> 12 f912b ( feat : add support for external signer instead of private key )
112108}
113109
114110/**
@@ -149,11 +145,8 @@ export async function executeBatch(
149145 executions,
150146 pendingMessage,
151147 privateKey,
152- < << << << HEAD
153148 gas,
154- = === ===
155149 useWalletClientSigning = false ,
156- > >>> >>> 12 f912b ( feat : add support for external signer instead of private key )
157150 } = options ;
158151
159152 const account = walletClient . account ;
@@ -286,26 +279,7 @@ export async function executeBatch(
286279 }
287280 }
288281
289- < < < << << HEAD
290282 // 5. Show pending message
291- = === ===
292- // 5. Send transaction using viem
293- if ( needsConfirmation ) {
294- try {
295- const fees = await publicClient . estimateFeesPerGas ( ) ;
296- const estimatedGas = 2000000n ;
297- const maxCostWei = estimatedGas * fees . maxFeePerGas ;
298- const costEth = formatETH ( maxCostWei ) ;
299- logger . info (
300- `${ confirmationPrompt } on ${ environmentConfig . name } (estimated max cost: ${ costEth } ETH)`
301- ) ;
302- // TODO: Add confirmation prompt
303- } catch ( error ) {
304- logger . warn ( `Could not estimate cost for confirmation: ${error } `) ;
305- }
306- }
307-
308- >>> >>> > 12 f912b ( feat : add support for external signer instead of private key )
309283 if ( pendingMessage ) {
310284 logger . info ( pendingMessage ) ;
311285 }
@@ -364,4 +338,4 @@ export async function executeBatch(
364338 }
365339
366340 return hash ;
367- }
341+ }
0 commit comments