@aztec/wallet-sdk 0.0.1-commit.e588bc7e5 → 0.0.1-commit.e5a3663dd

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.
@@ -2,7 +2,7 @@ import type { Account, NoFrom } from '@aztec/aztec.js/account';
2
2
  import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
3
3
  import { type InteractionWaitOptions, type SendReturn } from '@aztec/aztec.js/contracts';
4
4
  import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
5
- import { type Aliased, type AppCapabilities, type BatchResults, type BatchedMethod, ContractInitializationStatus, type ExecuteUtilityOptions, type PrivateEvent, type PrivateEventFilter, type ProfileOptions, type SendOptions, type SimulateOptions, type Wallet, type WalletCapabilities } from '@aztec/aztec.js/wallet';
5
+ import { type Aliased, type AppCapabilities, type BatchResults, type BatchedMethod, ContractInitializationStatus, type ExecuteUtilityOptions, type PrivateEvent, type PrivateEventFilter, type ProfileOptions, type SendOptions, type SimulateOptions, TxSimulationResultWithAppOffset, type Wallet, type WalletCapabilities } from '@aztec/aztec.js/wallet';
6
6
  import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
7
7
  import type { ChainInfo } from '@aztec/entrypoints/interfaces';
8
8
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -12,10 +12,9 @@ import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall
12
12
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
13
13
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
14
14
  import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
15
- import { GasSettings } from '@aztec/stdlib/gas';
15
+ import { GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
16
16
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
17
- import { type TxExecutionRequest, type TxProfileResult, TxSimulationResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
18
- import { ExecutionPayload } from '@aztec/stdlib/tx';
17
+ import { ExecutionPayload, type TxExecutionRequest, type TxProfileResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
19
18
  /**
20
19
  * Options to configure fee payment for a transaction
21
20
  */
@@ -31,11 +30,25 @@ export type FeeOptions = {
31
30
  gasSettings: GasSettings;
32
31
  };
33
32
  /** Options for `simulateViaEntrypoint`. */
34
- export type SimulateViaEntrypointOptions = Pick<SimulateOptions, 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement'> & {
33
+ export type SimulateViaEntrypointOptions = Pick<SimulateOptions, 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs'> & {
35
34
  /** Fee options for the entrypoint */
36
35
  feeOptions: FeeOptions;
37
- /** Scopes to use for the simulation */
38
- scopes: AztecAddress[];
36
+ };
37
+ /** Options for `completeFeeOptions`. */
38
+ export type CompleteFeeOptionsConfig = {
39
+ /** The address where the transaction is being sent from. */
40
+ from: AztecAddress | NoFrom;
41
+ /** The address paying for fees (if any fee payment method is embedded in the execution payload). */
42
+ feePayer?: AztecAddress;
43
+ /** User-provided partial gas settings. */
44
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
45
+ /** If true, returns gas settings with high gas limits for estimation. If false, uses fallback limits. */
46
+ forEstimation?: boolean;
47
+ /**
48
+ * Assumed network congestion level for fee prediction. Controls how aggressively the wallet
49
+ * estimates future fees. Defaults to Limit (worst case) when not specified.
50
+ */
51
+ congestionEstimate?: ManaUsageEstimate;
39
52
  };
40
53
  /**
41
54
  * A base class for Wallet implementations
@@ -46,8 +59,17 @@ export declare abstract class BaseWallet implements Wallet {
46
59
  protected log: import("@aztec/foundation/log").Logger;
47
60
  protected minFeePadding: number;
48
61
  protected cancellableTransactions: boolean;
62
+ private nodeInfoPromise;
49
63
  protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
50
64
  protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes?: AztecAddress[]): AztecAddress[];
65
+ /**
66
+ * Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
67
+ * account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx will fail
68
+ * the contract-side `Sender for tags is not set` assertion unless `set_sender_for_tags` is called first.
69
+ * @param from - Tx sender, or `NO_FROM`.
70
+ * @param sendMessagesAs - Explicit override.
71
+ */
72
+ protected senderForTagsFrom(from: AztecAddress | NoFrom, sendMessagesAs?: AztecAddress): AztecAddress | undefined;
51
73
  protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
52
74
  abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
53
75
  /**
@@ -78,30 +100,15 @@ export declare abstract class BaseWallet implements Wallet {
78
100
  batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
79
101
  /**
80
102
  * Completes partial user-provided fee options with wallet defaults.
81
- * @param from - The address where the transaction is being sent from
82
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
83
- * @param gasSettings - User-provided partial gas settings
84
- * @returns - Complete fee options that can be used to create a transaction execution request
103
+ * @param config - Fee completion config.
85
104
  */
86
- protected completeFeeOptions(from: AztecAddress | NoFrom, feePayer?: AztecAddress, gasSettings?: Partial<FieldsOf<GasSettings>>): Promise<FeeOptions>;
105
+ protected completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions>;
87
106
  /**
88
- * Completes partial user-provided fee options with unreasonably high gas limits
89
- * for gas estimation. Uses the same logic as completeFeeOptions but sets high limits
90
- * to avoid running out of gas during estimation.
91
- * @param from - The address where the transaction is being sent from
92
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
93
- * @param gasSettings - User-provided partial gas settings
107
+ * Returns the worst-case min fee across predicted future slots.
108
+ * Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
109
+ * @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
94
110
  */
95
- protected completeFeeOptionsForEstimation(from: AztecAddress | NoFrom, feePayer?: AztecAddress, gasSettings?: Partial<FieldsOf<GasSettings>>): Promise<{
96
- /**
97
- * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
98
- * doesn't already include one
99
- */
100
- walletFeePaymentMethod?: FeePaymentMethod | undefined;
101
- /** Configuration options for the account to properly handle the selected fee payment method */
102
- accountFeePaymentMethodOptions?: AccountFeePaymentMethodOptions | undefined;
103
- gasSettings: GasSettings;
104
- }>;
111
+ protected getMinFees(estimate?: ManaUsageEstimate): Promise<GasFees>;
105
112
  registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
106
113
  registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
107
114
  /**
@@ -109,7 +116,14 @@ export declare abstract class BaseWallet implements Wallet {
109
116
  * @param executionPayload - The execution payload to simulate.
110
117
  * @param opts - Simulation options.
111
118
  */
112
- protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<TxSimulationResult>;
119
+ protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<TxSimulationResultWithAppOffset>;
120
+ /**
121
+ * Computes the index where the app's calls begin in the flattened array of calls (0 = entrypoint/root, 1..N = fee
122
+ * calls, N+1 = app).
123
+ * @param from - The sender address, or NO_FROM for the default entrypoint.
124
+ * @param feeOptions - Fee options containing the wallet fee payment method.
125
+ */
126
+ protected computeAppCallOffset(from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<number>;
113
127
  /**
114
128
  * Simulates a transaction, optimizing leading public static calls by running them directly
115
129
  * on the node while sending the remaining calls through the standard PXE path.
@@ -118,7 +132,7 @@ export declare abstract class BaseWallet implements Wallet {
118
132
  * @param opts - Simulation options (from address, fee settings, etc.).
119
133
  * @returns The merged simulation result.
120
134
  */
121
- simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
135
+ simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset>;
122
136
  profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
123
137
  sendTx<W extends InteractionWaitOptions = undefined>(executionPayload: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
124
138
  /**
@@ -145,4 +159,4 @@ export declare abstract class BaseWallet implements Wallet {
145
159
  isContractClassPubliclyRegistered: boolean;
146
160
  }>;
147
161
  }
148
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLGVBQWUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2pGLE9BQU8sRUFDTCxLQUFLLHNCQUFzQixFQUUzQixLQUFLLFVBQVUsRUFFaEIsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTVELE9BQU8sRUFDTCxLQUFLLE9BQU8sRUFDWixLQUFLLGVBQWUsRUFDcEIsS0FBSyxZQUFZLEVBQ2pCLEtBQUssYUFBYSxFQUNsQiw0QkFBNEIsRUFDNUIsS0FBSyxxQkFBcUIsRUFDMUIsS0FBSyxZQUFZLEVBQ2pCLEtBQUssa0JBQWtCLEVBQ3ZCLEtBQUssY0FBYyxFQUNuQixLQUFLLFdBQVcsRUFDaEIsS0FBSyxlQUFlLEVBQ3BCLEtBQUssTUFBTSxFQUNYLEtBQUssa0JB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H,UAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAMzG;IAED;;;;;;;OAOG;IACG,UAAU,CACd,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,+BAA+B,CAAC,CAgD1C;IAEK,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAclG;IAEY,MAAM,CAAC,CAAC,SAAS,sBAAsB,GAAG,SAAS,EAC9D,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA0CxB;IAED;;;OAGG;IACH,UAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAOlF;IAED,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAYpE;IAED,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAE/F;IAEK,gBAAgB,CAAC,CAAC,EACtB,QAAQ,EAAE,uBAAuB,EACjC,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAe5B;IAED;;;OAGG;IACG,mBAAmB,CAAC,OAAO,EAAE,YAAY;;;;;;OAiC9C;IAEK,wBAAwB,CAAC,EAAE,EAAE,EAAE;;;OAMpC;CACF"}
@@ -1,8 +1,7 @@
1
1
  import { NO_FROM } from '@aztec/aztec.js/account';
2
2
  import { NO_WAIT, extractOffchainOutput } from '@aztec/aztec.js/contracts';
3
3
  import { waitForTx } from '@aztec/aztec.js/node';
4
- import { ContractInitializationStatus } from '@aztec/aztec.js/wallet';
5
- import { GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT } from '@aztec/constants';
4
+ import { ContractInitializationStatus, TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
6
5
  import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
7
6
  import { DefaultEntrypoint } from '@aztec/entrypoints/default';
8
7
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -12,7 +11,7 @@ import { decodeFromAbi } from '@aztec/stdlib/abi';
12
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
12
  import { computePartialAddress, getContractClassFromArtifact } from '@aztec/stdlib/contract';
14
13
  import { SimulationError } from '@aztec/stdlib/errors';
15
- import { Gas, GasSettings } from '@aztec/stdlib/gas';
14
+ import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
16
15
  import { computeSiloedPrivateInitializationNullifier, computeSiloedPublicInitializationNullifier } from '@aztec/stdlib/hash';
17
16
  import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
18
17
  import { inspect } from 'util';
@@ -25,6 +24,9 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
25
24
  log;
26
25
  minFeePadding;
27
26
  cancellableTransactions;
27
+ // A wallet is instantiated for a particular chain, so chain info never changes during its lifetime.
28
+ // We cache it here because getChainInfo is called frequently (every tx simulation, send, auth wit, etc.).
29
+ nodeInfoPromise;
28
30
  // Protected because we want to force wallets to instantiate their own PXE.
29
31
  constructor(pxe, aztecNode, log = createLogger('wallet-sdk:base_wallet')){
30
32
  this.pxe = pxe;
@@ -44,6 +46,15 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
44
46
  ].map(AztecAddress.fromString);
45
47
  }
46
48
  /**
49
+ * Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
50
+ * account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx will fail
51
+ * the contract-side `Sender for tags is not set` assertion unless `set_sender_for_tags` is called first.
52
+ * @param from - Tx sender, or `NO_FROM`.
53
+ * @param sendMessagesAs - Explicit override.
54
+ */ senderForTagsFrom(from, sendMessagesAs) {
55
+ return sendMessagesAs ?? (from === NO_FROM ? undefined : from);
56
+ }
57
+ /**
47
58
  * Returns the list of aliased contacts associated with the wallet.
48
59
  * This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
49
60
  * - Senders: Addresses we check during synching in case they sent us notes,
@@ -57,7 +68,10 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
57
68
  }));
58
69
  }
59
70
  async getChainInfo() {
60
- const { l1ChainId, rollupVersion } = await this.aztecNode.getNodeInfo();
71
+ if (!this.nodeInfoPromise) {
72
+ this.nodeInfoPromise = this.aztecNode.getNodeInfo();
73
+ }
74
+ const { l1ChainId, rollupVersion } = await this.nodeInfoPromise;
61
75
  return {
62
76
  chainId: new Fr(l1ChainId),
63
77
  version: new Fr(rollupVersion)
@@ -125,12 +139,10 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
125
139
  }
126
140
  /**
127
141
  * Completes partial user-provided fee options with wallet defaults.
128
- * @param from - The address where the transaction is being sent from
129
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
130
- * @param gasSettings - User-provided partial gas settings
131
- * @returns - Complete fee options that can be used to create a transaction execution request
132
- */ async completeFeeOptions(from, feePayer, gasSettings) {
133
- const maxFeesPerGas = gasSettings?.maxFeesPerGas ?? (await this.aztecNode.getCurrentMinFees()).mul(1 + this.minFeePadding);
142
+ * @param config - Fee completion config.
143
+ */ async completeFeeOptions(config) {
144
+ const { from, feePayer, gasSettings, forEstimation, congestionEstimate } = config;
145
+ const maxFeesPerGas = gasSettings?.maxFeesPerGas ?? (await this.getMinFees(congestionEstimate)).mul(1 + this.minFeePadding);
134
146
  let accountFeePaymentMethodOptions;
135
147
  // If from is an address, we need to determine the appropriate fee payment method options for the
136
148
  // account contract entrypoint to use
@@ -145,10 +157,15 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
145
157
  accountFeePaymentMethodOptions = from.equals(feePayer) ? AccountFeePaymentMethodOptions.FEE_JUICE_WITH_CLAIM : AccountFeePaymentMethodOptions.EXTERNAL;
146
158
  }
147
159
  }
148
- const fullGasSettings = GasSettings.default({
149
- ...gasSettings,
150
- maxFeesPerGas
151
- });
160
+ const gasSettingsOverrides = {
161
+ gasLimits: gasSettings?.gasLimits ? Gas.from(gasSettings.gasLimits) : undefined,
162
+ teardownGasLimits: gasSettings?.teardownGasLimits ? Gas.from(gasSettings.teardownGasLimits) : undefined,
163
+ maxFeesPerGas,
164
+ maxPriorityFeesPerGas: gasSettings?.maxPriorityFeesPerGas ?? GasFees.empty()
165
+ };
166
+ // When estimating gas (simulation), use high limits so the simulation doesn't run out of gas.
167
+ // When sending for real, use protocol max limits that the network will actually accept.
168
+ const fullGasSettings = forEstimation ? GasSettings.forEstimation(gasSettingsOverrides) : GasSettings.fallback(gasSettingsOverrides);
152
169
  this.log.debug(`Using L2 gas settings`, fullGasSettings);
153
170
  return {
154
171
  gasSettings: fullGasSettings,
@@ -157,22 +174,24 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
157
174
  };
158
175
  }
159
176
  /**
160
- * Completes partial user-provided fee options with unreasonably high gas limits
161
- * for gas estimation. Uses the same logic as completeFeeOptions but sets high limits
162
- * to avoid running out of gas during estimation.
163
- * @param from - The address where the transaction is being sent from
164
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
165
- * @param gasSettings - User-provided partial gas settings
166
- */ async completeFeeOptionsForEstimation(from, feePayer, gasSettings) {
167
- const defaultFeeOptions = await this.completeFeeOptions(from, feePayer, gasSettings);
168
- const { gasSettings: { maxFeesPerGas, maxPriorityFeesPerGas } } = defaultFeeOptions;
169
- // Use unrealistically high gas limits for estimation to avoid running out of gas.
170
- // They will be tuned down after the simulation.
171
- const gasSettingsForEstimation = new GasSettings(new Gas(GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT), new Gas(GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT), maxFeesPerGas, maxPriorityFeesPerGas);
172
- return {
173
- ...defaultFeeOptions,
174
- gasSettings: gasSettingsForEstimation
175
- };
177
+ * Returns the worst-case min fee across predicted future slots.
178
+ * Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
179
+ * @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
180
+ */ async getMinFees(estimate = ManaUsageEstimate.Limit) {
181
+ try {
182
+ const predicted = await this.aztecNode.getPredictedMinFees(estimate);
183
+ if (predicted.length === 0) {
184
+ return this.aztecNode.getCurrentMinFees();
185
+ }
186
+ return predicted.reduce((worst, fees)=>fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst);
187
+ } catch (err) {
188
+ // Fallback for old nodes that don't support getPredictedMinFees.
189
+ // Only fall back on method-not-found errors (JSON-RPC code -32601); rethrow others.
190
+ if (err?.cause?.code === -32601 || err?.message?.includes('Method not found')) {
191
+ return this.aztecNode.getCurrentMinFees();
192
+ }
193
+ throw err;
194
+ }
176
195
  }
177
196
  registerSender(address, _alias = '') {
178
197
  return this.pxe.registerSender(address);
@@ -215,12 +234,27 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
215
234
  * @param opts - Simulation options.
216
235
  */ async simulateViaEntrypoint(executionPayload, opts) {
217
236
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, opts.feeOptions);
218
- return this.pxe.simulateTx(txRequest, {
237
+ const result = await this.pxe.simulateTx(txRequest, {
219
238
  simulatePublic: true,
220
239
  skipTxValidation: opts.skipTxValidation,
221
240
  skipFeeEnforcement: opts.skipFeeEnforcement,
222
- scopes: opts.scopes
241
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
242
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
223
243
  });
244
+ const appCallOffset = await this.computeAppCallOffset(opts.from, opts.feeOptions);
245
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
246
+ }
247
+ /**
248
+ * Computes the index where the app's calls begin in the flattened array of calls (0 = entrypoint/root, 1..N = fee
249
+ * calls, N+1 = app).
250
+ * @param from - The sender address, or NO_FROM for the default entrypoint.
251
+ * @param feeOptions - Fee options containing the wallet fee payment method.
252
+ */ async computeAppCallOffset(from, feeOptions) {
253
+ if (from === NO_FROM) {
254
+ return 0;
255
+ }
256
+ const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
257
+ return (feeExecutionPayload?.calls.length ?? 0) + 1; // +1 for entrypoint
224
258
  }
225
259
  /**
226
260
  * Simulates a transaction, optimizing leading public static calls by running them directly
@@ -230,7 +264,13 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
230
264
  * @param opts - Simulation options (from address, fee settings, etc.).
231
265
  * @returns The merged simulation result.
232
266
  */ async simulateTx(executionPayload, opts) {
233
- const feeOptions = opts.fee?.estimateGas ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings) : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
267
+ const feeOptions = await this.completeFeeOptions({
268
+ from: opts.from,
269
+ feePayer: executionPayload.feePayer,
270
+ gasSettings: opts.fee?.gasSettings,
271
+ forEstimation: true,
272
+ congestionEstimate: opts.fee?.congestionEstimate
273
+ });
234
274
  const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
235
275
  const remainingPayload = {
236
276
  ...executionPayload,
@@ -243,7 +283,7 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
243
283
  try {
244
284
  blockHeader = await this.pxe.getSyncedBlockHeader();
245
285
  } catch {
246
- blockHeader = await this.aztecNode.getBlockHeader();
286
+ blockHeader = await this.aztecNode.getBlockHeader('latest');
247
287
  }
248
288
  const simulationOrigin = opts.from === NO_FROM ? AztecAddress.ZERO : opts.from;
249
289
  const [optimizedResults, normalResult] = await Promise.all([
@@ -251,26 +291,41 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
251
291
  remainingCalls.length > 0 ? this.simulateViaEntrypoint(remainingPayload, {
252
292
  from: opts.from,
253
293
  feeOptions,
254
- scopes: this.scopesFrom(opts.from, opts.additionalScopes),
294
+ additionalScopes: opts.additionalScopes,
255
295
  skipTxValidation: opts.skipTxValidation,
256
- skipFeeEnforcement: opts.skipFeeEnforcement ?? true
296
+ skipFeeEnforcement: opts.skipFeeEnforcement ?? true,
297
+ sendMessagesAs: opts.sendMessagesAs
257
298
  }) : Promise.resolve(null)
258
299
  ]);
259
300
  return buildMergedSimulationResult(optimizedResults, normalResult);
260
301
  }
261
302
  async profileTx(executionPayload, opts) {
262
- const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
303
+ const feeOptions = await this.completeFeeOptions({
304
+ from: opts.from,
305
+ feePayer: executionPayload.feePayer,
306
+ gasSettings: opts.fee?.gasSettings,
307
+ congestionEstimate: opts.fee?.congestionEstimate
308
+ });
263
309
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
264
310
  return this.pxe.profileTx(txRequest, {
265
311
  profileMode: opts.profileMode,
266
312
  skipProofGeneration: opts.skipProofGeneration ?? true,
267
- scopes: this.scopesFrom(opts.from, opts.additionalScopes)
313
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
314
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
268
315
  });
269
316
  }
270
317
  async sendTx(executionPayload, opts) {
271
- const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
318
+ const feeOptions = await this.completeFeeOptions({
319
+ from: opts.from,
320
+ feePayer: executionPayload.feePayer,
321
+ gasSettings: opts.fee?.gasSettings,
322
+ congestionEstimate: opts.fee?.congestionEstimate
323
+ });
272
324
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
273
- const provenTx = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
325
+ const provenTx = await this.pxe.proveTx(txRequest, {
326
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
327
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
328
+ });
274
329
  const offchainOutput = extractOffchainOutput(provenTx.getOffchainEffects(), provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp);
275
330
  const tx = await provenTx.toTx();
276
331
  const txHash = tx.getTxHash();
@@ -1,3 +1,3 @@
1
- export { BaseWallet, type FeeOptions, type SimulateViaEntrypointOptions } from './base_wallet.js';
1
+ export { BaseWallet, type CompleteFeeOptionsConfig, type FeeOptions, type SimulateViaEntrypointOptions, } from './base_wallet.js';
2
2
  export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLEtBQUssVUFBVSxFQUFFLEtBQUssNEJBQTRCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNsRyxPQUFPLEVBQUUsZUFBZSxFQUFFLDJCQUEyQixFQUFFLG1DQUFtQyxFQUFFLE1BQU0sWUFBWSxDQUFDIn0=
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsVUFBVSxFQUNWLEtBQUssd0JBQXdCLEVBQzdCLEtBQUssVUFBVSxFQUNmLEtBQUssNEJBQTRCLEdBQ2xDLE1BQU0sa0JBQWtCLENBQUM7QUFDMUIsT0FBTyxFQUFFLGVBQWUsRUFBRSwyQkFBMkIsRUFBRSxtQ0FBbUMsRUFBRSxNQUFNLFlBQVksQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,4BAA4B,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
2
3
  import type { ChainInfo } from '@aztec/entrypoints/interfaces';
3
4
  import type { ContractNameResolver } from '@aztec/pxe/client/lazy';
4
5
  import { type FunctionCall } from '@aztec/stdlib/abi';
@@ -45,5 +46,5 @@ export declare function simulateViaNode(node: AztecNode, publicStaticCalls: Func
45
46
  * @param normalResult - Result from normal simulation (null if all calls were optimized).
46
47
  * @returns A single TxSimulationResult with return values in original call order.
47
48
  */
48
- export declare function buildMergedSimulationResult(optimizedResults: TxSimulationResult[], normalResult: TxSimulationResult | null): TxSimulationResult;
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV0RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUkvRCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBR25FLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBb0IsTUFBTSxtQkFBbUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQVFyRCxPQUFPLEVBQ0wsS0FBSyxXQUFXLEVBQ2hCLEtBQUssZ0JBQWdCLEVBT3JCLGtCQUFrQixFQUNuQixNQUFNLGtCQUFrQixDQUFDO0FBRTFCOzs7Ozs7Ozs7R0FTRztBQUNILHdCQUFnQixtQ0FBbUMsQ0FBQyxPQUFPLEVBQUUsZ0JBQWdCLEdBQUc7SUFDOUUsdUVBQXVFO0lBQ3ZFLGdCQUFnQixFQUFFLFlBQVksRUFBRSxDQUFDO0lBQ2pDLDJCQUEyQjtJQUMzQixjQUFjLEVBQUUsWUFBWSxFQUFFLENBQUM7Q0FDaEMsQ0FPQTtBQXVHRDs7Ozs7Ozs7Ozs7O0dBWUc7QUFDSCx3QkFBc0IsZUFBZSxDQUNuQyxJQUFJLEVBQUUsU0FBUyxFQUNmLGlCQUFpQixFQUFFLFlBQVksRUFBRSxFQUNqQyxJQUFJLEVBQUUsWUFBWSxFQUNsQixTQUFTLEVBQUUsU0FBUyxFQUNwQixXQUFXLEVBQUUsV0FBVyxFQUN4QixXQUFXLEVBQUUsV0FBVyxFQUN4QixrQkFBa0IscUJBQWdCLEVBQ2xDLGVBQWUsRUFBRSxvQkFBb0IsR0FDcEMsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0F3Qi9CO0FBRUQ7Ozs7Ozs7OztHQVNHO0FBQ0gsd0JBQWdCLDJCQUEyQixDQUN6QyxnQkFBZ0IsRUFBRSxrQkFBa0IsRUFBRSxFQUN0QyxZQUFZLEVBQUUsa0JBQWtCLEdBQUcsSUFBSSxHQUN0QyxrQkFBa0IsQ0FvQnBCIn0=
49
+ export declare function buildMergedSimulationResult(optimizedResults: TxSimulationResult[], normalResult: TxSimulationResultWithAppOffset | null): TxSimulationResultWithAppOffset;
50
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsK0JBQStCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUV6RSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUkvRCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBR25FLE9BQU8sRUFBRSxLQUFLLFlBQVksRU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oot":"","sources":["../../src/base-wallet/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAOrB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;GASG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,gBAAgB,GAAG;IAC9E,uEAAuE;IACvE,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,2BAA2B;IAC3B,cAAc,EAAE,YAAY,EAAE,CAAC;CAChC,CAOA;AAuGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,SAAS,EACf,iBAAiB,EAAE,YAAY,EAAE,EACjC,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,kBAAkB,qBAAgB,EAClC,eAAe,EAAE,oBAAoB,GACpC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAwB/B;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,YAAY,EAAE,kBAAkB,GAAG,IAAI,GACtC,kBAAkB,CAoBpB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base-wallet/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAOrB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;GASG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,gBAAgB,GAAG;IAC9E,uEAAuE;IACvE,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,2BAA2B;IAC3B,cAAc,EAAE,YAAY,EAAE,CAAC;CAChC,CAOA;AAuGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,SAAS,EACf,iBAAiB,EAAE,YAAY,EAAE,EACjC,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,kBAAkB,qBAAgB,EAClC,eAAe,EAAE,oBAAoB,GACpC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAwB/B;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,YAAY,EAAE,+BAA+B,GAAG,IAAI,GACnD,+BAA+B,CAqBjC"}
@@ -1,3 +1,4 @@
1
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
1
2
  import { MAX_ENQUEUED_CALLS_PER_CALL } from '@aztec/constants';
2
3
  import { makeTuple } from '@aztec/foundation/array';
3
4
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -127,5 +128,6 @@ import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx, T
127
128
  ...baseResult.publicOutput,
128
129
  publicReturnValues: allReturnValues
129
130
  } : undefined;
130
- return new TxSimulationResult(baseResult.privateExecutionResult, baseResult.publicInputs, mergedPublicOutput, normalResult?.stats);
131
+ const merged = new TxSimulationResult(baseResult.privateExecutionResult, baseResult.publicInputs, mergedPublicOutput, normalResult?.stats);
132
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(merged, normalResult?.appCallOffset ?? 0);
131
133
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aztec/wallet-sdk",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/wallet-sdk",
4
- "version": "0.0.1-commit.e588bc7e5",
4
+ "version": "0.0.1-commit.e5a3663dd",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./base-wallet": "./dest/base-wallet/index.js",
@@ -75,15 +75,15 @@
75
75
  ]
76
76
  },
77
77
  "dependencies": {
78
- "@aztec/aztec.js": "0.0.1-commit.e588bc7e5",
79
- "@aztec/constants": "0.0.1-commit.e588bc7e5",
80
- "@aztec/entrypoints": "0.0.1-commit.e588bc7e5",
81
- "@aztec/foundation": "0.0.1-commit.e588bc7e5",
82
- "@aztec/pxe": "0.0.1-commit.e588bc7e5",
83
- "@aztec/stdlib": "0.0.1-commit.e588bc7e5"
78
+ "@aztec/aztec.js": "0.0.1-commit.e5a3663dd",
79
+ "@aztec/constants": "0.0.1-commit.e5a3663dd",
80
+ "@aztec/entrypoints": "0.0.1-commit.e5a3663dd",
81
+ "@aztec/foundation": "0.0.1-commit.e5a3663dd",
82
+ "@aztec/pxe": "0.0.1-commit.e5a3663dd",
83
+ "@aztec/stdlib": "0.0.1-commit.e5a3663dd"
84
84
  },
85
85
  "devDependencies": {
86
- "@aztec/noir-contracts.js": "0.0.1-commit.e588bc7e5",
86
+ "@aztec/noir-contracts.js": "0.0.1-commit.e5a3663dd",
87
87
  "@jest/globals": "^30.0.0",
88
88
  "@types/jest": "^30.0.0",
89
89
  "@types/node": "^22.15.17",
@@ -21,15 +21,10 @@ import {
21
21
  type ProfileOptions,
22
22
  type SendOptions,
23
23
  type SimulateOptions,
24
+ TxSimulationResultWithAppOffset,
24
25
  type Wallet,
25
26
  type WalletCapabilities,
26
27
  } from '@aztec/aztec.js/wallet';
27
- import {
28
- GAS_ESTIMATION_DA_GAS_LIMIT,
29
- GAS_ESTIMATION_L2_GAS_LIMIT,
30
- GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT,
31
- GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT,
32
- } from '@aztec/constants';
33
28
  import { AccountFeePaymentMethodOptions, type DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
34
29
  import { DefaultEntrypoint } from '@aztec/entrypoints/default';
35
30
  import type { ChainInfo } from '@aztec/entrypoints/interfaces';
@@ -48,11 +43,12 @@ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
48
43
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
49
44
  import {
50
45
  type ContractInstanceWithAddress,
46
+ type NodeInfo,
51
47
  computePartialAddress,
52
48
  getContractClassFromArtifact,
53
49
  } from '@aztec/stdlib/contract';
54
50
  import { SimulationError } from '@aztec/stdlib/errors';
55
- import { Gas, GasSettings } from '@aztec/stdlib/gas';
51
+ import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
56
52
  import {
57
53
  computeSiloedPrivateInitializationNullifier,
58
54
  computeSiloedPublicInitializationNullifier,
@@ -60,12 +56,12 @@ import {
60
56
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
61
57
  import {
62
58
  BlockHeader,
59
+ ExecutionPayload,
63
60
  type TxExecutionRequest,
64
61
  type TxProfileResult,
65
- TxSimulationResult,
66
62
  type UtilityExecutionResult,
63
+ mergeExecutionPayloads,
67
64
  } from '@aztec/stdlib/tx';
68
- import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
69
65
 
70
66
  import { inspect } from 'util';
71
67
 
@@ -89,19 +85,38 @@ export type FeeOptions = {
89
85
  /** Options for `simulateViaEntrypoint`. */
90
86
  export type SimulateViaEntrypointOptions = Pick<
91
87
  SimulateOptions,
92
- 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement'
88
+ 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs'
93
89
  > & {
94
90
  /** Fee options for the entrypoint */
95
91
  feeOptions: FeeOptions;
96
- /** Scopes to use for the simulation */
97
- scopes: AztecAddress[];
98
92
  };
93
+
94
+ /** Options for `completeFeeOptions`. */
95
+ export type CompleteFeeOptionsConfig = {
96
+ /** The address where the transaction is being sent from. */
97
+ from: AztecAddress | NoFrom;
98
+ /** The address paying for fees (if any fee payment method is embedded in the execution payload). */
99
+ feePayer?: AztecAddress;
100
+ /** User-provided partial gas settings. */
101
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
102
+ /** If true, returns gas settings with high gas limits for estimation. If false, uses fallback limits. */
103
+ forEstimation?: boolean;
104
+ /**
105
+ * Assumed network congestion level for fee prediction. Controls how aggressively the wallet
106
+ * estimates future fees. Defaults to Limit (worst case) when not specified.
107
+ */
108
+ congestionEstimate?: ManaUsageEstimate;
109
+ };
110
+
99
111
  /**
100
112
  * A base class for Wallet implementations
101
113
  */
102
114
  export abstract class BaseWallet implements Wallet {
103
115
  protected minFeePadding = 0.5;
104
116
  protected cancellableTransactions = false;
117
+ // A wallet is instantiated for a particular chain, so chain info never changes during its lifetime.
118
+ // We cache it here because getChainInfo is called frequently (every tx simulation, send, auth wit, etc.).
119
+ private nodeInfoPromise: Promise<NodeInfo> | undefined;
105
120
 
106
121
  // Protected because we want to force wallets to instantiate their own PXE.
107
122
  protected constructor(
@@ -116,6 +131,17 @@ export abstract class BaseWallet implements Wallet {
116
131
  return [...scopeSet].map(AztecAddress.fromString);
117
132
  }
118
133
 
134
+ /**
135
+ * Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
136
+ * account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx will fail
137
+ * the contract-side `Sender for tags is not set` assertion unless `set_sender_for_tags` is called first.
138
+ * @param from - Tx sender, or `NO_FROM`.
139
+ * @param sendMessagesAs - Explicit override.
140
+ */
141
+ protected senderForTagsFrom(from: AztecAddress | NoFrom, sendMessagesAs?: AztecAddress): AztecAddress | undefined {
142
+ return sendMessagesAs ?? (from === NO_FROM ? undefined : from);
143
+ }
144
+
119
145
  protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
120
146
 
121
147
  abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
@@ -133,7 +159,10 @@ export abstract class BaseWallet implements Wallet {
133
159
  }
134
160
 
135
161
  async getChainInfo(): Promise<ChainInfo> {
136
- const { l1ChainId, rollupVersion } = await this.aztecNode.getNodeInfo();
162
+ if (!this.nodeInfoPromise) {
163
+ this.nodeInfoPromise = this.aztecNode.getNodeInfo();
164
+ }
165
+ const { l1ChainId, rollupVersion } = await this.nodeInfoPromise;
137
166
  return { chainId: new Fr(l1ChainId), version: new Fr(rollupVersion) };
138
167
  }
139
168
 
@@ -214,18 +243,12 @@ export abstract class BaseWallet implements Wallet {
214
243
 
215
244
  /**
216
245
  * Completes partial user-provided fee options with wallet defaults.
217
- * @param from - The address where the transaction is being sent from
218
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
219
- * @param gasSettings - User-provided partial gas settings
220
- * @returns - Complete fee options that can be used to create a transaction execution request
246
+ * @param config - Fee completion config.
221
247
  */
222
- protected async completeFeeOptions(
223
- from: AztecAddress | NoFrom,
224
- feePayer?: AztecAddress,
225
- gasSettings?: Partial<FieldsOf<GasSettings>>,
226
- ): Promise<FeeOptions> {
248
+ protected async completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions> {
249
+ const { from, feePayer, gasSettings, forEstimation, congestionEstimate } = config;
227
250
  const maxFeesPerGas =
228
- gasSettings?.maxFeesPerGas ?? (await this.aztecNode.getCurrentMinFees()).mul(1 + this.minFeePadding);
251
+ gasSettings?.maxFeesPerGas ?? (await this.getMinFees(congestionEstimate)).mul(1 + this.minFeePadding);
229
252
  let accountFeePaymentMethodOptions;
230
253
  // If from is an address, we need to determine the appropriate fee payment method options for the
231
254
  // account contract entrypoint to use
@@ -242,7 +265,17 @@ export abstract class BaseWallet implements Wallet {
242
265
  : AccountFeePaymentMethodOptions.EXTERNAL;
243
266
  }
244
267
  }
245
- const fullGasSettings: GasSettings = GasSettings.default({ ...gasSettings, maxFeesPerGas });
268
+ const gasSettingsOverrides = {
269
+ gasLimits: gasSettings?.gasLimits ? Gas.from(gasSettings.gasLimits) : undefined,
270
+ teardownGasLimits: gasSettings?.teardownGasLimits ? Gas.from(gasSettings.teardownGasLimits) : undefined,
271
+ maxFeesPerGas,
272
+ maxPriorityFeesPerGas: gasSettings?.maxPriorityFeesPerGas ?? GasFees.empty(),
273
+ };
274
+ // When estimating gas (simulation), use high limits so the simulation doesn't run out of gas.
275
+ // When sending for real, use protocol max limits that the network will actually accept.
276
+ const fullGasSettings = forEstimation
277
+ ? GasSettings.forEstimation(gasSettingsOverrides)
278
+ : GasSettings.fallback(gasSettingsOverrides);
246
279
  this.log.debug(`Using L2 gas settings`, fullGasSettings);
247
280
  return {
248
281
  gasSettings: fullGasSettings,
@@ -252,34 +285,25 @@ export abstract class BaseWallet implements Wallet {
252
285
  }
253
286
 
254
287
  /**
255
- * Completes partial user-provided fee options with unreasonably high gas limits
256
- * for gas estimation. Uses the same logic as completeFeeOptions but sets high limits
257
- * to avoid running out of gas during estimation.
258
- * @param from - The address where the transaction is being sent from
259
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
260
- * @param gasSettings - User-provided partial gas settings
288
+ * Returns the worst-case min fee across predicted future slots.
289
+ * Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
290
+ * @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
261
291
  */
262
- protected async completeFeeOptionsForEstimation(
263
- from: AztecAddress | NoFrom,
264
- feePayer?: AztecAddress,
265
- gasSettings?: Partial<FieldsOf<GasSettings>>,
266
- ) {
267
- const defaultFeeOptions = await this.completeFeeOptions(from, feePayer, gasSettings);
268
- const {
269
- gasSettings: { maxFeesPerGas, maxPriorityFeesPerGas },
270
- } = defaultFeeOptions;
271
- // Use unrealistically high gas limits for estimation to avoid running out of gas.
272
- // They will be tuned down after the simulation.
273
- const gasSettingsForEstimation = new GasSettings(
274
- new Gas(GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT),
275
- new Gas(GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT),
276
- maxFeesPerGas,
277
- maxPriorityFeesPerGas,
278
- );
279
- return {
280
- ...defaultFeeOptions,
281
- gasSettings: gasSettingsForEstimation,
282
- };
292
+ protected async getMinFees(estimate: ManaUsageEstimate = ManaUsageEstimate.Limit): Promise<GasFees> {
293
+ try {
294
+ const predicted = await this.aztecNode.getPredictedMinFees(estimate);
295
+ if (predicted.length === 0) {
296
+ return this.aztecNode.getCurrentMinFees();
297
+ }
298
+ return predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst));
299
+ } catch (err: any) {
300
+ // Fallback for old nodes that don't support getPredictedMinFees.
301
+ // Only fall back on method-not-found errors (JSON-RPC code -32601); rethrow others.
302
+ if (err?.cause?.code === -32601 || err?.message?.includes('Method not found')) {
303
+ return this.aztecNode.getCurrentMinFees();
304
+ }
305
+ throw err;
306
+ }
283
307
  }
284
308
 
285
309
  registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
@@ -335,12 +359,29 @@ export abstract class BaseWallet implements Wallet {
335
359
  opts.from,
336
360
  opts.feeOptions,
337
361
  );
338
- return this.pxe.simulateTx(txRequest, {
362
+ const result = await this.pxe.simulateTx(txRequest, {
339
363
  simulatePublic: true,
340
364
  skipTxValidation: opts.skipTxValidation,
341
365
  skipFeeEnforcement: opts.skipFeeEnforcement,
342
- scopes: opts.scopes,
366
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
367
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
343
368
  });
369
+ const appCallOffset = await this.computeAppCallOffset(opts.from, opts.feeOptions);
370
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
371
+ }
372
+
373
+ /**
374
+ * Computes the index where the app's calls begin in the flattened array of calls (0 = entrypoint/root, 1..N = fee
375
+ * calls, N+1 = app).
376
+ * @param from - The sender address, or NO_FROM for the default entrypoint.
377
+ * @param feeOptions - Fee options containing the wallet fee payment method.
378
+ */
379
+ protected async computeAppCallOffset(from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<number> {
380
+ if (from === NO_FROM) {
381
+ return 0;
382
+ }
383
+ const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
384
+ return (feeExecutionPayload?.calls.length ?? 0) + 1; // +1 for entrypoint
344
385
  }
345
386
 
346
387
  /**
@@ -351,10 +392,17 @@ export abstract class BaseWallet implements Wallet {
351
392
  * @param opts - Simulation options (from address, fee settings, etc.).
352
393
  * @returns The merged simulation result.
353
394
  */
354
- async simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult> {
355
- const feeOptions = opts.fee?.estimateGas
356
- ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings)
357
- : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
395
+ async simulateTx(
396
+ executionPayload: ExecutionPayload,
397
+ opts: SimulateOptions,
398
+ ): Promise<TxSimulationResultWithAppOffset> {
399
+ const feeOptions = await this.completeFeeOptions({
400
+ from: opts.from,
401
+ feePayer: executionPayload.feePayer,
402
+ gasSettings: opts.fee?.gasSettings,
403
+ forEstimation: true,
404
+ congestionEstimate: opts.fee?.congestionEstimate,
405
+ });
358
406
  const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
359
407
  const remainingPayload = { ...executionPayload, calls: remainingCalls };
360
408
 
@@ -365,7 +413,7 @@ export abstract class BaseWallet implements Wallet {
365
413
  try {
366
414
  blockHeader = await this.pxe.getSyncedBlockHeader();
367
415
  } catch {
368
- blockHeader = (await this.aztecNode.getBlockHeader())!;
416
+ blockHeader = (await this.aztecNode.getBlockHeader('latest'))!;
369
417
  }
370
418
 
371
419
  const simulationOrigin = opts.from === NO_FROM ? AztecAddress.ZERO : opts.from;
@@ -386,9 +434,10 @@ export abstract class BaseWallet implements Wallet {
386
434
  ? this.simulateViaEntrypoint(remainingPayload, {
387
435
  from: opts.from,
388
436
  feeOptions,
389
- scopes: this.scopesFrom(opts.from, opts.additionalScopes),
437
+ additionalScopes: opts.additionalScopes,
390
438
  skipTxValidation: opts.skipTxValidation,
391
439
  skipFeeEnforcement: opts.skipFeeEnforcement ?? true,
440
+ sendMessagesAs: opts.sendMessagesAs,
392
441
  })
393
442
  : Promise.resolve(null),
394
443
  ]);
@@ -397,12 +446,18 @@ export abstract class BaseWallet implements Wallet {
397
446
  }
398
447
 
399
448
  async profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult> {
400
- const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
449
+ const feeOptions = await this.completeFeeOptions({
450
+ from: opts.from,
451
+ feePayer: executionPayload.feePayer,
452
+ gasSettings: opts.fee?.gasSettings,
453
+ congestionEstimate: opts.fee?.congestionEstimate,
454
+ });
401
455
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
402
456
  return this.pxe.profileTx(txRequest, {
403
457
  profileMode: opts.profileMode,
404
458
  skipProofGeneration: opts.skipProofGeneration ?? true,
405
459
  scopes: this.scopesFrom(opts.from, opts.additionalScopes),
460
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
406
461
  });
407
462
  }
408
463
 
@@ -410,9 +465,17 @@ export abstract class BaseWallet implements Wallet {
410
465
  executionPayload: ExecutionPayload,
411
466
  opts: SendOptions<W>,
412
467
  ): Promise<SendReturn<W>> {
413
- const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
468
+ const feeOptions = await this.completeFeeOptions({
469
+ from: opts.from,
470
+ feePayer: executionPayload.feePayer,
471
+ gasSettings: opts.fee?.gasSettings,
472
+ congestionEstimate: opts.fee?.congestionEstimate,
473
+ });
414
474
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
415
- const provenTx = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
475
+ const provenTx = await this.pxe.proveTx(txRequest, {
476
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
477
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
478
+ });
416
479
  const offchainOutput = extractOffchainOutput(
417
480
  provenTx.getOffchainEffects(),
418
481
  provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp,
@@ -1,2 +1,7 @@
1
- export { BaseWallet, type FeeOptions, type SimulateViaEntrypointOptions } from './base_wallet.js';
1
+ export {
2
+ BaseWallet,
3
+ type CompleteFeeOptionsConfig,
4
+ type FeeOptions,
5
+ type SimulateViaEntrypointOptions,
6
+ } from './base_wallet.js';
2
7
  export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
@@ -1,4 +1,5 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
2
3
  import { MAX_ENQUEUED_CALLS_PER_CALL } from '@aztec/constants';
3
4
  import type { ChainInfo } from '@aztec/entrypoints/interfaces';
4
5
  import { makeTuple } from '@aztec/foundation/array';
@@ -214,13 +215,13 @@ export async function simulateViaNode(
214
215
  */
215
216
  export function buildMergedSimulationResult(
216
217
  optimizedResults: TxSimulationResult[],
217
- normalResult: TxSimulationResult | null,
218
- ): TxSimulationResult {
218
+ normalResult: TxSimulationResultWithAppOffset | null,
219
+ ): TxSimulationResultWithAppOffset {
219
220
  const optimizedReturnValues = optimizedResults.flatMap(r => r.publicOutput?.publicReturnValues ?? []);
220
221
  const normalReturnValues = normalResult?.publicOutput?.publicReturnValues ?? [];
221
222
  const allReturnValues = [...optimizedReturnValues, ...normalReturnValues];
222
223
 
223
- const baseResult = normalResult ?? optimizedResults[0];
224
+ const baseResult: TxSimulationResult = normalResult ?? optimizedResults[0];
224
225
 
225
226
  const mergedPublicOutput: PublicSimulationOutput | undefined = baseResult.publicOutput
226
227
  ? {
@@ -229,10 +230,11 @@ export function buildMergedSimulationResult(
229
230
  }
230
231
  : undefined;
231
232
 
232
- return new TxSimulationResult(
233
+ const merged = new TxSimulationResult(
233
234
  baseResult.privateExecutionResult,
234
235
  baseResult.publicInputs,
235
236
  mergedPublicOutput,
236
237
  normalResult?.stats,
237
238
  );
239
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(merged, normalResult?.appCallOffset ?? 0);
238
240
  }