@aztec/cli-wallet 0.84.0 → 0.85.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 +6 -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 +2 -1
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +6 -7
- package/dest/utils/options/fees.js +2 -3
- package/dest/utils/options/options.d.ts +3 -3
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +13 -13
- package/package.json +12 -12
- package/src/bin/index.ts +7 -2
- package/src/cmds/deploy_account.ts +2 -0
- package/src/cmds/index.ts +16 -6
- package/src/utils/options/fees.ts +6 -6
- package/src/utils/options/options.ts +15 -12
package/dest/bin/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { createAliasOption } from '../utils/options/index.js';
|
|
|
12
12
|
import { PXEWrapper } from '../utils/pxe_wrapper.js';
|
|
13
13
|
const userLog = createConsoleLogger();
|
|
14
14
|
const debugLogger = createLogger('wallet');
|
|
15
|
-
const { WALLET_DATA_DIRECTORY = join(homedir(), '.aztec/wallet')
|
|
15
|
+
const { WALLET_DATA_DIRECTORY = join(homedir(), '.aztec/wallet') } = process.env;
|
|
16
16
|
function injectInternalCommands(program, log, db) {
|
|
17
17
|
program.command('alias').description('Aliases information for easy reference.').addArgument(new Argument('<type>', 'Type of alias to create').choices(Aliases)).argument('<key>', 'Key to alias.').argument('<value>', 'Value to assign to the alias.').action(async (type, key, value)=>{
|
|
18
18
|
value = db.tryRetrieveAlias(value) || value;
|
|
@@ -45,7 +45,11 @@ function injectInternalCommands(program, log, db) {
|
|
|
45
45
|
const db = WalletDB.getInstance();
|
|
46
46
|
const pxeWrapper = new PXEWrapper();
|
|
47
47
|
const program = new Command('wallet');
|
|
48
|
-
program.description('Aztec wallet').version(walletVersion).option('-d, --data-dir <string>', 'Storage directory for wallet data', WALLET_DATA_DIRECTORY).
|
|
48
|
+
program.description('Aztec wallet').version(walletVersion).option('-d, --data-dir <string>', 'Storage directory for wallet data', WALLET_DATA_DIRECTORY).addOption(new Option('-p, --prover <string>', 'The type of prover the wallet uses (only applies if not using a remote PXE)').choices([
|
|
49
|
+
'wasm',
|
|
50
|
+
'native',
|
|
51
|
+
'none'
|
|
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)=>{
|
|
49
53
|
const { dataDir, remotePxe, nodeUrl, prover, rpcUrl } = command.optsWithGlobals();
|
|
50
54
|
if (!remotePxe) {
|
|
51
55
|
debugLogger.info('Using local PXE service');
|
|
@@ -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, feeOpts: IFeeOpts, json: boolean, debugLogger: Logger, log: LogFn): Promise<{
|
|
4
|
+
export declare function deployAccount(account: AccountManager, wait: boolean, registerClass: boolean, feeOpts: IFeeOpts, json: 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;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,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;GA8FX"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
2
2
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
3
|
-
export async function deployAccount(account, wait, feeOpts, json, debugLogger, log) {
|
|
3
|
+
export async function deployAccount(account, wait, registerClass, feeOpts, json, debugLogger, log) {
|
|
4
4
|
const out = {};
|
|
5
5
|
const { address, partialAddress, publicKeys } = await account.getCompleteAddress();
|
|
6
6
|
const { initializationHash, deployer, salt } = account.getInstance();
|
|
@@ -29,6 +29,7 @@ export async function deployAccount(account, wait, feeOpts, json, debugLogger, l
|
|
|
29
29
|
const deployOpts = {
|
|
30
30
|
skipInitialization: false,
|
|
31
31
|
skipPublicDeployment: false,
|
|
32
|
+
skipClassRegistration: !registerClass,
|
|
32
33
|
...await feeOpts.toDeployAccountOpts(wallet)
|
|
33
34
|
};
|
|
34
35
|
if (feeOpts.estimateOnly) {
|
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;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,
|
|
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,WAgpBxB"}
|
package/dest/cmds/index.js
CHANGED
|
@@ -54,14 +54,14 @@ 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');
|
|
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).');
|
|
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 } = options;
|
|
61
|
+
const { rpcUrl, wait, from: parsedFromAddress, json, registerClass } = options;
|
|
62
62
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
63
63
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db);
|
|
64
|
-
await deployAccount(account, wait, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, debugLogger, log);
|
|
64
|
+
await deployAccount(account, wait, registerClass, await FeeOptsWithFeePayer.fromCli(options, client, log, db), json, 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
|
|
@@ -80,17 +80,17 @@ 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(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.');
|
|
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.');
|
|
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 } = options;
|
|
87
|
+
const { args, contractArtifact: artifactPathPromise, contractAddress, from: parsedFromAddress, wait, rpcUrl, secretKey, alias, cancel, authWitness: authWitnessArray } = options;
|
|
88
88
|
const client = 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
|
-
const authWitnesses = cleanupAuthWitnesses(
|
|
93
|
+
const authWitnesses = cleanupAuthWitnesses(authWitnessArray);
|
|
94
94
|
const sentTx = await send(wallet, functionName, args, artifactPath, contractAddress, wait, cancel, await FeeOpts.fromCli(options, client, log, db), authWitnesses, log);
|
|
95
95
|
if (db && sentTx) {
|
|
96
96
|
const txAlias = alias ? alias : `${functionName}-${sentTx.nonce.toString().slice(-4)}`;
|
|
@@ -127,7 +127,6 @@ export function injectCommands(program, log, debugLogger, db, pxeWrapper) {
|
|
|
127
127
|
const { bridgeL1FeeJuice } = await import('./bridge_fee_juice.js');
|
|
128
128
|
const { rpcUrl, l1ChainId, l1RpcUrls, l1PrivateKey, mnemonic, mint, json, wait, interval: intervalS } = options;
|
|
129
129
|
const client = pxeWrapper?.getPXE() ?? await createCompatibleClient(rpcUrl, debugLogger);
|
|
130
|
-
log(`Minting ${amount} fee juice on L1 and pushing to L2`);
|
|
131
130
|
const [secret, messageLeafIndex] = await bridgeL1FeeJuice(amount, recipient, client, l1RpcUrls, l1ChainId, l1PrivateKey, mnemonic, mint, json, wait, intervalS * 1000, log, debugLogger);
|
|
132
131
|
if (db) {
|
|
133
132
|
await db.pushBridgedFeeJuice(recipient, secret, amount, messageLeafIndex, log);
|
|
@@ -36,7 +36,7 @@ function printOptionParams(params) {
|
|
|
36
36
|
`${indent(5)}${name}${indent(maxParamWidth - name.length)} ${params[name].description}`,
|
|
37
37
|
params[name].default ? `Default: ${params[name].default}` : ''
|
|
38
38
|
].join(' '));
|
|
39
|
-
return descriptionList.length ? `\n Parameters:\n${descriptionList.join('\n')}` : '';
|
|
39
|
+
return descriptionList.length ? `\n Parameters:\n${descriptionList.join('\n')}\nFormat: --payment ${Object.keys(params).slice(0, 3).map((name)=>`${name}=${params[name].type}`)} ${Object.keys(params).length > 3 ? '...' : ''}` : '';
|
|
40
40
|
}
|
|
41
41
|
function getFeePaymentMethodParams(allowCustomFeePayer) {
|
|
42
42
|
const feePayer = allowCustomFeePayer ? {
|
|
@@ -84,8 +84,7 @@ function getFeePaymentMethodParams(allowCustomFeePayer) {
|
|
|
84
84
|
}
|
|
85
85
|
function getPaymentMethodOption(allowCustomFeePayer) {
|
|
86
86
|
const params = getFeePaymentMethodParams(allowCustomFeePayer);
|
|
87
|
-
|
|
88
|
-
return new Option(`--payment <${paramList.join(',')}>`, `Fee payment method and arguments.${printOptionParams(params)}`);
|
|
87
|
+
return new Option(`--payment <options>`, `Fee payment method and arguments.${printOptionParams(params)}`);
|
|
89
88
|
}
|
|
90
89
|
function getFeeOptions(allowCustomFeePayer) {
|
|
91
90
|
return [
|
|
@@ -4,8 +4,8 @@ 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/
|
|
8
|
-
export declare function aliasedAuthWitParser(
|
|
7
|
+
export declare function aliasedTxHashParser(txHash: string, db?: WalletDB): import("@aztec/aztec.js/tx_hash").TxHash;
|
|
8
|
+
export declare function aliasedAuthWitParser(witnesses: string, db?: WalletDB): AuthWitness[];
|
|
9
9
|
export declare function aliasedAddressParser(defaultPrefix: AliasType, address: string, db?: WalletDB): AztecAddress;
|
|
10
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;
|
|
@@ -18,5 +18,5 @@ export declare function createDebugExecutionStepsDirOption(): Option;
|
|
|
18
18
|
export declare function artifactPathParser(filePath: string, db?: WalletDB): Promise<string>;
|
|
19
19
|
export declare function artifactPathFromPromiseOrAlias(artifactPathPromise: Promise<string>, contractAddress: AztecAddress, db?: WalletDB): Promise<string>;
|
|
20
20
|
export declare function createArtifactOption(db?: WalletDB): Option;
|
|
21
|
-
export declare function cleanupAuthWitnesses(authWitnesses: AuthWitness |
|
|
21
|
+
export declare function cleanupAuthWitnesses(authWitnesses: AuthWitness[] | undefined): AuthWitness[];
|
|
22
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,4CAQhE;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,iBAYpE;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,EAAE,GAAG,SAAS,GAAG,WAAW,EAAE,CAE5F"}
|
|
@@ -24,14 +24,17 @@ export function aliasedTxHashParser(txHash, db) {
|
|
|
24
24
|
return parseTxHash(rawTxHash);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
export function aliasedAuthWitParser(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
export function aliasedAuthWitParser(witnesses, db) {
|
|
28
|
+
const parsedWitnesses = witnesses.split(',').map((witness)=>{
|
|
29
|
+
try {
|
|
30
|
+
return AuthWitness.fromString(witness);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
const prefixed = witness.includes(':') ? witness : `authwits:${witness}`;
|
|
33
|
+
const rawAuthWitness = db ? db.tryRetrieveAlias(prefixed) : witness;
|
|
34
|
+
return AuthWitness.fromString(rawAuthWitness);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return parsedWitnesses;
|
|
35
38
|
}
|
|
36
39
|
export function aliasedAddressParser(defaultPrefix, address, db) {
|
|
37
40
|
if (address.startsWith('0x')) {
|
|
@@ -58,7 +61,7 @@ export function createAccountOption(description, hide, db) {
|
|
|
58
61
|
return new Option(`-f, --from <string>`, description).hideHelp(hide).argParser((address)=>aliasedAddressParser('accounts', address, db));
|
|
59
62
|
}
|
|
60
63
|
export function createAuthwitnessOption(description, hide, db) {
|
|
61
|
-
return new Option('-aw, --auth-witness <string
|
|
64
|
+
return new Option('-aw, --auth-witness <string,...>', description).hideHelp(hide).argParser((witness)=>aliasedAuthWitParser(witness, db));
|
|
62
65
|
}
|
|
63
66
|
export function createTypeOption(mandatory) {
|
|
64
67
|
return new Option('-t, --type <string>', 'Type of account to create').choices(AccountTypes).default('schnorr').conflicts('account-or-address').makeOptionMandatory(mandatory);
|
|
@@ -124,8 +127,5 @@ async function contractArtifactFromWorkspace(pkg, contractName) {
|
|
|
124
127
|
return `${cwd}/${TARGET_DIR}/${bestMatch[0]}`;
|
|
125
128
|
}
|
|
126
129
|
export function cleanupAuthWitnesses(authWitnesses) {
|
|
127
|
-
|
|
128
|
-
authWitnesses
|
|
129
|
-
];
|
|
130
|
-
return authWitnessArray.filter((w)=>w !== undefined);
|
|
130
|
+
return authWitnesses?.filter((w)=>w !== undefined) ?? [];
|
|
131
131
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -65,17 +65,17 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/accounts": "0.
|
|
69
|
-
"@aztec/aztec.js": "0.
|
|
70
|
-
"@aztec/cli": "0.
|
|
71
|
-
"@aztec/entrypoints": "0.
|
|
72
|
-
"@aztec/ethereum": "0.
|
|
73
|
-
"@aztec/foundation": "0.
|
|
74
|
-
"@aztec/kv-store": "0.
|
|
75
|
-
"@aztec/noir-contracts.js": "0.
|
|
76
|
-
"@aztec/noir-noirc_abi": "0.
|
|
77
|
-
"@aztec/pxe": "0.
|
|
78
|
-
"@aztec/stdlib": "0.
|
|
68
|
+
"@aztec/accounts": "0.85.0",
|
|
69
|
+
"@aztec/aztec.js": "0.85.0",
|
|
70
|
+
"@aztec/cli": "0.85.0",
|
|
71
|
+
"@aztec/entrypoints": "0.85.0",
|
|
72
|
+
"@aztec/ethereum": "0.85.0",
|
|
73
|
+
"@aztec/foundation": "0.85.0",
|
|
74
|
+
"@aztec/kv-store": "0.85.0",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.85.0",
|
|
76
|
+
"@aztec/noir-noirc_abi": "0.85.0",
|
|
77
|
+
"@aztec/pxe": "0.85.0",
|
|
78
|
+
"@aztec/stdlib": "0.85.0",
|
|
79
79
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
80
80
|
"commander": "^12.1.0",
|
|
81
81
|
"inquirer": "^10.1.8",
|
package/src/bin/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { PXEWrapper } from '../utils/pxe_wrapper.js';
|
|
|
17
17
|
const userLog = createConsoleLogger();
|
|
18
18
|
const debugLogger = createLogger('wallet');
|
|
19
19
|
|
|
20
|
-
const { WALLET_DATA_DIRECTORY = join(homedir(), '.aztec/wallet')
|
|
20
|
+
const { WALLET_DATA_DIRECTORY = join(homedir(), '.aztec/wallet') } = process.env;
|
|
21
21
|
|
|
22
22
|
function injectInternalCommands(program: Command, log: LogFn, db: WalletDB) {
|
|
23
23
|
program
|
|
@@ -77,7 +77,12 @@ async function main() {
|
|
|
77
77
|
.description('Aztec wallet')
|
|
78
78
|
.version(walletVersion)
|
|
79
79
|
.option('-d, --data-dir <string>', 'Storage directory for wallet data', WALLET_DATA_DIRECTORY)
|
|
80
|
-
.
|
|
80
|
+
.addOption(
|
|
81
|
+
new Option('-p, --prover <string>', 'The type of prover the wallet uses (only applies if not using a remote PXE)')
|
|
82
|
+
.choices(['wasm', 'native', 'none'])
|
|
83
|
+
.env('PXE_PROVER')
|
|
84
|
+
.default('native'),
|
|
85
|
+
)
|
|
81
86
|
.addOption(
|
|
82
87
|
new Option('--remote-pxe', 'Connect to an external PXE RPC server, instead of the local one')
|
|
83
88
|
.env('REMOTE_PXE')
|
|
@@ -7,6 +7,7 @@ import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
|
|
|
7
7
|
export async function deployAccount(
|
|
8
8
|
account: AccountManager,
|
|
9
9
|
wait: boolean,
|
|
10
|
+
registerClass: boolean,
|
|
10
11
|
feeOpts: IFeeOpts,
|
|
11
12
|
json: boolean,
|
|
12
13
|
debugLogger: Logger,
|
|
@@ -43,6 +44,7 @@ export async function deployAccount(
|
|
|
43
44
|
const deployOpts: DeployAccountOptions = {
|
|
44
45
|
skipInitialization: false,
|
|
45
46
|
skipPublicDeployment: false,
|
|
47
|
+
skipClassRegistration: !registerClass,
|
|
46
48
|
...(await feeOpts.toDeployAccountOpts(wallet)),
|
|
47
49
|
};
|
|
48
50
|
|
package/src/cmds/index.ts
CHANGED
|
@@ -149,12 +149,16 @@ export function injectCommands(
|
|
|
149
149
|
.option('--json', 'Emit output as json')
|
|
150
150
|
// `options.wait` is default true. Passing `--no-wait` will set it to false.
|
|
151
151
|
// https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue
|
|
152
|
-
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction')
|
|
152
|
+
.option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction')
|
|
153
|
+
.option(
|
|
154
|
+
'--register-class',
|
|
155
|
+
'Register the contract class (useful for when the contract class has not been deployed yet).',
|
|
156
|
+
);
|
|
153
157
|
|
|
154
158
|
addOptions(deployAccountCommand, FeeOptsWithFeePayer.getOptions()).action(async (_options, command) => {
|
|
155
159
|
const { deployAccount } = await import('./deploy_account.js');
|
|
156
160
|
const options = command.optsWithGlobals();
|
|
157
|
-
const { rpcUrl, wait, from: parsedFromAddress, json } = options;
|
|
161
|
+
const { rpcUrl, wait, from: parsedFromAddress, json, registerClass } = options;
|
|
158
162
|
|
|
159
163
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
160
164
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db);
|
|
@@ -162,6 +166,7 @@ export function injectCommands(
|
|
|
162
166
|
await deployAccount(
|
|
163
167
|
account,
|
|
164
168
|
wait,
|
|
169
|
+
registerClass,
|
|
165
170
|
await FeeOptsWithFeePayer.fromCli(options, client, log, db),
|
|
166
171
|
json,
|
|
167
172
|
debugLogger,
|
|
@@ -262,7 +267,13 @@ export function injectCommands(
|
|
|
262
267
|
.addOption(
|
|
263
268
|
createSecretKeyOption("The sender's secret key", !db, sk => aliasedSecretKeyParser(sk, db)).conflicts('account'),
|
|
264
269
|
)
|
|
265
|
-
.addOption(
|
|
270
|
+
.addOption(
|
|
271
|
+
createAuthwitnessOption(
|
|
272
|
+
'Authorization witness to use for the transaction. If using multiple, pass a comma separated string',
|
|
273
|
+
!db,
|
|
274
|
+
db,
|
|
275
|
+
),
|
|
276
|
+
)
|
|
266
277
|
.addOption(createAccountOption('Alias or address of the account to send the transaction from', !db, db))
|
|
267
278
|
.option('--no-wait', 'Print transaction hash without waiting for it to be mined')
|
|
268
279
|
.option('--no-cancel', 'Do not allow the transaction to be cancelled. This makes for cheaper transactions.');
|
|
@@ -280,7 +291,7 @@ export function injectCommands(
|
|
|
280
291
|
secretKey,
|
|
281
292
|
alias,
|
|
282
293
|
cancel,
|
|
283
|
-
authWitness,
|
|
294
|
+
authWitness: authWitnessArray,
|
|
284
295
|
} = options;
|
|
285
296
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
286
297
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
@@ -289,7 +300,7 @@ export function injectCommands(
|
|
|
289
300
|
|
|
290
301
|
debugLogger.info(`Using wallet with address ${wallet.getCompleteAddress().address.toString()}`);
|
|
291
302
|
|
|
292
|
-
const authWitnesses = cleanupAuthWitnesses(
|
|
303
|
+
const authWitnesses = cleanupAuthWitnesses(authWitnessArray);
|
|
293
304
|
const sentTx = await send(
|
|
294
305
|
wallet,
|
|
295
306
|
functionName,
|
|
@@ -422,7 +433,6 @@ export function injectCommands(
|
|
|
422
433
|
const { bridgeL1FeeJuice } = await import('./bridge_fee_juice.js');
|
|
423
434
|
const { rpcUrl, l1ChainId, l1RpcUrls, l1PrivateKey, mnemonic, mint, json, wait, interval: intervalS } = options;
|
|
424
435
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
425
|
-
log(`Minting ${amount} fee juice on L1 and pushing to L2`);
|
|
426
436
|
|
|
427
437
|
const [secret, messageLeafIndex] = await bridgeL1FeeJuice(
|
|
428
438
|
amount,
|
|
@@ -77,7 +77,11 @@ function printOptionParams(params: OptionParams) {
|
|
|
77
77
|
params[name].default ? `Default: ${params[name].default}` : '',
|
|
78
78
|
].join(' '),
|
|
79
79
|
);
|
|
80
|
-
return descriptionList.length
|
|
80
|
+
return descriptionList.length
|
|
81
|
+
? `\n Parameters:\n${descriptionList.join('\n')}\nFormat: --payment ${Object.keys(params)
|
|
82
|
+
.slice(0, 3)
|
|
83
|
+
.map(name => `${name}=${params[name].type}`)} ${Object.keys(params).length > 3 ? '...' : ''}`
|
|
84
|
+
: '';
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
function getFeePaymentMethodParams(allowCustomFeePayer: boolean): OptionParams {
|
|
@@ -122,11 +126,7 @@ function getFeePaymentMethodParams(allowCustomFeePayer: boolean): OptionParams {
|
|
|
122
126
|
|
|
123
127
|
function getPaymentMethodOption(allowCustomFeePayer: boolean) {
|
|
124
128
|
const params = getFeePaymentMethodParams(allowCustomFeePayer);
|
|
125
|
-
|
|
126
|
-
return new Option(
|
|
127
|
-
`--payment <${paramList.join(',')}>`,
|
|
128
|
-
`Fee payment method and arguments.${printOptionParams(params)}`,
|
|
129
|
-
);
|
|
129
|
+
return new Option(`--payment <options>`, `Fee payment method and arguments.${printOptionParams(params)}`);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function getFeeOptions(allowCustomFeePayer: boolean) {
|
|
@@ -39,14 +39,18 @@ export function aliasedTxHashParser(txHash: string, db?: WalletDB) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function aliasedAuthWitParser(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
export function aliasedAuthWitParser(witnesses: string, db?: WalletDB) {
|
|
43
|
+
const parsedWitnesses = witnesses.split(',').map(witness => {
|
|
44
|
+
try {
|
|
45
|
+
return AuthWitness.fromString(witness);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
const prefixed = witness.includes(':') ? witness : `authwits:${witness}`;
|
|
48
|
+
const rawAuthWitness = db ? db.tryRetrieveAlias(prefixed) : witness;
|
|
49
|
+
return AuthWitness.fromString(rawAuthWitness);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return parsedWitnesses;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
export function aliasedAddressParser(defaultPrefix: AliasType, address: string, db?: WalletDB) {
|
|
@@ -80,7 +84,7 @@ export function createAccountOption(description: string, hide: boolean, db?: Wal
|
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
export function createAuthwitnessOption(description: string, hide: boolean, db?: WalletDB) {
|
|
83
|
-
return new Option('-aw, --auth-witness <string
|
|
87
|
+
return new Option('-aw, --auth-witness <string,...>', description)
|
|
84
88
|
.hideHelp(hide)
|
|
85
89
|
.argParser(witness => aliasedAuthWitParser(witness, db));
|
|
86
90
|
}
|
|
@@ -180,7 +184,6 @@ async function contractArtifactFromWorkspace(pkg?: string, contractName?: string
|
|
|
180
184
|
return `${cwd}/${TARGET_DIR}/${bestMatch[0]}`;
|
|
181
185
|
}
|
|
182
186
|
|
|
183
|
-
export function cleanupAuthWitnesses(authWitnesses: AuthWitness |
|
|
184
|
-
|
|
185
|
-
return authWitnessArray.filter(w => w !== undefined);
|
|
187
|
+
export function cleanupAuthWitnesses(authWitnesses: AuthWitness[] | undefined): AuthWitness[] {
|
|
188
|
+
return authWitnesses?.filter(w => w !== undefined) ?? [];
|
|
186
189
|
}
|