@aztec/cli-wallet 0.80.0 → 0.82.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/cancel_tx.d.ts.map +1 -1
- package/dest/cmds/cancel_tx.js +2 -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/options.d.ts +3 -1
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +12 -3
- package/dest/utils/sponsored_fee_payment.d.ts +2 -10
- package/dest/utils/sponsored_fee_payment.d.ts.map +1 -1
- package/dest/utils/sponsored_fee_payment.js +4 -3
- package/package.json +13 -10
- package/src/cmds/cancel_tx.ts +3 -4
- 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/options.ts +18 -7
- package/src/utils/sponsored_fee_payment.ts +17 -12
- 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/src/cmds/add_authwit.ts +0 -13
|
@@ -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
|
});
|
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
|
-
}
|
|
@@ -10,11 +10,13 @@ export declare function aliasedAddressParser(defaultPrefix: AliasType, address:
|
|
|
10
10
|
export declare function aliasedSecretKeyParser(sk: string, db?: WalletDB): import("@aztec/aztec.js").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,oCAQhE;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,gCAQ/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,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,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;
|
|
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,oCAQhE;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,gCAQ/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
|
+
}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
|
-
import {
|
|
2
|
+
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
export declare class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
5
5
|
private paymentContract;
|
|
6
6
|
constructor(paymentContract: AztecAddress);
|
|
7
7
|
getAsset(): Promise<AztecAddress>;
|
|
8
8
|
getFeePayer(): Promise<AztecAddress>;
|
|
9
|
-
|
|
10
|
-
name: string;
|
|
11
|
-
to: AztecAddress;
|
|
12
|
-
selector: FunctionSelector;
|
|
13
|
-
type: FunctionType;
|
|
14
|
-
isStatic: boolean;
|
|
15
|
-
args: never[];
|
|
16
|
-
returnTypes: never[];
|
|
17
|
-
}[]>;
|
|
9
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
18
10
|
}
|
|
19
11
|
//# sourceMappingURL=sponsored_fee_payment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsored_fee_payment.d.ts","sourceRoot":"","sources":["../../src/utils/sponsored_fee_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"sponsored_fee_payment.d.ts","sourceRoot":"","sources":["../../src/utils/sponsored_fee_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,qBAAa,yBAA0B,YAAW,gBAAgB;IACpD,OAAO,CAAC,eAAe;gBAAf,eAAe,EAAE,YAAY;IAEjD,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAIjC,WAAW;IAIL,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAiBvD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
1
2
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
2
3
|
export class SponsoredFeePaymentMethod {
|
|
3
4
|
paymentContract;
|
|
@@ -10,8 +11,8 @@ export class SponsoredFeePaymentMethod {
|
|
|
10
11
|
getFeePayer() {
|
|
11
12
|
return Promise.resolve(this.paymentContract);
|
|
12
13
|
}
|
|
13
|
-
async
|
|
14
|
-
return [
|
|
14
|
+
async getExecutionPayload() {
|
|
15
|
+
return new ExecutionPayload([
|
|
15
16
|
{
|
|
16
17
|
name: 'sponsor_unconditionally',
|
|
17
18
|
to: this.paymentContract,
|
|
@@ -21,6 +22,6 @@ export class SponsoredFeePaymentMethod {
|
|
|
21
22
|
args: [],
|
|
22
23
|
returnTypes: []
|
|
23
24
|
}
|
|
24
|
-
];
|
|
25
|
+
], [], []);
|
|
25
26
|
}
|
|
26
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
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.0",
|
|
69
|
+
"@aztec/aztec.js": "0.82.0",
|
|
70
|
+
"@aztec/cli": "0.82.0",
|
|
71
|
+
"@aztec/entrypoints": "0.82.0",
|
|
72
|
+
"@aztec/ethereum": "0.82.0",
|
|
73
|
+
"@aztec/foundation": "0.82.0",
|
|
74
|
+
"@aztec/kv-store": "0.82.0",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.82.0",
|
|
76
|
+
"@aztec/noir-noirc_abi": "0.82.0",
|
|
77
|
+
"@aztec/pxe": "0.82.0",
|
|
78
|
+
"@aztec/stdlib": "0.82.0",
|
|
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",
|
package/src/cmds/cancel_tx.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AccountWalletWithSecretKey, type FeePaymentMethod, SentTx, type TxHash, TxStatus } from '@aztec/aztec.js';
|
|
2
|
-
import type { FeeOptions } from '@aztec/
|
|
2
|
+
import type { FeeOptions } from '@aztec/entrypoints/interfaces';
|
|
3
|
+
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
5
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
6
|
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
@@ -37,9 +38,7 @@ export async function cancelTx(
|
|
|
37
38
|
}),
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
const txRequest = await wallet.createTxExecutionRequest({
|
|
41
|
-
calls: [],
|
|
42
|
-
fee,
|
|
41
|
+
const txRequest = await wallet.createTxExecutionRequest(ExecutionPayload.empty(), fee, {
|
|
43
42
|
nonce,
|
|
44
43
|
cancellable: true,
|
|
45
44
|
});
|
package/src/cmds/index.ts
CHANGED
|
@@ -21,22 +21,23 @@ import { type Command, Option } from 'commander';
|
|
|
21
21
|
import inquirer from 'inquirer';
|
|
22
22
|
|
|
23
23
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
24
|
-
import { type AccountType,
|
|
24
|
+
import { type AccountType, createOrRetrieveAccount } from '../utils/accounts.js';
|
|
25
25
|
import { FeeOpts, FeeOptsWithFeePayer } from '../utils/options/fees.js';
|
|
26
26
|
import {
|
|
27
27
|
ARTIFACT_DESCRIPTION,
|
|
28
28
|
aliasedAddressParser,
|
|
29
|
-
aliasedAuthWitParser,
|
|
30
29
|
aliasedSecretKeyParser,
|
|
31
30
|
aliasedTxHashParser,
|
|
32
31
|
artifactPathFromPromiseOrAlias,
|
|
33
32
|
artifactPathParser,
|
|
33
|
+
cleanupAuthWitnesses,
|
|
34
34
|
createAccountOption,
|
|
35
35
|
createAliasOption,
|
|
36
36
|
createArgsOption,
|
|
37
37
|
createArtifactOption,
|
|
38
|
+
createAuthwitnessOption,
|
|
38
39
|
createContractAddressOption,
|
|
39
|
-
|
|
40
|
+
createDebugExecutionStepsDirOption,
|
|
40
41
|
createTypeOption,
|
|
41
42
|
integerArgParser,
|
|
42
43
|
parseGasFees,
|
|
@@ -219,7 +220,7 @@ export function injectCommands(
|
|
|
219
220
|
} = options;
|
|
220
221
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
221
222
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
222
|
-
const wallet = await
|
|
223
|
+
const wallet = await account.getWallet();
|
|
223
224
|
const artifactPath = await artifactPathPromise;
|
|
224
225
|
|
|
225
226
|
debugLogger.info(`Using wallet with address ${wallet.getCompleteAddress().address.toString()}`);
|
|
@@ -262,6 +263,7 @@ export function injectCommands(
|
|
|
262
263
|
.addOption(
|
|
263
264
|
createSecretKeyOption("The sender's secret key", !db, sk => aliasedSecretKeyParser(sk, db)).conflicts('account'),
|
|
264
265
|
)
|
|
266
|
+
.addOption(createAuthwitnessOption('Authorization witness to use for the transaction', !db, db))
|
|
265
267
|
.addOption(createAccountOption('Alias or address of the account to send the transaction from', !db, db))
|
|
266
268
|
.option('--no-wait', 'Print transaction hash without waiting for it to be mined')
|
|
267
269
|
.option('--no-cancel', 'Do not allow the transaction to be cancelled. This makes for cheaper transactions.');
|
|
@@ -279,14 +281,16 @@ export function injectCommands(
|
|
|
279
281
|
secretKey,
|
|
280
282
|
alias,
|
|
281
283
|
cancel,
|
|
284
|
+
authWitness,
|
|
282
285
|
} = options;
|
|
283
286
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
284
287
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
285
|
-
const wallet = await
|
|
288
|
+
const wallet = await account.getWallet();
|
|
286
289
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
287
290
|
|
|
288
291
|
debugLogger.info(`Using wallet with address ${wallet.getCompleteAddress().address.toString()}`);
|
|
289
292
|
|
|
293
|
+
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
290
294
|
const sentTx = await send(
|
|
291
295
|
wallet,
|
|
292
296
|
functionName,
|
|
@@ -296,6 +300,7 @@ export function injectCommands(
|
|
|
296
300
|
wait,
|
|
297
301
|
cancel,
|
|
298
302
|
await FeeOpts.fromCli(options, client, log, db),
|
|
303
|
+
authWitnesses,
|
|
299
304
|
log,
|
|
300
305
|
);
|
|
301
306
|
if (db && sentTx) {
|
|
@@ -315,8 +320,8 @@ export function injectCommands(
|
|
|
315
320
|
.addOption(
|
|
316
321
|
createSecretKeyOption("The sender's secret key", !db, sk => aliasedSecretKeyParser(sk, db)).conflicts('account'),
|
|
317
322
|
)
|
|
323
|
+
.addOption(createAuthwitnessOption('Authorization witness to use for the simulation', !db, db))
|
|
318
324
|
.addOption(createAccountOption('Alias or address of the account to simulate from', !db, db))
|
|
319
|
-
.addOption(createProfileOption())
|
|
320
325
|
.action(async (functionName, _options, command) => {
|
|
321
326
|
const { simulate } = await import('./simulate.js');
|
|
322
327
|
const options = command.optsWithGlobals();
|
|
@@ -327,14 +332,60 @@ export function injectCommands(
|
|
|
327
332
|
from: parsedFromAddress,
|
|
328
333
|
rpcUrl,
|
|
329
334
|
secretKey,
|
|
330
|
-
|
|
335
|
+
authWitness,
|
|
331
336
|
} = options;
|
|
332
337
|
|
|
333
338
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
334
339
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
335
|
-
const wallet = await
|
|
340
|
+
const wallet = await account.getWallet();
|
|
336
341
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
337
|
-
|
|
342
|
+
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
343
|
+
await simulate(wallet, functionName, args, artifactPath, contractAddress, authWitnesses, log);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
program
|
|
347
|
+
.command('profile')
|
|
348
|
+
.description('Profiles a private function by counting the unconditional operations in its execution steps')
|
|
349
|
+
.argument('<functionName>', 'Name of function to simulate')
|
|
350
|
+
.addOption(pxeOption)
|
|
351
|
+
.addOption(createArgsOption(false, db))
|
|
352
|
+
.addOption(createContractAddressOption(db))
|
|
353
|
+
.addOption(createArtifactOption(db))
|
|
354
|
+
.addOption(createDebugExecutionStepsDirOption())
|
|
355
|
+
.addOption(
|
|
356
|
+
createSecretKeyOption("The sender's secret key", !db, sk => aliasedSecretKeyParser(sk, db)).conflicts('account'),
|
|
357
|
+
)
|
|
358
|
+
.addOption(createAuthwitnessOption('Authorization witness to use for the simulation', !db, db))
|
|
359
|
+
.addOption(createAccountOption('Alias or address of the account to simulate from', !db, db))
|
|
360
|
+
.action(async (functionName, _options, command) => {
|
|
361
|
+
const { profile } = await import('./profile.js');
|
|
362
|
+
const options = command.optsWithGlobals();
|
|
363
|
+
const {
|
|
364
|
+
args,
|
|
365
|
+
contractArtifact: artifactPathPromise,
|
|
366
|
+
contractAddress,
|
|
367
|
+
from: parsedFromAddress,
|
|
368
|
+
rpcUrl,
|
|
369
|
+
secretKey,
|
|
370
|
+
debugExecutionStepsDir,
|
|
371
|
+
authWitness,
|
|
372
|
+
} = options;
|
|
373
|
+
|
|
374
|
+
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
375
|
+
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
376
|
+
const wallet = await account.getWallet();
|
|
377
|
+
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
378
|
+
const authWitnesses = cleanupAuthWitnesses(authWitness);
|
|
379
|
+
await profile(
|
|
380
|
+
wallet,
|
|
381
|
+
functionName,
|
|
382
|
+
args,
|
|
383
|
+
artifactPath,
|
|
384
|
+
contractAddress,
|
|
385
|
+
debugExecutionStepsDir,
|
|
386
|
+
authWitnesses,
|
|
387
|
+
log,
|
|
388
|
+
);
|
|
338
389
|
});
|
|
339
390
|
|
|
340
391
|
program
|
|
@@ -372,6 +423,7 @@ export function injectCommands(
|
|
|
372
423
|
const { bridgeL1FeeJuice } = await import('./bridge_fee_juice.js');
|
|
373
424
|
const { rpcUrl, l1ChainId, l1RpcUrls, l1PrivateKey, mnemonic, mint, json, wait, interval: intervalS } = options;
|
|
374
425
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
426
|
+
log(`Minting ${amount} fee juice on L1 and pushing to L2`);
|
|
375
427
|
|
|
376
428
|
const [secret, messageLeafIndex] = await bridgeL1FeeJuice(
|
|
377
429
|
amount,
|
|
@@ -428,7 +480,7 @@ export function injectCommands(
|
|
|
428
480
|
|
|
429
481
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
430
482
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
431
|
-
const wallet = await
|
|
483
|
+
const wallet = await account.getWallet();
|
|
432
484
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
433
485
|
const witness = await createAuthwit(wallet, functionName, caller, args, artifactPath, contractAddress, log);
|
|
434
486
|
|
|
@@ -468,40 +520,11 @@ export function injectCommands(
|
|
|
468
520
|
|
|
469
521
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
470
522
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
471
|
-
const wallet = await
|
|
523
|
+
const wallet = await account.getWallet();
|
|
472
524
|
const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db);
|
|
473
525
|
await authorizeAction(wallet, functionName, caller, args, artifactPath, contractAddress, log);
|
|
474
526
|
});
|
|
475
527
|
|
|
476
|
-
program
|
|
477
|
-
.command('add-authwit')
|
|
478
|
-
.description(
|
|
479
|
-
'Adds an authorization witness to the provided account, granting PXE access to the notes of the authorizer so that it can be verified',
|
|
480
|
-
)
|
|
481
|
-
.argument('<authwit>', 'Authorization witness to add to the account', witness => aliasedAuthWitParser(witness, db))
|
|
482
|
-
.argument('<authorizer>', 'Account that provides the authorization to perform the action', address =>
|
|
483
|
-
aliasedAddressParser('accounts', address, db),
|
|
484
|
-
)
|
|
485
|
-
.addOption(pxeOption)
|
|
486
|
-
.addOption(
|
|
487
|
-
createSecretKeyOption("The sender's secret key", !db, sk => aliasedSecretKeyParser(sk, db)).conflicts('account'),
|
|
488
|
-
)
|
|
489
|
-
.addOption(createAccountOption('Alias or address of the account to simulate from', !db, db))
|
|
490
|
-
.addOption(
|
|
491
|
-
createAliasOption('Alias for the authorization witness. Used for easy reference in subsequent commands.', !db),
|
|
492
|
-
)
|
|
493
|
-
.action(async (authwit, authorizer, _options, command) => {
|
|
494
|
-
const { addAuthwit } = await import('./add_authwit.js');
|
|
495
|
-
const options = command.optsWithGlobals();
|
|
496
|
-
const { from: parsedFromAddress, rpcUrl, secretKey } = options;
|
|
497
|
-
|
|
498
|
-
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
499
|
-
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
500
|
-
const wallet = await getWalletWithScopes(account, db);
|
|
501
|
-
await addAuthwit(wallet, authwit, authorizer, log);
|
|
502
|
-
await addScopeToWallet(wallet, authorizer, db);
|
|
503
|
-
});
|
|
504
|
-
|
|
505
528
|
program
|
|
506
529
|
.command('get-tx')
|
|
507
530
|
.description('Gets the status of the recent txs, or a detailed view if a specific transaction hash is provided')
|
|
@@ -572,7 +595,7 @@ export function injectCommands(
|
|
|
572
595
|
const { from: parsedFromAddress, rpcUrl, secretKey, payment, increasedFees, maxFeesPerGas } = options;
|
|
573
596
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
574
597
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
575
|
-
const wallet = await
|
|
598
|
+
const wallet = await account.getWallet();
|
|
576
599
|
|
|
577
600
|
const txData = await db?.retrieveTxData(txHash);
|
|
578
601
|
if (!txData) {
|
|
@@ -600,7 +623,7 @@ export function injectCommands(
|
|
|
600
623
|
const { from: parsedFromAddress, rpcUrl, secretKey, alias } = options;
|
|
601
624
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
602
625
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
603
|
-
const wallet = await
|
|
626
|
+
const wallet = await account.getWallet();
|
|
604
627
|
|
|
605
628
|
await registerSender(wallet, address, log);
|
|
606
629
|
|
|
@@ -626,7 +649,7 @@ export function injectCommands(
|
|
|
626
649
|
const client = pxeWrapper?.getPXE() ?? (await createCompatibleClient(rpcUrl, debugLogger));
|
|
627
650
|
const node = pxeWrapper?.getNode() ?? createAztecNodeClient(nodeUrl);
|
|
628
651
|
const account = await createOrRetrieveAccount(client, parsedFromAddress, db, secretKey);
|
|
629
|
-
const wallet = await
|
|
652
|
+
const wallet = await account.getWallet();
|
|
630
653
|
|
|
631
654
|
const artifactPath = await artifactPathPromise;
|
|
632
655
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress, Contract } from '@aztec/aztec.js';
|
|
2
|
+
import { prepTx } from '@aztec/cli/utils';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
5
|
+
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
6
|
+
import type { TxProfileResult } from '@aztec/stdlib/tx';
|
|
7
|
+
|
|
8
|
+
import { encode } from '@msgpack/msgpack';
|
|
9
|
+
import { promises as fs } from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { format } from 'util';
|
|
12
|
+
|
|
13
|
+
function printProfileResult(result: TxProfileResult, log: LogFn) {
|
|
14
|
+
// TODO(AD): this is a bit misleading - the maximum gate count of any piece is as important
|
|
15
|
+
// as the total gate count. We should probably print both.
|
|
16
|
+
log(format('\nGate count per circuit:'));
|
|
17
|
+
let acc = 0;
|
|
18
|
+
result.executionSteps.forEach(r => {
|
|
19
|
+
acc += r.gateCount!;
|
|
20
|
+
log(
|
|
21
|
+
format(
|
|
22
|
+
' ',
|
|
23
|
+
r.functionName.padEnd(50),
|
|
24
|
+
'Gates:',
|
|
25
|
+
r.gateCount!.toLocaleString(),
|
|
26
|
+
'\tSubtotal:',
|
|
27
|
+
acc.toLocaleString(),
|
|
28
|
+
),
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
log(format('\nTotal gates:', acc.toLocaleString()));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// TODO(#7371): This is duplicated.
|
|
35
|
+
// Longer term we won't use this hacked together msgpack format
|
|
36
|
+
// Leaving duplicated as this eventually bb will provide a serialization
|
|
37
|
+
// helper for passing to a generic msgpack RPC endpoint.
|
|
38
|
+
async function _createClientIvcProofFiles(directory: string, executionSteps: PrivateExecutionStep[]) {
|
|
39
|
+
const acirPath = path.join(directory, 'acir.msgpack');
|
|
40
|
+
const witnessPath = path.join(directory, 'witnesses.msgpack');
|
|
41
|
+
await fs.writeFile(acirPath, encode(executionSteps.map(map => map.bytecode)));
|
|
42
|
+
await fs.writeFile(witnessPath, encode(executionSteps.map(map => serializeWitness(map.witness))));
|
|
43
|
+
return {
|
|
44
|
+
acirPath,
|
|
45
|
+
witnessPath,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function profile(
|
|
50
|
+
wallet: AccountWalletWithSecretKey,
|
|
51
|
+
functionName: string,
|
|
52
|
+
functionArgsIn: any[],
|
|
53
|
+
contractArtifactPath: string,
|
|
54
|
+
contractAddress: AztecAddress,
|
|
55
|
+
debugOutputPath: string | undefined,
|
|
56
|
+
authWitnesses: AuthWitness[],
|
|
57
|
+
log: LogFn,
|
|
58
|
+
) {
|
|
59
|
+
const profileMode = debugOutputPath ? ('full' as const) : ('gates' as const);
|
|
60
|
+
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
61
|
+
|
|
62
|
+
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
63
|
+
const call = contract.methods[functionName](...functionArgs);
|
|
64
|
+
|
|
65
|
+
const result = await call.profile({ profileMode, authWitnesses });
|
|
66
|
+
printProfileResult(result, log);
|
|
67
|
+
if (debugOutputPath) {
|
|
68
|
+
log(`Debug output written to ${debugOutputPath} (witnesses.msgpack and acir.msgpack)`);
|
|
69
|
+
await _createClientIvcProofFiles(debugOutputPath, result.executionSteps);
|
|
70
|
+
}
|
|
71
|
+
}
|
package/src/cmds/send.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type AccountWalletWithSecretKey,
|
|
3
|
+
AuthWitness,
|
|
4
|
+
type AztecAddress,
|
|
5
|
+
Contract,
|
|
6
|
+
Fr,
|
|
7
|
+
type SendMethodOptions,
|
|
8
|
+
} from '@aztec/aztec.js';
|
|
2
9
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
10
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
11
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
@@ -14,6 +21,7 @@ export async function send(
|
|
|
14
21
|
wait: boolean,
|
|
15
22
|
cancellable: boolean,
|
|
16
23
|
feeOpts: IFeeOpts,
|
|
24
|
+
authWitnesses: AuthWitness[],
|
|
17
25
|
log: LogFn,
|
|
18
26
|
) {
|
|
19
27
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
@@ -21,15 +29,23 @@ export async function send(
|
|
|
21
29
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
22
30
|
const call = contract.methods[functionName](...functionArgs);
|
|
23
31
|
|
|
24
|
-
const
|
|
32
|
+
const nonce = Fr.random();
|
|
33
|
+
|
|
34
|
+
const sendOptions: SendMethodOptions = {
|
|
35
|
+
...(await feeOpts.toSendOpts(wallet)),
|
|
36
|
+
authWitnesses,
|
|
37
|
+
cancellable,
|
|
38
|
+
nonce,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const gasLimits = await call.estimateGas(sendOptions);
|
|
25
42
|
printGasEstimates(feeOpts, gasLimits, log);
|
|
26
43
|
|
|
27
44
|
if (feeOpts.estimateOnly) {
|
|
28
45
|
return;
|
|
29
46
|
}
|
|
30
47
|
|
|
31
|
-
const
|
|
32
|
-
const tx = call.send({ ...(await feeOpts.toSendOpts(wallet)), nonce, cancellable });
|
|
48
|
+
const tx = call.send(sendOptions);
|
|
33
49
|
const txHash = await tx.getTxHash();
|
|
34
50
|
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
35
51
|
if (wait) {
|
package/src/cmds/simulate.ts
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
|
-
import { type AccountWalletWithSecretKey, type AztecAddress, Contract
|
|
1
|
+
import { type AccountWalletWithSecretKey, AuthWitness, type AztecAddress, Contract } from '@aztec/aztec.js';
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
5
|
import { format } from 'util';
|
|
6
6
|
|
|
7
|
-
function printProfileResult(result: ProfileResult, log: LogFn) {
|
|
8
|
-
log(format('\nSimulation result:'));
|
|
9
|
-
log(format('Return value:', JSON.stringify(result.returnValues, null, 2)));
|
|
10
|
-
|
|
11
|
-
log(format('\nGate count per circuit:'));
|
|
12
|
-
let acc = 0;
|
|
13
|
-
result.gateCounts.forEach(r => {
|
|
14
|
-
acc += r.gateCount;
|
|
15
|
-
log(format(' ', r.circuitName.padEnd(50), 'Gates:', r.gateCount.toLocaleString(), '\tAcc:', acc.toLocaleString()));
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
log(format('\nTotal gates:', acc.toLocaleString()));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
7
|
export async function simulate(
|
|
22
8
|
wallet: AccountWalletWithSecretKey,
|
|
23
9
|
functionName: string,
|
|
24
10
|
functionArgsIn: any[],
|
|
25
11
|
contractArtifactPath: string,
|
|
26
12
|
contractAddress: AztecAddress,
|
|
27
|
-
|
|
13
|
+
authWitnesses: AuthWitness[],
|
|
28
14
|
log: LogFn,
|
|
29
15
|
) {
|
|
30
16
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
31
17
|
|
|
32
18
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
33
19
|
const call = contract.methods[functionName](...functionArgs);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const result = await call.simulateWithProfile();
|
|
37
|
-
printProfileResult(result, log);
|
|
38
|
-
} else {
|
|
39
|
-
const result = await call.simulate();
|
|
40
|
-
log(format('\nSimulation result: ', result, '\n'));
|
|
41
|
-
}
|
|
20
|
+
const result = await call.simulate({ authWitnesses });
|
|
21
|
+
log(format('\nSimulation result: ', result, '\n'));
|
|
42
22
|
}
|
package/src/utils/accounts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getIdentities } from '@aztec/accounts/utils';
|
|
2
|
-
import type { AccountManager
|
|
2
|
+
import type { AccountManager } from '@aztec/aztec.js';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
@@ -70,33 +70,3 @@ export async function createOrRetrieveAccount(
|
|
|
70
70
|
|
|
71
71
|
return account;
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
export async function addScopeToWallet(wallet: AccountWalletWithSecretKey, scope: AztecAddress, db?: WalletDB) {
|
|
75
|
-
const address = wallet.getAddress().toString();
|
|
76
|
-
const currentScopes = wallet.getScopes() ?? [];
|
|
77
|
-
const deduplicatedScopes = Array.from(
|
|
78
|
-
new Set([address, ...currentScopes, scope].map(scope => scope.toString())).values(),
|
|
79
|
-
);
|
|
80
|
-
if (db) {
|
|
81
|
-
await db.storeAccountMetadata(wallet.getAddress(), 'scopes', Buffer.from(deduplicatedScopes.join(',')));
|
|
82
|
-
}
|
|
83
|
-
wallet.setScopes(deduplicatedScopes.map(scope => AztecAddress.fromString(scope)));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export async function getWalletWithScopes(account: AccountManager, db?: WalletDB) {
|
|
87
|
-
const wallet = await account.getWallet();
|
|
88
|
-
if (db) {
|
|
89
|
-
const address = wallet.getAddress().toString();
|
|
90
|
-
let storedScopes: string[] = [];
|
|
91
|
-
try {
|
|
92
|
-
storedScopes = ((await db.retrieveAccountMetadata(wallet.getAddress(), 'scopes')) ?? '').toString().split(',');
|
|
93
|
-
// eslint-disable-next-line no-empty
|
|
94
|
-
} catch {}
|
|
95
|
-
const currentScopes = wallet.getScopes()?.map(scopes => scopes.toString()) ?? [];
|
|
96
|
-
const deduplicatedScopes = Array.from(new Set([address, ...currentScopes, ...storedScopes]).values()).map(scope =>
|
|
97
|
-
AztecAddress.fromString(scope),
|
|
98
|
-
);
|
|
99
|
-
wallet.setScopes(deduplicatedScopes);
|
|
100
|
-
}
|
|
101
|
-
return wallet;
|
|
102
|
-
}
|
|
@@ -79,6 +79,12 @@ export function createAccountOption(description: string, hide: boolean, db?: Wal
|
|
|
79
79
|
.argParser(address => aliasedAddressParser('accounts', address, db));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
export function createAuthwitnessOption(description: string, hide: boolean, db?: WalletDB) {
|
|
83
|
+
return new Option('-aw, --auth-witness <string>', description)
|
|
84
|
+
.hideHelp(hide)
|
|
85
|
+
.argParser(witness => aliasedAuthWitParser(witness, db));
|
|
86
|
+
}
|
|
87
|
+
|
|
82
88
|
export function createTypeOption(mandatory: boolean) {
|
|
83
89
|
return new Option('-t, --type <string>', 'Type of account to create')
|
|
84
90
|
.choices(AccountTypes)
|
|
@@ -103,6 +109,13 @@ export function createContractAddressOption(db?: WalletDB) {
|
|
|
103
109
|
.makeOptionMandatory(true);
|
|
104
110
|
}
|
|
105
111
|
|
|
112
|
+
export function createDebugExecutionStepsDirOption() {
|
|
113
|
+
return new Option(
|
|
114
|
+
'--debug-execution-steps-dir <address>',
|
|
115
|
+
'Directory to write execution step artifacts for bb profiling/debugging.',
|
|
116
|
+
).makeOptionMandatory(false);
|
|
117
|
+
}
|
|
118
|
+
|
|
106
119
|
export function artifactPathParser(filePath: string, db?: WalletDB) {
|
|
107
120
|
if (filePath.includes('@')) {
|
|
108
121
|
const [pkg, contractName] = filePath.split('@');
|
|
@@ -140,13 +153,6 @@ export function createArtifactOption(db?: WalletDB) {
|
|
|
140
153
|
.makeOptionMandatory(false);
|
|
141
154
|
}
|
|
142
155
|
|
|
143
|
-
export function createProfileOption() {
|
|
144
|
-
return new Option(
|
|
145
|
-
'-p, --profile',
|
|
146
|
-
'Run the real prover and get the gate count for each function in the transaction.',
|
|
147
|
-
).default(false);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
156
|
async function contractArtifactFromWorkspace(pkg?: string, contractName?: string) {
|
|
151
157
|
const cwd = process.cwd();
|
|
152
158
|
try {
|
|
@@ -173,3 +179,8 @@ async function contractArtifactFromWorkspace(pkg?: string, contractName?: string
|
|
|
173
179
|
}
|
|
174
180
|
return `${cwd}/${TARGET_DIR}/${bestMatch[0]}`;
|
|
175
181
|
}
|
|
182
|
+
|
|
183
|
+
export function cleanupAuthWitnesses(authWitnesses: AuthWitness | AuthWitness[]): AuthWitness[] {
|
|
184
|
+
const authWitnessArray = Array.isArray(authWitnesses) ? authWitnesses : [authWitnesses];
|
|
185
|
+
return authWitnessArray.filter(w => w !== undefined);
|
|
186
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
|
+
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
3
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
|
|
@@ -13,17 +14,21 @@ export class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
|
13
14
|
return Promise.resolve(this.paymentContract);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
async
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
async getExecutionPayload(): Promise<ExecutionPayload> {
|
|
18
|
+
return new ExecutionPayload(
|
|
19
|
+
[
|
|
20
|
+
{
|
|
21
|
+
name: 'sponsor_unconditionally',
|
|
22
|
+
to: this.paymentContract,
|
|
23
|
+
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
24
|
+
type: FunctionType.PRIVATE,
|
|
25
|
+
isStatic: false,
|
|
26
|
+
args: [],
|
|
27
|
+
returnTypes: [],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
[],
|
|
31
|
+
[],
|
|
32
|
+
);
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { AccountWalletWithSecretKey, AuthWitness, AztecAddress } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
export declare function addAuthwit(wallet: AccountWalletWithSecretKey, authwit: AuthWitness, authorizer: AztecAddress, log: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=add_authwit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add_authwit.d.ts","sourceRoot":"","sources":["../../src/cmds/add_authwit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,0BAA0B,EAClC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,YAAY,EACxB,GAAG,EAAE,KAAK,iBAKX"}
|
package/dest/cmds/add_authwit.js
DELETED
package/src/cmds/add_authwit.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { AccountWalletWithSecretKey, AuthWitness, AztecAddress } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
export async function addAuthwit(
|
|
5
|
-
wallet: AccountWalletWithSecretKey,
|
|
6
|
-
authwit: AuthWitness,
|
|
7
|
-
authorizer: AztecAddress,
|
|
8
|
-
log: LogFn,
|
|
9
|
-
) {
|
|
10
|
-
await wallet.addAuthWitness(authwit);
|
|
11
|
-
|
|
12
|
-
log(`Added authorization witness from ${authorizer}`);
|
|
13
|
-
}
|