@aztec/cli-wallet 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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 +1 -1
- package/dest/bin/index.js +38 -23
- 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 +6 -7
- 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 +9 -7
- 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 +144 -6
- package/dest/cmds/create_account.d.ts +7 -6
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +36 -48
- 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 +7 -4
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +57 -46
- package/dest/cmds/deploy_account.d.ts +6 -8
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +36 -51
- 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 +73 -112
- package/dest/cmds/profile.d.ts +7 -4
- package/dest/cmds/profile.d.ts.map +1 -1
- package/dest/cmds/profile.js +9 -4
- 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 +5 -6
- 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 +8 -9
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +27 -24
- package/dest/cmds/simulate.d.ts +7 -4
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +9 -4
- package/dest/storage/wallet_db.d.ts +6 -16
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +2 -23
- package/dest/utils/authorizations.d.ts +3 -2
- package/dest/utils/authorizations.d.ts.map +1 -1
- package/dest/utils/authorizations.js +1 -1
- 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/ecdsa.d.ts +1 -1
- package/dest/utils/options/fees.d.ts +22 -28
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +66 -133
- package/dest/utils/options/index.d.ts +1 -1
- package/dest/utils/options/options.d.ts +4 -3
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +1 -1
- package/dest/utils/profiling.d.ts +1 -1
- package/dest/utils/wallet.d.ts +36 -0
- package/dest/utils/wallet.d.ts.map +1 -0
- package/dest/utils/wallet.js +195 -0
- package/package.json +17 -14
- package/src/bin/index.ts +38 -31
- package/src/cmds/authorize_action.ts +14 -6
- package/src/cmds/bridge_fee_juice.ts +15 -11
- package/src/cmds/check_tx.ts +181 -5
- package/src/cmds/create_account.ts +43 -53
- package/src/cmds/create_authwit.ts +9 -5
- package/src/cmds/deploy.ts +58 -56
- package/src/cmds/deploy_account.ts +43 -51
- package/src/cmds/import_test_accounts.ts +7 -11
- package/src/cmds/index.ts +120 -206
- package/src/cmds/profile.ts +14 -6
- package/src/cmds/register_contract.ts +9 -11
- package/src/cmds/register_sender.ts +3 -2
- package/src/cmds/send.ts +22 -32
- package/src/cmds/simulate.ts +14 -6
- package/src/storage/wallet_db.ts +3 -31
- package/src/utils/authorizations.ts +3 -1
- package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
- package/src/utils/options/fees.ts +88 -178
- package/src/utils/options/options.ts +3 -2
- package/src/utils/wallet.ts +266 -0
- 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 -43
- package/dest/utils/accounts.d.ts +0 -9
- package/dest/utils/accounts.d.ts.map +0 -1
- package/dest/utils/accounts.js +0 -61
- package/dest/utils/pxe_wrapper.d.ts +0 -12
- package/dest/utils/pxe_wrapper.d.ts.map +0 -1
- package/dest/utils/pxe_wrapper.js +0 -26
- package/src/cmds/cancel_tx.ts +0 -66
- package/src/utils/accounts.ts +0 -77
- package/src/utils/pxe_wrapper.ts +0 -32
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
|
+
import type { DeployAccountOptions } from '@aztec/aztec.js/wallet';
|
|
2
4
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
3
5
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
6
|
|
|
5
|
-
import {
|
|
7
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
8
|
+
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
6
9
|
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
-
import {
|
|
10
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
8
11
|
|
|
9
12
|
export async function deployAccount(
|
|
10
|
-
|
|
13
|
+
wallet: CLIWallet,
|
|
14
|
+
aztecNode: AztecNode,
|
|
15
|
+
address: AztecAddress,
|
|
11
16
|
wait: boolean,
|
|
17
|
+
deployer: AztecAddress | undefined,
|
|
12
18
|
registerClass: boolean,
|
|
13
19
|
publicDeploy: boolean,
|
|
14
|
-
|
|
20
|
+
skipInitialization: boolean,
|
|
21
|
+
feeOpts: CLIFeeArgs,
|
|
15
22
|
json: boolean,
|
|
16
23
|
verbose: boolean,
|
|
17
24
|
debugLogger: Logger,
|
|
18
25
|
log: LogFn,
|
|
19
26
|
) {
|
|
20
27
|
const out: Record<string, any> = {};
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
28
|
+
|
|
29
|
+
const account = await wallet.createOrRetrieveAccount(address);
|
|
30
|
+
const { partialAddress, publicKeys } = await account.getCompleteAddress();
|
|
31
|
+
const { initializationHash, salt } = account.getInstance();
|
|
25
32
|
|
|
26
33
|
if (json) {
|
|
27
34
|
out.address = address;
|
|
@@ -33,71 +40,58 @@ export async function deployAccount(
|
|
|
33
40
|
log(`\nNew account:\n`);
|
|
34
41
|
log(`Address: ${address.toString()}`);
|
|
35
42
|
log(`Public key: ${publicKeys.toString()}`);
|
|
36
|
-
if (secretKey) {
|
|
37
|
-
log(`Secret key: ${secretKey.toString()}`);
|
|
38
|
-
}
|
|
39
43
|
log(`Partial address: ${partialAddress.toString()}`);
|
|
40
44
|
log(`Salt: ${salt.toString()}`);
|
|
41
45
|
log(`Init hash: ${initializationHash.toString()}`);
|
|
42
|
-
log(`Deployer: ${deployer.toString()}`);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
let tx;
|
|
46
49
|
let txReceipt;
|
|
50
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
47
51
|
|
|
48
|
-
const
|
|
49
|
-
|
|
52
|
+
const delegatedDeployment = deployer && !account.address.equals(deployer);
|
|
53
|
+
const from = delegatedDeployment ? deployer : AztecAddress.ZERO;
|
|
54
|
+
|
|
55
|
+
const deployAccountOpts: DeployAccountOptions = {
|
|
50
56
|
skipClassPublication: !registerClass,
|
|
51
|
-
|
|
57
|
+
skipInstancePublication: !publicDeploy,
|
|
58
|
+
skipInitialization,
|
|
59
|
+
from,
|
|
60
|
+
fee: { paymentMethod, gasSettings },
|
|
52
61
|
};
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* entrypoint. For reference, see aztec.js/src/account_manager.ts:deploy()
|
|
60
|
-
* Also, salt and universalDeploy have to be explicitly provided
|
|
61
|
-
*/
|
|
62
|
-
deployOpts.fee =
|
|
63
|
-
!deployOpts?.deployWallet && deployOpts?.fee
|
|
64
|
-
? { ...deployOpts.fee, paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod) }
|
|
65
|
-
: deployOpts?.fee;
|
|
66
|
-
|
|
67
|
-
const deployMethod = await account.getDeployMethod(deployOpts.deployWallet);
|
|
63
|
+
const deployMethod = await account.getDeployMethod();
|
|
64
|
+
const { estimatedGas, stats } = await deployMethod.simulate({
|
|
65
|
+
...deployAccountOpts,
|
|
66
|
+
fee: { ...deployAccountOpts.fee, estimateGas: true },
|
|
67
|
+
});
|
|
68
68
|
|
|
69
69
|
if (feeOpts.estimateOnly) {
|
|
70
|
-
const gas = await deployMethod.estimateGas({
|
|
71
|
-
...deployOpts,
|
|
72
|
-
from: AztecAddress.ZERO,
|
|
73
|
-
universalDeploy: true,
|
|
74
|
-
contractAddressSalt: salt,
|
|
75
|
-
});
|
|
76
70
|
if (json) {
|
|
77
71
|
out.fee = {
|
|
78
72
|
gasLimits: {
|
|
79
|
-
da:
|
|
80
|
-
l2:
|
|
73
|
+
da: estimatedGas.gasLimits.daGas,
|
|
74
|
+
l2: estimatedGas.gasLimits.l2Gas,
|
|
81
75
|
},
|
|
82
76
|
teardownGasLimits: {
|
|
83
|
-
da:
|
|
84
|
-
l2:
|
|
77
|
+
da: estimatedGas.teardownGasLimits.daGas,
|
|
78
|
+
l2: estimatedGas.teardownGasLimits,
|
|
85
79
|
},
|
|
86
80
|
};
|
|
87
|
-
} else {
|
|
88
|
-
printGasEstimates(feeOpts, gas, log);
|
|
89
81
|
}
|
|
90
82
|
} else {
|
|
91
|
-
|
|
92
|
-
...
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
tx = deployMethod.send({
|
|
84
|
+
...deployAccountOpts,
|
|
85
|
+
fee: deployAccountOpts.fee
|
|
86
|
+
? {
|
|
87
|
+
...deployAccountOpts.fee,
|
|
88
|
+
gasSettings: estimatedGas,
|
|
89
|
+
}
|
|
90
|
+
: undefined,
|
|
96
91
|
});
|
|
97
92
|
if (verbose) {
|
|
98
|
-
printProfileResult(
|
|
93
|
+
printProfileResult(stats, log);
|
|
99
94
|
}
|
|
100
|
-
tx = provenTx.send();
|
|
101
95
|
|
|
102
96
|
const txHash = await tx.getTxHash();
|
|
103
97
|
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
@@ -124,6 +118,4 @@ export async function deployAccount(
|
|
|
124
118
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
|
125
119
|
}
|
|
126
120
|
}
|
|
127
|
-
|
|
128
|
-
return { address, secretKey, salt };
|
|
129
121
|
}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Fr, type PXE } from '@aztec/aztec.js';
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
3
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
5
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
6
5
|
|
|
7
6
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
7
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
8
8
|
|
|
9
|
-
export async function importTestAccounts(
|
|
10
|
-
const testAccounts = await
|
|
11
|
-
const accounts = await Promise.all(
|
|
12
|
-
testAccounts.map(({ secret, signingKey, salt }) => getSchnorrAccount(client, secret, signingKey, salt)),
|
|
13
|
-
);
|
|
9
|
+
export async function importTestAccounts(wallet: CLIWallet, db: WalletDB, json: boolean, log: LogFn) {
|
|
10
|
+
const testAccounts = await getInitialTestAccountsData();
|
|
14
11
|
|
|
15
12
|
const out: Record<string, any> = {};
|
|
16
13
|
await Promise.all(
|
|
17
|
-
|
|
14
|
+
testAccounts.map(async (account, i) => {
|
|
18
15
|
const alias = `test${i}`;
|
|
19
16
|
const secret = testAccounts[i].secret;
|
|
20
17
|
const salt = new Fr(account.salt);
|
|
21
|
-
const address = account.
|
|
22
|
-
await account.register();
|
|
18
|
+
const address = account.address;
|
|
23
19
|
await db.storeAccount(address, { type: 'schnorr', secretKey: secret, salt, alias, publicKey: undefined }, log);
|
|
24
20
|
|
|
25
21
|
if (json) {
|