@aztec/cli-wallet 0.0.0-test.1 → 0.0.1-commit.b655e406
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/README.md +30 -0
- package/dest/bin/index.js +48 -26
- package/dest/cmds/authorize_action.d.ts +3 -2
- package/dest/cmds/authorize_action.d.ts.map +1 -1
- package/dest/cmds/authorize_action.js +8 -4
- package/dest/cmds/bridge_fee_juice.d.ts +2 -2
- package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
- package/dest/cmds/bridge_fee_juice.js +8 -7
- package/dest/cmds/check_tx.d.ts +4 -2
- package/dest/cmds/check_tx.d.ts.map +1 -1
- package/dest/cmds/check_tx.js +145 -6
- package/dest/cmds/create_account.d.ts +6 -5
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +46 -27
- package/dest/cmds/create_authwit.d.ts +3 -2
- package/dest/cmds/create_authwit.d.ts.map +1 -1
- package/dest/cmds/create_authwit.js +5 -5
- package/dest/cmds/deploy.d.ts +6 -3
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +71 -54
- package/dest/cmds/deploy_account.d.ts +5 -7
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +46 -29
- package/dest/cmds/import_test_accounts.d.ts +2 -2
- package/dest/cmds/import_test_accounts.d.ts.map +1 -1
- package/dest/cmds/import_test_accounts.js +6 -9
- package/dest/cmds/index.d.ts +2 -2
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +83 -115
- package/dest/cmds/profile.d.ts +8 -0
- package/dest/cmds/profile.d.ts.map +1 -0
- package/dest/cmds/profile.js +28 -0
- package/dest/cmds/register_contract.d.ts +6 -2
- package/dest/cmds/register_contract.d.ts.map +1 -1
- package/dest/cmds/register_contract.js +20 -7
- package/dest/cmds/register_sender.d.ts +3 -2
- package/dest/cmds/register_sender.d.ts.map +1 -1
- package/dest/cmds/send.d.ts +7 -8
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +31 -20
- package/dest/cmds/simulate.d.ts +6 -2
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +25 -19
- package/dest/storage/wallet_db.d.ts +4 -16
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +2 -23
- package/dest/utils/authorizations.d.ts +6 -0
- package/dest/utils/authorizations.d.ts.map +1 -0
- package/dest/utils/authorizations.js +28 -0
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts +12 -0
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts.map +1 -0
- package/dest/utils/cli_wallet_and_node_wrapper.js +25 -0
- package/dest/utils/ecdsa.d.ts +0 -2
- package/dest/utils/ecdsa.d.ts.map +1 -1
- package/dest/utils/options/fees.d.ts +20 -27
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +85 -144
- package/dest/utils/options/options.d.ts +8 -4
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +26 -14
- package/dest/utils/profiling.d.ts +5 -0
- package/dest/utils/profiling.d.ts.map +1 -0
- package/dest/utils/profiling.js +60 -0
- package/dest/utils/wallet.d.ts +35 -0
- package/dest/utils/wallet.d.ts.map +1 -0
- package/dest/utils/wallet.js +193 -0
- package/package.json +24 -20
- package/src/bin/index.ts +56 -32
- package/src/cmds/authorize_action.ts +15 -4
- package/src/cmds/bridge_fee_juice.ts +14 -11
- package/src/cmds/check_tx.ts +182 -5
- package/src/cmds/create_account.ts +55 -32
- package/src/cmds/create_authwit.ts +8 -4
- package/src/cmds/deploy.ts +79 -62
- package/src/cmds/deploy_account.ts +57 -28
- package/src/cmds/import_test_accounts.ts +7 -11
- package/src/cmds/index.ts +256 -220
- package/src/cmds/profile.ts +48 -0
- package/src/cmds/register_contract.ts +28 -5
- package/src/cmds/register_sender.ts +3 -2
- package/src/cmds/send.ts +31 -17
- package/src/cmds/simulate.ts +39 -23
- package/src/storage/wallet_db.ts +3 -31
- package/src/utils/authorizations.ts +51 -0
- package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
- package/src/utils/options/fees.ts +134 -206
- package/src/utils/options/options.ts +41 -19
- package/src/utils/profiling.ts +158 -0
- package/src/utils/wallet.ts +264 -0
- package/dest/cmds/add_authwit.d.ts +0 -4
- package/dest/cmds/add_authwit.d.ts.map +0 -1
- package/dest/cmds/add_authwit.js +0 -4
- package/dest/cmds/cancel_tx.d.ts +0 -11
- package/dest/cmds/cancel_tx.d.ts.map +0 -1
- package/dest/cmds/cancel_tx.js +0 -38
- package/dest/utils/accounts.d.ts +0 -11
- package/dest/utils/accounts.d.ts.map +0 -1
- package/dest/utils/accounts.js +0 -87
- package/dest/utils/pxe_wrapper.d.ts +0 -10
- package/dest/utils/pxe_wrapper.d.ts.map +0 -1
- package/dest/utils/pxe_wrapper.js +0 -21
- package/src/cmds/add_authwit.ts +0 -13
- package/src/cmds/cancel_tx.ts +0 -62
- package/src/utils/accounts.ts +0 -102
- package/src/utils/pxe_wrapper.ts +0 -26
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
import { FeeJuicePaymentMethod } from '@aztec/aztec.js';
|
|
2
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
3
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
5
4
|
import { Option } from 'commander';
|
|
6
|
-
import {
|
|
5
|
+
import { BASE_FEE_PADDING } from '../wallet.js';
|
|
7
6
|
import { aliasedAddressParser } from './options.js';
|
|
8
|
-
export function printGasEstimates(feeOpts, gasEstimates, log) {
|
|
9
|
-
log(`Estimated gas usage: ${formatGasEstimate(gasEstimates)}`);
|
|
10
|
-
log(`Maximum total tx fee: ${getEstimatedCost(gasEstimates, feeOpts.gasSettings.maxFeesPerGas)}`);
|
|
11
|
-
}
|
|
12
|
-
function formatGasEstimate(estimate) {
|
|
13
|
-
return `da=${estimate.gasLimits.daGas},l2=${estimate.gasLimits.l2Gas},teardownDA=${estimate.teardownGasLimits.daGas},teardownL2=${estimate.teardownGasLimits.l2Gas}`;
|
|
14
|
-
}
|
|
15
|
-
function getEstimatedCost(estimate, maxFeesPerGas) {
|
|
16
|
-
return GasSettings.default({
|
|
17
|
-
...estimate,
|
|
18
|
-
maxFeesPerGas
|
|
19
|
-
}).getFeeLimit().toBigInt();
|
|
20
|
-
}
|
|
21
|
-
async function parseGasSettings(args, pxe) {
|
|
22
|
-
const gasLimits = args.gasLimits ? parseGasLimits(args.gasLimits) : {};
|
|
23
|
-
const maxFeesPerGas = args.maxFeesPerGas ? parseGasFees(args.maxFeesPerGas) : await pxe.getCurrentBaseFees();
|
|
24
|
-
const maxPriorityFeesPerGas = args.maxPriorityFeesPerGas ? parseGasFees(args.maxPriorityFeesPerGas) : undefined;
|
|
25
|
-
return GasSettings.default({
|
|
26
|
-
...gasLimits,
|
|
27
|
-
maxFeesPerGas,
|
|
28
|
-
maxPriorityFeesPerGas
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
7
|
function printOptionParams(params) {
|
|
32
8
|
const paramsWithDescription = Object.keys(params).filter((name)=>params[name].description);
|
|
33
9
|
const maxParamWidth = paramsWithDescription.reduce((v, name)=>Math.max(v, name.length), 0);
|
|
@@ -36,25 +12,18 @@ function printOptionParams(params) {
|
|
|
36
12
|
`${indent(5)}${name}${indent(maxParamWidth - name.length)} ${params[name].description}`,
|
|
37
13
|
params[name].default ? `Default: ${params[name].default}` : ''
|
|
38
14
|
].join(' '));
|
|
39
|
-
return descriptionList.length ? `\n Parameters:\n${descriptionList.join('\n')}` : '';
|
|
15
|
+
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
16
|
}
|
|
41
|
-
function getFeePaymentMethodParams(
|
|
42
|
-
const feePayer = allowCustomFeePayer ? {
|
|
43
|
-
type: 'address',
|
|
44
|
-
description: 'The account paying the fee.'
|
|
45
|
-
} : undefined;
|
|
17
|
+
function getFeePaymentMethodParams() {
|
|
46
18
|
return {
|
|
47
19
|
method: {
|
|
48
20
|
type: 'name',
|
|
49
|
-
description: 'Valid values: "fee_juice", "fpc-public", "fpc-private"
|
|
21
|
+
description: 'Valid values: "fee_juice", "fpc-public", "fpc-private", "fpc-sponsored"',
|
|
50
22
|
default: 'fee_juice'
|
|
51
23
|
},
|
|
52
|
-
...feePayer ? {
|
|
53
|
-
feePayer
|
|
54
|
-
} : {},
|
|
55
24
|
asset: {
|
|
56
25
|
type: 'address',
|
|
57
|
-
description: 'The asset used for fee payment.
|
|
26
|
+
description: 'The asset used for fee payment. Required for "fpc-public" and "fpc-private".'
|
|
58
27
|
},
|
|
59
28
|
fpc: {
|
|
60
29
|
type: 'address',
|
|
@@ -75,165 +44,95 @@ function getFeePaymentMethodParams(allowCustomFeePayer) {
|
|
|
75
44
|
messageLeafIndex: {
|
|
76
45
|
type: 'bigint',
|
|
77
46
|
description: 'The index of the claim in the l1toL2Message tree.'
|
|
78
|
-
},
|
|
79
|
-
feeRecipient: {
|
|
80
|
-
type: 'string',
|
|
81
|
-
description: 'Recipient of the fee.'
|
|
82
47
|
}
|
|
83
48
|
};
|
|
84
49
|
}
|
|
85
|
-
function getPaymentMethodOption(
|
|
86
|
-
const params = getFeePaymentMethodParams(
|
|
87
|
-
|
|
88
|
-
return new Option(`--payment <${paramList.join(',')}>`, `Fee payment method and arguments.${printOptionParams(params)}`);
|
|
50
|
+
export function getPaymentMethodOption() {
|
|
51
|
+
const params = getFeePaymentMethodParams();
|
|
52
|
+
return new Option(`--payment <options>`, `Fee payment method and arguments.${printOptionParams(params)}`);
|
|
89
53
|
}
|
|
90
|
-
function getFeeOptions(
|
|
54
|
+
function getFeeOptions() {
|
|
91
55
|
return [
|
|
92
|
-
getPaymentMethodOption(
|
|
56
|
+
getPaymentMethodOption(),
|
|
93
57
|
new Option('--gas-limits <da=100,l2=100,teardownDA=10,teardownL2=10>', 'Gas limits for the tx.'),
|
|
94
58
|
new Option('--max-fees-per-gas <da=100,l2=100>', 'Maximum fees per gas unit for DA and L2 computation.'),
|
|
95
59
|
new Option('--max-priority-fees-per-gas <da=0,l2=0>', 'Maximum priority fees per gas unit for DA and L2 computation.'),
|
|
96
|
-
new Option('--no-estimate-gas', 'Whether to automatically estimate gas limits for the tx.'),
|
|
97
60
|
new Option('--estimate-gas-only', 'Only report gas estimation for the tx, do not send it.')
|
|
98
61
|
];
|
|
99
62
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.paymentMethodFactory = paymentMethodFactory;
|
|
110
|
-
this.getDeployWallet = getDeployWallet;
|
|
111
|
-
this.estimateGas = estimateGas;
|
|
112
|
-
}
|
|
113
|
-
async toSendOpts(sender) {
|
|
114
|
-
return {
|
|
115
|
-
fee: {
|
|
116
|
-
estimateGas: this.estimateGas,
|
|
117
|
-
gasSettings: this.gasSettings,
|
|
118
|
-
paymentMethod: await this.paymentMethodFactory(sender)
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
async toDeployAccountOpts(sender) {
|
|
123
|
-
const paymentMethod = await this.paymentMethodFactory(sender);
|
|
124
|
-
const deployWallet = await this.getDeployWallet(sender, paymentMethod);
|
|
125
|
-
return {
|
|
126
|
-
deployWallet,
|
|
127
|
-
fee: {
|
|
128
|
-
estimateGas: this.estimateGas,
|
|
129
|
-
gasSettings: this.gasSettings,
|
|
130
|
-
paymentMethod
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
static paymentMethodOption() {
|
|
135
|
-
return getPaymentMethodOption(false);
|
|
136
|
-
}
|
|
137
|
-
static getOptions() {
|
|
138
|
-
return getFeeOptions(false);
|
|
139
|
-
}
|
|
140
|
-
static async fromCli(args, pxe, log, db) {
|
|
141
|
-
const estimateOnly = args.estimateGasOnly;
|
|
142
|
-
const gasSettings = await parseGasSettings(args, pxe);
|
|
143
|
-
const defaultPaymentMethod = async (sender)=>{
|
|
144
|
-
const { FeeJuicePaymentMethod } = await import('@aztec/aztec.js/fee');
|
|
145
|
-
return new FeeJuicePaymentMethod(sender.getAddress());
|
|
146
|
-
};
|
|
147
|
-
const getDeployWallet = ()=>{
|
|
148
|
-
// Returns undefined. The sender's wallet will be used by default.
|
|
149
|
-
return Promise.resolve(undefined);
|
|
150
|
-
};
|
|
151
|
-
return new FeeOpts(estimateOnly, gasSettings, args.payment ? parsePaymentMethod(args.payment, false, log, db) : defaultPaymentMethod, getDeployWallet, !!args.estimateGas);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
export class FeeOptsWithFeePayer extends FeeOpts {
|
|
155
|
-
static paymentMethodOption() {
|
|
156
|
-
return getPaymentMethodOption(true);
|
|
157
|
-
}
|
|
158
|
-
static getOptions() {
|
|
159
|
-
return getFeeOptions(true);
|
|
160
|
-
}
|
|
161
|
-
static async fromCli(args, pxe, log, db) {
|
|
162
|
-
const estimateOnly = args.estimateGasOnly;
|
|
163
|
-
const gasSettings = await parseGasSettings(args, pxe);
|
|
164
|
-
const defaultPaymentMethod = async (sender)=>{
|
|
165
|
-
const { FeeJuicePaymentMethod } = await import('@aztec/aztec.js/fee');
|
|
166
|
-
return new FeeJuicePaymentMethod(sender.getAddress());
|
|
167
|
-
};
|
|
168
|
-
const getDeployWallet = async (sender, paymentMethod)=>{
|
|
169
|
-
if (paymentMethod instanceof FeeJuicePaymentMethod) {
|
|
170
|
-
const feePayer = await paymentMethod.getFeePayer();
|
|
171
|
-
if (!sender.getAddress().equals(feePayer)) {
|
|
172
|
-
return (await createOrRetrieveAccount(pxe, feePayer, db)).getWallet();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return undefined;
|
|
176
|
-
};
|
|
177
|
-
return new FeeOptsWithFeePayer(estimateOnly, gasSettings, args.payment ? parsePaymentMethod(args.payment, true, log, db) : defaultPaymentMethod, getDeployWallet, !!args.estimateGas);
|
|
178
|
-
}
|
|
63
|
+
function parseGasSettings(args) {
|
|
64
|
+
const gasLimits = args.gasLimits ? parseGasLimits(args.gasLimits) : {};
|
|
65
|
+
const maxFeesPerGas = args.maxFeesPerGas ? parseGasFees(args.maxFeesPerGas) : undefined;
|
|
66
|
+
const maxPriorityFeesPerGas = args.maxPriorityFeesPerGas ? parseGasFees(args.maxPriorityFeesPerGas) : undefined;
|
|
67
|
+
return {
|
|
68
|
+
...gasLimits,
|
|
69
|
+
maxFeesPerGas,
|
|
70
|
+
maxPriorityFeesPerGas
|
|
71
|
+
};
|
|
179
72
|
}
|
|
180
|
-
export function parsePaymentMethod(payment,
|
|
73
|
+
export function parsePaymentMethod(payment, log, db) {
|
|
181
74
|
const parsed = payment.split(',').reduce((acc, item)=>{
|
|
182
75
|
const [dimension, value] = item.split('=');
|
|
183
76
|
acc[dimension] = value ?? 1;
|
|
184
77
|
return acc;
|
|
185
78
|
}, {});
|
|
186
|
-
const
|
|
79
|
+
const getFpc = ()=>{
|
|
187
80
|
if (!parsed.fpc) {
|
|
188
81
|
throw new Error('Missing "fpc" in payment option');
|
|
189
82
|
}
|
|
83
|
+
return aliasedAddressParser('contracts', parsed.fpc, db);
|
|
84
|
+
};
|
|
85
|
+
const getAsset = ()=>{
|
|
190
86
|
if (!parsed.asset) {
|
|
191
87
|
throw new Error('Missing "asset" in payment option');
|
|
192
88
|
}
|
|
193
|
-
|
|
194
|
-
return [
|
|
195
|
-
AztecAddress.fromString(parsed.asset),
|
|
196
|
-
fpc
|
|
197
|
-
];
|
|
89
|
+
return AztecAddress.fromString(parsed.asset);
|
|
198
90
|
};
|
|
199
|
-
return async (
|
|
91
|
+
return async (wallet, from, gasSettings)=>{
|
|
200
92
|
switch(parsed.method){
|
|
201
93
|
case 'fee_juice':
|
|
202
94
|
{
|
|
203
95
|
if (parsed.claim || parsed.claimSecret && parsed.claimAmount && parsed.messageLeafIndex) {
|
|
204
96
|
let claimAmount, claimSecret, messageLeafIndex;
|
|
205
97
|
if (parsed.claim && db) {
|
|
206
|
-
({ amount: claimAmount, secret: claimSecret, leafIndex: messageLeafIndex } = await db.popBridgedFeeJuice(
|
|
98
|
+
({ amount: claimAmount, secret: claimSecret, leafIndex: messageLeafIndex } = await db.popBridgedFeeJuice(from, log));
|
|
207
99
|
} else {
|
|
208
100
|
({ claimAmount, claimSecret, messageLeafIndex } = parsed);
|
|
209
101
|
}
|
|
210
102
|
log(`Using Fee Juice for fee payments with claim for ${claimAmount} tokens`);
|
|
211
103
|
const { FeeJuicePaymentMethodWithClaim } = await import('@aztec/aztec.js/fee');
|
|
212
|
-
return new FeeJuicePaymentMethodWithClaim(
|
|
104
|
+
return new FeeJuicePaymentMethodWithClaim(from, {
|
|
213
105
|
claimAmount: (typeof claimAmount === 'string' ? Fr.fromHexString(claimAmount) : new Fr(claimAmount)).toBigInt(),
|
|
214
106
|
claimSecret: Fr.fromHexString(claimSecret),
|
|
215
107
|
messageLeafIndex: BigInt(messageLeafIndex)
|
|
216
108
|
});
|
|
217
109
|
} else {
|
|
218
|
-
log(`Using Fee Juice for fee payment`);
|
|
219
|
-
|
|
220
|
-
const feePayer = parsed.feePayer && allowCustomFeePayer ? aliasedAddressParser('accounts', parsed.feePayer, db) : sender.getAddress();
|
|
221
|
-
return new FeeJuicePaymentMethod(feePayer);
|
|
110
|
+
log(`Using Fee Juice for fee payment with the balance of account ${from}`);
|
|
111
|
+
return;
|
|
222
112
|
}
|
|
223
113
|
}
|
|
224
114
|
case 'fpc-public':
|
|
225
115
|
{
|
|
226
|
-
const
|
|
116
|
+
const fpc = getFpc();
|
|
117
|
+
const asset = getAsset();
|
|
227
118
|
log(`Using public fee payment with asset ${asset} via paymaster ${fpc}`);
|
|
228
119
|
const { PublicFeePaymentMethod } = await import('@aztec/aztec.js/fee');
|
|
229
|
-
return new PublicFeePaymentMethod(fpc,
|
|
120
|
+
return new PublicFeePaymentMethod(fpc, from, wallet, gasSettings);
|
|
230
121
|
}
|
|
231
122
|
case 'fpc-private':
|
|
232
123
|
{
|
|
233
|
-
const
|
|
124
|
+
const fpc = getFpc();
|
|
125
|
+
const asset = getAsset();
|
|
234
126
|
log(`Using private fee payment with asset ${asset} via paymaster ${fpc}`);
|
|
235
127
|
const { PrivateFeePaymentMethod } = await import('@aztec/aztec.js/fee');
|
|
236
|
-
return new PrivateFeePaymentMethod(fpc,
|
|
128
|
+
return new PrivateFeePaymentMethod(fpc, from, wallet, gasSettings);
|
|
129
|
+
}
|
|
130
|
+
case 'fpc-sponsored':
|
|
131
|
+
{
|
|
132
|
+
const sponsor = getFpc();
|
|
133
|
+
log(`Using sponsored fee payment with sponsor ${sponsor}`);
|
|
134
|
+
const { SponsoredFeePaymentMethod } = await import('@aztec/aztec.js/fee/testing');
|
|
135
|
+
return new SponsoredFeePaymentMethod(sponsor);
|
|
237
136
|
}
|
|
238
137
|
case undefined:
|
|
239
138
|
throw new Error('Missing "method" in payment option');
|
|
@@ -281,3 +180,45 @@ export function parseGasFees(gasFees) {
|
|
|
281
180
|
}
|
|
282
181
|
return new GasFees(parsed.da, parsed.l2);
|
|
283
182
|
}
|
|
183
|
+
export class CLIFeeArgs {
|
|
184
|
+
estimateOnly;
|
|
185
|
+
paymentMethod;
|
|
186
|
+
gasSettings;
|
|
187
|
+
constructor(estimateOnly, paymentMethod, gasSettings){
|
|
188
|
+
this.estimateOnly = estimateOnly;
|
|
189
|
+
this.paymentMethod = paymentMethod;
|
|
190
|
+
this.gasSettings = gasSettings;
|
|
191
|
+
}
|
|
192
|
+
async toUserFeeOptions(node, wallet, from) {
|
|
193
|
+
const maxFeesPerGas = (await node.getCurrentBaseFees()).mul(1 + BASE_FEE_PADDING);
|
|
194
|
+
const gasSettings = GasSettings.default({
|
|
195
|
+
...this.gasSettings,
|
|
196
|
+
maxFeesPerGas
|
|
197
|
+
});
|
|
198
|
+
const paymentMethod = await this.paymentMethod(wallet, from, gasSettings);
|
|
199
|
+
return {
|
|
200
|
+
paymentMethod,
|
|
201
|
+
gasSettings
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
static parse(args, log, db) {
|
|
205
|
+
return new CLIFeeArgs(!!args.estimateGasOnly, parsePaymentMethod(args.payment ?? 'method=fee_juice', log, db), parseGasSettings(args));
|
|
206
|
+
}
|
|
207
|
+
static getOptions() {
|
|
208
|
+
return getFeeOptions();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// Printing
|
|
212
|
+
export function printGasEstimates(feeOpts, gasEstimates, log) {
|
|
213
|
+
log(`Estimated gas usage: ${formatGasEstimate(gasEstimates)}`);
|
|
214
|
+
log(`Maximum total tx fee: ${getEstimatedCost(gasEstimates, feeOpts.gasSettings.maxFeesPerGas)}`);
|
|
215
|
+
}
|
|
216
|
+
function formatGasEstimate(estimate) {
|
|
217
|
+
return `da=${estimate.gasLimits.daGas},l2=${estimate.gasLimits.l2Gas},teardownDA=${estimate.teardownGasLimits.daGas},teardownL2=${estimate.teardownGasLimits.l2Gas}`;
|
|
218
|
+
}
|
|
219
|
+
function getEstimatedCost(estimate, maxFeesPerGas) {
|
|
220
|
+
return GasSettings.default({
|
|
221
|
+
...estimate,
|
|
222
|
+
maxFeesPerGas
|
|
223
|
+
}).getFeeLimit().toBigInt();
|
|
224
|
+
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
1
2
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
2
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
import { Option } from 'commander';
|
|
4
5
|
import type { AliasType, WalletDB } from '../../storage/wallet_db.js';
|
|
5
6
|
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
7
|
export declare function integerArgParser(value: string, argName: string, min?: number, max?: number): number;
|
|
7
|
-
export declare function aliasedTxHashParser(txHash: string, db?: WalletDB):
|
|
8
|
-
export declare function aliasedAuthWitParser(
|
|
8
|
+
export declare function aliasedTxHashParser(txHash: string, db?: WalletDB): TxHash;
|
|
9
|
+
export declare function aliasedAuthWitParser(witnesses: string, db?: WalletDB): AuthWitness[];
|
|
9
10
|
export declare function aliasedAddressParser(defaultPrefix: AliasType, address: string, db?: WalletDB): AztecAddress;
|
|
10
|
-
export declare function aliasedSecretKeyParser(sk: string, db?: WalletDB): import("@aztec/
|
|
11
|
+
export declare function aliasedSecretKeyParser(sk: string, db?: WalletDB): import("@aztec/foundation/schemas").Fr;
|
|
11
12
|
export declare function createAliasOption(description: string, hide: boolean): Option;
|
|
12
13
|
export declare function createAccountOption(description: string, hide: boolean, db?: WalletDB): Option;
|
|
14
|
+
export declare function createAuthwitnessOption(description: string, hide: boolean, db?: WalletDB): Option;
|
|
13
15
|
export declare function createTypeOption(mandatory: boolean): Option;
|
|
14
16
|
export declare function createArgsOption(isConstructor: boolean, db?: WalletDB): Option;
|
|
15
17
|
export declare function createContractAddressOption(db?: WalletDB): Option;
|
|
18
|
+
export declare function createDebugExecutionStepsDirOption(): Option;
|
|
19
|
+
export declare function createVerboseOption(): Option;
|
|
16
20
|
export declare function artifactPathParser(filePath: string, db?: WalletDB): Promise<string>;
|
|
17
21
|
export declare function artifactPathFromPromiseOrAlias(artifactPathPromise: Promise<string>, contractAddress: AztecAddress, db?: WalletDB): Promise<string>;
|
|
18
22
|
export declare function createArtifactOption(db?: WalletDB): Option;
|
|
19
|
-
export declare function
|
|
23
|
+
export declare function cleanupAuthWitnesses(authWitnesses: AuthWitness[] | undefined): AuthWitness[];
|
|
20
24
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/utils/options/options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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,mBAAmB,WAKlC;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"}
|
|
@@ -2,7 +2,7 @@ import { parseAztecAddress, parseSecretKey, parseTxHash } from '@aztec/cli/utils
|
|
|
2
2
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
3
|
import { Option } from 'commander';
|
|
4
4
|
import { readdir, stat } from 'fs/promises';
|
|
5
|
-
import { AccountTypes } from '../
|
|
5
|
+
import { AccountTypes } from '../wallet.js';
|
|
6
6
|
const TARGET_DIR = 'target';
|
|
7
7
|
export 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";
|
|
8
8
|
export function integerArgParser(value, argName, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
@@ -18,20 +18,23 @@ export function integerArgParser(value, argName, min = Number.MIN_SAFE_INTEGER,
|
|
|
18
18
|
export function aliasedTxHashParser(txHash, db) {
|
|
19
19
|
try {
|
|
20
20
|
return parseTxHash(txHash);
|
|
21
|
-
} catch
|
|
21
|
+
} catch {
|
|
22
22
|
const prefixed = txHash.includes(':') ? txHash : `transactions:${txHash}`;
|
|
23
23
|
const rawTxHash = db ? db.tryRetrieveAlias(prefixed) : txHash;
|
|
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 {
|
|
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')) {
|
|
@@ -57,6 +60,9 @@ export function createAliasOption(description, hide) {
|
|
|
57
60
|
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
|
}
|
|
63
|
+
export function createAuthwitnessOption(description, hide, db) {
|
|
64
|
+
return new Option('-aw, --auth-witness <string,...>', description).hideHelp(hide).argParser((witness)=>aliasedAuthWitParser(witness, db));
|
|
65
|
+
}
|
|
60
66
|
export function createTypeOption(mandatory) {
|
|
61
67
|
return new Option('-t, --type <string>', 'Type of account to create').choices(AccountTypes).default('schnorr').conflicts('account-or-address').makeOptionMandatory(mandatory);
|
|
62
68
|
}
|
|
@@ -70,6 +76,12 @@ export function createArgsOption(isConstructor, db) {
|
|
|
70
76
|
export function createContractAddressOption(db) {
|
|
71
77
|
return new Option('-ca, --contract-address <address>', 'Aztec address of the contract.').argParser((address)=>aliasedAddressParser('contracts', address, db)).makeOptionMandatory(true);
|
|
72
78
|
}
|
|
79
|
+
export function createDebugExecutionStepsDirOption() {
|
|
80
|
+
return new Option('--debug-execution-steps-dir <address>', 'Directory to write execution step artifacts for bb profiling/debugging.').makeOptionMandatory(false);
|
|
81
|
+
}
|
|
82
|
+
export function createVerboseOption() {
|
|
83
|
+
return new Option('-v, --verbose', 'Provide timings on all executed operations (synching, simulating, proving)').default(false);
|
|
84
|
+
}
|
|
73
85
|
export function artifactPathParser(filePath, db) {
|
|
74
86
|
if (filePath.includes('@')) {
|
|
75
87
|
const [pkg, contractName] = filePath.split('@');
|
|
@@ -95,14 +107,11 @@ export async function artifactPathFromPromiseOrAlias(artifactPathPromise, contra
|
|
|
95
107
|
export function createArtifactOption(db) {
|
|
96
108
|
return new Option('-c, --contract-artifact <fileLocation>', ARTIFACT_DESCRIPTION).argParser((filePath)=>artifactPathParser(filePath, db)).makeOptionMandatory(false);
|
|
97
109
|
}
|
|
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
110
|
async function contractArtifactFromWorkspace(pkg, contractName) {
|
|
102
111
|
const cwd = process.cwd();
|
|
103
112
|
try {
|
|
104
113
|
await stat(`${cwd}/Nargo.toml`);
|
|
105
|
-
} catch
|
|
114
|
+
} catch {
|
|
106
115
|
throw new Error('Invalid contract artifact argument provided. To use this option, command should be called from a nargo workspace');
|
|
107
116
|
}
|
|
108
117
|
const filesInTarget = await readdir(`${cwd}/${TARGET_DIR}`);
|
|
@@ -120,3 +129,6 @@ async function contractArtifactFromWorkspace(pkg, contractName) {
|
|
|
120
129
|
}
|
|
121
130
|
return `${cwd}/${TARGET_DIR}/${bestMatch[0]}`;
|
|
122
131
|
}
|
|
132
|
+
export function cleanupAuthWitnesses(authWitnesses) {
|
|
133
|
+
return authWitnesses?.filter((w)=>w !== undefined) ?? [];
|
|
134
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
3
|
+
import type { ProvingStats, SimulationStats } from '@aztec/stdlib/tx';
|
|
4
|
+
export declare function printProfileResult(stats: ProvingStats | SimulationStats, log: LogFn, printOracles?: boolean, executionSteps?: PrivateExecutionStep[]): void;
|
|
5
|
+
//# sourceMappingURL=profiling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,YAAY,GAAE,OAAe,EAC7B,cAAc,CAAC,EAAE,oBAAoB,EAAE,QA6IxC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { format } from 'util';
|
|
2
|
+
const FN_NAME_PADDING = 60;
|
|
3
|
+
const COLUMN_MIN_WIDTH = 13;
|
|
4
|
+
const COLUMN_MAX_WIDTH = 15;
|
|
5
|
+
const ORACLE_NAME_PADDING = 50;
|
|
6
|
+
export function printProfileResult(stats, log, printOracles = false, executionSteps) {
|
|
7
|
+
log(format('\nPer circuit breakdown:\n'));
|
|
8
|
+
log(format(' ', 'Function name'.padEnd(FN_NAME_PADDING), 'Time'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), executionSteps ? 'Gates'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '', executionSteps ? 'Subtotal'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : ''));
|
|
9
|
+
log(format(''.padEnd(FN_NAME_PADDING + COLUMN_MAX_WIDTH + COLUMN_MAX_WIDTH + (executionSteps ? COLUMN_MAX_WIDTH + COLUMN_MAX_WIDTH : 0), '-')));
|
|
10
|
+
let acc = 0;
|
|
11
|
+
let biggest = executionSteps?.[0];
|
|
12
|
+
const timings = stats.timings;
|
|
13
|
+
timings.perFunction.forEach((fn, i)=>{
|
|
14
|
+
const currentExecutionStep = executionSteps?.[i];
|
|
15
|
+
if (currentExecutionStep && biggest && currentExecutionStep.gateCount > biggest.gateCount) {
|
|
16
|
+
biggest = currentExecutionStep;
|
|
17
|
+
}
|
|
18
|
+
acc += currentExecutionStep ? currentExecutionStep.gateCount : 0;
|
|
19
|
+
log(format(' - ', fn.functionName.padEnd(FN_NAME_PADDING), `${fn.time.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), currentExecutionStep ? currentExecutionStep.gateCount.toLocaleString().padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '', currentExecutionStep ? acc.toLocaleString().padStart(COLUMN_MAX_WIDTH) : ''));
|
|
20
|
+
if (printOracles && fn.oracles) {
|
|
21
|
+
log('');
|
|
22
|
+
for (const [oracleName, { times }] of Object.entries(fn.oracles)){
|
|
23
|
+
const calls = times.length;
|
|
24
|
+
const min = Math.min(...times);
|
|
25
|
+
const max = Math.max(...times);
|
|
26
|
+
const total = times.reduce((acc, time)=>acc + time, 0);
|
|
27
|
+
const avg = total / calls;
|
|
28
|
+
log(format(' ', oracleName.padEnd(ORACLE_NAME_PADDING), `${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH)));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
log('');
|
|
32
|
+
});
|
|
33
|
+
if (biggest) {
|
|
34
|
+
log(format('\nTotal gates:', acc.toLocaleString(), `(Biggest circuit: ${biggest.functionName} -> ${biggest.gateCount.toLocaleString()})`));
|
|
35
|
+
}
|
|
36
|
+
if (stats.nodeRPCCalls) {
|
|
37
|
+
log(format('\nRPC calls:\n'));
|
|
38
|
+
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)){
|
|
39
|
+
const calls = times.length;
|
|
40
|
+
const total = times.reduce((acc, time)=>acc + time, 0);
|
|
41
|
+
const avg = total / calls;
|
|
42
|
+
const min = Math.min(...times);
|
|
43
|
+
const max = Math.max(...times);
|
|
44
|
+
log(format(method.padEnd(ORACLE_NAME_PADDING), `${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH)));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
|
|
48
|
+
log(format('Private simulation time:'.padEnd(25), `${timings.perFunction.reduce((acc, { time })=>acc + time, 0).toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
49
|
+
if (timings.proving) {
|
|
50
|
+
log(format('Proving time:'.padEnd(25), `${timings.proving?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
51
|
+
}
|
|
52
|
+
if (timings.publicSimulation) {
|
|
53
|
+
log(format('Public simulation time:'.padEnd(25), `${timings.publicSimulation?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
54
|
+
}
|
|
55
|
+
if (timings.validation) {
|
|
56
|
+
log(format('Validation time:'.padEnd(25), `${timings.validation?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
57
|
+
}
|
|
58
|
+
log(format('Total time:'.padEnd(25), `${timings.total.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH), `(${timings.unaccounted.toFixed(2)}ms unaccounted)`));
|
|
59
|
+
log('\n');
|
|
60
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Account } from '@aztec/aztec.js/account';
|
|
2
|
+
import { type InteractionFeeOptions } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
+
import { UniqueNote } from '@aztec/aztec.js/note';
|
|
5
|
+
import { AccountManager, type Aliased, BaseWallet, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
6
|
+
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
7
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
8
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
9
|
+
import type { PXEConfig } from '@aztec/pxe/config';
|
|
10
|
+
import type { PXE } from '@aztec/pxe/server';
|
|
11
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
+
import type { NotesFilter } from '@aztec/stdlib/note';
|
|
13
|
+
import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
14
|
+
import type { WalletDB } from '../storage/wallet_db.js';
|
|
15
|
+
export declare const AccountTypes: readonly ["schnorr", "ecdsasecp256r1", "ecdsasecp256r1ssh", "ecdsasecp256k1"];
|
|
16
|
+
export type AccountType = (typeof AccountTypes)[number];
|
|
17
|
+
export declare const BASE_FEE_PADDING = 0.5;
|
|
18
|
+
export declare class CLIWallet extends BaseWallet {
|
|
19
|
+
private userLog;
|
|
20
|
+
private db?;
|
|
21
|
+
private accountCache;
|
|
22
|
+
constructor(pxe: PXE, node: AztecNode, userLog: LogFn, db?: WalletDB | undefined);
|
|
23
|
+
static create(node: AztecNode, log: LogFn, db?: WalletDB, overridePXEConfig?: Partial<PXEConfig>): Promise<CLIWallet>;
|
|
24
|
+
getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
25
|
+
private createCancellationTxExecutionRequest;
|
|
26
|
+
proveCancellationTx(from: AztecAddress, txNonce: Fr, increasedFee: InteractionFeeOptions): Promise<TxProvingResult>;
|
|
27
|
+
getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
28
|
+
private createAccount;
|
|
29
|
+
createOrRetrieveAccount(address?: AztecAddress, secretKey?: Fr, type?: AccountType, salt?: Fr, publicKey?: string): Promise<AccountManager>;
|
|
30
|
+
private getFakeAccountDataFor;
|
|
31
|
+
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
32
|
+
getContracts(): Promise<AztecAddress[]>;
|
|
33
|
+
getNotes(filter: NotesFilter): Promise<UniqueNote[]>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAA2C,MAAM,yBAAyB,CAAC;AAChG,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,M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