@aztec/cli-wallet 1.0.0-nightly.20250708 → 1.0.0-staging.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/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +8 -8
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +4 -6
- package/dest/cmds/profile.js +1 -1
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +0 -9
- package/dest/utils/profiling.d.ts +1 -1
- package/dest/utils/profiling.d.ts.map +1 -1
- package/dest/utils/profiling.js +3 -3
- package/package.json +12 -12
- package/src/cmds/deploy.ts +1 -2
- package/src/cmds/index.ts +1 -11
- package/src/cmds/profile.ts +1 -1
- package/src/cmds/simulate.ts +0 -16
- package/src/utils/profiling.ts +2 -3
- package/dest/utils/authorizations.d.ts +0 -5
- package/dest/utils/authorizations.d.ts.map +0 -1
- package/dest/utils/authorizations.js +0 -28
- package/src/utils/authorizations.ts +0 -49
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, verbose: boolean,
|
|
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;AAI5E,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,
|
|
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;AAI5E,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
|
@@ -5,7 +5,7 @@ import { PublicKeys } from '@aztec/stdlib/keys';
|
|
|
5
5
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
6
6
|
import { printProfileResult } from '../utils/profiling.js';
|
|
7
7
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
8
|
-
export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipPublicDeployment, skipClassRegistration, skipInitialization, universalDeploy, wait, feeOpts, verbose,
|
|
8
|
+
export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipPublicDeployment, skipClassRegistration, skipInitialization, universalDeploy, wait, feeOpts, verbose, debugLogger, log, logJson) {
|
|
9
9
|
salt ??= Fr.random();
|
|
10
10
|
const contractArtifact = await getContractArtifact(artifactPath, log);
|
|
11
11
|
const hasInitializer = getAllFunctionAbis(contractArtifact).some((fn)=>fn.isInitializer);
|
|
@@ -21,7 +21,7 @@ export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, sa
|
|
|
21
21
|
args = encodeArgs(rawArgs, constructorArtifact.parameters);
|
|
22
22
|
debugLogger.debug(`Encoded arguments: ${args.join(', ')}`);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const deploy = deployer.deploy(...args);
|
|
25
25
|
const deployOpts = {
|
|
26
26
|
...await feeOpts.toDeployAccountOpts(wallet),
|
|
27
27
|
contractAddressSalt: salt,
|
|
@@ -31,11 +31,11 @@ export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, sa
|
|
|
31
31
|
skipPublicDeployment
|
|
32
32
|
};
|
|
33
33
|
if (feeOpts.estimateOnly) {
|
|
34
|
-
const gas = await
|
|
34
|
+
const gas = await deploy.estimateGas(deployOpts);
|
|
35
35
|
printGasEstimates(feeOpts, gas, log);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
const provenTx = await
|
|
38
|
+
const provenTx = await deploy.prove(deployOpts);
|
|
39
39
|
if (verbose) {
|
|
40
40
|
printProfileResult(provenTx.stats, log);
|
|
41
41
|
}
|
|
@@ -44,7 +44,7 @@ export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, sa
|
|
|
44
44
|
debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
|
|
45
45
|
if (wait) {
|
|
46
46
|
const deployed = await tx.wait({
|
|
47
|
-
timeout
|
|
47
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
48
48
|
});
|
|
49
49
|
const { address, partialAddress, instance } = deployed.contract;
|
|
50
50
|
if (json) {
|
|
@@ -64,8 +64,8 @@ export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, sa
|
|
|
64
64
|
log(`Deployment fee: ${deployed.transactionFee}`);
|
|
65
65
|
}
|
|
66
66
|
} else {
|
|
67
|
-
const { address, partialAddress } =
|
|
68
|
-
const instance = await
|
|
67
|
+
const { address, partialAddress } = deploy;
|
|
68
|
+
const instance = await deploy.getInstance();
|
|
69
69
|
if (json) {
|
|
70
70
|
logJson({
|
|
71
71
|
address: address?.toString() ?? 'N/A',
|
|
@@ -84,5 +84,5 @@ export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, sa
|
|
|
84
84
|
log(`Deployer: ${instance.deployer.toString()}`);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
return
|
|
87
|
+
return deploy.address;
|
|
88
88
|
}
|
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":"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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CopyCatAccountWallet } from '@aztec/accounts/copy-cat';
|
|
2
1
|
import { getIdentities } from '@aztec/accounts/utils';
|
|
3
2
|
import { createCompatibleClient } from '@aztec/aztec.js/rpc';
|
|
4
3
|
import { TxHash } from '@aztec/aztec.js/tx_hash';
|
|
@@ -66,17 +65,17 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
66
65
|
});
|
|
67
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.
|
|
68
67
|
// https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
|
|
69
|
-
.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(
|
|
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());
|
|
70
69
|
addOptions(deployCommand, FeeOpts.getOptions()).action(async (artifactPathPromise, _options, command)=>{
|
|
71
70
|
const { deploy } = await import('./deploy.js');
|
|
72
71
|
const options = command.optsWithGlobals();
|
|
73
|
-
const { json, publicKey, args, salt, wait, secretKey, classRegistration, init, publicDeployment, universal, rpcUrl, from: parsedFromAddress, alias,
|
|
72
|
+
const { json, publicKey, args, salt, wait, secretKey, classRegistration, init, publicDeployment, universal, rpcUrl, from: parsedFromAddress, alias, verbose } = options;
|
|
74
73
|
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
75
74
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
76
75
|
const wallet = await account.getWallet();
|
|
77
76
|
const artifactPath = await artifactPathPromise;
|
|
78
77
|
debugLogger.info(`Using wallet with address ${wallet.getCompleteAddress().address.toString()}`);
|
|
79
|
-
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),
|
|
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));
|
|
80
79
|
if (db && address) {
|
|
81
80
|
await db.storeContract(address, artifactPath, log, alias);
|
|
82
81
|
}
|
|
@@ -105,8 +104,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
105
104
|
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, verbose, authWitness } = options;
|
|
106
105
|
const client = await pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
107
106
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
108
|
-
const
|
|
109
|
-
const wallet = await CopyCatAccountWallet.create(client, originalWallet);
|
|
107
|
+
const wallet = await account.getWallet();
|
|
110
108
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
111
109
|
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
112
110
|
await simulate(wallet, functionName, args, artifactPath, contractAddress, await FeeOpts.fromCli(options, client, log, db), authWitnesses, verbose, log);
|
package/dest/cmds/profile.js
CHANGED
|
@@ -14,7 +14,7 @@ export async function profile(wallet, functionName, functionArgsIn, contractArti
|
|
|
14
14
|
authWitnesses,
|
|
15
15
|
skipProofGeneration: false
|
|
16
16
|
});
|
|
17
|
-
printProfileResult(result.stats, log,
|
|
17
|
+
printProfileResult(result.stats, log, result.executionSteps);
|
|
18
18
|
if (debugOutputPath) {
|
|
19
19
|
const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
|
|
20
20
|
log(`Debug output written to ${ivcInputsPath}.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../src/cmds/simulate.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":"simulate.d.ts","sourceRoot":"","sources":["../../src/cmds/simulate.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;AAInD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,iBAeX"}
|
package/dest/cmds/simulate.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Contract } from '@aztec/aztec.js';
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
3
|
import { format } from 'util';
|
|
4
|
-
import { printAuthorizations } from '../utils/authorizations.js';
|
|
5
4
|
import { printProfileResult } from '../utils/profiling.js';
|
|
6
5
|
export async function simulate(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, feeOpts, authWitnesses, verbose, log) {
|
|
7
6
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
@@ -13,14 +12,6 @@ export async function simulate(wallet, functionName, functionArgsIn, contractArt
|
|
|
13
12
|
includeMetadata: true
|
|
14
13
|
});
|
|
15
14
|
if (verbose) {
|
|
16
|
-
await printAuthorizations(simulationResult.offchainEffects, async (address)=>{
|
|
17
|
-
const metadata = await wallet.getContractMetadata(address);
|
|
18
|
-
if (!metadata.contractInstance) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
const classMetadata = await wallet.getContractClassMetadata(metadata.contractInstance.currentContractClassId, true);
|
|
22
|
-
return classMetadata.artifact;
|
|
23
|
-
}, log);
|
|
24
15
|
printProfileResult(simulationResult.stats, log);
|
|
25
16
|
}
|
|
26
17
|
log(format('\nSimulation result: ', simulationResult.result, '\n'));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
3
3
|
import type { ProvingStats, SimulationStats } from '@aztec/stdlib/tx';
|
|
4
|
-
export declare function printProfileResult(stats: ProvingStats | SimulationStats, log: LogFn,
|
|
4
|
+
export declare function printProfileResult(stats: ProvingStats | SimulationStats, log: LogFn, executionSteps?: PrivateExecutionStep[]): void;
|
|
5
5
|
//# sourceMappingURL=profiling.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,cAAc,CAAC,EAAE,oBAAoB,EAAE,QA6IxC"}
|
package/dest/utils/profiling.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { format } from 'util';
|
|
2
|
-
const FN_NAME_PADDING =
|
|
2
|
+
const FN_NAME_PADDING = 50;
|
|
3
3
|
const COLUMN_MIN_WIDTH = 13;
|
|
4
4
|
const COLUMN_MAX_WIDTH = 15;
|
|
5
5
|
const ORACLE_NAME_PADDING = 50;
|
|
6
|
-
export function printProfileResult(stats, log,
|
|
6
|
+
export function printProfileResult(stats, log, executionSteps) {
|
|
7
7
|
log(format('\nPer circuit breakdown:\n'));
|
|
8
8
|
log(format(' ', 'Function name'.padEnd(FN_NAME_PADDING), 'Time'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), executionSteps ? 'Gates'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '', executionSteps ? 'Subtotal'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : ''));
|
|
9
9
|
log(format(''.padEnd(FN_NAME_PADDING + COLUMN_MAX_WIDTH + COLUMN_MAX_WIDTH + (executionSteps ? COLUMN_MAX_WIDTH + COLUMN_MAX_WIDTH : 0), '-')));
|
|
@@ -17,7 +17,7 @@ export function printProfileResult(stats, log, printOracles = false, executionSt
|
|
|
17
17
|
}
|
|
18
18
|
acc += currentExecutionStep ? currentExecutionStep.gateCount : 0;
|
|
19
19
|
log(format(' - ', fn.functionName.padEnd(FN_NAME_PADDING), `${fn.time.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), currentExecutionStep ? currentExecutionStep.gateCount.toLocaleString().padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '', currentExecutionStep ? acc.toLocaleString().padStart(COLUMN_MAX_WIDTH) : ''));
|
|
20
|
-
if (
|
|
20
|
+
if (fn.oracles) {
|
|
21
21
|
log('');
|
|
22
22
|
for (const [oracleName, { times }] of Object.entries(fn.oracles)){
|
|
23
23
|
const calls = times.length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-staging.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -67,17 +67,17 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/accounts": "1.0.0-
|
|
71
|
-
"@aztec/aztec.js": "1.0.0-
|
|
72
|
-
"@aztec/cli": "1.0.0-
|
|
73
|
-
"@aztec/entrypoints": "1.0.0-
|
|
74
|
-
"@aztec/ethereum": "1.0.0-
|
|
75
|
-
"@aztec/foundation": "1.0.0-
|
|
76
|
-
"@aztec/kv-store": "1.0.0-
|
|
77
|
-
"@aztec/noir-contracts.js": "1.0.0-
|
|
78
|
-
"@aztec/noir-noirc_abi": "1.0.0-
|
|
79
|
-
"@aztec/pxe": "1.0.0-
|
|
80
|
-
"@aztec/stdlib": "1.0.0-
|
|
70
|
+
"@aztec/accounts": "1.0.0-staging.0",
|
|
71
|
+
"@aztec/aztec.js": "1.0.0-staging.0",
|
|
72
|
+
"@aztec/cli": "1.0.0-staging.0",
|
|
73
|
+
"@aztec/entrypoints": "1.0.0-staging.0",
|
|
74
|
+
"@aztec/ethereum": "1.0.0-staging.0",
|
|
75
|
+
"@aztec/foundation": "1.0.0-staging.0",
|
|
76
|
+
"@aztec/kv-store": "1.0.0-staging.0",
|
|
77
|
+
"@aztec/noir-contracts.js": "1.0.0-staging.0",
|
|
78
|
+
"@aztec/noir-noirc_abi": "1.0.0-staging.0",
|
|
79
|
+
"@aztec/pxe": "1.0.0-staging.0",
|
|
80
|
+
"@aztec/stdlib": "1.0.0-staging.0",
|
|
81
81
|
"commander": "^12.1.0",
|
|
82
82
|
"inquirer": "^10.1.8",
|
|
83
83
|
"source-map-support": "^0.5.21",
|
package/src/cmds/deploy.ts
CHANGED
|
@@ -23,7 +23,6 @@ export async function deploy(
|
|
|
23
23
|
wait: boolean,
|
|
24
24
|
feeOpts: IFeeOpts,
|
|
25
25
|
verbose: boolean,
|
|
26
|
-
timeout: number = DEFAULT_TX_TIMEOUT_S,
|
|
27
26
|
debugLogger: Logger,
|
|
28
27
|
log: LogFn,
|
|
29
28
|
logJson: (output: any) => void,
|
|
@@ -73,7 +72,7 @@ export async function deploy(
|
|
|
73
72
|
const txHash = await tx.getTxHash();
|
|
74
73
|
debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
|
|
75
74
|
if (wait) {
|
|
76
|
-
const deployed = await tx.wait({ timeout });
|
|
75
|
+
const deployed = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
77
76
|
const { address, partialAddress, instance } = deployed.contract;
|
|
78
77
|
if (json) {
|
|
79
78
|
logJson({
|
package/src/cmds/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CopyCatAccountWallet } from '@aztec/accounts/copy-cat';
|
|
2
1
|
import { getIdentities } from '@aztec/accounts/utils';
|
|
3
2
|
import { createCompatibleClient } from '@aztec/aztec.js/rpc';
|
|
4
3
|
import { TxHash } from '@aztec/aztec.js/tx_hash';
|
|
@@ -213,12 +212,6 @@ export function injectCommands(
|
|
|
213
212
|
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction')
|
|
214
213
|
.option('--no-class-registration', "Don't register this contract class")
|
|
215
214
|
.option('--no-public-deployment', "Don't emit this contract's public bytecode")
|
|
216
|
-
.addOption(
|
|
217
|
-
new Option(
|
|
218
|
-
'--timeout <number>',
|
|
219
|
-
'The amount of time in seconds to wait for the deployment to post to L2',
|
|
220
|
-
).conflicts('wait'),
|
|
221
|
-
)
|
|
222
215
|
.addOption(createVerboseOption());
|
|
223
216
|
|
|
224
217
|
addOptions(deployCommand, FeeOpts.getOptions()).action(async (artifactPathPromise, _options, command) => {
|
|
@@ -238,7 +231,6 @@ export function injectCommands(
|
|
|
238
231
|
rpcUrl,
|
|
239
232
|
from: parsedFromAddress,
|
|
240
233
|
alias,
|
|
241
|
-
timeout,
|
|
242
234
|
verbose,
|
|
243
235
|
} = options;
|
|
244
236
|
const client = (await pxeWrapper?.getPXE()) ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
@@ -262,7 +254,6 @@ export function injectCommands(
|
|
|
262
254
|
universal,
|
|
263
255
|
wait,
|
|
264
256
|
await FeeOpts.fromCli(options, client, log, db),
|
|
265
|
-
timeout,
|
|
266
257
|
verbose,
|
|
267
258
|
debugLogger,
|
|
268
259
|
log,
|
|
@@ -373,8 +364,7 @@ export function injectCommands(
|
|
|
373
364
|
|
|
374
365
|
const client = (await pxeWrapper?.getPXE()) ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
375
366
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
376
|
-
const
|
|
377
|
-
const wallet = await CopyCatAccountWallet.create(client, originalWallet);
|
|
367
|
+
const wallet = await account.getWallet();
|
|
378
368
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
379
369
|
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
380
370
|
await simulate(
|
package/src/cmds/profile.ts
CHANGED
|
@@ -31,7 +31,7 @@ export async function profile(
|
|
|
31
31
|
authWitnesses,
|
|
32
32
|
skipProofGeneration: false,
|
|
33
33
|
});
|
|
34
|
-
printProfileResult(result.stats, log,
|
|
34
|
+
printProfileResult(result.stats, log, result.executionSteps);
|
|
35
35
|
if (debugOutputPath) {
|
|
36
36
|
const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
|
|
37
37
|
log(`Debug output written to ${ivcInputsPath}.`);
|
package/src/cmds/simulate.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
4
4
|
|
|
5
5
|
import { format } from 'util';
|
|
6
6
|
|
|
7
|
-
import { printAuthorizations } from '../utils/authorizations.js';
|
|
8
7
|
import type { IFeeOpts } from '../utils/options/fees.js';
|
|
9
8
|
import { printProfileResult } from '../utils/profiling.js';
|
|
10
9
|
|
|
@@ -29,21 +28,6 @@ export async function simulate(
|
|
|
29
28
|
includeMetadata: true,
|
|
30
29
|
});
|
|
31
30
|
if (verbose) {
|
|
32
|
-
await printAuthorizations(
|
|
33
|
-
simulationResult.offchainEffects!,
|
|
34
|
-
async (address: AztecAddress) => {
|
|
35
|
-
const metadata = await wallet.getContractMetadata(address);
|
|
36
|
-
if (!metadata.contractInstance) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
const classMetadata = await wallet.getContractClassMetadata(
|
|
40
|
-
metadata.contractInstance.currentContractClassId,
|
|
41
|
-
true,
|
|
42
|
-
);
|
|
43
|
-
return classMetadata.artifact;
|
|
44
|
-
},
|
|
45
|
-
log,
|
|
46
|
-
);
|
|
47
31
|
printProfileResult(simulationResult.stats!, log);
|
|
48
32
|
}
|
|
49
33
|
log(format('\nSimulation result: ', simulationResult.result, '\n'));
|
package/src/utils/profiling.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ProvingStats, ProvingTimings, SimulationStats, SimulationTimings }
|
|
|
4
4
|
|
|
5
5
|
import { format } from 'util';
|
|
6
6
|
|
|
7
|
-
const FN_NAME_PADDING =
|
|
7
|
+
const FN_NAME_PADDING = 50;
|
|
8
8
|
const COLUMN_MIN_WIDTH = 13;
|
|
9
9
|
const COLUMN_MAX_WIDTH = 15;
|
|
10
10
|
|
|
@@ -13,7 +13,6 @@ const ORACLE_NAME_PADDING = 50;
|
|
|
13
13
|
export function printProfileResult(
|
|
14
14
|
stats: ProvingStats | SimulationStats,
|
|
15
15
|
log: LogFn,
|
|
16
|
-
printOracles: boolean = false,
|
|
17
16
|
executionSteps?: PrivateExecutionStep[],
|
|
18
17
|
) {
|
|
19
18
|
log(format('\nPer circuit breakdown:\n'));
|
|
@@ -59,7 +58,7 @@ export function printProfileResult(
|
|
|
59
58
|
currentExecutionStep ? acc.toLocaleString().padStart(COLUMN_MAX_WIDTH) : '',
|
|
60
59
|
),
|
|
61
60
|
);
|
|
62
|
-
if (
|
|
61
|
+
if (fn.oracles) {
|
|
63
62
|
log('');
|
|
64
63
|
for (const [oracleName, { times }] of Object.entries(fn.oracles)) {
|
|
65
64
|
const calls = times.length;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type AztecAddress, type ContractArtifact } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import type { OffchainEffect } from '@aztec/stdlib/tx';
|
|
4
|
-
export declare function printAuthorizations(offchainEffects: OffchainEffect[], artifactRetriever: (address: AztecAddress) => Promise<ContractArtifact | undefined>, log: LogFn): Promise<void>;
|
|
5
|
-
//# sourceMappingURL=authorizations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorizations.d.ts","sourceRoot":"","sources":["../../src/utils/authorizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAA4B,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD,wBAAsB,mBAAmB,CACvC,eAAe,EAAE,cAAc,EAAE,EACjC,iBAAiB,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,EACnF,GAAG,EAAE,KAAK,iBAsCX"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { CallAuthorizationRequest } from '@aztec/aztec.js';
|
|
2
|
-
import { decodeFromAbi, getFunctionArtifact } from '@aztec/stdlib/abi';
|
|
3
|
-
import { format } from 'util';
|
|
4
|
-
export async function printAuthorizations(offchainEffects, artifactRetriever, log) {
|
|
5
|
-
log(format('\nAuthorizations requested by the tx:\n'));
|
|
6
|
-
const callAuthorizationSelector = await CallAuthorizationRequest.getSelector();
|
|
7
|
-
const callAuthorizationEffects = offchainEffects.filter((effect)=>effect.data[0].equals(callAuthorizationSelector.toField()));
|
|
8
|
-
for (const callAuthorizationEffect of callAuthorizationEffects){
|
|
9
|
-
const callAuthorizationRequest = await CallAuthorizationRequest.fromFields(callAuthorizationEffect.data);
|
|
10
|
-
const artifact = await artifactRetriever(callAuthorizationEffect.contractAddress);
|
|
11
|
-
if (!artifact) {
|
|
12
|
-
log(format(' -', `Call authorization. Inner hash: ${callAuthorizationRequest.innerHash.toString()}\n`));
|
|
13
|
-
log(format(' ', `Contract: unknown@${callAuthorizationEffect.contractAddress}`));
|
|
14
|
-
log(format(' ', `${callAuthorizationRequest.functionSelector.toString()}(\n${callAuthorizationRequest.args.map((arg)=>` ${arg.toString()}`).join(',\n')}\n )`));
|
|
15
|
-
} else {
|
|
16
|
-
const functionAbi = await getFunctionArtifact(artifact, callAuthorizationRequest.functionSelector);
|
|
17
|
-
const callData = decodeFromAbi(functionAbi.parameters.map((param)=>param.type), callAuthorizationRequest.args);
|
|
18
|
-
const parameters = functionAbi.parameters.map((param, i)=>({
|
|
19
|
-
name: param.name,
|
|
20
|
-
value: callData[i]
|
|
21
|
-
}));
|
|
22
|
-
log(format(' -', `Call authorization. Inner hash: ${callAuthorizationRequest.innerHash.toString()}`));
|
|
23
|
-
log(format(' ', `Contract: ${artifact.name}@${callAuthorizationEffect.contractAddress}`));
|
|
24
|
-
log(format(' ', /* eslint-disable-next-line @typescript-eslint/no-base-to-string */ `${functionAbi.name}(\n${parameters.map((p)=>` ${p.name}: ${p.value}`).join(',\n')}\n )`));
|
|
25
|
-
}
|
|
26
|
-
log(`\n`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type AztecAddress, CallAuthorizationRequest, type ContractArtifact } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import { type AbiDecoded, decodeFromAbi, getFunctionArtifact } from '@aztec/stdlib/abi';
|
|
4
|
-
import type { OffchainEffect } from '@aztec/stdlib/tx';
|
|
5
|
-
|
|
6
|
-
import { format } from 'util';
|
|
7
|
-
|
|
8
|
-
export async function printAuthorizations(
|
|
9
|
-
offchainEffects: OffchainEffect[],
|
|
10
|
-
artifactRetriever: (address: AztecAddress) => Promise<ContractArtifact | undefined>,
|
|
11
|
-
log: LogFn,
|
|
12
|
-
) {
|
|
13
|
-
log(format('\nAuthorizations requested by the tx:\n'));
|
|
14
|
-
const callAuthorizationSelector = await CallAuthorizationRequest.getSelector();
|
|
15
|
-
const callAuthorizationEffects = offchainEffects.filter(effect =>
|
|
16
|
-
effect.data[0].equals(callAuthorizationSelector.toField()),
|
|
17
|
-
);
|
|
18
|
-
for (const callAuthorizationEffect of callAuthorizationEffects) {
|
|
19
|
-
const callAuthorizationRequest = await CallAuthorizationRequest.fromFields(callAuthorizationEffect.data);
|
|
20
|
-
const artifact = await artifactRetriever(callAuthorizationEffect.contractAddress);
|
|
21
|
-
if (!artifact) {
|
|
22
|
-
log(format(' -', `Call authorization. Inner hash: ${callAuthorizationRequest.innerHash.toString()}\n`));
|
|
23
|
-
log(format(' ', `Contract: unknown@${callAuthorizationEffect.contractAddress}`));
|
|
24
|
-
log(
|
|
25
|
-
format(
|
|
26
|
-
' ',
|
|
27
|
-
`${callAuthorizationRequest.functionSelector.toString()}(\n${callAuthorizationRequest.args.map(arg => ` ${arg.toString()}`).join(',\n')}\n )`,
|
|
28
|
-
),
|
|
29
|
-
);
|
|
30
|
-
} else {
|
|
31
|
-
const functionAbi = await getFunctionArtifact(artifact, callAuthorizationRequest.functionSelector);
|
|
32
|
-
const callData = decodeFromAbi(
|
|
33
|
-
functionAbi.parameters.map(param => param.type),
|
|
34
|
-
callAuthorizationRequest.args,
|
|
35
|
-
) as AbiDecoded[];
|
|
36
|
-
const parameters = functionAbi.parameters.map((param, i) => ({ name: param.name, value: callData[i] }));
|
|
37
|
-
log(format(' -', `Call authorization. Inner hash: ${callAuthorizationRequest.innerHash.toString()}`));
|
|
38
|
-
log(format(' ', `Contract: ${artifact.name}@${callAuthorizationEffect.contractAddress}`));
|
|
39
|
-
log(
|
|
40
|
-
format(
|
|
41
|
-
' ',
|
|
42
|
-
/* eslint-disable-next-line @typescript-eslint/no-base-to-string */
|
|
43
|
-
`${functionAbi.name}(\n${parameters.map(p => ` ${p.name}: ${p.value}`).join(',\n')}\n )`,
|
|
44
|
-
),
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
log(`\n`);
|
|
48
|
-
}
|
|
49
|
-
}
|