@aztec/cli-wallet 0.81.0 → 0.82.1-alpha-testnet.1
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/cancel_tx.d.ts.map +1 -1
- package/dest/cmds/cancel_tx.js +2 -3
- package/dest/cmds/create_account.js +2 -2
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +1 -1
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +3 -3
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +30 -26
- package/dest/cmds/profile.d.ts +4 -0
- package/dest/cmds/profile.d.ts.map +1 -0
- package/dest/cmds/profile.js +47 -0
- package/dest/cmds/send.d.ts +2 -2
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +10 -10
- package/dest/cmds/simulate.d.ts +2 -2
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +5 -19
- package/dest/utils/accounts.d.ts +1 -3
- package/dest/utils/accounts.d.ts.map +1 -1
- package/dest/utils/accounts.js +0 -33
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +2 -1
- package/dest/utils/options/options.d.ts +5 -3
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +12 -3
- package/package.json +13 -10
- package/src/cmds/cancel_tx.ts +3 -4
- package/src/cmds/create_account.ts +2 -2
- package/src/cmds/deploy.ts +3 -3
- package/src/cmds/deploy_account.ts +3 -2
- package/src/cmds/index.ts +66 -43
- package/src/cmds/profile.ts +71 -0
- package/src/cmds/send.ts +20 -4
- package/src/cmds/simulate.ts +4 -24
- package/src/utils/accounts.ts +1 -31
- package/src/utils/options/fees.ts +2 -1
- package/src/utils/options/options.ts +18 -7
- package/dest/cmds/add_authwit.d.ts +0 -4
- package/dest/cmds/add_authwit.d.ts.map +0 -1
- package/dest/cmds/add_authwit.js +0 -4
- package/dest/utils/sponsored_fee_payment.d.ts +0 -19
- package/dest/utils/sponsored_fee_payment.d.ts.map +0 -1
- package/dest/utils/sponsored_fee_payment.js +0 -26
- package/src/cmds/add_authwit.ts +0 -13
- package/src/utils/sponsored_fee_payment.ts +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/cancel_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,gBAAgB,EAAU,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"cancel_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/cancel_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,gBAAgB,EAAU,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAGxH,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEzD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,0BAA0B,EAClC,EACE,MAAM,EACN,WAAW,EAAE,iBAAiB,EAC9B,KAAK,EACL,WAAW,GACZ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,EAAE,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,EAChF,aAAa,EAAE,gBAAgB,EAC/B,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GAAG,SAAS,EAClC,GAAG,EAAE,KAAK,iBA0CX"}
|
package/dest/cmds/cancel_tx.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SentTx, TxStatus } from '@aztec/aztec.js';
|
|
2
|
+
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
3
|
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
3
4
|
export async function cancelTx(wallet, { txHash, gasSettings: prevTxGasSettings, nonce, cancellable }, paymentMethod, increasedFees, maxFeesPerGas, log) {
|
|
4
5
|
const receipt = await wallet.getTxReceipt(txHash);
|
|
@@ -15,9 +16,7 @@ export async function cancelTx(wallet, { txHash, gasSettings: prevTxGasSettings,
|
|
|
15
16
|
maxFeesPerGas: maxFeesPerGas ?? prevTxGasSettings.maxFeesPerGas
|
|
16
17
|
})
|
|
17
18
|
};
|
|
18
|
-
const txRequest = await wallet.createTxExecutionRequest({
|
|
19
|
-
calls: [],
|
|
20
|
-
fee,
|
|
19
|
+
const txRequest = await wallet.createTxExecutionRequest(ExecutionPayload.empty(), fee, {
|
|
21
20
|
nonce,
|
|
22
21
|
cancellable: true
|
|
23
22
|
});
|
|
@@ -5,7 +5,7 @@ import { printGasEstimates } from '../utils/options/fees.js';
|
|
|
5
5
|
export async function createAccount(client, accountType, secretKey, publicKey, alias, registerOnly, publicDeploy, skipInitialization, wait, feeOpts, json, debugLogger, log) {
|
|
6
6
|
secretKey ??= Fr.random();
|
|
7
7
|
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
|
-
const salt = account.getInstance()
|
|
8
|
+
const { salt } = account.getInstance();
|
|
9
9
|
const { address, publicKeys, partialAddress } = await account.getCompleteAddress();
|
|
10
10
|
const out = {};
|
|
11
11
|
if (json) {
|
|
@@ -43,7 +43,7 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
43
43
|
...await feeOpts.toDeployAccountOpts(wallet)
|
|
44
44
|
};
|
|
45
45
|
if (feeOpts.estimateOnly) {
|
|
46
|
-
const gas = await
|
|
46
|
+
const gas = await account.estimateDeploymentGas(deployOpts);
|
|
47
47
|
if (json) {
|
|
48
48
|
out.fee = {
|
|
49
49
|
gasLimits: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,EAAE,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtH,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;AAE5E,wBAAsB,MAAM,CAC1B,MAAM,EAAE,GAAG,EACX,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,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,+DAiF/B"}
|
package/dest/cmds/deploy.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function deploy(client, wallet, artifactPath, json, publicKeys, raw
|
|
|
20
20
|
}
|
|
21
21
|
const deploy = deployer.deploy(...args);
|
|
22
22
|
const deployOpts = {
|
|
23
|
-
...await feeOpts.
|
|
23
|
+
...await feeOpts.toDeployAccountOpts(wallet),
|
|
24
24
|
contractAddressSalt: salt,
|
|
25
25
|
universalDeploy,
|
|
26
26
|
skipClassRegistration,
|
|
@@ -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;AAE5E,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;
|
|
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;AAE5E,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;GAgFX"}
|
|
@@ -27,11 +27,11 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
|
|
|
27
27
|
let tx;
|
|
28
28
|
let txReceipt;
|
|
29
29
|
const deployOpts = {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
skipInitialization: false,
|
|
31
|
+
...await feeOpts.toDeployAccountOpts(wallet)
|
|
32
32
|
};
|
|
33
33
|
if (feeOpts.estimateOnly) {
|
|
34
|
-
const gas = await
|
|
34
|
+
const gas = await account.estimateDeploymentGas(deployOpts);
|
|
35
35
|
if (json) {
|
|
36
36
|
out.fee = {
|
|
37
37
|
gasLimits: {
|
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;AAuBxD,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,WAmmBxB"}
|
package/dest/cmds/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { GasFees } from '@aztec/stdlib/gas';
|
|
|
6
6
|
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
7
7
|
import { Option } from 'commander';
|
|
8
8
|
import inquirer from 'inquirer';
|
|
9
|
-
import {
|
|
9
|
+
import { createOrRetrieveAccount } from '../utils/accounts.js';
|
|
10
10
|
import { FeeOpts, FeeOptsWithFeePayer } from '../utils/options/fees.js';
|
|
11
|
-
import { ARTIFACT_DESCRIPTION, aliasedAddressParser,
|
|
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';
|
|
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) {
|
|
@@ -72,7 +72,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
72
72
|
const { json, publicKey, args, salt, wait, secretKey, classRegistration, init, publicDeployment, universal, rpcUrl, from: parsedFromAddress, alias } = options;
|
|
73
73
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
74
74
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
75
|
-
const wallet = await
|
|
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
78
|
const address = await deploy(client, 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));
|
|
@@ -80,31 +80,44 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
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(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', !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.');
|
|
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 } = options;
|
|
87
|
+
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, wait, rpcUrl, secretKey, alias, cancel, authWitness } = options;
|
|
88
88
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
89
89
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
90
|
-
const wallet = await
|
|
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
|
-
const
|
|
93
|
+
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
94
|
+
const sentTx = await send(wallet, functionName, args, artifactPath, contractAddress, wait, cancel, await FeeOpts.fromCli(options, client, log, db), authWitnesses, log);
|
|
94
95
|
if (db && sentTx) {
|
|
95
96
|
const txAlias = alias ? alias : `${functionName}-${sentTx.nonce.toString().slice(-4)}`;
|
|
96
97
|
await db.storeTx(sentTx, log, txAlias);
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
|
-
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(createAccountOption('Alias or address of the account to simulate from', !db, db)).
|
|
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)).action(async (functionName, _options, command)=>{
|
|
100
101
|
const { simulate } = await import('./simulate.js');
|
|
101
102
|
const options = command.optsWithGlobals();
|
|
102
|
-
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey,
|
|
103
|
+
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, authWitness } = options;
|
|
103
104
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
104
105
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
105
|
-
const wallet = await
|
|
106
|
+
const wallet = await account.getWallet();
|
|
106
107
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
107
|
-
|
|
108
|
+
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
109
|
+
await simulate(wallet, functionName, args, artifactPath, contractAddress, authWitnesses, log);
|
|
110
|
+
});
|
|
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)).action(async (functionName, _options, command)=>{
|
|
112
|
+
const { profile } = await import('./profile.js');
|
|
113
|
+
const options = command.optsWithGlobals();
|
|
114
|
+
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, debugExecutionStepsDir, authWitness } = options;
|
|
115
|
+
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
116
|
+
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
117
|
+
const wallet = await account.getWallet();
|
|
118
|
+
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
119
|
+
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
120
|
+
await profile(wallet, functionName, args, artifactPath, contractAddress, debugExecutionStepsDir, authWitnesses, log);
|
|
108
121
|
});
|
|
109
122
|
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(','), [
|
|
110
123
|
ETHEREUM_HOSTS
|
|
@@ -114,6 +127,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
114
127
|
const { bridgeL1FeeJuice } = await import('./bridge_fee_juice.js');
|
|
115
128
|
const { rpcUrl, l1ChainId, l1RpcUrls, l1PrivateKey, mnemonic, mint, json, wait, interval: intervalS } = options;
|
|
116
129
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
130
|
+
log(`Minting ${amount} fee juice on L1 and pushing to L2`);
|
|
117
131
|
const [secret, messageLeafIndex] = await bridgeL1FeeJuice(amount, recipient, client, l1RpcUrls, l1ChainId, l1PrivateKey, mnemonic, mint, json, wait, intervalS * 1000, log, debugLogger);
|
|
118
132
|
if (db) {
|
|
119
133
|
await db.pushBridgedFeeJuice(recipient, secret, amount, messageLeafIndex, log);
|
|
@@ -125,7 +139,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
125
139
|
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey, alias } = options;
|
|
126
140
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
127
141
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
128
|
-
const wallet = await
|
|
142
|
+
const wallet = await account.getWallet();
|
|
129
143
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
130
144
|
const witness = await createAuthwit(wallet, functionName, caller, args, artifactPath, contractAddress, log);
|
|
131
145
|
if (db) {
|
|
@@ -138,20 +152,10 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
138
152
|
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, rpcUrl, secretKey } = options;
|
|
139
153
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
140
154
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
141
|
-
const wallet = await
|
|
155
|
+
const wallet = await account.getWallet();
|
|
142
156
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
143
157
|
await authorizeAction(wallet, functionName, caller, args, artifactPath, contractAddress, log);
|
|
144
158
|
});
|
|
145
|
-
program.command('add-authwit').description('Adds an authorization witness to the provided account, granting PXE access to the notes of the authorizer so that it can be verified').argument('<authwit>', 'Authorization witness to add to the account', (witness)=>aliasedAuthWitParser(witness, db)).argument('<authorizer>', 'Account that provides the authorization to perform the action', (address)=>aliasedAddressParser('accounts', address, 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(createAliasOption('Alias for the authorization witness. Used for easy reference in subsequent commands.', !db)).action(async (authwit, authorizer, _options, command)=>{
|
|
146
|
-
const { addAuthwit } = await import('./add_authwit.js');
|
|
147
|
-
const options = command.optsWithGlobals();
|
|
148
|
-
const { from: parsedFromAddress, rpcUrl, secretKey } = options;
|
|
149
|
-
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
150
|
-
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
151
|
-
const wallet = await getWalletWithScopes(account, db);
|
|
152
|
-
await addAuthwit(wallet, authwit, authorizer, log);
|
|
153
|
-
await addScopeToWallet(wallet, authorizer, db);
|
|
154
|
-
});
|
|
155
159
|
program.command('get-tx').description('Gets the status of the recent txs, or a detailed view if a specific transaction hash is provided').argument('[txHash]', 'A transaction hash to get the receipt for.', (txHash)=>aliasedTxHashParser(txHash, db)).addOption(pxeOption).option('-p, --page <number>', 'The page number to display', (value)=>integerArgParser(value, '--page', 1), 1).option('-s, --page-size <number>', 'The number of transactions to display per page', (value)=>integerArgParser(value, '--page-size', 1), 10).action(async (txHash, options)=>{
|
|
156
160
|
const { checkTx } = await import('./check_tx.js');
|
|
157
161
|
const { rpcUrl, pageSize } = options;
|
|
@@ -187,7 +191,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
187
191
|
const { from: parsedFromAddress, rpcUrl, secretKey, payment, increasedFees, maxFeesPerGas } = options;
|
|
188
192
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
189
193
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
190
|
-
const wallet = await
|
|
194
|
+
const wallet = await account.getWallet();
|
|
191
195
|
const txData = await db?.retrieveTxData(txHash);
|
|
192
196
|
if (!txData) {
|
|
193
197
|
throw new Error('Transaction data not found in the database, cannot reuse nonce');
|
|
@@ -200,7 +204,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
200
204
|
const { from: parsedFromAddress, rpcUrl, secretKey, alias } = options;
|
|
201
205
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
202
206
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
203
|
-
const wallet = await
|
|
207
|
+
const wallet = await account.getWallet();
|
|
204
208
|
await registerSender(wallet, address, log);
|
|
205
209
|
if (db && alias) {
|
|
206
210
|
await db.storeSender(address, alias, log);
|
|
@@ -212,7 +216,7 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
212
216
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
213
217
|
const node = pxeWrapper?.getNode() ?? createAztecNodeClient(nodeUrl);
|
|
214
218
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
215
|
-
const wallet = await
|
|
219
|
+
const wallet = await account.getWallet();
|
|
216
220
|
const artifactPath = await artifactPathPromise;
|
|
217
221
|
const instance = await registerContract(wallet, node, address, artifactPath, log);
|
|
218
222
|
if (db && alias) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress } from '@aztec/aztec.js';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
export declare function profile(wallet: AccountWalletWithSecretKey, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, debugOutputPath: string | undefined, authWitnesses: AuthWitness[], log: LogFn): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -0,0 +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;AA8CnD,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,aAAa,EAAE,WAAW,EAAE,EAC5B,GAAG,EAAE,KAAK,iBAcX"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Contract } from '@aztec/aztec.js';
|
|
2
|
+
import { prepTx } from '@aztec/cli/utils';
|
|
3
|
+
import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
4
|
+
import { encode } from '@msgpack/msgpack';
|
|
5
|
+
import { promises as fs } from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { format } from 'util';
|
|
8
|
+
function printProfileResult(result, log) {
|
|
9
|
+
// TODO(AD): this is a bit misleading - the maximum gate count of any piece is as important
|
|
10
|
+
// as the total gate count. We should probably print both.
|
|
11
|
+
log(format('\nGate count per circuit:'));
|
|
12
|
+
let acc = 0;
|
|
13
|
+
result.executionSteps.forEach((r)=>{
|
|
14
|
+
acc += r.gateCount;
|
|
15
|
+
log(format(' ', r.functionName.padEnd(50), 'Gates:', r.gateCount.toLocaleString(), '\tSubtotal:', acc.toLocaleString()));
|
|
16
|
+
});
|
|
17
|
+
log(format('\nTotal gates:', acc.toLocaleString()));
|
|
18
|
+
}
|
|
19
|
+
// TODO(#7371): This is duplicated.
|
|
20
|
+
// Longer term we won't use this hacked together msgpack format
|
|
21
|
+
// Leaving duplicated as this eventually bb will provide a serialization
|
|
22
|
+
// helper for passing to a generic msgpack RPC endpoint.
|
|
23
|
+
async function _createClientIvcProofFiles(directory, executionSteps) {
|
|
24
|
+
const acirPath = path.join(directory, 'acir.msgpack');
|
|
25
|
+
const witnessPath = path.join(directory, 'witnesses.msgpack');
|
|
26
|
+
await fs.writeFile(acirPath, encode(executionSteps.map((map)=>map.bytecode)));
|
|
27
|
+
await fs.writeFile(witnessPath, encode(executionSteps.map((map)=>serializeWitness(map.witness))));
|
|
28
|
+
return {
|
|
29
|
+
acirPath,
|
|
30
|
+
witnessPath
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export async function profile(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, debugOutputPath, authWitnesses, log) {
|
|
34
|
+
const profileMode = debugOutputPath ? 'full' : 'gates';
|
|
35
|
+
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
36
|
+
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
37
|
+
const call = contract.methods[functionName](...functionArgs);
|
|
38
|
+
const result = await call.profile({
|
|
39
|
+
profileMode,
|
|
40
|
+
authWitnesses
|
|
41
|
+
});
|
|
42
|
+
printProfileResult(result, log);
|
|
43
|
+
if (debugOutputPath) {
|
|
44
|
+
log(`Debug output written to ${debugOutputPath} (witnesses.msgpack and acir.msgpack)`);
|
|
45
|
+
await _createClientIvcProofFiles(debugOutputPath, result.executionSteps);
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dest/cmds/send.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type AccountWalletWithSecretKey, type AztecAddress, Fr } from '@aztec/aztec.js';
|
|
1
|
+
import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress, Fr } from '@aztec/aztec.js';
|
|
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, 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[], 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,
|
|
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;AAE5E,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,GAAG,EAAE,KAAK;;;;;eAqDX"}
|
package/dest/cmds/send.js
CHANGED
|
@@ -2,23 +2,23 @@ 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
|
-
export async function send(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, log) {
|
|
5
|
+
export async function send(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, authWitnesses, log) {
|
|
6
6
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
7
7
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
8
8
|
const call = contract.methods[functionName](...functionArgs);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const nonce = Fr.random();
|
|
10
|
+
const sendOptions = {
|
|
11
|
+
...await feeOpts.toSendOpts(wallet),
|
|
12
|
+
authWitnesses,
|
|
13
|
+
cancellable,
|
|
14
|
+
nonce
|
|
15
|
+
};
|
|
16
|
+
const gasLimits = await call.estimateGas(sendOptions);
|
|
12
17
|
printGasEstimates(feeOpts, gasLimits, log);
|
|
13
18
|
if (feeOpts.estimateOnly) {
|
|
14
19
|
return;
|
|
15
20
|
}
|
|
16
|
-
const
|
|
17
|
-
const tx = call.send({
|
|
18
|
-
...await feeOpts.toSendOpts(wallet),
|
|
19
|
-
nonce,
|
|
20
|
-
cancellable
|
|
21
|
-
});
|
|
21
|
+
const tx = call.send(sendOptions);
|
|
22
22
|
const txHash = await tx.getTxHash();
|
|
23
23
|
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
24
24
|
if (wait) {
|
package/dest/cmds/simulate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AccountWalletWithSecretKey, type AztecAddress } from '@aztec/aztec.js';
|
|
1
|
+
import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress } from '@aztec/aztec.js';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
export declare function simulate(wallet: AccountWalletWithSecretKey, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress,
|
|
3
|
+
export declare function simulate(wallet: AccountWalletWithSecretKey, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, authWitnesses: AuthWitness[], log: LogFn): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=simulate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../src/cmds/simulate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,YAAY,
|
|
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,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,aAAa,EAAE,WAAW,EAAE,EAC5B,GAAG,EAAE,KAAK,iBAQX"}
|
package/dest/cmds/simulate.js
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import { Contract } from '@aztec/aztec.js';
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
3
|
import { format } from 'util';
|
|
4
|
-
function
|
|
5
|
-
log(format('\nSimulation result:'));
|
|
6
|
-
log(format('Return value:', JSON.stringify(result.returnValues, null, 2)));
|
|
7
|
-
log(format('\nGate count per circuit:'));
|
|
8
|
-
let acc = 0;
|
|
9
|
-
result.gateCounts.forEach((r)=>{
|
|
10
|
-
acc += r.gateCount;
|
|
11
|
-
log(format(' ', r.circuitName.padEnd(50), 'Gates:', r.gateCount.toLocaleString(), '\tAcc:', acc.toLocaleString()));
|
|
12
|
-
});
|
|
13
|
-
log(format('\nTotal gates:', acc.toLocaleString()));
|
|
14
|
-
}
|
|
15
|
-
export async function simulate(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, profile, log) {
|
|
4
|
+
export async function simulate(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, authWitnesses, log) {
|
|
16
5
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
17
6
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
18
7
|
const call = contract.methods[functionName](...functionArgs);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const result = await call.simulate();
|
|
24
|
-
log(format('\nSimulation result: ', result, '\n'));
|
|
25
|
-
}
|
|
8
|
+
const result = await call.simulate({
|
|
9
|
+
authWitnesses
|
|
10
|
+
});
|
|
11
|
+
log(format('\nSimulation result: ', result, '\n'));
|
|
26
12
|
}
|
package/dest/utils/accounts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccountManager
|
|
1
|
+
import type { AccountManager } from '@aztec/aztec.js';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
@@ -6,6 +6,4 @@ import type { WalletDB } from '../storage/wallet_db.js';
|
|
|
6
6
|
export declare const AccountTypes: readonly ["schnorr", "ecdsasecp256r1ssh", "ecdsasecp256k1"];
|
|
7
7
|
export type AccountType = (typeof AccountTypes)[number];
|
|
8
8
|
export declare function createOrRetrieveAccount(pxe: PXE, address?: AztecAddress, db?: WalletDB, secretKey?: Fr, type?: AccountType, salt?: Fr, publicKey?: string | undefined): Promise<AccountManager>;
|
|
9
|
-
export declare function addScopeToWallet(wallet: AccountWalletWithSecretKey, scope: AztecAddress, db?: WalletDB): Promise<void>;
|
|
10
|
-
export declare function getWalletWithScopes(account: AccountManager, db?: WalletDB): Promise<AccountWalletWithSecretKey>;
|
|
11
9
|
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/utils/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/utils/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,eAAO,MAAM,YAAY,6DAA8D,CAAC;AACxF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,OAAO,CAAC,EAAE,YAAY,EACtB,EAAE,CAAC,EAAE,QAAQ,EACb,SAAS,CAAC,EAAE,EAAE,EACd,IAAI,GAAE,WAAuB,EAC7B,IAAI,CAAC,EAAE,EAAE,EACT,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,CAAC,cAAc,CAAC,CAkDzB"}
|
package/dest/utils/accounts.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getIdentities } from '@aztec/accounts/utils';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
3
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
5
4
|
import { extractECDSAPublicKeyFromBase64String } from './ecdsa.js';
|
|
6
5
|
export const AccountTypes = [
|
|
@@ -53,35 +52,3 @@ export async function createOrRetrieveAccount(pxe, address, db, secretKey, type
|
|
|
53
52
|
}
|
|
54
53
|
return account;
|
|
55
54
|
}
|
|
56
|
-
export async function addScopeToWallet(wallet, scope, db) {
|
|
57
|
-
const address = wallet.getAddress().toString();
|
|
58
|
-
const currentScopes = wallet.getScopes() ?? [];
|
|
59
|
-
const deduplicatedScopes = Array.from(new Set([
|
|
60
|
-
address,
|
|
61
|
-
...currentScopes,
|
|
62
|
-
scope
|
|
63
|
-
].map((scope)=>scope.toString())).values());
|
|
64
|
-
if (db) {
|
|
65
|
-
await db.storeAccountMetadata(wallet.getAddress(), 'scopes', Buffer.from(deduplicatedScopes.join(',')));
|
|
66
|
-
}
|
|
67
|
-
wallet.setScopes(deduplicatedScopes.map((scope)=>AztecAddress.fromString(scope)));
|
|
68
|
-
}
|
|
69
|
-
export async function getWalletWithScopes(account, db) {
|
|
70
|
-
const wallet = await account.getWallet();
|
|
71
|
-
if (db) {
|
|
72
|
-
const address = wallet.getAddress().toString();
|
|
73
|
-
let storedScopes = [];
|
|
74
|
-
try {
|
|
75
|
-
storedScopes = (await db.retrieveAccountMetadata(wallet.getAddress(), 'scopes') ?? '').toString().split(',');
|
|
76
|
-
// eslint-disable-next-line no-empty
|
|
77
|
-
} catch {}
|
|
78
|
-
const currentScopes = wallet.getScopes()?.map((scopes)=>scopes.toString()) ?? [];
|
|
79
|
-
const deduplicatedScopes = Array.from(new Set([
|
|
80
|
-
address,
|
|
81
|
-
...currentScopes,
|
|
82
|
-
...storedScopes
|
|
83
|
-
]).values()).map((scope)=>AztecAddress.fromString(scope));
|
|
84
|
-
wallet.setScopes(deduplicatedScopes);
|
|
85
|
-
}
|
|
86
|
-
return wallet;
|
|
87
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["../../../src/utils/options/fees.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAEzB,KAAK,gBAAgB,EACrB,KAAK,GAAG,EACR,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAO,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["../../../src/utils/options/fees.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAEzB,KAAK,gBAAgB,EACrB,KAAK,GAAG,EACR,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAO,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAI3D,MAAM,MAAM,UAAU,GAAG;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9D,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC3E;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,QAAQ,EACjB,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB,CAAC,EAClE,GAAG,EAAE,KAAK,QAIX;AAuGD,qBAAa,OAAQ,YAAW,QAAQ;IAE7B,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,WAAW;IAC/B,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,WAAW;gBAPZ,YAAY,EAAE,OAAO,EACrB,WAAW,EAAE,WAAW,EACvB,oBAAoB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,gBAAgB,CAAC,EAC1E,eAAe,EAAE,CACvB,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,gBAAgB,KAC5B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,EAC/B,WAAW,EAAE,OAAO;IAGxB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAU7D,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAa/E,MAAM,CAAC,mBAAmB;IAI1B,MAAM,CAAC,UAAU;WAIJ,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,QAAQ;CAsB3E;AAED,qBAAa,mBAAoB,SAAQ,OAAO;WAC9B,mBAAmB;WAInB,UAAU;WAIJ,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,QAAQ;CA2BpF;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,mBAAmB,EAAE,OAAO,EAC5B,GAAG,EAAE,KAAK,EACV,EAAE,CAAC,EAAE,QAAQ,GACZ,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAiFtD;AAsBD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAerD"}
|
|
@@ -4,7 +4,6 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
4
4
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
5
5
|
import { Option } from 'commander';
|
|
6
6
|
import { createOrRetrieveAccount } from '../accounts.js';
|
|
7
|
-
import { SponsoredFeePaymentMethod } from '../sponsored_fee_payment.js';
|
|
8
7
|
import { aliasedAddressParser } from './options.js';
|
|
9
8
|
export function printGasEstimates(feeOpts, gasEstimates, log) {
|
|
10
9
|
log(`Estimated gas usage: ${formatGasEstimate(gasEstimates)}`);
|
|
@@ -240,6 +239,8 @@ export function parsePaymentMethod(payment, allowCustomFeePayer, log, db) {
|
|
|
240
239
|
case 'fpc-sponsored':
|
|
241
240
|
{
|
|
242
241
|
const sponsor = getFpc();
|
|
242
|
+
log(`Using sponsored fee payment with sponsor ${sponsor}`);
|
|
243
|
+
const { SponsoredFeePaymentMethod } = await import('@aztec/aztec.js/fee/testing');
|
|
243
244
|
return new SponsoredFeePaymentMethod(sponsor);
|
|
244
245
|
}
|
|
245
246
|
case undefined:
|
|
@@ -4,17 +4,19 @@ import { Option } from 'commander';
|
|
|
4
4
|
import type { AliasType, WalletDB } from '../../storage/wallet_db.js';
|
|
5
5
|
export declare const ARTIFACT_DESCRIPTION = "Path to a compiled Aztec contract's artifact in JSON format. If executed inside a nargo workspace, a package and contract name can be specified as package@contract";
|
|
6
6
|
export declare function integerArgParser(value: string, argName: string, min?: number, max?: number): number;
|
|
7
|
-
export declare function aliasedTxHashParser(txHash: string, db?: WalletDB): import("@aztec/
|
|
7
|
+
export declare function aliasedTxHashParser(txHash: string, db?: WalletDB): import("@aztec/stdlib/tx").TxHash;
|
|
8
8
|
export declare function aliasedAuthWitParser(witness: string, db?: WalletDB): AuthWitness;
|
|
9
9
|
export declare function aliasedAddressParser(defaultPrefix: AliasType, address: string, db?: WalletDB): AztecAddress;
|
|
10
|
-
export declare function aliasedSecretKeyParser(sk: string, db?: WalletDB): import("@aztec/
|
|
10
|
+
export declare function aliasedSecretKeyParser(sk: string, db?: WalletDB): import("@aztec/foundation/schemas").Fr;
|
|
11
11
|
export declare function createAliasOption(description: string, hide: boolean): Option;
|
|
12
12
|
export declare function createAccountOption(description: string, hide: boolean, db?: WalletDB): Option;
|
|
13
|
+
export declare function createAuthwitnessOption(description: string, hide: boolean, db?: WalletDB): Option;
|
|
13
14
|
export declare function createTypeOption(mandatory: boolean): Option;
|
|
14
15
|
export declare function createArgsOption(isConstructor: boolean, db?: WalletDB): Option;
|
|
15
16
|
export declare function createContractAddressOption(db?: WalletDB): Option;
|
|
17
|
+
export declare function createDebugExecutionStepsDirOption(): Option;
|
|
16
18
|
export declare function artifactPathParser(filePath: string, db?: WalletDB): Promise<string>;
|
|
17
19
|
export declare function artifactPathFromPromiseOrAlias(artifactPathPromise: Promise<string>, contractAddress: AztecAddress, db?: WalletDB): Promise<string>;
|
|
18
20
|
export declare function createArtifactOption(db?: WalletDB): Option;
|
|
19
|
-
export declare function
|
|
21
|
+
export declare function cleanupAuthWitnesses(authWitnesses: AuthWitness | AuthWitness[]): AuthWitness[];
|
|
20
22
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/utils/options/options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAKtE,eAAO,MAAM,oBAAoB,wKACsI,CAAC;AAExK,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,GAAG,SAA0B,EAC7B,GAAG,SAA0B,UAU9B;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/utils/options/options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAKtE,eAAO,MAAM,oBAAoB,wKACsI,CAAC;AAExK,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,GAAG,SAA0B,EAC7B,GAAG,SAA0B,UAU9B;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,qCAQhE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,eAQlE;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,gBAQ5F;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,0CAQ/D;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,UAEnE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,QAAQ,UAIpF;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,QAAQ,UAIxF;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,OAAO,UAMlD;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,QAAQ,UAQrE;AAED,wBAAgB,2BAA2B,CAAC,EAAE,CAAC,EAAE,QAAQ,UAIxD;AAED,wBAAgB,kCAAkC,WAKjD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,mBAajE;AAED,wBAAsB,8BAA8B,CAClD,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,EACpC,eAAe,EAAE,YAAY,EAC7B,EAAE,CAAC,EAAE,QAAQ,mBAWd;AAED,wBAAgB,oBAAoB,CAAC,EAAE,CAAC,EAAE,QAAQ,UAIjD;AA6BD,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,WAAW,EAAE,CAG9F"}
|
|
@@ -57,6 +57,9 @@ export function createAliasOption(description, hide) {
|
|
|
57
57
|
export function createAccountOption(description, hide, db) {
|
|
58
58
|
return new Option(`-f, --from <string>`, description).hideHelp(hide).argParser((address)=>aliasedAddressParser('accounts', address, db));
|
|
59
59
|
}
|
|
60
|
+
export function createAuthwitnessOption(description, hide, db) {
|
|
61
|
+
return new Option('-aw, --auth-witness <string>', description).hideHelp(hide).argParser((witness)=>aliasedAuthWitParser(witness, db));
|
|
62
|
+
}
|
|
60
63
|
export function createTypeOption(mandatory) {
|
|
61
64
|
return new Option('-t, --type <string>', 'Type of account to create').choices(AccountTypes).default('schnorr').conflicts('account-or-address').makeOptionMandatory(mandatory);
|
|
62
65
|
}
|
|
@@ -70,6 +73,9 @@ export function createArgsOption(isConstructor, db) {
|
|
|
70
73
|
export function createContractAddressOption(db) {
|
|
71
74
|
return new Option('-ca, --contract-address <address>', 'Aztec address of the contract.').argParser((address)=>aliasedAddressParser('contracts', address, db)).makeOptionMandatory(true);
|
|
72
75
|
}
|
|
76
|
+
export function createDebugExecutionStepsDirOption() {
|
|
77
|
+
return new Option('--debug-execution-steps-dir <address>', 'Directory to write execution step artifacts for bb profiling/debugging.').makeOptionMandatory(false);
|
|
78
|
+
}
|
|
73
79
|
export function artifactPathParser(filePath, db) {
|
|
74
80
|
if (filePath.includes('@')) {
|
|
75
81
|
const [pkg, contractName] = filePath.split('@');
|
|
@@ -95,9 +101,6 @@ export async function artifactPathFromPromiseOrAlias(artifactPathPromise, contra
|
|
|
95
101
|
export function createArtifactOption(db) {
|
|
96
102
|
return new Option('-c, --contract-artifact <fileLocation>', ARTIFACT_DESCRIPTION).argParser((filePath)=>artifactPathParser(filePath, db)).makeOptionMandatory(false);
|
|
97
103
|
}
|
|
98
|
-
export function createProfileOption() {
|
|
99
|
-
return new Option('-p, --profile', 'Run the real prover and get the gate count for each function in the transaction.').default(false);
|
|
100
|
-
}
|
|
101
104
|
async function contractArtifactFromWorkspace(pkg, contractName) {
|
|
102
105
|
const cwd = process.cwd();
|
|
103
106
|
try {
|
|
@@ -120,3 +123,9 @@ async function contractArtifactFromWorkspace(pkg, contractName) {
|
|
|
120
123
|
}
|
|
121
124
|
return `${cwd}/${TARGET_DIR}/${bestMatch[0]}`;
|
|
122
125
|
}
|
|
126
|
+
export function cleanupAuthWitnesses(authWitnesses) {
|
|
127
|
+
const authWitnessArray = Array.isArray(authWitnesses) ? authWitnesses : [
|
|
128
|
+
authWitnesses
|
|
129
|
+
];
|
|
130
|
+
return authWitnessArray.filter((w)=>w !== undefined);
|
|
131
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.1-alpha-testnet.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -65,15 +65,18 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/accounts": "0.
|
|
69
|
-
"@aztec/aztec.js": "0.
|
|
70
|
-
"@aztec/cli": "0.
|
|
71
|
-
"@aztec/
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
68
|
+
"@aztec/accounts": "0.82.1-alpha-testnet.1",
|
|
69
|
+
"@aztec/aztec.js": "0.82.1-alpha-testnet.1",
|
|
70
|
+
"@aztec/cli": "0.82.1-alpha-testnet.1",
|
|
71
|
+
"@aztec/entrypoints": "0.82.1-alpha-testnet.1",
|
|
72
|
+
"@aztec/ethereum": "0.82.1-alpha-testnet.1",
|
|
73
|
+
"@aztec/foundation": "0.82.1-alpha-testnet.1",
|
|
74
|
+
"@aztec/kv-store": "0.82.1-alpha-testnet.1",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.82.1-alpha-testnet.1",
|
|
76
|
+
"@aztec/noir-noirc_abi": "0.82.1-alpha-testnet.1",
|
|
77
|
+
"@aztec/pxe": "0.82.1-alpha-testnet.1",
|
|
78
|
+
"@aztec/stdlib": "0.82.1-alpha-testnet.1",
|
|
79
|
+
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
77
80
|
"commander": "^12.1.0",
|
|
78
81
|
"inquirer": "^10.1.8",
|
|
79
82
|
"source-map-support": "^0.5.21",
|