@aztec/cli 0.0.1-commit.f2ce05ee → 0.0.1-commit.f5a9928

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 (83) hide show
  1. package/dest/cmds/aztec_node/block_number.js +1 -1
  2. package/dest/cmds/aztec_node/get_logs.d.ts +30 -4
  3. package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
  4. package/dest/cmds/aztec_node/get_logs.js +39 -29
  5. package/dest/cmds/aztec_node/get_node_info.d.ts +1 -1
  6. package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -1
  7. package/dest/cmds/aztec_node/get_node_info.js +0 -2
  8. package/dest/cmds/aztec_node/index.d.ts +1 -1
  9. package/dest/cmds/aztec_node/index.d.ts.map +1 -1
  10. package/dest/cmds/aztec_node/index.js +13 -3
  11. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  12. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  13. package/dest/cmds/infrastructure/setup_l2_contract.js +12 -7
  14. package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +1 -1
  15. package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -1
  16. package/dest/cmds/l1/deploy_l1_contracts_cmd.js +0 -1
  17. package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
  18. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  19. package/dest/cmds/l1/deploy_new_rollup.js +2 -4
  20. package/dest/cmds/l1/update_l1_validators.d.ts +1 -1
  21. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  22. package/dest/cmds/l1/update_l1_validators.js +5 -6
  23. package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts +2 -0
  24. package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts.map +1 -0
  25. package/dest/cmds/validator_keys/eth_json_v3_worker.js +27 -0
  26. package/dest/cmds/validator_keys/index.d.ts +1 -1
  27. package/dest/cmds/validator_keys/index.d.ts.map +1 -1
  28. package/dest/cmds/validator_keys/index.js +7 -6
  29. package/dest/cmds/validator_keys/new.d.ts +7 -1
  30. package/dest/cmds/validator_keys/new.d.ts.map +1 -1
  31. package/dest/cmds/validator_keys/new.js +98 -12
  32. package/dest/cmds/validator_keys/set_funding_account.d.ts +14 -0
  33. package/dest/cmds/validator_keys/set_funding_account.d.ts.map +1 -0
  34. package/dest/cmds/validator_keys/set_funding_account.js +37 -0
  35. package/dest/cmds/validator_keys/shared.d.ts +15 -2
  36. package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
  37. package/dest/cmds/validator_keys/shared.js +100 -23
  38. package/dest/cmds/validator_keys/utils.d.ts +12 -2
  39. package/dest/cmds/validator_keys/utils.d.ts.map +1 -1
  40. package/dest/cmds/validator_keys/utils.js +34 -0
  41. package/dest/config/cached_fetch.d.ts +19 -10
  42. package/dest/config/cached_fetch.d.ts.map +1 -1
  43. package/dest/config/cached_fetch.js +110 -32
  44. package/dest/config/chain_l2_config.d.ts +7 -2
  45. package/dest/config/chain_l2_config.d.ts.map +1 -1
  46. package/dest/config/chain_l2_config.js +17 -2
  47. package/dest/config/generated/networks.d.ts +81 -60
  48. package/dest/config/generated/networks.d.ts.map +1 -1
  49. package/dest/config/generated/networks.js +82 -61
  50. package/dest/config/network_config.d.ts +1 -1
  51. package/dest/config/network_config.d.ts.map +1 -1
  52. package/dest/config/network_config.js +6 -2
  53. package/dest/utils/aztec.d.ts +1 -2
  54. package/dest/utils/aztec.d.ts.map +1 -1
  55. package/dest/utils/aztec.js +4 -5
  56. package/dest/utils/commands.d.ts +20 -11
  57. package/dest/utils/commands.d.ts.map +1 -1
  58. package/dest/utils/commands.js +29 -18
  59. package/dest/utils/inspect.d.ts +1 -1
  60. package/dest/utils/inspect.d.ts.map +1 -1
  61. package/dest/utils/inspect.js +11 -11
  62. package/package.json +30 -30
  63. package/src/cmds/aztec_node/block_number.ts +1 -1
  64. package/src/cmds/aztec_node/get_logs.ts +70 -38
  65. package/src/cmds/aztec_node/get_node_info.ts +0 -2
  66. package/src/cmds/aztec_node/index.ts +13 -8
  67. package/src/cmds/infrastructure/setup_l2_contract.ts +12 -7
  68. package/src/cmds/l1/deploy_l1_contracts_cmd.ts +0 -1
  69. package/src/cmds/l1/deploy_new_rollup.ts +1 -3
  70. package/src/cmds/l1/update_l1_validators.ts +5 -6
  71. package/src/cmds/validator_keys/eth_json_v3_worker.ts +30 -0
  72. package/src/cmds/validator_keys/index.ts +48 -8
  73. package/src/cmds/validator_keys/new.ts +129 -9
  74. package/src/cmds/validator_keys/set_funding_account.ts +55 -0
  75. package/src/cmds/validator_keys/shared.ts +123 -35
  76. package/src/cmds/validator_keys/utils.ts +44 -1
  77. package/src/config/cached_fetch.ts +119 -31
  78. package/src/config/chain_l2_config.ts +17 -2
  79. package/src/config/generated/networks.ts +80 -59
  80. package/src/config/network_config.ts +6 -2
  81. package/src/utils/aztec.ts +14 -20
  82. package/src/utils/commands.ts +36 -22
  83. package/src/utils/inspect.ts +7 -8
@@ -1,17 +1,20 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
3
4
  import type { LogFn } from '@aztec/foundation/log';
4
5
  import type { PXE } from '@aztec/pxe/server';
5
6
  import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
6
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
8
  import { PublicKeys } from '@aztec/stdlib/keys';
8
- import { LogId } from '@aztec/stdlib/logs/log-id';
9
+ import { LogCursor, Tag } from '@aztec/stdlib/logs';
9
10
  import { TxHash } from '@aztec/stdlib/tx/tx-hash';
10
11
 
11
12
  import { type Command, CommanderError, InvalidArgumentError, Option } from 'commander';
12
13
  import { lookup } from 'dns/promises';
13
14
  import { rename, writeFile } from 'fs/promises';
14
15
 
16
+ export { LogCursor };
17
+
15
18
  /**
16
19
  * If we can successfully resolve 'host.docker.internal', then we are running in a container, and we should treat
17
20
  * localhost as being host.docker.internal.
@@ -48,14 +51,14 @@ export const l1ChainIdOption = new Option('-c, --l1-chain-id <number>', 'Chain I
48
51
  return parsedValue;
49
52
  });
50
53
 
51
- export const createSecretKeyOption = (
54
+ export const createSigningKeyOption = (
52
55
  description: string,
53
56
  mandatory: boolean,
54
- argsParser?: (value: string, previous: Fr) => Fr,
57
+ argsParser?: (value: string, previous: GrumpkinScalar) => GrumpkinScalar,
55
58
  ) =>
56
- new Option('-sk, --secret-key <string>', description)
57
- .env('SECRET_KEY')
58
- .argParser(argsParser ?? parseSecretKey)
59
+ new Option('-sk, --signing-key <string>', description)
60
+ .env('SIGNING_KEY')
61
+ .argParser(argsParser ?? parseSigningKey)
59
62
  .makeOptionMandatory(mandatory);
60
63
 
61
64
  export const logJson = (log: LogFn) => (obj: object) => log(JSON.stringify(obj, null, 2));
@@ -99,7 +102,7 @@ export async function getTxSender(pxe: PXE, _from?: string) {
99
102
  let from: AztecAddress;
100
103
  if (_from) {
101
104
  try {
102
- from = AztecAddress.fromString(_from);
105
+ from = AztecAddress.fromStringUnsafe(_from);
103
106
  } catch {
104
107
  throw new InvalidArgumentError(`Invalid option 'from' passed: ${_from}`);
105
108
  }
@@ -193,7 +196,7 @@ export function parseFieldFromHexString(str: string): Fr {
193
196
  */
194
197
  export function parseAztecAddress(address: string): AztecAddress {
195
198
  try {
196
- return AztecAddress.fromString(address);
199
+ return AztecAddress.fromStringUnsafe(address);
197
200
  } catch {
198
201
  throw new InvalidArgumentError(`Invalid Aztec address: ${address}`);
199
202
  }
@@ -227,16 +230,27 @@ export function parseOptionalAztecAddress(address: string): AztecAddress | undef
227
230
  }
228
231
 
229
232
  /**
230
- * Parses an optional log ID string into a LogId object.
231
- *
232
- * @param logId - The log ID string to parse.
233
- * @returns The parsed LogId object, or undefined if the log ID is missing or empty.
233
+ * Parses an optional `<blockNumber>-<txIndexWithinBlock>-<logIndexWithinTx>` triple into a {@link LogCursor},
234
+ * used as the `--after-log` argument of `get-logs` to resume pagination strictly after a previously-seen log.
235
+ * Thin wrapper over {@link LogCursor.parseOptional} that surfaces parse errors as commander's
236
+ * {@link InvalidArgumentError}.
234
237
  */
235
- export function parseOptionalLogId(logId: string): LogId | undefined {
236
- if (!logId) {
237
- return undefined;
238
+ export function parseOptionalLogCursor(value: string): LogCursor | undefined {
239
+ try {
240
+ return LogCursor.parseOptional(value);
241
+ } catch (err) {
242
+ throw new InvalidArgumentError(err instanceof Error ? err.message : String(err));
238
243
  }
239
- return LogId.fromString(logId);
244
+ }
245
+
246
+ /**
247
+ * Parses a log tag from a string. Tags are field-element values; we delegate to the {@link parseField} parser.
248
+ *
249
+ * @param tag - A hex string, integer, or boolean string representing the tag.
250
+ * @returns A {@link Tag} wrapping the parsed field.
251
+ */
252
+ export function parseTag(tag: string): Tag {
253
+ return new Tag(parseField(tag));
240
254
  }
241
255
 
242
256
  /**
@@ -344,16 +358,16 @@ export function parsePartialAddress(address: string): Fr {
344
358
  }
345
359
 
346
360
  /**
347
- * Parses a secret key from a string.
348
- * @param privateKey - A string
349
- * @returns A secret key
361
+ * Parses an account signing key from a string.
362
+ * @param signingKey - A string
363
+ * @returns A signing key
350
364
  * @throws InvalidArgumentError if the input string is not valid.
351
365
  */
352
- export function parseSecretKey(secretKey: string): Fr {
366
+ export function parseSigningKey(signingKey: string): GrumpkinScalar {
353
367
  try {
354
- return Fr.fromHexString(secretKey);
368
+ return GrumpkinScalar.fromHexString(signingKey);
355
369
  } catch {
356
- throw new InvalidArgumentError(`Invalid encryption secret key: ${secretKey}`);
370
+ throw new InvalidArgumentError(`Invalid signing key: ${signingKey}`);
357
371
  }
358
372
  }
359
373
 
@@ -9,14 +9,13 @@ export async function inspectBlock(
9
9
  log: LogFn,
10
10
  opts: { showTxs?: boolean } = {},
11
11
  ) {
12
- const block = await aztecNode.getBlock(blockNumber);
12
+ const block = await aztecNode.getBlock(blockNumber, { includeTransactions: opts.showTxs });
13
13
  if (!block) {
14
14
  log(`No block found for block number ${blockNumber}`);
15
15
  return;
16
16
  }
17
17
 
18
- const blockHash = await block.hash();
19
- log(`Block ${blockNumber} (${blockHash.toString()})`);
18
+ log(`Block ${blockNumber} (${block.hash.toString()})`);
20
19
  log(` Total fees: ${block.header.totalFees.toBigInt()}`);
21
20
  log(` Total mana used: ${block.header.totalManaUsed.toBigInt()}`);
22
21
  log(
@@ -25,12 +24,12 @@ export async function inspectBlock(
25
24
  log(` Coinbase: ${block.header.globalVariables.coinbase}`);
26
25
  log(` Fee recipient: ${block.header.globalVariables.feeRecipient}`);
27
26
  log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
28
- if (opts.showTxs) {
27
+ if (opts.showTxs && block.body) {
29
28
  log(``);
30
29
  for (const txHash of block.body.txEffects.map(tx => tx.txHash)) {
31
30
  await inspectTx(aztecNode, txHash, log, { includeBlockInfo: false });
32
31
  }
33
- } else {
32
+ } else if (block.body) {
34
33
  log(` Transactions: ${block.body.txEffects.length}`);
35
34
  }
36
35
  }
@@ -41,7 +40,7 @@ export async function inspectTx(
41
40
  log: LogFn,
42
41
  opts: { includeBlockInfo?: boolean } = {},
43
42
  ) {
44
- const [receipt, effectsInBlock] = await Promise.all([aztecNode.getTxReceipt(txHash), aztecNode.getTxEffect(txHash)]);
43
+ const receipt = await aztecNode.getTxReceipt(txHash, { includeTxEffect: true });
45
44
  // Base tx data
46
45
  log(`Tx ${txHash.toString()}`);
47
46
  log(` Status: ${receipt.status}`);
@@ -52,11 +51,11 @@ export async function inspectTx(
52
51
  log(` Error: ${receipt.error}`);
53
52
  }
54
53
 
55
- if (!effectsInBlock) {
54
+ if (!receipt.isMined() || !receipt.txEffect) {
56
55
  return;
57
56
  }
58
57
 
59
- const effects = effectsInBlock.data;
58
+ const effects = receipt.txEffect;
60
59
 
61
60
  if (opts.includeBlockInfo) {
62
61
  log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);