@aztec/cli-wallet 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa

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.
Files changed (86) hide show
  1. package/README.md +2 -2
  2. package/dest/bin/index.d.ts +2 -1
  3. package/dest/bin/index.js +21 -11
  4. package/dest/cmds/authorize_action.d.ts +2 -2
  5. package/dest/cmds/authorize_action.d.ts.map +1 -1
  6. package/dest/cmds/authorize_action.js +5 -3
  7. package/dest/cmds/bridge_fee_juice.d.ts +2 -2
  8. package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
  9. package/dest/cmds/bridge_fee_juice.js +3 -2
  10. package/dest/cmds/check_tx.d.ts +1 -1
  11. package/dest/cmds/check_tx.d.ts.map +1 -1
  12. package/dest/cmds/check_tx.js +57 -26
  13. package/dest/cmds/create_account.d.ts +7 -5
  14. package/dest/cmds/create_account.d.ts.map +1 -1
  15. package/dest/cmds/create_account.js +47 -31
  16. package/dest/cmds/create_authwit.d.ts +1 -1
  17. package/dest/cmds/create_authwit.js +1 -1
  18. package/dest/cmds/deploy.d.ts +5 -4
  19. package/dest/cmds/deploy.d.ts.map +1 -1
  20. package/dest/cmds/deploy.js +65 -36
  21. package/dest/cmds/deploy_account.d.ts +4 -3
  22. package/dest/cmds/deploy_account.d.ts.map +1 -1
  23. package/dest/cmds/deploy_account.js +38 -24
  24. package/dest/cmds/get_fee_juice_balance.d.ts +5 -0
  25. package/dest/cmds/get_fee_juice_balance.d.ts.map +1 -0
  26. package/dest/cmds/get_fee_juice_balance.js +27 -0
  27. package/dest/cmds/import_test_accounts.d.ts +1 -1
  28. package/dest/cmds/import_test_accounts.d.ts.map +1 -1
  29. package/dest/cmds/import_test_accounts.js +1 -1
  30. package/dest/cmds/index.d.ts +1 -1
  31. package/dest/cmds/index.d.ts.map +1 -1
  32. package/dest/cmds/index.js +33 -17
  33. package/dest/cmds/profile.d.ts +1 -1
  34. package/dest/cmds/profile.js +1 -1
  35. package/dest/cmds/register_contract.d.ts +1 -1
  36. package/dest/cmds/register_sender.d.ts +1 -1
  37. package/dest/cmds/send.d.ts +5 -4
  38. package/dest/cmds/send.d.ts.map +1 -1
  39. package/dest/cmds/send.js +34 -21
  40. package/dest/cmds/simulate.d.ts +1 -1
  41. package/dest/cmds/simulate.d.ts.map +1 -1
  42. package/dest/cmds/simulate.js +5 -4
  43. package/dest/storage/wallet_db.d.ts +10 -5
  44. package/dest/storage/wallet_db.d.ts.map +1 -1
  45. package/dest/storage/wallet_db.js +61 -32
  46. package/dest/utils/authorizations.d.ts +1 -1
  47. package/dest/utils/cli_wallet_and_node_wrapper.d.ts +1 -1
  48. package/dest/utils/cli_wallet_and_node_wrapper.d.ts.map +1 -1
  49. package/dest/utils/constants.d.ts +4 -0
  50. package/dest/utils/constants.d.ts.map +1 -0
  51. package/dest/utils/constants.js +8 -0
  52. package/dest/utils/ecdsa.d.ts +1 -1
  53. package/dest/utils/options/fees.d.ts +5 -3
  54. package/dest/utils/options/fees.d.ts.map +1 -1
  55. package/dest/utils/options/fees.js +38 -12
  56. package/dest/utils/options/index.d.ts +1 -1
  57. package/dest/utils/options/options.d.ts +1 -1
  58. package/dest/utils/options/options.js +1 -1
  59. package/dest/utils/profiling.d.ts +1 -1
  60. package/dest/utils/profiling.d.ts.map +1 -1
  61. package/dest/utils/profiling.js +9 -1
  62. package/dest/utils/wallet.d.ts +30 -12
  63. package/dest/utils/wallet.d.ts.map +1 -1
  64. package/dest/utils/wallet.js +154 -68
  65. package/package.json +19 -15
  66. package/src/bin/index.ts +19 -13
  67. package/src/cmds/authorize_action.ts +2 -2
  68. package/src/cmds/bridge_fee_juice.ts +3 -2
  69. package/src/cmds/check_tx.ts +65 -34
  70. package/src/cmds/create_account.ts +51 -28
  71. package/src/cmds/create_authwit.ts +1 -1
  72. package/src/cmds/deploy.ts +64 -37
  73. package/src/cmds/deploy_account.ts +39 -20
  74. package/src/cmds/get_fee_juice_balance.ts +37 -0
  75. package/src/cmds/import_test_accounts.ts +5 -1
  76. package/src/cmds/index.ts +63 -9
  77. package/src/cmds/profile.ts +1 -1
  78. package/src/cmds/send.ts +34 -14
  79. package/src/cmds/simulate.ts +6 -8
  80. package/src/storage/wallet_db.ts +65 -38
  81. package/src/utils/cli_wallet_and_node_wrapper.ts +1 -1
  82. package/src/utils/constants.ts +10 -0
  83. package/src/utils/options/fees.ts +46 -13
  84. package/src/utils/options/options.ts +1 -1
  85. package/src/utils/profiling.ts +15 -1
  86. package/src/utils/wallet.ts +170 -79
@@ -1,35 +1,53 @@
1
1
  import { type Account } from '@aztec/aztec.js/account';
2
2
  import { type InteractionFeeOptions } from '@aztec/aztec.js/contracts';
3
3
  import type { AztecNode } from '@aztec/aztec.js/node';
4
- import { UniqueNote } from '@aztec/aztec.js/note';
5
- import { AccountManager, type Aliased, BaseWallet, type SimulateOptions } from '@aztec/aztec.js/wallet';
6
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
7
- import { Fr } from '@aztec/foundation/fields';
4
+ import { AccountManager, type Aliased } from '@aztec/aztec.js/wallet';
5
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
6
+ import { Fr } from '@aztec/foundation/curves/bn254';
8
7
  import type { LogFn } from '@aztec/foundation/log';
8
+ import type { NotesFilter } from '@aztec/pxe/client/lazy';
9
9
  import type { PXEConfig } from '@aztec/pxe/config';
10
10
  import type { PXE } from '@aztec/pxe/server';
11
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
- import type { NotesFilter } from '@aztec/stdlib/note';
13
- import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
12
+ import type { Gas, GasUsed } from '@aztec/stdlib/gas';
13
+ import { NoteDao } from '@aztec/stdlib/note';
14
+ import type { TxProvingResult } from '@aztec/stdlib/tx';
15
+ import { ExecutionPayload } from '@aztec/stdlib/tx';
16
+ import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
14
17
  import type { WalletDB } from '../storage/wallet_db.js';
15
- export declare const AccountTypes: readonly ["schnorr", "ecdsasecp256r1", "ecdsasecp256r1ssh", "ecdsasecp256k1"];
16
- export type AccountType = (typeof AccountTypes)[number];
17
- export declare const BASE_FEE_PADDING = 0.5;
18
+ import type { AccountType } from './constants.js';
18
19
  export declare class CLIWallet extends BaseWallet {
19
20
  private userLog;
20
21
  private db?;
21
22
  private accountCache;
23
+ private stubClassIds;
22
24
  constructor(pxe: PXE, node: AztecNode, userLog: LogFn, db?: WalletDB | undefined);
23
25
  static create(node: AztecNode, log: LogFn, db?: WalletDB, overridePXEConfig?: Partial<PXEConfig>): Promise<CLIWallet>;
26
+ private registerAuthRegistry;
27
+ private initStubClasses;
24
28
  getAccounts(): Promise<Aliased<AztecAddress>[]>;
29
+ /**
30
+ * Derives suggested total and teardown gas limits from simulated gas usage, padded and clamped to the
31
+ * network's per-tx admission limits.
32
+ * @param gasUsed - The gas consumed during simulation (from a `simulate({ includeMetadata: true })` result).
33
+ */
34
+ estimateGasLimits(gasUsed: GasUsed): Promise<{
35
+ gasLimits: Gas;
36
+ teardownGasLimits: Gas;
37
+ }>;
25
38
  private createCancellationTxExecutionRequest;
26
39
  proveCancellationTx(from: AztecAddress, txNonce: Fr, increasedFee: InteractionFeeOptions): Promise<TxProvingResult>;
27
40
  getAccountFromAddress(address: AztecAddress): Promise<Account>;
28
41
  private createAccount;
29
42
  createOrRetrieveAccount(address?: AztecAddress, secretKey?: Fr, type?: AccountType, salt?: Fr, publicKey?: string): Promise<AccountManager>;
30
43
  private getFakeAccountDataFor;
31
- simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
44
+ /**
45
+ * Uses a stub account for kernelless simulation, bypassing real account authorization.
46
+ * Uses DefaultEntrypoint directly for NO_FROM transactions.
47
+ */
48
+ protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<TxSimulationResultWithAppOffset>;
32
49
  getContracts(): Promise<AztecAddress[]>;
33
- getNotes(filter: NotesFilter): Promise<UniqueNote[]>;
50
+ getNotes(filter: NotesFilter): Promise<NoteDao[]>;
51
+ getContractArtifact(id: Fr): Promise<import("@aztec/stdlib/abi").ContractArtifact | undefined>;
34
52
  }
35
- //# sourceMappingURL=wallet.d.ts.map
53
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sRUFBRSxLQUFLLE9BQU8sRUFBaUMsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RixPQUFPLEVBRUwsS0FBSyxxQkFBcUIsRUFFM0IsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsY0FBYyxFQUFFLEtBQUssT0FBTyxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDdEUsT0FBTyxFQUFFLCtCQUErQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFHekUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzFELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRzdDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FB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,CAAC,GACrC,OAAO,CAAC,SAAS,CAAC,CAOpB;YAEa,oBAAoB;YAUpB,eAAe;IAed,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAQ7D;IAED;;;;OAIG;IACG,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,GAAG,CAAC;QAAC,iBAAiB,EAAE,GAAG,CAAA;KAAE,CAAC,CAG7F;YAEa,oCAAoC;IA4B5C,mBAAmB,CACvB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,EAAE,EACX,YAAY,EAAE,qBAAqB,GAClC,OAAO,CAAC,eAAe,CAAC,CAG1B;IAEc,qBAAqB,CAAC,OAAO,EAAE,YAAY,oBAazD;YAEa,aAAa;IAyBrB,uBAAuB,CAC3B,OAAO,CAAC,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,EAAE,EACd,IAAI,GAAE,WAAuB,EAC7B,IAAI,CAAC,EAAE,EAAE,EACT,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC,CA2DzB;YAQa,qBAAqB;IAsBnC;;;OAGG;IACH,UAAyB,qBAAqB,CAC5C,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,+BAA+B,CAAC,CA2C1C;IAID,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAEtC;IAID,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEhD;IAID,mBAAmB,CAAC,EAAE,EAAE,EAAE,qEAEzB;CACF"}
@@ -1,65 +1,107 @@
1
1
  import { EcdsaRAccountContract, EcdsaRSSHAccountContract } from '@aztec/accounts/ecdsa';
2
- import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
3
- import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
2
+ import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/ecdsa/stub';
3
+ import { SchnorrAccountContract, SchnorrInitializerlessAccountContract } from '@aztec/accounts/schnorr';
4
+ import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/schnorr/stub';
4
5
  import { getIdentities } from '@aztec/accounts/utils';
5
- import { SignerlessAccount } from '@aztec/aztec.js/account';
6
- import { getContractInstanceFromInstantiationParams, getGasLimits } from '@aztec/aztec.js/contracts';
7
- import { AccountManager, BaseWallet } from '@aztec/aztec.js/wallet';
8
- import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
9
- import { Fr } from '@aztec/foundation/fields';
6
+ import { NO_FROM } from '@aztec/aztec.js/account';
7
+ import { ContractFunctionInteraction, getContractClassFromArtifact } from '@aztec/aztec.js/contracts';
8
+ import { AccountManager } from '@aztec/aztec.js/wallet';
9
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
10
+ import { DefaultEntrypoint } from '@aztec/entrypoints/default';
11
+ import { Fr } from '@aztec/foundation/curves/bn254';
10
12
  import { createPXE, getPXEConfig } from '@aztec/pxe/server';
13
+ import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
11
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
15
  import { deriveSigningKey } from '@aztec/stdlib/keys';
16
+ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
17
+ import { BaseWallet, getGasLimits } from '@aztec/wallet-sdk/base-wallet';
13
18
  import { extractECDSAPublicKeyFromBase64String } from './ecdsa.js';
14
- import { printGasEstimates } from './options/fees.js';
15
- export const AccountTypes = [
16
- 'schnorr',
17
- 'ecdsasecp256r1',
18
- 'ecdsasecp256r1ssh',
19
- 'ecdsasecp256k1'
20
- ];
21
- export const BASE_FEE_PADDING = 0.5;
19
+ /** Padding the CLI wallet applies to simulated gas usage when deriving declared gas limits. */ const DEFAULT_ESTIMATED_GAS_PADDING = 0.1;
22
20
  export class CLIWallet extends BaseWallet {
23
21
  userLog;
24
22
  db;
25
23
  accountCache;
24
+ // Stub class ids, populated on wallet startup
25
+ // to avoid redundant work per simulation
26
+ stubClassIds;
26
27
  constructor(pxe, node, userLog, db){
27
- super(pxe, node), this.userLog = userLog, this.db = db, this.accountCache = new Map();
28
+ super(pxe, node), this.userLog = userLog, this.db = db, this.accountCache = new Map(), this.stubClassIds = new Map();
28
29
  this.cancellableTransactions = true;
29
30
  }
30
31
  static async create(node, log, db, overridePXEConfig) {
31
32
  const pxeConfig = Object.assign(getPXEConfig(), overridePXEConfig);
32
33
  const pxe = await createPXE(node, pxeConfig);
33
- return new CLIWallet(pxe, node, log, db);
34
+ const wallet = new CLIWallet(pxe, node, log, db);
35
+ await wallet.initStubClasses();
36
+ await wallet.registerAuthRegistry();
37
+ return wallet;
38
+ }
39
+ async registerAuthRegistry() {
40
+ const { instance, artifact } = await getStandardAuthRegistry();
41
+ await this.pxe.registerContractClass(artifact);
42
+ await this.pxe.registerContract(instance);
43
+ }
44
+ /**
45
+ * Hashes and registers the stub class for every supported account type with PXE, populating
46
+ * stubClassIds. Called on wallet initialization.
47
+ */ async initStubClasses() {
48
+ const { id: schnorrClassId } = await getContractClassFromArtifact(StubSchnorrAccountContractArtifact);
49
+ await this.pxe.registerContractClass(StubSchnorrAccountContractArtifact);
50
+ // ecdsa stubs share the same class id
51
+ const { id: ecdsaClassId } = await getContractClassFromArtifact(StubEcdsaAccountContractArtifact);
52
+ await this.pxe.registerContractClass(StubEcdsaAccountContractArtifact);
53
+ this.stubClassIds.set('schnorr', schnorrClassId);
54
+ this.stubClassIds.set('schnorr_initializerless', schnorrClassId);
55
+ this.stubClassIds.set('ecdsasecp256k1', ecdsaClassId);
56
+ this.stubClassIds.set('ecdsasecp256r1', ecdsaClassId);
57
+ this.stubClassIds.set('ecdsasecp256r1ssh', ecdsaClassId);
34
58
  }
35
59
  async getAccounts() {
36
60
  const accounts = await this.db?.listAliases('accounts') ?? [];
37
- return Promise.resolve(accounts.map(({ key, value })=>({
38
- alias: value,
39
- item: AztecAddress.fromString(key)
40
- })));
61
+ return Promise.resolve(accounts.map(({ key, value })=>{
62
+ const alias = key.includes(':') ? key.slice(key.indexOf(':') + 1) : key;
63
+ return {
64
+ alias,
65
+ item: AztecAddress.fromStringUnsafe(value)
66
+ };
67
+ }));
68
+ }
69
+ /**
70
+ * Derives suggested total and teardown gas limits from simulated gas usage, padded and clamped to the
71
+ * network's per-tx admission limits.
72
+ * @param gasUsed - The gas consumed during simulation (from a `simulate({ includeMetadata: true })` result).
73
+ */ async estimateGasLimits(gasUsed) {
74
+ const maxTxGasLimits = await this.getMaxTxGasLimits();
75
+ return getGasLimits(gasUsed, maxTxGasLimits, DEFAULT_ESTIMATED_GAS_PADDING);
41
76
  }
42
77
  async createCancellationTxExecutionRequest(from, txNonce, increasedFee) {
43
- const feeOptions = await this.getDefaultFeeOptions(from, increasedFee);
78
+ const executionPayload = ExecutionPayload.empty();
79
+ const feeOptions = await this.completeFeeOptions({
80
+ from,
81
+ feePayer: executionPayload.feePayer,
82
+ gasSettings: increasedFee.gasSettings
83
+ });
44
84
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
45
85
  const fromAccount = await this.getAccountFromAddress(from);
86
+ const chainInfo = await this.getChainInfo();
46
87
  const executionOptions = {
47
88
  txNonce,
48
89
  cancellable: this.cancellableTransactions,
90
+ // If from is an address, feeOptions include the way the account contract should handle the fee payment
49
91
  feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
50
92
  };
51
- return await fromAccount.createTxExecutionRequest(feeExecutionPayload ?? ExecutionPayload.empty(), feeOptions.gasSettings, executionOptions);
93
+ return await fromAccount.createTxExecutionRequest(feeExecutionPayload ?? executionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
52
94
  }
53
95
  async proveCancellationTx(from, txNonce, increasedFee) {
54
96
  const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
55
- return await this.pxe.proveTx(cancellationTxRequest);
97
+ return await this.pxe.proveTx(cancellationTxRequest, {
98
+ scopes: this.scopesFrom(from),
99
+ senderForTags: from
100
+ });
56
101
  }
57
102
  async getAccountFromAddress(address) {
58
103
  let account;
59
- if (address.equals(AztecAddress.ZERO)) {
60
- const chainInfo = await this.getChainInfo();
61
- account = new SignerlessAccount(chainInfo);
62
- } else if (this.accountCache.has(address.toString())) {
104
+ if (this.accountCache.has(address.toString())) {
63
105
  return this.accountCache.get(address.toString());
64
106
  } else {
65
107
  const accountManager = await this.createOrRetrieveAccount(address);
@@ -71,11 +113,30 @@ export class CLIWallet extends BaseWallet {
71
113
  return account;
72
114
  }
73
115
  async createAccount(secret, salt, contract) {
74
- const accountManager = await AccountManager.create(this, secret, contract, salt);
116
+ const accountManager = await AccountManager.create(this, secret, contract, {
117
+ salt
118
+ });
75
119
  const instance = accountManager.getInstance();
76
120
  const artifact = await contract.getContractArtifact();
77
121
  await this.registerContract(instance, artifact, secret);
78
122
  this.accountCache.set(accountManager.address.toString(), await accountManager.getAccount());
123
+ // Initializerless accounts have no deployment tx; their address commits to the signing public key
124
+ // (via the contract's immutablesHash, resolved by AccountManager.create) and the constructor's
125
+ // storage writes are materialized locally via a simulated "store" call here.
126
+ if (contract instanceof SchnorrInitializerlessAccountContract) {
127
+ const constructorAbi = artifact.functions.find((f)=>f.name === 'constructor');
128
+ if (!constructorAbi) {
129
+ throw new Error('Could not create SchnorrInitializerlessAccount: constructor ABI not found');
130
+ }
131
+ const { x, y } = await contract.getSigningPublicKey();
132
+ const storeCall = new ContractFunctionInteraction(this, instance.address, constructorAbi, [
133
+ x,
134
+ y
135
+ ]);
136
+ await storeCall.simulate({
137
+ from: instance.address
138
+ });
139
+ }
79
140
  return accountManager;
80
141
  }
81
142
  async createOrRetrieveAccount(address, secretKey, type = 'schnorr', salt, publicKey) {
@@ -93,6 +154,11 @@ export class CLIWallet extends BaseWallet {
93
154
  account = await this.createAccount(secretKey, salt, new SchnorrAccountContract(deriveSigningKey(secretKey)));
94
155
  break;
95
156
  }
157
+ case 'schnorr_initializerless':
158
+ {
159
+ account = await this.createAccount(secretKey, salt, new SchnorrInitializerlessAccountContract(deriveSigningKey(secretKey)));
160
+ break;
161
+ }
96
162
  case 'ecdsasecp256r1':
97
163
  {
98
164
  account = await this.createAccount(secretKey, salt, new EcdsaRAccountContract(deriveSigningKey(secretKey).toBuffer()));
@@ -123,62 +189,77 @@ export class CLIWallet extends BaseWallet {
123
189
  }
124
190
  return account;
125
191
  }
126
- async getFakeAccountDataFor(address) {
127
- const chainInfo = await this.getChainInfo();
192
+ /**
193
+ * Creates a stub account that impersonates the given address, allowing kernelless simulations
194
+ * to bypass the account's authorization mechanisms via contract overrides.
195
+ * @param address - The address of the account to impersonate
196
+ * @returns The stub account, contract instance, and artifact for simulation
197
+ */ async getFakeAccountDataFor(address) {
128
198
  const originalAccount = await this.getAccountFromAddress(address);
129
199
  const originalAddress = originalAccount.getCompleteAddress();
130
- const { contractInstance } = await this.pxe.getContractMetadata(originalAddress.address);
200
+ const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
131
201
  if (!contractInstance) {
132
202
  throw new Error(`No contract instance found for address: ${originalAddress.address}`);
133
203
  }
134
- const stubAccount = createStubAccount(originalAddress, chainInfo);
135
- const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
136
- salt: Fr.random()
137
- });
204
+ const { type } = await this.db.retrieveAccount(address);
205
+ const stubAccount = type === 'schnorr' || type === 'schnorr_initializerless' ? createStubSchnorrAccount(originalAddress) : createStubEcdsaAccount(originalAddress);
206
+ const stubClassId = this.stubClassIds.get(type);
207
+ if (!stubClassId) {
208
+ throw new Error(`Stub class for account type '${type}' was not registered at wallet init. This is a bug — initStubClasses should cover every supported AccountType.`);
209
+ }
210
+ const instance = {
211
+ ...contractInstance,
212
+ currentContractClassId: stubClassId
213
+ };
138
214
  return {
139
215
  account: stubAccount,
140
- instance,
141
- artifact: StubAccountContractArtifact
216
+ instance
142
217
  };
143
218
  }
144
- async simulateTx(executionPayload, opts) {
145
- let simulationResults;
146
- const feeOptions = opts.fee?.estimateGas ? await this.getFeeOptionsForGasEstimation(opts.from, opts.fee) : await this.getDefaultFeeOptions(opts.from, opts.fee);
219
+ /**
220
+ * Uses a stub account for kernelless simulation, bypassing real account authorization.
221
+ * Uses DefaultEntrypoint directly for NO_FROM transactions.
222
+ */ async simulateViaEntrypoint(executionPayload, opts) {
223
+ const { from, feeOptions, additionalScopes, sendMessagesAs } = opts;
224
+ const scopes = this.scopesFrom(from, additionalScopes);
147
225
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
148
- const executionOptions = {
149
- txNonce: Fr.random(),
150
- cancellable: this.cancellableTransactions,
151
- feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
152
- };
153
226
  const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
154
227
  feeExecutionPayload,
155
228
  executionPayload
156
229
  ]) : executionPayload;
157
- // Kernelless simulations using the multicall entrypoints are not currently supported,
158
- // since we only override proper account contracts.
159
- // TODO: allow disabling kernels even when no overrides are necessary
160
- if (opts.from.equals(AztecAddress.ZERO)) {
161
- const fromAccount = await this.getAccountFromAddress(opts.from);
162
- const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
163
- simulationResults = await this.pxe.simulateTx(txRequest, true, opts?.skipTxValidation, opts?.skipFeeEnforcement ?? true);
230
+ const chainInfo = await this.getChainInfo();
231
+ let overrides;
232
+ let txRequest;
233
+ if (from === NO_FROM) {
234
+ const entrypoint = new DefaultEntrypoint();
235
+ txRequest = await entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
164
236
  } else {
165
- const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
166
- const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, executionOptions);
167
- const contractOverrides = {
168
- [opts.from.toString()]: {
169
- instance,
170
- artifact
237
+ const { account, instance } = await this.getFakeAccountDataFor(from);
238
+ overrides = {
239
+ contracts: {
240
+ [from.toString()]: {
241
+ instance
242
+ }
171
243
  }
172
244
  };
173
- simulationResults = await this.pxe.simulateTx(txRequest, true, true, true, {
174
- contracts: contractOverrides
175
- });
176
- }
177
- if (opts.fee?.estimateGas) {
178
- const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
179
- printGasEstimates(feeOptions, limits, this.userLog);
245
+ const executionOptions = {
246
+ txNonce: Fr.random(),
247
+ cancellable: this.cancellableTransactions,
248
+ // If from is an address, feeOptions include the way the account contract should handle the fee payment
249
+ feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
250
+ };
251
+ txRequest = await account.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
180
252
  }
181
- return simulationResults;
253
+ const result = await this.pxe.simulateTx(txRequest, {
254
+ simulatePublic: true,
255
+ skipFeeEnforcement: true,
256
+ skipTxValidation: true,
257
+ overrides,
258
+ scopes,
259
+ senderForTags: this.senderForTagsFrom(from, sendMessagesAs)
260
+ });
261
+ const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
262
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
182
263
  }
183
264
  // Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
184
265
  // this is just a CLI wallet.
@@ -188,6 +269,11 @@ export class CLIWallet extends BaseWallet {
188
269
  // Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
189
270
  // this is just a CLI wallet.
190
271
  getNotes(filter) {
191
- return this.pxe.getNotes(filter);
272
+ return this.pxe.debug.getNotes(filter);
273
+ }
274
+ // Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
275
+ // this is just a CLI wallet.
276
+ getContractArtifact(id) {
277
+ return this.pxe.getContractArtifact(id);
192
278
  }
193
279
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli-wallet",
3
- "version": "0.0.1-commit.b655e406",
3
+ "version": "0.0.1-commit.b8a057fa",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/cmds/index.js",
@@ -19,9 +19,9 @@
19
19
  "scripts": {
20
20
  "start": "node --no-warnings ./dest/bin",
21
21
  "start:debug": "node --inspect=0.0.0.0:9221 --no-warnings ./dest/bin",
22
- "dev": "LOG_LEVEL=debug && node ./dest/bin",
23
- "build": "yarn clean && tsc -b",
24
- "build:dev": "tsc -b --watch",
22
+ "dev": "LOG_LEVEL=\"debug; info: json-rpc, simulator\" node ./dest/bin",
23
+ "build": "yarn clean && ../scripts/tsc.sh",
24
+ "build:dev": "../scripts/tsc.sh --watch",
25
25
  "clean": "rm -rf ./dest .tsbuildinfo",
26
26
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
27
27
  },
@@ -67,17 +67,20 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@aztec/accounts": "0.0.1-commit.b655e406",
71
- "@aztec/aztec.js": "0.0.1-commit.b655e406",
72
- "@aztec/cli": "0.0.1-commit.b655e406",
73
- "@aztec/entrypoints": "0.0.1-commit.b655e406",
74
- "@aztec/ethereum": "0.0.1-commit.b655e406",
75
- "@aztec/foundation": "0.0.1-commit.b655e406",
76
- "@aztec/kv-store": "0.0.1-commit.b655e406",
77
- "@aztec/noir-contracts.js": "0.0.1-commit.b655e406",
78
- "@aztec/noir-noirc_abi": "0.0.1-commit.b655e406",
79
- "@aztec/pxe": "0.0.1-commit.b655e406",
80
- "@aztec/stdlib": "0.0.1-commit.b655e406",
70
+ "@aztec/accounts": "0.0.1-commit.b8a057fa",
71
+ "@aztec/aztec.js": "0.0.1-commit.b8a057fa",
72
+ "@aztec/bb.js": "0.0.1-commit.b8a057fa",
73
+ "@aztec/cli": "0.0.1-commit.b8a057fa",
74
+ "@aztec/entrypoints": "0.0.1-commit.b8a057fa",
75
+ "@aztec/ethereum": "0.0.1-commit.b8a057fa",
76
+ "@aztec/foundation": "0.0.1-commit.b8a057fa",
77
+ "@aztec/kv-store": "0.0.1-commit.b8a057fa",
78
+ "@aztec/noir-contracts.js": "0.0.1-commit.b8a057fa",
79
+ "@aztec/noir-noirc_abi": "0.0.1-commit.b8a057fa",
80
+ "@aztec/pxe": "0.0.1-commit.b8a057fa",
81
+ "@aztec/standard-contracts": "0.0.1-commit.b8a057fa",
82
+ "@aztec/stdlib": "0.0.1-commit.b8a057fa",
83
+ "@aztec/wallet-sdk": "0.0.1-commit.b8a057fa",
81
84
  "commander": "^12.1.0",
82
85
  "inquirer": "^10.1.8",
83
86
  "source-map-support": "^0.5.21",
@@ -88,6 +91,7 @@
88
91
  "@types/jest": "^30.0.0",
89
92
  "@types/node": "^22.15.17",
90
93
  "@types/source-map-support": "^0.5.10",
94
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
91
95
  "jest": "^30.0.0",
92
96
  "jest-mock-extended": "^4.0.0",
93
97
  "ts-jest": "^29.4.0",
package/src/bin/index.ts CHANGED
@@ -1,7 +1,9 @@
1
+ #!/usr/bin/env node
1
2
  import { computeSecretHash } from '@aztec/aztec.js/crypto';
2
3
  import { Fr } from '@aztec/aztec.js/fields';
3
4
  import { createAztecNodeClient } from '@aztec/aztec.js/node';
4
5
  import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
6
+ import { BackendType, Barretenberg } from '@aztec/bb.js';
5
7
  import { LOCALHOST } from '@aztec/cli/cli-utils';
6
8
  import { type LogFn, createConsoleLogger, createLogger } from '@aztec/foundation/log';
7
9
  import { openStoreAt } from '@aztec/kv-store/lmdb-v2';
@@ -9,10 +11,8 @@ import type { PXEConfig } from '@aztec/pxe/config';
9
11
  import { getPackageVersion } from '@aztec/stdlib/update-checker';
10
12
 
11
13
  import { Argument, Command, Option } from 'commander';
12
- import { mkdirSync } from 'fs';
13
14
  import { homedir } from 'os';
14
- import { dirname, join, resolve } from 'path';
15
- import { fileURLToPath } from 'url';
15
+ import { join } from 'path';
16
16
 
17
17
  import { injectCommands } from '../cmds/index.js';
18
18
  import { Aliases, WalletDB } from '../storage/wallet_db.js';
@@ -73,7 +73,7 @@ function injectInternalCommands(program: Command, log: LogFn, db: WalletDB) {
73
73
 
74
74
  /** CLI wallet main entrypoint */
75
75
  async function main() {
76
- const walletVersion = getPackageVersion() ?? '0.0.0';
76
+ const walletVersion = getPackageVersion();
77
77
 
78
78
  const db = WalletDB.getInstance();
79
79
  const walletAndNodeWrapper = new CliWalletAndNodeWrapper();
@@ -95,22 +95,26 @@ async function main() {
95
95
  .default(`http://${LOCALHOST}:8080`),
96
96
  )
97
97
  .hook('preSubcommand', async command => {
98
+ // Skip initialization if user is just requesting help
99
+ if (command.args.includes('--help') || command.args.includes('-h')) {
100
+ return;
101
+ }
102
+
98
103
  const { dataDir, nodeUrl, prover } = command.optsWithGlobals();
99
104
 
100
105
  const proverEnabled = prover !== 'none';
101
106
 
102
- const bbBinaryPath =
103
- prover === 'native'
104
- ? (process.env.BB_BINARY_PATH ??
105
- resolve(dirname(fileURLToPath(import.meta.url)), '../../../../barretenberg/cpp/build/bin/bb'))
106
- : undefined;
107
- const bbWorkingDirectory = dataDir + '/bb';
108
- mkdirSync(bbWorkingDirectory, { recursive: true });
107
+ switch (prover) {
108
+ case 'native':
109
+ await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
110
+ break;
111
+ case 'wasm':
112
+ await Barretenberg.initSingleton({ backend: BackendType.Wasm });
113
+ break;
114
+ }
109
115
 
110
116
  const overridePXEConfig: Partial<PXEConfig> = {
111
117
  proverEnabled,
112
- bbBinaryPath: prover === 'native' ? bbBinaryPath : undefined,
113
- bbWorkingDirectory: prover === 'native' ? bbWorkingDirectory : undefined,
114
118
  dataDirectory: join(dataDir, 'pxe'),
115
119
  };
116
120
 
@@ -142,6 +146,8 @@ async function main() {
142
146
  injectCommands(program, userLog, debugLogger, walletAndNodeWrapper, db);
143
147
  injectInternalCommands(program, userLog, db);
144
148
  await program.parseAsync(process.argv);
149
+
150
+ await Barretenberg.destroySingleton();
145
151
  }
146
152
 
147
153
  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(
@@ -39,7 +39,7 @@ export async function authorizeAction(
39
39
  { caller, action },
40
40
  true,
41
41
  );
42
- const witness = await setAuthwitnessInteraction.send().wait({ timeout: DEFAULT_TX_TIMEOUT_S });
42
+ const witness = await setAuthwitnessInteraction.send({ wait: { timeout: DEFAULT_TX_TIMEOUT_S } });
43
43
 
44
44
  log(`Authorized action ${functionName} on contract ${contractAddress} for caller ${caller}`);
45
45
 
@@ -2,8 +2,9 @@ import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
2
2
  import type { AztecNode } from '@aztec/aztec.js/node';
3
3
  import { ProtocolContractAddress } from '@aztec/aztec.js/protocol';
4
4
  import { prettyPrintJSON } from '@aztec/cli/utils';
5
- import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
6
- import { Fr } from '@aztec/foundation/fields';
5
+ import { createEthereumChain } from '@aztec/ethereum/chain';
6
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
7
+ import { Fr } from '@aztec/foundation/curves/bn254';
7
8
  import type { LogFn, Logger } from '@aztec/foundation/log';
8
9
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
9
10
  import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';