@aztec/cli-wallet 3.0.0-nightly.20250930 → 3.0.0-nightly.20251002

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 (43) hide show
  1. package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
  2. package/dest/cmds/bridge_fee_juice.js +2 -3
  3. package/dest/cmds/cancel_tx.d.ts +2 -2
  4. package/dest/cmds/cancel_tx.d.ts.map +1 -1
  5. package/dest/cmds/cancel_tx.js +3 -1
  6. package/dest/cmds/create_account.d.ts +2 -2
  7. package/dest/cmds/create_account.d.ts.map +1 -1
  8. package/dest/cmds/create_account.js +18 -42
  9. package/dest/cmds/deploy.d.ts +3 -2
  10. package/dest/cmds/deploy.d.ts.map +1 -1
  11. package/dest/cmds/deploy.js +6 -3
  12. package/dest/cmds/deploy_account.d.ts +2 -2
  13. package/dest/cmds/deploy_account.d.ts.map +1 -1
  14. package/dest/cmds/deploy_account.js +19 -40
  15. package/dest/cmds/index.d.ts.map +1 -1
  16. package/dest/cmds/index.js +26 -23
  17. package/dest/cmds/profile.d.ts +3 -2
  18. package/dest/cmds/profile.d.ts.map +1 -1
  19. package/dest/cmds/profile.js +6 -2
  20. package/dest/cmds/send.d.ts +3 -2
  21. package/dest/cmds/send.d.ts.map +1 -1
  22. package/dest/cmds/send.js +15 -6
  23. package/dest/cmds/simulate.d.ts +3 -2
  24. package/dest/cmds/simulate.d.ts.map +1 -1
  25. package/dest/cmds/simulate.js +6 -3
  26. package/dest/utils/options/fees.d.ts +9 -13
  27. package/dest/utils/options/fees.d.ts.map +1 -1
  28. package/dest/utils/options/fees.js +25 -45
  29. package/dest/utils/wallet.d.ts +5 -6
  30. package/dest/utils/wallet.d.ts.map +1 -1
  31. package/dest/utils/wallet.js +38 -24
  32. package/package.json +12 -12
  33. package/src/cmds/bridge_fee_juice.ts +7 -6
  34. package/src/cmds/cancel_tx.ts +11 -3
  35. package/src/cmds/create_account.ts +21 -47
  36. package/src/cmds/deploy.ts +6 -4
  37. package/src/cmds/deploy_account.ts +21 -44
  38. package/src/cmds/index.ts +52 -19
  39. package/src/cmds/profile.ts +6 -3
  40. package/src/cmds/send.ts +13 -8
  41. package/src/cmds/simulate.ts +6 -4
  42. package/src/utils/options/fees.ts +38 -55
  43. package/src/utils/wallet.ts +60 -36
@@ -1 +1 @@
1
- {"version":3,"file":"bridge_fee_juice.d.ts","sourceRoot":"","sources":["../../src/cmds/bridge_fee_juice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,iBAAiB,CAAC;AAG1E,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,QAAQ,oBAAS,EACjB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,kCAkEpB"}
1
+ {"version":3,"file":"bridge_fee_juice.d.ts","sourceRoot":"","sources":["../../src/cmds/bridge_fee_juice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoD,MAAM,iBAAiB,CAAC;AAGnG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,QAAQ,oBAAS,EACjB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,kCAmEpB"}
@@ -1,4 +1,4 @@
1
- import { L1FeeJuicePortalManager } from '@aztec/aztec.js';
1
+ import { L1FeeJuicePortalManager, ProtocolContractAddress } from '@aztec/aztec.js';
2
2
  import { prettyPrintJSON } from '@aztec/cli/utils';
3
3
  import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
4
4
  import { Fr } from '@aztec/foundation/fields';
@@ -7,7 +7,6 @@ export async function bridgeL1FeeJuice(amount, recipient, node, l1RpcUrls, chain
7
7
  // Prepare L1 client
8
8
  const chain = createEthereumChain(l1RpcUrls, chainId);
9
9
  const client = createExtendedL1Client(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
10
- const { protocolContractAddresses: { feeJuice: feeJuiceAddress } } = await node.getNodeInfo();
11
10
  // Setup portal manager
12
11
  const portal = await L1FeeJuicePortalManager.new(node, client, debugLogger);
13
12
  const { claimAmount, claimSecret, messageHash, messageLeafIndex } = await portal.bridgeTokensPublic(recipient, amount, mint);
@@ -34,7 +33,7 @@ export async function bridgeL1FeeJuice(amount, recipient, node, l1RpcUrls, chain
34
33
  const delayedCheck = (delay)=>{
35
34
  return new Promise((resolve, reject)=>{
36
35
  setTimeout(()=>{
37
- void getNonNullifiedL1ToL2MessageWitness(node, feeJuiceAddress, Fr.fromHexString(messageHash), claimSecret).then((witness)=>resolve(witness)).catch((err)=>reject(err));
36
+ void getNonNullifiedL1ToL2MessageWitness(node, ProtocolContractAddress.FeeJuice, Fr.fromHexString(messageHash), claimSecret).then((witness)=>resolve(witness)).catch((err)=>reject(err));
38
37
  }, delay);
39
38
  });
40
39
  };
@@ -1,4 +1,4 @@
1
- import { AztecAddress, type FeePaymentMethod, type TxHash } from '@aztec/aztec.js';
1
+ import { type AppConfigurableFeePaymentMethod, AztecAddress, type TxHash } from '@aztec/aztec.js';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
4
  import { GasFees, GasSettings } from '@aztec/stdlib/gas';
@@ -8,5 +8,5 @@ export declare function cancelTx(wallet: CLIWallet, from: AztecAddress, { txHash
8
8
  gasSettings: GasSettings;
9
9
  txNonce: Fr;
10
10
  cancellable: boolean;
11
- }, paymentMethod: FeePaymentMethod, increasedFees: GasFees, maxFeesPerGas: GasFees | undefined, log: LogFn): Promise<void>;
11
+ }, paymentMethod: AppConfigurableFeePaymentMethod | undefined, increasedFees: GasFees, maxFeesPerGas: GasFees | undefined, log: LogFn): Promise<void>;
12
12
  //# sourceMappingURL=cancel_tx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cancel_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/cancel_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAU,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAErG,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,YAAY,EAClB,EACE,MAAM,EACN,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EACP,WAAW,GACZ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,EAClF,aAAa,EAAE,gBAAgB,EAC/B,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GAAG,SAAS,EAClC,GAAG,EAAE,KAAK,iBAwCX"}
1
+ {"version":3,"file":"cancel_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/cancel_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,+BAA+B,EACpC,YAAY,EAGZ,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,YAAY,EAClB,EACE,MAAM,EACN,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EACP,WAAW,GACZ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,EAClF,aAAa,EAAE,+BAA+B,GAAG,SAAS,EAC1D,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GAAG,SAAS,EAClC,GAAG,EAAE,KAAK,iBA0CX"}
@@ -14,7 +14,9 @@ export async function cancelTx(wallet, from, { txHash, gasSettings: prevTxGasSet
14
14
  ...prevTxGasSettings,
15
15
  maxPriorityFeesPerGas,
16
16
  maxFeesPerGas: maxFeesPerGas ?? prevTxGasSettings.maxFeesPerGas
17
- })
17
+ }),
18
+ endSetup: false,
19
+ isFeePayer: false
18
20
  };
19
21
  const txProvingResult = await wallet.proveCancellationTx(from, txNonce, feeOptions);
20
22
  const sentTx = new SentTx(wallet, async ()=>{
@@ -1,9 +1,9 @@
1
- import { AztecAddress } from '@aztec/aztec.js';
1
+ import { AztecAddress, type AztecNode } from '@aztec/aztec.js';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import type { LogFn, Logger } from '@aztec/foundation/log';
4
4
  import { CLIFeeArgs } from '../utils/options/fees.js';
5
5
  import { type AccountType, CLIWallet } from '../utils/wallet.js';
6
- export declare function createAccount(wallet: CLIWallet, accountType: AccountType, secretKey: Fr | undefined, publicKey: string | undefined, alias: string | undefined, registerOnly: boolean, publicDeploy: boolean, skipInitialization: boolean, wait: boolean, feeOpts: CLIFeeArgs, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<{
6
+ export declare function createAccount(wallet: CLIWallet, aztecNode: AztecNode, accountType: AccountType, secretKey: Fr | undefined, publicKey: string | undefined, alias: string | undefined, deployer: AztecAddress | undefined, registerOnly: boolean, skipInitialization: boolean, publicDeploy: boolean, registerClass: boolean, wait: boolean, feeOpts: CLIFeeArgs, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<{
7
7
  alias: string | undefined;
8
8
  address: AztecAddress;
9
9
  secretKey: Fr;
@@ -1 +1 @@
1
- {"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+C,MAAM,iBAAiB,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,kBAAkB,EAAE,OAAO,EAC3B,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;;GA+IX"}
1
+ {"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAA6B,MAAM,iBAAiB,CAAC;AAE1F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,YAAY,EAAE,OAAO,EACrB,kBAAkB,EAAE,OAAO,EAC3B,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;;GAkHX"}
@@ -1,9 +1,9 @@
1
- import { AztecAddress, ProtocolContractAddress } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js';
2
2
  import { prettyPrintJSON } from '@aztec/cli/cli-utils';
3
3
  import { Fr } from '@aztec/foundation/fields';
4
4
  import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
5
5
  import { printProfileResult } from '../utils/profiling.js';
6
- export async function createAccount(wallet, accountType, secretKey, publicKey, alias, registerOnly, publicDeploy, skipInitialization, wait, feeOpts, json, verbose, debugLogger, log) {
6
+ export async function createAccount(wallet, aztecNode, accountType, secretKey, publicKey, alias, deployer, registerOnly, skipInitialization, publicDeploy, registerClass, wait, feeOpts, json, verbose, debugLogger, log) {
7
7
  secretKey ??= Fr.random();
8
8
  const account = await wallet.createOrRetrieveAccount(undefined /* address, we don't have it yet */ , secretKey, accountType, Fr.ZERO, publicKey);
9
9
  const { salt } = account.getInstance();
@@ -18,7 +18,6 @@ export async function createAccount(wallet, accountType, secretKey, publicKey, a
18
18
  out.partialAddress = partialAddress;
19
19
  out.salt = salt;
20
20
  out.initHash = account.getInstance().initializationHash;
21
- out.deployer = account.getInstance().deployer;
22
21
  } else {
23
22
  log(`\nNew account:\n`);
24
23
  log(`Address: ${address.toString()}`);
@@ -29,54 +28,31 @@ export async function createAccount(wallet, accountType, secretKey, publicKey, a
29
28
  log(`Partial address: ${partialAddress.toString()}`);
30
29
  log(`Salt: ${salt.toString()}`);
31
30
  log(`Init hash: ${account.getInstance().initializationHash.toString()}`);
32
- log(`Deployer: ${account.getInstance().deployer.toString()}`);
33
31
  }
34
32
  let tx;
35
33
  let txReceipt;
36
34
  if (!registerOnly) {
37
- const userFeeOptions = await feeOpts.toUserFeeOptions(wallet, address);
38
- const feePayer = await userFeeOptions.paymentMethod?.getFeePayer();
39
- let paymentAsset;
40
- try {
41
- paymentAsset = await userFeeOptions.paymentMethod?.getAsset();
42
- // eslint-disable-next-line no-empty
43
- } catch {}
44
- // If someone else is paying the fee, set them as the deployment account.
45
- // What we're trying to identify here is that the fee payment method is
46
- // FeeJuicePaymentMethod(anAddressThatsNotTheAccountBeingDeployed)
47
- const delegatedDeployment = paymentAsset?.equals(ProtocolContractAddress.FeeJuice) && !feePayer?.equals(account.getAddress());
48
- const from = delegatedDeployment ? feePayer : AztecAddress.ZERO;
49
- const deployOpts = {
50
- skipClassPublication: !publicDeploy,
35
+ const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
36
+ const delegatedDeployment = deployer && !account.address.equals(deployer);
37
+ const from = delegatedDeployment ? deployer : AztecAddress.ZERO;
38
+ const deployAccountOpts = {
39
+ skipClassPublication: !registerClass,
51
40
  skipInstancePublication: !publicDeploy,
52
41
  skipInitialization,
53
42
  from,
54
- fee: userFeeOptions,
55
- // Do not mix the deployer in the address, since the account
56
- // was created (and thus its address was fixed) like this
57
- universalDeploy: true,
58
- contractAddressSalt: salt
43
+ fee: {
44
+ paymentMethod,
45
+ gasSettings
46
+ }
59
47
  };
60
- /*
61
- * This is usually handled by accountManager.create(), but we're accessing the lower
62
- * level method to get gas and timings. That means we have to replicate some of the logic here.
63
- * In case we're initializing and/or publishing our own account, we need to hijack the payment method for the fee,
64
- * wrapping it in the one that will make use of the freshly deployed account's
65
- * entrypoint. For reference, see aztec.js/src/account_manager.ts:sendAccountContractSetupTx()
66
- * Also, salt and universalDeploy have to be explicitly provided
67
- */ deployOpts.fee = !delegatedDeployment && deployOpts.fee ? {
68
- ...deployOpts.fee,
69
- paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
70
- } : deployOpts.fee;
71
48
  const deployMethod = await account.getDeployMethod();
72
- const { stats, estimatedGas } = await deployMethod.simulate({
73
- ...deployOpts,
49
+ const { estimatedGas } = await deployMethod.simulate({
50
+ ...deployAccountOpts,
74
51
  fee: {
75
- ...deployOpts.fee,
52
+ ...deployAccountOpts.fee,
76
53
  estimateGas: true
77
54
  }
78
55
  });
79
- printProfileResult(stats, log);
80
56
  if (feeOpts.estimateOnly) {
81
57
  if (json) {
82
58
  out.fee = {
@@ -92,11 +68,11 @@ export async function createAccount(wallet, accountType, secretKey, publicKey, a
92
68
  }
93
69
  } else {
94
70
  const provenTx = await deployMethod.prove({
95
- ...deployOpts,
96
- fee: {
97
- ...deployOpts.fee,
71
+ ...deployAccountOpts,
72
+ fee: deployAccountOpts.fee ? {
73
+ ...deployAccountOpts.fee,
98
74
  gasSettings: estimatedGas
99
- }
75
+ } : undefined
100
76
  });
101
77
  if (verbose) {
102
78
  printProfileResult(provenTx.stats, log);
@@ -1,6 +1,7 @@
1
- import { AztecAddress, Fr, type Wallet } from '@aztec/aztec.js';
1
+ import { AztecAddress, type AztecNode, Fr } from '@aztec/aztec.js';
2
2
  import type { LogFn, Logger } from '@aztec/foundation/log';
3
3
  import { PublicKeys } from '@aztec/stdlib/keys';
4
4
  import { CLIFeeArgs } from '../utils/options/fees.js';
5
- export declare function deploy(wallet: Wallet, deployer: AztecAddress, artifactPath: string, json: boolean, publicKeys: PublicKeys | undefined, rawArgs: any[], salt: Fr | undefined, initializer: string | undefined, skipInstancePublication: boolean, skipClassPublication: boolean, skipInitialization: boolean | undefined, wait: boolean, feeOpts: CLIFeeArgs, verbose: boolean, timeout: number | undefined, debugLogger: Logger, log: LogFn): Promise<AztecAddress | undefined>;
5
+ import type { CLIWallet } from '../utils/wallet.js';
6
+ export declare function deploy(wallet: CLIWallet, node: AztecNode, deployer: AztecAddress, artifactPath: string, json: boolean, publicKeys: PublicKeys | undefined, rawArgs: any[], salt: Fr | undefined, initializer: string | undefined, skipInstancePublication: boolean, skipClassPublication: boolean, skipInitialization: boolean | undefined, wait: boolean, feeOpts: CLIFeeArgs, verbose: boolean, timeout: number | undefined, debugLogger: Logger, log: LogFn): Promise<AztecAddress | undefined>;
6
7
  //# sourceMappingURL=deploy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwC,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEtG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,wBAAsB,MAAM,CAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,OAAO,EAAE,GAAG,EAAE,EACd,IAAI,EAAE,EAAE,GAAG,SAAS,EACpB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,uBAAuB,EAAE,OAAO,EAChC,oBAAoB,EAAE,OAAO,EAC7B,kBAAkB,EAAE,OAAO,GAAG,SAAS,EACvC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,YAAuB,EACtC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,qCA+FX"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAwC,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAEzG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,MAAM,CAC1B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,OAAO,EAAE,GAAG,EAAE,EACd,IAAI,EAAE,EAAE,GAAG,SAAS,EACpB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,uBAAuB,EAAE,OAAO,EAChC,oBAAoB,EAAE,OAAO,EAC7B,kBAAkB,EAAE,OAAO,GAAG,SAAS,EACvC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,YAAuB,EACtC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,qCA+FX"}
@@ -4,7 +4,7 @@ import { getAllFunctionAbis, getInitializer } from '@aztec/stdlib/abi';
4
4
  import { PublicKeys } from '@aztec/stdlib/keys';
5
5
  import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
6
6
  import { printProfileResult } from '../utils/profiling.js';
7
- export async function deploy(wallet, deployer, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipInstancePublication, skipClassPublication, skipInitialization, wait, feeOpts, verbose, timeout = DEFAULT_TX_TIMEOUT_S, debugLogger, log) {
7
+ export async function deploy(wallet, node, deployer, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipInstancePublication, skipClassPublication, skipInitialization, wait, feeOpts, verbose, timeout = DEFAULT_TX_TIMEOUT_S, debugLogger, log) {
8
8
  const out = {};
9
9
  salt ??= Fr.random();
10
10
  const contractArtifact = await getContractArtifact(artifactPath, log);
@@ -22,9 +22,12 @@ export async function deploy(wallet, deployer, artifactPath, json, publicKeys, r
22
22
  debugLogger.debug(`Encoded arguments: ${args.join(', ')}`);
23
23
  }
24
24
  const deploy1 = contractDeployer.deploy(...args);
25
- const userFeeOptions = await feeOpts.toUserFeeOptions(wallet, deployer);
25
+ const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, deployer);
26
26
  const deployOpts = {
27
- fee: userFeeOptions,
27
+ fee: {
28
+ gasSettings,
29
+ paymentMethod
30
+ },
28
31
  from: deployer ?? AztecAddress.ZERO,
29
32
  contractAddressSalt: salt,
30
33
  universalDeploy: !deployer,
@@ -1,6 +1,6 @@
1
- import { AztecAddress } from '@aztec/aztec.js';
1
+ import { AztecAddress, type AztecNode } from '@aztec/aztec.js';
2
2
  import type { LogFn, Logger } from '@aztec/foundation/log';
3
3
  import type { CLIFeeArgs } from '../utils/options/fees.js';
4
4
  import type { CLIWallet } from '../utils/wallet.js';
5
- export declare function deployAccount(wallet: CLIWallet, address: AztecAddress, wait: boolean, registerClass: boolean, publicDeploy: boolean, feeOpts: CLIFeeArgs, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<void>;
5
+ export declare function deployAccount(wallet: CLIWallet, aztecNode: AztecNode, address: AztecAddress, wait: boolean, deployer: AztecAddress | undefined, registerClass: boolean, publicDeploy: boolean, skipInitialization: boolean, feeOpts: CLIFeeArgs, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<void>;
6
6
  //# sourceMappingURL=deploy_account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+C,MAAM,iBAAiB,CAAC;AAE5F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBA2HX"}
1
+ {"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAA6B,MAAM,iBAAiB,CAAC;AAE1F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,kBAAkB,EAAE,OAAO,EAC3B,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAiGX"}
@@ -1,12 +1,12 @@
1
- import { AztecAddress, ProtocolContractAddress } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js';
2
2
  import { prettyPrintJSON } from '@aztec/cli/cli-utils';
3
3
  import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
4
4
  import { printProfileResult } from '../utils/profiling.js';
5
- export async function deployAccount(wallet, address, wait, registerClass, publicDeploy, feeOpts, json, verbose, debugLogger, log) {
5
+ export async function deployAccount(wallet, aztecNode, address, wait, deployer, registerClass, publicDeploy, skipInitialization, feeOpts, json, verbose, debugLogger, log) {
6
6
  const out = {};
7
7
  const account = await wallet.createOrRetrieveAccount(address);
8
8
  const { partialAddress, publicKeys } = await account.getCompleteAddress();
9
- const { initializationHash, deployer, salt } = account.getInstance();
9
+ const { initializationHash, salt } = account.getInstance();
10
10
  if (json) {
11
11
  out.address = address;
12
12
  out.partialAddress = partialAddress;
@@ -20,48 +20,27 @@ export async function deployAccount(wallet, address, wait, registerClass, public
20
20
  log(`Partial address: ${partialAddress.toString()}`);
21
21
  log(`Salt: ${salt.toString()}`);
22
22
  log(`Init hash: ${initializationHash.toString()}`);
23
- log(`Deployer: ${deployer.toString()}`);
24
23
  }
25
24
  let tx;
26
25
  let txReceipt;
27
- const userFeeOptions = await feeOpts.toUserFeeOptions(wallet, address);
28
- const feePayer = await userFeeOptions.paymentMethod?.getFeePayer();
29
- let paymentAsset;
30
- try {
31
- paymentAsset = await userFeeOptions.paymentMethod?.getAsset();
32
- // eslint-disable-next-line no-empty
33
- } catch {}
34
- // If someone else is paying the fee, set them as the deployment account.
35
- // What we're trying to identify here is that the fee payment method is
36
- // FeeJuicePaymentMethod(anAddressThatsNotTheAccountBeingDeployed)
37
- const delegatedDeployment = paymentAsset?.equals(ProtocolContractAddress.FeeJuice) && !feePayer?.equals(account.getAddress());
38
- const from = delegatedDeployment ? feePayer : AztecAddress.ZERO;
39
- const deployOpts = {
40
- skipInstancePublication: !publicDeploy,
26
+ const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
27
+ const delegatedDeployment = deployer && !account.address.equals(deployer);
28
+ const from = delegatedDeployment ? deployer : AztecAddress.ZERO;
29
+ const deployAccountOpts = {
41
30
  skipClassPublication: !registerClass,
31
+ skipInstancePublication: !publicDeploy,
32
+ skipInitialization,
42
33
  from,
43
- fee: userFeeOptions,
44
- // Do not mix the deployer in the address, since the account
45
- // was created (and thus its address was fixed) like this
46
- universalDeploy: true,
47
- contractAddressSalt: salt
34
+ fee: {
35
+ paymentMethod,
36
+ gasSettings
37
+ }
48
38
  };
49
- /*
50
- * This is usually handled by accountManager.deploy(), but we're accessing the lower
51
- * level method to get gas and timings. That means we have to replicate some of the logic here.
52
- * In case we're deploying our own account, we need to hijack the payment method for the fee,
53
- * wrapping it in the one that will make use of the freshly deployed account's
54
- * entrypoint. For reference, see aztec.js/src/account_manager.ts:deploy()
55
- * Also, salt and universalDeploy have to be explicitly provided
56
- */ deployOpts.fee = !delegatedDeployment && deployOpts?.fee ? {
57
- ...deployOpts.fee,
58
- paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
59
- } : deployOpts?.fee;
60
39
  const deployMethod = await account.getDeployMethod();
61
40
  const { estimatedGas } = await deployMethod.simulate({
62
- ...deployOpts,
41
+ ...deployAccountOpts,
63
42
  fee: {
64
- ...deployOpts.fee,
43
+ ...deployAccountOpts.fee,
65
44
  estimateGas: true
66
45
  }
67
46
  });
@@ -80,11 +59,11 @@ export async function deployAccount(wallet, address, wait, registerClass, public
80
59
  }
81
60
  } else {
82
61
  const provenTx = await deployMethod.prove({
83
- ...deployOpts,
84
- fee: {
85
- ...deployOpts.fee,
62
+ ...deployAccountOpts,
63
+ fee: deployAccountOpts.fee ? {
64
+ ...deployAccountOpts.fee,
86
65
  gasSettings: estimatedGas
87
- }
66
+ } : undefined
88
67
  });
89
68
  if (verbose) {
90
69
  printProfileResult(provenTx.stats, log);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AA4BvF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,uBAAuB,EAC7C,EAAE,EAAE,QAAQ,WAonBb"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AA2BvF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,uBAAuB,EAC7C,EAAE,EAAE,QAAQ,WAspBb"}
@@ -1,10 +1,10 @@
1
1
  import { getIdentities } from '@aztec/accounts/utils';
2
2
  import { TxHash } from '@aztec/aztec.js/tx_hash';
3
3
  import { ETHEREUM_HOSTS, PRIVATE_KEY, addOptions, createSecretKeyOption, l1ChainIdOption, parseBigint, parseFieldFromHexString, parsePublicKey } from '@aztec/cli/utils';
4
- import { GasFees } from '@aztec/stdlib/gas';
4
+ import { GasFees, GasSettings } from '@aztec/stdlib/gas';
5
5
  import { Option } from 'commander';
6
6
  import inquirer from 'inquirer';
7
- import { ARTIFACT_DESCRIPTION, CLIFeeArgs, CLIFeeArgsWithFeePayer, aliasedAddressParser, aliasedSecretKeyParser, aliasedTxHashParser, artifactPathFromPromiseOrAlias, artifactPathParser, cleanupAuthWitnesses, createAccountOption, createAliasOption, createArgsOption, createArtifactOption, createAuthwitnessOption, createContractAddressOption, createDebugExecutionStepsDirOption, createTypeOption, createVerboseOption, getPaymentMethodOption, integerArgParser, parseGasFees, parsePaymentMethod } from '../utils/options/index.js';
7
+ import { ARTIFACT_DESCRIPTION, CLIFeeArgs, aliasedAddressParser, aliasedSecretKeyParser, aliasedTxHashParser, artifactPathFromPromiseOrAlias, artifactPathParser, cleanupAuthWitnesses, createAccountOption, createAliasOption, createArgsOption, createArtifactOption, createAuthwitnessOption, createContractAddressOption, createDebugExecutionStepsDirOption, createTypeOption, createVerboseOption, getPaymentMethodOption, integerArgParser, parseGasFees, parsePaymentMethod } from '../utils/options/index.js';
8
8
  // TODO: This function is only used in 1 place so we could just inline this
9
9
  export function injectCommands(program, log, debugLogger, walletAndNodeWrapper, db) {
10
10
  program.command('import-test-accounts').description('Import test accounts from pxe.').option('--json', 'Emit output as json').action(async (options)=>{
@@ -13,13 +13,13 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
13
13
  const { importTestAccounts } = await import('./import_test_accounts.js');
14
14
  await importTestAccounts(wallet, db, json, log);
15
15
  });
16
- const createAccountCommand = program.command('create-account').description('Creates an aztec account that can be used for sending transactions. Registers the account on the PXE and deploys an account contract. Uses a Schnorr single-key account which uses the same key for encryption and authentication (not secure for production usage).').summary('Creates an aztec account that can be used for sending transactions.').option('--skip-initialization', 'Skip initializing the account contract. Useful for publicly deploying an existing account.').option('--public-deploy', 'Publishes the account contract instance (and the class, if needed). Needed if the contract contains public functions.').option('-p, --public-key <string>', 'Public key that identifies a private signing key stored outside of the wallet. Used for ECDSA SSH accounts over the secp256r1 curve.').addOption(createSecretKeyOption('Secret key for account. Uses random by default.', false, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('public-key')).addOption(createAliasOption('Alias for the account. Used for easy reference in subsequent commands.', !db)).addOption(createTypeOption(true)).option('--register-only', 'Just register the account on the Wallet. Do not deploy or initialize the account contract.').option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
16
+ const createAccountCommand = program.command('create-account').description('Creates an aztec account that can be used for sending transactions. Registers the account on the PXE and deploys an account contract. Uses a Schnorr single-key account which uses the same key for encryption and authentication (not secure for production usage).').summary('Creates an aztec account that can be used for sending transactions.').addOption(createAccountOption('Alias or address of the account performing the deployment', !db, db)).option('--skip-initialization', 'Skip initializing the account contract. Useful for publicly deploying an existing account.').option('--public-deploy', 'Publishes the account contract instance (and the class, if needed). Needed if the contract contains public functions.').option('--register-class', 'Register the contract class (useful for when the contract class has not been deployed yet).').option('-p, --public-key <string>', 'Public key that identifies a private signing key stored outside of the wallet. Used for ECDSA SSH accounts over the secp256r1 curve.').addOption(createSecretKeyOption('Secret key for account. Uses random by default.', false, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('public-key')).addOption(createAliasOption('Alias for the account. Used for easy reference in subsequent commands.', !db)).addOption(createTypeOption(true)).option('--register-only', 'Just register the account on the Wallet. Do not deploy or initialize the account contract.').option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
17
17
  // https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
18
18
  .option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').addOption(createVerboseOption());
19
- addOptions(createAccountCommand, CLIFeeArgsWithFeePayer.getOptions()).action(async (_options, command)=>{
19
+ addOptions(createAccountCommand, CLIFeeArgs.getOptions()).action(async (_options, command)=>{
20
20
  const { createAccount } = await import('./create_account.js');
21
21
  const options = command.optsWithGlobals();
22
- const { type, secretKey, wait, registerOnly, skipInitialization, publicDeploy, alias, json, verbose } = options;
22
+ const { type, from: parsedFromAddress, secretKey, wait, registerOnly, skipInitialization, publicDeploy, registerClass, alias, json, verbose } = options;
23
23
  let { publicKey } = options;
24
24
  if (type === 'ecdsasecp256r1ssh' && !publicKey) {
25
25
  const identities = await getIdentities();
@@ -33,8 +33,8 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
33
33
  ]);
34
34
  publicKey = answers.identity.split(' ')[1];
35
35
  }
36
- const wallet = walletAndNodeWrapper.wallet;
37
- const accountCreationResult = await createAccount(wallet, type, secretKey, publicKey, alias, registerOnly, skipInitialization, publicDeploy, wait, CLIFeeArgsWithFeePayer.parse(options, log, db), json, verbose, debugLogger, log);
36
+ const { wallet, node } = walletAndNodeWrapper;
37
+ const accountCreationResult = await createAccount(wallet, node, type, secretKey, publicKey, alias, parsedFromAddress, registerOnly, skipInitialization, publicDeploy, registerClass, wait, CLIFeeArgs.parse(options, log, db), json, verbose, debugLogger, log);
38
38
  if (db) {
39
39
  const { address, alias, secretKey, salt } = accountCreationResult;
40
40
  await db.storeAccount(address, {
@@ -46,15 +46,15 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
46
46
  }, log);
47
47
  }
48
48
  });
49
- 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)).option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
49
+ const deployAccountCommand = program.command('deploy-account').description('Deploys an already registered aztec account that can be used for sending transactions.').argument('<address>', 'The address of the contract to register', (address)=>aliasedAddressParser('accounts', address, db)).addOption(createAccountOption('Alias or address of the account performing the deployment', !db, db)).option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
50
50
  // https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
51
- .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', 'Publishes the account contract instance (and the class, if needed). Needed if the contract contains public functions.').addOption(createVerboseOption());
52
- addOptions(deployAccountCommand, CLIFeeArgsWithFeePayer.getOptions()).action(async (_options, command)=>{
51
+ .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', 'Publishes the account contract instance (and the class, if needed). Needed if the contract contains public functions.').option('--skip-initialization', 'Skip initializing the account contract. Useful for publicly deploying an existing account.').addOption(createVerboseOption());
52
+ addOptions(deployAccountCommand, CLIFeeArgs.getOptions()).action(async (parsedAccount, _options, command)=>{
53
53
  const { deployAccount } = await import('./deploy_account.js');
54
54
  const options = command.optsWithGlobals();
55
- const { wait, from: parsedFromAddress, json, registerClass, publicDeploy, verbose } = options;
56
- const wallet = walletAndNodeWrapper.wallet;
57
- await deployAccount(wallet, parsedFromAddress, wait, registerClass, publicDeploy, CLIFeeArgsWithFeePayer.parse(options, log, db), json, verbose, debugLogger, log);
55
+ const { wait, from: parsedFromAddress, json, registerClass, skipInitialization, publicDeploy, verbose } = options;
56
+ const { wallet, node } = walletAndNodeWrapper;
57
+ await deployAccount(wallet, node, parsedAccount, wait, parsedFromAddress, registerClass, publicDeploy, skipInitialization, CLIFeeArgs.parse(options, log, db), json, verbose, debugLogger, log);
58
58
  });
59
59
  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(createArgsOption(true, db)).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.
60
60
  // https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
@@ -63,10 +63,10 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
63
63
  const { deploy } = await import('./deploy.js');
64
64
  const options = command.optsWithGlobals();
65
65
  const { json, publicKey, args, salt, wait, classRegistration, init, publicDeployment, universal, from: parsedFromAddress, alias, timeout, verbose } = options;
66
- const wallet = walletAndNodeWrapper.wallet;
66
+ const { wallet, node } = walletAndNodeWrapper;
67
67
  const artifactPath = await artifactPathPromise;
68
68
  debugLogger.info(`Using wallet with address ${parsedFromAddress.toString()}`);
69
- const address = await deploy(wallet, universal ? undefined : parsedFromAddress, artifactPath, json, publicKey, args, salt, typeof init === 'string' ? init : undefined, !publicDeployment, !classRegistration, typeof init === 'string' ? false : init, wait, CLIFeeArgs.parse(options, log, db), timeout, verbose, debugLogger, log);
69
+ const address = await deploy(wallet, node, universal ? undefined : parsedFromAddress, artifactPath, json, publicKey, args, salt, typeof init === 'string' ? init : undefined, !publicDeployment, !classRegistration, typeof init === 'string' ? false : init, wait, CLIFeeArgs.parse(options, log, db), timeout, verbose, debugLogger, log);
70
70
  if (db && address) {
71
71
  await db.storeContract(address, artifactPath, log, alias);
72
72
  }
@@ -76,11 +76,11 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
76
76
  const { send } = await import('./send.js');
77
77
  const options = command.optsWithGlobals();
78
78
  const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, wait, alias, cancel, authWitness: authWitnessArray, verbose } = options;
79
- const wallet = walletAndNodeWrapper.wallet;
79
+ const { wallet, node } = walletAndNodeWrapper;
80
80
  const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
81
81
  debugLogger.info(`Using wallet with address ${parsedFromAddress.toString()}`);
82
82
  const authWitnesses = cleanupAuthWitnesses(authWitnessArray);
83
- const sentTx = await send(wallet, parsedFromAddress, functionName, args, artifactPath, contractAddress, wait, cancel, CLIFeeArgs.parse(options, log, db), authWitnesses, verbose, log);
83
+ const sentTx = await send(wallet, node, parsedFromAddress, functionName, args, artifactPath, contractAddress, wait, cancel, CLIFeeArgs.parse(options, log, db), authWitnesses, verbose, log);
84
84
  if (db && sentTx) {
85
85
  const txAlias = alias ? alias : `${functionName}-${sentTx.txNonce.toString().slice(-4)}`;
86
86
  await db.storeTx(sentTx, log, txAlias);
@@ -91,20 +91,20 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
91
91
  const { simulate } = await import('./simulate.js');
92
92
  const options = command.optsWithGlobals();
93
93
  const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, verbose, authWitness } = options;
94
- const wallet = walletAndNodeWrapper.wallet;
94
+ const { wallet, node } = walletAndNodeWrapper;
95
95
  const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
96
96
  const authWitnesses = cleanupAuthWitnesses(authWitness);
97
- await simulate(wallet, parsedFromAddress, functionName, args, artifactPath, contractAddress, CLIFeeArgs.parse(options, log, db), authWitnesses, verbose, log);
97
+ await simulate(wallet, node, parsedFromAddress, functionName, args, artifactPath, contractAddress, CLIFeeArgs.parse(options, log, db), authWitnesses, verbose, log);
98
98
  });
99
99
  const profileCommand = program.command('profile').description('Profiles a private function by counting the unconditional operations in its execution steps').argument('<functionName>', 'Name of function to simulate').addOption(createArgsOption(false, db)).addOption(createContractAddressOption(db)).addOption(createArtifactOption(db)).addOption(createDebugExecutionStepsDirOption()).addOption(createAuthwitnessOption('Authorization witness to use for the simulation', !db, db)).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db));
100
100
  addOptions(profileCommand, CLIFeeArgs.getOptions()).action(async (functionName, _options, command)=>{
101
101
  const { profile } = await import('./profile.js');
102
102
  const options = command.optsWithGlobals();
103
103
  const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, debugExecutionStepsDir, authWitness } = options;
104
- const wallet = walletAndNodeWrapper.wallet;
104
+ const { wallet, node } = walletAndNodeWrapper;
105
105
  const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
106
106
  const authWitnesses = cleanupAuthWitnesses(authWitness);
107
- await profile(wallet, parsedFromAddress, functionName, args, artifactPath, contractAddress, debugExecutionStepsDir, CLIFeeArgs.parse(options, log, db), authWitnesses, log);
107
+ await profile(wallet, node, parsedFromAddress, functionName, args, artifactPath, contractAddress, debugExecutionStepsDir, CLIFeeArgs.parse(options, log, db), authWitnesses, log);
108
108
  });
109
109
  program.command('bridge-fee-juice').description('Mints L1 Fee Juice and pushes them to L2.').argument('<amount>', 'The amount of Fee Juice to mint and bridge.', parseBigint).argument('<recipient>', 'Aztec address of the recipient.', (address)=>aliasedAddressParser('accounts', address, db)).requiredOption('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)', (arg)=>arg.split(','), [
110
110
  ETHEREUM_HOSTS
@@ -171,12 +171,15 @@ export function injectCommands(program, log, debugLogger, walletAndNodeWrapper,
171
171
  program.command('cancel-tx').description('Cancels a pending tx by reusing its nonce with a higher fee and an empty payload').argument('<txHash>', 'A transaction hash to cancel.', (txHash)=>aliasedTxHashParser(txHash, db)).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db)).addOption(getPaymentMethodOption().default('method=fee_juice')).option('-i --increased-fees <da=1,l2=1>', 'The amounts by which the fees are increased', (value)=>parseGasFees(value), new GasFees(1, 1)).option('--max-fees-per-gas <da=100,l2=100>', 'Maximum fees per gas unit for DA and L2 computation.', (value)=>parseGasFees(value)).action(async (txHash, options)=>{
172
172
  const { cancelTx } = await import('./cancel_tx.js');
173
173
  const { from: parsedFromAddress, payment, increasedFees, maxFeesPerGas } = options;
174
- const wallet = walletAndNodeWrapper.wallet;
174
+ const { wallet } = walletAndNodeWrapper;
175
175
  const txData = await db?.retrieveTxData(txHash);
176
176
  if (!txData) {
177
177
  throw new Error('Transaction data not found in the database, cannot reuse nonce');
178
178
  }
179
- const paymentMethod = await parsePaymentMethod(payment, false, log, db)(wallet, parsedFromAddress);
179
+ const gasSettings = GasSettings.default({
180
+ maxFeesPerGas
181
+ });
182
+ const paymentMethod = await parsePaymentMethod(payment, log, db)(wallet, parsedFromAddress, gasSettings);
180
183
  await cancelTx(wallet, parsedFromAddress, txData, paymentMethod, increasedFees, maxFeesPerGas, log);
181
184
  });
182
185
  program.command('register-sender').description("Registers a sender's address in the wallet, so the note synching process will look for notes sent by them").argument('[address]', 'The address of the sender to register', (address)=>aliasedAddressParser('accounts', address, db)).addOption(createAliasOption('Alias for the sender. Used for easy reference in subsequent commands.', !db)).action(async (address, options)=>{
@@ -1,5 +1,6 @@
1
- import { AuthWitness, type AztecAddress, type Wallet } from '@aztec/aztec.js';
1
+ import { AuthWitness, type AztecAddress, type AztecNode } from '@aztec/aztec.js';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
3
  import type { CLIFeeArgs } from '../utils/options/fees.js';
4
- export declare function profile(wallet: Wallet, from: AztecAddress, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, debugOutputPath: string | undefined, feeOpts: CLIFeeArgs, authWitnesses: AuthWitness[], log: LogFn): Promise<void>;
4
+ import type { CLIWallet } from '../utils/wallet.js';
5
+ export declare function profile(wallet: CLIWallet, node: AztecNode, from: AztecAddress, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, debugOutputPath: string | undefined, feeOpts: CLIFeeArgs, authWitnesses: AuthWitness[], log: LogFn): Promise<void>;
5
6
  //# sourceMappingURL=profile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAY,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,wBAAsB,OAAO,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,WAAW,EAAE,EAC5B,GAAG,EAAE,KAAK,iBAoBX"}
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAY,MAAM,iBAAiB,CAAC;AAE3F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,WAAW,EAAE,EAC5B,GAAG,EAAE,KAAK,iBAqBX"}
@@ -4,12 +4,16 @@ import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
4
4
  import { promises as fs } from 'fs';
5
5
  import path from 'path';
6
6
  import { printProfileResult } from '../utils/profiling.js';
7
- export async function profile(wallet, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, debugOutputPath, feeOpts, authWitnesses, log) {
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
9
  const contract = await Contract.at(contractAddress, contractArtifact, wallet);
10
10
  const call = contract.methods[functionName](...functionArgs);
11
+ const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
11
12
  const result = await call.profile({
12
- fee: await feeOpts.toUserFeeOptions(wallet, from),
13
+ fee: {
14
+ gasSettings,
15
+ paymentMethod
16
+ },
13
17
  from,
14
18
  profileMode: 'full',
15
19
  authWitnesses,
@@ -1,8 +1,9 @@
1
- import { AuthWitness, type AztecAddress, Fr, type Wallet } from '@aztec/aztec.js';
1
+ import { AuthWitness, type AztecAddress, type AztecNode, Fr } from '@aztec/aztec.js';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
3
  import { GasSettings } from '@aztec/stdlib/gas';
4
4
  import { CLIFeeArgs } from '../utils/options/fees.js';
5
- export declare function send(wallet: Wallet, from: AztecAddress, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, wait: boolean, cancellable: boolean, feeOpts: CLIFeeArgs, authWitnesses: AuthWitness[], verbose: boolean, log: LogFn): Promise<{
5
+ import type { CLIWallet } from '../utils/wallet.js';
6
+ export declare function send(wallet: CLIWallet, node: AztecNode, from: AztecAddress, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, wait: boolean, cancellable: boolean, feeOpts: CLIFeeArgs, authWitnesses: AuthWitness[], verbose: boolean, log: LogFn): Promise<{
6
7
  txHash: import("@aztec/aztec.js").TxHash;
7
8
  txNonce: Fr;
8
9
  cancellable: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/cmds/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAY,EAAE,EAA0B,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEpH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,wBAAsB,IAAI,CACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK;;;;;eAyDX"}
1
+ {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/cmds/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAY,EAAE,EAA0B,MAAM,iBAAiB,CAAC;AAEvH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,IAAI,CACxB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK;;;;;eA4DX"}
package/dest/cmds/send.js CHANGED
@@ -3,14 +3,17 @@ import { prepTx } from '@aztec/cli/utils';
3
3
  import { GasSettings } from '@aztec/stdlib/gas';
4
4
  import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
5
5
  import { printProfileResult } from '../utils/profiling.js';
6
- export async function send(wallet, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, authWitnesses, verbose, log) {
6
+ export async function send(wallet, node, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, authWitnesses, verbose, log) {
7
7
  const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
8
8
  const contract = await Contract.at(contractAddress, contractArtifact, wallet);
9
9
  const call = contract.methods[functionName](...functionArgs);
10
10
  const txNonce = Fr.random();
11
- const userFeeOptions = await feeOpts.toUserFeeOptions(wallet, from);
11
+ const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
12
12
  const sendOptions = {
13
- fee: userFeeOptions,
13
+ fee: {
14
+ paymentMethod,
15
+ gasSettings
16
+ },
14
17
  from,
15
18
  authWitnesses
16
19
  };
@@ -24,7 +27,13 @@ export async function send(wallet, from, functionName, functionArgsIn, contractA
24
27
  if (feeOpts.estimateOnly) {
25
28
  return;
26
29
  }
27
- const provenTx = await call.prove(sendOptions);
30
+ const provenTx = await call.prove({
31
+ ...sendOptions,
32
+ fee: {
33
+ ...sendOptions.fee,
34
+ gasSettings: estimatedGas
35
+ }
36
+ });
28
37
  if (verbose) {
29
38
  printProfileResult(provenTx.stats, log);
30
39
  }
@@ -48,7 +57,7 @@ export async function send(wallet, from, functionName, functionArgsIn, contractA
48
57
  } else {
49
58
  log('Transaction pending. Check status with check-tx');
50
59
  }
51
- const gasSettings = GasSettings.from({
60
+ const finalGasSettings = GasSettings.from({
52
61
  ...provenTx.data.constants.txContext.gasSettings,
53
62
  ...estimatedGas
54
63
  });
@@ -56,6 +65,6 @@ export async function send(wallet, from, functionName, functionArgsIn, contractA
56
65
  txHash,
57
66
  txNonce,
58
67
  cancellable,
59
- gasSettings
68
+ gasSettings: finalGasSettings
60
69
  };
61
70
  }