@@ -115,6 +115,7 @@ export function parsePaymentMethod(
115115 payment : string ,
116116 log : LogFn ,
117117 db ?: WalletDB ,
118+ estimateOnly ?: boolean ,
118119) : ( wallet : Wallet , from : AztecAddress , gasSettings : GasSettings ) => Promise < FeePaymentMethod | undefined > {
119120 const parsed = payment . split ( ',' ) . reduce (
120121 ( acc , item ) => {
@@ -149,7 +150,7 @@ export function parsePaymentMethod(
149150 amount : claimAmount ,
150151 secret : claimSecret ,
151152 leafIndex : messageLeafIndex ,
152- } = await db . popBridgedFeeJuice ( from , log ) ) ;
153+ } = estimateOnly ? await db . peekBridgedFeeJuice ( from , log ) : await db . popBridgedFeeJuice ( from , log ) ) ;
153154 } else {
154155 ( { claimAmount, claimSecret, messageLeafIndex } = parsed ) ;
155156 }
@@ -266,9 +267,10 @@ export class CLIFeeArgs {
266267 }
267268
268269 static parse ( args : RawCliFeeArgs , log : LogFn , db ?: WalletDB ) : CLIFeeArgs {
270+ const estimateOnly = ! ! args . estimateGasOnly ;
269271 return new CLIFeeArgs (
270- ! ! args . estimateGasOnly ,
271- parsePaymentMethod ( args . payment ?? 'method=fee_juice' , log , db ) ,
272+ estimateOnly ,
273+ parsePaymentMethod ( args . payment ?? 'method=fee_juice' , log , db , estimateOnly ) ,
272274 parseGasSettings ( args ) ,
273275 ) ;
274276 }
0 commit comments