@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.
- package/dest/cmds/aztec_node/block_number.js +1 -1
- package/dest/cmds/aztec_node/get_logs.d.ts +30 -4
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_logs.js +39 -29
- package/dest/cmds/aztec_node/get_node_info.d.ts +1 -1
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_node_info.js +0 -2
- package/dest/cmds/aztec_node/index.d.ts +1 -1
- package/dest/cmds/aztec_node/index.d.ts.map +1 -1
- package/dest/cmds/aztec_node/index.js +13 -3
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +12 -7
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.js +0 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +2 -4
- package/dest/cmds/l1/update_l1_validators.d.ts +1 -1
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +5 -6
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts +2 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +1 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +7 -6
- package/dest/cmds/validator_keys/new.d.ts +7 -1
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +98 -12
- package/dest/cmds/validator_keys/set_funding_account.d.ts +14 -0
- package/dest/cmds/validator_keys/set_funding_account.d.ts.map +1 -0
- package/dest/cmds/validator_keys/set_funding_account.js +37 -0
- package/dest/cmds/validator_keys/shared.d.ts +15 -2
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +100 -23
- package/dest/cmds/validator_keys/utils.d.ts +12 -2
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -1
- package/dest/cmds/validator_keys/utils.js +34 -0
- package/dest/config/cached_fetch.d.ts +19 -10
- package/dest/config/cached_fetch.d.ts.map +1 -1
- package/dest/config/cached_fetch.js +110 -32
- package/dest/config/chain_l2_config.d.ts +7 -2
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +17 -2
- package/dest/config/generated/networks.d.ts +81 -60
- package/dest/config/generated/networks.d.ts.map +1 -1
- package/dest/config/generated/networks.js +82 -61
- package/dest/config/network_config.d.ts +1 -1
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +6 -2
- package/dest/utils/aztec.d.ts +1 -2
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +4 -5
- package/dest/utils/commands.d.ts +20 -11
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +29 -18
- package/dest/utils/inspect.d.ts +1 -1
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +11 -11
- package/package.json +30 -30
- package/src/cmds/aztec_node/block_number.ts +1 -1
- package/src/cmds/aztec_node/get_logs.ts +70 -38
- package/src/cmds/aztec_node/get_node_info.ts +0 -2
- package/src/cmds/aztec_node/index.ts +13 -8
- package/src/cmds/infrastructure/setup_l2_contract.ts +12 -7
- package/src/cmds/l1/deploy_l1_contracts_cmd.ts +0 -1
- package/src/cmds/l1/deploy_new_rollup.ts +1 -3
- package/src/cmds/l1/update_l1_validators.ts +5 -6
- package/src/cmds/validator_keys/eth_json_v3_worker.ts +30 -0
- package/src/cmds/validator_keys/index.ts +48 -8
- package/src/cmds/validator_keys/new.ts +129 -9
- package/src/cmds/validator_keys/set_funding_account.ts +55 -0
- package/src/cmds/validator_keys/shared.ts +123 -35
- package/src/cmds/validator_keys/utils.ts +44 -1
- package/src/config/cached_fetch.ts +119 -31
- package/src/config/chain_l2_config.ts +17 -2
- package/src/config/generated/networks.ts +80 -59
- package/src/config/network_config.ts +6 -2
- package/src/utils/aztec.ts +14 -20
- package/src/utils/commands.ts +36 -22
- package/src/utils/inspect.ts +7 -8
package/src/utils/commands.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
54
|
+
export const createSigningKeyOption = (
|
|
52
55
|
description: string,
|
|
53
56
|
mandatory: boolean,
|
|
54
|
-
argsParser?: (value: string, previous:
|
|
57
|
+
argsParser?: (value: string, previous: GrumpkinScalar) => GrumpkinScalar,
|
|
55
58
|
) =>
|
|
56
|
-
new Option('-sk, --
|
|
57
|
-
.env('
|
|
58
|
-
.argParser(argsParser ??
|
|
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.
|
|
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.
|
|
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
|
|
231
|
-
*
|
|
232
|
-
* @
|
|
233
|
-
* @
|
|
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
|
|
236
|
-
|
|
237
|
-
return
|
|
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
|
-
|
|
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
|
|
348
|
-
* @param
|
|
349
|
-
* @returns A
|
|
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
|
|
366
|
+
export function parseSigningKey(signingKey: string): GrumpkinScalar {
|
|
353
367
|
try {
|
|
354
|
-
return
|
|
368
|
+
return GrumpkinScalar.fromHexString(signingKey);
|
|
355
369
|
} catch {
|
|
356
|
-
throw new InvalidArgumentError(`Invalid
|
|
370
|
+
throw new InvalidArgumentError(`Invalid signing key: ${signingKey}`);
|
|
357
371
|
}
|
|
358
372
|
}
|
|
359
373
|
|
package/src/utils/inspect.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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 (!
|
|
54
|
+
if (!receipt.isMined() || !receipt.txEffect) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
const effects =
|
|
58
|
+
const effects = receipt.txEffect;
|
|
60
59
|
|
|
61
60
|
if (opts.includeBlockInfo) {
|
|
62
61
|
log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);
|