@aztec/cli-wallet 0.0.1-commit.e558bd1c → 0.0.1-commit.e57c76e

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.
Files changed (46) hide show
  1. package/dest/bin/index.js +1 -1
  2. package/dest/cmds/authorize_action.d.ts +2 -2
  3. package/dest/cmds/authorize_action.d.ts.map +1 -1
  4. package/dest/cmds/check_tx.d.ts +1 -1
  5. package/dest/cmds/check_tx.d.ts.map +1 -1
  6. package/dest/cmds/check_tx.js +42 -15
  7. package/dest/cmds/create_account.d.ts +4 -3
  8. package/dest/cmds/create_account.d.ts.map +1 -1
  9. package/dest/cmds/create_account.js +32 -21
  10. package/dest/cmds/deploy.d.ts +5 -4
  11. package/dest/cmds/deploy.d.ts.map +1 -1
  12. package/dest/cmds/deploy.js +43 -34
  13. package/dest/cmds/deploy_account.d.ts +4 -3
  14. package/dest/cmds/deploy_account.d.ts.map +1 -1
  15. package/dest/cmds/deploy_account.js +27 -16
  16. package/dest/cmds/get_fee_juice_balance.d.ts +5 -0
  17. package/dest/cmds/get_fee_juice_balance.d.ts.map +1 -0
  18. package/dest/cmds/get_fee_juice_balance.js +27 -0
  19. package/dest/cmds/index.d.ts +1 -1
  20. package/dest/cmds/index.d.ts.map +1 -1
  21. package/dest/cmds/index.js +31 -15
  22. package/dest/cmds/send.d.ts +4 -3
  23. package/dest/cmds/send.d.ts.map +1 -1
  24. package/dest/cmds/send.js +27 -23
  25. package/dest/storage/wallet_db.d.ts +6 -1
  26. package/dest/storage/wallet_db.d.ts.map +1 -1
  27. package/dest/storage/wallet_db.js +14 -0
  28. package/dest/utils/options/fees.d.ts +3 -2
  29. package/dest/utils/options/fees.d.ts.map +1 -1
  30. package/dest/utils/options/fees.js +32 -9
  31. package/dest/utils/wallet.d.ts +14 -5
  32. package/dest/utils/wallet.d.ts.map +1 -1
  33. package/dest/utils/wallet.js +115 -56
  34. package/package.json +16 -15
  35. package/src/bin/index.ts +1 -1
  36. package/src/cmds/check_tx.ts +46 -14
  37. package/src/cmds/create_account.ts +32 -18
  38. package/src/cmds/deploy.ts +40 -32
  39. package/src/cmds/deploy_account.ts +26 -13
  40. package/src/cmds/get_fee_juice_balance.ts +37 -0
  41. package/src/cmds/index.ts +60 -6
  42. package/src/cmds/send.ts +24 -16
  43. package/src/cmds/simulate.ts +1 -1
  44. package/src/storage/wallet_db.ts +14 -0
  45. package/src/utils/options/fees.ts +39 -9
  46. package/src/utils/wallet.ts +123 -76
@@ -5,7 +5,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import type { LogFn } from '@aztec/foundation/log';
6
6
  import type { FieldsOf } from '@aztec/foundation/types';
7
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
8
+ import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
9
9
  import type { FeeOptions } from '@aztec/wallet-sdk/base-wallet';
10
10
 
11
11
  import { Option } from 'commander';
@@ -115,6 +115,7 @@ export function parsePaymentMethod(
115
115
  payment: string,
116
116
  log: LogFn,
117
117
  db?: WalletDB,
118
+ estimateOnly?: boolean,
118
119
  ): (wallet: Wallet, from: AztecAddress, gasSettings: GasSettings) => Promise<FeePaymentMethod | undefined> {
119
120
  const parsed = payment.split(',').reduce(
120
121
  (acc, item) => {
@@ -149,7 +150,7 @@ export function parsePaymentMethod(
149
150
  amount: claimAmount,
150
151
  secret: claimSecret,
151
152
  leafIndex: messageLeafIndex,
152
- } = await db.popBridgedFeeJuice(from, log));
153
+ } = estimateOnly ? await db.peekBridgedFeeJuice(from, log) : await db.popBridgedFeeJuice(from, log));
153
154
  } else {
154
155
  ({ claimAmount, claimSecret, messageLeafIndex } = parsed);
155
156
  }
@@ -157,10 +158,10 @@ export function parsePaymentMethod(
157
158
  const { FeeJuicePaymentMethodWithClaim } = await import('@aztec/aztec.js/fee');
158
159
  return new FeeJuicePaymentMethodWithClaim(from, {
159
160
  claimAmount: (typeof claimAmount === 'string'
160
- ? Fr.fromHexString(claimAmount)
161
+ ? Fr.fromString(claimAmount)
161
162
  : new Fr(claimAmount)
162
163
  ).toBigInt(),
163
- claimSecret: Fr.fromHexString(claimSecret),
164
+ claimSecret: typeof claimSecret === 'string' ? Fr.fromString(claimSecret) : claimSecret,
164
165
  messageLeafIndex: BigInt(messageLeafIndex),
165
166
  });
166
167
  } else {
@@ -171,6 +172,9 @@ export function parsePaymentMethod(
171
172
  case 'fpc-public': {
172
173
  const fpc = getFpc();
173
174
  const asset = getAsset();
175
+ log(
176
+ `WARNING: fpc-public is deprecated and will not work on mainnet alpha. Use fee_juice or fpc-sponsored instead.`,
177
+ );
174
178
  log(`Using public fee payment with asset ${asset} via paymaster ${fpc}`);
175
179
  const { PublicFeePaymentMethod } = await import('@aztec/aztec.js/fee');
176
180
  return new PublicFeePaymentMethod(fpc, from, wallet, gasSettings);
@@ -178,6 +182,9 @@ export function parsePaymentMethod(
178
182
  case 'fpc-private': {
179
183
  const fpc = getFpc();
180
184
  const asset = getAsset();
185
+ log(
186
+ `WARNING: fpc-private is deprecated and will not work on mainnet alpha. Use fee_juice or fpc-sponsored instead.`,
187
+ );
181
188
  log(`Using private fee payment with asset ${asset} via paymaster ${fpc}`);
182
189
  const { PrivateFeePaymentMethod } = await import('@aztec/aztec.js/fee');
183
190
  return new PrivateFeePaymentMethod(fpc, from, wallet, gasSettings);
@@ -250,8 +257,9 @@ export class CLIFeeArgs {
250
257
  ) {}
251
258
 
252
259
  async toUserFeeOptions(node: AztecNode, wallet: Wallet, from: AztecAddress): Promise<ParsedFeeOptions> {
253
- const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1 + MIN_FEE_PADDING);
254
- const gasSettings = GasSettings.default({ ...this.gasSettings, maxFeesPerGas });
260
+ const minFees = await this.getMinFees(node);
261
+ const maxFeesPerGas = minFees.mul(1 + MIN_FEE_PADDING);
262
+ const gasSettings = GasSettings.fallback({ ...this.gasSettings, maxFeesPerGas });
255
263
  const paymentMethod = await this.paymentMethod(wallet, from, gasSettings);
256
264
  return {
257
265
  paymentMethod,
@@ -259,10 +267,32 @@ export class CLIFeeArgs {
259
267
  };
260
268
  }
261
269
 
270
+ /**
271
+ * Returns the worst-case min fee across predicted future slots.
272
+ * Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
273
+ */
274
+ private async getMinFees(node: AztecNode): Promise<GasFees> {
275
+ try {
276
+ const predicted = await node.getPredictedMinFees(ManaUsageEstimate.Limit);
277
+ if (predicted.length === 0) {
278
+ return node.getCurrentMinFees();
279
+ }
280
+ return predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst));
281
+ } catch (err: any) {
282
+ // Fallback for old nodes that don't support getPredictedMinFees.
283
+ // Only fall back on method-not-found errors (JSON-RPC code -32601); rethrow others.
284
+ if (err?.cause?.code === -32601 || err?.message?.includes('Method not found')) {
285
+ return node.getCurrentMinFees();
286
+ }
287
+ throw err;
288
+ }
289
+ }
290
+
262
291
  static parse(args: RawCliFeeArgs, log: LogFn, db?: WalletDB): CLIFeeArgs {
292
+ const estimateOnly = !!args.estimateGasOnly;
263
293
  return new CLIFeeArgs(
264
- !!args.estimateGasOnly,
265
- parsePaymentMethod(args.payment ?? 'method=fee_juice', log, db),
294
+ estimateOnly,
295
+ parsePaymentMethod(args.payment ?? 'method=fee_juice', log, db, estimateOnly),
266
296
  parseGasSettings(args),
267
297
  );
268
298
  }
@@ -288,7 +318,7 @@ function formatGasEstimate(estimate: Pick<GasSettings, 'gasLimits' | 'teardownGa
288
318
  }
289
319
 
290
320
  function getEstimatedCost(estimate: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>, maxFeesPerGas: GasFees) {
291
- return GasSettings.default({ ...estimate, maxFeesPerGas })
321
+ return GasSettings.fallback({ ...estimate, maxFeesPerGas })
292
322
  .getFeeLimit()
293
323
  .toBigInt();
294
324
  }
@@ -1,28 +1,28 @@
1
1
  import { EcdsaRAccountContract, EcdsaRSSHAccountContract } from '@aztec/accounts/ecdsa';
2
2
  import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
3
- import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
3
+ import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/stub/ecdsa';
4
+ import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/stub/schnorr';
4
5
  import { getIdentities } from '@aztec/accounts/utils';
5
- import { type Account, type AccountContract, SignerlessAccount } from '@aztec/aztec.js/account';
6
- import {
7
- type InteractionFeeOptions,
8
- getContractInstanceFromInstantiationParams,
9
- getGasLimits,
10
- } from '@aztec/aztec.js/contracts';
6
+ import { type Account, type AccountContract, NO_FROM } from '@aztec/aztec.js/account';
7
+ import { type InteractionFeeOptions, getContractClassFromArtifact, getGasLimits } from '@aztec/aztec.js/contracts';
11
8
  import type { AztecNode } from '@aztec/aztec.js/node';
12
9
  import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec.js/wallet';
10
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
13
11
  import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
12
+ import { DefaultEntrypoint } from '@aztec/entrypoints/default';
14
13
  import { Fr } from '@aztec/foundation/curves/bn254';
15
14
  import type { LogFn } from '@aztec/foundation/log';
15
+ import type { NotesFilter } from '@aztec/pxe/client/lazy';
16
16
  import type { PXEConfig } from '@aztec/pxe/config';
17
17
  import type { PXE } from '@aztec/pxe/server';
18
18
  import { createPXE, getPXEConfig } from '@aztec/pxe/server';
19
+ import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
19
20
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
20
21
  import { deriveSigningKey } from '@aztec/stdlib/keys';
21
22
  import { NoteDao } from '@aztec/stdlib/note';
22
- import type { NotesFilter } from '@aztec/stdlib/note';
23
- import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
23
+ import type { SimulationOverrides, TxExecutionRequest, TxProvingResult } 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 SimulateViaEntrypointOptions } 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';
@@ -31,6 +31,9 @@ import { printGasEstimates } from './options/fees.js';
31
31
 
32
32
  export class CLIWallet extends BaseWallet {
33
33
  private accountCache = new Map<string, Account>();
34
+ // Stub class ids, populated on wallet startup
35
+ // to avoid redundant work per simulation
36
+ private stubClassIds = new Map<AccountType, Fr>();
34
37
 
35
38
  constructor(
36
39
  pxe: PXE,
@@ -50,12 +53,43 @@ export class CLIWallet extends BaseWallet {
50
53
  ): Promise<CLIWallet> {
51
54
  const pxeConfig = Object.assign(getPXEConfig(), overridePXEConfig);
52
55
  const pxe = await createPXE(node, pxeConfig);
53
- return new CLIWallet(pxe, node, log, db);
56
+ const wallet = new CLIWallet(pxe, node, log, db);
57
+ await wallet.initStubClasses();
58
+ await wallet.registerAuthRegistry();
59
+ return wallet;
60
+ }
61
+
62
+ private async registerAuthRegistry(): Promise<void> {
63
+ const { instance, artifact } = await getStandardAuthRegistry();
64
+ await this.pxe.registerContract({ instance, artifact });
65
+ }
66
+
67
+ /**
68
+ * Hashes and registers the stub class for every supported account type with PXE, populating
69
+ * stubClassIds. Called on wallet initialization.
70
+ */
71
+ private async initStubClasses(): Promise<void> {
72
+ const { id: schnorrClassId } = await getContractClassFromArtifact(StubSchnorrAccountContractArtifact);
73
+ await this.pxe.registerContractClass(StubSchnorrAccountContractArtifact);
74
+
75
+ // ecdsa stubs share the same class id
76
+ const { id: ecdsaClassId } = await getContractClassFromArtifact(StubEcdsaAccountContractArtifact);
77
+ await this.pxe.registerContractClass(StubEcdsaAccountContractArtifact);
78
+
79
+ this.stubClassIds.set('schnorr', schnorrClassId);
80
+ this.stubClassIds.set('ecdsasecp256k1', ecdsaClassId);
81
+ this.stubClassIds.set('ecdsasecp256r1', ecdsaClassId);
82
+ this.stubClassIds.set('ecdsasecp256r1ssh', ecdsaClassId);
54
83
  }
55
84
 
56
85
  override async getAccounts(): Promise<Aliased<AztecAddress>[]> {
57
86
  const accounts = (await this.db?.listAliases('accounts')) ?? [];
58
- return Promise.resolve(accounts.map(({ key, value }) => ({ alias: value, item: AztecAddress.fromString(key) })));
87
+ return Promise.resolve(
88
+ accounts.map(({ key, value }) => {
89
+ const alias = key.includes(':') ? key.slice(key.indexOf(':') + 1) : key;
90
+ return { alias, item: AztecAddress.fromString(value) };
91
+ }),
92
+ );
59
93
  }
60
94
 
61
95
  private async createCancellationTxExecutionRequest(
@@ -64,14 +98,19 @@ export class CLIWallet extends BaseWallet {
64
98
  increasedFee: InteractionFeeOptions,
65
99
  ) {
66
100
  const executionPayload = ExecutionPayload.empty();
67
- const feeOptions = await this.completeFeeOptions(from, executionPayload.feePayer, increasedFee.gasSettings);
101
+ const feeOptions = await this.completeFeeOptions({
102
+ from,
103
+ feePayer: executionPayload.feePayer,
104
+ gasSettings: increasedFee.gasSettings,
105
+ });
68
106
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
69
107
  const fromAccount = await this.getAccountFromAddress(from);
70
108
  const chainInfo = await this.getChainInfo();
71
109
  const executionOptions: DefaultAccountEntrypointOptions = {
72
110
  txNonce,
73
111
  cancellable: this.cancellableTransactions,
74
- feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions,
112
+ // If from is an address, feeOptions include the way the account contract should handle the fee payment
113
+ feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions!,
75
114
  };
76
115
  return await fromAccount.createTxExecutionRequest(
77
116
  feeExecutionPayload ?? executionPayload,
@@ -87,14 +126,12 @@ export class CLIWallet extends BaseWallet {
87
126
  increasedFee: InteractionFeeOptions,
88
127
  ): Promise<TxProvingResult> {
89
128
  const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
90
- return await this.pxe.proveTx(cancellationTxRequest);
129
+ return await this.pxe.proveTx(cancellationTxRequest, { scopes: this.scopesFrom(from), senderForTags: from });
91
130
  }
92
131
 
93
132
  override async getAccountFromAddress(address: AztecAddress) {
94
133
  let account: Account | undefined;
95
- if (address.equals(AztecAddress.ZERO)) {
96
- account = new SignerlessAccount();
97
- } else if (this.accountCache.has(address.toString())) {
134
+ if (this.accountCache.has(address.toString())) {
98
135
  return this.accountCache.get(address.toString())!;
99
136
  } else {
100
137
  const accountManager = await this.createOrRetrieveAccount(address);
@@ -108,7 +145,7 @@ export class CLIWallet extends BaseWallet {
108
145
  }
109
146
 
110
147
  private async createAccount(secret: Fr, salt: Fr, contract: AccountContract): Promise<AccountManager> {
111
- const accountManager = await AccountManager.create(this, secret, contract, salt);
148
+ const accountManager = await AccountManager.create(this, secret, contract, { salt });
112
149
 
113
150
  const instance = accountManager.getInstance();
114
151
  const artifact = await contract.getContractArtifact();
@@ -185,82 +222,92 @@ export class CLIWallet extends BaseWallet {
185
222
  */
186
223
  private async getFakeAccountDataFor(address: AztecAddress) {
187
224
  const originalAccount = await this.getAccountFromAddress(address);
188
- // Account contracts can only be overridden if they have an associated address
189
- // Overwriting SignerlessAccount is not supported, and does not really make sense
190
- // since it has no authorization mechanism.
191
- if (originalAccount instanceof SignerlessAccount) {
192
- throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
193
- }
194
- const originalAddress = (originalAccount as Account).getCompleteAddress();
225
+ const originalAddress = originalAccount.getCompleteAddress();
195
226
  const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
196
227
  if (!contractInstance) {
197
228
  throw new Error(`No contract instance found for address: ${originalAddress.address}`);
198
229
  }
199
- const stubAccount = createStubAccount(originalAddress);
200
- const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
201
- salt: Fr.random(),
202
- });
203
- return {
204
- account: stubAccount,
205
- instance,
206
- artifact: StubAccountContractArtifact,
207
- };
230
+ const { type } = await this.db!.retrieveAccount(address);
231
+ const stubAccount =
232
+ type === 'schnorr' ? createStubSchnorrAccount(originalAddress) : createStubEcdsaAccount(originalAddress);
233
+ const stubClassId = this.stubClassIds.get(type);
234
+ if (!stubClassId) {
235
+ throw new Error(
236
+ `Stub class for account type '${type}' was not registered at wallet init. This is a bug — initStubClasses should cover every supported AccountType.`,
237
+ );
238
+ }
239
+ const instance = { ...contractInstance, currentContractClassId: stubClassId };
240
+ return { account: stubAccount, instance };
241
+ }
242
+
243
+ override async simulateTx(
244
+ executionPayload: ExecutionPayload,
245
+ opts: SimulateOptions,
246
+ ): Promise<TxSimulationResultWithAppOffset> {
247
+ const simulationResults = await super.simulateTx(executionPayload, opts);
248
+
249
+ if (opts.fee?.estimateGas) {
250
+ const feeOptions = await this.completeFeeOptions({
251
+ from: opts.from,
252
+ feePayer: executionPayload.feePayer,
253
+ gasSettings: opts.fee?.gasSettings,
254
+ });
255
+ const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
256
+ printGasEstimates(feeOptions, limits, this.userLog);
257
+ }
258
+ return simulationResults;
208
259
  }
209
260
 
210
- override async simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult> {
211
- let simulationResults;
212
- const feeOptions = opts.fee?.estimateGas
213
- ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings)
214
- : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
261
+ /**
262
+ * Uses a stub account for kernelless simulation, bypassing real account authorization.
263
+ * Uses DefaultEntrypoint directly for NO_FROM transactions.
264
+ */
265
+ protected override async simulateViaEntrypoint(
266
+ executionPayload: ExecutionPayload,
267
+ opts: SimulateViaEntrypointOptions,
268
+ ): Promise<TxSimulationResultWithAppOffset> {
269
+ const { from, feeOptions, additionalScopes, sendMessagesAs } = opts;
270
+ const scopes = this.scopesFrom(from, additionalScopes);
215
271
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
216
- const chainInfo = await this.getChainInfo();
217
- const executionOptions: DefaultAccountEntrypointOptions = {
218
- txNonce: Fr.random(),
219
- cancellable: this.cancellableTransactions,
220
- feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions,
221
- };
222
272
  const finalExecutionPayload = feeExecutionPayload
223
273
  ? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
224
274
  : executionPayload;
275
+ const chainInfo = await this.getChainInfo();
225
276
 
226
- // Kernelless simulations using the multicall entrypoints are not currently supported,
227
- // since we only override proper account contracts.
228
- // TODO: allow disabling kernels even when no overrides are necessary
229
- if (opts.from.equals(AztecAddress.ZERO)) {
230
- const fromAccount = await this.getAccountFromAddress(opts.from);
231
- const txRequest = await fromAccount.createTxExecutionRequest(
232
- finalExecutionPayload,
233
- feeOptions.gasSettings,
234
- chainInfo,
235
- executionOptions,
236
- );
237
- simulationResults = await this.pxe.simulateTx(
238
- txRequest,
239
- true /* simulatePublic */,
240
- opts?.skipTxValidation,
241
- opts?.skipFeeEnforcement ?? true,
242
- );
277
+ let overrides: SimulationOverrides | undefined;
278
+ let txRequest: TxExecutionRequest;
279
+ if (from === NO_FROM) {
280
+ const entrypoint = new DefaultEntrypoint();
281
+ txRequest = await entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
243
282
  } else {
244
- const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
245
- const txRequest = await fromAccount.createTxExecutionRequest(
283
+ const { account, instance } = await this.getFakeAccountDataFor(from);
284
+ overrides = {
285
+ contracts: { [from.toString()]: { instance } },
286
+ };
287
+ const executionOptions: DefaultAccountEntrypointOptions = {
288
+ txNonce: Fr.random(),
289
+ cancellable: this.cancellableTransactions,
290
+ // If from is an address, feeOptions include the way the account contract should handle the fee payment
291
+ feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions!,
292
+ };
293
+ txRequest = await account.createTxExecutionRequest(
246
294
  finalExecutionPayload,
247
295
  feeOptions.gasSettings,
248
296
  chainInfo,
249
297
  executionOptions,
250
298
  );
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
299
  }
258
300
 
259
- if (opts.fee?.estimateGas) {
260
- const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
261
- printGasEstimates(feeOptions, limits, this.userLog);
262
- }
263
- return simulationResults;
301
+ const result = await this.pxe.simulateTx(txRequest, {
302
+ simulatePublic: true,
303
+ skipFeeEnforcement: true,
304
+ skipTxValidation: true,
305
+ overrides,
306
+ scopes,
307
+ senderForTags: this.senderForTagsFrom(from, sendMessagesAs),
308
+ });
309
+ const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
310
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
264
311
  }
265
312
 
266
313
  // Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because