@aztec/cli-wallet 0.0.0-test.1 → 0.0.1-commit.b655e406
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.js +48 -26
- package/dest/cmds/authorize_action.d.ts +3 -2
- package/dest/cmds/authorize_action.d.ts.map +1 -1
- package/dest/cmds/authorize_action.js +8 -4
- package/dest/cmds/bridge_fee_juice.d.ts +2 -2
- package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
- package/dest/cmds/bridge_fee_juice.js +8 -7
- package/dest/cmds/check_tx.d.ts +4 -2
- package/dest/cmds/check_tx.d.ts.map +1 -1
- package/dest/cmds/check_tx.js +145 -6
- package/dest/cmds/create_account.d.ts +6 -5
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +46 -27
- package/dest/cmds/create_authwit.d.ts +3 -2
- package/dest/cmds/create_authwit.d.ts.map +1 -1
- package/dest/cmds/create_authwit.js +5 -5
- package/dest/cmds/deploy.d.ts +6 -3
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +71 -54
- package/dest/cmds/deploy_account.d.ts +5 -7
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +46 -29
- package/dest/cmds/import_test_accounts.d.ts +2 -2
- 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 +2 -2
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +83 -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 +6 -2
- 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 +3 -2
- package/dest/cmds/register_sender.d.ts.map +1 -1
- package/dest/cmds/send.d.ts +7 -8
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +31 -20
- package/dest/cmds/simulate.d.ts +6 -2
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +25 -19
- package/dest/storage/wallet_db.d.ts +4 -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 +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/ecdsa.d.ts +0 -2
- package/dest/utils/ecdsa.d.ts.map +1 -1
- package/dest/utils/options/fees.d.ts +20 -27
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +85 -144
- package/dest/utils/options/options.d.ts +8 -4
- 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 +60 -0
- package/dest/utils/wallet.d.ts +35 -0
- package/dest/utils/wallet.d.ts.map +1 -0
- package/dest/utils/wallet.js +193 -0
- package/package.json +24 -20
- package/src/bin/index.ts +56 -32
- package/src/cmds/authorize_action.ts +15 -4
- package/src/cmds/bridge_fee_juice.ts +14 -11
- package/src/cmds/check_tx.ts +182 -5
- package/src/cmds/create_account.ts +55 -32
- package/src/cmds/create_authwit.ts +8 -4
- package/src/cmds/deploy.ts +79 -62
- package/src/cmds/deploy_account.ts +57 -28
- package/src/cmds/import_test_accounts.ts +7 -11
- package/src/cmds/index.ts +256 -220
- 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 +31 -17
- package/src/cmds/simulate.ts +39 -23
- package/src/storage/wallet_db.ts +3 -31
- package/src/utils/authorizations.ts +51 -0
- package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
- package/src/utils/options/fees.ts +134 -206
- package/src/utils/options/options.ts +41 -19
- package/src/utils/profiling.ts +158 -0
- package/src/utils/wallet.ts +264 -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
package/dest/cmds/deploy.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { ContractDeployer } from '@aztec/aztec.js/deployment';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { encodeArgs, getContractArtifact, prettyPrintJSON } from '@aztec/cli/utils';
|
|
5
|
+
import { getAllFunctionAbis, getInitializer } from '@aztec/stdlib/abi';
|
|
4
6
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
8
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
9
|
+
export async function deploy(wallet, node, deployer, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipInstancePublication, skipClassPublication, skipInitialization, wait, feeOpts, verbose, timeout = DEFAULT_TX_TIMEOUT_S, debugLogger, log) {
|
|
10
|
+
const out = {};
|
|
7
11
|
salt ??= Fr.random();
|
|
8
12
|
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);
|
|
13
|
+
const hasInitializer = getAllFunctionAbis(contractArtifact).some((fn)=>fn.isInitializer);
|
|
14
|
+
const constructorArtifact = hasInitializer ? getInitializer(contractArtifact, initializer) : undefined;
|
|
15
|
+
// TODO(#12081): Add contractArtifact.noirVersion and check here (via Noir.lock)?
|
|
16
|
+
const contractDeployer = new ContractDeployer(contractArtifact, wallet, publicKeys ?? PublicKeys.default(), initializer);
|
|
16
17
|
let args = [];
|
|
17
18
|
if (rawArgs.length > 0) {
|
|
18
19
|
if (!constructorArtifact) {
|
|
@@ -22,62 +23,78 @@ export async function deploy(client, wallet, artifactPath, json, publicKeys, raw
|
|
|
22
23
|
args = encodeArgs(rawArgs, constructorArtifact.parameters);
|
|
23
24
|
debugLogger.debug(`Encoded arguments: ${args.join(', ')}`);
|
|
24
25
|
}
|
|
25
|
-
const
|
|
26
|
+
const deploy1 = contractDeployer.deploy(...args);
|
|
27
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, deployer);
|
|
26
28
|
const deployOpts = {
|
|
27
|
-
|
|
29
|
+
fee: {
|
|
30
|
+
gasSettings,
|
|
31
|
+
paymentMethod
|
|
32
|
+
},
|
|
33
|
+
from: deployer ?? AztecAddress.ZERO,
|
|
28
34
|
contractAddressSalt: salt,
|
|
29
|
-
universalDeploy,
|
|
30
|
-
|
|
35
|
+
universalDeploy: !deployer,
|
|
36
|
+
skipClassPublication,
|
|
31
37
|
skipInitialization,
|
|
32
|
-
|
|
38
|
+
skipInstancePublication
|
|
33
39
|
};
|
|
40
|
+
const { estimatedGas, stats } = await deploy1.simulate({
|
|
41
|
+
...deployOpts,
|
|
42
|
+
fee: {
|
|
43
|
+
...deployOpts.fee,
|
|
44
|
+
estimateGas: true
|
|
45
|
+
}
|
|
46
|
+
});
|
|
34
47
|
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
48
|
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}`);
|
|
49
|
+
out.fee = {
|
|
50
|
+
gasLimits: {
|
|
51
|
+
da: estimatedGas.gasLimits.daGas,
|
|
52
|
+
l2: estimatedGas.gasLimits.l2Gas
|
|
53
|
+
},
|
|
54
|
+
teardownGasLimits: {
|
|
55
|
+
da: estimatedGas.teardownGasLimits.daGas,
|
|
56
|
+
l2: estimatedGas.teardownGasLimits
|
|
57
|
+
}
|
|
58
|
+
};
|
|
60
59
|
}
|
|
61
60
|
} else {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
61
|
+
const tx = deploy1.send(deployOpts);
|
|
62
|
+
if (verbose) {
|
|
63
|
+
printProfileResult(stats, log);
|
|
64
|
+
}
|
|
65
|
+
const txHash = await tx.getTxHash();
|
|
66
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
67
|
+
out.hash = txHash;
|
|
68
|
+
const { address, partialAddress } = deploy1;
|
|
69
|
+
const instance = await deploy1.getInstance();
|
|
70
|
+
if (!json) {
|
|
74
71
|
log(`Contract deployed at ${address?.toString()}`);
|
|
75
72
|
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
76
73
|
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
77
74
|
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
78
75
|
log(`Deployment salt: ${salt.toString()}`);
|
|
79
76
|
log(`Deployer: ${instance.deployer.toString()}`);
|
|
77
|
+
} else {
|
|
78
|
+
out.contract = {
|
|
79
|
+
address: address?.toString(),
|
|
80
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
81
|
+
initializationHash: instance.initializationHash.toString(),
|
|
82
|
+
salt: salt.toString()
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (wait) {
|
|
86
|
+
const deployed = await tx.wait({
|
|
87
|
+
timeout
|
|
88
|
+
});
|
|
89
|
+
if (!json) {
|
|
90
|
+
log(`Transaction fee: ${deployed.transactionFee?.toString()}`);
|
|
91
|
+
} else {
|
|
92
|
+
out.contract.transactionFee = deployed.transactionFee?.toString();
|
|
93
|
+
}
|
|
80
94
|
}
|
|
81
95
|
}
|
|
82
|
-
|
|
96
|
+
if (json) {
|
|
97
|
+
log(prettyPrintJSON(out));
|
|
98
|
+
}
|
|
99
|
+
return deploy1.address;
|
|
83
100
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
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
|
-
secretKey: import("@aztec/aztec.js").Fr;
|
|
7
|
-
salt: import("@aztec/aztec.js").Fr;
|
|
8
|
-
}>;
|
|
4
|
+
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
5
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
6
|
+
export declare function deployAccount(wallet: CLIWallet, aztecNode: AztecNode, address: AztecAddress, wait: boolean, deployer: AztecAddress | undefined, registerClass: boolean, publicDeploy: boolean, skipInitialization: boolean, feeOpts: CLIFeeArgs, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<void>;
|
|
9
7
|
//# sourceMappingURL=deploy_account.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,kBAAkB,EAAE,OAAO,EAC3B,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAgGX"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
1
2
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
2
|
-
import {
|
|
3
|
-
|
|
3
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
4
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
5
|
+
export async function deployAccount(wallet, aztecNode, address, wait, deployer, registerClass, publicDeploy, skipInitialization, feeOpts, json, verbose, debugLogger, log) {
|
|
4
6
|
const out = {};
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
7
|
-
const
|
|
8
|
-
const secretKey = wallet.getSecretKey();
|
|
7
|
+
const account = await wallet.createOrRetrieveAccount(address);
|
|
8
|
+
const { partialAddress, publicKeys } = await account.getCompleteAddress();
|
|
9
|
+
const { initializationHash, salt } = account.getInstance();
|
|
9
10
|
if (json) {
|
|
10
11
|
out.address = address;
|
|
11
12
|
out.partialAddress = partialAddress;
|
|
@@ -16,46 +17,67 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
|
|
|
16
17
|
log(`\nNew account:\n`);
|
|
17
18
|
log(`Address: ${address.toString()}`);
|
|
18
19
|
log(`Public key: ${publicKeys.toString()}`);
|
|
19
|
-
if (secretKey) {
|
|
20
|
-
log(`Secret key: ${secretKey.toString()}`);
|
|
21
|
-
}
|
|
22
20
|
log(`Partial address: ${partialAddress.toString()}`);
|
|
23
21
|
log(`Salt: ${salt.toString()}`);
|
|
24
22
|
log(`Init hash: ${initializationHash.toString()}`);
|
|
25
|
-
log(`Deployer: ${deployer.toString()}`);
|
|
26
23
|
}
|
|
27
24
|
let tx;
|
|
28
25
|
let txReceipt;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
27
|
+
const delegatedDeployment = deployer && !account.address.equals(deployer);
|
|
28
|
+
const from = delegatedDeployment ? deployer : AztecAddress.ZERO;
|
|
29
|
+
const deployAccountOpts = {
|
|
30
|
+
skipClassPublication: !registerClass,
|
|
31
|
+
skipInstancePublication: !publicDeploy,
|
|
32
|
+
skipInitialization,
|
|
33
|
+
from,
|
|
34
|
+
fee: {
|
|
35
|
+
paymentMethod,
|
|
36
|
+
gasSettings
|
|
37
|
+
}
|
|
32
38
|
};
|
|
39
|
+
const deployMethod = await account.getDeployMethod();
|
|
40
|
+
const { estimatedGas, stats } = await deployMethod.simulate({
|
|
41
|
+
...deployAccountOpts,
|
|
42
|
+
fee: {
|
|
43
|
+
...deployAccountOpts.fee,
|
|
44
|
+
estimateGas: true
|
|
45
|
+
}
|
|
46
|
+
});
|
|
33
47
|
if (feeOpts.estimateOnly) {
|
|
34
|
-
const gas = await (await account.getDeployMethod(deployOpts.deployWallet)).estimateGas(deployOpts);
|
|
35
48
|
if (json) {
|
|
36
49
|
out.fee = {
|
|
37
50
|
gasLimits: {
|
|
38
|
-
da:
|
|
39
|
-
l2:
|
|
51
|
+
da: estimatedGas.gasLimits.daGas,
|
|
52
|
+
l2: estimatedGas.gasLimits.l2Gas
|
|
40
53
|
},
|
|
41
54
|
teardownGasLimits: {
|
|
42
|
-
da:
|
|
43
|
-
l2:
|
|
55
|
+
da: estimatedGas.teardownGasLimits.daGas,
|
|
56
|
+
l2: estimatedGas.teardownGasLimits
|
|
44
57
|
}
|
|
45
58
|
};
|
|
46
|
-
} else {
|
|
47
|
-
printGasEstimates(feeOpts, gas, log);
|
|
48
59
|
}
|
|
49
60
|
} else {
|
|
50
|
-
tx =
|
|
61
|
+
tx = deployMethod.send({
|
|
62
|
+
...deployAccountOpts,
|
|
63
|
+
fee: deployAccountOpts.fee ? {
|
|
64
|
+
...deployAccountOpts.fee,
|
|
65
|
+
gasSettings: estimatedGas
|
|
66
|
+
} : undefined
|
|
67
|
+
});
|
|
68
|
+
if (verbose) {
|
|
69
|
+
printProfileResult(stats, log);
|
|
70
|
+
}
|
|
51
71
|
const txHash = await tx.getTxHash();
|
|
52
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash}`);
|
|
72
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
53
73
|
out.txHash = txHash;
|
|
54
74
|
if (wait) {
|
|
55
75
|
if (!json) {
|
|
56
76
|
log(`\nWaiting for account contract deployment...`);
|
|
57
77
|
}
|
|
58
|
-
txReceipt = await tx.wait(
|
|
78
|
+
txReceipt = await tx.wait({
|
|
79
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
80
|
+
});
|
|
59
81
|
out.txReceipt = {
|
|
60
82
|
status: txReceipt.status,
|
|
61
83
|
transactionFee: txReceipt.transactionFee
|
|
@@ -66,15 +88,10 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
|
|
|
66
88
|
log(prettyPrintJSON(out));
|
|
67
89
|
} else {
|
|
68
90
|
if (tx) {
|
|
69
|
-
log(`Deploy tx hash: ${await tx.getTxHash()}`);
|
|
91
|
+
log(`Deploy tx hash: ${(await tx.getTxHash()).toString()}`);
|
|
70
92
|
}
|
|
71
93
|
if (txReceipt) {
|
|
72
94
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
|
73
95
|
}
|
|
74
96
|
}
|
|
75
|
-
return {
|
|
76
|
-
address,
|
|
77
|
-
secretKey,
|
|
78
|
-
salt
|
|
79
|
-
};
|
|
80
97
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type PXE } from '@aztec/aztec.js';
|
|
2
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
2
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
4
|
-
|
|
3
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
4
|
+
export declare function importTestAccounts(wallet: CLIWallet, db: WalletDB, json: boolean, log: LogFn): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=import_test_accounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import_test_accounts.d.ts","sourceRoot":"","sources":["../../src/cmds/import_test_accounts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import_test_accounts.d.ts","sourceRoot":"","sources":["../../src/cmds/import_test_accounts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,iBAkClG"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Fr } 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
|
-
export async function importTestAccounts(
|
|
6
|
-
const testAccounts = await
|
|
7
|
-
const accounts = await Promise.all(testAccounts.map(({ secret, signingKey, salt })=>getSchnorrAccount(client, secret, signingKey, salt)));
|
|
4
|
+
export async function importTestAccounts(wallet, db, json, log) {
|
|
5
|
+
const testAccounts = await getInitialTestAccountsData();
|
|
8
6
|
const out = {};
|
|
9
|
-
await Promise.all(
|
|
7
|
+
await Promise.all(testAccounts.map(async (account, i)=>{
|
|
10
8
|
const alias = `test${i}`;
|
|
11
9
|
const secret = testAccounts[i].secret;
|
|
12
10
|
const salt = new Fr(account.salt);
|
|
13
|
-
const address = account.
|
|
14
|
-
await account.register();
|
|
11
|
+
const address = account.address;
|
|
15
12
|
await db.storeAccount(address, {
|
|
16
13
|
type: 'schnorr',
|
|
17
14
|
secretKey: secret,
|
package/dest/cmds/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
2
|
import { type Command } from 'commander';
|
|
3
3
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
4
|
-
import type {
|
|
5
|
-
export declare function injectCommands(program: Command, log: LogFn, debugLogger: Logger,
|
|
4
|
+
import type { CliWalletAndNodeWrapper } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
5
|
+
export declare function injectCommands(program: Command, log: LogFn, debugLogger: Logger, walletAndNodeWrapper: CliWalletAndNodeWrapper, db: WalletDB): Command;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dest/cmds/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cmds/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAwBvF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,uBAAuB,EAC7C,EAAE,EAAE,QAAQ,WAonBb"}
|