@aztec/aztec.js 0.0.1-commit.96bb3f7 → 0.0.1-commit.a072138

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 (167) hide show
  1. package/dest/account/account.d.ts +25 -40
  2. package/dest/account/account.d.ts.map +1 -1
  3. package/dest/account/account.js +19 -47
  4. package/dest/account/account_contract.d.ts +8 -9
  5. package/dest/account/account_contract.d.ts.map +1 -1
  6. package/dest/account/account_with_secret_key.d.ts +19 -7
  7. package/dest/account/account_with_secret_key.d.ts.map +1 -1
  8. package/dest/account/account_with_secret_key.js +21 -4
  9. package/dest/account/index.d.ts +3 -2
  10. package/dest/account/index.d.ts.map +1 -1
  11. package/dest/account/index.js +2 -0
  12. package/dest/account/signerless_account.d.ts +5 -6
  13. package/dest/account/signerless_account.d.ts.map +1 -1
  14. package/dest/account/signerless_account.js +8 -11
  15. package/dest/api/account.d.ts +2 -4
  16. package/dest/api/account.d.ts.map +1 -1
  17. package/dest/api/account.js +1 -3
  18. package/dest/api/authorization.d.ts +2 -2
  19. package/dest/api/authorization.d.ts.map +1 -1
  20. package/dest/api/authorization.js +1 -1
  21. package/dest/api/contract.d.ts +16 -10
  22. package/dest/api/contract.d.ts.map +1 -1
  23. package/dest/api/contract.js +14 -8
  24. package/dest/api/keys.d.ts +1 -1
  25. package/dest/api/keys.js +1 -1
  26. package/dest/api/node.d.ts +8 -4
  27. package/dest/api/node.d.ts.map +1 -1
  28. package/dest/api/node.js +7 -3
  29. package/dest/api/protocol.d.ts +7 -1
  30. package/dest/api/protocol.d.ts.map +1 -1
  31. package/dest/api/protocol.js +6 -0
  32. package/dest/api/tx.d.ts +2 -2
  33. package/dest/api/tx.d.ts.map +1 -1
  34. package/dest/api/tx.js +1 -1
  35. package/dest/api/wallet.d.ts +3 -2
  36. package/dest/api/wallet.d.ts.map +1 -1
  37. package/dest/api/wallet.js +2 -1
  38. package/dest/authorization/call_authorization_request.d.ts +22 -1
  39. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  40. package/dest/contract/base_contract_interaction.d.ts +8 -10
  41. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  42. package/dest/contract/base_contract_interaction.js +5 -17
  43. package/dest/contract/contract_base.d.ts +4 -1
  44. package/dest/contract/contract_base.d.ts.map +1 -1
  45. package/dest/contract/contract_function_interaction.d.ts +1 -1
  46. package/dest/contract/deploy_method.d.ts +63 -16
  47. package/dest/contract/deploy_method.d.ts.map +1 -1
  48. package/dest/contract/deploy_method.js +41 -23
  49. package/dest/contract/interaction_options.d.ts +42 -5
  50. package/dest/contract/interaction_options.d.ts.map +1 -1
  51. package/dest/contract/interaction_options.js +8 -1
  52. package/dest/contract/protocol_contracts/auth-registry.d.ts +27 -0
  53. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  54. package/dest/contract/protocol_contracts/auth-registry.js +558 -0
  55. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +26 -0
  56. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  57. package/dest/contract/protocol_contracts/contract-class-registry.js +385 -0
  58. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +22 -0
  59. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  60. package/dest/contract/protocol_contracts/contract-instance-registry.js +465 -0
  61. package/dest/contract/protocol_contracts/fee-juice.d.ts +21 -0
  62. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  63. package/dest/contract/protocol_contracts/fee-juice.js +426 -0
  64. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  65. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  66. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +575 -0
  67. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  68. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  69. package/dest/contract/protocol_contracts/public-checks.js +583 -0
  70. package/dest/contract/wait_for_proven.d.ts +2 -2
  71. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  72. package/dest/contract/wait_for_proven.js +1 -1
  73. package/dest/contract/wait_opts.d.ts +16 -0
  74. package/dest/contract/wait_opts.d.ts.map +1 -0
  75. package/dest/contract/wait_opts.js +5 -0
  76. package/dest/deployment/broadcast_function.js +3 -3
  77. package/dest/deployment/publish_class.js +2 -2
  78. package/dest/deployment/publish_instance.d.ts +2 -2
  79. package/dest/deployment/publish_instance.d.ts.map +1 -1
  80. package/dest/deployment/publish_instance.js +3 -3
  81. package/dest/ethereum/portal_manager.d.ts +3 -1
  82. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  83. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  84. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  85. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  86. package/dest/utils/authwit.d.ts +8 -6
  87. package/dest/utils/authwit.d.ts.map +1 -1
  88. package/dest/utils/authwit.js +5 -9
  89. package/dest/utils/node.d.ts +12 -1
  90. package/dest/utils/node.d.ts.map +1 -1
  91. package/dest/utils/node.js +46 -0
  92. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +5 -8
  93. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  94. package/dest/wallet/account_entrypoint_meta_payment_method.js +28 -43
  95. package/dest/wallet/account_manager.d.ts +5 -8
  96. package/dest/wallet/account_manager.d.ts.map +1 -1
  97. package/dest/wallet/account_manager.js +5 -11
  98. package/dest/wallet/capabilities.d.ts +444 -0
  99. package/dest/wallet/capabilities.d.ts.map +1 -0
  100. package/dest/wallet/capabilities.js +3 -0
  101. package/dest/wallet/deploy_account_method.d.ts +34 -6
  102. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  103. package/dest/wallet/deploy_account_method.js +7 -5
  104. package/dest/wallet/index.d.ts +2 -1
  105. package/dest/wallet/index.d.ts.map +1 -1
  106. package/dest/wallet/index.js +1 -0
  107. package/dest/wallet/wallet.d.ts +1460 -2424
  108. package/dest/wallet/wallet.d.ts.map +1 -1
  109. package/dest/wallet/wallet.js +179 -86
  110. package/package.json +14 -12
  111. package/src/account/account.ts +34 -58
  112. package/src/account/account_contract.ts +6 -7
  113. package/src/account/account_with_secret_key.ts +33 -8
  114. package/src/account/index.ts +2 -1
  115. package/src/account/signerless_account.ts +13 -12
  116. package/src/api/account.ts +9 -3
  117. package/src/api/authorization.ts +1 -0
  118. package/src/api/contract.ts +22 -7
  119. package/src/api/keys.ts +2 -2
  120. package/src/api/node.ts +7 -3
  121. package/src/api/protocol.ts +7 -0
  122. package/src/api/tx.ts +2 -0
  123. package/src/api/wallet.ts +43 -2
  124. package/src/contract/base_contract_interaction.ts +27 -15
  125. package/src/contract/batch_call.ts +2 -2
  126. package/src/contract/deploy_method.ts +122 -29
  127. package/src/contract/interaction_options.ts +49 -4
  128. package/src/contract/protocol_contracts/auth-registry.ts +351 -0
  129. package/src/contract/protocol_contracts/contract-class-registry.ts +241 -0
  130. package/src/contract/protocol_contracts/contract-instance-registry.ts +302 -0
  131. package/src/contract/protocol_contracts/fee-juice.ts +264 -0
  132. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +332 -0
  133. package/src/contract/protocol_contracts/public-checks.ts +316 -0
  134. package/src/contract/wait_for_proven.ts +1 -1
  135. package/src/contract/wait_opts.ts +21 -0
  136. package/src/deployment/broadcast_function.ts +3 -3
  137. package/src/deployment/publish_class.ts +2 -2
  138. package/src/deployment/publish_instance.ts +3 -6
  139. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  140. package/src/utils/authwit.ts +19 -7
  141. package/src/utils/node.ts +62 -0
  142. package/src/wallet/account_entrypoint_meta_payment_method.ts +28 -60
  143. package/src/wallet/account_manager.ts +5 -13
  144. package/src/wallet/capabilities.ts +491 -0
  145. package/src/wallet/deploy_account_method.ts +37 -13
  146. package/src/wallet/index.ts +1 -0
  147. package/src/wallet/wallet.ts +257 -93
  148. package/dest/account/interface.d.ts +0 -19
  149. package/dest/account/interface.d.ts.map +0 -1
  150. package/dest/account/interface.js +0 -5
  151. package/dest/contract/deploy_sent_tx.d.ts +0 -48
  152. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  153. package/dest/contract/deploy_sent_tx.js +0 -46
  154. package/dest/contract/protocol_contracts.d.ts +0 -9
  155. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  156. package/dest/contract/protocol_contracts.js +0 -26
  157. package/dest/contract/sent_tx.d.ts +0 -50
  158. package/dest/contract/sent_tx.d.ts.map +0 -1
  159. package/dest/contract/sent_tx.js +0 -90
  160. package/dest/contract/unsafe_contract.d.ts +0 -15
  161. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  162. package/dest/contract/unsafe_contract.js +0 -6
  163. package/src/account/interface.ts +0 -25
  164. package/src/contract/deploy_sent_tx.ts +0 -75
  165. package/src/contract/protocol_contracts.ts +0 -35
  166. package/src/contract/sent_tx.ts +0 -129
  167. package/src/contract/unsafe_contract.ts +0 -19
@@ -0,0 +1,491 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+
4
+ import type { Aliased } from './wallet.js';
5
+
6
+ /**
7
+ * Current capability manifest version.
8
+ */
9
+ export const CAPABILITY_VERSION = '1.0' as const;
10
+
11
+ /**
12
+ * Pattern for matching contract functions with wildcards.
13
+ *
14
+ * Used in simulation and transaction capabilities to specify which
15
+ * contract functions are allowed.
16
+ *
17
+ * @example
18
+ * // Allow any function on a specific contract
19
+ * \{ contract: ammAddress, function: '*' \}
20
+ *
21
+ * @example
22
+ * // Allow only 'swap' function on a specific contract
23
+ * \{ contract: ammAddress, function: 'swap' \}
24
+ *
25
+ * @example
26
+ * // Allow 'transfer' on any contract
27
+ * \{ contract: '*', function: 'transfer' \}
28
+ */
29
+ export interface ContractFunctionPattern {
30
+ /** Contract address or '*' for any contract */
31
+ contract: AztecAddress | '*';
32
+
33
+ /** Function name or '*' for any function */
34
+ function: string;
35
+ }
36
+
37
+ /**
38
+ * Account access capability - grants access to user accounts.
39
+ *
40
+ * Maps to wallet methods:
41
+ * - getAccounts (when canGet: true)
42
+ * - createAuthWit (when canCreateAuthWit: true)
43
+ *
44
+ * The wallet decides which accounts to reveal to the app.
45
+ * Apps don't specify which accounts they want - they just request
46
+ * the capability and the wallet shows them the available accounts.
47
+ */
48
+ export interface AccountsCapability {
49
+ /** Discriminator for capability type */
50
+ type: 'accounts';
51
+
52
+ /** Can get accounts from wallet. Maps to: getAccounts */
53
+ canGet?: boolean;
54
+
55
+ /** Can create auth witnesses for accounts. Maps to: createAuthWit */
56
+ canCreateAuthWit?: boolean;
57
+ }
58
+
59
+ /**
60
+ * Granted account access capability.
61
+ *
62
+ * Extends the request with specific accounts that were granted by the wallet.
63
+ */
64
+ export interface GrantedAccountsCapability extends AccountsCapability {
65
+ /** Specific accounts granted by the wallet with their aliases. The wallet adds this when granting the capability. */
66
+ accounts: Aliased<AztecAddress>[];
67
+ }
68
+
69
+ /**
70
+ * Contract interaction capability - for registering and querying contracts.
71
+ *
72
+ * Maps to wallet methods:
73
+ * - registerContract (when canRegister: true)
74
+ * - getContractMetadata (when canGetMetadata: true)
75
+ *
76
+ * Matching is done by contract address, not class ID. This allows updating
77
+ * existing contracts with new artifacts (e.g., when contract is upgraded
78
+ * to a new contractClassId on-chain).
79
+ *
80
+ * Note: For querying contract class metadata, use ContractClassesCapability instead.
81
+ *
82
+ * @example
83
+ * // Register and query specific contracts
84
+ * \{
85
+ * type: 'contracts',
86
+ * contracts: [ammAddress, tokenAddress],
87
+ * canRegister: true,
88
+ * canGetMetadata: true
89
+ * \}
90
+ *
91
+ * @example
92
+ * // Query any contract (read-only)
93
+ * \{
94
+ * type: 'contracts',
95
+ * contracts: '*',
96
+ * canGetMetadata: true
97
+ * \}
98
+ */
99
+ export interface ContractsCapability {
100
+ /** Discriminator for capability type */
101
+ type: 'contracts';
102
+
103
+ /**
104
+ * Which contracts this applies to:
105
+ * - '*': Any contract address
106
+ * - AztecAddress[]: Specific contract addresses
107
+ */
108
+ contracts: '*' | AztecAddress[];
109
+
110
+ /**
111
+ * Can register contracts and update existing registrations.
112
+ * Maps to: registerContract
113
+ *
114
+ * When true, allows:
115
+ * - Registering new contract instances at specified addresses
116
+ * - Re-registering existing contracts with updated artifacts (e.g., after upgrade)
117
+ */
118
+ canRegister?: boolean;
119
+
120
+ /** Can query contract metadata. Maps to: getContractMetadata */
121
+ canGetMetadata?: boolean;
122
+ }
123
+
124
+ /**
125
+ * Granted contract interaction capability.
126
+ *
127
+ * The wallet may reduce the scope (e.g., from '*' to specific addresses).
128
+ */
129
+ export interface GrantedContractsCapability extends ContractsCapability {}
130
+
131
+ /**
132
+ * Contract class capability - for querying contract class metadata.
133
+ *
134
+ * Maps to wallet methods:
135
+ * - getContractClassMetadata
136
+ *
137
+ * Contract classes are identified by their class ID (Fr), not by contract address.
138
+ * Multiple contract instances can share the same class. This capability grants
139
+ * permission to query metadata for specific contract classes.
140
+ *
141
+ * Apps typically acquire this permission automatically when registering a contract
142
+ * with an artifact (the wallet auto-grants permission for that contract's class ID).
143
+ *
144
+ * @example
145
+ * // Query specific contract classes
146
+ * \{
147
+ * type: 'contractClasses',
148
+ * classes: [classId1, classId2],
149
+ * canGetMetadata: true
150
+ * \}
151
+ *
152
+ * @example
153
+ * // Query any contract class (wildcard)
154
+ * \{
155
+ * type: 'contractClasses',
156
+ * classes: '*',
157
+ * canGetMetadata: true
158
+ * \}
159
+ */
160
+ export interface ContractClassesCapability {
161
+ /** Discriminator for capability type */
162
+ type: 'contractClasses';
163
+
164
+ /**
165
+ * Which contract classes this applies to:
166
+ * - '*': Any contract class ID
167
+ * - Fr[]: Specific contract class IDs
168
+ */
169
+ classes: '*' | Fr[];
170
+
171
+ /** Can query contract class metadata. Maps to: getContractClassMetadata */
172
+ canGetMetadata: boolean;
173
+ }
174
+
175
+ /**
176
+ * Granted contract class capability.
177
+ *
178
+ * The wallet may reduce the scope (e.g., from '*' to specific class IDs).
179
+ */
180
+ export interface GrantedContractClassesCapability extends ContractClassesCapability {}
181
+
182
+ /**
183
+ * Transaction simulation capability - for simulating transactions and utilities.
184
+ *
185
+ * Maps to wallet methods:
186
+ * - simulateTx (when transactions scope specified)
187
+ * - simulateUtility (when utilities scope specified)
188
+ * - profileTx (when transactions scope specified)
189
+ *
190
+ * @example
191
+ * // Simulate any transaction on specific contracts
192
+ * \{
193
+ * type: 'simulation',
194
+ * transactions: \{
195
+ * scope: [
196
+ * \{ contract: ammAddress, function: '*' \},
197
+ * \{ contract: tokenAddress, function: 'transfer' \}
198
+ * ]
199
+ * \}
200
+ * \}
201
+ *
202
+ * @example
203
+ * // Simulate any transaction and utility call
204
+ * \{
205
+ * type: 'simulation',
206
+ * transactions: \{ scope: '*' \},
207
+ * utilities: \{ scope: '*' \}
208
+ * \}
209
+ */
210
+ export interface SimulationCapability {
211
+ /** Discriminator for capability type */
212
+ type: 'simulation';
213
+
214
+ /** Transaction simulation scope. Maps to: simulateTx, profileTx */
215
+ transactions?: {
216
+ /**
217
+ * Which contracts/functions to allow:
218
+ * - '*': Any transaction
219
+ * - ContractFunctionPattern[]: Specific contract functions
220
+ */
221
+ scope: '*' | ContractFunctionPattern[];
222
+ };
223
+
224
+ /** Utility simulation scope (unconstrained calls). Maps to: simulateUtility */
225
+ utilities?: {
226
+ /**
227
+ * Which contracts/functions to allow:
228
+ * - '*': Any utility call
229
+ * - ContractFunctionPattern[]: Specific contract functions
230
+ */
231
+ scope: '*' | ContractFunctionPattern[];
232
+ };
233
+ }
234
+
235
+ /**
236
+ * Granted transaction simulation capability.
237
+ *
238
+ * The wallet may reduce the scope (e.g., from '*' to specific patterns).
239
+ */
240
+ export interface GrantedSimulationCapability extends SimulationCapability {}
241
+
242
+ /**
243
+ * Transaction execution capability - for sending transactions.
244
+ *
245
+ * Maps to wallet methods:
246
+ * - sendTx
247
+ *
248
+ * Policy enforcement (rate limits, spending limits) should be handled
249
+ * at the contract level in Aztec, not at the wallet level.
250
+ *
251
+ * @example
252
+ * // Send specific transactions with approval
253
+ * \{
254
+ * type: 'transaction',
255
+ * scope: [
256
+ * \{ contract: ammAddress, function: 'swap' \},
257
+ * \{ contract: ammAddress, function: 'addLiquidity' \}
258
+ * ]
259
+ * \}
260
+ *
261
+ * @example
262
+ * // Send any transaction
263
+ * \{
264
+ * type: 'transaction',
265
+ * scope: '*'
266
+ * \}
267
+ */
268
+ export interface TransactionCapability {
269
+ /** Discriminator for capability type */
270
+ type: 'transaction';
271
+
272
+ /**
273
+ * Which contracts/functions to allow:
274
+ * - '*': Any transaction
275
+ * - ContractFunctionPattern[]: Specific patterns
276
+ */
277
+ scope: '*' | ContractFunctionPattern[];
278
+ }
279
+
280
+ /**
281
+ * Granted transaction execution capability.
282
+ *
283
+ * The wallet may reduce the scope (e.g., from '*' to specific patterns).
284
+ */
285
+ export interface GrantedTransactionCapability extends TransactionCapability {}
286
+
287
+ /**
288
+ * Data access capability - for querying private data.
289
+ *
290
+ * Maps to wallet methods:
291
+ * - getAddressBook (when addressBook: true)
292
+ * - getPrivateEvents (when privateEvents specified)
293
+ *
294
+ * @example
295
+ * // Access address book and events from specific contract
296
+ * \{
297
+ * type: 'data',
298
+ * addressBook: true,
299
+ * privateEvents: \{
300
+ * contracts: [ammAddress],
301
+ * events: ['Swap', 'LiquidityAdded']
302
+ * \}
303
+ * \}
304
+ *
305
+ * @example
306
+ * // Access all events from any contract
307
+ * \{
308
+ * type: 'data',
309
+ * privateEvents: \{
310
+ * contracts: '*',
311
+ * events: '*'
312
+ * \}
313
+ * \}
314
+ */
315
+ export interface DataCapability {
316
+ /** Discriminator for capability type */
317
+ type: 'data';
318
+
319
+ /** Access to address book. Maps to: getAddressBook */
320
+ addressBook?: boolean;
321
+
322
+ /** Access to private events. Maps to: getPrivateEvents */
323
+ privateEvents?: {
324
+ /**
325
+ * Which contracts to allow event queries from:
326
+ * - '*': Any contract
327
+ * - AztecAddress[]: Specific contracts
328
+ */
329
+ contracts: '*' | AztecAddress[];
330
+ };
331
+ }
332
+
333
+ /**
334
+ * Granted data access capability.
335
+ *
336
+ * The wallet may reduce the scope (e.g., from '*' to specific contracts).
337
+ */
338
+ export interface GrantedDataCapability extends DataCapability {}
339
+
340
+ /**
341
+ * Union type of all capability scopes (app request).
342
+ *
343
+ * Capabilities group wallet operations by their security sensitivity
344
+ * and functional cohesion, making permission requests understandable
345
+ * to users.
346
+ */
347
+ export type Capability =
348
+ | AccountsCapability
349
+ | ContractsCapability
350
+ | ContractClassesCapability
351
+ | SimulationCapability
352
+ | TransactionCapability
353
+ | DataCapability;
354
+
355
+ /**
356
+ * Union type of all granted capabilities (wallet response).
357
+ *
358
+ * The wallet may augment capabilities with additional information:
359
+ * - AccountsCapability: adds specific accounts granted
360
+ * - Other capabilities: may reduce scope (e.g., '*' to specific addresses)
361
+ */
362
+ export type GrantedCapability =
363
+ | GrantedAccountsCapability
364
+ | GrantedContractsCapability
365
+ | GrantedContractClassesCapability
366
+ | GrantedSimulationCapability
367
+ | GrantedTransactionCapability
368
+ | GrantedDataCapability;
369
+
370
+ /**
371
+ * Application capability manifest.
372
+ *
373
+ * Sent by dApp to declare all operations it needs. This reduces authorization
374
+ * friction from multiple dialogs to a single comprehensive permission request.
375
+ *
376
+ * @example
377
+ * // DEX application manifest
378
+ * const manifest: AppCapabilities = \{
379
+ * version: CAPABILITY_VERSION,
380
+ * metadata: \{
381
+ * name: 'MyDEX',
382
+ * version: '1.0.0',
383
+ * description: 'Decentralized exchange for private token swaps',
384
+ * url: 'https://example.com',
385
+ * icon: 'https://example.com/icon.png'
386
+ * \},
387
+ * capabilities: [
388
+ * \{
389
+ * type: 'accounts',
390
+ * canGet: true,
391
+ * canCreateAuthWit: true
392
+ * \},
393
+ * \{
394
+ * type: 'contracts',
395
+ * contracts: [ammAddress, tokenAAddress, tokenBAddress],
396
+ * canRegister: true,
397
+ * canGetMetadata: true
398
+ * \},
399
+ * \{
400
+ * type: 'simulation',
401
+ * transactions: \{
402
+ * scope: [\{ contract: ammAddress, function: '*' \}]
403
+ * \}
404
+ * \},
405
+ * \{
406
+ * type: 'transaction',
407
+ * scope: [\{ contract: ammAddress, function: 'swap' \}]
408
+ * \}
409
+ * ]
410
+ * \};
411
+ */
412
+ export interface AppCapabilities {
413
+ /**
414
+ * Manifest version for forward compatibility.
415
+ * Currently only '1.0' is supported.
416
+ */
417
+ version: typeof CAPABILITY_VERSION;
418
+
419
+ /** Application metadata for display in authorization dialogs. */
420
+ metadata: {
421
+ /** Human-readable app name */
422
+ name: string;
423
+
424
+ /** App version */
425
+ version: string;
426
+
427
+ /** Optional description of what the app does */
428
+ description?: string;
429
+
430
+ /** Optional website URL */
431
+ url?: string;
432
+
433
+ /** Optional icon URL or data URI */
434
+ icon?: string;
435
+ };
436
+
437
+ /**
438
+ * Requested capabilities grouped by scope.
439
+ */
440
+ capabilities: Capability[];
441
+ }
442
+
443
+ /**
444
+ * Wallet capability response.
445
+ *
446
+ * Returned by wallet after user reviews and approves/denies the capability request.
447
+ *
448
+ * The wallet can modify requested capabilities:
449
+ * - Reduce scope (e.g., restrict to specific contracts instead of '*')
450
+ * - Add information (e.g., specify which accounts are granted)
451
+ * - Deny capabilities (by omitting them from the `granted` array)
452
+ *
453
+ * @example
454
+ * // App requests
455
+ * const manifest: AppCapabilities = \{
456
+ * version: '1.0',
457
+ * metadata: \{ name: 'MyDApp', version: '1.0.0' \},
458
+ * capabilities: [
459
+ * \{ type: 'accounts', canGet: true \},
460
+ * \{ type: 'contracts', contracts: '*', canRegister: true \}
461
+ * ]
462
+ * \};
463
+ *
464
+ * // Wallet responds with specific accounts and restricted contracts
465
+ * const response = await wallet.requestCapabilities(manifest);
466
+ * console.log(response.granted);
467
+ * // [
468
+ * // \{ type: 'accounts', canGet: true, accounts: [addr1, addr2] \},
469
+ * // \{ type: 'contracts', contracts: [specificContract], canRegister: true \}
470
+ * // ]
471
+ */
472
+ export interface WalletCapabilities {
473
+ /** Response version for forward compatibility. */
474
+ version: typeof CAPABILITY_VERSION;
475
+
476
+ /**
477
+ * Capabilities granted by the wallet.
478
+ * Capabilities not in this array were implicitly denied.
479
+ * Empty array means the user denied all capabilities.
480
+ */
481
+ granted: GrantedCapability[];
482
+
483
+ /** Wallet implementation details. */
484
+ wallet: {
485
+ /** Wallet name/implementation */
486
+ name: string;
487
+
488
+ /** Wallet version */
489
+ version: string;
490
+ };
491
+ }
@@ -5,30 +5,58 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
5
5
  import type { PublicKeys } from '@aztec/stdlib/keys';
6
6
  import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
7
7
 
8
+ import type { Account } from '../account/account.js';
8
9
  import type { Contract } from '../contract/contract.js';
9
10
  import type { ContractBase } from '../contract/contract_base.js';
10
11
  import {
11
12
  DeployMethod,
12
- type DeployOptions,
13
+ type DeployOptionsWithoutWait,
13
14
  type RequestDeployOptions,
14
15
  type SimulateDeployOptions,
15
16
  } from '../contract/deploy_method.js';
17
+ import type { FeePaymentMethodOption, InteractionWaitOptions } from '../contract/interaction_options.js';
16
18
  import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
17
19
  import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
18
20
  import type { Wallet } from './index.js';
19
21
 
22
+ /**
23
+ * Extended fee payment method option for account deployments that includes entrypoint wrapping options
24
+ */
25
+ export type DeployAccountFeePaymentMethodOption = FeePaymentMethodOption & {
26
+ /** Optional entrypoint-specific options for wrapping execution payloads */
27
+ feeEntrypointOptions?: unknown;
28
+ };
29
+
20
30
  /**
21
31
  * The configuration options for the request method. Omits the contractAddressSalt, since
22
32
  * for account contracts that is fixed in the constructor
23
33
  */
24
- export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt'>;
34
+ export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt' | 'fee'> & {
35
+ /** Fee options specific to account deployment */
36
+ fee?: DeployAccountFeePaymentMethodOption;
37
+ };
38
+
39
+ /**
40
+ * Base configuration options for the send/prove methods without wait parameter. Omits:
41
+ * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
42
+ * - UniversalDeployment flag, since account contracts are always deployed with it set to true
43
+ */
44
+ export type DeployAccountOptionsWithoutWait = Omit<DeployOptionsWithoutWait, 'contractAddressSalt' | 'universalDeploy'>;
25
45
 
26
46
  /**
27
47
  * The configuration options for the send/prove methods. Omits:
28
48
  * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
29
49
  * - UniversalDeployment flag, since account contracts are always deployed with it set to true
30
50
  */
31
- export type DeployAccountOptions = Omit<DeployOptions, 'contractAddressSalt' | 'universalDeploy'>;
51
+ export type DeployAccountOptions<W extends InteractionWaitOptions = undefined> = DeployAccountOptionsWithoutWait & {
52
+ /**
53
+ * Whether to wait for the transaction to be mined.
54
+ * - undefined (default): wait with default options and return TxReceipt
55
+ * - WaitOpts object: wait with custom options and return TxReceipt
56
+ * - false: return txHash immediately without waiting
57
+ */
58
+ wait?: W;
59
+ };
32
60
 
33
61
  /**
34
62
  * The configuration options for the simulate method. Omits the contractAddressSalt, since
@@ -47,6 +75,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
47
75
  artifact: ContractArtifact,
48
76
  postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
49
77
  private salt: Fr,
78
+ private account: Account,
50
79
  args: any[] = [],
51
80
  constructorNameOrArtifact?: string | FunctionArtifact,
52
81
  ) {
@@ -61,19 +90,14 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
61
90
  * For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
62
91
  *
63
92
  * @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
93
+ * @param feeEntrypointOptions - Optional entrypoint-specific options for wrapping. If not provided, will be auto-computed based on the payment method.
64
94
  * @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
65
95
  */
66
- private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod) {
96
+ private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod, feeEntrypointOptions?: any) {
67
97
  if (!this.address) {
68
98
  throw new Error('Instance is not yet constructed. This is a bug!');
69
99
  }
70
- return new AccountEntrypointMetaPaymentMethod(
71
- this.wallet,
72
- this.artifact,
73
- 'entrypoint',
74
- this.address,
75
- originalPaymentMethod,
76
- );
100
+ return new AccountEntrypointMetaPaymentMethod(this.account, originalPaymentMethod, feeEntrypointOptions);
77
101
  }
78
102
 
79
103
  /**
@@ -97,7 +121,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
97
121
  const executionPayloads = [deploymentExecutionPayload];
98
122
  // If this is a self-deployment, manage the fee accordingly
99
123
  if (opts?.deployer?.equals(AztecAddress.ZERO)) {
100
- const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod);
124
+ const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod, opts?.fee?.feeEntrypointOptions);
101
125
  const feeExecutionPayload = await feePaymentMethod.getExecutionPayload();
102
126
  // Notice they are reversed (fee payment usually goes first):
103
127
  // this is because we need to construct the contract BEFORE it can pay for its own fee
@@ -113,7 +137,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
113
137
  return mergeExecutionPayloads(executionPayloads);
114
138
  }
115
139
 
116
- override convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
140
+ override convertDeployOptionsToRequestOptions(options: DeployAccountOptionsWithoutWait): RequestDeployOptions {
117
141
  return {
118
142
  ...options,
119
143
  // Deployer is handled in the request method and forcibly set to undefined,
@@ -1,2 +1,3 @@
1
1
  export * from './wallet.js';
2
2
  export * from './account_manager.js';
3
+ export * from './capabilities.js';