@aztec/cli 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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 +7 -0
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
- 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 -8
- 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 +28 -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 +10 -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 +2 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +8 -6
- 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/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 -7
- 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 +5 -5
- 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 +22 -36
- 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 +10 -5
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +74 -9
- 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 +18 -0
- package/dest/config/cached_fetch.d.ts.map +1 -0
- package/dest/config/cached_fetch.js +54 -0
- package/dest/config/chain_l2_config.d.ts +41 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +524 -0
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/get_l1_config.d.ts +9 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +24 -0
- package/dest/config/index.d.ts +5 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +4 -0
- package/dest/config/network_config.d.ts +22 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +115 -0
- package/dest/utils/aztec.d.ts +8 -20
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +22 -67
- package/dest/utils/commands.d.ts +21 -12
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +38 -11
- 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 +13 -95
- 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 +43 -28
- 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/{pxe → aztec_node}/get_logs.ts +11 -9
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +5 -16
- package/src/cmds/aztec_node/index.ts +87 -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 +13 -30
- package/src/cmds/l1/advance_epoch.ts +6 -5
- package/src/cmds/l1/assume_proven_through.ts +10 -6
- package/src/cmds/l1/bridge_erc20.ts +5 -2
- package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +44 -24
- package/src/cmds/l1/deploy_new_rollup.ts +6 -9
- 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 +28 -66
- 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 +88 -18
- 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 +67 -0
- package/src/config/chain_l2_config.ts +694 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/get_l1_config.ts +31 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +147 -0
- package/src/utils/aztec.ts +27 -118
- package/src/utils/commands.ts +52 -15
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +19 -111
- package/src/utils/setup_contracts.ts +4 -43
- package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
- package/dest/cmds/devnet/bootstrap_network.js +0 -216
- package/dest/cmds/devnet/faucet.d.ts +0 -4
- package/dest/cmds/devnet/faucet.d.ts.map +0 -1
- package/dest/cmds/devnet/faucet.js +0 -26
- package/dest/cmds/devnet/index.d.ts +0 -4
- package/dest/cmds/devnet/index.d.ts.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- 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_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/devnet/bootstrap_network.ts +0 -321
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
- 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_pxe_info.ts +0 -13
- package/src/cmds/pxe/index.ts +0 -170
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AztecAddress, type ContractInstanceWithAddress, type Fr, getContractClassFromArtifact } from '@aztec/aztec.js';
|
|
2
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
3
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
|
-
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
5
|
-
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
6
|
-
|
|
7
|
-
import { getContractArtifact } from '../../utils/aztec.js';
|
|
8
|
-
|
|
9
|
-
export async function addContract(
|
|
10
|
-
rpcUrl: string,
|
|
11
|
-
contractArtifactPath: string,
|
|
12
|
-
address: AztecAddress,
|
|
13
|
-
initializationHash: Fr,
|
|
14
|
-
salt: Fr,
|
|
15
|
-
publicKeys: PublicKeys,
|
|
16
|
-
deployer: AztecAddress | undefined,
|
|
17
|
-
debugLogger: Logger,
|
|
18
|
-
log: LogFn,
|
|
19
|
-
) {
|
|
20
|
-
const artifact = await getContractArtifact(contractArtifactPath, log);
|
|
21
|
-
const contractClass = await getContractClassFromArtifact(artifact);
|
|
22
|
-
const instance: ContractInstanceWithAddress = {
|
|
23
|
-
version: 1,
|
|
24
|
-
salt,
|
|
25
|
-
initializationHash,
|
|
26
|
-
currentContractClassId: contractClass.id,
|
|
27
|
-
originalContractClassId: contractClass.id,
|
|
28
|
-
publicKeys: publicKeys ?? PublicKeys.default(),
|
|
29
|
-
address,
|
|
30
|
-
deployer: deployer ?? AztecAddress.ZERO,
|
|
31
|
-
};
|
|
32
|
-
const computed = await computeContractAddressFromInstance(instance);
|
|
33
|
-
if (!computed.equals(address)) {
|
|
34
|
-
throw new Error(`Contract address ${address.toString()} does not match computed address ${computed.toString()}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
38
|
-
|
|
39
|
-
await client.registerContract({ artifact, instance });
|
|
40
|
-
log(`\nContract added to PXE at ${address.toString()} with class ${instance.currentContractClassId.toString()}\n`);
|
|
41
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
export async function blockNumber(rpcUrl: string, debugLogger: Logger, log: LogFn) {
|
|
5
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
6
|
-
const [latestNum, provenNum] = await Promise.all([client.getBlockNumber(), client.getProvenBlockNumber()]);
|
|
7
|
-
log(`Latest block: ${latestNum}`);
|
|
8
|
-
log(`Proven block: ${provenNum}`);
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/aztec.js';
|
|
2
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
3
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
|
-
|
|
5
|
-
export async function getAccount(aztecAddress: AztecAddress, rpcUrl: string, debugLogger: Logger, log: LogFn) {
|
|
6
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
7
|
-
const account = (await client.getRegisteredAccounts()).find(completeAddress =>
|
|
8
|
-
completeAddress.address.equals(aztecAddress),
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
if (!account) {
|
|
12
|
-
log(`Unknown account ${aztecAddress.toString()}`);
|
|
13
|
-
} else {
|
|
14
|
-
log(account.toReadableString());
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
export async function getAccounts(
|
|
5
|
-
rpcUrl: string,
|
|
6
|
-
json: boolean,
|
|
7
|
-
debugLogger: Logger,
|
|
8
|
-
log: LogFn,
|
|
9
|
-
logJson: (output: any) => void,
|
|
10
|
-
) {
|
|
11
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
12
|
-
const accounts = await client.getRegisteredAccounts();
|
|
13
|
-
if (!accounts.length) {
|
|
14
|
-
if (json) {
|
|
15
|
-
logJson([]);
|
|
16
|
-
} else {
|
|
17
|
-
log('No accounts found.');
|
|
18
|
-
}
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (json) {
|
|
22
|
-
logJson(
|
|
23
|
-
accounts.map(a => ({
|
|
24
|
-
address: a.address.toString(),
|
|
25
|
-
publicKeys: a.publicKeys.toString(),
|
|
26
|
-
partialAddress: a.partialAddress.toString(),
|
|
27
|
-
})),
|
|
28
|
-
);
|
|
29
|
-
} else {
|
|
30
|
-
log(`Accounts found: \n`);
|
|
31
|
-
for (const account of accounts) {
|
|
32
|
-
log(account.toReadableString());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
import { inspectBlock } from '../../utils/inspect.js';
|
|
5
|
-
|
|
6
|
-
export async function getBlock(rpcUrl: string, maybeBlockNumber: number | undefined, debugLogger: Logger, log: LogFn) {
|
|
7
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
8
|
-
const blockNumber = maybeBlockNumber ?? (await client.getBlockNumber());
|
|
9
|
-
await inspectBlock(client, blockNumber, log, { showTxs: true });
|
|
10
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/aztec.js';
|
|
2
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
3
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
|
-
|
|
5
|
-
export async function getContractData(
|
|
6
|
-
rpcUrl: string,
|
|
7
|
-
contractAddress: AztecAddress,
|
|
8
|
-
includeBytecode: boolean,
|
|
9
|
-
debugLogger: Logger,
|
|
10
|
-
log: LogFn,
|
|
11
|
-
) {
|
|
12
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
13
|
-
const {
|
|
14
|
-
contractInstance: instance,
|
|
15
|
-
isContractInitialized: isInitialized,
|
|
16
|
-
isContractPublished: isPubliclyDeployed,
|
|
17
|
-
} = await client.getContractMetadata(contractAddress);
|
|
18
|
-
const contractClass =
|
|
19
|
-
includeBytecode &&
|
|
20
|
-
instance &&
|
|
21
|
-
(await client.getContractClassMetadata(instance?.currentContractClassId)).contractClass;
|
|
22
|
-
|
|
23
|
-
const isPrivatelyDeployed = !!instance;
|
|
24
|
-
const initStr = isInitialized ? 'initialized' : 'not initialized';
|
|
25
|
-
const addrStr = contractAddress.toString();
|
|
26
|
-
|
|
27
|
-
if (isPubliclyDeployed && isPrivatelyDeployed) {
|
|
28
|
-
log(`Contract is ${initStr} and publicly deployed at ${addrStr}`);
|
|
29
|
-
} else if (isPrivatelyDeployed) {
|
|
30
|
-
log(`Contract is ${initStr} and registered in the local pxe at ${addrStr} but not publicly deployed`);
|
|
31
|
-
} else if (isPubliclyDeployed) {
|
|
32
|
-
log(`Contract is ${initStr} and publicly deployed at ${addrStr} but not registered in the local pxe`);
|
|
33
|
-
} else if (isInitialized) {
|
|
34
|
-
log(`Contract is initialized but not publicly deployed nor registered in the local pxe at ${addrStr}`);
|
|
35
|
-
} else {
|
|
36
|
-
log(`No contract found at ${addrStr}`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (instance) {
|
|
40
|
-
log(``);
|
|
41
|
-
Object.entries(instance).forEach(([key, value]) => {
|
|
42
|
-
const capitalized = key.charAt(0).toUpperCase() + key.slice(1);
|
|
43
|
-
log(`${capitalized}: ${value.toString()}`);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (contractClass) {
|
|
47
|
-
log(`\nBytecode: ${contractClass.packedBytecode.toString('base64')}`);
|
|
48
|
-
}
|
|
49
|
-
log('');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
|
-
|
|
5
|
-
export async function getCurrentBaseFee(rpcUrl: string, debugLogger: Logger, log: LogFn) {
|
|
6
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
7
|
-
const fees = await client.getCurrentBaseFees();
|
|
8
|
-
log(`Current fees: ${jsonStringify(fees)}`);
|
|
9
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type AztecAddress, type Fr, createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
export async function getL1ToL2MessageWitness(
|
|
5
|
-
rpcUrl: string,
|
|
6
|
-
contractAddress: AztecAddress,
|
|
7
|
-
messageHash: Fr,
|
|
8
|
-
secret: Fr,
|
|
9
|
-
debugLogger: Logger,
|
|
10
|
-
log: LogFn,
|
|
11
|
-
) {
|
|
12
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
13
|
-
const messageWitness = await client.getL1ToL2MembershipWitness(contractAddress, messageHash, secret);
|
|
14
|
-
|
|
15
|
-
log(
|
|
16
|
-
messageWitness === undefined
|
|
17
|
-
? `
|
|
18
|
-
L1 to L2 Message not found.
|
|
19
|
-
`
|
|
20
|
-
: `
|
|
21
|
-
L1 to L2 message index: ${messageWitness[0]}
|
|
22
|
-
L1 to L2 message sibling path: ${messageWitness[1]}
|
|
23
|
-
`,
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
export async function getPXEInfo(rpcUrl: string, debugLogger: Logger, log: LogFn) {
|
|
5
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
6
|
-
const info = await client.getPXEInfo();
|
|
7
|
-
log(`PXE Version: ${info.pxeVersion}`);
|
|
8
|
-
log(`Protocol Contract Addresses:`);
|
|
9
|
-
log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
|
|
10
|
-
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
|
11
|
-
log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
|
|
12
|
-
log(` Multi Call Entrypoint: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
|
|
13
|
-
}
|
package/src/cmds/pxe/index.ts
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
import type { Command } from 'commander';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
logJson,
|
|
8
|
-
makePxeOption,
|
|
9
|
-
parseAztecAddress,
|
|
10
|
-
parseEthereumAddress,
|
|
11
|
-
parseField,
|
|
12
|
-
parseFieldFromHexString,
|
|
13
|
-
parseOptionalAztecAddress,
|
|
14
|
-
parseOptionalInteger,
|
|
15
|
-
parseOptionalLogId,
|
|
16
|
-
parseOptionalTxHash,
|
|
17
|
-
parsePublicKey,
|
|
18
|
-
pxeOption,
|
|
19
|
-
} from '../../utils/commands.js';
|
|
20
|
-
|
|
21
|
-
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
22
|
-
program
|
|
23
|
-
.command('add-contract')
|
|
24
|
-
.description(
|
|
25
|
-
'Adds an existing contract to the PXE. This is useful if you have deployed a contract outside of the PXE and want to use it with the PXE.',
|
|
26
|
-
)
|
|
27
|
-
.requiredOption(
|
|
28
|
-
'-c, --contract-artifact <fileLocation>',
|
|
29
|
-
"A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts.js",
|
|
30
|
-
)
|
|
31
|
-
.requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
|
|
32
|
-
.requiredOption('--init-hash <init hash>', 'Initialization hash', parseFieldFromHexString)
|
|
33
|
-
.option('--salt <salt>', 'Optional deployment salt', parseFieldFromHexString)
|
|
34
|
-
.option('-p, --public-key <public key>', 'Optional public key for this contract', parsePublicKey)
|
|
35
|
-
.option('--portal-address <address>', 'Optional address to a portal contract on L1', parseEthereumAddress)
|
|
36
|
-
.option('--deployer-address <address>', 'Optional address of the contract deployer', parseAztecAddress)
|
|
37
|
-
.addOption(pxeOption)
|
|
38
|
-
.action(async options => {
|
|
39
|
-
const { addContract } = await import('./add_contract.js');
|
|
40
|
-
await addContract(
|
|
41
|
-
options.rpcUrl,
|
|
42
|
-
options.contractArtifact,
|
|
43
|
-
options.contractAddress,
|
|
44
|
-
options.initHash,
|
|
45
|
-
options.salt ?? Fr.ZERO,
|
|
46
|
-
options.publicKey,
|
|
47
|
-
options.deployerAddress,
|
|
48
|
-
debugLogger,
|
|
49
|
-
log,
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
program
|
|
54
|
-
.command('get-block')
|
|
55
|
-
.description('Gets info for a given block or latest.')
|
|
56
|
-
.argument('[blockNumber]', 'Block height', parseOptionalInteger)
|
|
57
|
-
.addOption(pxeOption)
|
|
58
|
-
.action(async (blockNumber, options) => {
|
|
59
|
-
const { getBlock } = await import('./get_block.js');
|
|
60
|
-
await getBlock(options.rpcUrl, blockNumber, debugLogger, log);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
program
|
|
64
|
-
.command('get-current-base-fee')
|
|
65
|
-
.description('Gets the current base fee.')
|
|
66
|
-
.addOption(pxeOption)
|
|
67
|
-
.action(async options => {
|
|
68
|
-
const { getCurrentBaseFee } = await import('./get_current_base_fee.js');
|
|
69
|
-
await getCurrentBaseFee(options.rpcUrl, debugLogger, log);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
program
|
|
73
|
-
.command('get-contract-data')
|
|
74
|
-
.description('Gets information about the Aztec contract deployed at the specified address.')
|
|
75
|
-
.argument('<contractAddress>', 'Aztec address of the contract.', parseAztecAddress)
|
|
76
|
-
.addOption(pxeOption)
|
|
77
|
-
.option('-b, --include-bytecode <boolean>', "Include the contract's public function bytecode, if any.", false)
|
|
78
|
-
.action(async (contractAddress, options) => {
|
|
79
|
-
const { getContractData } = await import('./get_contract_data.js');
|
|
80
|
-
await getContractData(options.rpcUrl, contractAddress, options.includeBytecode, debugLogger, log);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
program
|
|
84
|
-
.command('get-logs')
|
|
85
|
-
.description('Gets all the public logs from an intersection of all the filter params.')
|
|
86
|
-
.option('-tx, --tx-hash <txHash>', 'A transaction hash to get the receipt for.', parseOptionalTxHash)
|
|
87
|
-
.option(
|
|
88
|
-
'-fb, --from-block <blockNum>',
|
|
89
|
-
'Initial block number for getting logs (defaults to 1).',
|
|
90
|
-
parseOptionalInteger,
|
|
91
|
-
)
|
|
92
|
-
.option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
|
|
93
|
-
.option('-al --after-log <logId>', 'ID of a log after which to fetch the logs.', parseOptionalLogId)
|
|
94
|
-
.option('-ca, --contract-address <address>', 'Contract address to filter logs by.', parseOptionalAztecAddress)
|
|
95
|
-
.addOption(pxeOption)
|
|
96
|
-
.option('--follow', 'If set, will keep polling for new logs until interrupted.')
|
|
97
|
-
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, rpcUrl, follow }) => {
|
|
98
|
-
const { getLogs } = await import('./get_logs.js');
|
|
99
|
-
await getLogs(txHash, fromBlock, toBlock, afterLog, contractAddress, rpcUrl, follow, debugLogger, log);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
program
|
|
103
|
-
.command('get-accounts')
|
|
104
|
-
.description('Gets all the Aztec accounts stored in the PXE.')
|
|
105
|
-
.addOption(pxeOption)
|
|
106
|
-
.option('--json', 'Emit output as json')
|
|
107
|
-
.action(async (options: any) => {
|
|
108
|
-
const { getAccounts } = await import('./get_accounts.js');
|
|
109
|
-
await getAccounts(options.rpcUrl, options.json, debugLogger, log, logJson(log));
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
program
|
|
113
|
-
.command('get-account')
|
|
114
|
-
.description('Gets an account given its Aztec address.')
|
|
115
|
-
.argument('<address>', 'The Aztec address to get account for', parseAztecAddress)
|
|
116
|
-
.addOption(pxeOption)
|
|
117
|
-
.action(async (address, options) => {
|
|
118
|
-
const { getAccount } = await import('./get_account.js');
|
|
119
|
-
await getAccount(address, options.rpcUrl, debugLogger, log);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
program
|
|
123
|
-
.command('block-number')
|
|
124
|
-
.description('Gets the current Aztec L2 block number.')
|
|
125
|
-
.addOption(pxeOption)
|
|
126
|
-
.action(async (options: any) => {
|
|
127
|
-
const { blockNumber } = await import('./block_number.js');
|
|
128
|
-
await blockNumber(options.rpcUrl, debugLogger, log);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
program
|
|
132
|
-
.command('get-l1-to-l2-message-witness')
|
|
133
|
-
.description('Gets a L1 to L2 message witness.')
|
|
134
|
-
.requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
|
|
135
|
-
.requiredOption('--message-hash <messageHash>', 'The L1 to L2 message hash.', parseField)
|
|
136
|
-
.requiredOption('--secret <secret>', 'The secret used to claim the L1 to L2 message', parseField)
|
|
137
|
-
.addOption(pxeOption)
|
|
138
|
-
.action(async ({ contractAddress, messageHash, secret, rpcUrl }) => {
|
|
139
|
-
const { getL1ToL2MessageWitness } = await import('./get_l1_to_l2_message_witness.js');
|
|
140
|
-
await getL1ToL2MessageWitness(rpcUrl, contractAddress, messageHash, secret, debugLogger, log);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
program
|
|
144
|
-
.command('get-node-info')
|
|
145
|
-
.description('Gets the information of an Aztec node from a PXE or directly from an Aztec node.')
|
|
146
|
-
.option('--node-url <string>', 'URL of the node.')
|
|
147
|
-
.option('--json', 'Emit output as json')
|
|
148
|
-
.addOption(makePxeOption(false))
|
|
149
|
-
.action(async options => {
|
|
150
|
-
const { getNodeInfo } = await import('./get_node_info.js');
|
|
151
|
-
let url: string;
|
|
152
|
-
if (options.nodeUrl) {
|
|
153
|
-
url = options.nodeUrl;
|
|
154
|
-
} else {
|
|
155
|
-
url = options.rpcUrl;
|
|
156
|
-
}
|
|
157
|
-
await getNodeInfo(url, !options.nodeUrl, debugLogger, options.json, log, logJson(log));
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
program
|
|
161
|
-
.command('get-pxe-info')
|
|
162
|
-
.description('Gets the information of a PXE at a URL.')
|
|
163
|
-
.addOption(pxeOption)
|
|
164
|
-
.action(async options => {
|
|
165
|
-
const { getPXEInfo } = await import('./get_pxe_info.js');
|
|
166
|
-
await getPXEInfo(options.rpcUrl, debugLogger, log);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
return program;
|
|
170
|
-
}
|