@aztec/cli-wallet 0.0.1-commit.d431d1c → 0.0.1-commit.e2b2873ed
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/authorize_action.js +4 -2
- package/dest/cmds/check_tx.js +4 -1
- package/dest/cmds/create_account.d.ts +1 -1
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +24 -18
- package/dest/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +46 -23
- package/dest/cmds/deploy_account.d.ts +1 -1
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +24 -18
- package/dest/cmds/send.d.ts +1 -1
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +28 -16
- package/dest/storage/wallet_db.d.ts +1 -1
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +46 -31
- package/dest/utils/wallet.d.ts +7 -2
- package/dest/utils/wallet.d.ts.map +1 -1
- package/dest/utils/wallet.js +31 -28
- package/package.json +14 -14
- package/src/cmds/authorize_action.ts +1 -1
- package/src/cmds/check_tx.ts +4 -1
- package/src/cmds/create_account.ts +23 -17
- package/src/cmds/deploy.ts +41 -22
- package/src/cmds/deploy_account.ts +23 -17
- package/src/cmds/send.ts +22 -10
- package/src/storage/wallet_db.ts +49 -36
- package/src/utils/wallet.ts +43 -45
package/src/utils/wallet.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { NoteDao } from '@aztec/stdlib/note';
|
|
|
22
22
|
import type { NotesFilter } from '@aztec/stdlib/note';
|
|
23
23
|
import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
24
24
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
25
|
-
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
25
|
+
import { BaseWallet, type FeeOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
26
26
|
|
|
27
27
|
import type { WalletDB } from '../storage/wallet_db.js';
|
|
28
28
|
import type { AccountType } from './constants.js';
|
|
@@ -87,7 +87,7 @@ export class CLIWallet extends BaseWallet {
|
|
|
87
87
|
increasedFee: InteractionFeeOptions,
|
|
88
88
|
): Promise<TxProvingResult> {
|
|
89
89
|
const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
|
|
90
|
-
return await this.pxe.proveTx(cancellationTxRequest);
|
|
90
|
+
return await this.pxe.proveTx(cancellationTxRequest, this.scopesFor(from));
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
override async getAccountFromAddress(address: AztecAddress) {
|
|
@@ -208,12 +208,32 @@ export class CLIWallet extends BaseWallet {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
override async simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult> {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
const simulationResults = await super.simulateTx(executionPayload, opts);
|
|
212
|
+
|
|
213
|
+
if (opts.fee?.estimateGas) {
|
|
214
|
+
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
215
|
+
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
216
|
+
printGasEstimates(feeOptions, limits, this.userLog);
|
|
217
|
+
}
|
|
218
|
+
return simulationResults;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Uses a stub account for kernelless simulation, bypassing real account authorization.
|
|
223
|
+
* Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
|
|
224
|
+
*/
|
|
225
|
+
protected override async simulateViaEntrypoint(
|
|
226
|
+
executionPayload: ExecutionPayload,
|
|
227
|
+
from: AztecAddress,
|
|
228
|
+
feeOptions: FeeOptions,
|
|
229
|
+
skipTxValidation?: boolean,
|
|
230
|
+
skipFeeEnforcement?: boolean,
|
|
231
|
+
): Promise<TxSimulationResult> {
|
|
232
|
+
if (from.equals(AztecAddress.ZERO)) {
|
|
233
|
+
return super.simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement);
|
|
234
|
+
}
|
|
235
|
+
|
|
215
236
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
216
|
-
const chainInfo = await this.getChainInfo();
|
|
217
237
|
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
218
238
|
txNonce: Fr.random(),
|
|
219
239
|
cancellable: this.cancellableTransactions,
|
|
@@ -223,44 +243,22 @@ export class CLIWallet extends BaseWallet {
|
|
|
223
243
|
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
224
244
|
: executionPayload;
|
|
225
245
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
);
|
|
243
|
-
} else {
|
|
244
|
-
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
|
|
245
|
-
const txRequest = await fromAccount.createTxExecutionRequest(
|
|
246
|
-
finalExecutionPayload,
|
|
247
|
-
feeOptions.gasSettings,
|
|
248
|
-
chainInfo,
|
|
249
|
-
executionOptions,
|
|
250
|
-
);
|
|
251
|
-
const contractOverrides = {
|
|
252
|
-
[opts.from.toString()]: { instance, artifact },
|
|
253
|
-
};
|
|
254
|
-
simulationResults = await this.pxe.simulateTx(txRequest, true /* simulatePublic */, true, true, {
|
|
255
|
-
contracts: contractOverrides,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (opts.fee?.estimateGas) {
|
|
260
|
-
const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
|
|
261
|
-
printGasEstimates(feeOptions, limits, this.userLog);
|
|
262
|
-
}
|
|
263
|
-
return simulationResults;
|
|
246
|
+
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
247
|
+
const chainInfo = await this.getChainInfo();
|
|
248
|
+
const txRequest = await fromAccount.createTxExecutionRequest(
|
|
249
|
+
finalExecutionPayload,
|
|
250
|
+
feeOptions.gasSettings,
|
|
251
|
+
chainInfo,
|
|
252
|
+
executionOptions,
|
|
253
|
+
);
|
|
254
|
+
return this.pxe.simulateTx(txRequest, {
|
|
255
|
+
simulatePublic: true,
|
|
256
|
+
skipFeeEnforcement: true,
|
|
257
|
+
skipTxValidation: true,
|
|
258
|
+
overrides: {
|
|
259
|
+
contracts: { [from.toString()]: { instance, artifact } },
|
|
260
|
+
},
|
|
261
|
+
});
|
|
264
262
|
}
|
|
265
263
|
|
|
266
264
|
// Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
|