@aztec/cli-wallet 3.0.0-nightly.20251115 → 3.0.0-nightly.20251119

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 CHANGED
@@ -2,15 +2,14 @@ import { computeSecretHash } from '@aztec/aztec.js/crypto';
2
2
  import { Fr } from '@aztec/aztec.js/fields';
3
3
  import { createAztecNodeClient } from '@aztec/aztec.js/node';
4
4
  import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
5
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
5
6
  import { LOCALHOST } from '@aztec/cli/cli-utils';
6
7
  import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
7
8
  import { openStoreAt } from '@aztec/kv-store/lmdb-v2';
8
9
  import { getPackageVersion } from '@aztec/stdlib/update-checker';
9
10
  import { Argument, Command, Option } from 'commander';
10
- import { mkdirSync } from 'fs';
11
11
  import { homedir } from 'os';
12
- import { dirname, join, resolve } from 'path';
13
- import { fileURLToPath } from 'url';
12
+ import { join } from 'path';
14
13
  import { injectCommands } from '../cmds/index.js';
15
14
  import { Aliases, WalletDB } from '../storage/wallet_db.js';
16
15
  import { CliWalletAndNodeWrapper } from '../utils/cli_wallet_and_node_wrapper.js';
@@ -62,15 +61,20 @@ function injectInternalCommands(program, log, db) {
62
61
  }
63
62
  const { dataDir, nodeUrl, prover } = command.optsWithGlobals();
64
63
  const proverEnabled = prover !== 'none';
65
- const bbBinaryPath = prover === 'native' ? process.env.BB_BINARY_PATH ?? resolve(dirname(fileURLToPath(import.meta.url)), '../../../../barretenberg/cpp/build/bin/bb') : undefined;
66
- const bbWorkingDirectory = dataDir + '/bb';
67
- mkdirSync(bbWorkingDirectory, {
68
- recursive: true
69
- });
64
+ switch(prover){
65
+ case 'native':
66
+ await Barretenberg.initSingleton({
67
+ backend: BackendType.NativeUnixSocket
68
+ });
69
+ break;
70
+ case 'wasm':
71
+ await Barretenberg.initSingleton({
72
+ backend: BackendType.Wasm
73
+ });
74
+ break;
75
+ }
70
76
  const overridePXEConfig = {
71
77
  proverEnabled,
72
- bbBinaryPath: prover === 'native' ? bbBinaryPath : undefined,
73
- bbWorkingDirectory: prover === 'native' ? bbWorkingDirectory : undefined,
74
78
  dataDirectory: join(dataDir, 'pxe')
75
79
  };
76
80
  const node = createAztecNodeClient(nodeUrl);
@@ -93,6 +97,7 @@ function injectInternalCommands(program, log, db) {
93
97
  injectCommands(program, userLog, debugLogger, walletAndNodeWrapper, db);
94
98
  injectInternalCommands(program, userLog, db);
95
99
  await program.parseAsync(process.argv);
100
+ await Barretenberg.destroySingleton();
96
101
  }
97
102
  main().catch((err)=>{
98
103
  debugLogger.error(`Error in command execution`);
@@ -7,7 +7,7 @@ export async function authorizeAction(wallet, from, functionName, caller, functi
7
7
  if (isPrivate) {
8
8
  throw new Error('Cannot authorize private function. To allow a third party to call a private function, please create an authorization witness via the create-authwit command');
9
9
  }
10
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
10
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
11
11
  const action = contract.methods[functionName](...functionArgs);
12
12
  const setAuthwitnessInteraction = await SetPublicAuthwitContractInteraction.create(wallet, from, {
13
13
  caller,
@@ -5,7 +5,7 @@ export async function createAuthwit(wallet, from, functionName, caller, function
5
5
  if (!isPrivate) {
6
6
  throw new Error('Cannot create an authwit for a public function. To allow a third party to call a public function, please authorize the action via the authorize-action command');
7
7
  }
8
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
8
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
9
9
  const call = await contract.methods[functionName](...functionArgs).getFunctionCall();
10
10
  const witness = await wallet.createAuthWit(from, {
11
11
  caller,
@@ -82,7 +82,7 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
82
82
  const authWitnesses = cleanupAuthWitnesses(authWitnessArray);
83
83
  const sentTx = await send(wallet, node, parsedFromAddress, functionName, args, artifactPath, contractAddress, wait, alias, CLIFeeArgs.parse(options, log, db), authWitnesses, verbose, log);
84
84
  if (db && sentTx) {
85
- const txAlias = alias ? alias : `${functionName}-${randomBytes(16).toString()}`;
85
+ const txAlias = alias ? alias : `${functionName}-${randomBytes(16).toString('hex')}`;
86
86
  await db.storeTx(sentTx, log, txAlias);
87
87
  }
88
88
  });
@@ -6,7 +6,7 @@ import path from 'path';
6
6
  import { printProfileResult } from '../utils/profiling.js';
7
7
  export async function profile(wallet, node, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, debugOutputPath, feeOpts, authWitnesses, log) {
8
8
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
9
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
9
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
10
10
  const call = contract.methods[functionName](...functionArgs);
11
11
  const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
12
12
  const result = await call.profile({
package/dest/cmds/send.js CHANGED
@@ -4,7 +4,7 @@ import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
4
4
  import { printProfileResult } from '../utils/profiling.js';
5
5
  export async function send(wallet, node, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, authWitnesses, verbose, log) {
6
6
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
7
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
7
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
8
8
  const call = contract.methods[functionName](...functionArgs);
9
9
  const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
10
10
  const sendOptions = {
@@ -5,7 +5,7 @@ import { printAuthorizations } from '../utils/authorizations.js';
5
5
  import { printProfileResult } from '../utils/profiling.js';
6
6
  export async function simulate(wallet, node, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, feeOpts, authWitnesses, verbose, log) {
7
7
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
8
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
8
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
9
9
  const call = contract.methods[functionName](...functionArgs);
10
10
  const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
11
11
  const simulationResult = await call.simulate({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli-wallet",
3
- "version": "3.0.0-nightly.20251115",
3
+ "version": "3.0.0-nightly.20251119",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/cmds/index.js",
@@ -67,17 +67,18 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@aztec/accounts": "3.0.0-nightly.20251115",
71
- "@aztec/aztec.js": "3.0.0-nightly.20251115",
72
- "@aztec/cli": "3.0.0-nightly.20251115",
73
- "@aztec/entrypoints": "3.0.0-nightly.20251115",
74
- "@aztec/ethereum": "3.0.0-nightly.20251115",
75
- "@aztec/foundation": "3.0.0-nightly.20251115",
76
- "@aztec/kv-store": "3.0.0-nightly.20251115",
77
- "@aztec/noir-contracts.js": "3.0.0-nightly.20251115",
78
- "@aztec/noir-noirc_abi": "3.0.0-nightly.20251115",
79
- "@aztec/pxe": "3.0.0-nightly.20251115",
80
- "@aztec/stdlib": "3.0.0-nightly.20251115",
70
+ "@aztec/accounts": "3.0.0-nightly.20251119",
71
+ "@aztec/aztec.js": "3.0.0-nightly.20251119",
72
+ "@aztec/bb.js": "3.0.0-nightly.20251119",
73
+ "@aztec/cli": "3.0.0-nightly.20251119",
74
+ "@aztec/entrypoints": "3.0.0-nightly.20251119",
75
+ "@aztec/ethereum": "3.0.0-nightly.20251119",
76
+ "@aztec/foundation": "3.0.0-nightly.20251119",
77
+ "@aztec/kv-store": "3.0.0-nightly.20251119",
78
+ "@aztec/noir-contracts.js": "3.0.0-nightly.20251119",
79
+ "@aztec/noir-noirc_abi": "3.0.0-nightly.20251119",
80
+ "@aztec/pxe": "3.0.0-nightly.20251119",
81
+ "@aztec/stdlib": "3.0.0-nightly.20251119",
81
82
  "commander": "^12.1.0",
82
83
  "inquirer": "^10.1.8",
83
84
  "source-map-support": "^0.5.21",
package/src/bin/index.ts CHANGED
@@ -2,6 +2,7 @@ import { computeSecretHash } from '@aztec/aztec.js/crypto';
2
2
  import { Fr } from '@aztec/aztec.js/fields';
3
3
  import { createAztecNodeClient } from '@aztec/aztec.js/node';
4
4
  import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
5
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
5
6
  import { LOCALHOST } from '@aztec/cli/cli-utils';
6
7
  import { type LogFn, createConsoleLogger, createLogger } from '@aztec/foundation/log';
7
8
  import { openStoreAt } from '@aztec/kv-store/lmdb-v2';
@@ -9,10 +10,8 @@ import type { PXEConfig } from '@aztec/pxe/config';
9
10
  import { getPackageVersion } from '@aztec/stdlib/update-checker';
10
11
 
11
12
  import { Argument, Command, Option } from 'commander';
12
- import { mkdirSync } from 'fs';
13
13
  import { homedir } from 'os';
14
- import { dirname, join, resolve } from 'path';
15
- import { fileURLToPath } from 'url';
14
+ import { join } from 'path';
16
15
 
17
16
  import { injectCommands } from '../cmds/index.js';
18
17
  import { Aliases, WalletDB } from '../storage/wallet_db.js';
@@ -104,18 +103,17 @@ async function main() {
104
103
 
105
104
  const proverEnabled = prover !== 'none';
106
105
 
107
- const bbBinaryPath =
108
- prover === 'native'
109
- ? (process.env.BB_BINARY_PATH ??
110
- resolve(dirname(fileURLToPath(import.meta.url)), '../../../../barretenberg/cpp/build/bin/bb'))
111
- : undefined;
112
- const bbWorkingDirectory = dataDir + '/bb';
113
- mkdirSync(bbWorkingDirectory, { recursive: true });
106
+ switch (prover) {
107
+ case 'native':
108
+ await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
109
+ break;
110
+ case 'wasm':
111
+ await Barretenberg.initSingleton({ backend: BackendType.Wasm });
112
+ break;
113
+ }
114
114
 
115
115
  const overridePXEConfig: Partial<PXEConfig> = {
116
116
  proverEnabled,
117
- bbBinaryPath: prover === 'native' ? bbBinaryPath : undefined,
118
- bbWorkingDirectory: prover === 'native' ? bbWorkingDirectory : undefined,
119
117
  dataDirectory: join(dataDir, 'pxe'),
120
118
  };
121
119
 
@@ -147,6 +145,8 @@ async function main() {
147
145
  injectCommands(program, userLog, debugLogger, walletAndNodeWrapper, db);
148
146
  injectInternalCommands(program, userLog, db);
149
147
  await program.parseAsync(process.argv);
148
+
149
+ await Barretenberg.destroySingleton();
150
150
  }
151
151
 
152
152
  main().catch(err => {
@@ -30,7 +30,7 @@ export async function authorizeAction(
30
30
  );
31
31
  }
32
32
 
33
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
33
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
34
34
  const action = contract.methods[functionName](...functionArgs);
35
35
 
36
36
  const setAuthwitnessInteraction = await SetPublicAuthwitContractInteraction.create(
@@ -28,7 +28,7 @@ export async function createAuthwit(
28
28
  );
29
29
  }
30
30
 
31
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
31
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
32
32
  const call = await contract.methods[functionName](...functionArgs).getFunctionCall();
33
33
 
34
34
  const witness = await wallet.createAuthWit(from, { caller, call });
package/src/cmds/index.ts CHANGED
@@ -346,7 +346,7 @@ export function injectCommands(
346
346
  log,
347
347
  );
348
348
  if (db && sentTx) {
349
- const txAlias = alias ? alias : `${functionName}-${randomBytes(16).toString()}`;
349
+ const txAlias = alias ? alias : `${functionName}-${randomBytes(16).toString('hex')}`;
350
350
  await db.storeTx(sentTx, log, txAlias);
351
351
  }
352
352
  });
@@ -28,7 +28,7 @@ export async function profile(
28
28
  ) {
29
29
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
30
30
 
31
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
31
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
32
32
  const call = contract.methods[functionName](...functionArgs);
33
33
 
34
34
  const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
package/src/cmds/send.ts CHANGED
@@ -27,7 +27,7 @@ export async function send(
27
27
  ) {
28
28
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
29
29
 
30
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
30
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
31
31
  const call = contract.methods[functionName](...functionArgs);
32
32
 
33
33
  const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
@@ -27,7 +27,7 @@ export async function simulate(
27
27
  ) {
28
28
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
29
29
 
30
- const contract = await Contract.at(contractAddress, contractArtifact, wallet);
30
+ const contract = Contract.at(contractAddress, contractArtifact, wallet);
31
31
  const call = contract.methods[functionName](...functionArgs);
32
32
  const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
33
33
  const simulationResult = await call.simulate({