@aztec/cli-wallet 0.0.1-fake-ceab37513c → 0.0.2-commit.217f559981

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +30 -0
  2. package/dest/bin/index.d.ts +2 -1
  3. package/dest/bin/index.js +39 -23
  4. package/dest/cmds/authorize_action.d.ts +4 -3
  5. package/dest/cmds/authorize_action.d.ts.map +1 -1
  6. package/dest/cmds/authorize_action.js +8 -7
  7. package/dest/cmds/bridge_fee_juice.d.ts +4 -4
  8. package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
  9. package/dest/cmds/bridge_fee_juice.js +9 -7
  10. package/dest/cmds/check_tx.d.ts +5 -3
  11. package/dest/cmds/check_tx.d.ts.map +1 -1
  12. package/dest/cmds/check_tx.js +148 -6
  13. package/dest/cmds/create_account.d.ts +8 -6
  14. package/dest/cmds/create_account.d.ts.map +1 -1
  15. package/dest/cmds/create_account.js +56 -62
  16. package/dest/cmds/create_authwit.d.ts +4 -3
  17. package/dest/cmds/create_authwit.d.ts.map +1 -1
  18. package/dest/cmds/create_authwit.js +6 -6
  19. package/dest/cmds/deploy.d.ts +7 -4
  20. package/dest/cmds/deploy.d.ts.map +1 -1
  21. package/dest/cmds/deploy.js +84 -50
  22. package/dest/cmds/deploy_account.d.ts +6 -8
  23. package/dest/cmds/deploy_account.d.ts.map +1 -1
  24. package/dest/cmds/deploy_account.js +56 -65
  25. package/dest/cmds/import_test_accounts.d.ts +3 -3
  26. package/dest/cmds/import_test_accounts.d.ts.map +1 -1
  27. package/dest/cmds/import_test_accounts.js +6 -9
  28. package/dest/cmds/index.d.ts +3 -3
  29. package/dest/cmds/index.d.ts.map +1 -1
  30. package/dest/cmds/index.js +73 -112
  31. package/dest/cmds/profile.d.ts +7 -4
  32. package/dest/cmds/profile.d.ts.map +1 -1
  33. package/dest/cmds/profile.js +9 -4
  34. package/dest/cmds/register_contract.d.ts +7 -3
  35. package/dest/cmds/register_contract.d.ts.map +1 -1
  36. package/dest/cmds/register_contract.js +5 -6
  37. package/dest/cmds/register_sender.d.ts +4 -3
  38. package/dest/cmds/register_sender.d.ts.map +1 -1
  39. package/dest/cmds/send.d.ts +8 -9
  40. package/dest/cmds/send.d.ts.map +1 -1
  41. package/dest/cmds/send.js +46 -31
  42. package/dest/cmds/simulate.d.ts +7 -4
  43. package/dest/cmds/simulate.d.ts.map +1 -1
  44. package/dest/cmds/simulate.js +12 -7
  45. package/dest/storage/wallet_db.d.ts +6 -16
  46. package/dest/storage/wallet_db.d.ts.map +1 -1
  47. package/dest/storage/wallet_db.js +48 -54
  48. package/dest/utils/authorizations.d.ts +3 -2
  49. package/dest/utils/authorizations.d.ts.map +1 -1
  50. package/dest/utils/authorizations.js +1 -1
  51. package/dest/utils/cli_wallet_and_node_wrapper.d.ts +12 -0
  52. package/dest/utils/cli_wallet_and_node_wrapper.d.ts.map +1 -0
  53. package/dest/utils/cli_wallet_and_node_wrapper.js +25 -0
  54. package/dest/utils/constants.d.ts +4 -0
  55. package/dest/utils/constants.d.ts.map +1 -0
  56. package/dest/utils/constants.js +7 -0
  57. package/dest/utils/ecdsa.d.ts +1 -1
  58. package/dest/utils/options/fees.d.ts +22 -28
  59. package/dest/utils/options/fees.d.ts.map +1 -1
  60. package/dest/utils/options/fees.js +66 -133
  61. package/dest/utils/options/index.d.ts +1 -1
  62. package/dest/utils/options/options.d.ts +3 -2
  63. package/dest/utils/options/options.d.ts.map +1 -1
  64. package/dest/utils/options/options.js +1 -1
  65. package/dest/utils/profiling.d.ts +1 -1
  66. package/dest/utils/profiling.d.ts.map +1 -1
  67. package/dest/utils/profiling.js +9 -1
  68. package/dest/utils/wallet.d.ts +40 -0
  69. package/dest/utils/wallet.d.ts.map +1 -0
  70. package/dest/utils/wallet.js +208 -0
  71. package/package.json +17 -14
  72. package/src/bin/index.ts +39 -31
  73. package/src/cmds/authorize_action.ts +14 -6
  74. package/src/cmds/bridge_fee_juice.ts +15 -11
  75. package/src/cmds/check_tx.ts +180 -5
  76. package/src/cmds/create_account.ts +63 -66
  77. package/src/cmds/create_authwit.ts +9 -5
  78. package/src/cmds/deploy.ts +82 -61
  79. package/src/cmds/deploy_account.ts +62 -64
  80. package/src/cmds/import_test_accounts.ts +7 -11
  81. package/src/cmds/index.ts +120 -206
  82. package/src/cmds/profile.ts +14 -6
  83. package/src/cmds/register_contract.ts +9 -11
  84. package/src/cmds/register_sender.ts +3 -2
  85. package/src/cmds/send.ts +42 -40
  86. package/src/cmds/simulate.ts +17 -12
  87. package/src/storage/wallet_db.ts +52 -67
  88. package/src/utils/authorizations.ts +3 -1
  89. package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
  90. package/src/utils/constants.ts +4 -0
  91. package/src/utils/options/fees.ts +88 -178
  92. package/src/utils/options/options.ts +3 -2
  93. package/src/utils/profiling.ts +15 -1
  94. package/src/utils/wallet.ts +290 -0
  95. package/dest/cmds/cancel_tx.d.ts +0 -11
  96. package/dest/cmds/cancel_tx.d.ts.map +0 -1
  97. package/dest/cmds/cancel_tx.js +0 -43
  98. package/dest/utils/accounts.d.ts +0 -9
  99. package/dest/utils/accounts.d.ts.map +0 -1
  100. package/dest/utils/accounts.js +0 -61
  101. package/dest/utils/pxe_wrapper.d.ts +0 -12
  102. package/dest/utils/pxe_wrapper.d.ts.map +0 -1
  103. package/dest/utils/pxe_wrapper.js +0 -26
  104. package/src/cmds/cancel_tx.ts +0 -66
  105. package/src/utils/accounts.ts +0 -77
  106. package/src/utils/pxe_wrapper.ts +0 -32
@@ -1,67 +1,31 @@
1
- import {
2
- type AccountWallet,
3
- type DeployAccountOptions,
4
- FeeJuicePaymentMethod,
5
- type FeePaymentMethod,
6
- type PXE,
7
- type SendMethodOptions,
8
- } from '@aztec/aztec.js';
9
- import { Fr } from '@aztec/foundation/fields';
1
+ import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
2
+ import type { AztecNode } from '@aztec/aztec.js/node';
3
+ import type { Wallet } from '@aztec/aztec.js/wallet';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
10
5
  import type { LogFn } from '@aztec/foundation/log';
6
+ import type { FieldsOf } from '@aztec/foundation/types';
11
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
8
  import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
9
+ import type { FeeOptions } from '@aztec/wallet-sdk/base-wallet';
13
10
 
14
11
  import { Option } from 'commander';
15
12
 
16
13
  import type { WalletDB } from '../../storage/wallet_db.js';
17
- import { createOrRetrieveAccount } from '../accounts.js';
14
+ import { MIN_FEE_PADDING } from '../constants.js';
18
15
  import { aliasedAddressParser } from './options.js';
19
16
 
20
- export type CliFeeArgs = {
17
+ export type RawCliFeeArgs = {
21
18
  estimateGasOnly: boolean;
22
19
  gasLimits?: string;
23
20
  payment?: string;
24
21
  maxFeesPerGas?: string;
25
22
  maxPriorityFeesPerGas?: string;
26
- estimateGas?: boolean;
27
23
  };
28
24
 
29
- export interface IFeeOpts {
30
- estimateOnly: boolean;
31
- gasSettings: GasSettings;
32
- toSendOpts(sender: AccountWallet): Promise<SendMethodOptions>;
33
- toDeployAccountOpts(sender: AccountWallet): Promise<DeployAccountOptions>;
34
- }
35
-
36
- export function printGasEstimates(
37
- feeOpts: IFeeOpts,
38
- gasEstimates: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>,
39
- log: LogFn,
40
- ) {
41
- log(`Estimated gas usage: ${formatGasEstimate(gasEstimates)}`);
42
- log(`Maximum total tx fee: ${getEstimatedCost(gasEstimates, feeOpts.gasSettings.maxFeesPerGas)}`);
43
- }
44
-
45
- function formatGasEstimate(estimate: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>) {
46
- return `da=${estimate.gasLimits.daGas},l2=${estimate.gasLimits.l2Gas},teardownDA=${estimate.teardownGasLimits.daGas},teardownL2=${estimate.teardownGasLimits.l2Gas}`;
47
- }
48
-
49
- function getEstimatedCost(estimate: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>, maxFeesPerGas: GasFees) {
50
- return GasSettings.default({ ...estimate, maxFeesPerGas })
51
- .getFeeLimit()
52
- .toBigInt();
53
- }
54
-
55
- async function parseGasSettings(args: CliFeeArgs, pxe: PXE) {
56
- const gasLimits = args.gasLimits ? parseGasLimits(args.gasLimits) : {};
57
- const maxFeesPerGas = args.maxFeesPerGas ? parseGasFees(args.maxFeesPerGas) : await pxe.getCurrentBaseFees();
58
- const maxPriorityFeesPerGas = args.maxPriorityFeesPerGas ? parseGasFees(args.maxPriorityFeesPerGas) : undefined;
59
- return GasSettings.default({
60
- ...gasLimits,
61
- maxFeesPerGas,
62
- maxPriorityFeesPerGas,
63
- });
64
- }
25
+ export type ParsedFeeOptions = {
26
+ paymentMethod?: FeePaymentMethod;
27
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
28
+ };
65
29
 
66
30
  type OptionParams = {
67
31
  [key: string]: { type: string; description?: string; default?: string };
@@ -84,15 +48,13 @@ function printOptionParams(params: OptionParams) {
84
48
  : '';
85
49
  }
86
50
 
87
- function getFeePaymentMethodParams(allowCustomFeePayer: boolean): OptionParams {
88
- const feePayer = allowCustomFeePayer ? { type: 'address', description: 'The account paying the fee.' } : undefined;
51
+ function getFeePaymentMethodParams(): OptionParams {
89
52
  return {
90
53
  method: {
91
54
  type: 'name',
92
55
  description: 'Valid values: "fee_juice", "fpc-public", "fpc-private", "fpc-sponsored"',
93
56
  default: 'fee_juice',
94
57
  },
95
- ...(feePayer ? { feePayer } : {}),
96
58
  asset: {
97
59
  type: 'address',
98
60
  description: 'The asset used for fee payment. Required for "fpc-public" and "fpc-private".',
@@ -117,144 +79,43 @@ function getFeePaymentMethodParams(allowCustomFeePayer: boolean): OptionParams {
117
79
  type: 'bigint',
118
80
  description: 'The index of the claim in the l1toL2Message tree.',
119
81
  },
120
- feeRecipient: {
121
- type: 'string',
122
- description: 'Recipient of the fee.',
123
- },
124
82
  };
125
83
  }
126
84
 
127
- function getPaymentMethodOption(allowCustomFeePayer: boolean) {
128
- const params = getFeePaymentMethodParams(allowCustomFeePayer);
85
+ export function getPaymentMethodOption() {
86
+ const params = getFeePaymentMethodParams();
129
87
  return new Option(`--payment <options>`, `Fee payment method and arguments.${printOptionParams(params)}`);
130
88
  }
131
89
 
132
- function getFeeOptions(allowCustomFeePayer: boolean) {
90
+ function getFeeOptions() {
133
91
  return [
134
- getPaymentMethodOption(allowCustomFeePayer),
92
+ getPaymentMethodOption(),
135
93
  new Option('--gas-limits <da=100,l2=100,teardownDA=10,teardownL2=10>', 'Gas limits for the tx.'),
136
94
  new Option('--max-fees-per-gas <da=100,l2=100>', 'Maximum fees per gas unit for DA and L2 computation.'),
137
95
  new Option(
138
96
  '--max-priority-fees-per-gas <da=0,l2=0>',
139
97
  'Maximum priority fees per gas unit for DA and L2 computation.',
140
98
  ),
141
- new Option('--estimate-gas', 'Whether to automatically estimate gas limits for the tx.'),
142
99
  new Option('--estimate-gas-only', 'Only report gas estimation for the tx, do not send it.'),
143
100
  ];
144
101
  }
145
102
 
146
- export class FeeOpts implements IFeeOpts {
147
- constructor(
148
- public estimateOnly: boolean,
149
- public gasSettings: GasSettings,
150
- private paymentMethodFactory: (sender: AccountWallet) => Promise<FeePaymentMethod>,
151
- private getDeployWallet: (
152
- sender: AccountWallet,
153
- paymentMethod: FeePaymentMethod,
154
- ) => Promise<AccountWallet | undefined>,
155
- private estimateGas: boolean,
156
- ) {}
157
-
158
- async toSendOpts(sender: AccountWallet): Promise<SendMethodOptions> {
159
- return {
160
- from: sender.getAddress(),
161
- fee: {
162
- estimateGas: this.estimateGas,
163
- gasSettings: this.gasSettings,
164
- paymentMethod: await this.paymentMethodFactory(sender),
165
- },
166
- };
167
- }
168
-
169
- async toDeployAccountOpts(sender: AccountWallet): Promise<DeployAccountOptions> {
170
- const paymentMethod = await this.paymentMethodFactory(sender);
171
- const deployWallet = await this.getDeployWallet(sender, paymentMethod);
172
- return {
173
- deployWallet,
174
- fee: {
175
- estimateGas: this.estimateGas,
176
- gasSettings: this.gasSettings,
177
- paymentMethod,
178
- },
179
- };
180
- }
181
-
182
- static paymentMethodOption() {
183
- return getPaymentMethodOption(false);
184
- }
185
-
186
- static getOptions() {
187
- return getFeeOptions(false);
188
- }
189
-
190
- static async fromCli(args: CliFeeArgs, pxe: PXE, log: LogFn, db?: WalletDB) {
191
- const estimateOnly = args.estimateGasOnly;
192
- const gasSettings = await parseGasSettings(args, pxe);
193
-
194
- const defaultPaymentMethod = async (sender: AccountWallet) => {
195
- const { FeeJuicePaymentMethod } = await import('@aztec/aztec.js/fee');
196
- return new FeeJuicePaymentMethod(sender.getAddress());
197
- };
198
-
199
- const getDeployWallet = () => {
200
- // Returns undefined. The sender's wallet will be used by default.
201
- return Promise.resolve(undefined);
202
- };
203
-
204
- return new FeeOpts(
205
- estimateOnly,
206
- gasSettings,
207
- args.payment ? parsePaymentMethod(args.payment, false, log, db) : defaultPaymentMethod,
208
- getDeployWallet,
209
- !!args.estimateGas,
210
- );
211
- }
212
- }
213
-
214
- export class FeeOptsWithFeePayer extends FeeOpts {
215
- static override paymentMethodOption() {
216
- return getPaymentMethodOption(true);
217
- }
218
-
219
- static override getOptions() {
220
- return getFeeOptions(true);
221
- }
222
-
223
- static override async fromCli(args: CliFeeArgs, pxe: PXE, log: LogFn, db?: WalletDB) {
224
- const estimateOnly = args.estimateGasOnly;
225
- const gasSettings = await parseGasSettings(args, pxe);
226
-
227
- const defaultPaymentMethod = async (sender: AccountWallet) => {
228
- const { FeeJuicePaymentMethod } = await import('@aztec/aztec.js/fee');
229
- return new FeeJuicePaymentMethod(sender.getAddress());
230
- };
231
-
232
- const getDeployWallet = async (sender: AccountWallet, paymentMethod: FeePaymentMethod) => {
233
- if (paymentMethod instanceof FeeJuicePaymentMethod) {
234
- const feePayer = await paymentMethod.getFeePayer();
235
- if (!sender.getAddress().equals(feePayer)) {
236
- return (await createOrRetrieveAccount(pxe, feePayer, db)).getWallet();
237
- }
238
- }
239
- return undefined;
240
- };
241
-
242
- return new FeeOptsWithFeePayer(
243
- estimateOnly,
244
- gasSettings,
245
- args.payment ? parsePaymentMethod(args.payment, true, log, db) : defaultPaymentMethod,
246
- getDeployWallet,
247
- !!args.estimateGas,
248
- );
249
- }
103
+ function parseGasSettings(args: RawCliFeeArgs): Partial<FieldsOf<GasSettings>> {
104
+ const gasLimits = args.gasLimits ? parseGasLimits(args.gasLimits) : {};
105
+ const maxFeesPerGas = args.maxFeesPerGas ? parseGasFees(args.maxFeesPerGas) : undefined;
106
+ const maxPriorityFeesPerGas = args.maxPriorityFeesPerGas ? parseGasFees(args.maxPriorityFeesPerGas) : undefined;
107
+ return {
108
+ ...gasLimits,
109
+ maxFeesPerGas,
110
+ maxPriorityFeesPerGas,
111
+ };
250
112
  }
251
113
 
252
114
  export function parsePaymentMethod(
253
115
  payment: string,
254
- allowCustomFeePayer: boolean,
255
116
  log: LogFn,
256
117
  db?: WalletDB,
257
- ): (sender: AccountWallet) => Promise<FeePaymentMethod> {
118
+ ): (wallet: Wallet, from: AztecAddress, gasSettings: GasSettings) => Promise<FeePaymentMethod | undefined> {
258
119
  const parsed = payment.split(',').reduce(
259
120
  (acc, item) => {
260
121
  const [dimension, value] = item.split('=');
@@ -278,7 +139,7 @@ export function parsePaymentMethod(
278
139
  return AztecAddress.fromString(parsed.asset);
279
140
  };
280
141
 
281
- return async (sender: AccountWallet) => {
142
+ return async (wallet: Wallet, from: AztecAddress, gasSettings: GasSettings) => {
282
143
  switch (parsed.method) {
283
144
  case 'fee_juice': {
284
145
  if (parsed.claim || (parsed.claimSecret && parsed.claimAmount && parsed.messageLeafIndex)) {
@@ -288,13 +149,13 @@ export function parsePaymentMethod(
288
149
  amount: claimAmount,
289
150
  secret: claimSecret,
290
151
  leafIndex: messageLeafIndex,
291
- } = await db.popBridgedFeeJuice(sender.getAddress(), log));
152
+ } = await db.popBridgedFeeJuice(from, log));
292
153
  } else {
293
154
  ({ claimAmount, claimSecret, messageLeafIndex } = parsed);
294
155
  }
295
156
  log(`Using Fee Juice for fee payments with claim for ${claimAmount} tokens`);
296
157
  const { FeeJuicePaymentMethodWithClaim } = await import('@aztec/aztec.js/fee');
297
- return new FeeJuicePaymentMethodWithClaim(sender, {
158
+ return new FeeJuicePaymentMethodWithClaim(from, {
298
159
  claimAmount: (typeof claimAmount === 'string'
299
160
  ? Fr.fromHexString(claimAmount)
300
161
  : new Fr(claimAmount)
@@ -303,13 +164,8 @@ export function parsePaymentMethod(
303
164
  messageLeafIndex: BigInt(messageLeafIndex),
304
165
  });
305
166
  } else {
306
- log(`Using Fee Juice for fee payment`);
307
- const { FeeJuicePaymentMethod } = await import('@aztec/aztec.js/fee');
308
- const feePayer =
309
- parsed.feePayer && allowCustomFeePayer
310
- ? aliasedAddressParser('accounts', parsed.feePayer, db)
311
- : sender.getAddress();
312
- return new FeeJuicePaymentMethod(feePayer);
167
+ log(`Using Fee Juice for fee payment with the balance of account ${from}`);
168
+ return;
313
169
  }
314
170
  }
315
171
  case 'fpc-public': {
@@ -317,14 +173,14 @@ export function parsePaymentMethod(
317
173
  const asset = getAsset();
318
174
  log(`Using public fee payment with asset ${asset} via paymaster ${fpc}`);
319
175
  const { PublicFeePaymentMethod } = await import('@aztec/aztec.js/fee');
320
- return new PublicFeePaymentMethod(fpc, sender);
176
+ return new PublicFeePaymentMethod(fpc, from, wallet, gasSettings);
321
177
  }
322
178
  case 'fpc-private': {
323
179
  const fpc = getFpc();
324
180
  const asset = getAsset();
325
181
  log(`Using private fee payment with asset ${asset} via paymaster ${fpc}`);
326
182
  const { PrivateFeePaymentMethod } = await import('@aztec/aztec.js/fee');
327
- return new PrivateFeePaymentMethod(fpc, sender);
183
+ return new PrivateFeePaymentMethod(fpc, from, wallet, gasSettings);
328
184
  }
329
185
  case 'fpc-sponsored': {
330
186
  const sponsor = getFpc();
@@ -382,3 +238,57 @@ export function parseGasFees(gasFees: string): GasFees {
382
238
 
383
239
  return new GasFees(parsed.da, parsed.l2);
384
240
  }
241
+ export class CLIFeeArgs {
242
+ constructor(
243
+ public estimateOnly: boolean,
244
+ private paymentMethod: (
245
+ wallet: Wallet,
246
+ feePayer: AztecAddress,
247
+ gasSettings: GasSettings,
248
+ ) => Promise<FeePaymentMethod | undefined>,
249
+ private gasSettings: Partial<FieldsOf<GasSettings>>,
250
+ ) {}
251
+
252
+ async toUserFeeOptions(node: AztecNode, wallet: Wallet, from: AztecAddress): Promise<ParsedFeeOptions> {
253
+ const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1 + MIN_FEE_PADDING);
254
+ const gasSettings = GasSettings.default({ ...this.gasSettings, maxFeesPerGas });
255
+ const paymentMethod = await this.paymentMethod(wallet, from, gasSettings);
256
+ return {
257
+ paymentMethod,
258
+ gasSettings,
259
+ };
260
+ }
261
+
262
+ static parse(args: RawCliFeeArgs, log: LogFn, db?: WalletDB): CLIFeeArgs {
263
+ return new CLIFeeArgs(
264
+ !!args.estimateGasOnly,
265
+ parsePaymentMethod(args.payment ?? 'method=fee_juice', log, db),
266
+ parseGasSettings(args),
267
+ );
268
+ }
269
+
270
+ static getOptions() {
271
+ return getFeeOptions();
272
+ }
273
+ }
274
+
275
+ // Printing
276
+
277
+ export function printGasEstimates(
278
+ feeOpts: FeeOptions,
279
+ gasEstimates: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>,
280
+ log: LogFn,
281
+ ) {
282
+ log(`Estimated gas usage: ${formatGasEstimate(gasEstimates)}`);
283
+ log(`Maximum total tx fee: ${getEstimatedCost(gasEstimates, feeOpts.gasSettings.maxFeesPerGas)}`);
284
+ }
285
+
286
+ function formatGasEstimate(estimate: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>) {
287
+ return `da=${estimate.gasLimits.daGas},l2=${estimate.gasLimits.l2Gas},teardownDA=${estimate.teardownGasLimits.daGas},teardownL2=${estimate.teardownGasLimits.l2Gas}`;
288
+ }
289
+
290
+ function getEstimatedCost(estimate: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>, maxFeesPerGas: GasFees) {
291
+ return GasSettings.default({ ...estimate, maxFeesPerGas })
292
+ .getFeeLimit()
293
+ .toBigInt();
294
+ }
@@ -1,3 +1,4 @@
1
+ import { TxHash } from '@aztec/aztec.js/tx';
1
2
  import { parseAztecAddress, parseSecretKey, parseTxHash } from '@aztec/cli/utils';
2
3
  import { AuthWitness } from '@aztec/stdlib/auth-witness';
3
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -6,7 +7,7 @@ import { Option } from 'commander';
6
7
  import { readdir, stat } from 'fs/promises';
7
8
 
8
9
  import type { AliasType, WalletDB } from '../../storage/wallet_db.js';
9
- import { AccountTypes } from '../accounts.js';
10
+ import { AccountTypes } from '../constants.js';
10
11
 
11
12
  const TARGET_DIR = 'target';
12
13
 
@@ -29,7 +30,7 @@ export function integerArgParser(
29
30
  return parsed;
30
31
  }
31
32
 
32
- export function aliasedTxHashParser(txHash: string, db?: WalletDB) {
33
+ export function aliasedTxHashParser(txHash: string, db?: WalletDB): TxHash {
33
34
  try {
34
35
  return parseTxHash(txHash);
35
36
  } catch {
@@ -95,7 +95,7 @@ export function printProfileResult(
95
95
 
96
96
  if (stats.nodeRPCCalls) {
97
97
  log(format('\nRPC calls:\n'));
98
- for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)) {
98
+ for (const [method, { times }] of Object.entries(stats.nodeRPCCalls.perMethod)) {
99
99
  const calls = times.length;
100
100
  const total = times.reduce((acc, time) => acc + time, 0);
101
101
  const avg = total / calls;
@@ -112,6 +112,20 @@ export function printProfileResult(
112
112
  ),
113
113
  );
114
114
  }
115
+
116
+ const { roundTrips } = stats.nodeRPCCalls;
117
+ log(format('\nRound trips (actual blocking waits):\n'));
118
+ log(format('Round trips:'.padEnd(25), `${roundTrips.roundTrips}`.padStart(COLUMN_MAX_WIDTH)));
119
+ log(
120
+ format(
121
+ 'Total blocking time:'.padEnd(25),
122
+ `${roundTrips.totalBlockingTime.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
123
+ ),
124
+ );
125
+ if (roundTrips.roundTrips > 0) {
126
+ const avgRoundTrip = roundTrips.totalBlockingTime / roundTrips.roundTrips;
127
+ log(format('Avg round trip:'.padEnd(25), `${avgRoundTrip.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
128
+ }
115
129
  }
116
130
 
117
131
  log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));