@aztec/cli 0.0.0-test.1 → 0.0.1-commit.b655e406
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 +1 -427
- 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 +9 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_base_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 +6 -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 +14 -15
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +28 -0
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +9 -5
- package/dest/cmds/infrastructure/index.d.ts +2 -2
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +8 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +4 -4
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +29 -16
- 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 +11 -24
- package/dest/cmds/l1/advance_epoch.d.ts +1 -1
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
- package/dest/cmds/l1/advance_epoch.js +8 -6
- package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +9 -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 +5 -5
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +2 -2
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +23 -6
- package/dest/cmds/l1/deploy_new_rollup.d.ts +2 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +17 -8
- package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +17 -17
- package/dest/cmds/l1/index.d.ts +1 -0
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +33 -43
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
- package/dest/cmds/l1/trigger_seed_snapshot.js +19 -0
- package/dest/cmds/l1/update_l1_validators.d.ts +17 -2
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +159 -103
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +3 -3
- package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
- 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 +3 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
- package/dest/cmds/misc/index.d.ts.map +1 -1
- package/dest/cmds/misc/index.js +7 -3
- package/dest/cmds/misc/update/github.d.ts +0 -1
- package/dest/cmds/misc/update/github.d.ts.map +1 -1
- package/dest/cmds/misc/update/github.js +0 -1
- package/dest/cmds/misc/update.d.ts.map +1 -1
- package/dest/cmds/misc/update.js +2 -3
- 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 +70 -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 +26 -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 +20 -0
- package/dest/cmds/validator_keys/new.d.ts +26 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +60 -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 +271 -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 +39 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +475 -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 +8 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +22 -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 +19 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +79 -0
- package/dest/utils/aztec.d.ts +12 -17
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +54 -49
- package/dest/utils/commands.d.ts +17 -9
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +40 -14
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +0 -1
- package/dest/utils/github.d.ts.map +1 -1
- package/dest/utils/github.js +0 -1
- package/dest/utils/index.d.ts +1 -0
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -0
- package/dest/utils/inspect.d.ts +3 -10
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +19 -109
- package/dest/utils/setup_contracts.d.ts +3 -0
- package/dest/utils/setup_contracts.d.ts.map +1 -0
- package/dest/utils/setup_contracts.js +16 -0
- package/package.json +44 -33
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +10 -0
- package/src/cmds/aztec_node/get_current_base_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 +8 -7
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +15 -23
- package/src/cmds/aztec_node/index.ts +87 -0
- package/src/cmds/contracts/inspect_contract.ts +16 -6
- package/src/cmds/infrastructure/index.ts +8 -10
- package/src/cmds/infrastructure/sequencers.ts +36 -19
- package/src/cmds/infrastructure/setup_l2_contract.ts +13 -25
- package/src/cmds/l1/advance_epoch.ts +7 -5
- package/src/cmds/l1/assume_proven_through.ts +8 -7
- package/src/cmds/l1/bridge_erc20.ts +7 -4
- package/src/cmds/l1/deploy_l1_contracts.ts +32 -7
- package/src/cmds/l1/deploy_new_rollup.ts +23 -9
- package/src/cmds/l1/get_l1_addresses.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +18 -17
- package/src/cmds/l1/index.ts +74 -101
- package/src/cmds/l1/trigger_seed_snapshot.ts +31 -0
- package/src/cmds/l1/update_l1_validators.ts +194 -94
- package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
- package/src/cmds/misc/generate_secret_and_hash.ts +3 -3
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
- package/src/cmds/misc/index.ts +13 -4
- package/src/cmds/misc/update/github.ts +0 -1
- package/src/cmds/misc/update.ts +1 -7
- package/src/cmds/validator_keys/add.ts +113 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +33 -0
- package/src/cmds/validator_keys/index.ts +96 -0
- package/src/cmds/validator_keys/new.ts +120 -0
- package/src/cmds/validator_keys/shared.ts +321 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +627 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/get_l1_config.ts +28 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +102 -0
- package/src/utils/aztec.ts +78 -65
- package/src/utils/commands.ts +54 -18
- package/src/utils/encoding.ts +1 -1
- package/src/utils/github.ts +0 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/inspect.ts +23 -123
- package/src/utils/setup_contracts.ts +19 -0
- 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 -196
- 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.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
- package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
- package/dest/cmds/misc/setup_contracts.d.ts +0 -7
- package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
- package/dest/cmds/misc/setup_contracts.js +0 -27
- 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 -318
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
- package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
- package/src/cmds/misc/setup_contracts.ts +0 -40
- 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
- /package/dest/cmds/{devnet → aztec_node}/index.d.ts +0 -0
package/dest/utils/aztec.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
1
|
+
import { type ContractArtifact, type FunctionAbi } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type DeployL1ContractsReturnType, type L1ContractsConfig, type Operator, RollupContract } from '@aztec/ethereum';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
6
6
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
7
7
|
/**
|
|
@@ -10,7 +10,7 @@ import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
|
10
10
|
* @param fnName - Function name to be found.
|
|
11
11
|
* @returns The function's ABI.
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getFunctionAbi(artifact: ContractArtifact, fnName: string): FunctionAbi;
|
|
14
14
|
/**
|
|
15
15
|
* Function to execute the 'deployRollupContracts' command.
|
|
16
16
|
* @param rpcUrls - The RPC URL of the ethereum node.
|
|
@@ -18,10 +18,10 @@ export declare function getFunctionArtifact(artifact: ContractArtifact, fnName:
|
|
|
18
18
|
* @param privateKey - The private key to be used in contract deployment.
|
|
19
19
|
* @param mnemonic - The mnemonic to be used in contract deployment.
|
|
20
20
|
*/
|
|
21
|
-
export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators:
|
|
22
|
-
export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators:
|
|
23
|
-
payloadAddress: EthAddress;
|
|
21
|
+
export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, acceleratedTestDeployments: boolean, config: L1ContractsConfig, existingToken: EthAddress | undefined, realVerifier: boolean, createVerificationJson: string | false, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
|
|
22
|
+
export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, config: L1ContractsConfig, realVerifier: boolean, createVerificationJson: string | false, logger: Logger): Promise<{
|
|
24
23
|
rollup: RollupContract;
|
|
24
|
+
slashFactoryAddress: EthAddress;
|
|
25
25
|
}>;
|
|
26
26
|
/**
|
|
27
27
|
* Gets all contracts available in \@aztec/noir-contracts.js.
|
|
@@ -54,15 +54,10 @@ export declare function prepTx(contractFile: string, functionName: string, _func
|
|
|
54
54
|
*/
|
|
55
55
|
export declare const stripLeadingHex: (hex: string) => string;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @param
|
|
59
|
-
* @returns
|
|
57
|
+
* Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
|
|
58
|
+
* @param hex - A hex string
|
|
59
|
+
* @returns A new string with leading 0x added
|
|
60
60
|
*/
|
|
61
|
+
export declare const addLeadingHex: (hex: string) => `0x${string}`;
|
|
61
62
|
export declare function prettyPrintNargoToml(config: NoirPackageConfig): string;
|
|
62
|
-
/**
|
|
63
|
-
* Checks that Private eXecution Environment (PXE) version matches the expected one by this CLI. Throws if not.
|
|
64
|
-
* @param pxe - PXE client.
|
|
65
|
-
* @param expectedVersionRange - Expected version by CLI.
|
|
66
|
-
*/
|
|
67
|
-
export declare function checkServerVersion(pxe: PXE, expectedVersionRange: string): Promise<void>;
|
|
68
63
|
//# sourceMappingURL=aztec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAQhE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAMtF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,0BAA0B,EAAE,OAAO,EACnC,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,UAAU,GAAG,SAAS,EACrC,YAAY,EAAE,OAAO,EACrB,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,2BAA2B,CAAC,CAiCtC;AAED,wBAAsB,wBAAwB,CAC5C,eAAe,EAAE,UAAU,EAC3B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,EAAE,EAAE,EACtB,4BAA4B,EAAE,MAAM,EACpC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,OAAO,EACrB,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,mBAAmB,EAAE,UAAU,CAAA;CAAE,CAAC,CA8CtE;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAKjE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,6BA4BpE;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK;;;;GAO3G;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,MAK7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,KAAK,MAAM,EAKtD,CAAC;AAOF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE"}
|
package/dest/utils/aztec.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { FunctionType, getAllFunctionAbis, loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
6
|
import TOML from '@iarna/toml';
|
|
5
7
|
import { readFile } from 'fs/promises';
|
|
6
|
-
import { gtr, ltr, satisfies, valid } from 'semver';
|
|
7
8
|
import { encodeArgs } from './encoding.js';
|
|
8
9
|
/**
|
|
9
10
|
* Helper to get an ABI function or throw error if it doesn't exist.
|
|
10
11
|
* @param artifact - Contract's build artifact in JSON format.
|
|
11
12
|
* @param fnName - Function name to be found.
|
|
12
13
|
* @returns The function's ABI.
|
|
13
|
-
*/ export function
|
|
14
|
-
const fn = artifact.
|
|
14
|
+
*/ export function getFunctionAbi(artifact, fnName) {
|
|
15
|
+
const fn = getAllFunctionAbis(artifact).find(({ name })=>name === fnName);
|
|
15
16
|
if (!fn) {
|
|
16
17
|
throw Error(`Function ${fnName} not found in contract ABI.`);
|
|
17
18
|
}
|
|
@@ -23,48 +24,66 @@ import { encodeArgs } from './encoding.js';
|
|
|
23
24
|
* @param chainId - The chain ID of the L1 host.
|
|
24
25
|
* @param privateKey - The private key to be used in contract deployment.
|
|
25
26
|
* @param mnemonic - The mnemonic to be used in contract deployment.
|
|
26
|
-
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot,
|
|
27
|
+
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, existingToken, realVerifier, createVerificationJson, debugLogger) {
|
|
27
28
|
const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
|
|
28
29
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
29
30
|
const account = !privateKey ? mnemonicToAccount(mnemonic, {
|
|
30
31
|
addressIndex: mnemonicIndex
|
|
31
|
-
}) : privateKeyToAccount(
|
|
32
|
+
}) : privateKeyToAccount(addLeadingHex(privateKey));
|
|
32
33
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
33
34
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
34
|
-
|
|
35
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
35
|
+
const result = await deployL1Contracts(chain.rpcUrls, account, chain.chainInfo, debugLogger, {
|
|
36
36
|
vkTreeRoot: getVKTreeRoot(),
|
|
37
|
-
|
|
37
|
+
protocolContractsHash,
|
|
38
38
|
genesisArchiveRoot,
|
|
39
|
-
genesisBlockHash,
|
|
40
39
|
salt,
|
|
41
40
|
initialValidators,
|
|
42
41
|
acceleratedTestDeployments,
|
|
42
|
+
feeJuicePortalInitialBalance,
|
|
43
|
+
realVerifier,
|
|
44
|
+
existingTokenAddress: existingToken,
|
|
43
45
|
...config
|
|
44
|
-
}, config);
|
|
46
|
+
}, config, createVerificationJson);
|
|
47
|
+
return result;
|
|
45
48
|
}
|
|
46
|
-
export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot,
|
|
47
|
-
const { createEthereumChain,
|
|
49
|
+
export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, config, realVerifier, createVerificationJson, logger) {
|
|
50
|
+
const { createEthereumChain, deployRollupForUpgrade, createExtendedL1Client } = await import('@aztec/ethereum');
|
|
48
51
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
49
52
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
50
53
|
const account = !privateKey ? mnemonicToAccount(mnemonic, {
|
|
51
54
|
addressIndex: mnemonicIndex
|
|
52
|
-
}) : privateKeyToAccount(
|
|
55
|
+
}) : privateKeyToAccount(addLeadingHex(privateKey));
|
|
53
56
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
54
|
-
const
|
|
55
|
-
|
|
57
|
+
const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
|
|
58
|
+
if (!initialValidators || initialValidators.length === 0) {
|
|
59
|
+
// initialize the new rollup with Amin's validator address.
|
|
60
|
+
const aminAddressString = '0x3b218d0F26d15B36C715cB06c949210a0d630637';
|
|
61
|
+
const amin = EthAddress.fromString(aminAddressString);
|
|
62
|
+
initialValidators = [
|
|
63
|
+
{
|
|
64
|
+
attester: amin,
|
|
65
|
+
withdrawer: amin,
|
|
66
|
+
// No secrets here. The actual keys are not currently used.
|
|
67
|
+
bn254SecretKey: new SecretValue(Fr.fromHexString(aminAddressString).toBigInt())
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
logger.info('Initializing new rollup with old attesters', {
|
|
71
|
+
initialValidators
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(client, {
|
|
56
75
|
salt,
|
|
57
76
|
vkTreeRoot: getVKTreeRoot(),
|
|
58
|
-
|
|
59
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
77
|
+
protocolContractsHash,
|
|
60
78
|
genesisArchiveRoot,
|
|
61
|
-
genesisBlockHash,
|
|
62
79
|
initialValidators,
|
|
80
|
+
feeJuicePortalInitialBalance,
|
|
81
|
+
realVerifier,
|
|
63
82
|
...config
|
|
64
|
-
}, registryAddress, logger, config);
|
|
83
|
+
}, registryAddress, logger, config, createVerificationJson);
|
|
65
84
|
return {
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
rollup,
|
|
86
|
+
slashFactoryAddress
|
|
68
87
|
};
|
|
69
88
|
}
|
|
70
89
|
/**
|
|
@@ -116,7 +135,7 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
116
135
|
* @returns Formatted contract address, function arguments and caller's aztec address.
|
|
117
136
|
*/ export async function prepTx(contractFile, functionName, _functionArgs, log) {
|
|
118
137
|
const contractArtifact = await getContractArtifact(contractFile, log);
|
|
119
|
-
const functionArtifact =
|
|
138
|
+
const functionArtifact = getFunctionAbi(contractArtifact, functionName);
|
|
120
139
|
const functionArgs = encodeArgs(_functionArgs, functionArtifact.parameters);
|
|
121
140
|
const isPrivate = functionArtifact.functionType === FunctionType.PRIVATE;
|
|
122
141
|
return {
|
|
@@ -136,6 +155,16 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
136
155
|
return hex;
|
|
137
156
|
};
|
|
138
157
|
/**
|
|
158
|
+
* Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
|
|
159
|
+
* @param hex - A hex string
|
|
160
|
+
* @returns A new string with leading 0x added
|
|
161
|
+
*/ export const addLeadingHex = (hex)=>{
|
|
162
|
+
if (hex.length > 2 && hex.startsWith('0x')) {
|
|
163
|
+
return hex;
|
|
164
|
+
}
|
|
165
|
+
return `0x${hex}`;
|
|
166
|
+
};
|
|
167
|
+
/*
|
|
139
168
|
* Pretty prints Nargo.toml contents to a string
|
|
140
169
|
* @param config - Nargo.toml contents
|
|
141
170
|
* @returns The Nargo.toml contents as a string
|
|
@@ -148,27 +177,3 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
148
177
|
});
|
|
149
178
|
return partialToml + '\n[dependencies]\n' + dependenciesToml.join('\n') + '\n';
|
|
150
179
|
}
|
|
151
|
-
/** Mismatch between server and client versions. */ class VersionMismatchError extends Error {
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Checks that Private eXecution Environment (PXE) version matches the expected one by this CLI. Throws if not.
|
|
155
|
-
* @param pxe - PXE client.
|
|
156
|
-
* @param expectedVersionRange - Expected version by CLI.
|
|
157
|
-
*/ export async function checkServerVersion(pxe, expectedVersionRange) {
|
|
158
|
-
const serverName = 'Aztec Node';
|
|
159
|
-
const { nodeVersion } = await pxe.getNodeInfo();
|
|
160
|
-
if (!nodeVersion) {
|
|
161
|
-
throw new VersionMismatchError(`Couldn't determine ${serverName} version. You may run into issues.`);
|
|
162
|
-
}
|
|
163
|
-
if (!nodeVersion || !valid(nodeVersion)) {
|
|
164
|
-
throw new VersionMismatchError(`Missing or invalid version identifier for ${serverName} (${nodeVersion ?? 'empty'}).`);
|
|
165
|
-
} else if (!satisfies(nodeVersion, expectedVersionRange)) {
|
|
166
|
-
if (gtr(nodeVersion, expectedVersionRange)) {
|
|
167
|
-
throw new VersionMismatchError(`${serverName} is running version ${nodeVersion} which is newer than the expected by this CLI (${expectedVersionRange}). Consider upgrading your CLI to a newer version.`);
|
|
168
|
-
} else if (ltr(nodeVersion, expectedVersionRange)) {
|
|
169
|
-
throw new VersionMismatchError(`${serverName} is running version ${nodeVersion} which is older than the expected by this CLI (${expectedVersionRange}). Consider upgrading your ${serverName} to a newer version.`);
|
|
170
|
-
} else {
|
|
171
|
-
throw new VersionMismatchError(`${serverName} is running version ${nodeVersion} which does not match the expected by this CLI (${expectedVersionRange}).`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
package/dest/utils/commands.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { FunctionSelector } from '@aztec/aztec.js/abi';
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { EthAddress } from '@aztec/aztec.js/eth_address';
|
|
2
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
-
import { LogId } from '@aztec/aztec.js/
|
|
6
|
-
import { TxHash } from '@aztec/aztec.js/
|
|
4
|
+
import { LogId } from '@aztec/aztec.js/log';
|
|
5
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
7
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
|
-
import type { PXE } from '@aztec/
|
|
7
|
+
import type { PXE } from '@aztec/pxe/server';
|
|
9
8
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
10
9
|
import { type Command, Option } from 'commander';
|
|
11
10
|
/**
|
|
@@ -14,10 +13,10 @@ import { type Command, Option } from 'commander';
|
|
|
14
13
|
*/
|
|
15
14
|
export declare const getLocalhost: () => Promise<string>;
|
|
16
15
|
export declare const LOCALHOST: string;
|
|
17
|
-
export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
|
|
16
|
+
export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, MNEMONIC: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
|
|
18
17
|
export declare function addOptions(program: Command, options: Option[]): Command;
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
18
|
+
export declare const makeNodeOption: (mandatory: boolean) => Option;
|
|
19
|
+
export declare const nodeOption: Option;
|
|
21
20
|
export declare const l1ChainIdOption: Option;
|
|
22
21
|
export declare const createSecretKeyOption: (description: string, mandatory: boolean, argsParser?: (value: string, previous: Fr) => Fr) => Option;
|
|
23
22
|
export declare const logJson: (log: LogFn) => (obj: object) => void;
|
|
@@ -35,6 +34,15 @@ export declare function atomicUpdateFile(filePath: string, contents: string): Pr
|
|
|
35
34
|
* @returns An Aztec address. Will throw if one can't be found in either options.
|
|
36
35
|
*/
|
|
37
36
|
export declare function getTxSender(pxe: PXE, _from?: string): Promise<AztecAddress>;
|
|
37
|
+
/**
|
|
38
|
+
* Parses and validates a hex string. Removes leading 0x if present, checks for hex validity,
|
|
39
|
+
* and enforces an optional minimum length.
|
|
40
|
+
* @param hex - The hex string to validate.
|
|
41
|
+
* @param minLen - Optional minimum length (in hex characters, after stripping '0x').
|
|
42
|
+
* @returns The normalized hex string (without leading 0x).
|
|
43
|
+
* @throws InvalidArgumentError if the string is not valid hex or does not meet the minimum length.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseHex(hex: string, minLen?: number): `0x${string}`;
|
|
38
46
|
export declare function parseBigint(bigint: string): bigint | undefined;
|
|
39
47
|
/**
|
|
40
48
|
* Parses a hex encoded string to an Fr integer
|
|
@@ -84,7 +92,7 @@ export declare function parseOptionalSelector(selector: string): FunctionSelecto
|
|
|
84
92
|
* @returns The parsed integer, or undefined if the input string is falsy.
|
|
85
93
|
* @throws If the input is not a valid integer.
|
|
86
94
|
*/
|
|
87
|
-
export declare function parseOptionalInteger(value: string): number | undefined;
|
|
95
|
+
export declare function parseOptionalInteger(value: string, min?: number, max?: number): number | undefined;
|
|
88
96
|
/**
|
|
89
97
|
* Parses a TxHash from a string.
|
|
90
98
|
* @param txHash - A transaction hash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":"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"}
|
package/dest/utils/commands.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FunctionSelector } from '@aztec/aztec.js/abi';
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { EthAddress } from '@aztec/aztec.js/eth_address';
|
|
2
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
-
import { LogId } from '@aztec/aztec.js/
|
|
6
|
-
import { TxHash } from '@aztec/aztec.js/
|
|
4
|
+
import { LogId } from '@aztec/aztec.js/log';
|
|
5
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
7
6
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
8
7
|
import { CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
9
8
|
import { lookup } from 'dns/promises';
|
|
@@ -13,13 +12,13 @@ import { rename, writeFile } from 'fs/promises';
|
|
|
13
12
|
* localhost as being host.docker.internal.
|
|
14
13
|
*/ export const getLocalhost = ()=>lookup('host.docker.internal').then(()=>'host.docker.internal').catch(()=>'localhost');
|
|
15
14
|
export const LOCALHOST = await getLocalhost();
|
|
16
|
-
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, API_KEY, CLI_VERSION } = process.env;
|
|
15
|
+
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, MNEMONIC, API_KEY, CLI_VERSION } = process.env;
|
|
17
16
|
export function addOptions(program, options) {
|
|
18
17
|
options.forEach((option)=>program.addOption(option));
|
|
19
18
|
return program;
|
|
20
19
|
}
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
20
|
+
export const makeNodeOption = (mandatory)=>new Option('-n, --node-url <string>', 'URL of the Aztec node').env('AZTEC_NODE_URL').default(`http://${LOCALHOST}:8080`).makeOptionMandatory(mandatory);
|
|
21
|
+
export const nodeOption = makeNodeOption(true);
|
|
23
22
|
export const l1ChainIdOption = new Option('-c, --l1-chain-id <number>', 'Chain ID of the ethereum host').env('L1_CHAIN_ID').default(31337).argParser((value)=>{
|
|
24
23
|
const parsedValue = Number(value);
|
|
25
24
|
if (isNaN(parsedValue)) {
|
|
@@ -74,6 +73,27 @@ export const logJson = (log)=>(obj)=>log(JSON.stringify(obj, null, 2));
|
|
|
74
73
|
}
|
|
75
74
|
return from;
|
|
76
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Parses and validates a hex string. Removes leading 0x if present, checks for hex validity,
|
|
78
|
+
* and enforces an optional minimum length.
|
|
79
|
+
* @param hex - The hex string to validate.
|
|
80
|
+
* @param minLen - Optional minimum length (in hex characters, after stripping '0x').
|
|
81
|
+
* @returns The normalized hex string (without leading 0x).
|
|
82
|
+
* @throws InvalidArgumentError if the string is not valid hex or does not meet the minimum length.
|
|
83
|
+
*/ // minLen is now interpreted as the minimum number of bytes (2 hex characters per byte)
|
|
84
|
+
export function parseHex(hex, minLen) {
|
|
85
|
+
const normalized = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
86
|
+
if (!/^[0-9a-fA-F]*$/.test(normalized)) {
|
|
87
|
+
throw new InvalidArgumentError('Invalid hex string');
|
|
88
|
+
}
|
|
89
|
+
if (minLen !== undefined) {
|
|
90
|
+
const minHexLen = minLen * 2;
|
|
91
|
+
if (normalized.length < minHexLen) {
|
|
92
|
+
throw new InvalidArgumentError(`Hex string is too short (length ${normalized.length}), minimum byte length is ${minLen} (hex chars: ${minHexLen})`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return `0x${normalized}`;
|
|
96
|
+
}
|
|
77
97
|
/**
|
|
78
98
|
* Removes the leading 0x from a hex string. If no leading 0x is found the string is returned unchanged.
|
|
79
99
|
* @param hex - A hex string
|
|
@@ -118,7 +138,7 @@ export function parseBigint(bigint) {
|
|
|
118
138
|
try {
|
|
119
139
|
return AztecAddress.fromString(address);
|
|
120
140
|
} catch {
|
|
121
|
-
throw new InvalidArgumentError(`Invalid address: ${address}`);
|
|
141
|
+
throw new InvalidArgumentError(`Invalid Aztec address: ${address}`);
|
|
122
142
|
}
|
|
123
143
|
}
|
|
124
144
|
/**
|
|
@@ -130,7 +150,7 @@ export function parseBigint(bigint) {
|
|
|
130
150
|
try {
|
|
131
151
|
return EthAddress.fromString(address);
|
|
132
152
|
} catch {
|
|
133
|
-
throw new InvalidArgumentError(`Invalid
|
|
153
|
+
throw new InvalidArgumentError(`Invalid Ethereumaddress: ${address}`);
|
|
134
154
|
}
|
|
135
155
|
}
|
|
136
156
|
/**
|
|
@@ -176,7 +196,7 @@ export function parseBigint(bigint) {
|
|
|
176
196
|
* @param value - The string to parse into an integer.
|
|
177
197
|
* @returns The parsed integer, or undefined if the input string is falsy.
|
|
178
198
|
* @throws If the input is not a valid integer.
|
|
179
|
-
*/ export function parseOptionalInteger(value) {
|
|
199
|
+
*/ export function parseOptionalInteger(value, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
180
200
|
if (!value) {
|
|
181
201
|
return undefined;
|
|
182
202
|
}
|
|
@@ -184,6 +204,12 @@ export function parseBigint(bigint) {
|
|
|
184
204
|
if (!Number.isInteger(parsed)) {
|
|
185
205
|
throw new InvalidArgumentError('Invalid integer.');
|
|
186
206
|
}
|
|
207
|
+
if (parsed < min) {
|
|
208
|
+
throw new InvalidArgumentError(`Value must be greater than ${min}.`);
|
|
209
|
+
}
|
|
210
|
+
if (parsed > max) {
|
|
211
|
+
throw new InvalidArgumentError(`Value must be less than ${max}.`);
|
|
212
|
+
}
|
|
187
213
|
return parsed;
|
|
188
214
|
}
|
|
189
215
|
/**
|
|
@@ -221,7 +247,7 @@ export function parseBigint(bigint) {
|
|
|
221
247
|
}
|
|
222
248
|
try {
|
|
223
249
|
return PublicKeys.fromString(publicKey);
|
|
224
|
-
} catch
|
|
250
|
+
} catch {
|
|
225
251
|
throw new InvalidArgumentError(`Invalid public key: ${publicKey}`);
|
|
226
252
|
}
|
|
227
253
|
}
|
|
@@ -233,7 +259,7 @@ export function parseBigint(bigint) {
|
|
|
233
259
|
*/ export function parsePartialAddress(address) {
|
|
234
260
|
try {
|
|
235
261
|
return Fr.fromHexString(address);
|
|
236
|
-
} catch
|
|
262
|
+
} catch {
|
|
237
263
|
throw new InvalidArgumentError(`Invalid partial address: ${address}`);
|
|
238
264
|
}
|
|
239
265
|
}
|
|
@@ -245,7 +271,7 @@ export function parseBigint(bigint) {
|
|
|
245
271
|
*/ export function parseSecretKey(secretKey) {
|
|
246
272
|
try {
|
|
247
273
|
return Fr.fromHexString(secretKey);
|
|
248
|
-
} catch
|
|
274
|
+
} catch {
|
|
249
275
|
throw new InvalidArgumentError(`Invalid encryption secret key: ${secretKey}`);
|
|
250
276
|
}
|
|
251
277
|
}
|
|
@@ -275,7 +301,7 @@ export function parseBigint(bigint) {
|
|
|
275
301
|
return new Fr(BigInt(field.replace(/n$/, '')));
|
|
276
302
|
}
|
|
277
303
|
return new Fr(BigInt(field));
|
|
278
|
-
} catch
|
|
304
|
+
} catch {
|
|
279
305
|
throw new InvalidArgumentError(`Invalid field: ${field}`);
|
|
280
306
|
}
|
|
281
307
|
}
|
package/dest/utils/encoding.js
CHANGED
|
@@ -29,7 +29,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
29
29
|
let res;
|
|
30
30
|
try {
|
|
31
31
|
res = BigInt(arg);
|
|
32
|
-
} catch
|
|
32
|
+
} catch {
|
|
33
33
|
throw new Error(`Invalid value passed for ${name}. Could not parse ${arg} as a${kind === 'integer' ? 'n' : ''} ${kind}.`);
|
|
34
34
|
}
|
|
35
35
|
return res;
|
package/dest/utils/github.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAC5C,eAAO,MAAM,WAAW,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAC5C,eAAO,MAAM,WAAW,mBAAmB,CAAC"}
|
package/dest/utils/github.js
CHANGED
package/dest/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
package/dest/utils/index.js
CHANGED
package/dest/utils/inspect.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import type { ContractArtifact, Fr } from '@aztec/aztec.js';
|
|
2
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import type {
|
|
2
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
3
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
5
|
-
export declare function inspectBlock(
|
|
4
|
+
export declare function inspectBlock(aztecNode: AztecNode, blockNumber: number, log: LogFn, opts?: {
|
|
6
5
|
showTxs?: boolean;
|
|
7
6
|
}): Promise<void>;
|
|
8
|
-
export declare function inspectTx(
|
|
7
|
+
export declare function inspectTx(aztecNode: AztecNode, txHash: TxHash, log: LogFn, opts?: {
|
|
9
8
|
includeBlockInfo?: boolean;
|
|
10
|
-
artifactMap?: ArtifactMap;
|
|
11
9
|
}): Promise<void>;
|
|
12
|
-
type ArtifactMap = Record<string, ContractArtifactWithClassId>;
|
|
13
|
-
type ContractArtifactWithClassId = ContractArtifact & {
|
|
14
|
-
classId: Fr;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
17
10
|
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0BjC;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,iBAmE1C"}
|