@aztec/wallet-sdk 0.0.1-commit.fffb133c → 0.0.1-dev

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 (71) hide show
  1. package/dest/base-wallet/base_wallet.d.ts +83 -35
  2. package/dest/base-wallet/base_wallet.d.ts.map +1 -1
  3. package/dest/base-wallet/base_wallet.js +231 -70
  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/handlers/background_connection_handler.d.ts +12 -2
  14. package/dest/extension/handlers/background_connection_handler.d.ts.map +1 -1
  15. package/dest/extension/handlers/background_connection_handler.js +44 -8
  16. package/dest/extension/handlers/content_script_connection_handler.d.ts +2 -1
  17. package/dest/extension/handlers/content_script_connection_handler.d.ts.map +1 -1
  18. package/dest/extension/handlers/content_script_connection_handler.js +19 -0
  19. package/dest/extension/handlers/internal_message_types.d.ts +3 -1
  20. package/dest/extension/handlers/internal_message_types.d.ts.map +1 -1
  21. package/dest/extension/handlers/internal_message_types.js +3 -1
  22. package/dest/extension/provider/extension_wallet.d.ts +27 -6
  23. package/dest/extension/provider/extension_wallet.d.ts.map +1 -1
  24. package/dest/extension/provider/extension_wallet.js +87 -9
  25. package/dest/extension/provider/index.d.ts +2 -2
  26. package/dest/extension/provider/index.d.ts.map +1 -1
  27. package/dest/iframe/handlers/iframe_connection_handler.d.ts +122 -0
  28. package/dest/iframe/handlers/iframe_connection_handler.d.ts.map +1 -0
  29. package/dest/iframe/handlers/iframe_connection_handler.js +240 -0
  30. package/dest/iframe/handlers/index.d.ts +2 -0
  31. package/dest/iframe/handlers/index.d.ts.map +1 -0
  32. package/dest/iframe/handlers/index.js +1 -0
  33. package/dest/iframe/provider/iframe_discovery.d.ts +25 -0
  34. package/dest/iframe/provider/iframe_discovery.d.ts.map +1 -0
  35. package/dest/iframe/provider/iframe_discovery.js +167 -0
  36. package/dest/iframe/provider/iframe_provider.d.ts +65 -0
  37. package/dest/iframe/provider/iframe_provider.d.ts.map +1 -0
  38. package/dest/iframe/provider/iframe_provider.js +257 -0
  39. package/dest/iframe/provider/iframe_wallet.d.ts +85 -0
  40. package/dest/iframe/provider/iframe_wallet.d.ts.map +1 -0
  41. package/dest/iframe/provider/iframe_wallet.js +269 -0
  42. package/dest/iframe/provider/index.d.ts +4 -0
  43. package/dest/iframe/provider/index.d.ts.map +1 -0
  44. package/dest/iframe/provider/index.js +3 -0
  45. package/dest/manager/types.d.ts +6 -5
  46. package/dest/manager/types.d.ts.map +1 -1
  47. package/dest/manager/wallet_manager.d.ts +1 -1
  48. package/dest/manager/wallet_manager.d.ts.map +1 -1
  49. package/dest/manager/wallet_manager.js +48 -18
  50. package/dest/types.d.ts +64 -2
  51. package/dest/types.d.ts.map +1 -1
  52. package/dest/types.js +29 -0
  53. package/package.json +19 -9
  54. package/src/base-wallet/base_wallet.ts +318 -124
  55. package/src/base-wallet/index.ts +7 -1
  56. package/src/base-wallet/utils.ts +240 -0
  57. package/src/crypto.ts +104 -0
  58. package/src/extension/handlers/background_connection_handler.ts +42 -9
  59. package/src/extension/handlers/content_script_connection_handler.ts +18 -0
  60. package/src/extension/handlers/internal_message_types.ts +2 -0
  61. package/src/extension/provider/extension_wallet.ts +104 -15
  62. package/src/extension/provider/index.ts +1 -1
  63. package/src/iframe/handlers/iframe_connection_handler.ts +342 -0
  64. package/src/iframe/handlers/index.ts +7 -0
  65. package/src/iframe/provider/iframe_discovery.ts +185 -0
  66. package/src/iframe/provider/iframe_provider.ts +331 -0
  67. package/src/iframe/provider/iframe_wallet.ts +323 -0
  68. package/src/iframe/provider/index.ts +3 -0
  69. package/src/manager/types.ts +5 -4
  70. package/src/manager/wallet_manager.ts +55 -23
  71. package/src/types.ts +72 -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, BatchResults, BatchedMethod, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions, Wallet } 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,11 +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
15
  import { GasSettings } 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';
17
+ import { type TxExecutionRequest, type TxProfileResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
18
18
  import { ExecutionPayload } from '@aztec/stdlib/tx';
19
19
  /**
20
20
  * Options to configure fee payment for a transaction
@@ -26,10 +26,26 @@ export type FeeOptions = {
26
26
  */
27
27
  walletFeePaymentMethod?: FeePaymentMethod;
28
28
  /** Configuration options for the account to properly handle the selected fee payment method */
29
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
29
+ accountFeePaymentMethodOptions?: AccountFeePaymentMethodOptions;
30
30
  /** The gas settings to use for the transaction */
31
31
  gasSettings: GasSettings;
32
32
  };
33
+ /** Options for `simulateViaEntrypoint`. */
34
+ export type SimulateViaEntrypointOptions = Pick<SimulateOptions, 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs'> & {
35
+ /** Fee options for the entrypoint */
36
+ feeOptions: FeeOptions;
37
+ };
38
+ /** Options for `completeFeeOptions`. */
39
+ export type CompleteFeeOptionsConfig = {
40
+ /** The address where the transaction is being sent from. */
41
+ from: AztecAddress | NoFrom;
42
+ /** The address paying for fees (if any fee payment method is embedded in the execution payload). */
43
+ feePayer?: AztecAddress;
44
+ /** User-provided partial gas settings. */
45
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
46
+ /** If true, returns gas settings with high gas limits for estimation. If false, uses fallback limits. */
47
+ forEstimation?: boolean;
48
+ };
33
49
  /**
34
50
  * A base class for Wallet implementations
35
51
  */
@@ -39,7 +55,17 @@ export declare abstract class BaseWallet implements Wallet {
39
55
  protected log: import("@aztec/foundation/log").Logger;
40
56
  protected minFeePadding: number;
41
57
  protected cancellableTransactions: boolean;
42
- protected constructor(pxe: PXE, aztecNode: AztecNode);
58
+ private nodeInfoPromise;
59
+ protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
60
+ protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes?: AztecAddress[]): AztecAddress[];
61
+ /**
62
+ * Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
63
+ * account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx will fail
64
+ * the contract-side `Sender for tags is not set` assertion unless `set_sender_for_tags` is called first.
65
+ * @param from - Tx sender, or `NO_FROM`.
66
+ * @param sendMessagesAs - Explicit override.
67
+ */
68
+ protected senderForTagsFrom(from: AztecAddress | NoFrom, sendMessagesAs?: AztecAddress): AztecAddress | undefined;
43
69
  protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
44
70
  abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
45
71
  /**
@@ -51,48 +77,70 @@ export declare abstract class BaseWallet implements Wallet {
51
77
  */
52
78
  getAddressBook(): Promise<Aliased<AztecAddress>[]>;
53
79
  getChainInfo(): Promise<ChainInfo>;
54
- protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
80
+ protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
55
81
  createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
56
- batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
57
82
  /**
58
- * Completes partial user-provided fee options with wallet defaults.
59
- * @param from - The address where the transaction is being sent from
60
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
61
- * @param gasSettings - User-provided partial gas settings
62
- * @returns - Complete fee options that can be used to create a transaction execution request
83
+ * Request capabilities from the wallet.
84
+ *
85
+ * This method is wallet-implementation-dependent and must be provided by classes extending BaseWallet.
86
+ * Embedded wallets typically don't support capability-based authorization (no user authorization flow),
87
+ * while external wallets (browser extensions, hardware wallets) implement this to reduce authorization
88
+ * friction by allowing apps to request permissions upfront.
89
+ *
90
+ * TODO: Consider making it abstract so implementing it is a conscious decision. Leaving it as-is
91
+ * while the feature stabilizes.
92
+ *
93
+ * @param _manifest - Application capability manifest declaring what operations the app needs
63
94
  */
64
- protected completeFeeOptions(from: AztecAddress, feePayer?: AztecAddress, gasSettings?: Partial<FieldsOf<GasSettings>>): Promise<FeeOptions>;
95
+ requestCapabilities(_manifest: AppCapabilities): Promise<WalletCapabilities>;
96
+ batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
65
97
  /**
66
- * Completes partial user-provided fee options with unreasonably high gas limits
67
- * for gas estimation. Uses the same logic as completeFeeOptions but sets high limits
68
- * to avoid running out of gas during estimation.
69
- * @param from - The address where the transaction is being sent from
70
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
71
- * @param gasSettings - User-provided partial gas settings
98
+ * Completes partial user-provided fee options with wallet defaults.
99
+ * @param config - Fee completion config.
72
100
  */
73
- protected completeFeeOptionsForEstimation(from: AztecAddress, feePayer?: AztecAddress, gasSettings?: Partial<FieldsOf<GasSettings>>): Promise<{
74
- /**
75
- * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
76
- * doesn't already include one
77
- */
78
- walletFeePaymentMethod?: FeePaymentMethod | undefined;
79
- /** Configuration options for the account to properly handle the selected fee payment method */
80
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
81
- gasSettings: GasSettings;
82
- }>;
101
+ protected completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions>;
83
102
  registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
84
103
  registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
85
- simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
104
+ /**
105
+ * Simulates calls through the standard PXE path (account entrypoint).
106
+ * @param executionPayload - The execution payload to simulate.
107
+ * @param opts - Simulation options.
108
+ */
109
+ protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<TxSimulationResultWithAppOffset>;
110
+ /**
111
+ * Computes the index where the app's calls begin in the flattened array of calls (0 = entrypoint/root, 1..N = fee
112
+ * calls, N+1 = app).
113
+ * @param from - The sender address, or NO_FROM for the default entrypoint.
114
+ * @param feeOptions - Fee options containing the wallet fee payment method.
115
+ */
116
+ protected computeAppCallOffset(from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<number>;
117
+ /**
118
+ * Simulates a transaction, optimizing leading public static calls by running them directly
119
+ * on the node while sending the remaining calls through the standard PXE path.
120
+ * Return values from both paths are merged back in original call order.
121
+ * @param executionPayload - The execution payload to simulate.
122
+ * @param opts - Simulation options (from address, fee settings, etc.).
123
+ * @returns The merged simulation result.
124
+ */
125
+ simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset>;
86
126
  profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
87
127
  sendTx<W extends InteractionWaitOptions = undefined>(executionPayload: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
128
+ /**
129
+ * Resolves a contract address to a human-readable name via PXE, if available.
130
+ * @param address - The contract address to resolve.
131
+ */
132
+ protected getContractName(address: AztecAddress): Promise<string | undefined>;
88
133
  protected contextualizeError(err: Error, ...context: string[]): Error;
89
- simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
134
+ executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
90
135
  getPrivateEvents<T>(eventDef: EventMetadataDefinition, eventFilter: PrivateEventFilter): Promise<PrivateEvent<T>[]>;
136
+ /**
137
+ * Returns metadata about a contract, including whether it has been initialized, published, and updated.
138
+ * @param address - The contract address to query.
139
+ */
91
140
  getContractMetadata(address: AztecAddress): Promise<{
92
141
  instance: ContractInstanceWithAddress | undefined;
93
- isContractInitialized: boolean;
142
+ initializationStatus: ContractInitializationStatus;
94
143
  isContractPublished: boolean;
95
- isContractClassPubliclyRegistered: boolean;
96
144
  isContractUpdated: boolean;
97
145
  updatedContractClassId: Fr | undefined;
98
146
  }>;
@@ -101,4 +149,4 @@ export declare abstract class BaseWallet implements Wallet {
101
149
  isContractClassPubliclyRegistered: boolean;
102
150
  }>;
103
151
  }
104
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsZUFBZSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDakYsT0FBTyxFQUFFLEtBQUssc0JBQXNCLEVBQVcsS0FBSyxVQUFVLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNsRyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTVELE9BQU8sS0FBSyxFQUNWLE9BQU8sRUFDUCxZQUFZLEVBQ1osYUFBYSxFQUNiLFlBQVksRUFDWixrQkFBa0IsRUFDbEIsY0FBYyxFQUNkLFdBQVcsRUFDWCxlQUFlLEVBQ2YsTUFBTSxFQUNQLE1BQU0sd0JBQXdCLENBQUM7QUFPaEMsT0FBTyxFQUFFLDhCQUE4QixFQUF3QyxNQUFNLDRCQUE0QixDQUFDO0FBQ2xILE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQy9ELE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUVwRCxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN4RCxPQUFPLEtBQUssRUFBRSxHQ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OAAO,CAAC,MAAM,CAAC,CAMzG;IAED;;;;;;;OAOG;IACG,UAAU,CACd,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,+BAA+B,CAAC,CA+C1C;IAEK,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAalG;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,CAyCxB;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,16 +1,21 @@
1
- import { NO_WAIT } from '@aztec/aztec.js/contracts';
1
+ import { NO_FROM } from '@aztec/aztec.js/account';
2
+ 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 } 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,24 +79,45 @@ 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);
67
103
  const chainInfo = await this.getChainInfo();
68
104
  return account.createAuthWit(messageHashOrIntent, chainInfo);
69
105
  }
106
+ /**
107
+ * Request capabilities from the wallet.
108
+ *
109
+ * This method is wallet-implementation-dependent and must be provided by classes extending BaseWallet.
110
+ * Embedded wallets typically don't support capability-based authorization (no user authorization flow),
111
+ * while external wallets (browser extensions, hardware wallets) implement this to reduce authorization
112
+ * friction by allowing apps to request permissions upfront.
113
+ *
114
+ * TODO: Consider making it abstract so implementing it is a conscious decision. Leaving it as-is
115
+ * while the feature stabilizes.
116
+ *
117
+ * @param _manifest - Application capability manifest declaring what operations the app needs
118
+ */ requestCapabilities(_manifest) {
119
+ throw new Error('Not implemented');
120
+ }
70
121
  async batch(methods) {
71
122
  const results = [];
72
123
  for (const method of methods){
@@ -88,26 +139,33 @@ import { inspect } from 'util';
88
139
  }
89
140
  /**
90
141
  * Completes partial user-provided fee options with wallet defaults.
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
94
- * @returns - Complete fee options that can be used to create a transaction execution request
95
- */ async completeFeeOptions(from, feePayer, gasSettings) {
142
+ * @param config - Fee completion config.
143
+ */ async completeFeeOptions(config) {
144
+ const { from, feePayer, gasSettings, forEstimation } = config;
96
145
  const maxFeesPerGas = gasSettings?.maxFeesPerGas ?? (await this.aztecNode.getCurrentMinFees()).mul(1 + this.minFeePadding);
97
146
  let accountFeePaymentMethodOptions;
98
- // The transaction does not include a fee payment method, so we set the flag
99
- // for the account to use its fee juice balance
100
- if (!feePayer) {
101
- accountFeePaymentMethodOptions = AccountFeePaymentMethodOptions.PREEXISTING_FEE_JUICE;
102
- } else {
103
- // The transaction includes fee payment method, so we check if we are the fee payer for it
104
- // (this can only happen if the embedded payment method is FeeJuiceWithClaim)
105
- 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
+ }
106
159
  }
107
- const fullGasSettings = GasSettings.default({
108
- ...gasSettings,
109
- maxFeesPerGas
110
- });
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);
111
169
  this.log.debug(`Using L2 gas settings`, fullGasSettings);
112
170
  return {
113
171
  gasSettings: fullGasSettings,
@@ -115,24 +173,6 @@ import { inspect } from 'util';
115
173
  accountFeePaymentMethodOptions
116
174
  };
117
175
  }
118
- /**
119
- * Completes partial user-provided fee options with unreasonably high gas limits
120
- * for gas estimation. Uses the same logic as completeFeeOptions but sets high limits
121
- * to avoid running out of gas during estimation.
122
- * @param from - The address where the transaction is being sent from
123
- * @param feePayer - The address paying for fees (if any fee payment method is embedded in the execution payload)
124
- * @param gasSettings - User-provided partial gas settings
125
- */ async completeFeeOptionsForEstimation(from, feePayer, gasSettings) {
126
- const defaultFeeOptions = await this.completeFeeOptions(from, feePayer, gasSettings);
127
- const { gasSettings: { maxFeesPerGas, maxPriorityFeesPerGas } } = defaultFeeOptions;
128
- // Use unrealistically high gas limits for estimation to avoid running out of gas.
129
- // They will be tuned down after the simulation.
130
- 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);
131
- return {
132
- ...defaultFeeOptions,
133
- gasSettings: gasSettingsForEstimation
134
- };
135
- }
136
176
  registerSender(address, _alias = '') {
137
177
  return this.pxe.registerSender(address);
138
178
  }
@@ -168,20 +208,102 @@ import { inspect } from 'util';
168
208
  }
169
209
  return instance;
170
210
  }
171
- async simulateTx(executionPayload, opts) {
172
- 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);
173
- const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
174
- return this.pxe.simulateTx(txRequest, true, opts?.skipTxValidation, opts?.skipFeeEnforcement ?? true);
211
+ /**
212
+ * Simulates calls through the standard PXE path (account entrypoint).
213
+ * @param executionPayload - The execution payload to simulate.
214
+ * @param opts - Simulation options.
215
+ */ async simulateViaEntrypoint(executionPayload, opts) {
216
+ const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, opts.feeOptions);
217
+ const result = await this.pxe.simulateTx(txRequest, {
218
+ simulatePublic: true,
219
+ skipTxValidation: opts.skipTxValidation,
220
+ skipFeeEnforcement: opts.skipFeeEnforcement,
221
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
222
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
223
+ });
224
+ const appCallOffset = await this.computeAppCallOffset(opts.from, opts.feeOptions);
225
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
226
+ }
227
+ /**
228
+ * Computes the index where the app's calls begin in the flattened array of calls (0 = entrypoint/root, 1..N = fee
229
+ * calls, N+1 = app).
230
+ * @param from - The sender address, or NO_FROM for the default entrypoint.
231
+ * @param feeOptions - Fee options containing the wallet fee payment method.
232
+ */ async computeAppCallOffset(from, feeOptions) {
233
+ if (from === NO_FROM) {
234
+ return 0;
235
+ }
236
+ const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
237
+ return (feeExecutionPayload?.calls.length ?? 0) + 1; // +1 for entrypoint
238
+ }
239
+ /**
240
+ * Simulates a transaction, optimizing leading public static calls by running them directly
241
+ * on the node while sending the remaining calls through the standard PXE path.
242
+ * Return values from both paths are merged back in original call order.
243
+ * @param executionPayload - The execution payload to simulate.
244
+ * @param opts - Simulation options (from address, fee settings, etc.).
245
+ * @returns The merged simulation result.
246
+ */ async simulateTx(executionPayload, opts) {
247
+ const feeOptions = await this.completeFeeOptions({
248
+ from: opts.from,
249
+ feePayer: executionPayload.feePayer,
250
+ gasSettings: opts.fee?.gasSettings,
251
+ forEstimation: true
252
+ });
253
+ const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
254
+ const remainingPayload = {
255
+ ...executionPayload,
256
+ calls: remainingCalls
257
+ };
258
+ const chainInfo = await this.getChainInfo();
259
+ let blockHeader;
260
+ // PXE might not be synced yet, so we pull the latest header from the node
261
+ // To keep things consistent, we'll always try with PXE first
262
+ try {
263
+ blockHeader = await this.pxe.getSyncedBlockHeader();
264
+ } catch {
265
+ blockHeader = await this.aztecNode.getBlockHeader();
266
+ }
267
+ const simulationOrigin = opts.from === NO_FROM ? AztecAddress.ZERO : opts.from;
268
+ const [optimizedResults, normalResult] = await Promise.all([
269
+ optimizableCalls.length > 0 ? simulateViaNode(this.aztecNode, optimizableCalls, simulationOrigin, chainInfo, feeOptions.gasSettings, blockHeader, opts.skipFeeEnforcement ?? true, this.getContractName.bind(this)) : Promise.resolve([]),
270
+ remainingCalls.length > 0 ? this.simulateViaEntrypoint(remainingPayload, {
271
+ from: opts.from,
272
+ feeOptions,
273
+ additionalScopes: opts.additionalScopes,
274
+ skipTxValidation: opts.skipTxValidation,
275
+ skipFeeEnforcement: opts.skipFeeEnforcement ?? true,
276
+ sendMessagesAs: opts.sendMessagesAs
277
+ }) : Promise.resolve(null)
278
+ ]);
279
+ return buildMergedSimulationResult(optimizedResults, normalResult);
175
280
  }
176
281
  async profileTx(executionPayload, opts) {
177
- const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
282
+ const feeOptions = await this.completeFeeOptions({
283
+ from: opts.from,
284
+ feePayer: executionPayload.feePayer,
285
+ gasSettings: opts.fee?.gasSettings
286
+ });
178
287
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
179
- return this.pxe.profileTx(txRequest, opts.profileMode, opts.skipProofGeneration ?? true);
288
+ return this.pxe.profileTx(txRequest, {
289
+ profileMode: opts.profileMode,
290
+ skipProofGeneration: opts.skipProofGeneration ?? true,
291
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
292
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
293
+ });
180
294
  }
181
295
  async sendTx(executionPayload, opts) {
182
- const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
296
+ const feeOptions = await this.completeFeeOptions({
297
+ from: opts.from,
298
+ feePayer: executionPayload.feePayer,
299
+ gasSettings: opts.fee?.gasSettings
300
+ });
183
301
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, feeOptions);
184
- const provenTx = await this.pxe.proveTx(txRequest);
302
+ const provenTx = await this.pxe.proveTx(txRequest, {
303
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
304
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs)
305
+ });
306
+ const offchainOutput = extractOffchainOutput(provenTx.getOffchainEffects(), provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp);
185
307
  const tx = await provenTx.toTx();
186
308
  const txHash = tx.getTxHash();
187
309
  if (await this.aztecNode.getTxEffect(txHash)) {
@@ -194,11 +316,33 @@ import { inspect } from 'util';
194
316
  this.log.info(`Sent transaction ${txHash}`);
195
317
  // If wait is NO_WAIT, return txHash immediately
196
318
  if (opts.wait === NO_WAIT) {
197
- return txHash;
319
+ return {
320
+ txHash,
321
+ ...offchainOutput
322
+ };
198
323
  }
199
324
  // Otherwise, wait for the full receipt (default behavior on wait: undefined)
200
325
  const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
201
- return await waitForTx(this.aztecNode, txHash, waitOpts);
326
+ const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
327
+ // Display debug logs from public execution if present (served in test mode only)
328
+ if (receipt.debugLogs?.length) {
329
+ await displayDebugLogs(receipt.debugLogs, this.getContractName.bind(this));
330
+ }
331
+ return {
332
+ receipt,
333
+ ...offchainOutput
334
+ };
335
+ }
336
+ /**
337
+ * Resolves a contract address to a human-readable name via PXE, if available.
338
+ * @param address - The contract address to resolve.
339
+ */ async getContractName(address) {
340
+ const instance = await this.pxe.getContractInstance(address);
341
+ if (!instance) {
342
+ return undefined;
343
+ }
344
+ const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
345
+ return artifact?.name;
202
346
  }
203
347
  contextualizeError(err, ...context) {
204
348
  let contextStr = '';
@@ -213,8 +357,11 @@ import { inspect } from 'util';
213
357
  }
214
358
  return err;
215
359
  }
216
- simulateUtility(call, authwits) {
217
- return this.pxe.simulateUtility(call, authwits);
360
+ executeUtility(call, opts) {
361
+ return this.pxe.executeUtility(call, {
362
+ authwits: opts.authWitnesses,
363
+ scopes: opts.scopes
364
+ });
218
365
  }
219
366
  async getPrivateEvents(eventDef, eventFilter) {
220
367
  const pxeEvents = await this.pxe.getPrivateEvents(eventDef.eventSelector, eventFilter);
@@ -232,20 +379,34 @@ import { inspect } from 'util';
232
379
  });
233
380
  return decodedEvents;
234
381
  }
235
- async getContractMetadata(address) {
382
+ /**
383
+ * Returns metadata about a contract, including whether it has been initialized, published, and updated.
384
+ * @param address - The contract address to query.
385
+ */ async getContractMetadata(address) {
236
386
  const instance = await this.pxe.getContractInstance(address);
237
- const initNullifier = await siloNullifier(address, address.toField());
238
- const publiclyRegisteredContract = await this.aztecNode.getContract(address);
239
- const [initNullifierMembershipWitness, publiclyRegisteredContractClass] = await Promise.all([
240
- this.aztecNode.getNullifierMembershipWitness('latest', initNullifier),
241
- publiclyRegisteredContract ? this.aztecNode.getContractClass(publiclyRegisteredContract.currentContractClassId || instance?.currentContractClassId) : undefined
242
- ]);
387
+ const publiclyRegisteredContractPromise = this.aztecNode.getContract(address);
388
+ let initializationStatus;
389
+ if (instance) {
390
+ // We have the instance, so we can compute the private initialization nullifier (which includes init_hash and is
391
+ // emitted by both private and public initializers) and get a definitive INITIALIZED/UNINITIALIZED answer.
392
+ const initNullifier = await computeSiloedPrivateInitializationNullifier(address, instance.initializationHash);
393
+ const witness = await this.aztecNode.getNullifierMembershipWitness('latest', initNullifier);
394
+ initializationStatus = witness ? ContractInitializationStatus.INITIALIZED : ContractInitializationStatus.UNINITIALIZED;
395
+ } else {
396
+ // Without the instance we lack the init_hash needed for the private nullifier. We fall back to checking the
397
+ // public initialization nullifier (computed from address alone). Not all contracts emit it (only those with
398
+ // public functions that require initialization checks), so its absence doesn't mean the contract is
399
+ // uninitialized.
400
+ const publicNullifier = await computeSiloedPublicInitializationNullifier(address);
401
+ const witness = await this.aztecNode.getNullifierMembershipWitness('latest', publicNullifier);
402
+ initializationStatus = witness ? ContractInitializationStatus.INITIALIZED : ContractInitializationStatus.UNKNOWN;
403
+ }
404
+ const publiclyRegisteredContract = await publiclyRegisteredContractPromise;
243
405
  const isContractUpdated = publiclyRegisteredContract && !publiclyRegisteredContract.currentContractClassId.equals(publiclyRegisteredContract.originalContractClassId);
244
406
  return {
245
407
  instance: instance ?? undefined,
246
- isContractInitialized: !!initNullifierMembershipWitness,
408
+ initializationStatus,
247
409
  isContractPublished: !!publiclyRegisteredContract,
248
- isContractClassPubliclyRegistered: !!publiclyRegisteredContractClass,
249
410
  isContractUpdated: !!isContractUpdated,
250
411
  updatedContractClassId: isContractUpdated ? publiclyRegisteredContract.currentContractClassId : undefined
251
412
  };