@aztec/wallet-sdk 0.0.1-commit.e558bd1c → 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.
Files changed (59) hide show
  1. package/dest/base-wallet/base_wallet.d.ts +79 -34
  2. package/dest/base-wallet/base_wallet.d.ts.map +1 -1
  3. package/dest/base-wallet/base_wallet.js +238 -65
  4. package/dest/base-wallet/index.d.ts +3 -2
  5. package/dest/base-wallet/index.d.ts.map +1 -1
  6. package/dest/base-wallet/index.js +1 -0
  7. package/dest/base-wallet/utils.d.ts +50 -0
  8. package/dest/base-wallet/utils.d.ts.map +1 -0
  9. package/dest/base-wallet/utils.js +133 -0
  10. package/dest/crypto.d.ts +39 -1
  11. package/dest/crypto.d.ts.map +1 -1
  12. package/dest/crypto.js +88 -0
  13. package/dest/extension/provider/extension_wallet.d.ts +4 -6
  14. package/dest/extension/provider/extension_wallet.d.ts.map +1 -1
  15. package/dest/extension/provider/extension_wallet.js +9 -2
  16. package/dest/extension/provider/index.d.ts +2 -2
  17. package/dest/extension/provider/index.d.ts.map +1 -1
  18. package/dest/iframe/handlers/iframe_connection_handler.d.ts +118 -0
  19. package/dest/iframe/handlers/iframe_connection_handler.d.ts.map +1 -0
  20. package/dest/iframe/handlers/iframe_connection_handler.js +228 -0
  21. package/dest/iframe/handlers/index.d.ts +2 -0
  22. package/dest/iframe/handlers/index.d.ts.map +1 -0
  23. package/dest/iframe/handlers/index.js +1 -0
  24. package/dest/iframe/provider/iframe_discovery.d.ts +25 -0
  25. package/dest/iframe/provider/iframe_discovery.d.ts.map +1 -0
  26. package/dest/iframe/provider/iframe_discovery.js +167 -0
  27. package/dest/iframe/provider/iframe_provider.d.ts +65 -0
  28. package/dest/iframe/provider/iframe_provider.d.ts.map +1 -0
  29. package/dest/iframe/provider/iframe_provider.js +257 -0
  30. package/dest/iframe/provider/iframe_wallet.d.ts +68 -0
  31. package/dest/iframe/provider/iframe_wallet.d.ts.map +1 -0
  32. package/dest/iframe/provider/iframe_wallet.js +200 -0
  33. package/dest/iframe/provider/index.d.ts +4 -0
  34. package/dest/iframe/provider/index.d.ts.map +1 -0
  35. package/dest/iframe/provider/index.js +3 -0
  36. package/dest/manager/types.d.ts +6 -5
  37. package/dest/manager/types.d.ts.map +1 -1
  38. package/dest/manager/wallet_manager.d.ts +1 -1
  39. package/dest/manager/wallet_manager.d.ts.map +1 -1
  40. package/dest/manager/wallet_manager.js +48 -18
  41. package/dest/types.d.ts +14 -2
  42. package/dest/types.d.ts.map +1 -1
  43. package/dest/types.js +4 -0
  44. package/package.json +12 -8
  45. package/src/base-wallet/base_wallet.ts +330 -116
  46. package/src/base-wallet/index.ts +7 -1
  47. package/src/base-wallet/utils.ts +240 -0
  48. package/src/crypto.ts +104 -0
  49. package/src/extension/provider/extension_wallet.ts +13 -10
  50. package/src/extension/provider/index.ts +1 -1
  51. package/src/iframe/handlers/iframe_connection_handler.ts +328 -0
  52. package/src/iframe/handlers/index.ts +7 -0
  53. package/src/iframe/provider/iframe_discovery.ts +185 -0
  54. package/src/iframe/provider/iframe_provider.ts +331 -0
  55. package/src/iframe/provider/iframe_wallet.ts +229 -0
  56. package/src/iframe/provider/index.ts +3 -0
  57. package/src/manager/types.ts +5 -4
  58. package/src/manager/wallet_manager.ts +55 -23
  59. package/src/types.ts +13 -0
@@ -1,8 +1,8 @@
1
- import type { Account } from '@aztec/aztec.js/account';
1
+ 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, AppCapabilities, BatchResults, BatchedMethod, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions, Wallet, 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';
@@ -10,12 +10,11 @@ import type { FieldsOf } from '@aztec/foundation/types';
10
10
  import type { PXE } from '@aztec/pxe/server';
11
11
  import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall } from '@aztec/stdlib/abi';
12
12
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
13
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
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, TxProfileResult, TxSimulationResult, UtilitySimulationResult } 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
  */
@@ -26,10 +25,31 @@ export type FeeOptions = {
26
25
  */
27
26
  walletFeePaymentMethod?: FeePaymentMethod;
28
27
  /** Configuration options for the account to properly handle the selected fee payment method */
29
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
28
+ accountFeePaymentMethodOptions?: AccountFeePaymentMethodOptions;
30
29
  /** The gas settings to use for the transaction */
31
30
  gasSettings: GasSettings;
32
31
  };
32
+ /** Options for `simulateViaEntrypoint`. */
33
+ export type SimulateViaEntrypointOptions = Pick<SimulateOptions, 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs'> & {
34
+ /** Fee options for the entrypoint */
35
+ feeOptions: FeeOptions;
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;
52
+ };
33
53
  /**
34
54
  * A base class for Wallet implementations
35
55
  */
@@ -39,7 +59,17 @@ export declare abstract class BaseWallet implements Wallet {
39
59
  protected log: import("@aztec/foundation/log").Logger;
40
60
  protected minFeePadding: number;
41
61
  protected cancellableTransactions: boolean;
42
- protected constructor(pxe: PXE, aztecNode: AztecNode);
62
+ private nodeInfoPromise;
63
+ protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
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;
43
73
  protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
44
74
  abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
45
75
  /**
@@ -51,7 +81,7 @@ export declare abstract class BaseWallet implements Wallet {
51
81
  */
52
82
  getAddressBook(): Promise<Aliased<AztecAddress>[]>;
53
83
  getChainInfo(): Promise<ChainInfo>;
54
- protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
84
+ protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
55
85
  createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
56
86
  /**
57
87
  * Request capabilities from the wallet.
@@ -70,41 +100,56 @@ export declare abstract class BaseWallet implements Wallet {
70
100
  batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
71
101
  /**
72
102
  * Completes partial user-provided fee options with wallet defaults.
73
- * @param from - The address where the transaction is being sent from
74
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
75
- * @param gasSettings - User-provided partial gas settings
76
- * @returns - Complete fee options that can be used to create a transaction execution request
103
+ * @param config - Fee completion config.
77
104
  */
78
- protected completeFeeOptions(from: AztecAddress, feePayer?: AztecAddress, gasSettings?: Partial<FieldsOf<GasSettings>>): Promise<FeeOptions>;
105
+ protected completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions>;
79
106
  /**
80
- * Completes partial user-provided fee options with unreasonably high gas limits
81
- * for gas estimation. Uses the same logic as completeFeeOptions but sets high limits
82
- * to avoid running out of gas during estimation.
83
- * @param from - The address where the transaction is being sent from
84
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
85
- * @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.
86
110
  */
87
- protected completeFeeOptionsForEstimation(from: AztecAddress, feePayer?: AztecAddress, gasSettings?: Partial<FieldsOf<GasSettings>>): Promise<{
88
- /**
89
- * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
90
- * doesn't already include one
91
- */
92
- walletFeePaymentMethod?: FeePaymentMethod | undefined;
93
- /** Configuration options for the account to properly handle the selected fee payment method */
94
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
95
- gasSettings: GasSettings;
96
- }>;
111
+ protected getMinFees(estimate?: ManaUsageEstimate): Promise<GasFees>;
97
112
  registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
98
113
  registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
99
- simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
114
+ /**
115
+ * Simulates calls through the standard PXE path (account entrypoint).
116
+ * @param executionPayload - The execution payload to simulate.
117
+ * @param opts - Simulation options.
118
+ */
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>;
127
+ /**
128
+ * Simulates a transaction, optimizing leading public static calls by running them directly
129
+ * on the node while sending the remaining calls through the standard PXE path.
130
+ * Return values from both paths are merged back in original call order.
131
+ * @param executionPayload - The execution payload to simulate.
132
+ * @param opts - Simulation options (from address, fee settings, etc.).
133
+ * @returns The merged simulation result.
134
+ */
135
+ simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset>;
100
136
  profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
101
137
  sendTx<W extends InteractionWaitOptions = undefined>(executionPayload: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
138
+ /**
139
+ * Resolves a contract address to a human-readable name via PXE, if available.
140
+ * @param address - The contract address to resolve.
141
+ */
142
+ protected getContractName(address: AztecAddress): Promise<string | undefined>;
102
143
  protected contextualizeError(err: Error, ...context: string[]): Error;
103
- simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
144
+ executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
104
145
  getPrivateEvents<T>(eventDef: EventMetadataDefinition, eventFilter: PrivateEventFilter): Promise<PrivateEvent<T>[]>;
146
+ /**
147
+ * Returns metadata about a contract, including whether it has been initialized, published, and updated.
148
+ * @param address - The contract address to query.
149
+ */
105
150
  getContractMetadata(address: AztecAddress): Promise<{
106
151
  instance: ContractInstanceWithAddress | undefined;
107
- isContractInitialized: boolean;
152
+ initializationStatus: ContractInitializationStatus;
108
153
  isContractPublished: boolean;
109
154
  isContractUpdated: boolean;
110
155
  updatedContractClassId: Fr | undefined;
@@ -114,4 +159,4 @@ export declare abstract class BaseWallet implements Wallet {
114
159
  isContractClassPubliclyRegistered: boolean;
115
160
  }>;
116
161
  }
117
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRS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
+ import { NO_WAIT, extractOffchainOutput } from '@aztec/aztec.js/contracts';
2
3
  import { waitForTx } from '@aztec/aztec.js/node';
3
- 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';
4
5
  import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
6
+ import { DefaultEntrypoint } from '@aztec/entrypoints/default';
5
7
  import { Fr } from '@aztec/foundation/curves/bn254';
6
8
  import { createLogger } from '@aztec/foundation/log';
9
+ import { displayDebugLogs } from '@aztec/pxe/client/lazy';
7
10
  import { decodeFromAbi } from '@aztec/stdlib/abi';
11
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
12
  import { computePartialAddress, getContractClassFromArtifact } from '@aztec/stdlib/contract';
9
13
  import { SimulationError } from '@aztec/stdlib/errors';
10
- import { Gas, GasSettings } from '@aztec/stdlib/gas';
11
- import { siloNullifier } from '@aztec/stdlib/hash';
14
+ import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
15
+ import { computeSiloedPrivateInitializationNullifier, computeSiloedPublicInitializationNullifier } from '@aztec/stdlib/hash';
12
16
  import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
13
17
  import { inspect } from 'util';
18
+ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simulateViaNode } from './utils.js';
14
19
  /**
15
20
  * A base class for Wallet implementations
16
21
  */ export class BaseWallet {
@@ -19,14 +24,36 @@ import { inspect } from 'util';
19
24
  log;
20
25
  minFeePadding;
21
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;
22
30
  // Protected because we want to force wallets to instantiate their own PXE.
23
- constructor(pxe, aztecNode){
31
+ constructor(pxe, aztecNode, log = createLogger('wallet-sdk:base_wallet')){
24
32
  this.pxe = pxe;
25
33
  this.aztecNode = aztecNode;
26
- this.log = createLogger('wallet-sdk:base_wallet');
34
+ this.log = log;
27
35
  this.minFeePadding = 0.5;
28
36
  this.cancellableTransactions = false;
29
37
  }
38
+ scopesFrom(from, additionalScopes = []) {
39
+ const allScopes = from === NO_FROM ? additionalScopes : [
40
+ from,
41
+ ...additionalScopes
42
+ ];
43
+ const scopeSet = new Set(allScopes.map((address)=>address.toString()));
44
+ return [
45
+ ...scopeSet
46
+ ].map(AztecAddress.fromString);
47
+ }
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
+ }
30
57
  /**
31
58
  * Returns the list of aliased contacts associated with the wallet.
32
59
  * This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
@@ -41,7 +68,10 @@ import { inspect } from 'util';
41
68
  }));
42
69
  }
43
70
  async getChainInfo() {
44
- 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;
45
75
  return {
46
76
  chainId: new Fr(l1ChainId),
47
77
  version: new Fr(rollupVersion)
@@ -49,18 +79,24 @@ import { inspect } from 'util';
49
79
  }
50
80
  async createTxExecutionRequestFromPayloadAndFee(executionPayload, from, feeOptions) {
51
81
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
52
- const executionOptions = {
53
- txNonce: Fr.random(),
54
- cancellable: this.cancellableTransactions,
55
- feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
56
- };
57
82
  const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
58
83
  feeExecutionPayload,
59
84
  executionPayload
60
85
  ]) : executionPayload;
61
- const fromAccount = await this.getAccountFromAddress(from);
62
86
  const chainInfo = await this.getChainInfo();
63
- return fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
87
+ if (from === NO_FROM) {
88
+ const entrypoint = new DefaultEntrypoint();
89
+ return entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
90
+ } else {
91
+ const fromAccount = await this.getAccountFromAddress(from);
92
+ const executionOptions = {
93
+ txNonce: Fr.random(),
94
+ cancellable: this.cancellableTransactions,
95
+ // If from is an address, feeOptions include the way the account contract should handle the fee payment
96
+ feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
97
+ };
98
+ return fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
99
+ }
64
100
  }
65
101
  async createAuthWit(from, messageHashOrIntent) {
66
102
  const account = await this.getAccountFromAddress(from);
@@ -103,26 +139,33 @@ import { inspect } from 'util';
103
139
  }
104
140
  /**
105
141
  * Completes partial user-provided fee options with wallet defaults.
106
- * @param from - The address where the transaction is being sent from
107
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
108
- * @param gasSettings - User-provided partial gas settings
109
- * @returns - Complete fee options that can be used to create a transaction execution request
110
- */ async completeFeeOptions(from, feePayer, gasSettings) {
111
- 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);
112
146
  let accountFeePaymentMethodOptions;
113
- // The transaction does not include a fee payment method, so we set the flag
114
- // for the account to use its fee juice balance
115
- if (!feePayer) {
116
- accountFeePaymentMethodOptions = AccountFeePaymentMethodOptions.PREEXISTING_FEE_JUICE;
117
- } else {
118
- // The transaction includes fee payment method, so we check if we are the fee payer for it
119
- // (this can only happen if the embedded payment method is FeeJuiceWithClaim)
120
- accountFeePaymentMethodOptions = from.equals(feePayer) ? AccountFeePaymentMethodOptions.FEE_JUICE_WITH_CLAIM : AccountFeePaymentMethodOptions.EXTERNAL;
147
+ // If from is an address, we need to determine the appropriate fee payment method options for the
148
+ // account contract entrypoint to use
149
+ if (from !== NO_FROM) {
150
+ if (!feePayer) {
151
+ // The transaction does not include a fee payment method, so we set the flag
152
+ // for the account to use its fee juice balance
153
+ accountFeePaymentMethodOptions = AccountFeePaymentMethodOptions.PREEXISTING_FEE_JUICE;
154
+ } else {
155
+ // The transaction includes fee payment method, so we check if we are the fee payer for it
156
+ // (this can only happen if the embedded payment method is FeeJuiceWithClaim)
157
+ accountFeePaymentMethodOptions = from.equals(feePayer) ? AccountFeePaymentMethodOptions.FEE_JUICE_WITH_CLAIM : AccountFeePaymentMethodOptions.EXTERNAL;
158
+ }
121
159
  }
122
- const fullGasSettings = GasSettings.default({
123
- ...gasSettings,
124
- maxFeesPerGas
125
- });
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);
126
169
  this.log.debug(`Using L2 gas settings`, fullGasSettings);
127
170
  return {
128
171
  gasSettings: fullGasSettings,
@@ -131,22 +174,24 @@ import { inspect } from 'util';
131
174
  };
132
175
  }
133
176
  /**
134
- * Completes partial user-provided fee options with unreasonably high gas limits
135
- * for gas estimation. Uses the same logic as completeFeeOptions but sets high limits
136
- * to avoid running out of gas during estimation.
137
- * @param from - The address where the transaction is being sent from
138
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
139
- * @param gasSettings - User-provided partial gas settings
140
- */ async completeFeeOptionsForEstimation(from, feePayer, gasSettings) {
141
- const defaultFeeOptions = await this.completeFeeOptions(from, feePayer, gasSettings);
142
- const { gasSettings: { maxFeesPerGas, maxPriorityFeesPerGas } } = defaultFeeOptions;
143
- // Use unrealistically high gas limits for estimation to avoid running out of gas.
144
- // They will be tuned down after the simulation.
145
- 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);
146
- return {
147
- ...defaultFeeOptions,
148
- gasSettings: gasSettingsForEstimation
149
- };
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
+ }
150
195
  }
151
196
  registerSender(address, _alias = '') {
152
197
  return this.pxe.registerSender(address);
@@ -183,20 +228,105 @@ import { inspect } from 'util';
183
228
  }
184
229
  return instance;
185
230
  }
186
- async simulateTx(executionPayload, opts) {
187
- 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);
188
- const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
189
- return this.pxe.simulateTx(txRequest, true, opts?.skipTxValidation, opts?.skipFeeEnforcement ?? true);
231
+ /**
232
+ * Simulates calls through the standard PXE path (account entrypoint).
233
+ * @param executionPayload - The execution payload to simulate.
234
+ * @param opts - Simulation options.
235
+ */ async simulateViaEntrypoint(executionPayload, opts) {
236
+ const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, opts.feeOptions);
237
+ const result = await this.pxe.simulateTx(txRequest, {
238
+ simulatePublic: true,
239
+ skipTxValidation: opts.skipTxValidation,
240
+ skipFeeEnforcement: opts.skipFeeEnforcement,
241
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
242
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
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
258
+ }
259
+ /**
260
+ * Simulates a transaction, optimizing leading public static calls by running them directly
261
+ * on the node while sending the remaining calls through the standard PXE path.
262
+ * Return values from both paths are merged back in original call order.
263
+ * @param executionPayload - The execution payload to simulate.
264
+ * @param opts - Simulation options (from address, fee settings, etc.).
265
+ * @returns The merged simulation result.
266
+ */ async simulateTx(executionPayload, opts) {
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
+ });
274
+ const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
275
+ const remainingPayload = {
276
+ ...executionPayload,
277
+ calls: remainingCalls
278
+ };
279
+ const chainInfo = await this.getChainInfo();
280
+ let blockHeader;
281
+ // PXE might not be synced yet, so we pull the latest header from the node
282
+ // To keep things consistent, we'll always try with PXE first
283
+ try {
284
+ blockHeader = await this.pxe.getSyncedBlockHeader();
285
+ } catch {
286
+ blockHeader = await this.aztecNode.getBlockHeader('latest');
287
+ }
288
+ const simulationOrigin = opts.from === NO_FROM ? AztecAddress.ZERO : opts.from;
289
+ const [optimizedResults, normalResult] = await Promise.all([
290
+ optimizableCalls.length > 0 ? simulateViaNode(this.aztecNode, optimizableCalls, simulationOrigin, chainInfo, feeOptions.gasSettings, blockHeader, opts.skipFeeEnforcement ?? true, this.getContractName.bind(this)) : Promise.resolve([]),
291
+ remainingCalls.length > 0 ? this.simulateViaEntrypoint(remainingPayload, {
292
+ from: opts.from,
293
+ feeOptions,
294
+ additionalScopes: opts.additionalScopes,
295
+ skipTxValidation: opts.skipTxValidation,
296
+ skipFeeEnforcement: opts.skipFeeEnforcement ?? true,
297
+ sendMessagesAs: opts.sendMessagesAs
298
+ }) : Promise.resolve(null)
299
+ ]);
300
+ return buildMergedSimulationResult(optimizedResults, normalResult);
190
301
  }
191
302
  async profileTx(executionPayload, opts) {
192
- 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
+ });
193
309
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
194
- return this.pxe.profileTx(txRequest, opts.profileMode, opts.skipProofGeneration ?? true);
310
+ return this.pxe.profileTx(txRequest, {
311
+ profileMode: opts.profileMode,
312
+ skipProofGeneration: opts.skipProofGeneration ?? true,
313
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
314
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
315
+ });
195
316
  }
196
317
  async sendTx(executionPayload, opts) {
197
- 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
+ });
198
324
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
199
- const provenTx = await this.pxe.proveTx(txRequest);
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
+ });
329
+ const offchainOutput = extractOffchainOutput(provenTx.getOffchainEffects(), provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp);
200
330
  const tx = await provenTx.toTx();
201
331
  const txHash = tx.getTxHash();
202
332
  if (await this.aztecNode.getTxEffect(txHash)) {
@@ -209,11 +339,33 @@ import { inspect } from 'util';
209
339
  this.log.info(`Sent transaction ${txHash}`);
210
340
  // If wait is NO_WAIT, return txHash immediately
211
341
  if (opts.wait === NO_WAIT) {
212
- return txHash;
342
+ return {
343
+ txHash,
344
+ ...offchainOutput
345
+ };
213
346
  }
214
347
  // Otherwise, wait for the full receipt (default behavior on wait: undefined)
215
348
  const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
216
- return await waitForTx(this.aztecNode, txHash, waitOpts);
349
+ const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
350
+ // Display debug logs from public execution if present (served in test mode only)
351
+ if (receipt.debugLogs?.length) {
352
+ await displayDebugLogs(receipt.debugLogs, this.getContractName.bind(this));
353
+ }
354
+ return {
355
+ receipt,
356
+ ...offchainOutput
357
+ };
358
+ }
359
+ /**
360
+ * Resolves a contract address to a human-readable name via PXE, if available.
361
+ * @param address - The contract address to resolve.
362
+ */ async getContractName(address) {
363
+ const instance = await this.pxe.getContractInstance(address);
364
+ if (!instance) {
365
+ return undefined;
366
+ }
367
+ const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
368
+ return artifact?.name;
217
369
  }
218
370
  contextualizeError(err, ...context) {
219
371
  let contextStr = '';
@@ -228,8 +380,11 @@ import { inspect } from 'util';
228
380
  }
229
381
  return err;
230
382
  }
231
- simulateUtility(call, authwits) {
232
- return this.pxe.simulateUtility(call, authwits);
383
+ executeUtility(call, opts) {
384
+ return this.pxe.executeUtility(call, {
385
+ authwits: opts.authWitnesses,
386
+ scopes: opts.scopes
387
+ });
233
388
  }
234
389
  async getPrivateEvents(eventDef, eventFilter) {
235
390
  const pxeEvents = await this.pxe.getPrivateEvents(eventDef.eventSelector, eventFilter);
@@ -247,15 +402,33 @@ import { inspect } from 'util';
247
402
  });
248
403
  return decodedEvents;
249
404
  }
250
- async getContractMetadata(address) {
405
+ /**
406
+ * Returns metadata about a contract, including whether it has been initialized, published, and updated.
407
+ * @param address - The contract address to query.
408
+ */ async getContractMetadata(address) {
251
409
  const instance = await this.pxe.getContractInstance(address);
252
- const initNullifier = await siloNullifier(address, address.toField());
253
- const publiclyRegisteredContract = await this.aztecNode.getContract(address);
254
- const initNullifierMembershipWitness = await this.aztecNode.getNullifierMembershipWitness('latest', initNullifier);
410
+ const publiclyRegisteredContractPromise = this.aztecNode.getContract(address);
411
+ let initializationStatus;
412
+ if (instance) {
413
+ // We have the instance, so we can compute the private initialization nullifier (which includes init_hash and is
414
+ // emitted by both private and public initializers) and get a definitive INITIALIZED/UNINITIALIZED answer.
415
+ const initNullifier = await computeSiloedPrivateInitializationNullifier(address, instance.initializationHash);
416
+ const witness = await this.aztecNode.getNullifierMembershipWitness('latest', initNullifier);
417
+ initializationStatus = witness ? ContractInitializationStatus.INITIALIZED : ContractInitializationStatus.UNINITIALIZED;
418
+ } else {
419
+ // Without the instance we lack the init_hash needed for the private nullifier. We fall back to checking the
420
+ // public initialization nullifier (computed from address alone). Not all contracts emit it (only those with
421
+ // public functions that require initialization checks), so its absence doesn't mean the contract is
422
+ // uninitialized.
423
+ const publicNullifier = await computeSiloedPublicInitializationNullifier(address);
424
+ const witness = await this.aztecNode.getNullifierMembershipWitness('latest', publicNullifier);
425
+ initializationStatus = witness ? ContractInitializationStatus.INITIALIZED : ContractInitializationStatus.UNKNOWN;
426
+ }
427
+ const publiclyRegisteredContract = await publiclyRegisteredContractPromise;
255
428
  const isContractUpdated = publiclyRegisteredContract && !publiclyRegisteredContract.currentContractClassId.equals(publiclyRegisteredContract.originalContractClassId);
256
429
  return {
257
430
  instance: instance ?? undefined,
258
- isContractInitialized: !!initNullifierMembershipWitness,
431
+ initializationStatus,
259
432
  isContractPublished: !!publiclyRegisteredContract,
260
433
  isContractUpdated: !!isContractUpdated,
261
434
  updatedContractClassId: isContractUpdated ? publiclyRegisteredContract.currentContractClassId : undefined