@aztec/cli-wallet 0.86.0 → 0.87.0
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/dest/bin/index.js +7 -9
- package/dest/cmds/create_account.d.ts +1 -1
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +25 -15
- package/dest/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +7 -2
- package/dest/cmds/deploy_account.d.ts +1 -1
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +26 -17
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +34 -32
- package/dest/cmds/profile.d.ts +2 -1
- package/dest/cmds/profile.d.ts.map +1 -1
- package/dest/cmds/profile.js +7 -17
- package/dest/cmds/register_contract.d.ts +1 -1
- package/dest/cmds/register_contract.d.ts.map +1 -1
- package/dest/cmds/send.d.ts +1 -1
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +7 -2
- package/dest/cmds/simulate.d.ts +2 -1
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +10 -4
- package/dest/storage/wallet_db.d.ts +1 -3
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +1 -1
- package/dest/utils/accounts.d.ts +1 -1
- package/dest/utils/accounts.d.ts.map +1 -1
- package/dest/utils/ecdsa.d.ts +0 -2
- package/dest/utils/ecdsa.d.ts.map +1 -1
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +1 -1
- package/dest/utils/options/options.d.ts +1 -0
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +6 -3
- package/dest/utils/profiling.d.ts +5 -0
- package/dest/utils/profiling.d.ts.map +1 -0
- package/dest/utils/profiling.js +32 -0
- package/dest/utils/pxe_wrapper.d.ts +3 -2
- package/dest/utils/pxe_wrapper.d.ts.map +1 -1
- package/dest/utils/pxe_wrapper.js +7 -3
- package/package.json +15 -15
- package/src/bin/index.ts +7 -9
- package/src/cmds/create_account.ts +24 -14
- package/src/cmds/deploy.ts +8 -1
- package/src/cmds/deploy_account.ts +26 -16
- package/src/cmds/index.ts +98 -69
- package/src/cmds/profile.ts +10 -25
- package/src/cmds/register_contract.ts +1 -1
- package/src/cmds/send.ts +8 -1
- package/src/cmds/simulate.ts +14 -2
- package/src/storage/wallet_db.ts +1 -1
- package/src/utils/accounts.ts +1 -1
- package/src/utils/options/fees.ts +25 -16
- package/src/utils/options/options.ts +10 -3
- package/src/utils/profiling.ts +87 -0
- package/src/utils/pxe_wrapper.ts +7 -3
package/dest/bin/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr,
|
|
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';
|
|
@@ -33,7 +33,7 @@ function injectInternalCommands(program, log, db) {
|
|
|
33
33
|
const options = command.optsWithGlobals();
|
|
34
34
|
const { alias } = options;
|
|
35
35
|
const value = Fr.random();
|
|
36
|
-
const hash = computeSecretHash(value);
|
|
36
|
+
const hash = await computeSecretHash(value);
|
|
37
37
|
await db.storeAlias('secrets', alias, Buffer.from(value.toString()), log);
|
|
38
38
|
await db.storeAlias('secrets', `${alias}:hash`, Buffer.from(hash.toString()), log);
|
|
39
39
|
});
|
|
@@ -49,8 +49,8 @@ function injectInternalCommands(program, log, db) {
|
|
|
49
49
|
'wasm',
|
|
50
50
|
'native',
|
|
51
51
|
'none'
|
|
52
|
-
]).env('PXE_PROVER').default('native')).addOption(new Option('--remote-pxe', 'Connect to an external PXE RPC server
|
|
53
|
-
const { dataDir, remotePxe, nodeUrl, prover
|
|
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)=>{
|
|
53
|
+
const { dataDir, remotePxe, nodeUrl, prover } = command.optsWithGlobals();
|
|
54
54
|
if (!remotePxe) {
|
|
55
55
|
debugLogger.info('Using local PXE service');
|
|
56
56
|
const proverEnabled = prover !== 'none';
|
|
@@ -64,19 +64,17 @@ function injectInternalCommands(program, log, db) {
|
|
|
64
64
|
bbBinaryPath: prover === 'native' ? bbBinaryPath : undefined,
|
|
65
65
|
bbWorkingDirectory: prover === 'native' ? bbWorkingDirectory : undefined
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
pxeWrapper.prepare(nodeUrl, join(dataDir, 'pxe'), overridePXEConfig);
|
|
68
68
|
}
|
|
69
69
|
await db.init(await openStoreAt(dataDir));
|
|
70
70
|
let protocolContractsRegistered;
|
|
71
71
|
try {
|
|
72
|
-
protocolContractsRegistered = !!await db.retrieveAlias('contracts:
|
|
72
|
+
protocolContractsRegistered = !!await db.retrieveAlias('contracts:ContractClassRegisterer');
|
|
73
73
|
// eslint-disable-next-line no-empty
|
|
74
74
|
} catch {}
|
|
75
75
|
if (!protocolContractsRegistered) {
|
|
76
76
|
userLog('Registering protocol contract aliases...');
|
|
77
|
-
const
|
|
78
|
-
const { protocolContractAddresses } = await client.getPXEInfo();
|
|
79
|
-
for (const [name, address] of Object.entries(protocolContractAddresses)){
|
|
77
|
+
for (const [name, address] of Object.entries(ProtocolContractAddress)){
|
|
80
78
|
await db.storeAlias('contracts', name, Buffer.from(address.toString()), userLog);
|
|
81
79
|
await db.storeAlias('artifacts', address.toString(), Buffer.from(`${name.slice(0, 1).toUpperCase()}${name.slice(1)}`), userLog);
|
|
82
80
|
}
|
|
@@ -3,7 +3,7 @@ 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
8
|
address: import("@aztec/aztec.js").AztecAddress;
|
|
9
9
|
secretKey: Fr;
|
|
@@ -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;
|
|
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;AAG5E,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;;;;;GAsHX"}
|
|
@@ -2,7 +2,8 @@ import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { createOrRetrieveAccount } from '../utils/accounts.js';
|
|
4
4
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
5
|
-
|
|
5
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
6
|
+
export async function createAccount(client, accountType, secretKey, publicKey, alias, registerOnly, publicDeploy, skipInitialization, wait, feeOpts, json, verbose, debugLogger, log) {
|
|
6
7
|
secretKey ??= Fr.random();
|
|
7
8
|
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
9
|
const { salt } = account.getInstance();
|
|
@@ -42,22 +43,23 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
42
43
|
skipInitialization: skipInitialization,
|
|
43
44
|
...await feeOpts.toDeployAccountOpts(wallet)
|
|
44
45
|
};
|
|
46
|
+
/*
|
|
47
|
+
* This is usually handled by accountManager.deploy(), but we're accessing the lower
|
|
48
|
+
* level method to get gas and timings. That means we have to replicate some of the logic here.
|
|
49
|
+
* In case we're deploying our own account, we need to hijack the payment method for the fee,
|
|
50
|
+
* wrapping it in the one that will make use of the freshly deployed account's
|
|
51
|
+
* entrypoint. For reference, see aztec.js/src/account_manager.ts:deploy()
|
|
52
|
+
* Also, salt and universalDeploy have to be explicitly provided
|
|
53
|
+
*/ deployOpts.fee = !deployOpts?.deployWallet && deployOpts?.fee ? {
|
|
54
|
+
...deployOpts.fee,
|
|
55
|
+
paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
|
|
56
|
+
} : deployOpts?.fee;
|
|
57
|
+
const deployMethod = await account.getDeployMethod(deployOpts.deployWallet);
|
|
45
58
|
if (feeOpts.estimateOnly) {
|
|
46
|
-
/*
|
|
47
|
-
* This is usually handled by accountManager.deploy(), but we're accessing the lower
|
|
48
|
-
* level method to get the gas estimates. That means we have to replicate some of the logic here.
|
|
49
|
-
* In case we're deploying our own account, we need to hijack the payment method for the fee,
|
|
50
|
-
* wrapping it in the one that will make use of the freshly deployed account's
|
|
51
|
-
* entrypoint. For reference, see aztec.js/src/account_manager.ts:deploy()
|
|
52
|
-
*/ const fee = !deployOpts?.deployWallet && deployOpts?.fee ? {
|
|
53
|
-
...deployOpts.fee,
|
|
54
|
-
paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
|
|
55
|
-
} : deployOpts?.fee;
|
|
56
|
-
const deployMethod = await account.getDeployMethod(deployOpts.deployWallet);
|
|
57
59
|
const gas = await deployMethod.estimateGas({
|
|
58
60
|
...deployOpts,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
universalDeploy: true,
|
|
62
|
+
contractAddressSalt: salt
|
|
61
63
|
});
|
|
62
64
|
if (json) {
|
|
63
65
|
out.fee = {
|
|
@@ -74,7 +76,15 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
74
76
|
printGasEstimates(feeOpts, gas, log);
|
|
75
77
|
}
|
|
76
78
|
} else {
|
|
77
|
-
|
|
79
|
+
const provenTx = await deployMethod.prove({
|
|
80
|
+
...deployOpts,
|
|
81
|
+
universalDeploy: true,
|
|
82
|
+
contractAddressSalt: salt
|
|
83
|
+
});
|
|
84
|
+
if (verbose) {
|
|
85
|
+
printProfileResult(provenTx.timings, log);
|
|
86
|
+
}
|
|
87
|
+
tx = provenTx.send();
|
|
78
88
|
const txHash = await tx.getTxHash();
|
|
79
89
|
debugLogger.debug(`Account contract tx sent with hash ${txHash}`);
|
|
80
90
|
out.txHash = txHash;
|
package/dest/cmds/deploy.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { type AccountWalletWithSecretKey, 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(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, 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, verbose: boolean, debugLogger: Logger, log: LogFn, logJson: (output: any) => void): Promise<import("@aztec/aztec.js").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,EAAwC,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAE5G,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;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAE5G,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;AAG5E,wBAAsB,MAAM,CAC1B,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,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,+DAuF/B"}
|
package/dest/cmds/deploy.js
CHANGED
|
@@ -3,7 +3,8 @@ import { encodeArgs, getContractArtifact } from '@aztec/cli/utils';
|
|
|
3
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
|
-
|
|
6
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
+
export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipPublicDeployment, skipClassRegistration, skipInitialization, universalDeploy, wait, feeOpts, verbose, debugLogger, log, logJson) {
|
|
7
8
|
salt ??= Fr.random();
|
|
8
9
|
const contractArtifact = await getContractArtifact(artifactPath, log);
|
|
9
10
|
const hasInitializer = getAllFunctionAbis(contractArtifact).some((fn)=>fn.isInitializer);
|
|
@@ -33,7 +34,11 @@ export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, sa
|
|
|
33
34
|
printGasEstimates(feeOpts, gas, log);
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
+
const provenTx = await deploy.prove(deployOpts);
|
|
38
|
+
if (verbose) {
|
|
39
|
+
printProfileResult(provenTx.timings, log);
|
|
40
|
+
}
|
|
41
|
+
const tx = provenTx.send();
|
|
37
42
|
const txHash = await tx.getTxHash();
|
|
38
43
|
debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
|
|
39
44
|
if (wait) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AccountManager } 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, registerClass: boolean, feeOpts: IFeeOpts, json: boolean, debugLogger: Logger, log: LogFn): Promise<{
|
|
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
5
|
address: import("@aztec/aztec.js").AztecAddress;
|
|
6
6
|
secretKey: import("@aztec/aztec.js").Fr;
|
|
7
7
|
salt: import("@aztec/aztec.js").Fr;
|
|
@@ -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;
|
|
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;AAG5E,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;;;;GAqGX"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
2
2
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
3
|
-
|
|
3
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
4
|
+
export async function deployAccount(account, wait, registerClass, publicDeploy, feeOpts, json, verbose, debugLogger, log) {
|
|
4
5
|
const out = {};
|
|
5
6
|
const { address, partialAddress, publicKeys } = await account.getCompleteAddress();
|
|
6
7
|
const { initializationHash, deployer, salt } = account.getInstance();
|
|
@@ -27,27 +28,27 @@ export async function deployAccount(account, wait, registerClass, feeOpts, json,
|
|
|
27
28
|
let tx;
|
|
28
29
|
let txReceipt;
|
|
29
30
|
const deployOpts = {
|
|
30
|
-
|
|
31
|
-
skipPublicDeployment: false,
|
|
31
|
+
skipPublicDeployment: !publicDeploy,
|
|
32
32
|
skipClassRegistration: !registerClass,
|
|
33
33
|
...await feeOpts.toDeployAccountOpts(wallet)
|
|
34
34
|
};
|
|
35
|
+
/*
|
|
36
|
+
* This is usually handled by accountManager.deploy(), but we're accessing the lower
|
|
37
|
+
* level method to get gas and timings. That means we have to replicate some of the logic here.
|
|
38
|
+
* In case we're deploying our own account, we need to hijack the payment method for the fee,
|
|
39
|
+
* wrapping it in the one that will make use of the freshly deployed account's
|
|
40
|
+
* entrypoint. For reference, see aztec.js/src/account_manager.ts:deploy()
|
|
41
|
+
* Also, salt and universalDeploy have to be explicitly provided
|
|
42
|
+
*/ deployOpts.fee = !deployOpts?.deployWallet && deployOpts?.fee ? {
|
|
43
|
+
...deployOpts.fee,
|
|
44
|
+
paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
|
|
45
|
+
} : deployOpts?.fee;
|
|
46
|
+
const deployMethod = await account.getDeployMethod(deployOpts.deployWallet);
|
|
35
47
|
if (feeOpts.estimateOnly) {
|
|
36
|
-
/*
|
|
37
|
-
* This is usually handled by accountManager.deploy(), but we're accessing the lower
|
|
38
|
-
* level method to get the gas estimates. That means we have to replicate some of the logic here.
|
|
39
|
-
* In case we're deploying our own account, we need to hijack the payment method for the fee,
|
|
40
|
-
* wrapping it in the one that will make use of the freshly deployed account's
|
|
41
|
-
* entrypoint. For reference, see aztec.js/src/account_manager.ts:deploy()
|
|
42
|
-
*/ const fee = !deployOpts?.deployWallet && deployOpts?.fee ? {
|
|
43
|
-
...deployOpts.fee,
|
|
44
|
-
paymentMethod: await account.getSelfPaymentMethod(deployOpts.fee.paymentMethod)
|
|
45
|
-
} : deployOpts?.fee;
|
|
46
|
-
const deployMethod = await account.getDeployMethod(deployOpts.deployWallet);
|
|
47
48
|
const gas = await deployMethod.estimateGas({
|
|
48
49
|
...deployOpts,
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
universalDeploy: true,
|
|
51
|
+
contractAddressSalt: salt
|
|
51
52
|
});
|
|
52
53
|
if (json) {
|
|
53
54
|
out.fee = {
|
|
@@ -64,7 +65,15 @@ export async function deployAccount(account, wait, registerClass, feeOpts, json,
|
|
|
64
65
|
printGasEstimates(feeOpts, gas, log);
|
|
65
66
|
}
|
|
66
67
|
} else {
|
|
67
|
-
|
|
68
|
+
const provenTx = await deployMethod.prove({
|
|
69
|
+
...deployOpts,
|
|
70
|
+
universalDeploy: true,
|
|
71
|
+
contractAddressSalt: salt
|
|
72
|
+
});
|
|
73
|
+
if (verbose) {
|
|
74
|
+
printProfileResult(provenTx.timings, log);
|
|
75
|
+
}
|
|
76
|
+
tx = provenTx.send();
|
|
68
77
|
const txHash = await tx.getTxHash();
|
|
69
78
|
debugLogger.debug(`Account contract tx sent with hash ${txHash}`);
|
|
70
79
|
out.txHash = txHash;
|
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":"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;
|
|
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;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,WA4qBxB"}
|
package/dest/cmds/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Option } from 'commander';
|
|
|
8
8
|
import inquirer from 'inquirer';
|
|
9
9
|
import { createOrRetrieveAccount } from '../utils/accounts.js';
|
|
10
10
|
import { FeeOpts, FeeOptsWithFeePayer } from '../utils/options/fees.js';
|
|
11
|
-
import { ARTIFACT_DESCRIPTION, aliasedAddressParser, aliasedSecretKeyParser, aliasedTxHashParser, artifactPathFromPromiseOrAlias, artifactPathParser, cleanupAuthWitnesses, createAccountOption, createAliasOption, createArgsOption, createArtifactOption, createAuthwitnessOption, createContractAddressOption, createDebugExecutionStepsDirOption, createTypeOption, integerArgParser, parseGasFees, parsePaymentMethod } from '../utils/options/index.js';
|
|
11
|
+
import { ARTIFACT_DESCRIPTION, aliasedAddressParser, aliasedSecretKeyParser, aliasedTxHashParser, artifactPathFromPromiseOrAlias, artifactPathParser, cleanupAuthWitnesses, createAccountOption, createAliasOption, createArgsOption, createArtifactOption, createAuthwitnessOption, createContractAddressOption, createDebugExecutionStepsDirOption, createTypeOption, createVerboseOption, integerArgParser, parseGasFees, parsePaymentMethod } from '../utils/options/index.js';
|
|
12
12
|
export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
13
13
|
program.command('import-test-accounts').description('Import test accounts from pxe.').addOption(pxeOption).option('--json', 'Emit output as json').action(async (options)=>{
|
|
14
14
|
if (!db) {
|
|
@@ -16,16 +16,16 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
16
16
|
}
|
|
17
17
|
const { importTestAccounts } = await import('./import_test_accounts.js');
|
|
18
18
|
const { rpcUrl, json } = options;
|
|
19
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
19
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
20
20
|
await importTestAccounts(client, db, json, log);
|
|
21
21
|
});
|
|
22
22
|
const createAccountCommand = program.command('create-account').description('Creates an aztec account that can be used for sending transactions. Registers the account on the PXE and deploys an account contract. Uses a Schnorr single-key account which uses the same key for encryption and authentication (not secure for production usage).').summary('Creates an aztec account that can be used for sending transactions.').option('--skip-initialization', 'Skip initializing the account contract. Useful for publicly deploying an existing account.').option('--public-deploy', 'Publicly deploys the account and registers the class if needed.').option('-p, --public-key <string>', 'Public key that identifies a private signing key stored outside of the wallet. Used for ECDSA SSH accounts over the secp256r1 curve.').addOption(pxeOption).addOption(createSecretKeyOption('Secret key for account. Uses random by default.', false, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('public-key')).addOption(createAliasOption('Alias for the account. Used for easy reference in subsequent commands.', !db)).addOption(createTypeOption(true)).option('--register-only', 'Just register the account on the PXE. Do not deploy or initialize the account contract.').option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
|
|
23
23
|
// https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
|
|
24
|
-
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction');
|
|
24
|
+
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').addOption(createVerboseOption());
|
|
25
25
|
addOptions(createAccountCommand, FeeOptsWithFeePayer.getOptions()).action(async (_options, command)=>{
|
|
26
26
|
const { createAccount } = await import('./create_account.js');
|
|
27
27
|
const options = command.optsWithGlobals();
|
|
28
|
-
const { type, secretKey, wait, registerOnly, skipInitialization, publicDeploy, rpcUrl, alias, json } = options;
|
|
28
|
+
const { type, secretKey, wait, registerOnly, skipInitialization, publicDeploy, rpcUrl, alias, json, verbose } = options;
|
|
29
29
|
let { publicKey } = options;
|
|
30
30
|
if (type === 'ecdsasecp256r1ssh' && !publicKey) {
|
|
31
31
|
const identities = await getIdentities();
|
|
@@ -39,8 +39,8 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
39
39
|
]);
|
|
40
40
|
publicKey = answers.identity.split(' ')[1];
|
|
41
41
|
}
|
|
42
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
43
|
-
const accountCreationResult = await createAccount(client, type, secretKey, publicKey, alias, registerOnly, skipInitialization, publicDeploy, wait, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, debugLogger, log);
|
|
42
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
43
|
+
const accountCreationResult = await createAccount(client, type, secretKey, publicKey, alias, registerOnly, skipInitialization, publicDeploy, wait, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, verbose, debugLogger, log);
|
|
44
44
|
if (db) {
|
|
45
45
|
const { address, alias, secretKey, salt } = accountCreationResult;
|
|
46
46
|
await db.storeAccount(address, {
|
|
@@ -54,70 +54,72 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
54
54
|
});
|
|
55
55
|
const deployAccountCommand = program.command('deploy-account').description('Deploys an already registered aztec account that can be used for sending transactions.').addOption(createAccountOption('Alias or address of the account to deploy', !db, db)).addOption(pxeOption).option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
|
|
56
56
|
// https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
|
|
57
|
-
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').option('--register-class', 'Register the contract class (useful for when the contract class has not been deployed yet).');
|
|
57
|
+
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').option('--register-class', 'Register the contract class (useful for when the contract class has not been deployed yet).').option('--public-deploy', 'Publicly deploy this account contract (only useful if it contains public functions').addOption(createVerboseOption());
|
|
58
58
|
addOptions(deployAccountCommand, FeeOptsWithFeePayer.getOptions()).action(async (_options, command)=>{
|
|
59
59
|
const { deployAccount } = await import('./deploy_account.js');
|
|
60
60
|
const options = command.optsWithGlobals();
|
|
61
|
-
const { rpcUrl, wait, from: parsedFromAddress, json, registerClass } = options;
|
|
62
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
61
|
+
const { rpcUrl, wait, from: parsedFromAddress, json, registerClass, publicDeploy, verbose } = options;
|
|
62
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
63
63
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db);
|
|
64
|
-
await deployAccount(account, wait, registerClass, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, debugLogger, log);
|
|
64
|
+
await deployAccount(account, wait, registerClass, publicDeploy, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, verbose, debugLogger, log);
|
|
65
65
|
});
|
|
66
66
|
const deployCommand = program.command('deploy').description('Deploys a compiled Aztec.nr contract to Aztec.').argument('[artifact]', ARTIFACT_DESCRIPTION, artifactPathParser).option('--init <string>', 'The contract initializer function to call', 'constructor').option('--no-init', 'Leave the contract uninitialized').option('-k, --public-key <string>', 'Optional encryption public key for this address. Set this value only if this contract is expected to receive private notes, which will be encrypted using this public key.', parsePublicKey).option('-s, --salt <hex string>', 'Optional deployment salt as a hex string for generating the deployment address.', parseFieldFromHexString).option('--universal', 'Do not mix the sender address into the deployment.').addOption(pxeOption).addOption(createArgsOption(true, db)).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAccountOption('Alias or address of the account to deploy from', !db, db)).addOption(createAliasOption('Alias for the contract. Used for easy reference subsequent commands.', !db)).option('--json', 'Emit output as json')// `options.wait` is default true. Passing `--no-wait` will set it to false.
|
|
67
67
|
// https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
|
|
68
|
-
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').option('--no-class-registration', "Don't register this contract class").option('--no-public-deployment', "Don't emit this contract's public bytecode");
|
|
68
|
+
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction').option('--no-class-registration', "Don't register this contract class").option('--no-public-deployment', "Don't emit this contract's public bytecode").addOption(createVerboseOption());
|
|
69
69
|
addOptions(deployCommand, FeeOpts.getOptions()).action(async (artifactPathPromise, _options, command)=>{
|
|
70
70
|
const { deploy } = await import('./deploy.js');
|
|
71
71
|
const options = command.optsWithGlobals();
|
|
72
|
-
const { json, publicKey, args, salt, wait, secretKey, classRegistration, init, publicDeployment, universal, rpcUrl, from: parsedFromAddress, alias } = options;
|
|
73
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
72
|
+
const { json, publicKey, args, salt, wait, secretKey, classRegistration, init, publicDeployment, universal, rpcUrl, from: parsedFromAddress, alias, verbose } = options;
|
|
73
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
74
74
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
75
75
|
const wallet = await account.getWallet();
|
|
76
76
|
const artifactPath = await artifactPathPromise;
|
|
77
77
|
debugLogger.info(`Using wallet with address ${wallet.getCompleteAddress().address.toString()}`);
|
|
78
|
-
const address = await deploy(wallet, artifactPath, json, publicKey, args, salt, typeof init === 'string' ? init : undefined, !publicDeployment, !classRegistration, typeof init === 'string' ? false : init, universal, wait, await FeeOpts.fromCli(options, client, log, db), debugLogger, log, logJson(log));
|
|
78
|
+
const address = await deploy(wallet, artifactPath, json, publicKey, args, salt, typeof init === 'string' ? init : undefined, !publicDeployment, !classRegistration, typeof init === 'string' ? false : init, universal, wait, await FeeOpts.fromCli(options, client, log, db), verbose, debugLogger, log, logJson(log));
|
|
79
79
|
if (db && address) {
|
|
80
80
|
await db.storeContract(address, artifactPath, log, alias);
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
const sendCommand = program.command('send').description('Calls a function on an Aztec contract.').argument('<functionName>', 'Name of function to execute').addOption(pxeOption).addOption(createArgsOption(false, db)).addOption(createArtifactOption(db)).addOption(createContractAddressOption(db)).addOption(createAliasOption('Alias for the transaction hash. Used for easy reference in subsequent commands.', !db)).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAuthwitnessOption('Authorization witness to use for the transaction. If using multiple, pass a comma separated string', !db, db)).addOption(createAccountOption('Alias or address of the account to send the transaction from', !db, db)).option('--no-wait', 'Print transaction hash without waiting for it to be mined').option('--no-cancel', 'Do not allow the transaction to be cancelled. This makes for cheaper transactions.');
|
|
83
|
+
const sendCommand = program.command('send').description('Calls a function on an Aztec contract.').argument('<functionName>', 'Name of function to execute').addOption(pxeOption).addOption(createArgsOption(false, db)).addOption(createArtifactOption(db)).addOption(createContractAddressOption(db)).addOption(createAliasOption('Alias for the transaction hash. Used for easy reference in subsequent commands.', !db)).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAuthwitnessOption('Authorization witness to use for the transaction. If using multiple, pass a comma separated string', !db, db)).addOption(createAccountOption('Alias or address of the account to send the transaction from', !db, db)).option('--no-wait', 'Print transaction hash without waiting for it to be mined').option('--no-cancel', 'Do not allow the transaction to be cancelled. This makes for cheaper transactions.').addOption(createVerboseOption());
|
|
84
84
|
addOptions(sendCommand, FeeOpts.getOptions()).action(async (functionName, _options, command)=>{
|
|
85
85
|
const { send } = await import('./send.js');
|
|
86
86
|
const options = command.optsWithGlobals();
|
|
87
|
-
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, wait, rpcUrl, secretKey, alias, cancel, authWitness: authWitnessArray } = options;
|
|
88
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
87
|
+
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, wait, rpcUrl, secretKey, alias, cancel, authWitness: authWitnessArray, verbose } = options;
|
|
88
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
89
89
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
90
90
|
const wallet = await account.getWallet();
|
|
91
91
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
92
92
|
debugLogger.info(`Using wallet with address ${wallet.getCompleteAddress().address.toString()}`);
|
|
93
93
|
const authWitnesses = cleanupAuthWitnesses(authWitnessArray);
|
|
94
|
-
const sentTx = await send(wallet, functionName, args, artifactPath, contractAddress, wait, cancel, await FeeOpts.fromCli(options, client, log, db), authWitnesses, log);
|
|
94
|
+
const sentTx = await send(wallet, functionName, args, artifactPath, contractAddress, wait, cancel, await FeeOpts.fromCli(options, client, log, db), authWitnesses, verbose, log);
|
|
95
95
|
if (db && sentTx) {
|
|
96
96
|
const txAlias = alias ? alias : `${functionName}-${sentTx.nonce.toString().slice(-4)}`;
|
|
97
97
|
await db.storeTx(sentTx, log, txAlias);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
|
-
program.command('simulate').description('Simulates the execution of a function on an Aztec contract.').argument('<functionName>', 'Name of function to simulate').addOption(pxeOption).addOption(createArgsOption(false, db)).addOption(createContractAddressOption(db)).addOption(createArtifactOption(db)).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAuthwitnessOption('Authorization witness to use for the simulation', !db, db)).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db)).
|
|
100
|
+
const simulateCommand = program.command('simulate').description('Simulates the execution of a function on an Aztec contract.').argument('<functionName>', 'Name of function to simulate').addOption(pxeOption).addOption(createArgsOption(false, db)).addOption(createContractAddressOption(db)).addOption(createArtifactOption(db)).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAuthwitnessOption('Authorization witness to use for the simulation', !db, db)).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db)).addOption(createVerboseOption());
|
|
101
|
+
addOptions(simulateCommand, FeeOpts.getOptions()).action(async (functionName, _options, command)=>{
|
|
101
102
|
const { simulate } = await import('./simulate.js');
|
|
102
103
|
const options = command.optsWithGlobals();
|
|
103
|
-
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, authWitness } = options;
|
|
104
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
104
|
+
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, verbose, authWitness } = options;
|
|
105
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
105
106
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
106
107
|
const wallet = await account.getWallet();
|
|
107
108
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
108
109
|
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
109
|
-
await simulate(wallet, functionName, args, artifactPath, contractAddress, authWitnesses, log);
|
|
110
|
+
await simulate(wallet, functionName, args, artifactPath, contractAddress, await FeeOpts.fromCli(options, client, log, db), authWitnesses, verbose, log);
|
|
110
111
|
});
|
|
111
|
-
program.command('profile').description('Profiles a private function by counting the unconditional operations in its execution steps').argument('<functionName>', 'Name of function to simulate').addOption(pxeOption).addOption(createArgsOption(false, db)).addOption(createContractAddressOption(db)).addOption(createArtifactOption(db)).addOption(createDebugExecutionStepsDirOption()).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAuthwitnessOption('Authorization witness to use for the simulation', !db, db)).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db))
|
|
112
|
+
const profileCommand = program.command('profile').description('Profiles a private function by counting the unconditional operations in its execution steps').argument('<functionName>', 'Name of function to simulate').addOption(pxeOption).addOption(createArgsOption(false, db)).addOption(createContractAddressOption(db)).addOption(createArtifactOption(db)).addOption(createDebugExecutionStepsDirOption()).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAuthwitnessOption('Authorization witness to use for the simulation', !db, db)).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db));
|
|
113
|
+
addOptions(profileCommand, FeeOpts.getOptions()).action(async (functionName, _options, command)=>{
|
|
112
114
|
const { profile } = await import('./profile.js');
|
|
113
115
|
const options = command.optsWithGlobals();
|
|
114
116
|
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, debugExecutionStepsDir, authWitness } = options;
|
|
115
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
117
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
116
118
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
117
119
|
const wallet = await account.getWallet();
|
|
118
120
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
119
121
|
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
120
|
-
await profile(wallet, functionName, args, artifactPath, contractAddress, debugExecutionStepsDir, authWitnesses, log);
|
|
122
|
+
await profile(wallet, functionName, args, artifactPath, contractAddress, debugExecutionStepsDir, await FeeOptsWithFeePayer.fromCli(options, client, log, db), authWitnesses, log);
|
|
121
123
|
});
|
|
122
124
|
program.command('bridge-fee-juice').description('Mints L1 Fee Juice and pushes them to L2.').argument('<amount>', 'The amount of Fee Juice to mint and bridge.', parseBigint).argument('<recipient>', 'Aztec address of the recipient.', (address)=>aliasedAddressParser('accounts', address, db)).requiredOption('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)', (arg)=>arg.split(','), [
|
|
123
125
|
ETHEREUM_HOSTS
|
|
@@ -126,7 +128,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
126
128
|
.option('--no-wait', 'Wait for the brigded funds to be available in L2, polling every 60 seconds').addOption(new Option('--interval <number>', 'The polling interval in seconds for the bridged funds').default('60').conflicts('wait')).action(async (amount, recipient, options)=>{
|
|
127
129
|
const { bridgeL1FeeJuice } = await import('./bridge_fee_juice.js');
|
|
128
130
|
const { rpcUrl, l1ChainId, l1RpcUrls, l1PrivateKey, mnemonic, mint, json, wait, interval: intervalS } = options;
|
|
129
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
131
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
130
132
|
const [secret, messageLeafIndex] = await bridgeL1FeeJuice(amount, recipient, client, l1RpcUrls, l1ChainId, l1PrivateKey, mnemonic, mint, json, wait, intervalS * 1000, log, debugLogger);
|
|
131
133
|
if (db) {
|
|
132
134
|
await db.pushBridgedFeeJuice(recipient, secret, amount, messageLeafIndex, log);
|
|
@@ -136,7 +138,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
136
138
|
const { createAuthwit } = await import('./create_authwit.js');
|
|
137
139
|
const options = command.optsWithGlobals();
|
|
138
140
|
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, alias } = options;
|
|
139
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
141
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
140
142
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
141
143
|
const wallet = await account.getWallet();
|
|
142
144
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
@@ -149,7 +151,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
149
151
|
const { authorizeAction } = await import('./authorize_action.js');
|
|
150
152
|
const options = command.optsWithGlobals();
|
|
151
153
|
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey } = options;
|
|
152
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
154
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
153
155
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
154
156
|
const wallet = await account.getWallet();
|
|
155
157
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
@@ -159,7 +161,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
159
161
|
const { checkTx } = await import('./check_tx.js');
|
|
160
162
|
const { rpcUrl, pageSize } = options;
|
|
161
163
|
let { page } = options;
|
|
162
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
164
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
163
165
|
if (txHash) {
|
|
164
166
|
await checkTx(client, txHash, false, log);
|
|
165
167
|
} else if (db) {
|
|
@@ -188,7 +190,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
188
190
|
program.command('cancel-tx').description('Cancels a pending tx by reusing its nonce with a higher fee and an empty payload').argument('<txHash>', 'A transaction hash to cancel.', (txHash)=>aliasedTxHashParser(txHash, db)).addOption(pxeOption).addOption(createSecretKeyOption("The sender's secret key", !db, (sk)=>aliasedSecretKeyParser(sk, db)).conflicts('account')).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db)).addOption(FeeOpts.paymentMethodOption().default('method=fee_juice')).option('-i --increased-fees <da=1,l2=1>', 'The amounts by which the fees are increased', (value)=>parseGasFees(value), new GasFees(1, 1)).option('--max-fees-per-gas <da=100,l2=100>', 'Maximum fees per gas unit for DA and L2 computation.', (value)=>parseGasFees(value)).action(async (txHash, options)=>{
|
|
189
191
|
const { cancelTx } = await import('./cancel_tx.js');
|
|
190
192
|
const { from: parsedFromAddress, rpcUrl, secretKey, payment, increasedFees, maxFeesPerGas } = options;
|
|
191
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
193
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
192
194
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
193
195
|
const wallet = await account.getWallet();
|
|
194
196
|
const txData = await db?.retrieveTxData(txHash);
|
|
@@ -201,7 +203,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
201
203
|
program.command('register-sender').description("Registers a sender's address in the wallet, so the note synching process will look for notes sent by them").argument('[address]', 'The address of the sender to register', (address)=>aliasedAddressParser('accounts', address, db)).addOption(pxeOption).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db)).addOption(createAliasOption('Alias for the sender. Used for easy reference in subsequent commands.', !db)).action(async (address, options)=>{
|
|
202
204
|
const { registerSender } = await import('./register_sender.js');
|
|
203
205
|
const { from: parsedFromAddress, rpcUrl, secretKey, alias } = options;
|
|
204
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
206
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
205
207
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
206
208
|
const wallet = await account.getWallet();
|
|
207
209
|
await registerSender(wallet, address, log);
|
|
@@ -212,7 +214,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
212
214
|
program.command('register-contract').description("Registers a contract in this wallet's PXE").argument('[address]', 'The address of the contract to register', (address)=>aliasedAddressParser('accounts', address, db)).argument('[artifact]', ARTIFACT_DESCRIPTION, artifactPathParser).option('--init <string>', 'The contract initializer function to call', 'constructor').option('-k, --public-key <string>', 'Optional encryption public key for this address. Set this value only if this contract is expected to receive private notes, which will be encrypted using this public key.', parsePublicKey).option('-s, --salt <hex string>', 'Optional deployment salt as a hex string for generating the deployment address.', parseFieldFromHexString).option('--deployer <string>', 'The address of the account that deployed the contract', (address)=>aliasedAddressParser('accounts', address, db)).addOption(createArgsOption(true, db)).addOption(pxeOption).addOption(createAccountOption('Alias or address of the account to simulate from', !db, db)).addOption(createAliasOption('Alias for the contact. Used for easy reference in subsequent commands.', !db)).action(async (address, artifactPathPromise, _options, command)=>{
|
|
213
215
|
const { registerContract } = await import('./register_contract.js');
|
|
214
216
|
const { from: parsedFromAddress, rpcUrl, nodeUrl, secretKey, alias, init, publicKey, salt, deployer, args } = command.optsWithGlobals();
|
|
215
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
217
|
+
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
216
218
|
const node = pxeWrapper?.getNode() ?? createAztecNodeClient(nodeUrl);
|
|
217
219
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
218
220
|
const wallet = await account.getWallet();
|
package/dest/cmds/profile.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
|
|
3
|
+
import type { IFeeOpts } from '../utils/options/fees.js';
|
|
4
|
+
export declare function profile(wallet: AccountWalletWithSecretKey, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, debugOutputPath: string | undefined, feeOpts: IFeeOpts, authWitnesses: AuthWitness[], log: LogFn): Promise<void>;
|
|
4
5
|
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,WAAW,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE5G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,WAAW,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE5G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,WAAW,EAAE,EAC5B,GAAG,EAAE,KAAK,iBAmBX"}
|
package/dest/cmds/profile.js
CHANGED
|
@@ -3,28 +3,18 @@ import { prepTx } from '@aztec/cli/utils';
|
|
|
3
3
|
import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
|
|
4
4
|
import { promises as fs } from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
8
|
-
// TODO(AD): this is a bit misleading - the maximum gate count of any piece is as important
|
|
9
|
-
// as the total gate count. We should probably print both.
|
|
10
|
-
log(format('\nGate count per circuit:'));
|
|
11
|
-
let acc = 0;
|
|
12
|
-
result.executionSteps.forEach((r)=>{
|
|
13
|
-
acc += r.gateCount;
|
|
14
|
-
log(format(' ', r.functionName.padEnd(50), 'Gates:', r.gateCount.toLocaleString(), '\tSubtotal:', acc.toLocaleString()));
|
|
15
|
-
});
|
|
16
|
-
log(format('\nTotal gates:', acc.toLocaleString()));
|
|
17
|
-
}
|
|
18
|
-
export async function profile(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, debugOutputPath, authWitnesses, log) {
|
|
19
|
-
const profileMode = debugOutputPath ? 'full' : 'gates';
|
|
6
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
+
export async function profile(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, debugOutputPath, feeOpts, authWitnesses, log) {
|
|
20
8
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
21
9
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
22
10
|
const call = contract.methods[functionName](...functionArgs);
|
|
23
11
|
const result = await call.profile({
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
...await feeOpts.toSendOpts(wallet),
|
|
13
|
+
profileMode: 'full',
|
|
14
|
+
authWitnesses,
|
|
15
|
+
skipProofGeneration: false
|
|
26
16
|
});
|
|
27
|
-
printProfileResult(result, log);
|
|
17
|
+
printProfileResult(result.timings, log, result.executionSteps);
|
|
28
18
|
if (debugOutputPath) {
|
|
29
19
|
const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
|
|
30
20
|
log(`Debug output written to ${ivcInputsPath}.`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type AccountWalletWithSecretKey, type AztecAddress, type AztecNode, type Fr, PublicKeys } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
export declare function registerContract(wallet: AccountWalletWithSecretKey, node: AztecNode, address: AztecAddress, artifactPath: string, log: LogFn, initializer?: string, publicKeys?: PublicKeys, rawArgs?: any[], salt?: Fr, deployer?: AztecAddress
|
|
3
|
+
export declare function registerContract(wallet: AccountWalletWithSecretKey, node: AztecNode, address: AztecAddress, artifactPath: string, log: LogFn, initializer?: string, publicKeys?: PublicKeys, rawArgs?: any[], salt?: Fr, deployer?: AztecAddress): Promise<import("@aztec/aztec.js").ContractInstanceWithAddress>;
|
|
4
4
|
//# sourceMappingURL=register_contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register_contract.d.ts","sourceRoot":"","sources":["../../src/cmds/register_contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,EAAE,EACP,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,0BAA0B,EAClC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,KAAK,EACV,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,UAAU,EACvB,OAAO,CAAC,EAAE,GAAG,EAAE,EACf,IAAI,CAAC,EAAE,EAAE,EACT,QAAQ,CAAC,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"register_contract.d.ts","sourceRoot":"","sources":["../../src/cmds/register_contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,EAAE,EACP,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,0BAA0B,EAClC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,KAAK,EACV,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,UAAU,EACvB,OAAO,CAAC,EAAE,GAAG,EAAE,EACf,IAAI,CAAC,EAAE,EAAE,EACT,QAAQ,CAAC,EAAE,YAAY,kEAsBxB"}
|
package/dest/cmds/send.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress, Fr } f
|
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
4
4
|
import { type IFeeOpts } from '../utils/options/fees.js';
|
|
5
|
-
export declare function send(wallet: AccountWalletWithSecretKey, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, wait: boolean, cancellable: boolean, feeOpts: IFeeOpts, authWitnesses: AuthWitness[], log: LogFn): Promise<{
|
|
5
|
+
export declare function send(wallet: AccountWalletWithSecretKey, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, wait: boolean, cancellable: boolean, feeOpts: IFeeOpts, authWitnesses: AuthWitness[], verbose: boolean, log: LogFn): Promise<{
|
|
6
6
|
txHash: import("@aztec/aztec.js").TxHash;
|
|
7
7
|
nonce: Fr;
|
|
8
8
|
cancellable: boolean;
|
package/dest/cmds/send.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/cmds/send.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,WAAW,EACX,KAAK,YAAY,EAEjB,EAAE,EAEH,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/cmds/send.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,WAAW,EACX,KAAK,YAAY,EAEjB,EAAE,EAEH,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAG5E,wBAAsB,IAAI,CACxB,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK;;;;;eA0DX"}
|
package/dest/cmds/send.js
CHANGED
|
@@ -2,7 +2,8 @@ import { Contract, Fr } from '@aztec/aztec.js';
|
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
3
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
4
4
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
5
|
-
|
|
5
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
6
|
+
export async function send(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, authWitnesses, verbose, log) {
|
|
6
7
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
7
8
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
8
9
|
const call = contract.methods[functionName](...functionArgs);
|
|
@@ -18,7 +19,11 @@ export async function send(wallet, functionName, functionArgsIn, contractArtifac
|
|
|
18
19
|
if (feeOpts.estimateOnly) {
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
+
const provenTx = await call.prove(sendOptions);
|
|
23
|
+
if (verbose) {
|
|
24
|
+
printProfileResult(provenTx.timings, log);
|
|
25
|
+
}
|
|
26
|
+
const tx = provenTx.send();
|
|
22
27
|
const txHash = await tx.getTxHash();
|
|
23
28
|
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
24
29
|
if (wait) {
|
package/dest/cmds/simulate.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
|
|
3
|
+
import type { IFeeOpts } from '../utils/options/fees.js';
|
|
4
|
+
export declare function simulate(wallet: AccountWalletWithSecretKey, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, feeOpts: IFeeOpts, authWitnesses: AuthWitness[], verbose: boolean, log: LogFn): Promise<void>;
|
|
4
5
|
//# sourceMappingURL=simulate.d.ts.map
|