@aztec/cli 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212
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_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 +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 +7 -4
- 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.d.ts +3 -3
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +6 -6
- package/dest/cmds/l1/deploy_new_rollup.d.ts +3 -3
- 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 +2 -1
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +1 -1
- 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 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +18 -34
- 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 +29 -29
- 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/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 +132 -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 +208 -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 +505 -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 +109 -0
- package/dest/utils/aztec.d.ts +8 -12
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +14 -35
- package/dest/utils/commands.d.ts +18 -10
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +35 -9
- 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 +40 -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_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 +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 +9 -8
- 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 +7 -4
- package/src/cmds/l1/deploy_new_rollup.ts +6 -3
- package/src/cmds/l1/get_l1_addresses.ts +4 -2
- package/src/cmds/l1/get_l1_balance.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/index.ts +25 -53
- package/src/cmds/l1/prover_stats.ts +38 -30
- 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/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 +80 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +669 -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 +140 -0
- package/src/utils/aztec.ts +17 -49
- package/src/utils/commands.ts +49 -13
- 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/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,321 +0,0 @@
|
|
|
1
|
-
import { getInitialTestAccountsManagers } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
3
|
-
AztecAddress,
|
|
4
|
-
BatchCall,
|
|
5
|
-
EthAddress,
|
|
6
|
-
Fr,
|
|
7
|
-
L1FeeJuicePortalManager,
|
|
8
|
-
type PXE,
|
|
9
|
-
type WaitForProvenOpts,
|
|
10
|
-
type WaitOpts,
|
|
11
|
-
type Wallet,
|
|
12
|
-
createCompatibleClient,
|
|
13
|
-
retryUntil,
|
|
14
|
-
waitForProven,
|
|
15
|
-
} from '@aztec/aztec.js';
|
|
16
|
-
import {
|
|
17
|
-
type ContractArtifacts,
|
|
18
|
-
type ExtendedViemWalletClient,
|
|
19
|
-
createEthereumChain,
|
|
20
|
-
createExtendedL1Client,
|
|
21
|
-
deployL1Contract,
|
|
22
|
-
} from '@aztec/ethereum';
|
|
23
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
24
|
-
|
|
25
|
-
import { getContract } from 'viem';
|
|
26
|
-
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
27
|
-
|
|
28
|
-
type ContractDeploymentInfo = {
|
|
29
|
-
address: AztecAddress;
|
|
30
|
-
initHash: Fr;
|
|
31
|
-
salt: Fr;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const waitOpts: WaitOpts = {
|
|
35
|
-
timeout: 120,
|
|
36
|
-
interval: 1,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const provenWaitOpts: WaitForProvenOpts = {
|
|
40
|
-
provenTimeout: 4800,
|
|
41
|
-
interval: 1,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export async function bootstrapNetwork(
|
|
45
|
-
pxeUrl: string,
|
|
46
|
-
l1Urls: string[],
|
|
47
|
-
l1ChainId: string,
|
|
48
|
-
l1PrivateKey: `0x${string}` | undefined,
|
|
49
|
-
l1Mnemonic: string,
|
|
50
|
-
addressIndex: number,
|
|
51
|
-
json: boolean,
|
|
52
|
-
log: LogFn,
|
|
53
|
-
debugLog: Logger,
|
|
54
|
-
) {
|
|
55
|
-
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
56
|
-
|
|
57
|
-
// We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
|
|
58
|
-
// so all we need to do is register them to our pxe.
|
|
59
|
-
const [accountManager] = await getInitialTestAccountsManagers(pxe);
|
|
60
|
-
await accountManager.register();
|
|
61
|
-
|
|
62
|
-
const wallet = await accountManager.getWallet();
|
|
63
|
-
const defaultAccountAddress = wallet.getAddress();
|
|
64
|
-
|
|
65
|
-
const l1Client = createExtendedL1Client(
|
|
66
|
-
l1Urls,
|
|
67
|
-
l1PrivateKey
|
|
68
|
-
? privateKeyToAccount(l1PrivateKey)
|
|
69
|
-
: // We need to use a different account that the main "deployer" account because the "deployer" account creates transactions that send blobs.
|
|
70
|
-
// Note that this account needs to be funded on L1 !
|
|
71
|
-
mnemonicToAccount(l1Mnemonic, { addressIndex }),
|
|
72
|
-
createEthereumChain(l1Urls, +l1ChainId).chainInfo,
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
76
|
-
|
|
77
|
-
const { token, bridge } = await deployToken(wallet, defaultAccountAddress, portalAddress);
|
|
78
|
-
|
|
79
|
-
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
80
|
-
|
|
81
|
-
const fpcAdmin = wallet.getAddress();
|
|
82
|
-
const fpc = await deployFPC(wallet, defaultAccountAddress, token.address, fpcAdmin);
|
|
83
|
-
|
|
84
|
-
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
85
|
-
|
|
86
|
-
await fundFPC(pxe, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
87
|
-
|
|
88
|
-
if (json) {
|
|
89
|
-
log(
|
|
90
|
-
JSON.stringify(
|
|
91
|
-
{
|
|
92
|
-
devCoinL1: erc20Address.toString(),
|
|
93
|
-
devCoinPortalL1: portalAddress.toString(),
|
|
94
|
-
devCoin: {
|
|
95
|
-
address: token.address.toString(),
|
|
96
|
-
initHash: token.initHash.toString(),
|
|
97
|
-
salt: token.salt.toString(),
|
|
98
|
-
},
|
|
99
|
-
devCoinBridge: {
|
|
100
|
-
address: bridge.address.toString(),
|
|
101
|
-
initHash: bridge.initHash.toString(),
|
|
102
|
-
salt: bridge.salt.toString(),
|
|
103
|
-
},
|
|
104
|
-
devCoinFpc: {
|
|
105
|
-
address: fpc.address.toString(),
|
|
106
|
-
initHash: fpc.initHash.toString(),
|
|
107
|
-
salt: fpc.salt.toString(),
|
|
108
|
-
},
|
|
109
|
-
counter: {
|
|
110
|
-
address: counter.address.toString(),
|
|
111
|
-
initHash: counter.initHash.toString(),
|
|
112
|
-
salt: counter.salt.toString(),
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
null,
|
|
116
|
-
2,
|
|
117
|
-
),
|
|
118
|
-
);
|
|
119
|
-
} else {
|
|
120
|
-
log(`DevCoin L1: ${erc20Address}`);
|
|
121
|
-
log(`DevCoin L1 Portal: ${portalAddress}`);
|
|
122
|
-
log(`DevCoin L2: ${token.address}`);
|
|
123
|
-
log(`DevCoin L2 init hash: ${token.initHash}`);
|
|
124
|
-
log(`DevCoin L2 salt: ${token.salt}`);
|
|
125
|
-
log(`DevCoin L2 Bridge: ${bridge.address}`);
|
|
126
|
-
log(`DevCoin L2 Bridge init hash: ${bridge.initHash}`);
|
|
127
|
-
log(`DevCoin L2 Bridge salt: ${bridge.salt}`);
|
|
128
|
-
log(`DevCoin FPC: ${fpc.address}`);
|
|
129
|
-
log(`DevCoin FPC init hash: ${fpc.initHash}`);
|
|
130
|
-
log(`DevCoin FPC salt: ${fpc.salt}`);
|
|
131
|
-
log(`Counter: ${counter.address}`);
|
|
132
|
-
log(`Counter init hash: ${counter.initHash}`);
|
|
133
|
-
log(`Counter salt: ${counter.salt}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Step 1. Deploy the L1 contracts, but don't initialize
|
|
139
|
-
*/
|
|
140
|
-
async function deployERC20(l1Client: ExtendedViemWalletClient) {
|
|
141
|
-
const { TestERC20Abi, TestERC20Bytecode, TokenPortalAbi, TokenPortalBytecode } = await import('@aztec/l1-artifacts');
|
|
142
|
-
|
|
143
|
-
const erc20: ContractArtifacts = {
|
|
144
|
-
name: 'TestERC20',
|
|
145
|
-
contractAbi: TestERC20Abi,
|
|
146
|
-
contractBytecode: TestERC20Bytecode,
|
|
147
|
-
};
|
|
148
|
-
const portal: ContractArtifacts = {
|
|
149
|
-
name: 'TokenPortal',
|
|
150
|
-
contractAbi: TokenPortalAbi,
|
|
151
|
-
contractBytecode: TokenPortalBytecode,
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const { address: erc20Address } = await deployL1Contract(l1Client, erc20.contractAbi, erc20.contractBytecode, [
|
|
155
|
-
'DevCoin',
|
|
156
|
-
'DEV',
|
|
157
|
-
l1Client.account.address,
|
|
158
|
-
]);
|
|
159
|
-
const { address: portalAddress } = await deployL1Contract(l1Client, portal.contractAbi, portal.contractBytecode);
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
erc20Address,
|
|
163
|
-
portalAddress,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Step 2. Deploy the L2 contracts
|
|
169
|
-
*/
|
|
170
|
-
async function deployToken(
|
|
171
|
-
wallet: Wallet,
|
|
172
|
-
defaultAccountAddress: AztecAddress,
|
|
173
|
-
l1Portal: EthAddress,
|
|
174
|
-
): Promise<{ token: ContractDeploymentInfo; bridge: ContractDeploymentInfo }> {
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
176
|
-
// @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
|
|
177
|
-
const { TokenContract } = await import('@aztec/noir-contracts.js/Token');
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
179
|
-
// @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
|
|
180
|
-
const { TokenBridgeContract } = await import('@aztec/noir-contracts.js/TokenBridge');
|
|
181
|
-
const devCoin = await TokenContract.deploy(wallet, defaultAccountAddress, 'DevCoin', 'DEV', 18)
|
|
182
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
183
|
-
.deployed(waitOpts);
|
|
184
|
-
const bridge = await TokenBridgeContract.deploy(wallet, devCoin.address, l1Portal)
|
|
185
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
186
|
-
.deployed(waitOpts);
|
|
187
|
-
|
|
188
|
-
await new BatchCall(wallet, [
|
|
189
|
-
devCoin.methods.set_minter(bridge.address, true),
|
|
190
|
-
devCoin.methods.set_admin(bridge.address),
|
|
191
|
-
])
|
|
192
|
-
.send({ from: defaultAccountAddress })
|
|
193
|
-
.wait(waitOpts);
|
|
194
|
-
|
|
195
|
-
return {
|
|
196
|
-
token: {
|
|
197
|
-
address: devCoin.address,
|
|
198
|
-
initHash: devCoin.instance.initializationHash,
|
|
199
|
-
salt: devCoin.instance.salt,
|
|
200
|
-
},
|
|
201
|
-
bridge: {
|
|
202
|
-
address: bridge.address,
|
|
203
|
-
initHash: bridge.instance.initializationHash,
|
|
204
|
-
salt: bridge.instance.salt,
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Step 3. Initialize DevCoin's L1 portal
|
|
211
|
-
*/
|
|
212
|
-
async function initPortal(
|
|
213
|
-
pxe: PXE,
|
|
214
|
-
l1Client: ExtendedViemWalletClient,
|
|
215
|
-
erc20: EthAddress,
|
|
216
|
-
portal: EthAddress,
|
|
217
|
-
bridge: AztecAddress,
|
|
218
|
-
) {
|
|
219
|
-
const { TokenPortalAbi } = await import('@aztec/l1-artifacts');
|
|
220
|
-
const {
|
|
221
|
-
l1ContractAddresses: { registryAddress },
|
|
222
|
-
} = await pxe.getNodeInfo();
|
|
223
|
-
|
|
224
|
-
const contract = getContract({
|
|
225
|
-
abi: TokenPortalAbi,
|
|
226
|
-
address: portal.toString(),
|
|
227
|
-
client: l1Client,
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
const hash = await contract.write.initialize([registryAddress.toString(), erc20.toString(), bridge.toString()]);
|
|
231
|
-
|
|
232
|
-
await l1Client.waitForTransactionReceipt({ hash });
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
async function deployFPC(
|
|
236
|
-
wallet: Wallet,
|
|
237
|
-
defaultAccountAddress: AztecAddress,
|
|
238
|
-
tokenAddress: AztecAddress,
|
|
239
|
-
admin: AztecAddress,
|
|
240
|
-
): Promise<ContractDeploymentInfo> {
|
|
241
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
242
|
-
// @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
|
|
243
|
-
const { FPCContract } = await import('@aztec/noir-contracts.js/FPC');
|
|
244
|
-
const fpc = await FPCContract.deploy(wallet, tokenAddress, admin)
|
|
245
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
246
|
-
.deployed(waitOpts);
|
|
247
|
-
const info: ContractDeploymentInfo = {
|
|
248
|
-
address: fpc.address,
|
|
249
|
-
initHash: fpc.instance.initializationHash,
|
|
250
|
-
salt: fpc.instance.salt,
|
|
251
|
-
};
|
|
252
|
-
return info;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
async function deployCounter(wallet: Wallet, defaultAccountAddress: AztecAddress): Promise<ContractDeploymentInfo> {
|
|
256
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
257
|
-
// @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
|
|
258
|
-
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
259
|
-
const counter = await CounterContract.deploy(wallet, 1, defaultAccountAddress)
|
|
260
|
-
.send({ from: defaultAccountAddress, universalDeploy: true })
|
|
261
|
-
.deployed(waitOpts);
|
|
262
|
-
const info: ContractDeploymentInfo = {
|
|
263
|
-
address: counter.address,
|
|
264
|
-
initHash: counter.instance.initializationHash,
|
|
265
|
-
salt: counter.instance.salt,
|
|
266
|
-
};
|
|
267
|
-
return info;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// NOTE: Disabling for now in order to get devnet running
|
|
271
|
-
async function fundFPC(
|
|
272
|
-
pxe: PXE,
|
|
273
|
-
counterAddress: AztecAddress,
|
|
274
|
-
wallet: Wallet,
|
|
275
|
-
defaultAccountAddress: AztecAddress,
|
|
276
|
-
l1Client: ExtendedViemWalletClient,
|
|
277
|
-
fpcAddress: AztecAddress,
|
|
278
|
-
debugLog: Logger,
|
|
279
|
-
) {
|
|
280
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
281
|
-
// @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
|
|
282
|
-
const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
|
|
283
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
284
|
-
// @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
|
|
285
|
-
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
286
|
-
const {
|
|
287
|
-
protocolContractAddresses: { feeJuice },
|
|
288
|
-
} = await wallet.getPXEInfo();
|
|
289
|
-
|
|
290
|
-
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
|
|
291
|
-
|
|
292
|
-
const feeJuicePortal = await L1FeeJuicePortalManager.new(wallet, l1Client, debugLog);
|
|
293
|
-
|
|
294
|
-
const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(
|
|
295
|
-
fpcAddress,
|
|
296
|
-
undefined,
|
|
297
|
-
true,
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
await retryUntil(async () => await pxe.isL1ToL2MessageSynced(Fr.fromHexString(messageHash)), 'message sync', 600, 1);
|
|
301
|
-
|
|
302
|
-
const counter = await CounterContract.at(counterAddress, wallet);
|
|
303
|
-
|
|
304
|
-
debugLog.info('Incrementing Counter');
|
|
305
|
-
|
|
306
|
-
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
307
|
-
// advance the chain
|
|
308
|
-
await counter.methods.increment(wallet.getAddress()).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
309
|
-
await counter.methods.increment(wallet.getAddress()).send({ from: defaultAccountAddress }).wait(waitOpts);
|
|
310
|
-
|
|
311
|
-
debugLog.info('Claiming FPC');
|
|
312
|
-
|
|
313
|
-
const receipt = await feeJuiceContract.methods
|
|
314
|
-
.claim(fpcAddress, claimAmount, claimSecret, messageLeafIndex)
|
|
315
|
-
.send({ from: defaultAccountAddress })
|
|
316
|
-
.wait({ ...waitOpts });
|
|
317
|
-
|
|
318
|
-
await waitForProven(pxe, receipt, provenWaitOpts);
|
|
319
|
-
|
|
320
|
-
debugLog.info('Finished claiming FPC');
|
|
321
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
5
|
-
|
|
6
|
-
export async function dripFaucet(
|
|
7
|
-
faucetUrl: string,
|
|
8
|
-
asset: string,
|
|
9
|
-
account: EthAddress,
|
|
10
|
-
json: boolean,
|
|
11
|
-
log: LogFn,
|
|
12
|
-
): Promise<void> {
|
|
13
|
-
const url = new URL(`/drip/${account.toString()}`, faucetUrl);
|
|
14
|
-
url.searchParams.set('asset', asset);
|
|
15
|
-
const res = await fetch(url);
|
|
16
|
-
if (res.status === 200) {
|
|
17
|
-
if (json) {
|
|
18
|
-
log(prettyPrintJSON({ ok: true }));
|
|
19
|
-
} else {
|
|
20
|
-
log(`Dripped ${asset} for ${account.toString()}`);
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
if (json) {
|
|
24
|
-
log(prettyPrintJSON({ ok: false }));
|
|
25
|
-
} else if (res.status === 429) {
|
|
26
|
-
log(`Rate limited when dripping ${asset} for ${account.toString()}`);
|
|
27
|
-
} else {
|
|
28
|
-
log(`Failed to drip ${asset} for ${account.toString()}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/cmds/devnet/index.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
-
|
|
3
|
-
import type { Command } from 'commander';
|
|
4
|
-
|
|
5
|
-
import { ETHEREUM_HOSTS, l1ChainIdOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
6
|
-
|
|
7
|
-
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
8
|
-
program
|
|
9
|
-
.command('bootstrap-network')
|
|
10
|
-
.description('Bootstrap a new network')
|
|
11
|
-
.addOption(pxeOption)
|
|
12
|
-
.addOption(l1ChainIdOption)
|
|
13
|
-
.requiredOption<string[]>(
|
|
14
|
-
'--l1-rpc-urls <string>',
|
|
15
|
-
'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)',
|
|
16
|
-
(arg: string) => arg.split(','),
|
|
17
|
-
[ETHEREUM_HOSTS],
|
|
18
|
-
)
|
|
19
|
-
.option('--l1-private-key <string>', 'The private key to use for deployment', process.env.PRIVATE_KEY)
|
|
20
|
-
.option(
|
|
21
|
-
'-m, --mnemonic <string>',
|
|
22
|
-
'The mnemonic to use in deployment',
|
|
23
|
-
'test test test test test test test test test test test junk',
|
|
24
|
-
)
|
|
25
|
-
.option(
|
|
26
|
-
'-ai, --address-index <number>',
|
|
27
|
-
'The address index to use when calculating an address',
|
|
28
|
-
arg => BigInt(arg),
|
|
29
|
-
0n,
|
|
30
|
-
)
|
|
31
|
-
.option('--json', 'Output the result as JSON')
|
|
32
|
-
.action(async options => {
|
|
33
|
-
const { bootstrapNetwork } = await import('./bootstrap_network.js');
|
|
34
|
-
await bootstrapNetwork(
|
|
35
|
-
options[pxeOption.attributeName()],
|
|
36
|
-
options.l1RpcUrls,
|
|
37
|
-
options[l1ChainIdOption.attributeName()],
|
|
38
|
-
options.l1PrivateKey,
|
|
39
|
-
options.mnemonic,
|
|
40
|
-
options.addressIndex,
|
|
41
|
-
options.json,
|
|
42
|
-
log,
|
|
43
|
-
debugLogger,
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
program
|
|
48
|
-
.command('drip-faucet')
|
|
49
|
-
.description('Drip the faucet')
|
|
50
|
-
.requiredOption('-u, --faucet-url <string>', 'Url of the faucet', 'http://localhost:8082')
|
|
51
|
-
.requiredOption('-t, --token <string>', 'The asset to drip', 'eth')
|
|
52
|
-
.requiredOption('-a, --address <string>', 'The Ethereum address to drip to', parseEthereumAddress)
|
|
53
|
-
.option('--json', 'Output the result as JSON')
|
|
54
|
-
.action(async options => {
|
|
55
|
-
const { dripFaucet } = await import('./faucet.js');
|
|
56
|
-
await dripFaucet(options.faucetUrl, options.token, options.address, options.json, log);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return program;
|
|
60
|
-
}
|
|
@@ -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
|
-
}
|