@aztec/cli-wallet 0.0.0-test.1 → 0.0.1-fake-ceab37513c

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 (77) hide show
  1. package/dest/bin/index.js +24 -8
  2. package/dest/cmds/authorize_action.d.ts +1 -1
  3. package/dest/cmds/authorize_action.d.ts.map +1 -1
  4. package/dest/cmds/authorize_action.js +7 -2
  5. package/dest/cmds/bridge_fee_juice.js +3 -3
  6. package/dest/cmds/cancel_tx.d.ts +2 -2
  7. package/dest/cmds/cancel_tx.d.ts.map +1 -1
  8. package/dest/cmds/cancel_tx.js +13 -8
  9. package/dest/cmds/create_account.d.ts +3 -3
  10. package/dest/cmds/create_account.d.ts.map +1 -1
  11. package/dest/cmds/create_account.js +40 -9
  12. package/dest/cmds/deploy.d.ts +2 -2
  13. package/dest/cmds/deploy.d.ts.map +1 -1
  14. package/dest/cmds/deploy.js +29 -23
  15. package/dest/cmds/deploy_account.d.ts +3 -3
  16. package/dest/cmds/deploy_account.d.ts.map +1 -1
  17. package/dest/cmds/deploy_account.js +40 -8
  18. package/dest/cmds/index.d.ts.map +1 -1
  19. package/dest/cmds/index.js +61 -54
  20. package/dest/cmds/profile.d.ts +5 -0
  21. package/dest/cmds/profile.d.ts.map +1 -0
  22. package/dest/cmds/profile.js +23 -0
  23. package/dest/cmds/register_contract.d.ts +2 -2
  24. package/dest/cmds/register_contract.d.ts.map +1 -1
  25. package/dest/cmds/register_contract.js +17 -3
  26. package/dest/cmds/send.d.ts +3 -3
  27. package/dest/cmds/send.d.ts.map +1 -1
  28. package/dest/cmds/send.js +20 -12
  29. package/dest/cmds/simulate.d.ts +3 -2
  30. package/dest/cmds/simulate.d.ts.map +1 -1
  31. package/dest/cmds/simulate.js +19 -18
  32. package/dest/storage/wallet_db.d.ts +5 -7
  33. package/dest/storage/wallet_db.d.ts.map +1 -1
  34. package/dest/storage/wallet_db.js +8 -8
  35. package/dest/utils/accounts.d.ts +3 -5
  36. package/dest/utils/accounts.d.ts.map +1 -1
  37. package/dest/utils/accounts.js +7 -33
  38. package/dest/utils/authorizations.d.ts +5 -0
  39. package/dest/utils/authorizations.d.ts.map +1 -0
  40. package/dest/utils/authorizations.js +28 -0
  41. package/dest/utils/ecdsa.d.ts +0 -2
  42. package/dest/utils/ecdsa.d.ts.map +1 -1
  43. package/dest/utils/options/fees.d.ts.map +1 -1
  44. package/dest/utils/options/fees.js +22 -14
  45. package/dest/utils/options/options.d.ts +7 -4
  46. package/dest/utils/options/options.d.ts.map +1 -1
  47. package/dest/utils/options/options.js +25 -13
  48. package/dest/utils/profiling.d.ts +5 -0
  49. package/dest/utils/profiling.d.ts.map +1 -0
  50. package/dest/utils/profiling.js +60 -0
  51. package/dest/utils/pxe_wrapper.d.ts +4 -2
  52. package/dest/utils/pxe_wrapper.d.ts.map +1 -1
  53. package/dest/utils/pxe_wrapper.js +8 -3
  54. package/package.json +24 -20
  55. package/src/bin/index.ts +31 -9
  56. package/src/cmds/authorize_action.ts +4 -1
  57. package/src/cmds/bridge_fee_juice.ts +3 -3
  58. package/src/cmds/cancel_tx.ts +15 -11
  59. package/src/cmds/create_account.ts +42 -9
  60. package/src/cmds/deploy.ts +40 -25
  61. package/src/cmds/deploy_account.ts +44 -7
  62. package/src/cmds/index.ts +206 -84
  63. package/src/cmds/profile.ts +40 -0
  64. package/src/cmds/register_contract.ts +28 -3
  65. package/src/cmds/send.ts +30 -6
  66. package/src/cmds/simulate.ts +30 -22
  67. package/src/storage/wallet_db.ts +9 -9
  68. package/src/utils/accounts.ts +8 -33
  69. package/src/utils/authorizations.ts +49 -0
  70. package/src/utils/options/fees.ts +50 -31
  71. package/src/utils/options/options.ts +38 -17
  72. package/src/utils/profiling.ts +158 -0
  73. package/src/utils/pxe_wrapper.ts +9 -3
  74. package/dest/cmds/add_authwit.d.ts +0 -4
  75. package/dest/cmds/add_authwit.d.ts.map +0 -1
  76. package/dest/cmds/add_authwit.js +0 -4
  77. package/src/cmds/add_authwit.ts +0 -13
package/dest/bin/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { Fr, computeSecretHash, fileURLToPath } from '@aztec/aztec.js';
1
+ import { Fr, ProtocolContractAddress, computeSecretHash, fileURLToPath } from '@aztec/aztec.js';
2
2
  import { LOCALHOST } from '@aztec/cli/cli-utils';
3
3
  import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
4
4
  import { openStoreAt } from '@aztec/kv-store/lmdb-v2';
5
+ import { getPackageVersion } from '@aztec/stdlib/update-checker';
5
6
  import { Argument, Command, Option } from 'commander';
6
- import { mkdirSync, readFileSync } from 'fs';
7
+ import { mkdirSync } from 'fs';
7
8
  import { homedir } from 'os';
8
9
  import { dirname, join, resolve } from 'path';
9
10
  import { injectCommands } from '../cmds/index.js';
@@ -12,7 +13,7 @@ import { createAliasOption } from '../utils/options/index.js';
12
13
  import { PXEWrapper } from '../utils/pxe_wrapper.js';
13
14
  const userLog = createConsoleLogger();
14
15
  const debugLogger = createLogger('wallet');
15
- const { WALLET_DATA_DIRECTORY = join(homedir(), '.aztec/wallet'), PXE_PROVER = 'none' } = process.env;
16
+ const { WALLET_DATA_DIRECTORY = join(homedir(), '.aztec/wallet') } = process.env;
16
17
  function injectInternalCommands(program, log, db) {
17
18
  program.command('alias').description('Aliases information for easy reference.').addArgument(new Argument('<type>', 'Type of alias to create').choices(Aliases)).argument('<key>', 'Key to alias.').argument('<value>', 'Value to assign to the alias.').action(async (type, key, value)=>{
18
19
  value = db.tryRetrieveAlias(value) || value;
@@ -33,19 +34,22 @@ function injectInternalCommands(program, log, db) {
33
34
  const options = command.optsWithGlobals();
34
35
  const { alias } = options;
35
36
  const value = Fr.random();
36
- const hash = computeSecretHash(value);
37
+ const hash = await computeSecretHash(value);
37
38
  await db.storeAlias('secrets', alias, Buffer.from(value.toString()), log);
38
39
  await db.storeAlias('secrets', `${alias}:hash`, Buffer.from(hash.toString()), log);
39
40
  });
40
41
  return program;
41
42
  }
42
43
  /** CLI wallet main entrypoint */ async function main() {
43
- const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
44
- const walletVersion = JSON.parse(readFileSync(packageJsonPath).toString()).version;
44
+ const walletVersion = getPackageVersion() ?? '0.0.0';
45
45
  const db = WalletDB.getInstance();
46
46
  const pxeWrapper = new PXEWrapper();
47
47
  const program = new Command('wallet');
48
- program.description('Aztec wallet').version(walletVersion).option('-d, --data-dir <string>', 'Storage directory for wallet data', WALLET_DATA_DIRECTORY).option('-p, --prover <string>', 'wasm|native|none', PXE_PROVER).addOption(new Option('--remote-pxe', 'Connect to an external PXE RPC server, instead of the local one').env('REMOTE_PXE').default(false).conflicts('rpc-url')).addOption(new Option('-n, --node-url <string>', 'URL of the Aztec node to connect to').env('AZTEC_NODE_URL').default(`http://${LOCALHOST}:8080`)).hook('preSubcommand', async (command)=>{
48
+ program.description('Aztec wallet').version(walletVersion).option('-d, --data-dir <string>', 'Storage directory for wallet data', WALLET_DATA_DIRECTORY).addOption(new Option('-p, --prover <string>', 'The type of prover the wallet uses (only applies if not using a remote PXE)').choices([
49
+ 'wasm',
50
+ 'native',
51
+ 'none'
52
+ ]).env('PXE_PROVER').default('native')).addOption(new Option('--remote-pxe', 'Connect to an external PXE RPC server instead of the local one').env('REMOTE_PXE').default(false).conflicts('rpc-url')).addOption(new Option('-n, --node-url <string>', 'URL of the Aztec node to connect to').env('AZTEC_NODE_URL').default(`http://${LOCALHOST}:8080`)).hook('preSubcommand', async (command)=>{
49
53
  const { dataDir, remotePxe, nodeUrl, prover } = command.optsWithGlobals();
50
54
  if (!remotePxe) {
51
55
  debugLogger.info('Using local PXE service');
@@ -60,9 +64,21 @@ function injectInternalCommands(program, log, db) {
60
64
  bbBinaryPath: prover === 'native' ? bbBinaryPath : undefined,
61
65
  bbWorkingDirectory: prover === 'native' ? bbWorkingDirectory : undefined
62
66
  };
63
- await pxeWrapper.init(nodeUrl, join(dataDir, 'pxe'), overridePXEConfig);
67
+ pxeWrapper.prepare(nodeUrl, join(dataDir, 'pxe'), overridePXEConfig);
64
68
  }
65
69
  await db.init(await openStoreAt(dataDir));
70
+ let protocolContractsRegistered;
71
+ try {
72
+ protocolContractsRegistered = !!await db.retrieveAlias('contracts:ContractClassRegistry');
73
+ // eslint-disable-next-line no-empty
74
+ } catch {}
75
+ if (!protocolContractsRegistered) {
76
+ userLog('Registering protocol contract aliases...');
77
+ for (const [name, address] of Object.entries(ProtocolContractAddress)){
78
+ await db.storeAlias('contracts', name, Buffer.from(address.toString()), userLog);
79
+ await db.storeAlias('artifacts', address.toString(), Buffer.from(`${name.slice(0, 1).toUpperCase()}${name.slice(1)}`), userLog);
80
+ }
81
+ }
66
82
  });
67
83
  injectCommands(program, userLog, debugLogger, db, pxeWrapper);
68
84
  injectInternalCommands(program, userLog, db);
@@ -1,4 +1,4 @@
1
1
  import { type AccountWalletWithSecretKey, type AztecAddress } from '@aztec/aztec.js';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
- export declare function authorizeAction(wallet: AccountWalletWithSecretKey, functionName: string, caller: AztecAddress, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, log: LogFn): Promise<import("@aztec/aztec.js").FieldsOf<import("@aztec/aztec.js").TxReceipt>>;
3
+ export declare function authorizeAction(wallet: AccountWalletWithSecretKey, from: AztecAddress, functionName: string, caller: AztecAddress, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, log: LogFn): Promise<import("@aztec/aztec.js").FieldsOf<import("@aztec/aztec.js").TxReceipt>>;
4
4
  //# sourceMappingURL=authorize_action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorize_action.d.ts","sourceRoot":"","sources":["../../src/cmds/authorize_action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE/F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,wBAAsB,eAAe,CACnC,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,GAAG,EAAE,KAAK,oFAwBX"}
1
+ {"version":3,"file":"authorize_action.d.ts","sourceRoot":"","sources":["../../src/cmds/authorize_action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE/F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,wBAAsB,eAAe,CACnC,MAAM,EAAE,0BAA0B,EAClC,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,GAAG,EAAE,KAAK,oFAwBX"}
@@ -1,6 +1,7 @@
1
1
  import { Contract } from '@aztec/aztec.js';
2
2
  import { prepTx } from '@aztec/cli/utils';
3
- export async function authorizeAction(wallet, functionName, caller, functionArgsIn, contractArtifactPath, contractAddress, log) {
3
+ import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
4
+ export async function authorizeAction(wallet, from, functionName, caller, functionArgsIn, contractArtifactPath, contractAddress, log) {
4
5
  const { functionArgs, contractArtifact, isPrivate } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
5
6
  if (isPrivate) {
6
7
  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');
@@ -11,7 +12,11 @@ export async function authorizeAction(wallet, functionName, caller, functionArgs
11
12
  caller,
12
13
  action
13
14
  }, true);
14
- const witness = await setAuthwitnessInteraction.send().wait();
15
+ const witness = await setAuthwitnessInteraction.send({
16
+ from
17
+ }).wait({
18
+ timeout: DEFAULT_TX_TIMEOUT_S
19
+ });
15
20
  log(`Authorized action ${functionName} on contract ${contractAddress} for caller ${caller}`);
16
21
  return witness;
17
22
  }
@@ -1,14 +1,14 @@
1
1
  import { L1FeeJuicePortalManager } from '@aztec/aztec.js';
2
2
  import { prettyPrintJSON } from '@aztec/cli/utils';
3
- import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
3
+ import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
4
4
  import { Fr } from '@aztec/foundation/fields';
5
5
  export async function bridgeL1FeeJuice(amount, recipient, pxe, l1RpcUrls, chainId, privateKey, mnemonic, mint, json, wait, interval = 60_000, log, debugLogger) {
6
6
  // Prepare L1 client
7
7
  const chain = createEthereumChain(l1RpcUrls, chainId);
8
- const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
8
+ const client = createExtendedL1Client(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
9
9
  const { protocolContractAddresses: { feeJuice: feeJuiceAddress } } = await pxe.getPXEInfo();
10
10
  // Setup portal manager
11
- const portal = await L1FeeJuicePortalManager.new(pxe, publicClient, walletClient, debugLogger);
11
+ const portal = await L1FeeJuicePortalManager.new(pxe, client, debugLogger);
12
12
  const { claimAmount, claimSecret, messageHash, messageLeafIndex } = await portal.bridgeTokensPublic(recipient, amount, mint);
13
13
  if (json) {
14
14
  const out = {
@@ -2,10 +2,10 @@ import { type AccountWalletWithSecretKey, type FeePaymentMethod, type TxHash } f
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';
5
- export declare function cancelTx(wallet: AccountWalletWithSecretKey, { txHash, gasSettings: prevTxGasSettings, nonce, cancellable, }: {
5
+ export declare function cancelTx(wallet: AccountWalletWithSecretKey, { txHash, gasSettings: prevTxGasSettings, txNonce, cancellable, }: {
6
6
  txHash: TxHash;
7
7
  gasSettings: GasSettings;
8
- nonce: Fr;
8
+ txNonce: Fr;
9
9
  cancellable: boolean;
10
10
  }, paymentMethod: FeePaymentMethod, increasedFees: GasFees, maxFeesPerGas: GasFees | undefined, log: LogFn): Promise<void>;
11
11
  //# 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,KAAK,0BAA0B,EAAE,KAAK,gBAAgB,EAAU,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAExH,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;AAEzD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,0BAA0B,EAClC,EACE,MAAM,EACN,WAAW,EAAE,iBAAiB,EAC9B,KAAK,EACL,WAAW,GACZ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,EAAE,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,EAChF,aAAa,EAAE,gBAAgB,EAC/B,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GAAG,SAAS,EAClC,GAAG,EAAE,KAAK,iBA4CX"}
1
+ {"version":3,"file":"cancel_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/cancel_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,gBAAgB,EAAU,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAGxH,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;AAIzD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,0BAA0B,EAClC,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,iBA6CX"}
@@ -1,12 +1,14 @@
1
1
  import { SentTx, TxStatus } from '@aztec/aztec.js';
2
+ import { ExecutionPayload } from '@aztec/entrypoints/payload';
2
3
  import { GasFees, GasSettings } from '@aztec/stdlib/gas';
3
- export async function cancelTx(wallet, { txHash, gasSettings: prevTxGasSettings, nonce, cancellable }, paymentMethod, increasedFees, maxFeesPerGas, log) {
4
+ import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
5
+ export async function cancelTx(wallet, { txHash, gasSettings: prevTxGasSettings, txNonce, cancellable }, paymentMethod, increasedFees, maxFeesPerGas, log) {
4
6
  const receipt = await wallet.getTxReceipt(txHash);
5
7
  if (receipt.status !== TxStatus.PENDING || !cancellable) {
6
8
  log(`Transaction is in status ${receipt.status} and cannot be cancelled`);
7
9
  return;
8
10
  }
9
- const maxPriorityFeesPerGas = new GasFees(prevTxGasSettings.maxPriorityFeesPerGas.feePerDaGas.add(increasedFees.feePerDaGas), prevTxGasSettings.maxPriorityFeesPerGas.feePerL2Gas.add(increasedFees.feePerL2Gas));
11
+ const maxPriorityFeesPerGas = new GasFees(prevTxGasSettings.maxPriorityFeesPerGas.feePerDaGas + increasedFees.feePerDaGas, prevTxGasSettings.maxPriorityFeesPerGas.feePerL2Gas + increasedFees.feePerL2Gas);
10
12
  const fee = {
11
13
  paymentMethod,
12
14
  gasSettings: GasSettings.from({
@@ -15,17 +17,20 @@ export async function cancelTx(wallet, { txHash, gasSettings: prevTxGasSettings,
15
17
  maxFeesPerGas: maxFeesPerGas ?? prevTxGasSettings.maxFeesPerGas
16
18
  })
17
19
  };
18
- const txRequest = await wallet.createTxExecutionRequest({
19
- calls: [],
20
- fee,
21
- nonce,
20
+ const txRequest = await wallet.createTxExecutionRequest(ExecutionPayload.empty(), fee, {
21
+ txNonce,
22
22
  cancellable: true
23
23
  });
24
24
  const txSimulationResult = await wallet.simulateTx(txRequest, true);
25
25
  const txProvingResult = await wallet.proveTx(txRequest, txSimulationResult.privateExecutionResult);
26
- const sentTx = new SentTx(wallet, wallet.sendTx(txProvingResult.toTx()));
26
+ const sentTx = new SentTx(wallet, async ()=>{
27
+ const tx = await txProvingResult.toTx();
28
+ return wallet.sendTx(tx);
29
+ });
27
30
  try {
28
- await sentTx.wait();
31
+ await sentTx.wait({
32
+ timeout: DEFAULT_TX_TIMEOUT_S
33
+ });
29
34
  log('Transaction has been cancelled');
30
35
  const cancelReceipt = await sentTx.getReceipt();
31
36
  log(` Tx fee: ${cancelReceipt.transactionFee}`);
@@ -1,11 +1,11 @@
1
- import type { PXE } from '@aztec/aztec.js';
1
+ import { AztecAddress, type PXE } 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 { type AccountType } from '../utils/accounts.js';
5
5
  import { type IFeeOpts } from '../utils/options/fees.js';
6
- export declare function createAccount(client: PXE, accountType: AccountType, secretKey: Fr | undefined, publicKey: string | undefined, alias: string | undefined, registerOnly: boolean, publicDeploy: boolean, skipInitialization: boolean, wait: boolean, feeOpts: IFeeOpts, json: boolean, debugLogger: Logger, log: LogFn): Promise<{
6
+ export declare function createAccount(client: PXE, accountType: AccountType, secretKey: Fr | undefined, publicKey: string | undefined, alias: string | undefined, registerOnly: boolean, publicDeploy: boolean, skipInitialization: boolean, wait: boolean, feeOpts: IFeeOpts, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<{
7
7
  alias: string | undefined;
8
- address: import("@aztec/aztec.js").AztecAddress;
8
+ address: AztecAddress;
9
9
  secretKey: Fr;
10
10
  salt: Fr;
11
11
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,WAAW,EAA2B,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAE5E,wBAAsB,aAAa,CACjC,MAAM,EAAE,GAAG,EACX,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,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;;GAkGX"}
1
+ {"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6B,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEpF,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,WAAW,EAA2B,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAI5E,wBAAsB,aAAa,CACjC,MAAM,EAAE,GAAG,EACX,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,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;;GAgIX"}
@@ -1,11 +1,14 @@
1
+ import { AztecAddress } from '@aztec/aztec.js';
1
2
  import { prettyPrintJSON } from '@aztec/cli/cli-utils';
2
3
  import { Fr } from '@aztec/foundation/fields';
3
4
  import { createOrRetrieveAccount } from '../utils/accounts.js';
4
5
  import { printGasEstimates } from '../utils/options/fees.js';
5
- export async function createAccount(client, accountType, secretKey, publicKey, alias, registerOnly, publicDeploy, skipInitialization, wait, feeOpts, json, debugLogger, log) {
6
+ import { printProfileResult } from '../utils/profiling.js';
7
+ import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
8
+ export async function createAccount(client, accountType, secretKey, publicKey, alias, registerOnly, publicDeploy, skipInitialization, wait, feeOpts, json, verbose, debugLogger, log) {
6
9
  secretKey ??= Fr.random();
7
10
  const account = await createOrRetrieveAccount(client, undefined /* address, we don't have it yet */ , undefined /* db, as we want to create from scratch */ , secretKey, accountType, Fr.ZERO, publicKey);
8
- const salt = account.getInstance().salt;
11
+ const { salt } = account.getInstance();
9
12
  const { address, publicKeys, partialAddress } = await account.getCompleteAddress();
10
13
  const out = {};
11
14
  if (json) {
@@ -37,13 +40,30 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
37
40
  } else {
38
41
  const wallet = await account.getWallet();
39
42
  const deployOpts = {
40
- skipClassRegistration: !publicDeploy,
41
- skipPublicDeployment: !publicDeploy,
43
+ skipClassPublication: !publicDeploy,
44
+ skipInstancePublication: !publicDeploy,
42
45
  skipInitialization: skipInitialization,
43
46
  ...await feeOpts.toDeployAccountOpts(wallet)
44
47
  };
48
+ /*
49
+ * This is usually handled by accountManager.create(), but we're accessing the lower
50
+ * level method to get gas and timings. That means we have to replicate some of the logic here.
51
+ * In case we're initializing and/or publishing our own account, we need to hijack the payment method for the fee,
52
+ * wrapping it in the one that will make use of the freshly deployed account's
53
+ * entrypoint. For reference, see aztec.js/src/account_manager.ts:sendAccountContractSetupTx()
54
+ * Also, salt and universalDeploy have to be explicitly provided
55
+ */ deployOpts.fee = !deployOpts?.deployWallet && deployOpts?.fee ? {
56
+ ...deployOpts.fee,
57
+ paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
58
+ } : deployOpts?.fee;
59
+ const deployMethod = await account.getDeployMethod(deployOpts.deployWallet);
45
60
  if (feeOpts.estimateOnly) {
46
- const gas = await (await account.getDeployMethod(deployOpts.deployWallet)).estimateGas(deployOpts);
61
+ const gas = await deployMethod.estimateGas({
62
+ ...deployOpts,
63
+ from: AztecAddress.ZERO,
64
+ universalDeploy: true,
65
+ contractAddressSalt: salt
66
+ });
47
67
  if (json) {
48
68
  out.fee = {
49
69
  gasLimits: {
@@ -59,15 +79,26 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
59
79
  printGasEstimates(feeOpts, gas, log);
60
80
  }
61
81
  } else {
62
- tx = account.deploy(deployOpts);
82
+ const provenTx = await deployMethod.prove({
83
+ ...deployOpts,
84
+ from: AztecAddress.ZERO,
85
+ universalDeploy: true,
86
+ contractAddressSalt: salt
87
+ });
88
+ if (verbose) {
89
+ printProfileResult(provenTx.stats, log);
90
+ }
91
+ tx = provenTx.send();
63
92
  const txHash = await tx.getTxHash();
64
- debugLogger.debug(`Account contract tx sent with hash ${txHash}`);
93
+ debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
65
94
  out.txHash = txHash;
66
95
  if (wait) {
67
96
  if (!json) {
68
97
  log(`\nWaiting for account contract deployment...`);
69
98
  }
70
- txReceipt = await tx.wait();
99
+ txReceipt = await tx.wait({
100
+ timeout: DEFAULT_TX_TIMEOUT_S
101
+ });
71
102
  out.txReceipt = {
72
103
  status: txReceipt.status,
73
104
  transactionFee: txReceipt.transactionFee
@@ -79,7 +110,7 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
79
110
  log(prettyPrintJSON(out));
80
111
  } else {
81
112
  if (tx) {
82
- log(`Deploy tx hash: ${await tx.getTxHash()}`);
113
+ log(`Deploy tx hash: ${(await tx.getTxHash()).toString()}`);
83
114
  }
84
115
  if (txReceipt) {
85
116
  log(`Deploy tx fee: ${txReceipt.transactionFee}`);
@@ -1,6 +1,6 @@
1
- import { type AccountWalletWithSecretKey, Fr, type PXE } from '@aztec/aztec.js';
1
+ import { type AccountWalletWithSecretKey, AztecAddress, 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 { type IFeeOpts } from '../utils/options/fees.js';
5
- export declare function deploy(client: PXE, wallet: AccountWalletWithSecretKey, artifactPath: string, json: boolean, publicKeys: PublicKeys | undefined, rawArgs: any[], salt: Fr | undefined, initializer: string | undefined, skipPublicDeployment: boolean, skipClassRegistration: boolean, skipInitialization: boolean | undefined, universalDeploy: boolean | undefined, wait: boolean, feeOpts: IFeeOpts, debugLogger: Logger, log: LogFn, logJson: (output: any) => void): Promise<import("@aztec/aztec.js").AztecAddress | undefined>;
5
+ export declare function deploy(wallet: AccountWalletWithSecretKey, deployer: AztecAddress | undefined, 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: IFeeOpts, verbose: boolean, timeout: number | undefined, debugLogger: Logger, log: LogFn, logJson: (output: any) => void): Promise<AztecAddress | undefined>;
6
6
  //# 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,KAAK,0BAA0B,EAAuC,EAAE,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAErH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAE5E,wBAAsB,MAAM,CAC1B,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,0BAA0B,EAClC,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,oBAAoB,EAAE,OAAO,EAC7B,qBAAqB,EAAE,OAAO,EAC9B,kBAAkB,EAAE,OAAO,GAAG,SAAS,EACvC,eAAe,EAAE,OAAO,GAAG,SAAS,EACpC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,QAAQ,EACjB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,+DAuF/B"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,YAAY,EAGZ,EAAE,EACH,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAI5E,wBAAsB,MAAM,CAC1B,MAAM,EAAE,0BAA0B,EAClC,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,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,QAAQ,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,YAAuB,EACtC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,qCA6F/B"}
@@ -1,18 +1,17 @@
1
- import { ContractDeployer, Fr } from '@aztec/aztec.js';
2
- import { GITHUB_TAG_PREFIX, encodeArgs, getContractArtifact } from '@aztec/cli/utils';
3
- import { getInitializer } from '@aztec/stdlib/abi';
1
+ import { AztecAddress, ContractDeployer, Fr } from '@aztec/aztec.js';
2
+ import { encodeArgs, getContractArtifact } from '@aztec/cli/utils';
3
+ import { getAllFunctionAbis, getInitializer } from '@aztec/stdlib/abi';
4
4
  import { PublicKeys } from '@aztec/stdlib/keys';
5
5
  import { printGasEstimates } from '../utils/options/fees.js';
6
- export async function deploy(client, wallet, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipPublicDeployment, skipClassRegistration, skipInitialization, universalDeploy, wait, feeOpts, debugLogger, log, logJson) {
6
+ import { printProfileResult } from '../utils/profiling.js';
7
+ import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
8
+ 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, logJson) {
7
9
  salt ??= Fr.random();
8
10
  const contractArtifact = await getContractArtifact(artifactPath, log);
9
- const constructorArtifact = getInitializer(contractArtifact, initializer);
10
- const nodeInfo = await client.getNodeInfo();
11
- const expectedAztecNrVersion = `${GITHUB_TAG_PREFIX}-v${nodeInfo.nodeVersion}`;
12
- if (contractArtifact.aztecNrVersion && contractArtifact.aztecNrVersion !== expectedAztecNrVersion) {
13
- log(`\nWarning: Contract was compiled with a different version of Aztec.nr: ${contractArtifact.aztecNrVersion}. Consider updating Aztec.nr to ${expectedAztecNrVersion}\n`);
14
- }
15
- const deployer = new ContractDeployer(contractArtifact, wallet, publicKeys ?? PublicKeys.default(), initializer);
11
+ const hasInitializer = getAllFunctionAbis(contractArtifact).some((fn)=>fn.isInitializer);
12
+ const constructorArtifact = hasInitializer ? getInitializer(contractArtifact, initializer) : undefined;
13
+ // TODO(#12081): Add contractArtifact.noirVersion and check here (via Noir.lock)?
14
+ const contractDeployer = new ContractDeployer(contractArtifact, wallet, publicKeys ?? PublicKeys.default(), initializer);
16
15
  let args = [];
17
16
  if (rawArgs.length > 0) {
18
17
  if (!constructorArtifact) {
@@ -22,25 +21,32 @@ export async function deploy(client, wallet, artifactPath, json, publicKeys, raw
22
21
  args = encodeArgs(rawArgs, constructorArtifact.parameters);
23
22
  debugLogger.debug(`Encoded arguments: ${args.join(', ')}`);
24
23
  }
25
- const deploy = deployer.deploy(...args);
24
+ const deploy1 = contractDeployer.deploy(...args);
26
25
  const deployOpts = {
27
- ...await feeOpts.toSendOpts(wallet),
26
+ ...await feeOpts.toDeployAccountOpts(wallet),
27
+ from: deployer ?? AztecAddress.ZERO,
28
28
  contractAddressSalt: salt,
29
- universalDeploy,
30
- skipClassRegistration,
29
+ universalDeploy: !deployer,
30
+ skipClassPublication,
31
31
  skipInitialization,
32
- skipPublicDeployment
32
+ skipInstancePublication
33
33
  };
34
34
  if (feeOpts.estimateOnly) {
35
- const gas = await deploy.estimateGas(deployOpts);
35
+ const gas = await deploy1.estimateGas(deployOpts);
36
36
  printGasEstimates(feeOpts, gas, log);
37
37
  return;
38
38
  }
39
- const tx = deploy.send(deployOpts);
39
+ const provenTx = await deploy1.prove(deployOpts);
40
+ if (verbose) {
41
+ printProfileResult(provenTx.stats, log);
42
+ }
43
+ const tx = provenTx.send();
40
44
  const txHash = await tx.getTxHash();
41
- debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
45
+ debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
42
46
  if (wait) {
43
- const deployed = await tx.wait();
47
+ const deployed = await tx.wait({
48
+ timeout
49
+ });
44
50
  const { address, partialAddress, instance } = deployed.contract;
45
51
  if (json) {
46
52
  logJson({
@@ -59,8 +65,8 @@ export async function deploy(client, wallet, artifactPath, json, publicKeys, raw
59
65
  log(`Deployment fee: ${deployed.transactionFee}`);
60
66
  }
61
67
  } else {
62
- const { address, partialAddress } = deploy;
63
- const instance = await deploy.getInstance();
68
+ const { address, partialAddress } = deploy1;
69
+ const instance = await deploy1.getInstance();
64
70
  if (json) {
65
71
  logJson({
66
72
  address: address?.toString() ?? 'N/A',
@@ -79,5 +85,5 @@ export async function deploy(client, wallet, artifactPath, json, publicKeys, raw
79
85
  log(`Deployer: ${instance.deployer.toString()}`);
80
86
  }
81
87
  }
82
- return deploy.address;
88
+ return deploy1.address;
83
89
  }
@@ -1,8 +1,8 @@
1
- import type { AccountManager } from '@aztec/aztec.js';
1
+ import { type AccountManager, AztecAddress } from '@aztec/aztec.js';
2
2
  import type { LogFn, Logger } from '@aztec/foundation/log';
3
3
  import { type IFeeOpts } from '../utils/options/fees.js';
4
- export declare function deployAccount(account: AccountManager, wait: boolean, feeOpts: IFeeOpts, json: boolean, debugLogger: Logger, log: LogFn): Promise<{
5
- address: import("@aztec/aztec.js").AztecAddress;
4
+ export declare function deployAccount(account: AccountManager, wait: boolean, registerClass: boolean, publicDeploy: boolean, feeOpts: IFeeOpts, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<{
5
+ address: AztecAddress;
6
6
  secretKey: import("@aztec/aztec.js").Fr;
7
7
  salt: import("@aztec/aztec.js").Fr;
8
8
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAE5E,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;GA+EX"}
1
+ {"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,YAAY,EAA6B,MAAM,iBAAiB,CAAC;AAE/F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAI5E,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;GA+GX"}
@@ -1,6 +1,9 @@
1
+ import { AztecAddress } from '@aztec/aztec.js';
1
2
  import { prettyPrintJSON } from '@aztec/cli/cli-utils';
2
3
  import { printGasEstimates } from '../utils/options/fees.js';
3
- export async function deployAccount(account, wait, feeOpts, json, debugLogger, log) {
4
+ import { printProfileResult } from '../utils/profiling.js';
5
+ import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
6
+ export async function deployAccount(account, wait, registerClass, publicDeploy, feeOpts, json, verbose, debugLogger, log) {
4
7
  const out = {};
5
8
  const { address, partialAddress, publicKeys } = await account.getCompleteAddress();
6
9
  const { initializationHash, deployer, salt } = account.getInstance();
@@ -27,11 +30,29 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
27
30
  let tx;
28
31
  let txReceipt;
29
32
  const deployOpts = {
30
- ...await feeOpts.toDeployAccountOpts(wallet),
31
- skipInitialization: false
33
+ skipInstancePublication: !publicDeploy,
34
+ skipClassPublication: !registerClass,
35
+ ...await feeOpts.toDeployAccountOpts(wallet)
32
36
  };
37
+ /*
38
+ * This is usually handled by accountManager.deploy(), but we're accessing the lower
39
+ * level method to get gas and timings. That means we have to replicate some of the logic here.
40
+ * In case we're deploying our own account, we need to hijack the payment method for the fee,
41
+ * wrapping it in the one that will make use of the freshly deployed account's
42
+ * entrypoint. For reference, see aztec.js/src/account_manager.ts:deploy()
43
+ * Also, salt and universalDeploy have to be explicitly provided
44
+ */ deployOpts.fee = !deployOpts?.deployWallet && deployOpts?.fee ? {
45
+ ...deployOpts.fee,
46
+ paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
47
+ } : deployOpts?.fee;
48
+ const deployMethod = await account.getDeployMethod(deployOpts.deployWallet);
33
49
  if (feeOpts.estimateOnly) {
34
- const gas = await (await account.getDeployMethod(deployOpts.deployWallet)).estimateGas(deployOpts);
50
+ const gas = await deployMethod.estimateGas({
51
+ ...deployOpts,
52
+ from: AztecAddress.ZERO,
53
+ universalDeploy: true,
54
+ contractAddressSalt: salt
55
+ });
35
56
  if (json) {
36
57
  out.fee = {
37
58
  gasLimits: {
@@ -47,15 +68,26 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
47
68
  printGasEstimates(feeOpts, gas, log);
48
69
  }
49
70
  } else {
50
- tx = account.deploy(deployOpts);
71
+ const provenTx = await deployMethod.prove({
72
+ ...deployOpts,
73
+ from: AztecAddress.ZERO,
74
+ universalDeploy: true,
75
+ contractAddressSalt: salt
76
+ });
77
+ if (verbose) {
78
+ printProfileResult(provenTx.stats, log);
79
+ }
80
+ tx = provenTx.send();
51
81
  const txHash = await tx.getTxHash();
52
- debugLogger.debug(`Account contract tx sent with hash ${txHash}`);
82
+ debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
53
83
  out.txHash = txHash;
54
84
  if (wait) {
55
85
  if (!json) {
56
86
  log(`\nWaiting for account contract deployment...`);
57
87
  }
58
- txReceipt = await tx.wait();
88
+ txReceipt = await tx.wait({
89
+ timeout: DEFAULT_TX_TIMEOUT_S
90
+ });
59
91
  out.txReceipt = {
60
92
  status: txReceipt.status,
61
93
  transactionFee: txReceipt.transactionFee
@@ -66,7 +98,7 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
66
98
  log(prettyPrintJSON(out));
67
99
  } else {
68
100
  if (tx) {
69
- log(`Deploy tx hash: ${await tx.getTxHash()}`);
101
+ log(`Deploy tx hash: ${(await tx.getTxHash()).toString()}`);
70
102
  }
71
103
  if (txReceipt) {
72
104
  log(`Deploy tx fee: ${txReceipt.transactionFee}`);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAsBxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,EACnB,EAAE,CAAC,EAAE,QAAQ,EACb,UAAU,CAAC,EAAE,UAAU,WA6kBxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAwBxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,EACnB,EAAE,CAAC,EAAE,QAAQ,EACb,UAAU,CAAC,EAAE,UAAU,WAosBxB"}