@aztec/cli-wallet 0.85.0-alpha-testnet.2 → 0.85.0-alpha-testnet.4

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.
@@ -1,7 +1,7 @@
1
1
  import type { AccountManager } from '@aztec/aztec.js';
2
2
  import type { LogFn, Logger } from '@aztec/foundation/log';
3
3
  import { type IFeeOpts } from '../utils/options/fees.js';
4
- export declare function deployAccount(account: AccountManager, wait: boolean, registerClass: boolean, feeOpts: IFeeOpts, json: boolean, debugLogger: Logger, log: LogFn): Promise<{
4
+ export declare function deployAccount(account: AccountManager, wait: boolean, registerClass: boolean, publicDeploy: boolean, feeOpts: IFeeOpts, json: boolean, debugLogger: Logger, log: LogFn): Promise<{
5
5
  address: import("@aztec/aztec.js").AztecAddress;
6
6
  secretKey: import("@aztec/aztec.js").Fr;
7
7
  salt: import("@aztec/aztec.js").Fr;
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAE5E,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;GA8FX"}
1
+ {"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAE5E,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;GA8FX"}
@@ -1,6 +1,6 @@
1
1
  import { prettyPrintJSON } from '@aztec/cli/cli-utils';
2
2
  import { printGasEstimates } from '../utils/options/fees.js';
3
- export async function deployAccount(account, wait, registerClass, feeOpts, json, debugLogger, log) {
3
+ export async function deployAccount(account, wait, registerClass, publicDeploy, feeOpts, json, debugLogger, log) {
4
4
  const out = {};
5
5
  const { address, partialAddress, publicKeys } = await account.getCompleteAddress();
6
6
  const { initializationHash, deployer, salt } = account.getInstance();
@@ -28,7 +28,7 @@ export async function deployAccount(account, wait, registerClass, feeOpts, json,
28
28
  let txReceipt;
29
29
  const deployOpts = {
30
30
  skipInitialization: false,
31
- skipPublicDeployment: false,
31
+ skipPublicDeployment: !publicDeploy,
32
32
  skipClassRegistration: !registerClass,
33
33
  ...await feeOpts.toDeployAccountOpts(wallet)
34
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAuBxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,EACnB,EAAE,CAAC,EAAE,QAAQ,EACb,UAAU,CAAC,EAAE,UAAU,WAgpBxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAuBxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,EACnB,EAAE,CAAC,EAAE,QAAQ,EACb,UAAU,CAAC,EAAE,UAAU,WAkpBxB"}
@@ -54,14 +54,14 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
54
54
  });
55
55
  const deployAccountCommand = program.command('deploy-account').description('Deploys an already registered aztec account that can be used for sending transactions.').addOption(createAccountOption('Alias or address of the account to deploy', !db, db)).addOption(pxeOption).option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
56
56
  // https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
57
- .option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').option('--register-class', 'Register the contract class (useful for when the contract class has not been deployed yet).');
57
+ .option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').option('--register-class', 'Register the contract class (useful for when the contract class has not been deployed yet).').option('--public-deploy', 'Publicly deploy this account contract (only useful if it contains public functions');
58
58
  addOptions(deployAccountCommand, FeeOptsWithFeePayer.getOptions()).action(async (_options, command)=>{
59
59
  const { deployAccount } = await import('./deploy_account.js');
60
60
  const options = command.optsWithGlobals();
61
- const { rpcUrl, wait, from: parsedFromAddress, json, registerClass } = options;
61
+ const { rpcUrl, wait, from: parsedFromAddress, json, registerClass, publicDeploy } = options;
62
62
  const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
63
63
  const account = await createOrRetrieveAccount(client, parsedFromAddress, db);
64
- await deployAccount(account, wait, registerClass, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, debugLogger, log);
64
+ await deployAccount(account, wait, registerClass, publicDeploy, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, debugLogger, log);
65
65
  });
66
66
  const deployCommand = program.command('deploy').description('Deploys a compiled Aztec.nr contract to Aztec.').argument('[artifact]', ARTIFACT_DESCRIPTION, artifactPathParser).option('--init <string>', 'The contract initializer function to call', 'constructor').option('--no-init', 'Leave the contract uninitialized').option('-k, --public-key <string>', 'Optional encryption public key for this address. Set this value only if this contract is expected to receive private notes, which will be encrypted using this public key.', parsePublicKey).option('-s, --salt <hex string>', 'Optional deployment salt as a hex string for generating the deployment address.', parseFieldFromHexString).option('--universal', 'Do not mix the sender address into the deployment.').addOption(pxeOption).addOption(createArgsOption(true, db)).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAccountOption('Alias or address of the account to deploy from', !db, db)).addOption(createAliasOption('Alias for the contract. Used for easy reference subsequent commands.', !db)).option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
67
67
  // https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,WAAW,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE5G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA8CnD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,aAAa,EAAE,WAAW,EAAE,EAC5B,GAAG,EAAE,KAAK,iBAcX"}
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,WAAW,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE5G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA6BnD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,aAAa,EAAE,WAAW,EAAE,EAC5B,GAAG,EAAE,KAAK,iBAeX"}
@@ -1,7 +1,6 @@
1
1
  import { Contract } from '@aztec/aztec.js';
2
2
  import { prepTx } from '@aztec/cli/utils';
3
- import { serializeWitness } from '@aztec/noir-noirc_abi';
4
- import { encode } from '@msgpack/msgpack';
3
+ import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
5
4
  import { promises as fs } from 'fs';
6
5
  import path from 'path';
7
6
  import { format } from 'util';
@@ -16,20 +15,6 @@ function printProfileResult(result, log) {
16
15
  });
17
16
  log(format('\nTotal gates:', acc.toLocaleString()));
18
17
  }
19
- // TODO(#7371): This is duplicated.
20
- // Longer term we won't use this hacked together msgpack format
21
- // Leaving duplicated as this eventually bb will provide a serialization
22
- // helper for passing to a generic msgpack RPC endpoint.
23
- async function _createClientIvcProofFiles(directory, executionSteps) {
24
- const acirPath = path.join(directory, 'acir.msgpack');
25
- const witnessPath = path.join(directory, 'witnesses.msgpack');
26
- await fs.writeFile(acirPath, encode(executionSteps.map((map)=>map.bytecode)));
27
- await fs.writeFile(witnessPath, encode(executionSteps.map((map)=>serializeWitness(map.witness))));
28
- return {
29
- acirPath,
30
- witnessPath
31
- };
32
- }
33
18
  export async function profile(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, debugOutputPath, authWitnesses, log) {
34
19
  const profileMode = debugOutputPath ? 'full' : 'gates';
35
20
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
@@ -41,7 +26,8 @@ export async function profile(wallet, functionName, functionArgsIn, contractArti
41
26
  });
42
27
  printProfileResult(result, log);
43
28
  if (debugOutputPath) {
44
- log(`Debug output written to ${debugOutputPath} (witnesses.msgpack and acir.msgpack)`);
45
- await _createClientIvcProofFiles(debugOutputPath, result.executionSteps);
29
+ const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
30
+ log(`Debug output written to ${ivcInputsPath}.`);
31
+ await fs.writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
46
32
  }
47
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli-wallet",
3
- "version": "0.85.0-alpha-testnet.2",
3
+ "version": "0.85.0-alpha-testnet.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/cmds/index.js",
@@ -65,18 +65,17 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "@aztec/accounts": "0.85.0-alpha-testnet.2",
69
- "@aztec/aztec.js": "0.85.0-alpha-testnet.2",
70
- "@aztec/cli": "0.85.0-alpha-testnet.2",
71
- "@aztec/entrypoints": "0.85.0-alpha-testnet.2",
72
- "@aztec/ethereum": "0.85.0-alpha-testnet.2",
73
- "@aztec/foundation": "0.85.0-alpha-testnet.2",
74
- "@aztec/kv-store": "0.85.0-alpha-testnet.2",
75
- "@aztec/noir-contracts.js": "0.85.0-alpha-testnet.2",
76
- "@aztec/noir-noirc_abi": "0.85.0-alpha-testnet.2",
77
- "@aztec/pxe": "0.85.0-alpha-testnet.2",
78
- "@aztec/stdlib": "0.85.0-alpha-testnet.2",
79
- "@msgpack/msgpack": "^3.0.0-beta2",
68
+ "@aztec/accounts": "0.85.0-alpha-testnet.4",
69
+ "@aztec/aztec.js": "0.85.0-alpha-testnet.4",
70
+ "@aztec/cli": "0.85.0-alpha-testnet.4",
71
+ "@aztec/entrypoints": "0.85.0-alpha-testnet.4",
72
+ "@aztec/ethereum": "0.85.0-alpha-testnet.4",
73
+ "@aztec/foundation": "0.85.0-alpha-testnet.4",
74
+ "@aztec/kv-store": "0.85.0-alpha-testnet.4",
75
+ "@aztec/noir-contracts.js": "0.85.0-alpha-testnet.4",
76
+ "@aztec/noir-noirc_abi": "0.85.0-alpha-testnet.4",
77
+ "@aztec/pxe": "0.85.0-alpha-testnet.4",
78
+ "@aztec/stdlib": "0.85.0-alpha-testnet.4",
80
79
  "commander": "^12.1.0",
81
80
  "inquirer": "^10.1.8",
82
81
  "source-map-support": "^0.5.21",
@@ -8,6 +8,7 @@ export async function deployAccount(
8
8
  account: AccountManager,
9
9
  wait: boolean,
10
10
  registerClass: boolean,
11
+ publicDeploy: boolean,
11
12
  feeOpts: IFeeOpts,
12
13
  json: boolean,
13
14
  debugLogger: Logger,
@@ -43,7 +44,7 @@ export async function deployAccount(
43
44
 
44
45
  const deployOpts: DeployAccountOptions = {
45
46
  skipInitialization: false,
46
- skipPublicDeployment: false,
47
+ skipPublicDeployment: !publicDeploy,
47
48
  skipClassRegistration: !registerClass,
48
49
  ...(await feeOpts.toDeployAccountOpts(wallet)),
49
50
  };
package/src/cmds/index.ts CHANGED
@@ -153,12 +153,13 @@ export function injectCommands(
153
153
  .option(
154
154
  '--register-class',
155
155
  'Register the contract class (useful for when the contract class has not been deployed yet).',
156
- );
156
+ )
157
+ .option('--public-deploy', 'Publicly deploy this account contract (only useful if it contains public functions');
157
158
 
158
159
  addOptions(deployAccountCommand, FeeOptsWithFeePayer.getOptions()).action(async (_options, command) => {
159
160
  const { deployAccount } = await import('./deploy_account.js');
160
161
  const options = command.optsWithGlobals();
161
- const { rpcUrl, wait, from: parsedFromAddress, json, registerClass } = options;
162
+ const { rpcUrl, wait, from: parsedFromAddress, json, registerClass, publicDeploy } = options;
162
163
 
163
164
  const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
164
165
  const account = await createOrRetrieveAccount(client, parsedFromAddress, db);
@@ -167,6 +168,7 @@ export function injectCommands(
167
168
  account,
168
169
  wait,
169
170
  registerClass,
171
+ publicDeploy,
170
172
  await FeeOptsWithFeePayer.fromCli(options, client, log, db),
171
173
  json,
172
174
  debugLogger,
@@ -1,11 +1,9 @@
1
1
  import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress, Contract } from '@aztec/aztec.js';
2
2
  import { prepTx } from '@aztec/cli/utils';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
- import { serializeWitness } from '@aztec/noir-noirc_abi';
5
- import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
4
+ import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
6
5
  import type { TxProfileResult } from '@aztec/stdlib/tx';
7
6
 
8
- import { encode } from '@msgpack/msgpack';
9
7
  import { promises as fs } from 'fs';
10
8
  import path from 'path';
11
9
  import { format } from 'util';
@@ -31,21 +29,6 @@ function printProfileResult(result: TxProfileResult, log: LogFn) {
31
29
  log(format('\nTotal gates:', acc.toLocaleString()));
32
30
  }
33
31
 
34
- // TODO(#7371): This is duplicated.
35
- // Longer term we won't use this hacked together msgpack format
36
- // Leaving duplicated as this eventually bb will provide a serialization
37
- // helper for passing to a generic msgpack RPC endpoint.
38
- async function _createClientIvcProofFiles(directory: string, executionSteps: PrivateExecutionStep[]) {
39
- const acirPath = path.join(directory, 'acir.msgpack');
40
- const witnessPath = path.join(directory, 'witnesses.msgpack');
41
- await fs.writeFile(acirPath, encode(executionSteps.map(map => map.bytecode)));
42
- await fs.writeFile(witnessPath, encode(executionSteps.map(map => serializeWitness(map.witness))));
43
- return {
44
- acirPath,
45
- witnessPath,
46
- };
47
- }
48
-
49
32
  export async function profile(
50
33
  wallet: AccountWalletWithSecretKey,
51
34
  functionName: string,
@@ -65,7 +48,8 @@ export async function profile(
65
48
  const result = await call.profile({ profileMode, authWitnesses });
66
49
  printProfileResult(result, log);
67
50
  if (debugOutputPath) {
68
- log(`Debug output written to ${debugOutputPath} (witnesses.msgpack and acir.msgpack)`);
69
- await _createClientIvcProofFiles(debugOutputPath, result.executionSteps);
51
+ const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
52
+ log(`Debug output written to ${ivcInputsPath}.`);
53
+ await fs.writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
70
54
  }
71
55
  }