@aztec/cli 0.16.1 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/index.js +4 -3
- package/dest/cmds/add_contract.d.ts +7 -0
- package/dest/cmds/add_contract.d.ts.map +1 -0
- package/dest/cmds/add_contract.js +15 -0
- package/dest/cmds/add_note.d.ts +8 -0
- package/dest/cmds/add_note.d.ts.map +1 -0
- package/dest/cmds/add_note.js +13 -0
- package/dest/cmds/block_number.d.ts +6 -0
- package/dest/cmds/block_number.d.ts.map +1 -0
- package/dest/cmds/block_number.js +10 -0
- package/dest/cmds/call.d.ts +7 -0
- package/dest/cmds/call.d.ts.map +1 -0
- package/dest/cmds/call.js +18 -0
- package/dest/cmds/check_deploy.d.ts +7 -0
- package/dest/cmds/check_deploy.d.ts.map +1 -0
- package/dest/cmds/check_deploy.js +16 -0
- package/dest/cmds/compute_selector.d.ts +6 -0
- package/dest/cmds/compute_selector.d.ts.map +1 -0
- package/dest/cmds/compute_selector.js +9 -0
- package/dest/cmds/create_account.d.ts +7 -0
- package/dest/cmds/create_account.d.ts.map +1 -0
- package/dest/cmds/create_account.js +30 -0
- package/dest/cmds/deploy.d.ts +7 -0
- package/dest/cmds/deploy.d.ts.map +1 -0
- package/dest/cmds/deploy.js +58 -0
- package/dest/cmds/deploy_l1_contracts.d.ts +6 -0
- package/dest/cmds/deploy_l1_contracts.d.ts.map +1 -0
- package/dest/cmds/deploy_l1_contracts.js +15 -0
- package/dest/cmds/example_contracts.d.ts +6 -0
- package/dest/cmds/example_contracts.d.ts.map +1 -0
- package/dest/cmds/example_contracts.js +10 -0
- package/dest/cmds/generate_p2p_private_key.d.ts +6 -0
- package/dest/cmds/generate_p2p_private_key.d.ts.map +1 -0
- package/dest/cmds/generate_p2p_private_key.js +11 -0
- package/dest/cmds/generate_private_key.d.ts +6 -0
- package/dest/cmds/generate_private_key.d.ts.map +1 -0
- package/dest/cmds/generate_private_key.js +22 -0
- package/dest/cmds/get_account.d.ts +7 -0
- package/dest/cmds/get_account.d.ts.map +1 -0
- package/dest/cmds/get_account.js +15 -0
- package/dest/cmds/get_accounts.d.ts +6 -0
- package/dest/cmds/get_accounts.d.ts.map +1 -0
- package/dest/cmds/get_accounts.js +18 -0
- package/dest/cmds/get_contract_data.d.ts +7 -0
- package/dest/cmds/get_contract_data.d.ts.map +1 -0
- package/dest/cmds/get_contract_data.js +28 -0
- package/dest/cmds/get_logs.d.ts +7 -0
- package/dest/cmds/get_logs.d.ts.map +1 -0
- package/dest/cmds/get_logs.js +54 -0
- package/dest/cmds/get_node_info.d.ts +6 -0
- package/dest/cmds/get_node_info.d.ts.map +1 -0
- package/dest/cmds/get_node_info.js +15 -0
- package/dest/cmds/get_recipient.d.ts +7 -0
- package/dest/cmds/get_recipient.d.ts.map +1 -0
- package/dest/cmds/get_recipient.js +15 -0
- package/dest/cmds/get_recipients.d.ts +6 -0
- package/dest/cmds/get_recipients.d.ts.map +1 -0
- package/dest/cmds/get_recipients.js +18 -0
- package/dest/cmds/get_tx_receipt.d.ts +7 -0
- package/dest/cmds/get_tx_receipt.d.ts.map +1 -0
- package/dest/cmds/get_tx_receipt.js +16 -0
- package/dest/cmds/inspect_contract.d.ts +6 -0
- package/dest/cmds/inspect_contract.d.ts.map +1 -0
- package/dest/cmds/inspect_contract.js +19 -0
- package/dest/cmds/parse_parameter_struct.d.ts +6 -0
- package/dest/cmds/parse_parameter_struct.d.ts.map +1 -0
- package/dest/cmds/parse_parameter_struct.js +20 -0
- package/dest/cmds/register_account.d.ts +7 -0
- package/dest/cmds/register_account.d.ts.map +1 -0
- package/dest/cmds/register_account.js +13 -0
- package/dest/cmds/register_recipient.d.ts +7 -0
- package/dest/cmds/register_recipient.d.ts.map +1 -0
- package/dest/cmds/register_recipient.js +11 -0
- package/dest/cmds/send.d.ts +7 -0
- package/dest/cmds/send.d.ts.map +1 -0
- package/dest/cmds/send.js +26 -0
- package/dest/cmds/unbox.d.ts +6 -0
- package/dest/cmds/unbox.d.ts.map +1 -0
- package/dest/cmds/unbox.js +9 -0
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +65 -312
- package/dest/utils.d.ts +9 -5
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +14 -10
- package/package.json +8 -8
- package/src/bin/index.ts +4 -2
- package/src/cmds/add_contract.ts +27 -0
- package/src/cmds/add_note.ts +24 -0
- package/src/cmds/block_number.ts +12 -0
- package/src/cmds/call.ts +35 -0
- package/src/cmds/check_deploy.ts +17 -0
- package/src/cmds/compute_selector.ts +10 -0
- package/src/cmds/create_account.ts +39 -0
- package/src/cmds/deploy.ts +77 -0
- package/src/cmds/deploy_l1_contracts.ts +25 -0
- package/src/cmds/example_contracts.ts +12 -0
- package/src/cmds/generate_p2p_private_key.ts +13 -0
- package/src/cmds/generate_private_key.ts +23 -0
- package/src/cmds/get_account.ts +18 -0
- package/src/cmds/get_accounts.ts +19 -0
- package/src/cmds/get_contract_data.ts +39 -0
- package/src/cmds/get_logs.ts +71 -0
- package/src/cmds/get_node_info.ts +17 -0
- package/src/cmds/get_recipient.ts +18 -0
- package/src/cmds/get_recipients.ts +19 -0
- package/src/cmds/get_tx_receipt.ts +18 -0
- package/src/cmds/inspect_contract.ts +29 -0
- package/src/cmds/parse_parameter_struct.ts +30 -0
- package/src/cmds/register_account.ts +24 -0
- package/src/cmds/register_recipient.ts +21 -0
- package/src/cmds/send.ts +40 -0
- package/src/cmds/unbox.ts +11 -0
- package/src/index.ts +97 -358
- package/src/utils.ts +28 -22
package/src/utils.ts
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { AztecAddress } from '@aztec/aztec.js/aztec_address';
|
|
3
|
+
import { EthAddress } from '@aztec/aztec.js/eth_address';
|
|
4
|
+
import { type L1ContractArtifactsForDeployment } from '@aztec/aztec.js/ethereum';
|
|
5
|
+
import { Fr, GrumpkinScalar, Point } from '@aztec/aztec.js/fields';
|
|
6
|
+
import { type PXE } from '@aztec/aztec.js/interfaces/pxe';
|
|
7
|
+
import { LogId } from '@aztec/aztec.js/log_id';
|
|
8
|
+
import { TxHash } from '@aztec/aztec.js/tx_hash';
|
|
4
9
|
import { DebugLogger, LogFn } from '@aztec/foundation/log';
|
|
5
|
-
import {
|
|
6
|
-
ContractDeploymentEmitterAbi,
|
|
7
|
-
ContractDeploymentEmitterBytecode,
|
|
8
|
-
InboxAbi,
|
|
9
|
-
InboxBytecode,
|
|
10
|
-
OutboxAbi,
|
|
11
|
-
OutboxBytecode,
|
|
12
|
-
RegistryAbi,
|
|
13
|
-
RegistryBytecode,
|
|
14
|
-
RollupAbi,
|
|
15
|
-
RollupBytecode,
|
|
16
|
-
} from '@aztec/l1-artifacts';
|
|
17
|
-
import { LogId } from '@aztec/types';
|
|
18
10
|
|
|
19
11
|
import { CommanderError, InvalidArgumentError } from 'commander';
|
|
20
|
-
import
|
|
21
|
-
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
12
|
+
import { readFile, rename, writeFile } from 'fs/promises';
|
|
22
13
|
|
|
23
14
|
import { encodeArgs } from './encoding.js';
|
|
24
15
|
|
|
@@ -35,7 +26,7 @@ interface ArtifactsType {
|
|
|
35
26
|
* @param fnName - Function name to be found.
|
|
36
27
|
* @returns The function's ABI.
|
|
37
28
|
*/
|
|
38
|
-
export function getFunctionArtifact(artifact: ContractArtifact, fnName: string) {
|
|
29
|
+
export function getFunctionArtifact(artifact: ContractArtifact, fnName: string): FunctionArtifact {
|
|
39
30
|
const fn = artifact.functions.find(({ name }) => name === fnName);
|
|
40
31
|
if (!fn) {
|
|
41
32
|
throw Error(`Function ${fnName} not found in contract ABI.`);
|
|
@@ -57,6 +48,21 @@ export async function deployAztecContracts(
|
|
|
57
48
|
mnemonic: string,
|
|
58
49
|
debugLogger: DebugLogger,
|
|
59
50
|
) {
|
|
51
|
+
const {
|
|
52
|
+
ContractDeploymentEmitterAbi,
|
|
53
|
+
ContractDeploymentEmitterBytecode,
|
|
54
|
+
InboxAbi,
|
|
55
|
+
InboxBytecode,
|
|
56
|
+
OutboxAbi,
|
|
57
|
+
OutboxBytecode,
|
|
58
|
+
RegistryAbi,
|
|
59
|
+
RegistryBytecode,
|
|
60
|
+
RollupAbi,
|
|
61
|
+
RollupBytecode,
|
|
62
|
+
} = await import('@aztec/l1-artifacts');
|
|
63
|
+
const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
|
|
64
|
+
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
65
|
+
|
|
60
66
|
const account = !privateKey ? mnemonicToAccount(mnemonic!) : privateKeyToAccount(`0x${privateKey}`);
|
|
61
67
|
const chain = createEthereumChain(rpcUrl, apiKey);
|
|
62
68
|
const l1Artifacts: L1ContractArtifactsForDeployment = {
|
|
@@ -107,7 +113,7 @@ export async function getContractArtifact(fileDir: string, log: LogFn) {
|
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
try {
|
|
110
|
-
contents =
|
|
116
|
+
contents = await readFile(fileDir, 'utf8');
|
|
111
117
|
} catch {
|
|
112
118
|
throw Error(`Contract ${fileDir} not found`);
|
|
113
119
|
}
|
|
@@ -412,11 +418,11 @@ export function parseFields(fields: string[]): Fr[] {
|
|
|
412
418
|
export async function atomicUpdateFile(filePath: string, contents: string) {
|
|
413
419
|
const tmpFilepath = filePath + '.tmp';
|
|
414
420
|
try {
|
|
415
|
-
await
|
|
421
|
+
await writeFile(tmpFilepath, contents, {
|
|
416
422
|
// let's crash if the tmp file already exists
|
|
417
423
|
flag: 'wx',
|
|
418
424
|
});
|
|
419
|
-
await
|
|
425
|
+
await rename(tmpFilepath, filePath);
|
|
420
426
|
} catch (e) {
|
|
421
427
|
if (e instanceof Error && 'code' in e && e.code === 'EEXIST') {
|
|
422
428
|
const commanderError = new CommanderError(
|