@aztec/cli-wallet 0.0.0-test.1 → 0.0.1-commit.017a351
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dest/bin/index.d.ts +2 -1
- package/dest/bin/index.js +58 -26
- package/dest/cmds/authorize_action.d.ts +4 -3
- package/dest/cmds/authorize_action.d.ts.map +1 -1
- package/dest/cmds/authorize_action.js +11 -5
- package/dest/cmds/bridge_fee_juice.d.ts +4 -4
- package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
- package/dest/cmds/bridge_fee_juice.js +10 -8
- package/dest/cmds/check_tx.d.ts +5 -3
- package/dest/cmds/check_tx.d.ts.map +1 -1
- package/dest/cmds/check_tx.js +174 -6
- package/dest/cmds/create_account.d.ts +10 -7
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +74 -38
- package/dest/cmds/create_authwit.d.ts +4 -3
- package/dest/cmds/create_authwit.d.ts.map +1 -1
- package/dest/cmds/create_authwit.js +6 -6
- package/dest/cmds/deploy.d.ts +8 -4
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +108 -59
- package/dest/cmds/deploy_account.d.ts +7 -8
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +70 -36
- package/dest/cmds/get_fee_juice_balance.d.ts +5 -0
- package/dest/cmds/get_fee_juice_balance.d.ts.map +1 -0
- package/dest/cmds/get_fee_juice_balance.js +27 -0
- package/dest/cmds/import_test_accounts.d.ts +3 -3
- package/dest/cmds/import_test_accounts.d.ts.map +1 -1
- package/dest/cmds/import_test_accounts.js +6 -9
- package/dest/cmds/index.d.ts +3 -3
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +99 -115
- package/dest/cmds/profile.d.ts +8 -0
- package/dest/cmds/profile.d.ts.map +1 -0
- package/dest/cmds/profile.js +28 -0
- package/dest/cmds/register_contract.d.ts +7 -3
- package/dest/cmds/register_contract.d.ts.map +1 -1
- package/dest/cmds/register_contract.js +20 -7
- package/dest/cmds/register_sender.d.ts +4 -3
- package/dest/cmds/register_sender.d.ts.map +1 -1
- package/dest/cmds/send.d.ts +9 -9
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +54 -27
- package/dest/cmds/simulate.d.ts +7 -3
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +26 -20
- package/dest/storage/wallet_db.d.ts +12 -19
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +63 -55
- package/dest/utils/authorizations.d.ts +6 -0
- package/dest/utils/authorizations.d.ts.map +1 -0
- package/dest/utils/authorizations.js +28 -0
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts +12 -0
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts.map +1 -0
- package/dest/utils/cli_wallet_and_node_wrapper.js +25 -0
- package/dest/utils/constants.d.ts +4 -0
- package/dest/utils/constants.d.ts.map +1 -0
- package/dest/utils/constants.js +7 -0
- package/dest/utils/ecdsa.d.ts +1 -3
- package/dest/utils/ecdsa.d.ts.map +1 -1
- package/dest/utils/options/fees.d.ts +23 -28
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +112 -148
- package/dest/utils/options/index.d.ts +1 -1
- package/dest/utils/options/options.d.ts +9 -5
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +26 -14
- package/dest/utils/profiling.d.ts +5 -0
- package/dest/utils/profiling.d.ts.map +1 -0
- package/dest/utils/profiling.js +68 -0
- package/dest/utils/wallet.d.ts +44 -0
- package/dest/utils/wallet.d.ts.map +1 -0
- package/dest/utils/wallet.js +263 -0
- package/package.json +31 -23
- package/src/bin/index.ts +63 -33
- package/src/cmds/authorize_action.ts +16 -5
- package/src/cmds/bridge_fee_juice.ts +16 -12
- package/src/cmds/check_tx.ts +212 -5
- package/src/cmds/create_account.ts +89 -45
- package/src/cmds/create_authwit.ts +9 -5
- package/src/cmds/deploy.ts +115 -71
- package/src/cmds/deploy_account.ts +84 -36
- package/src/cmds/get_fee_juice_balance.ts +37 -0
- package/src/cmds/import_test_accounts.ts +7 -11
- package/src/cmds/index.ts +312 -222
- package/src/cmds/profile.ts +48 -0
- package/src/cmds/register_contract.ts +28 -5
- package/src/cmds/register_sender.ts +3 -2
- package/src/cmds/send.ts +59 -25
- package/src/cmds/simulate.ts +37 -24
- package/src/storage/wallet_db.ts +67 -68
- package/src/utils/authorizations.ts +51 -0
- package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
- package/src/utils/constants.ts +4 -0
- package/src/utils/options/fees.ts +169 -210
- package/src/utils/options/options.ts +41 -19
- package/src/utils/profiling.ts +172 -0
- package/src/utils/wallet.ts +330 -0
- package/dest/cmds/add_authwit.d.ts +0 -4
- package/dest/cmds/add_authwit.d.ts.map +0 -1
- package/dest/cmds/add_authwit.js +0 -4
- package/dest/cmds/cancel_tx.d.ts +0 -11
- package/dest/cmds/cancel_tx.d.ts.map +0 -1
- package/dest/cmds/cancel_tx.js +0 -38
- package/dest/utils/accounts.d.ts +0 -11
- package/dest/utils/accounts.d.ts.map +0 -1
- package/dest/utils/accounts.js +0 -87
- package/dest/utils/pxe_wrapper.d.ts +0 -10
- package/dest/utils/pxe_wrapper.d.ts.map +0 -1
- package/dest/utils/pxe_wrapper.js +0 -21
- package/src/cmds/add_authwit.ts +0 -13
- package/src/cmds/cancel_tx.ts +0 -62
- package/src/utils/accounts.ts +0 -102
- package/src/utils/pxe_wrapper.ts +0 -26
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
1
4
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export async function createAccount(
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
7
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
8
|
+
export async function createAccount(wallet, aztecNode, accountType, secretKey, salt, publicKey, alias, deployer, registerOnly, skipInitialization, publicDeploy, registerClass, wait, feeOpts, waitForStatus, json, verbose, debugLogger, log) {
|
|
6
9
|
secretKey ??= Fr.random();
|
|
7
|
-
const account = await createOrRetrieveAccount(
|
|
8
|
-
const
|
|
10
|
+
const account = await wallet.createOrRetrieveAccount(undefined /* address, we don't have it yet */ , secretKey, accountType, salt, publicKey);
|
|
11
|
+
const instanceSalt = account.getInstance().salt;
|
|
9
12
|
const { address, publicKeys, partialAddress } = await account.getCompleteAddress();
|
|
10
13
|
const out = {};
|
|
11
14
|
if (json) {
|
|
@@ -15,9 +18,8 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
15
18
|
out.secretKey = secretKey;
|
|
16
19
|
}
|
|
17
20
|
out.partialAddress = partialAddress;
|
|
18
|
-
out.salt =
|
|
21
|
+
out.salt = instanceSalt;
|
|
19
22
|
out.initHash = account.getInstance().initializationHash;
|
|
20
|
-
out.deployer = account.getInstance().deployer;
|
|
21
23
|
} else {
|
|
22
24
|
log(`\nNew account:\n`);
|
|
23
25
|
log(`Address: ${address.toString()}`);
|
|
@@ -26,60 +28,94 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
26
28
|
log(`Secret key: ${secretKey.toString()}`);
|
|
27
29
|
}
|
|
28
30
|
log(`Partial address: ${partialAddress.toString()}`);
|
|
29
|
-
log(`Salt: ${
|
|
31
|
+
log(`Salt: ${instanceSalt.toString()}`);
|
|
30
32
|
log(`Init hash: ${account.getInstance().initializationHash.toString()}`);
|
|
31
|
-
log(`Deployer: ${account.getInstance().deployer.toString()}`);
|
|
32
33
|
}
|
|
33
|
-
let
|
|
34
|
+
let txHash;
|
|
34
35
|
let txReceipt;
|
|
35
|
-
if (registerOnly) {
|
|
36
|
-
await
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
skipInitialization
|
|
43
|
-
|
|
36
|
+
if (!registerOnly) {
|
|
37
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
38
|
+
const delegatedDeployment = deployer && !account.address.equals(deployer);
|
|
39
|
+
const from = delegatedDeployment ? deployer : NO_FROM;
|
|
40
|
+
const deployAccountOpts = {
|
|
41
|
+
skipClassPublication: !registerClass,
|
|
42
|
+
skipInstancePublication: !publicDeploy,
|
|
43
|
+
skipInitialization,
|
|
44
|
+
from,
|
|
45
|
+
fee: {
|
|
46
|
+
paymentMethod,
|
|
47
|
+
gasSettings
|
|
48
|
+
}
|
|
44
49
|
};
|
|
50
|
+
const localStart = performance.now();
|
|
51
|
+
const deployMethod = await account.getDeployMethod();
|
|
52
|
+
const sim = await deployMethod.simulate({
|
|
53
|
+
...deployAccountOpts,
|
|
54
|
+
fee: {
|
|
55
|
+
...deployAccountOpts.fee,
|
|
56
|
+
estimateGas: true
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// estimateGas: true guarantees these fields are present
|
|
60
|
+
const estimatedGas = sim.estimatedGas;
|
|
61
|
+
const stats = sim.stats;
|
|
45
62
|
if (feeOpts.estimateOnly) {
|
|
46
|
-
const gas = await (await account.getDeployMethod(deployOpts.deployWallet)).estimateGas(deployOpts);
|
|
47
63
|
if (json) {
|
|
48
64
|
out.fee = {
|
|
49
65
|
gasLimits: {
|
|
50
|
-
da:
|
|
51
|
-
l2:
|
|
66
|
+
da: estimatedGas.gasLimits.daGas,
|
|
67
|
+
l2: estimatedGas.gasLimits.l2Gas
|
|
52
68
|
},
|
|
53
69
|
teardownGasLimits: {
|
|
54
|
-
da:
|
|
55
|
-
l2:
|
|
70
|
+
da: estimatedGas.teardownGasLimits.daGas,
|
|
71
|
+
l2: estimatedGas.teardownGasLimits
|
|
56
72
|
}
|
|
57
73
|
};
|
|
58
|
-
} else {
|
|
59
|
-
printGasEstimates(feeOpts, gas, log);
|
|
60
74
|
}
|
|
61
75
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
if (verbose) {
|
|
77
|
+
printProfileResult(stats, log);
|
|
78
|
+
}
|
|
79
|
+
if (!json) {
|
|
80
|
+
log(`\nWaiting for account contract deployment...`);
|
|
81
|
+
}
|
|
82
|
+
const sendOpts = {
|
|
83
|
+
...deployAccountOpts,
|
|
84
|
+
fee: deployAccountOpts.fee ? {
|
|
85
|
+
...deployAccountOpts.fee,
|
|
86
|
+
gasSettings: estimatedGas
|
|
87
|
+
} : undefined
|
|
88
|
+
};
|
|
89
|
+
({ txHash } = await deployMethod.send({
|
|
90
|
+
...sendOpts,
|
|
91
|
+
wait: NO_WAIT
|
|
92
|
+
}));
|
|
93
|
+
const localTimeMs = performance.now() - localStart;
|
|
66
94
|
if (wait) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
95
|
+
const nodeStart = performance.now();
|
|
96
|
+
txReceipt = await waitForTx(aztecNode, txHash, {
|
|
97
|
+
timeout: DEFAULT_TX_TIMEOUT_S,
|
|
98
|
+
waitForStatus
|
|
99
|
+
});
|
|
100
|
+
const nodeTimeMs = performance.now() - nodeStart;
|
|
71
101
|
out.txReceipt = {
|
|
72
102
|
status: txReceipt.status,
|
|
73
103
|
transactionFee: txReceipt.transactionFee
|
|
74
104
|
};
|
|
105
|
+
if (!json) {
|
|
106
|
+
log(` Local processing time: ${(localTimeMs / 1000).toFixed(1)}s`);
|
|
107
|
+
log(` Node inclusion time: ${(nodeTimeMs / 1000).toFixed(1)}s`);
|
|
108
|
+
}
|
|
75
109
|
}
|
|
110
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
111
|
+
out.txHash = txHash;
|
|
76
112
|
}
|
|
77
113
|
}
|
|
78
114
|
if (json) {
|
|
79
115
|
log(prettyPrintJSON(out));
|
|
80
116
|
} else {
|
|
81
|
-
if (
|
|
82
|
-
log(`Deploy tx hash: ${
|
|
117
|
+
if (txHash) {
|
|
118
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
83
119
|
}
|
|
84
120
|
if (txReceipt) {
|
|
85
121
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
|
@@ -89,6 +125,6 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
89
125
|
alias,
|
|
90
126
|
address,
|
|
91
127
|
secretKey,
|
|
92
|
-
salt
|
|
128
|
+
salt: instanceSalt
|
|
93
129
|
};
|
|
94
130
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
4
|
+
export declare function createAuthwit(wallet: CLIWallet, from: AztecAddress, functionName: string, caller: AztecAddress, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, log: LogFn): Promise<import("@aztec/stdlib/auth-witness").AuthWitness>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX2F1dGh3aXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbWRzL2NyZWF0ZV9hdXRod2l0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRzlELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRW5ELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXBELHdCQUFzQixhQUFhLENBQ2pDLE1BQU0sRUFBRSxTQUFTLEVBQ2pCLElBQUksRUFBRSxZQUFZLEVBQ2xCLFlBQVksRUFBRSxNQUFNLEVBQ3BCLE1BQU0sRUFBRSxZQUFZLEVBQ3BCLGNBQWMsRUFBRSxHQUFHLEVBQUUsRUFDckIsb0JBQW9CLEVBQUUsTUFBTSxFQUM1QixlQUFlLEVBQUUsWUFBWSxFQUM3QixHQUFHLEVBQUUsS0FBSyw2REF1QlgifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_authwit.d.ts","sourceRoot":"","sources":["../../src/cmds/create_authwit.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create_authwit.d.ts","sourceRoot":"","sources":["../../src/cmds/create_authwit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,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,6DAuBX"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Contract } from '@aztec/aztec.js';
|
|
1
|
+
import { Contract } from '@aztec/aztec.js/contracts';
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
|
-
export async function createAuthwit(wallet, functionName, caller, functionArgsIn, contractArtifactPath, contractAddress, log) {
|
|
3
|
+
export async function createAuthwit(wallet, from, functionName, caller, functionArgsIn, contractArtifactPath, contractAddress, log) {
|
|
4
4
|
const { functionArgs, contractArtifact, isPrivate } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
5
5
|
if (!isPrivate) {
|
|
6
6
|
throw new Error('Cannot create an authwit for a public function. To allow a third party to call a public function, please authorize the action via the authorize-action command');
|
|
7
7
|
}
|
|
8
|
-
const contract =
|
|
9
|
-
const
|
|
10
|
-
const witness = await wallet.createAuthWit({
|
|
8
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
9
|
+
const call = await contract.methods[functionName](...functionArgs).getFunctionCall();
|
|
10
|
+
const witness = await wallet.createAuthWit(from, {
|
|
11
11
|
caller,
|
|
12
|
-
|
|
12
|
+
call
|
|
13
13
|
});
|
|
14
14
|
log(`Created authorization witness for action ${functionName} on contract ${contractAddress} for caller ${caller}`);
|
|
15
15
|
return witness;
|
package/dest/cmds/deploy.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { type AztecNode } from '@aztec/aztec.js/node';
|
|
2
4
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
5
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
import type { TxStatus } from '@aztec/stdlib/tx';
|
|
7
|
+
import { CLIFeeArgs } from '../utils/options/fees.js';
|
|
8
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
9
|
+
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, waitForStatus: TxStatus, verbose: boolean, timeout: number | undefined, debugLogger: Logger, log: LogFn, universal?: boolean): Promise<AztecAddress>;
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY21kcy9kZXBsb3kudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFJOUQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzVDLE9BQU8sRUFBRSxLQUFLLFNBQVMsRUFBYSxNQUFNLHNCQUFzQixDQUFDO0FBRWpFLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUUzRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDaEQsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFHakQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRXRELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXBELHdCQUFzQixNQUFNLENBQzFCLE1BQU0sRUFBRSxTQUFTLEVBQ2pCLElBQUksRUFBRSxTQUFTLEVBQ2YsUUFBUSxFQUFFLFlBQVksRUFDdEIsWUFBWSxFQUFFLE1BQU0sRUFDcEIsSUFBSSxFQUFFLE9BQU8sRUFDYixVQUFVLEVBQUUsVUFBVSxHQUFHLFNBQVMsRUFDbEMsT0FBTyxFQUFFLEdBQUcsRUFBRSxFQUNkLElBQUksRUFBRSxFQUFFLEdBQUcsU0FBUyxFQUNwQixXQUFXLEVBQUUsTUFBTSxHQUFHLFNBQVMsRUFDL0IsdUJBQXVCLEVBQUUsT0FBTyxFQUNoQyxvQkFBb0IsRUFBRSxPQUFPLEVBQzdCLGtCQUFrQixFQUFFLE9BQU8sR0FBRyxTQUFTLEVBQ3ZDLElBQUksRUFBRSxPQUFPLEVBQ2IsT0FBTyxFQUFFLFVBQVUsRUFDbkIsYUFBYSxFQUFFLFFBQVEsRUFDdkIsT0FBTyxFQUFFLE9BQU8sRUFDaEIsT0FBTyxvQkFBK0IsRUFDdEMsV0FBVyxFQUFFLE1BQU0sRUFDbkIsR0FBRyxFQUFFLEtBQUssRUFDVixTQUFTLENBQUMsRUFBRSxPQUFPLHlCQXNIcEIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,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,aAAa,EAAE,QAAQ,EACvB,OAAO,EAAE,OAAO,EAChB,OAAO,oBAA+B,EACtC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,SAAS,CAAC,EAAE,OAAO,yBAsHpB"}
|
package/dest/cmds/deploy.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { ContractDeployer } from '@aztec/aztec.js/deployment';
|
|
4
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
6
|
+
import { encodeArgs, getContractArtifact, prettyPrintJSON } from '@aztec/cli/utils';
|
|
7
|
+
import { getAllFunctionAbis, getInitializer } from '@aztec/stdlib/abi';
|
|
4
8
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
-
import {
|
|
6
|
-
|
|
9
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
10
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
11
|
+
export async function deploy(wallet, node, deployer, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipInstancePublication, skipClassPublication, skipInitialization, wait, feeOpts, waitForStatus, verbose, timeout = DEFAULT_TX_TIMEOUT_S, debugLogger, log, universal) {
|
|
12
|
+
const out = {};
|
|
7
13
|
salt ??= Fr.random();
|
|
8
14
|
const contractArtifact = await getContractArtifact(artifactPath, log);
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
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);
|
|
15
|
+
const hasInitializer = getAllFunctionAbis(contractArtifact).some((fn)=>fn.isInitializer);
|
|
16
|
+
const constructorArtifact = hasInitializer ? getInitializer(contractArtifact, initializer) : undefined;
|
|
17
|
+
// TODO(#12081): Add contractArtifact.noirVersion and check here (via Noir.lock)?
|
|
18
|
+
const contractDeployer = new ContractDeployer(contractArtifact, wallet, initializer);
|
|
16
19
|
let args = [];
|
|
17
20
|
if (rawArgs.length > 0) {
|
|
18
21
|
if (!constructorArtifact) {
|
|
@@ -22,62 +25,108 @@ export async function deploy(client, wallet, artifactPath, json, publicKeys, raw
|
|
|
22
25
|
args = encodeArgs(rawArgs, constructorArtifact.parameters);
|
|
23
26
|
debugLogger.debug(`Encoded arguments: ${args.join(', ')}`);
|
|
24
27
|
}
|
|
25
|
-
const
|
|
28
|
+
const deployInteraction = contractDeployer.deploy(args, {
|
|
29
|
+
salt,
|
|
30
|
+
publicKeys: publicKeys ?? PublicKeys.default(),
|
|
31
|
+
...universal ? {
|
|
32
|
+
universalDeploy: true
|
|
33
|
+
} : {}
|
|
34
|
+
});
|
|
35
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, deployer);
|
|
26
36
|
const deployOpts = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
fee: {
|
|
38
|
+
gasSettings,
|
|
39
|
+
paymentMethod
|
|
40
|
+
},
|
|
41
|
+
from: deployer ?? NO_FROM,
|
|
42
|
+
skipClassPublication,
|
|
31
43
|
skipInitialization,
|
|
32
|
-
|
|
44
|
+
skipInstancePublication
|
|
33
45
|
};
|
|
46
|
+
const localStart = performance.now();
|
|
47
|
+
const sim = await deployInteraction.simulate({
|
|
48
|
+
...deployOpts,
|
|
49
|
+
fee: {
|
|
50
|
+
...deployOpts.fee,
|
|
51
|
+
estimateGas: true
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
// estimateGas: true guarantees these fields are present
|
|
55
|
+
const estimatedGas = sim.estimatedGas;
|
|
56
|
+
const stats = sim.stats;
|
|
34
57
|
if (feeOpts.estimateOnly) {
|
|
35
|
-
const gas = await deploy.estimateGas(deployOpts);
|
|
36
|
-
printGasEstimates(feeOpts, gas, log);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const tx = deploy.send(deployOpts);
|
|
40
|
-
const txHash = await tx.getTxHash();
|
|
41
|
-
debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
|
|
42
|
-
if (wait) {
|
|
43
|
-
const deployed = await tx.wait();
|
|
44
|
-
const { address, partialAddress, instance } = deployed.contract;
|
|
45
58
|
if (json) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
57
|
-
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
58
|
-
log(`Deployment salt: ${salt.toString()}`);
|
|
59
|
-
log(`Deployment fee: ${deployed.transactionFee}`);
|
|
59
|
+
out.fee = {
|
|
60
|
+
gasLimits: {
|
|
61
|
+
da: estimatedGas.gasLimits.daGas,
|
|
62
|
+
l2: estimatedGas.gasLimits.l2Gas
|
|
63
|
+
},
|
|
64
|
+
teardownGasLimits: {
|
|
65
|
+
da: estimatedGas.teardownGasLimits.daGas,
|
|
66
|
+
l2: estimatedGas.teardownGasLimits
|
|
67
|
+
}
|
|
68
|
+
};
|
|
60
69
|
}
|
|
61
70
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
if (verbose) {
|
|
72
|
+
printProfileResult(stats, log);
|
|
73
|
+
}
|
|
74
|
+
const instance = await deployInteraction.getInstance();
|
|
75
|
+
const address = instance.address;
|
|
76
|
+
const partialAddress = await deployInteraction.getPartialAddress();
|
|
77
|
+
const { txHash } = await deployInteraction.send({
|
|
78
|
+
...deployOpts,
|
|
79
|
+
wait: NO_WAIT
|
|
80
|
+
});
|
|
81
|
+
const localTimeMs = performance.now() - localStart;
|
|
82
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
83
|
+
out.hash = txHash;
|
|
84
|
+
if (wait) {
|
|
85
|
+
const nodeStart = performance.now();
|
|
86
|
+
const receipt = await waitForTx(node, txHash, {
|
|
87
|
+
timeout,
|
|
88
|
+
waitForStatus
|
|
72
89
|
});
|
|
90
|
+
const nodeTimeMs = performance.now() - nodeStart;
|
|
91
|
+
if (!json) {
|
|
92
|
+
log(`Contract deployed at ${address.toString()}`);
|
|
93
|
+
log(`Contract partial address ${partialAddress.toString()}`);
|
|
94
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
95
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
96
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
97
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
98
|
+
log(`Transaction fee: ${receipt.transactionFee?.toString()}`);
|
|
99
|
+
log(` Local processing time: ${(localTimeMs / 1000).toFixed(1)}s`);
|
|
100
|
+
log(` Node inclusion time: ${(nodeTimeMs / 1000).toFixed(1)}s`);
|
|
101
|
+
} else {
|
|
102
|
+
out.contract = {
|
|
103
|
+
address: address.toString(),
|
|
104
|
+
partialAddress: partialAddress.toString(),
|
|
105
|
+
initializationHash: instance.initializationHash.toString(),
|
|
106
|
+
salt: salt.toString(),
|
|
107
|
+
transactionFee: receipt.transactionFee?.toString()
|
|
108
|
+
};
|
|
109
|
+
}
|
|
73
110
|
} else {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
111
|
+
if (!json) {
|
|
112
|
+
log(`Contract deployed at ${address.toString()}`);
|
|
113
|
+
log(`Contract partial address ${partialAddress.toString()}`);
|
|
114
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
115
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
116
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
117
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
118
|
+
} else {
|
|
119
|
+
out.contract = {
|
|
120
|
+
address: address.toString(),
|
|
121
|
+
partialAddress: partialAddress.toString(),
|
|
122
|
+
initializationHash: instance.initializationHash.toString(),
|
|
123
|
+
salt: salt.toString()
|
|
124
|
+
};
|
|
125
|
+
}
|
|
80
126
|
}
|
|
81
127
|
}
|
|
82
|
-
|
|
128
|
+
if (json) {
|
|
129
|
+
log(prettyPrintJSON(out));
|
|
130
|
+
}
|
|
131
|
+
return await deployInteraction.getAddress();
|
|
83
132
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { type AztecNode } from '@aztec/aztec.js/node';
|
|
2
3
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=deploy_account.d.ts.map
|
|
4
|
+
import type { TxStatus } from '@aztec/stdlib/tx';
|
|
5
|
+
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
6
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
7
|
+
export declare function deployAccount(wallet: CLIWallet, aztecNode: AztecNode, address: AztecAddress, wait: boolean, deployer: AztecAddress | undefined, registerClass: boolean, publicDeploy: boolean, skipInitialization: boolean, feeOpts: CLIFeeArgs, waitForStatus: TxStatus, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X2FjY291bnQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbWRzL2RlcGxveV9hY2NvdW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV6RCxPQUFPLEVBQUUsS0FBSyxTQUFTLEVBQWEsTUFBTSxzQkFBc0IsQ0FBQztBQUdqRSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQXFCLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR3BFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRTNELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXBELHdCQUFzQixhQUFhLENBQ2pDLE1BQU0sRUFBRSxTQUFTLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLE9BQU8sRUFBRSxZQUFZLEVBQ3JCLElBQUksRUFBRSxPQUFPLEVBQ2IsUUFBUSxFQUFFLFlBQVksR0FBRyxTQUFTLEVBQ2xDLGFBQWEsRUFBRSxPQUFPLEVBQ3RCLFlBQVksRUFBRSxPQUFPLEVBQ3JCLGtCQUFrQixFQUFFLE9BQU8sRUFDM0IsT0FBTyxFQUFFLFVBQVUsRUFDbkIsYUFBYSxFQUFFLFFBQVEsRUFDdkIsSUFBSSxFQUFFLE9BQU8sRUFDYixPQUFPLEVBQUUsT0FBTyxFQUNoQixXQUFXLEVBQUUsTUFBTSxFQUNuQixHQUFHLEVBQUUsS0FBSyxpQkErR1gifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAGjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAqB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGpE,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,aAAa,EAAE,QAAQ,EACvB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBA+GX"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
1
4
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
2
|
-
import {
|
|
3
|
-
|
|
5
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
6
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
+
export async function deployAccount(wallet, aztecNode, address, wait, deployer, registerClass, publicDeploy, skipInitialization, feeOpts, waitForStatus, json, verbose, debugLogger, log) {
|
|
4
8
|
const out = {};
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
7
|
-
const
|
|
8
|
-
const secretKey = wallet.getSecretKey();
|
|
9
|
+
const account = await wallet.createOrRetrieveAccount(address);
|
|
10
|
+
const { partialAddress, publicKeys } = await account.getCompleteAddress();
|
|
11
|
+
const { initializationHash, salt } = account.getInstance();
|
|
9
12
|
if (json) {
|
|
10
13
|
out.address = address;
|
|
11
14
|
out.partialAddress = partialAddress;
|
|
@@ -16,65 +19,96 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
|
|
|
16
19
|
log(`\nNew account:\n`);
|
|
17
20
|
log(`Address: ${address.toString()}`);
|
|
18
21
|
log(`Public key: ${publicKeys.toString()}`);
|
|
19
|
-
if (secretKey) {
|
|
20
|
-
log(`Secret key: ${secretKey.toString()}`);
|
|
21
|
-
}
|
|
22
22
|
log(`Partial address: ${partialAddress.toString()}`);
|
|
23
23
|
log(`Salt: ${salt.toString()}`);
|
|
24
24
|
log(`Init hash: ${initializationHash.toString()}`);
|
|
25
|
-
log(`Deployer: ${deployer.toString()}`);
|
|
26
25
|
}
|
|
27
|
-
let
|
|
26
|
+
let txHash;
|
|
28
27
|
let txReceipt;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
29
|
+
const delegatedDeployment = deployer && !account.address.equals(deployer);
|
|
30
|
+
const from = delegatedDeployment ? deployer : NO_FROM;
|
|
31
|
+
const deployAccountOpts = {
|
|
32
|
+
skipClassPublication: !registerClass,
|
|
33
|
+
skipInstancePublication: !publicDeploy,
|
|
34
|
+
skipInitialization,
|
|
35
|
+
from,
|
|
36
|
+
fee: {
|
|
37
|
+
paymentMethod,
|
|
38
|
+
gasSettings
|
|
39
|
+
}
|
|
32
40
|
};
|
|
41
|
+
const localStart = performance.now();
|
|
42
|
+
const deployMethod = await account.getDeployMethod();
|
|
43
|
+
const sim = await deployMethod.simulate({
|
|
44
|
+
...deployAccountOpts,
|
|
45
|
+
fee: {
|
|
46
|
+
...deployAccountOpts.fee,
|
|
47
|
+
estimateGas: true
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// estimateGas: true guarantees these fields are present
|
|
51
|
+
const estimatedGas = sim.estimatedGas;
|
|
52
|
+
const stats = sim.stats;
|
|
33
53
|
if (feeOpts.estimateOnly) {
|
|
34
|
-
const gas = await (await account.getDeployMethod(deployOpts.deployWallet)).estimateGas(deployOpts);
|
|
35
54
|
if (json) {
|
|
36
55
|
out.fee = {
|
|
37
56
|
gasLimits: {
|
|
38
|
-
da:
|
|
39
|
-
l2:
|
|
57
|
+
da: estimatedGas.gasLimits.daGas,
|
|
58
|
+
l2: estimatedGas.gasLimits.l2Gas
|
|
40
59
|
},
|
|
41
60
|
teardownGasLimits: {
|
|
42
|
-
da:
|
|
43
|
-
l2:
|
|
61
|
+
da: estimatedGas.teardownGasLimits.daGas,
|
|
62
|
+
l2: estimatedGas.teardownGasLimits
|
|
44
63
|
}
|
|
45
64
|
};
|
|
46
|
-
} else {
|
|
47
|
-
printGasEstimates(feeOpts, gas, log);
|
|
48
65
|
}
|
|
49
66
|
} else {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
if (verbose) {
|
|
68
|
+
printProfileResult(stats, log);
|
|
69
|
+
}
|
|
70
|
+
if (!json) {
|
|
71
|
+
log(`\nWaiting for account contract deployment...`);
|
|
72
|
+
}
|
|
73
|
+
const sendOpts = {
|
|
74
|
+
...deployAccountOpts,
|
|
75
|
+
fee: deployAccountOpts.fee ? {
|
|
76
|
+
...deployAccountOpts.fee,
|
|
77
|
+
gasSettings: estimatedGas
|
|
78
|
+
} : undefined
|
|
79
|
+
};
|
|
80
|
+
({ txHash } = await deployMethod.send({
|
|
81
|
+
...sendOpts,
|
|
82
|
+
wait: NO_WAIT
|
|
83
|
+
}));
|
|
84
|
+
const localTimeMs = performance.now() - localStart;
|
|
54
85
|
if (wait) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
86
|
+
const nodeStart = performance.now();
|
|
87
|
+
txReceipt = await waitForTx(aztecNode, txHash, {
|
|
88
|
+
timeout: DEFAULT_TX_TIMEOUT_S,
|
|
89
|
+
waitForStatus
|
|
90
|
+
});
|
|
91
|
+
const nodeTimeMs = performance.now() - nodeStart;
|
|
59
92
|
out.txReceipt = {
|
|
60
93
|
status: txReceipt.status,
|
|
61
94
|
transactionFee: txReceipt.transactionFee
|
|
62
95
|
};
|
|
96
|
+
if (!json) {
|
|
97
|
+
log(` Local processing time: ${(localTimeMs / 1000).toFixed(1)}s`);
|
|
98
|
+
log(` Node inclusion time: ${(nodeTimeMs / 1000).toFixed(1)}s`);
|
|
99
|
+
}
|
|
63
100
|
}
|
|
101
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
102
|
+
out.txHash = txHash;
|
|
64
103
|
}
|
|
65
104
|
if (json) {
|
|
66
105
|
log(prettyPrintJSON(out));
|
|
67
106
|
} else {
|
|
68
|
-
if (
|
|
69
|
-
log(`Deploy tx hash: ${
|
|
107
|
+
if (txHash) {
|
|
108
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
70
109
|
}
|
|
71
110
|
if (txReceipt) {
|
|
72
111
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
|
73
112
|
}
|
|
74
113
|
}
|
|
75
|
-
return {
|
|
76
|
-
address,
|
|
77
|
-
secretKey,
|
|
78
|
-
salt
|
|
79
|
-
};
|
|
80
114
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
export declare function getFeeJuiceBalanceCmd(node: AztecNode, address: AztecAddress, json: boolean, exact: boolean, log: LogFn): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2ZlZV9qdWljZV9iYWxhbmNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY21kcy9nZXRfZmVlX2p1aWNlX2JhbGFuY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDOUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFHdEQsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFtQm5ELHdCQUFzQixxQkFBcUIsQ0FDekMsSUFBSSxFQUFFLFNBQVMsRUFDZixPQUFPLEVBQUUsWUFBWSxFQUNyQixJQUFJLEVBQUUsT0FBTyxFQUNiLEtBQUssRUFBRSxPQUFPLEVBQ2QsR0FBRyxFQUFFLEtBQUssaUJBUVgifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_fee_juice_balance.d.ts","sourceRoot":"","sources":["../../src/cmds/get_fee_juice_balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAmBnD,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,KAAK,iBAQX"}
|