@aztec/cli 0.0.1-fake-ceab37513c → 0.0.1-private.5d121bfd
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/README.md +2 -428
- package/dest/cmds/aztec_node/block_number.d.ts +3 -0
- package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
- package/dest/cmds/aztec_node/block_number.js +10 -0
- package/dest/cmds/aztec_node/get_block.d.ts +3 -0
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_block.js +10 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_min_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +33 -0
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_logs.js +61 -0
- package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_node_info.js +3 -10
- package/dest/cmds/aztec_node/index.d.ts +4 -0
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +38 -0
- package/dest/cmds/contracts/index.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +4 -10
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts +3 -3
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +7 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +3 -5
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +15 -7
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +2 -2
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +11 -25
- package/dest/cmds/l1/advance_epoch.d.ts +2 -2
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
- package/dest/cmds/l1/advance_epoch.js +6 -5
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +8 -8
- package/dest/cmds/l1/bridge_erc20.d.ts +2 -2
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +3 -2
- package/dest/cmds/l1/compute_genesis_values.d.ts +4 -0
- package/dest/cmds/l1/compute_genesis_values.d.ts.map +1 -0
- package/dest/cmds/l1/compute_genesis_values.js +17 -0
- package/dest/cmds/l1/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -0
- package/dest/cmds/l1/{deploy_l1_contracts.js → deploy_l1_contracts_cmd.js} +42 -8
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +6 -8
- package/dest/cmds/l1/get_l1_addresses.d.ts +2 -2
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/get_l1_addresses.js +5 -2
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +4 -2
- package/dest/cmds/l1/governance_utils.d.ts +5 -5
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +3 -1
- package/dest/cmds/l1/index.d.ts +1 -2
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +20 -13
- package/dest/cmds/l1/prover_stats.d.ts +1 -1
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
- package/dest/cmds/l1/prover_stats.js +32 -30
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +2 -2
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
- package/dest/cmds/l1/trigger_seed_snapshot.js +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts +7 -7
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +62 -23
- package/dest/cmds/misc/compute_selector.d.ts +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_key.js +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts.map +1 -1
- package/dest/cmds/misc/index.js +1 -1
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -1
- package/dest/cmds/misc/update/noir.d.ts +1 -1
- package/dest/cmds/misc/update/npm.d.ts +1 -1
- package/dest/cmds/misc/update/npm.js +1 -1
- package/dest/cmds/misc/update/utils.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts +1 -1
- package/dest/cmds/validator_keys/add.d.ts +5 -0
- package/dest/cmds/validator_keys/add.d.ts.map +1 -0
- package/dest/cmds/validator_keys/add.js +83 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +4 -0
- package/dest/cmds/validator_keys/index.d.ts.map +1 -0
- package/dest/cmds/validator_keys/index.js +32 -0
- package/dest/cmds/validator_keys/new.d.ts +29 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +134 -0
- package/dest/cmds/validator_keys/shared.d.ts +68 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
- package/dest/cmds/validator_keys/shared.js +274 -0
- package/dest/cmds/validator_keys/staker.d.ts +38 -0
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/staker.js +210 -0
- package/dest/cmds/validator_keys/utils.d.ts +25 -0
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
- package/dest/cmds/validator_keys/utils.js +52 -0
- package/dest/config/cached_fetch.d.ts +20 -11
- package/dest/config/cached_fetch.d.ts.map +1 -1
- package/dest/config/cached_fetch.js +111 -33
- package/dest/config/chain_l2_config.d.ts +13 -37
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +34 -363
- package/dest/config/enrich_env.d.ts +1 -1
- package/dest/config/enrich_env.js +1 -1
- package/dest/config/generated/networks.d.ts +221 -0
- package/dest/config/generated/networks.d.ts.map +1 -0
- package/dest/config/generated/networks.js +222 -0
- package/dest/config/get_l1_config.d.ts +3 -2
- package/dest/config/get_l1_config.d.ts.map +1 -1
- package/dest/config/get_l1_config.js +3 -1
- package/dest/config/index.d.ts +1 -1
- package/dest/config/network_config.d.ts +7 -4
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +70 -30
- package/dest/utils/aztec.d.ts +8 -21
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +22 -69
- package/dest/utils/commands.d.ts +33 -16
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +56 -19
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +1 -1
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/inspect.d.ts +5 -11
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +22 -100
- package/dest/utils/setup_contracts.d.ts +2 -4
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +2 -22
- package/package.json +48 -30
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +11 -0
- package/src/cmds/aztec_node/get_current_min_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/aztec_node/get_logs.ts +100 -0
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +5 -18
- package/src/cmds/aztec_node/index.ts +92 -0
- package/src/cmds/contracts/inspect_contract.ts +4 -11
- package/src/cmds/infrastructure/index.ts +7 -18
- package/src/cmds/infrastructure/sequencers.ts +13 -11
- package/src/cmds/infrastructure/setup_l2_contract.ts +14 -30
- package/src/cmds/l1/advance_epoch.ts +6 -5
- package/src/cmds/l1/assume_proven_through.ts +10 -9
- package/src/cmds/l1/bridge_erc20.ts +5 -2
- package/src/cmds/l1/compute_genesis_values.ts +29 -0
- package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +43 -26
- package/src/cmds/l1/deploy_new_rollup.ts +7 -14
- package/src/cmds/l1/get_l1_addresses.ts +5 -3
- package/src/cmds/l1/get_l1_balance.ts +2 -2
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/index.ts +34 -25
- package/src/cmds/l1/prover_stats.ts +42 -31
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +56 -35
- package/src/cmds/misc/generate_secret_and_hash.ts +2 -2
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/index.ts +1 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- package/src/cmds/validator_keys/add.ts +123 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +34 -0
- package/src/cmds/validator_keys/index.ts +142 -0
- package/src/cmds/validator_keys/new.ts +207 -0
- package/src/cmds/validator_keys/shared.ts +326 -0
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +81 -0
- package/src/config/cached_fetch.ts +120 -32
- package/src/config/chain_l2_config.ts +36 -470
- package/src/config/enrich_env.ts +1 -1
- package/src/config/generated/networks.ts +226 -0
- package/src/config/get_l1_config.ts +4 -1
- package/src/config/network_config.ts +80 -31
- package/src/utils/aztec.ts +32 -133
- package/src/utils/commands.ts +73 -23
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +26 -116
- package/src/utils/setup_contracts.ts +4 -43
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.d.ts +0 -5
- package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.js +0 -29
- package/dest/cmds/pxe/block_number.d.ts +0 -3
- package/dest/cmds/pxe/block_number.d.ts.map +0 -1
- package/dest/cmds/pxe/block_number.js +0 -10
- package/dest/cmds/pxe/get_account.d.ts +0 -4
- package/dest/cmds/pxe/get_account.d.ts.map +0 -1
- package/dest/cmds/pxe/get_account.js +0 -10
- package/dest/cmds/pxe/get_accounts.d.ts +0 -3
- package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
- package/dest/cmds/pxe/get_accounts.js +0 -25
- package/dest/cmds/pxe/get_block.d.ts +0 -3
- package/dest/cmds/pxe/get_block.d.ts.map +0 -1
- package/dest/cmds/pxe/get_block.js +0 -9
- package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
- package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
- package/dest/cmds/pxe/get_contract_data.js +0 -31
- package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
- package/dest/cmds/pxe/get_current_base_fee.js +0 -7
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
- package/dest/cmds/pxe/get_logs.d.ts +0 -4
- package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
- package/dest/cmds/pxe/get_logs.js +0 -51
- package/dest/cmds/pxe/get_node_info.d.ts +0 -3
- package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.js +0 -11
- package/dest/cmds/pxe/index.d.ts +0 -4
- package/dest/cmds/pxe/index.d.ts.map +0 -1
- package/dest/cmds/pxe/index.js +0 -55
- package/src/cmds/pxe/add_contract.ts +0 -41
- package/src/cmds/pxe/block_number.ts +0 -9
- package/src/cmds/pxe/get_account.ts +0 -16
- package/src/cmds/pxe/get_accounts.ts +0 -35
- package/src/cmds/pxe/get_block.ts +0 -10
- package/src/cmds/pxe/get_contract_data.ts +0 -51
- package/src/cmds/pxe/get_current_base_fee.ts +0 -9
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
- package/src/cmds/pxe/get_logs.ts +0 -66
- package/src/cmds/pxe/get_pxe_info.ts +0 -13
- package/src/cmds/pxe/index.ts +0 -170
package/dest/utils/inspect.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export async function inspectBlock(aztecNode, blockNumber, log, opts = {}) {
|
|
2
|
+
const block = await aztecNode.getBlock(blockNumber, {
|
|
3
|
+
includeTransactions: opts.showTxs
|
|
4
|
+
});
|
|
5
5
|
if (!block) {
|
|
6
6
|
log(`No block found for block number ${blockNumber}`);
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
log(`Block ${blockNumber} (${blockHash.toString()})`);
|
|
9
|
+
log(`Block ${blockNumber} (${block.hash.toString()})`);
|
|
11
10
|
log(` Total fees: ${block.header.totalFees.toBigInt()}`);
|
|
12
11
|
log(` Total mana used: ${block.header.totalManaUsed.toBigInt()}`);
|
|
13
12
|
log(` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas} L2=${block.header.globalVariables.gasFees.feePerL2Gas}`);
|
|
14
13
|
log(` Coinbase: ${block.header.globalVariables.coinbase}`);
|
|
15
14
|
log(` Fee recipient: ${block.header.globalVariables.feeRecipient}`);
|
|
16
15
|
log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
|
|
17
|
-
if (opts.showTxs) {
|
|
16
|
+
if (opts.showTxs && block.body) {
|
|
18
17
|
log(``);
|
|
19
|
-
const artifactMap = await getKnownArtifacts(pxe);
|
|
20
18
|
for (const txHash of block.body.txEffects.map((tx)=>tx.txHash)){
|
|
21
|
-
await inspectTx(
|
|
22
|
-
includeBlockInfo: false
|
|
23
|
-
artifactMap
|
|
19
|
+
await inspectTx(aztecNode, txHash, log, {
|
|
20
|
+
includeBlockInfo: false
|
|
24
21
|
});
|
|
25
22
|
}
|
|
26
|
-
} else {
|
|
23
|
+
} else if (block.body) {
|
|
27
24
|
log(` Transactions: ${block.body.txEffects.length}`);
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
export async function inspectTx(
|
|
27
|
+
export async function inspectTx(aztecNode, txHash, log, opts = {}) {
|
|
31
28
|
const [receipt, effectsInBlock] = await Promise.all([
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
aztecNode.getTxReceipt(txHash),
|
|
30
|
+
aztecNode.getTxEffect(txHash)
|
|
34
31
|
]);
|
|
35
32
|
// Base tx data
|
|
36
33
|
log(`Tx ${txHash.toString()}`);
|
|
37
|
-
log(` Status: ${receipt.status}
|
|
34
|
+
log(` Status: ${receipt.status}`);
|
|
35
|
+
if (receipt.executionResult) {
|
|
36
|
+
log(` Execution result: ${receipt.executionResult}`);
|
|
37
|
+
}
|
|
38
38
|
if (receipt.error) {
|
|
39
39
|
log(` Error: ${receipt.error}`);
|
|
40
40
|
}
|
|
@@ -42,7 +42,6 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
const effects = effectsInBlock.data;
|
|
45
|
-
const artifactMap = opts?.artifactMap ?? await getKnownArtifacts(pxe);
|
|
46
45
|
if (opts.includeBlockInfo) {
|
|
47
46
|
log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);
|
|
48
47
|
}
|
|
@@ -74,32 +73,12 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
74
73
|
log(` Note hash: ${note.toShortString()}`);
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
//
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const deployed = deployNullifiers[nullifier.toString()];
|
|
84
|
-
const note = deployed ? (await pxe.getNotes({
|
|
85
|
-
siloedNullifier: nullifier,
|
|
86
|
-
contractAddress: deployed
|
|
87
|
-
}))[0] : undefined;
|
|
88
|
-
const initialized = initNullifiers[nullifier.toString()];
|
|
89
|
-
const registered = classNullifiers[nullifier.toString()];
|
|
90
|
-
if (nullifier.toBuffer().equals(txHash.toBuffer())) {
|
|
91
|
-
log(` Transaction hash nullifier ${nullifier.toShortString()}`);
|
|
92
|
-
} else if (note) {
|
|
93
|
-
inspectNote(note, artifactMap, log, `Nullifier ${nullifier.toShortString()} for note`);
|
|
94
|
-
} else if (deployed) {
|
|
95
|
-
log(` Contract ${toFriendlyAddress(deployed, artifactMap)} deployed via nullifier ${nullifier.toShortString()}`);
|
|
96
|
-
} else if (initialized) {
|
|
97
|
-
log(` Contract ${toFriendlyAddress(initialized, artifactMap)} initialized via nullifier ${nullifier.toShortString()}`);
|
|
98
|
-
} else if (registered) {
|
|
99
|
-
log(` Class ${registered} registered via nullifier ${nullifier.toShortString()}`);
|
|
100
|
-
} else {
|
|
101
|
-
log(` Unknown nullifier ${nullifier.toString()}`);
|
|
102
|
-
}
|
|
76
|
+
// Created nullifiers
|
|
77
|
+
const nullifiers = effects.nullifiers;
|
|
78
|
+
if (nullifiers.length > 0) {
|
|
79
|
+
log(' Created nullifiers:');
|
|
80
|
+
for (const nullifier of nullifiers){
|
|
81
|
+
log(` Nullifier: ${nullifier.toShortString()}`);
|
|
103
82
|
}
|
|
104
83
|
}
|
|
105
84
|
// L2 to L1 messages
|
|
@@ -110,60 +89,3 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
110
89
|
}
|
|
111
90
|
}
|
|
112
91
|
}
|
|
113
|
-
function inspectNote(note, artifactMap, log, text = 'Note') {
|
|
114
|
-
const artifact = artifactMap[note.contractAddress.toString()];
|
|
115
|
-
const contract = artifact?.name ?? note.contractAddress.toString();
|
|
116
|
-
log(` ${text} at ${contract}`);
|
|
117
|
-
log(` Recipient: ${toFriendlyAddress(note.recipient, artifactMap)}`);
|
|
118
|
-
for (const field of note.note.items){
|
|
119
|
-
log(` ${field.toString()}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function toFriendlyAddress(address, artifactMap) {
|
|
123
|
-
const artifact = artifactMap[address.toString()];
|
|
124
|
-
if (!artifact) {
|
|
125
|
-
return address.toString();
|
|
126
|
-
}
|
|
127
|
-
return `${artifact.name}<${address.toString()}>`;
|
|
128
|
-
}
|
|
129
|
-
async function getKnownNullifiers(pxe, artifactMap) {
|
|
130
|
-
const knownContracts = await pxe.getContracts();
|
|
131
|
-
const deployerAddress = ProtocolContractAddress.ContractInstanceRegistry;
|
|
132
|
-
const classRegistryAddress = ProtocolContractAddress.ContractClassRegistry;
|
|
133
|
-
const initNullifiers = {};
|
|
134
|
-
const deployNullifiers = {};
|
|
135
|
-
const classNullifiers = {};
|
|
136
|
-
for (const contract of knownContracts){
|
|
137
|
-
initNullifiers[(await siloNullifier(contract, contract.toField())).toString()] = contract;
|
|
138
|
-
deployNullifiers[(await siloNullifier(deployerAddress, contract.toField())).toString()] = contract;
|
|
139
|
-
}
|
|
140
|
-
for (const artifact of Object.values(artifactMap)){
|
|
141
|
-
classNullifiers[(await siloNullifier(classRegistryAddress, artifact.classId)).toString()] = `${artifact.name}Class<${artifact.classId}>`;
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
initNullifiers,
|
|
145
|
-
deployNullifiers,
|
|
146
|
-
classNullifiers
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
async function getKnownArtifacts(pxe) {
|
|
150
|
-
const knownContractAddresses = await pxe.getContracts();
|
|
151
|
-
const knownContracts = (await Promise.all(knownContractAddresses.map((contractAddress)=>pxe.getContractMetadata(contractAddress)))).map((contractMetadata)=>contractMetadata.contractInstance);
|
|
152
|
-
const classIds = [
|
|
153
|
-
...new Set(knownContracts.map((contract)=>contract?.currentContractClassId))
|
|
154
|
-
];
|
|
155
|
-
const knownArtifacts = (await Promise.all(classIds.map((classId)=>classId ? pxe.getContractClassMetadata(classId) : undefined))).map((contractClassMetadata)=>contractClassMetadata ? {
|
|
156
|
-
...contractClassMetadata.artifact,
|
|
157
|
-
classId: contractClassMetadata.contractClass?.id
|
|
158
|
-
} : undefined);
|
|
159
|
-
const map = {};
|
|
160
|
-
for (const instance of knownContracts){
|
|
161
|
-
if (instance) {
|
|
162
|
-
const artifact = knownArtifacts.find((a)=>a?.classId?.equals(instance.currentContractClassId));
|
|
163
|
-
if (artifact) {
|
|
164
|
-
map[instance.address.toString()] = artifact;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return map;
|
|
169
|
-
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { AztecAddress
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
2
|
export declare function getSponsoredFPCAddress(): Promise<AztecAddress>;
|
|
4
|
-
|
|
5
|
-
//# sourceMappingURL=setup_contracts.d.ts.map
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dXBfY29udHJhY3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvc2V0dXBfY29udHJhY3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBWTlELHdCQUFzQixzQkFBc0IsSUFBSSxPQUFPLENBQUMsWUFBWSxDQUFDLENBTXBFIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAY9D,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,YAAY,CAAC,CAMpE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
3
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
3
|
-
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
4
4
|
async function getSponsoredFPCContract() {
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
6
|
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
@@ -14,23 +14,3 @@ export async function getSponsoredFPCAddress() {
|
|
|
14
14
|
});
|
|
15
15
|
return sponsoredFPCInstance.address;
|
|
16
16
|
}
|
|
17
|
-
export async function setupSponsoredFPC(pxe, log, waitOpts = DefaultWaitOpts, waitForProvenOptions) {
|
|
18
|
-
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
19
|
-
const address = await getSponsoredFPCAddress();
|
|
20
|
-
const paymentMethod = new SponsoredFeePaymentMethod(address);
|
|
21
|
-
const { l1ChainId: chainId, rollupVersion } = await pxe.getNodeInfo();
|
|
22
|
-
const deployer = new SignerlessWallet(pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
23
|
-
const deployTx = SponsoredFPCContract.deploy(deployer).send({
|
|
24
|
-
from: AztecAddress.ZERO,
|
|
25
|
-
contractAddressSalt: new Fr(SPONSORED_FPC_SALT),
|
|
26
|
-
universalDeploy: true,
|
|
27
|
-
fee: {
|
|
28
|
-
paymentMethod
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const deployed = await deployTx.deployed(waitOpts);
|
|
32
|
-
if (waitForProvenOptions !== undefined) {
|
|
33
|
-
await waitForProven(pxe, await deployTx.getReceipt(), waitForProvenOptions);
|
|
34
|
-
}
|
|
35
|
-
log(`SponsoredFPC: ${deployed.address}`);
|
|
36
|
-
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-private.5d121bfd",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
7
7
|
"./devnet": "./dest/cmds/devnet/index.js",
|
|
8
8
|
"./infrastructure": "./dest/cmds/infrastructure/index.js",
|
|
9
9
|
"./l1": "./dest/cmds/l1/index.js",
|
|
10
|
-
"./
|
|
10
|
+
"./l1/validators": "./dest/cmds/l1/update_l1_validators.js",
|
|
11
|
+
"./aztec_node": "./dest/cmds/aztec_node/index.js",
|
|
11
12
|
"./cli-utils": "./dest/utils/index.js",
|
|
12
13
|
"./misc": "./dest/cmds/misc/index.js",
|
|
14
|
+
"./validator_keys": "./dest/cmds/validator_keys/index.js",
|
|
13
15
|
"./setup-contracts": "./dest/cmds/misc/setup_contracts.js",
|
|
14
16
|
"./utils": "./dest/utils/index.js",
|
|
15
17
|
"./inspect": "./dest/utils/inspect.js",
|
|
16
|
-
"./config": "./dest/config/index.js"
|
|
18
|
+
"./config": "./dest/config/index.js",
|
|
19
|
+
"./config/chain": "./dest/config/chain_l2_config.js",
|
|
20
|
+
"./config/network": "./dest/config/network_config.js"
|
|
17
21
|
},
|
|
18
22
|
"typedocOptions": {
|
|
19
23
|
"entryPoints": [
|
|
@@ -23,13 +27,16 @@
|
|
|
23
27
|
"tsconfig": "./tsconfig.json"
|
|
24
28
|
},
|
|
25
29
|
"scripts": {
|
|
26
|
-
"build": "yarn clean && tsc
|
|
27
|
-
"build:dev": "tsc
|
|
30
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
31
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
28
32
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
33
|
+
"copy-generated": "mkdir -p dest/config/generated/networks && cp src/config/generated/networks/*.json dest/config/generated/networks/",
|
|
34
|
+
"generate": "./scripts/generate.sh",
|
|
29
35
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
30
36
|
},
|
|
31
37
|
"inherits": [
|
|
32
|
-
"../package.common.json"
|
|
38
|
+
"../package.common.json",
|
|
39
|
+
"./package.local.json"
|
|
33
40
|
],
|
|
34
41
|
"jest": {
|
|
35
42
|
"preset": "ts-jest/presets/default-esm",
|
|
@@ -70,30 +77,39 @@
|
|
|
70
77
|
]
|
|
71
78
|
},
|
|
72
79
|
"dependencies": {
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/
|
|
79
|
-
"@aztec/
|
|
80
|
-
"@aztec/
|
|
81
|
-
"@aztec/
|
|
82
|
-
"@aztec/
|
|
83
|
-
"@aztec/
|
|
80
|
+
"@aztec/accounts": "0.0.1-private.5d121bfd",
|
|
81
|
+
"@aztec/archiver": "0.0.1-private.5d121bfd",
|
|
82
|
+
"@aztec/aztec.js": "0.0.1-private.5d121bfd",
|
|
83
|
+
"@aztec/constants": "0.0.1-private.5d121bfd",
|
|
84
|
+
"@aztec/entrypoints": "0.0.1-private.5d121bfd",
|
|
85
|
+
"@aztec/ethereum": "0.0.1-private.5d121bfd",
|
|
86
|
+
"@aztec/foundation": "0.0.1-private.5d121bfd",
|
|
87
|
+
"@aztec/l1-artifacts": "0.0.1-private.5d121bfd",
|
|
88
|
+
"@aztec/node-keystore": "0.0.1-private.5d121bfd",
|
|
89
|
+
"@aztec/node-lib": "0.0.1-private.5d121bfd",
|
|
90
|
+
"@aztec/p2p": "0.0.1-private.5d121bfd",
|
|
91
|
+
"@aztec/protocol-contracts": "0.0.1-private.5d121bfd",
|
|
92
|
+
"@aztec/sequencer-client": "0.0.1-private.5d121bfd",
|
|
93
|
+
"@aztec/slasher": "0.0.1-private.5d121bfd",
|
|
94
|
+
"@aztec/stdlib": "0.0.1-private.5d121bfd",
|
|
95
|
+
"@aztec/wallets": "0.0.1-private.5d121bfd",
|
|
96
|
+
"@aztec/world-state": "0.0.1-private.5d121bfd",
|
|
97
|
+
"@ethersproject/wallet": "^5.8.0",
|
|
84
98
|
"@iarna/toml": "^2.2.5",
|
|
85
99
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
100
|
+
"@scure/bip39": "^2.0.1",
|
|
86
101
|
"commander": "^12.1.0",
|
|
87
102
|
"lodash.chunk": "^4.2.0",
|
|
88
103
|
"lodash.groupby": "^4.6.0",
|
|
89
104
|
"semver": "^7.5.4",
|
|
90
105
|
"source-map-support": "^0.5.21",
|
|
91
106
|
"tslib": "^2.4.0",
|
|
92
|
-
"viem": "npm:@
|
|
107
|
+
"viem": "npm:@aztec/viem@2.38.2"
|
|
93
108
|
},
|
|
94
109
|
"devDependencies": {
|
|
95
|
-
"@aztec/
|
|
96
|
-
"@aztec/
|
|
110
|
+
"@aztec/aztec-node": "0.0.1-private.5d121bfd",
|
|
111
|
+
"@aztec/kv-store": "0.0.1-private.5d121bfd",
|
|
112
|
+
"@aztec/telemetry-client": "0.0.1-private.5d121bfd",
|
|
97
113
|
"@jest/globals": "^30.0.0",
|
|
98
114
|
"@types/jest": "^30.0.0",
|
|
99
115
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -102,6 +118,7 @@
|
|
|
102
118
|
"@types/node": "^22.15.17",
|
|
103
119
|
"@types/semver": "^7.5.2",
|
|
104
120
|
"@types/source-map-support": "^0.5.10",
|
|
121
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
105
122
|
"jest": "^30.0.0",
|
|
106
123
|
"jest-mock-extended": "^4.0.0",
|
|
107
124
|
"ts-jest": "^29.4.0",
|
|
@@ -109,20 +126,21 @@
|
|
|
109
126
|
"typescript": "^5.3.3"
|
|
110
127
|
},
|
|
111
128
|
"peerDependencies": {
|
|
112
|
-
"@aztec/accounts": "0.0.1-
|
|
113
|
-
"@aztec/bb-prover": "0.0.1-
|
|
114
|
-
"@aztec/ethereum": "0.0.1-
|
|
115
|
-
"@aztec/l1-artifacts": "0.0.1-
|
|
116
|
-
"@aztec/noir-contracts.js": "0.0.1-
|
|
117
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-
|
|
118
|
-
"@aztec/noir-test-contracts.js": "0.0.1-
|
|
119
|
-
"@aztec/protocol-contracts": "0.0.1-
|
|
120
|
-
"@aztec/stdlib": "0.0.1-
|
|
129
|
+
"@aztec/accounts": "0.0.1-private.5d121bfd",
|
|
130
|
+
"@aztec/bb-prover": "0.0.1-private.5d121bfd",
|
|
131
|
+
"@aztec/ethereum": "0.0.1-private.5d121bfd",
|
|
132
|
+
"@aztec/l1-artifacts": "0.0.1-private.5d121bfd",
|
|
133
|
+
"@aztec/noir-contracts.js": "0.0.1-private.5d121bfd",
|
|
134
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-private.5d121bfd",
|
|
135
|
+
"@aztec/noir-test-contracts.js": "0.0.1-private.5d121bfd",
|
|
136
|
+
"@aztec/protocol-contracts": "0.0.1-private.5d121bfd",
|
|
137
|
+
"@aztec/stdlib": "0.0.1-private.5d121bfd"
|
|
121
138
|
},
|
|
122
139
|
"files": [
|
|
123
140
|
"dest",
|
|
124
141
|
"src",
|
|
125
|
-
"!*.test.*"
|
|
142
|
+
"!*.test.*",
|
|
143
|
+
"public_include_metric_prefixes.json"
|
|
126
144
|
],
|
|
127
145
|
"types": "./dest/index.d.ts",
|
|
128
146
|
"engines": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
["aztec.validator", "aztec.tx_collector", "aztec.mempool", "aztec.p2p.gossip.agg_", "aztec.ivc_verifier.agg_"]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
|
|
4
|
+
export async function blockNumber(nodeUrl: string, log: LogFn) {
|
|
5
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
6
|
+
const [latestNum, provenNum] = await Promise.all([aztecNode.getBlockNumber(), aztecNode.getBlockNumber('proven')]);
|
|
7
|
+
log(`Latest block: ${latestNum}`);
|
|
8
|
+
log(`Proven block: ${provenNum}`);
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
|
|
5
|
+
import { inspectBlock } from '../../utils/inspect.js';
|
|
6
|
+
|
|
7
|
+
export async function getBlock(nodeUrl: string, maybeBlockNumber: number | undefined, log: LogFn) {
|
|
8
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
9
|
+
const blockNumber: BlockNumber = maybeBlockNumber ? BlockNumber(maybeBlockNumber) : await aztecNode.getBlockNumber();
|
|
10
|
+
await inspectBlock(aztecNode, blockNumber, log, { showTxs: true });
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
|
+
|
|
5
|
+
export async function getCurrentMinFee(nodeUrl: string, debugLogger: Logger, log: LogFn) {
|
|
6
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
7
|
+
const fees = await node.getCurrentMinFees();
|
|
8
|
+
log(`Current fees: ${jsonStringify(fees)}`);
|
|
9
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
4
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
6
|
+
|
|
7
|
+
export async function getL1ToL2MessageWitness(
|
|
8
|
+
nodeUrl: string,
|
|
9
|
+
contractAddress: AztecAddress,
|
|
10
|
+
messageHash: Fr,
|
|
11
|
+
secret: Fr,
|
|
12
|
+
log: LogFn,
|
|
13
|
+
) {
|
|
14
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
15
|
+
const messageWitness = await getNonNullifiedL1ToL2MessageWitness(node, contractAddress, messageHash, secret);
|
|
16
|
+
|
|
17
|
+
log(
|
|
18
|
+
messageWitness === undefined
|
|
19
|
+
? `
|
|
20
|
+
L1 to L2 Message not found.
|
|
21
|
+
`
|
|
22
|
+
: `
|
|
23
|
+
L1 to L2 message index: ${messageWitness[0]}
|
|
24
|
+
L1 to L2 message sibling path: ${messageWitness[1]}
|
|
25
|
+
`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
3
|
+
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
4
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
5
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
6
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
7
|
+
import {
|
|
8
|
+
LogCursor,
|
|
9
|
+
type PublicLogsQuery,
|
|
10
|
+
type Tag,
|
|
11
|
+
logResultToHumanReadable,
|
|
12
|
+
queryAllPublicLogsByTags,
|
|
13
|
+
} from '@aztec/stdlib/logs';
|
|
14
|
+
|
|
15
|
+
/** Options for the `get-logs` CLI command. */
|
|
16
|
+
export type GetLogsOptions = {
|
|
17
|
+
/** Contract address that emitted the logs (required). */
|
|
18
|
+
contractAddress: AztecAddress;
|
|
19
|
+
/** Tag to filter logs by (required). */
|
|
20
|
+
tag: Tag;
|
|
21
|
+
/** Restrict the search to this tx hash. Mutually exclusive with `fromBlock`/`toBlock`. */
|
|
22
|
+
txHash?: TxHash;
|
|
23
|
+
/** Lower block bound, inclusive. */
|
|
24
|
+
fromBlock?: BlockNumber;
|
|
25
|
+
/** Upper block bound, exclusive. */
|
|
26
|
+
toBlock?: BlockNumber;
|
|
27
|
+
/** Log cursor to resume pagination strictly after a previously-seen log. */
|
|
28
|
+
afterLog?: LogCursor;
|
|
29
|
+
/** Node RPC URL. */
|
|
30
|
+
nodeUrl: string;
|
|
31
|
+
/** When set, polls indefinitely for new logs. Incompatible with `txHash` and `toBlock`. */
|
|
32
|
+
follow: boolean;
|
|
33
|
+
/** Log function. */
|
|
34
|
+
log: LogFn;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Fetches public logs for a (contract, tag) pair, draining all pages via the stdlib pagination helper.
|
|
39
|
+
* In `--follow` mode, polls indefinitely: each round drains all currently-available logs, then sleeps
|
|
40
|
+
* until the next poll if nothing new was found.
|
|
41
|
+
*/
|
|
42
|
+
export async function getLogs(options: GetLogsOptions): Promise<void> {
|
|
43
|
+
const { txHash, fromBlock, toBlock, contractAddress, tag, nodeUrl, follow, log } = options;
|
|
44
|
+
let afterLog = options.afterLog;
|
|
45
|
+
|
|
46
|
+
if (follow) {
|
|
47
|
+
if (txHash) {
|
|
48
|
+
throw Error('Cannot use --follow with --tx-hash');
|
|
49
|
+
}
|
|
50
|
+
if (toBlock) {
|
|
51
|
+
throw Error('Cannot use --follow with --to-block');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (txHash !== undefined && (fromBlock !== undefined || toBlock !== undefined)) {
|
|
55
|
+
throw Error('Cannot combine --tx-hash with --from-block / --to-block');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
59
|
+
|
|
60
|
+
const drainLogs = async () => {
|
|
61
|
+
const query: PublicLogsQuery = {
|
|
62
|
+
contractAddress,
|
|
63
|
+
tags: [afterLog !== undefined ? { tag, afterLog } : tag],
|
|
64
|
+
fromBlock,
|
|
65
|
+
toBlock,
|
|
66
|
+
txHash,
|
|
67
|
+
};
|
|
68
|
+
const [logsForTag] = await queryAllPublicLogsByTags(node, query);
|
|
69
|
+
if (logsForTag.length > 0) {
|
|
70
|
+
afterLog = LogCursor.fromLog(logsForTag[logsForTag.length - 1]);
|
|
71
|
+
}
|
|
72
|
+
return logsForTag;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
if (follow) {
|
|
76
|
+
log('Fetching logs...');
|
|
77
|
+
while (true) {
|
|
78
|
+
const results = await drainLogs();
|
|
79
|
+
if (results.length === 0) {
|
|
80
|
+
await sleep(1000);
|
|
81
|
+
} else {
|
|
82
|
+
results.forEach(r => log(logResultToHumanReadable(r)));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
const results = await drainLogs();
|
|
87
|
+
if (results.length === 0) {
|
|
88
|
+
log(
|
|
89
|
+
`No logs found for {contractAddress: ${contractAddress.toString()}, tag: ${tag.toString()}` +
|
|
90
|
+
`${txHash ? `, txHash: ${txHash.toString()}` : ''}` +
|
|
91
|
+
`${fromBlock !== undefined ? `, fromBlock: ${fromBlock}` : ''}` +
|
|
92
|
+
`${toBlock !== undefined ? `, toBlock: ${toBlock}` : ''}` +
|
|
93
|
+
`${afterLog ? `, afterLog: ${afterLog.toString()}` : ''}}`,
|
|
94
|
+
);
|
|
95
|
+
} else {
|
|
96
|
+
log('Logs found: \n');
|
|
97
|
+
results.forEach(r => log(logResultToHumanReadable(r)));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { LogFn
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
|
|
4
|
+
export async function getNodeInfo(nodeUrl: string, json: boolean, log: LogFn, logJson: (output: any) => void) {
|
|
5
|
+
const client = createAztecNodeClient(nodeUrl);
|
|
3
6
|
|
|
4
|
-
export async function getNodeInfo(
|
|
5
|
-
rpcUrl: string,
|
|
6
|
-
pxeRequest: boolean,
|
|
7
|
-
debugLogger: Logger,
|
|
8
|
-
json: boolean,
|
|
9
|
-
log: LogFn,
|
|
10
|
-
logJson: (output: any) => void,
|
|
11
|
-
) {
|
|
12
|
-
let client: AztecNode | PXE;
|
|
13
|
-
if (pxeRequest) {
|
|
14
|
-
client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
15
|
-
} else {
|
|
16
|
-
client = createAztecNodeClient(rpcUrl);
|
|
17
|
-
}
|
|
18
7
|
const info = await client.getNodeInfo();
|
|
19
8
|
if (json) {
|
|
20
9
|
logJson({
|
|
@@ -34,7 +23,6 @@ export async function getNodeInfo(
|
|
|
34
23
|
rewardDistributor: info.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
35
24
|
governanceProposer: info.l1ContractAddresses.governanceProposerAddress.toString(),
|
|
36
25
|
governance: info.l1ContractAddresses.governanceAddress.toString(),
|
|
37
|
-
slashFactory: info.l1ContractAddresses.slashFactoryAddress?.toString(),
|
|
38
26
|
feeAssetHandler: info.l1ContractAddresses.feeAssetHandlerAddress?.toString(),
|
|
39
27
|
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString(),
|
|
40
28
|
},
|
|
@@ -62,7 +50,6 @@ export async function getNodeInfo(
|
|
|
62
50
|
log(` RewardDistributor Address: ${info.l1ContractAddresses.rewardDistributorAddress.toString()}`);
|
|
63
51
|
log(` GovernanceProposer Address: ${info.l1ContractAddresses.governanceProposerAddress.toString()}`);
|
|
64
52
|
log(` Governance Address: ${info.l1ContractAddresses.governanceAddress.toString()}`);
|
|
65
|
-
log(` SlashFactory Address: ${info.l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
66
53
|
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
67
54
|
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
68
55
|
log(`L2 Contract Addresses:`);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
3
|
+
import type { Command } from 'commander';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
logJson,
|
|
7
|
+
nodeOption,
|
|
8
|
+
parseAztecAddress,
|
|
9
|
+
parseField,
|
|
10
|
+
parseOptionalInteger,
|
|
11
|
+
parseOptionalLogCursor,
|
|
12
|
+
parseOptionalTxHash,
|
|
13
|
+
parseTag,
|
|
14
|
+
} from '../../utils/commands.js';
|
|
15
|
+
|
|
16
|
+
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
17
|
+
program
|
|
18
|
+
.command('get-block')
|
|
19
|
+
.description('Gets info for a given block or latest.')
|
|
20
|
+
.argument('[blockNumber]', 'Block height', parseOptionalInteger)
|
|
21
|
+
.addOption(nodeOption)
|
|
22
|
+
.action(async (blockNumber, options) => {
|
|
23
|
+
const { getBlock } = await import('./get_block.js');
|
|
24
|
+
await getBlock(options.nodeUrl, blockNumber, log);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
program
|
|
28
|
+
.command('get-current-min-fee')
|
|
29
|
+
.description('Gets the current base fee.')
|
|
30
|
+
.addOption(nodeOption)
|
|
31
|
+
.action(async options => {
|
|
32
|
+
const { getCurrentMinFee } = await import('./get_current_min_fee.js');
|
|
33
|
+
await getCurrentMinFee(options.rpcUrl, debugLogger, log);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
program
|
|
37
|
+
.command('get-l1-to-l2-message-witness')
|
|
38
|
+
.description('Gets a L1 to L2 message witness.')
|
|
39
|
+
.requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
|
|
40
|
+
.requiredOption('--message-hash <messageHash>', 'The L1 to L2 message hash.', parseField)
|
|
41
|
+
.requiredOption('--secret <secret>', 'The secret used to claim the L1 to L2 message', parseField)
|
|
42
|
+
.addOption(nodeOption)
|
|
43
|
+
.action(async ({ contractAddress, messageHash, secret, nodeUrl }) => {
|
|
44
|
+
const { getL1ToL2MessageWitness } = await import('./get_l1_to_l2_message_witness.js');
|
|
45
|
+
await getL1ToL2MessageWitness(nodeUrl, contractAddress, messageHash, secret, log);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
program
|
|
49
|
+
.command('get-logs')
|
|
50
|
+
.description('Gets public logs for a contract and tag, optionally restricted by block range or tx hash.')
|
|
51
|
+
.requiredOption('-ca, --contract-address <address>', 'Contract address that emitted the logs.', parseAztecAddress)
|
|
52
|
+
.requiredOption('--tag <tag>', 'Tag (Fr value) to filter logs by.', parseTag)
|
|
53
|
+
.option('-tx, --tx-hash <txHash>', 'A transaction hash to restrict the search to.', parseOptionalTxHash)
|
|
54
|
+
.option(
|
|
55
|
+
'-fb, --from-block <blockNum>',
|
|
56
|
+
'Initial block number for getting logs (defaults to 1).',
|
|
57
|
+
parseOptionalInteger,
|
|
58
|
+
)
|
|
59
|
+
.option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
|
|
60
|
+
.option(
|
|
61
|
+
'-al --after-log <cursor>',
|
|
62
|
+
'Log cursor of the form <blockNumber>-<txIndexWithinBlock>-<logIndexWithinTx> to resume pagination after.',
|
|
63
|
+
parseOptionalLogCursor,
|
|
64
|
+
)
|
|
65
|
+
.addOption(nodeOption)
|
|
66
|
+
.option('--follow', 'If set, will keep polling for new logs until interrupted.')
|
|
67
|
+
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, tag, nodeUrl, follow }) => {
|
|
68
|
+
const { getLogs } = await import('./get_logs.js');
|
|
69
|
+
await getLogs({ txHash, fromBlock, toBlock, afterLog, contractAddress, tag, nodeUrl, follow, log });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
program
|
|
73
|
+
.command('block-number')
|
|
74
|
+
.description('Gets the current Aztec L2 block number.')
|
|
75
|
+
.addOption(nodeOption)
|
|
76
|
+
.action(async (options: any) => {
|
|
77
|
+
const { blockNumber } = await import('./block_number.js');
|
|
78
|
+
await blockNumber(options.nodeUrl, log);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
program
|
|
82
|
+
.command('get-node-info')
|
|
83
|
+
.description('Gets the information of an Aztec node from a PXE or directly from an Aztec node.')
|
|
84
|
+
.option('--json', 'Emit output as json')
|
|
85
|
+
.addOption(nodeOption)
|
|
86
|
+
.action(async options => {
|
|
87
|
+
const { getNodeInfo } = await import('./get_node_info.js');
|
|
88
|
+
await getNodeInfo(options.nodeUrl, options.json, log, logJson(log));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return program;
|
|
92
|
+
}
|