@aztec/cli-wallet 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2

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 (48) hide show
  1. package/README.md +2 -0
  2. package/dest/bin/index.js +75 -0
  3. package/dest/cmds/add_authwit.js +4 -0
  4. package/dest/cmds/add_note.js +14 -0
  5. package/dest/cmds/authorize_action.js +17 -0
  6. package/dest/cmds/bridge_fee_juice.js +52 -0
  7. package/dest/cmds/cancel_tx.js +38 -0
  8. package/dest/cmds/check_tx.js +11 -0
  9. package/dest/cmds/create_account.js +98 -0
  10. package/dest/cmds/create_authwit.js +16 -0
  11. package/dest/cmds/deploy.js +83 -0
  12. package/dest/cmds/deploy_account.js +84 -0
  13. package/dest/cmds/index.js +227 -0
  14. package/dest/cmds/register_contract.js +14 -0
  15. package/dest/cmds/register_sender.js +4 -0
  16. package/dest/cmds/send.js +49 -0
  17. package/dest/cmds/simulate.js +26 -0
  18. package/dest/storage/wallet_db.js +180 -0
  19. package/dest/utils/accounts.js +87 -0
  20. package/dest/utils/ecdsa.js +13 -0
  21. package/dest/utils/options/fees.js +189 -0
  22. package/dest/utils/options/index.js +2 -0
  23. package/dest/utils/options/options.js +122 -0
  24. package/dest/utils/pxe_wrapper.js +21 -0
  25. package/package.json +103 -0
  26. package/src/bin/index.ts +121 -0
  27. package/src/cmds/add_authwit.ts +13 -0
  28. package/src/cmds/add_note.ts +30 -0
  29. package/src/cmds/authorize_action.ts +36 -0
  30. package/src/cmds/bridge_fee_juice.ts +88 -0
  31. package/src/cmds/cancel_tx.ts +61 -0
  32. package/src/cmds/check_tx.ts +12 -0
  33. package/src/cmds/create_account.ts +120 -0
  34. package/src/cmds/create_authwit.ts +35 -0
  35. package/src/cmds/deploy.ts +113 -0
  36. package/src/cmds/deploy_account.ts +92 -0
  37. package/src/cmds/index.ts +674 -0
  38. package/src/cmds/register_contract.ts +20 -0
  39. package/src/cmds/register_sender.ts +7 -0
  40. package/src/cmds/send.ts +62 -0
  41. package/src/cmds/simulate.ts +42 -0
  42. package/src/storage/wallet_db.ts +205 -0
  43. package/src/utils/accounts.ts +102 -0
  44. package/src/utils/ecdsa.ts +15 -0
  45. package/src/utils/options/fees.ts +234 -0
  46. package/src/utils/options/index.ts +2 -0
  47. package/src/utils/options/options.ts +175 -0
  48. package/src/utils/pxe_wrapper.ts +26 -0
@@ -0,0 +1,88 @@
1
+ import { L1FeeJuicePortalManager, type PXE } from '@aztec/aztec.js';
2
+ import { prettyPrintJSON } from '@aztec/cli/utils';
3
+ import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
4
+ import { type AztecAddress } from '@aztec/foundation/aztec-address';
5
+ import { Fr } from '@aztec/foundation/fields';
6
+ import { type LogFn, type Logger } from '@aztec/foundation/log';
7
+
8
+ export async function bridgeL1FeeJuice(
9
+ amount: bigint,
10
+ recipient: AztecAddress,
11
+ pxe: PXE,
12
+ l1RpcUrl: string,
13
+ chainId: number,
14
+ privateKey: string | undefined,
15
+ mnemonic: string,
16
+ mint: boolean,
17
+ json: boolean,
18
+ wait: boolean,
19
+ interval = 60_000,
20
+ log: LogFn,
21
+ debugLogger: Logger,
22
+ ) {
23
+ // Prepare L1 client
24
+ const chain = createEthereumChain(l1RpcUrl, chainId);
25
+ const { publicClient, walletClient } = createL1Clients(chain.rpcUrl, privateKey ?? mnemonic, chain.chainInfo);
26
+
27
+ const {
28
+ protocolContractAddresses: { feeJuice: feeJuiceAddress },
29
+ } = await pxe.getPXEInfo();
30
+
31
+ // Setup portal manager
32
+ const portal = await L1FeeJuicePortalManager.new(pxe, publicClient, walletClient, debugLogger);
33
+ const { claimAmount, claimSecret, messageHash, messageLeafIndex } = await portal.bridgeTokensPublic(
34
+ recipient,
35
+ amount,
36
+ mint,
37
+ );
38
+
39
+ if (json) {
40
+ const out = {
41
+ claimAmount,
42
+ claimSecret,
43
+ messageLeafIndex,
44
+ };
45
+ log(prettyPrintJSON(out));
46
+ } else {
47
+ if (mint) {
48
+ log(`Minted ${claimAmount} fee juice on L1 and pushed to L2 portal`);
49
+ } else {
50
+ log(`Bridged ${claimAmount} fee juice to L2 portal`);
51
+ }
52
+ log(
53
+ `claimAmount=${claimAmount},claimSecret=${claimSecret},messageHash=${messageHash},messageLeafIndex=${messageLeafIndex}\n`,
54
+ );
55
+ log(`Note: You need to wait for two L2 blocks before pulling them from the L2 side`);
56
+ if (wait) {
57
+ log(
58
+ `This command will now continually poll every ${
59
+ interval / 1000
60
+ }s for the inclusion of the newly created L1 to L2 message`,
61
+ );
62
+ }
63
+ }
64
+
65
+ if (wait) {
66
+ const delayedCheck = (delay: number) => {
67
+ return new Promise((resolve, reject) => {
68
+ setTimeout(() => {
69
+ void pxe
70
+ .getL1ToL2MembershipWitness(feeJuiceAddress, Fr.fromHexString(messageHash), claimSecret)
71
+ .then(witness => resolve(witness))
72
+ .catch(err => reject(err));
73
+ }, delay);
74
+ });
75
+ };
76
+
77
+ let witness;
78
+
79
+ while (!witness) {
80
+ witness = await delayedCheck(interval);
81
+ if (!witness) {
82
+ log(`No L1 to L2 message found yet, checking again in ${interval / 1000}s`);
83
+ }
84
+ }
85
+ }
86
+
87
+ return [claimSecret, messageLeafIndex] as const;
88
+ }
@@ -0,0 +1,61 @@
1
+ import { type AccountWalletWithSecretKey, type FeePaymentMethod, SentTx, type TxHash, TxStatus } from '@aztec/aztec.js';
2
+ import { type FeeOptions } from '@aztec/aztec.js/entrypoint';
3
+ import { type Fr, GasFees, GasSettings } from '@aztec/circuits.js';
4
+ import { type LogFn } from '@aztec/foundation/log';
5
+
6
+ export async function cancelTx(
7
+ wallet: AccountWalletWithSecretKey,
8
+ {
9
+ txHash,
10
+ gasSettings: prevTxGasSettings,
11
+ nonce,
12
+ cancellable,
13
+ }: { txHash: TxHash; gasSettings: GasSettings; nonce: Fr; cancellable: boolean },
14
+ paymentMethod: FeePaymentMethod,
15
+ increasedFees: GasFees,
16
+ maxFeesPerGas: GasFees | undefined,
17
+ log: LogFn,
18
+ ) {
19
+ const receipt = await wallet.getTxReceipt(txHash);
20
+ if (receipt.status !== TxStatus.PENDING || !cancellable) {
21
+ log(`Transaction is in status ${receipt.status} and cannot be cancelled`);
22
+ return;
23
+ }
24
+
25
+ const maxPriorityFeesPerGas = new GasFees(
26
+ prevTxGasSettings.maxPriorityFeesPerGas.feePerDaGas.add(increasedFees.feePerDaGas),
27
+ prevTxGasSettings.maxPriorityFeesPerGas.feePerL2Gas.add(increasedFees.feePerL2Gas),
28
+ );
29
+
30
+ const fee: FeeOptions = {
31
+ paymentMethod,
32
+ gasSettings: GasSettings.from({
33
+ ...prevTxGasSettings,
34
+ maxPriorityFeesPerGas,
35
+ maxFeesPerGas: maxFeesPerGas ?? prevTxGasSettings.maxFeesPerGas,
36
+ }),
37
+ };
38
+
39
+ const txRequest = await wallet.createTxExecutionRequest({
40
+ calls: [],
41
+ fee,
42
+ nonce,
43
+ cancellable: true,
44
+ });
45
+ const txSimulationResult = await wallet.simulateTx(txRequest, true);
46
+ const txProvingResult = await wallet.proveTx(txRequest, txSimulationResult.privateExecutionResult);
47
+ const sentTx = new SentTx(wallet, wallet.sendTx(txProvingResult.toTx()));
48
+ try {
49
+ await sentTx.wait();
50
+
51
+ log('Transaction has been cancelled');
52
+
53
+ const cancelReceipt = await sentTx.getReceipt();
54
+ log(` Tx fee: ${cancelReceipt.transactionFee}`);
55
+ log(` Status: ${cancelReceipt.status}`);
56
+ log(` Block number: ${cancelReceipt.blockNumber}`);
57
+ log(` Block hash: ${cancelReceipt.blockHash?.toString()}`);
58
+ } catch (err: any) {
59
+ log(`Could not cancel transaction\n ${err.message}`);
60
+ }
61
+ }
@@ -0,0 +1,12 @@
1
+ import { type PXE, type TxHash } from '@aztec/aztec.js';
2
+ import { inspectTx } from '@aztec/cli/inspect';
3
+ import { type LogFn } from '@aztec/foundation/log';
4
+
5
+ export async function checkTx(client: PXE, txHash: TxHash, statusOnly: boolean, log: LogFn) {
6
+ if (statusOnly) {
7
+ const receipt = await client.getTxReceipt(txHash);
8
+ return receipt.status;
9
+ } else {
10
+ await inspectTx(client, txHash, log, { includeBlockInfo: true });
11
+ }
12
+ }
@@ -0,0 +1,120 @@
1
+ import { type DeployAccountOptions, type PXE } from '@aztec/aztec.js';
2
+ import { prettyPrintJSON } from '@aztec/cli/cli-utils';
3
+ import { Fr } from '@aztec/foundation/fields';
4
+ import { type LogFn, type Logger } from '@aztec/foundation/log';
5
+
6
+ import { type AccountType, createOrRetrieveAccount } from '../utils/accounts.js';
7
+ import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
8
+
9
+ export async function createAccount(
10
+ client: PXE,
11
+ accountType: AccountType,
12
+ secretKey: Fr | undefined,
13
+ publicKey: string | undefined,
14
+ alias: string | undefined,
15
+ registerOnly: boolean,
16
+ publicDeploy: boolean,
17
+ skipInitialization: boolean,
18
+ wait: boolean,
19
+ feeOpts: IFeeOpts,
20
+ json: boolean,
21
+ debugLogger: Logger,
22
+ log: LogFn,
23
+ ) {
24
+ secretKey ??= Fr.random();
25
+
26
+ const account = await createOrRetrieveAccount(
27
+ client,
28
+ undefined /* address, we don't have it yet */,
29
+ undefined /* db, as we want to create from scratch */,
30
+ secretKey,
31
+ accountType,
32
+ Fr.ZERO,
33
+ publicKey,
34
+ );
35
+ const salt = account.getInstance().salt;
36
+ const { address, publicKeys, partialAddress } = await account.getCompleteAddress();
37
+
38
+ const out: Record<string, any> = {};
39
+ if (json) {
40
+ out.address = address;
41
+ out.publicKey = publicKeys;
42
+ if (secretKey) {
43
+ out.secretKey = secretKey;
44
+ }
45
+ out.partialAddress = partialAddress;
46
+ out.salt = salt;
47
+ out.initHash = account.getInstance().initializationHash;
48
+ out.deployer = account.getInstance().deployer;
49
+ } else {
50
+ log(`\nNew account:\n`);
51
+ log(`Address: ${address.toString()}`);
52
+ log(`Public key: 0x${publicKeys.toString()}`);
53
+ if (secretKey) {
54
+ log(`Secret key: ${secretKey.toString()}`);
55
+ }
56
+ log(`Partial address: ${partialAddress.toString()}`);
57
+ log(`Salt: ${salt.toString()}`);
58
+ log(`Init hash: ${account.getInstance().initializationHash.toString()}`);
59
+ log(`Deployer: ${account.getInstance().deployer.toString()}`);
60
+ }
61
+
62
+ let tx;
63
+ let txReceipt;
64
+ if (registerOnly) {
65
+ await account.register();
66
+ } else {
67
+ const wallet = await account.getWallet();
68
+ const sendOpts: DeployAccountOptions = {
69
+ ...(await feeOpts.toSendOpts(wallet)),
70
+ skipClassRegistration: !publicDeploy,
71
+ skipPublicDeployment: !publicDeploy,
72
+ skipInitialization: skipInitialization,
73
+ };
74
+ if (feeOpts.estimateOnly) {
75
+ const gas = await (await account.getDeployMethod()).estimateGas({ ...sendOpts });
76
+ if (json) {
77
+ out.fee = {
78
+ gasLimits: {
79
+ da: gas.gasLimits.daGas,
80
+ l2: gas.gasLimits.l2Gas,
81
+ },
82
+ teardownGasLimits: {
83
+ da: gas.teardownGasLimits.daGas,
84
+ l2: gas.teardownGasLimits,
85
+ },
86
+ };
87
+ } else {
88
+ printGasEstimates(feeOpts, gas, log);
89
+ }
90
+ } else {
91
+ tx = account.deploy({ ...sendOpts });
92
+ const txHash = await tx.getTxHash();
93
+ debugLogger.debug(`Account contract tx sent with hash ${txHash}`);
94
+ out.txHash = txHash;
95
+ if (wait) {
96
+ if (!json) {
97
+ log(`\nWaiting for account contract deployment...`);
98
+ }
99
+ txReceipt = await tx.wait();
100
+ out.txReceipt = {
101
+ status: txReceipt.status,
102
+ transactionFee: txReceipt.transactionFee,
103
+ };
104
+ }
105
+ }
106
+ }
107
+
108
+ if (json) {
109
+ log(prettyPrintJSON(out));
110
+ } else {
111
+ if (tx) {
112
+ log(`Deploy tx hash: ${await tx.getTxHash()}`);
113
+ }
114
+ if (txReceipt) {
115
+ log(`Deploy tx fee: ${txReceipt.transactionFee}`);
116
+ }
117
+ }
118
+
119
+ return { alias, address, secretKey, salt };
120
+ }
@@ -0,0 +1,35 @@
1
+ import { type AccountWalletWithSecretKey, type AztecAddress, Contract } from '@aztec/aztec.js';
2
+ import { prepTx } from '@aztec/cli/utils';
3
+ import { type LogFn } from '@aztec/foundation/log';
4
+
5
+ export async function createAuthwit(
6
+ wallet: AccountWalletWithSecretKey,
7
+ functionName: string,
8
+ caller: AztecAddress,
9
+ functionArgsIn: any[],
10
+ contractArtifactPath: string,
11
+ contractAddress: AztecAddress,
12
+ log: LogFn,
13
+ ) {
14
+ const { functionArgs, contractArtifact, isPrivate } = await prepTx(
15
+ contractArtifactPath,
16
+ functionName,
17
+ functionArgsIn,
18
+ log,
19
+ );
20
+
21
+ if (!isPrivate) {
22
+ throw new Error(
23
+ 'Cannot create an authwit for a public function. To allow a third party to call a public function, please authorize the action via the authorize-action command',
24
+ );
25
+ }
26
+
27
+ const contract = await Contract.at(contractAddress, contractArtifact, wallet);
28
+ const action = contract.methods[functionName](...functionArgs);
29
+
30
+ const witness = await wallet.createAuthWit({ caller, action });
31
+
32
+ log(`Created authorization witness for action ${functionName} on contract ${contractAddress} for caller ${caller}`);
33
+
34
+ return witness;
35
+ }
@@ -0,0 +1,113 @@
1
+ import { type AccountWalletWithSecretKey, ContractDeployer, type DeployMethod, Fr, type PXE } from '@aztec/aztec.js';
2
+ import { PublicKeys } from '@aztec/circuits.js';
3
+ import { GITHUB_TAG_PREFIX, encodeArgs, getContractArtifact } from '@aztec/cli/utils';
4
+ import { getInitializer } from '@aztec/foundation/abi';
5
+ import { type LogFn, type Logger } from '@aztec/foundation/log';
6
+
7
+ import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
8
+
9
+ export async function deploy(
10
+ client: PXE,
11
+ wallet: AccountWalletWithSecretKey,
12
+ artifactPath: string,
13
+ json: boolean,
14
+ publicKeys: PublicKeys | undefined,
15
+ rawArgs: any[],
16
+ salt: Fr | undefined,
17
+ initializer: string | undefined,
18
+ skipPublicDeployment: boolean,
19
+ skipClassRegistration: boolean,
20
+ skipInitialization: boolean | undefined,
21
+ universalDeploy: boolean | undefined,
22
+ wait: boolean,
23
+ feeOpts: IFeeOpts,
24
+ debugLogger: Logger,
25
+ log: LogFn,
26
+ logJson: (output: any) => void,
27
+ ) {
28
+ salt ??= Fr.random();
29
+ const contractArtifact = await getContractArtifact(artifactPath, log);
30
+ const constructorArtifact = getInitializer(contractArtifact, initializer);
31
+
32
+ const nodeInfo = await client.getNodeInfo();
33
+ const expectedAztecNrVersion = `${GITHUB_TAG_PREFIX}-v${nodeInfo.nodeVersion}`;
34
+ if (contractArtifact.aztecNrVersion && contractArtifact.aztecNrVersion !== expectedAztecNrVersion) {
35
+ log(
36
+ `\nWarning: Contract was compiled with a different version of Aztec.nr: ${contractArtifact.aztecNrVersion}. Consider updating Aztec.nr to ${expectedAztecNrVersion}\n`,
37
+ );
38
+ }
39
+
40
+ const deployer = new ContractDeployer(contractArtifact, wallet, publicKeys ?? PublicKeys.default(), initializer);
41
+
42
+ let args = [];
43
+ if (rawArgs.length > 0) {
44
+ if (!constructorArtifact) {
45
+ throw new Error(`Cannot process constructor arguments as no constructor was found`);
46
+ }
47
+ debugLogger.debug(`Input arguments: ${rawArgs.map((x: any) => `"${x}"`).join(', ')}`);
48
+ args = encodeArgs(rawArgs, constructorArtifact!.parameters);
49
+ debugLogger.debug(`Encoded arguments: ${args.join(', ')}`);
50
+ }
51
+
52
+ const deploy = deployer.deploy(...args);
53
+ const deployOpts: Parameters<DeployMethod['send']>[0] = {
54
+ ...(await feeOpts.toSendOpts(wallet)),
55
+ contractAddressSalt: salt,
56
+ universalDeploy,
57
+ skipClassRegistration,
58
+ skipInitialization,
59
+ skipPublicDeployment,
60
+ };
61
+
62
+ if (feeOpts.estimateOnly) {
63
+ const gas = await deploy.estimateGas(deployOpts);
64
+ printGasEstimates(feeOpts, gas, log);
65
+ return;
66
+ }
67
+
68
+ const tx = deploy.send(deployOpts);
69
+
70
+ const txHash = await tx.getTxHash();
71
+ debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
72
+ if (wait) {
73
+ const deployed = await tx.wait();
74
+ const { address, partialAddress, instance } = deployed.contract;
75
+ if (json) {
76
+ logJson({
77
+ address: address.toString(),
78
+ partialAddress: partialAddress.toString(),
79
+ initializationHash: instance.initializationHash.toString(),
80
+ salt: salt.toString(),
81
+ transactionFee: deployed.transactionFee?.toString(),
82
+ });
83
+ } else {
84
+ log(`Contract deployed at ${address.toString()}`);
85
+ log(`Contract partial address ${partialAddress.toString()}`);
86
+ log(`Contract init hash ${instance.initializationHash.toString()}`);
87
+ log(`Deployment tx hash: ${txHash.toString()}`);
88
+ log(`Deployment salt: ${salt.toString()}`);
89
+ log(`Deployment fee: ${deployed.transactionFee}`);
90
+ }
91
+ } else {
92
+ const { address, partialAddress } = deploy;
93
+ const instance = await deploy.getInstance();
94
+ if (json) {
95
+ logJson({
96
+ address: address?.toString() ?? 'N/A',
97
+ partialAddress: partialAddress?.toString() ?? 'N/A',
98
+ txHash: txHash.toString(),
99
+ initializationHash: instance.initializationHash.toString(),
100
+ salt: salt.toString(),
101
+ deployer: instance.deployer.toString(),
102
+ });
103
+ } else {
104
+ log(`Contract deployed at ${address?.toString()}`);
105
+ log(`Contract partial address ${partialAddress?.toString()}`);
106
+ log(`Contract init hash ${instance.initializationHash.toString()}`);
107
+ log(`Deployment tx hash: ${txHash.toString()}`);
108
+ log(`Deployment salt: ${salt.toString()}`);
109
+ log(`Deployer: ${instance.deployer.toString()}`);
110
+ }
111
+ }
112
+ return deploy.address;
113
+ }
@@ -0,0 +1,92 @@
1
+ import { type AccountManager, type DeployAccountOptions } from '@aztec/aztec.js';
2
+ import { prettyPrintJSON } from '@aztec/cli/cli-utils';
3
+ import { type LogFn, type Logger } from '@aztec/foundation/log';
4
+
5
+ import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
6
+
7
+ export async function deployAccount(
8
+ account: AccountManager,
9
+ wait: boolean,
10
+ feeOpts: IFeeOpts,
11
+ json: boolean,
12
+ debugLogger: Logger,
13
+ log: LogFn,
14
+ ) {
15
+ const out: Record<string, any> = {};
16
+ const { address, partialAddress, publicKeys } = await account.getCompleteAddress();
17
+ const { initializationHash, deployer, salt } = account.getInstance();
18
+ const wallet = await account.getWallet();
19
+ const secretKey = wallet.getSecretKey();
20
+
21
+ if (json) {
22
+ out.address = address;
23
+ out.partialAddress = partialAddress;
24
+ out.salt = salt;
25
+ out.initHash = initializationHash;
26
+ out.deployer = deployer;
27
+ } else {
28
+ log(`\nNew account:\n`);
29
+ log(`Address: ${address.toString()}`);
30
+ log(`Public key: 0x${publicKeys.toString()}`);
31
+ if (secretKey) {
32
+ log(`Secret key: ${secretKey.toString()}`);
33
+ }
34
+ log(`Partial address: ${partialAddress.toString()}`);
35
+ log(`Salt: ${salt.toString()}`);
36
+ log(`Init hash: ${initializationHash.toString()}`);
37
+ log(`Deployer: ${deployer.toString()}`);
38
+ }
39
+
40
+ let tx;
41
+ let txReceipt;
42
+
43
+ const sendOpts: DeployAccountOptions = {
44
+ ...(await feeOpts.toSendOpts(wallet)),
45
+ skipInitialization: false,
46
+ };
47
+ if (feeOpts.estimateOnly) {
48
+ const gas = await (await account.getDeployMethod()).estimateGas({ ...sendOpts });
49
+ if (json) {
50
+ out.fee = {
51
+ gasLimits: {
52
+ da: gas.gasLimits.daGas,
53
+ l2: gas.gasLimits.l2Gas,
54
+ },
55
+ teardownGasLimits: {
56
+ da: gas.teardownGasLimits.daGas,
57
+ l2: gas.teardownGasLimits,
58
+ },
59
+ };
60
+ } else {
61
+ printGasEstimates(feeOpts, gas, log);
62
+ }
63
+ } else {
64
+ tx = account.deploy({ ...sendOpts });
65
+ const txHash = await tx.getTxHash();
66
+ debugLogger.debug(`Account contract tx sent with hash ${txHash}`);
67
+ out.txHash = txHash;
68
+ if (wait) {
69
+ if (!json) {
70
+ log(`\nWaiting for account contract deployment...`);
71
+ }
72
+ txReceipt = await tx.wait();
73
+ out.txReceipt = {
74
+ status: txReceipt.status,
75
+ transactionFee: txReceipt.transactionFee,
76
+ };
77
+ }
78
+ }
79
+
80
+ if (json) {
81
+ log(prettyPrintJSON(out));
82
+ } else {
83
+ if (tx) {
84
+ log(`Deploy tx hash: ${await tx.getTxHash()}`);
85
+ }
86
+ if (txReceipt) {
87
+ log(`Deploy tx fee: ${txReceipt.transactionFee}`);
88
+ }
89
+ }
90
+
91
+ return { address, secretKey, salt };
92
+ }