@aztec/aztec.js 0.0.1-commit.1142ef1 → 0.0.1-commit.18ccd8f0

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 (156) 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/node.d.ts +8 -4
  25. package/dest/api/node.d.ts.map +1 -1
  26. package/dest/api/node.js +7 -3
  27. package/dest/api/protocol.d.ts +7 -1
  28. package/dest/api/protocol.d.ts.map +1 -1
  29. package/dest/api/protocol.js +6 -0
  30. package/dest/api/tx.d.ts +2 -2
  31. package/dest/api/tx.d.ts.map +1 -1
  32. package/dest/api/tx.js +1 -1
  33. package/dest/api/wallet.d.ts +2 -2
  34. package/dest/api/wallet.d.ts.map +1 -1
  35. package/dest/api/wallet.js +1 -1
  36. package/dest/authorization/call_authorization_request.d.ts +22 -1
  37. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  38. package/dest/contract/base_contract_interaction.d.ts +8 -10
  39. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  40. package/dest/contract/base_contract_interaction.js +5 -17
  41. package/dest/contract/contract_base.d.ts +4 -1
  42. package/dest/contract/contract_base.d.ts.map +1 -1
  43. package/dest/contract/contract_function_interaction.d.ts +1 -1
  44. package/dest/contract/deploy_method.d.ts +63 -16
  45. package/dest/contract/deploy_method.d.ts.map +1 -1
  46. package/dest/contract/deploy_method.js +41 -23
  47. package/dest/contract/interaction_options.d.ts +42 -5
  48. package/dest/contract/interaction_options.d.ts.map +1 -1
  49. package/dest/contract/interaction_options.js +8 -1
  50. package/dest/contract/protocol_contracts/auth-registry.d.ts +36 -0
  51. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  52. package/dest/contract/protocol_contracts/auth-registry.js +963 -0
  53. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +35 -0
  54. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  55. package/dest/contract/protocol_contracts/contract-class-registry.js +784 -0
  56. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +31 -0
  57. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  58. package/dest/contract/protocol_contracts/contract-instance-registry.js +866 -0
  59. package/dest/contract/protocol_contracts/fee-juice.d.ts +30 -0
  60. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  61. package/dest/contract/protocol_contracts/fee-juice.js +827 -0
  62. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  63. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  64. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +563 -0
  65. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  66. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  67. package/dest/contract/protocol_contracts/public-checks.js +579 -0
  68. package/dest/contract/wait_for_proven.d.ts +2 -2
  69. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  70. package/dest/contract/wait_for_proven.js +1 -1
  71. package/dest/contract/wait_opts.d.ts +16 -0
  72. package/dest/contract/wait_opts.d.ts.map +1 -0
  73. package/dest/contract/wait_opts.js +5 -0
  74. package/dest/deployment/broadcast_function.js +3 -3
  75. package/dest/deployment/publish_class.js +2 -2
  76. package/dest/deployment/publish_instance.d.ts +2 -2
  77. package/dest/deployment/publish_instance.d.ts.map +1 -1
  78. package/dest/deployment/publish_instance.js +3 -3
  79. package/dest/ethereum/portal_manager.d.ts +3 -1
  80. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  81. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  82. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  83. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  84. package/dest/utils/authwit.d.ts +8 -6
  85. package/dest/utils/authwit.d.ts.map +1 -1
  86. package/dest/utils/authwit.js +5 -9
  87. package/dest/utils/node.d.ts +12 -1
  88. package/dest/utils/node.d.ts.map +1 -1
  89. package/dest/utils/node.js +46 -0
  90. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +5 -8
  91. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  92. package/dest/wallet/account_entrypoint_meta_payment_method.js +28 -43
  93. package/dest/wallet/account_manager.d.ts +5 -8
  94. package/dest/wallet/account_manager.d.ts.map +1 -1
  95. package/dest/wallet/account_manager.js +5 -11
  96. package/dest/wallet/deploy_account_method.d.ts +34 -6
  97. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  98. package/dest/wallet/deploy_account_method.js +7 -5
  99. package/dest/wallet/wallet.d.ts +233 -2490
  100. package/dest/wallet/wallet.d.ts.map +1 -1
  101. package/dest/wallet/wallet.js +61 -87
  102. package/package.json +14 -12
  103. package/src/account/account.ts +34 -58
  104. package/src/account/account_contract.ts +6 -7
  105. package/src/account/account_with_secret_key.ts +33 -8
  106. package/src/account/index.ts +2 -1
  107. package/src/account/signerless_account.ts +13 -12
  108. package/src/api/account.ts +9 -3
  109. package/src/api/authorization.ts +1 -0
  110. package/src/api/contract.ts +22 -7
  111. package/src/api/node.ts +7 -3
  112. package/src/api/protocol.ts +7 -0
  113. package/src/api/tx.ts +2 -0
  114. package/src/api/wallet.ts +5 -2
  115. package/src/contract/base_contract_interaction.ts +27 -15
  116. package/src/contract/batch_call.ts +2 -2
  117. package/src/contract/deploy_method.ts +122 -29
  118. package/src/contract/interaction_options.ts +49 -4
  119. package/src/contract/protocol_contracts/auth-registry.ts +545 -0
  120. package/src/contract/protocol_contracts/contract-class-registry.ts +433 -0
  121. package/src/contract/protocol_contracts/contract-instance-registry.ts +495 -0
  122. package/src/contract/protocol_contracts/fee-juice.ts +457 -0
  123. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +329 -0
  124. package/src/contract/protocol_contracts/public-checks.ts +315 -0
  125. package/src/contract/wait_for_proven.ts +1 -1
  126. package/src/contract/wait_opts.ts +21 -0
  127. package/src/deployment/broadcast_function.ts +3 -3
  128. package/src/deployment/publish_class.ts +2 -2
  129. package/src/deployment/publish_instance.ts +3 -6
  130. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  131. package/src/utils/authwit.ts +19 -7
  132. package/src/utils/node.ts +62 -0
  133. package/src/wallet/account_entrypoint_meta_payment_method.ts +28 -60
  134. package/src/wallet/account_manager.ts +5 -13
  135. package/src/wallet/deploy_account_method.ts +37 -13
  136. package/src/wallet/wallet.ts +141 -93
  137. package/dest/account/interface.d.ts +0 -19
  138. package/dest/account/interface.d.ts.map +0 -1
  139. package/dest/account/interface.js +0 -5
  140. package/dest/contract/deploy_sent_tx.d.ts +0 -48
  141. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  142. package/dest/contract/deploy_sent_tx.js +0 -46
  143. package/dest/contract/protocol_contracts.d.ts +0 -9
  144. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  145. package/dest/contract/protocol_contracts.js +0 -26
  146. package/dest/contract/sent_tx.d.ts +0 -50
  147. package/dest/contract/sent_tx.d.ts.map +0 -1
  148. package/dest/contract/sent_tx.js +0 -90
  149. package/dest/contract/unsafe_contract.d.ts +0 -15
  150. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  151. package/dest/contract/unsafe_contract.js +0 -6
  152. package/src/account/interface.ts +0 -25
  153. package/src/contract/deploy_sent_tx.ts +0 -75
  154. package/src/contract/protocol_contracts.ts +0 -35
  155. package/src/contract/sent_tx.ts +0 -129
  156. package/src/contract/unsafe_contract.ts +0 -19
@@ -12,15 +12,10 @@ import {
12
12
  } from '@aztec/stdlib/abi';
13
13
  import { AuthWitness } from '@aztec/stdlib/auth-witness';
14
14
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
15
- import {
16
- type ContractClassMetadata,
17
- ContractClassWithIdSchema,
18
- type ContractInstanceWithAddress,
19
- ContractInstanceWithAddressSchema,
20
- type ContractMetadata,
21
- } from '@aztec/stdlib/contract';
15
+ import { type ContractInstanceWithAddress, ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
22
16
  import { Gas } from '@aztec/stdlib/gas';
23
17
  import { AbiDecodedSchema, type ApiSchemaFor, optional, schemas, zodFor } from '@aztec/stdlib/schemas';
18
+ import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
24
19
  import {
25
20
  Capsule,
26
21
  HashedValues,
@@ -31,16 +26,18 @@ import {
31
26
  UtilitySimulationResult,
32
27
  inTxSchema,
33
28
  } from '@aztec/stdlib/tx';
34
- import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
35
29
 
36
30
  import { z } from 'zod';
37
31
 
38
- import type {
39
- FeeEstimationOptions,
40
- GasSettingsOption,
41
- ProfileInteractionOptions,
42
- SendInteractionOptions,
43
- SimulateInteractionOptions,
32
+ import {
33
+ type FeeEstimationOptions,
34
+ type GasSettingsOption,
35
+ type InteractionWaitOptions,
36
+ NO_WAIT,
37
+ type ProfileInteractionOptions,
38
+ type SendInteractionOptionsWithoutWait,
39
+ type SendReturn,
40
+ type SimulateInteractionOptions,
44
41
  } from '../contract/interaction_options.js';
45
42
  import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
46
43
 
@@ -60,7 +57,7 @@ export type Aliased<T> = {
60
57
 
61
58
  /**
62
59
  * Options for simulating interactions with the wallet. Overrides the fee settings of an interaction with
63
- * a simplified version that only hints at the wallet wether the interaction contains a
60
+ * a simplified version that only hints at the wallet whether the interaction contains a
64
61
  * fee payment method or not
65
62
  */
66
63
  export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
@@ -70,7 +67,7 @@ export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
70
67
 
71
68
  /**
72
69
  * Options for profiling interactions with the wallet. Overrides the fee settings of an interaction with
73
- * a simplified version that only hints at the wallet wether the interaction contains a
70
+ * a simplified version that only hints at the wallet whether the interaction contains a
74
71
  * fee payment method or not
75
72
  */
76
73
  export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
@@ -80,45 +77,54 @@ export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
80
77
 
81
78
  /**
82
79
  * Options for sending/proving interactions with the wallet. Overrides the fee settings of an interaction with
83
- * a simplified version that only hints at the wallet wether the interaction contains a
80
+ * a simplified version that only hints at the wallet whether the interaction contains a
84
81
  * fee payment method or not
85
82
  */
86
- export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
83
+ export type SendOptions<W extends InteractionWaitOptions = undefined> = Omit<
84
+ SendInteractionOptionsWithoutWait,
85
+ 'fee'
86
+ > & {
87
87
  /** The fee options */
88
88
  fee?: GasSettingsOption;
89
+ /** Whether to wait for the transaction to be mined */
90
+ wait?: W;
89
91
  };
90
92
 
91
93
  /**
92
- * Helper type that represents all methods that can be batched.
94
+ * Helper type that represents all methods that can be batched (all methods except batch itself).
93
95
  */
94
- export type BatchableMethods = Pick<
95
- Wallet,
96
- 'registerContract' | 'sendTx' | 'registerSender' | 'simulateUtility' | 'simulateTx'
97
- >;
96
+ export type BatchableMethods = Omit<Wallet, 'batch'>;
98
97
 
99
98
  /**
100
- * From the batchable methods, we create a type that represents a method call with its name and arguments.
101
- * This is what the wallet will accept as arguments to the `batch` method.
99
+ * A method call with its name and arguments.
102
100
  */
103
- export type BatchedMethod<T extends keyof BatchableMethods> = {
101
+ type BatchedMethodInternal<T extends keyof BatchableMethods> = {
104
102
  /** The method name */
105
103
  name: T;
106
104
  /** The method arguments */
107
105
  args: Parameters<BatchableMethods[T]>;
108
106
  };
109
107
 
108
+ /**
109
+ * Union of all possible batched method calls.
110
+ * This ensures type safety: the `args` must match the specific `name`.
111
+ */
112
+ export type BatchedMethod = {
113
+ [K in keyof BatchableMethods]: BatchedMethodInternal<K>;
114
+ }[keyof BatchableMethods];
115
+
110
116
  /**
111
117
  * Helper type to extract the return type of a batched method
112
118
  */
113
119
  export type BatchedMethodResult<T> =
114
- T extends BatchedMethod<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
120
+ T extends BatchedMethodInternal<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
115
121
 
116
122
  /**
117
123
  * Wrapper type for batch results that includes the method name for discriminated union deserialization.
118
124
  * Each result is wrapped as \{ name: 'methodName', result: ActualResult \} to allow proper deserialization
119
125
  * when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).
120
126
  */
121
- export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMethods>> = {
127
+ export type BatchedMethodResultWrapper<T extends BatchedMethod> = {
122
128
  /** The method name */
123
129
  name: T['name'];
124
130
  /** The method result */
@@ -128,7 +134,7 @@ export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMe
128
134
  /**
129
135
  * Maps a tuple of BatchedMethod to a tuple of their wrapped return types
130
136
  */
131
- export type BatchResults<T extends readonly BatchedMethod<keyof BatchableMethods>[]> = {
137
+ export type BatchResults<T extends readonly BatchedMethod[]> = {
132
138
  [K in keyof T]: BatchedMethodResultWrapper<T[K]>;
133
139
  };
134
140
 
@@ -164,18 +170,43 @@ export type PrivateEvent<T> = {
164
170
  metadata: InTx;
165
171
  };
166
172
 
173
+ /**
174
+ * Contract metadata including deployment and registration status.
175
+ */
176
+ export type ContractMetadata = {
177
+ /** The contract instance */
178
+ instance?: ContractInstanceWithAddress;
179
+ /** Whether the contract has been initialized (init nullifier exists) */
180
+ isContractInitialized: boolean;
181
+ /** Whether the contract instance is publicly deployed on-chain */
182
+ isContractPublished: boolean;
183
+ /** Whether the contract has been updated to a different class */
184
+ isContractUpdated: boolean;
185
+ /** The updated contract class ID if the contract has been updated */
186
+ updatedContractClassId?: Fr | undefined;
187
+ };
188
+
189
+ /**
190
+ * Contract class metadata.
191
+ */
192
+ export type ContractClassMetadata = {
193
+ /** Whether the artifact is registered in the wallet */
194
+ isArtifactRegistered: boolean;
195
+ /** Whether the contract class is publicly registered on-chain */
196
+ isContractClassPubliclyRegistered: boolean;
197
+ };
198
+
167
199
  /**
168
200
  * The wallet interface.
169
201
  */
170
202
  export type Wallet = {
171
- getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
172
- getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
173
203
  getPrivateEvents<T>(
174
204
  eventMetadata: EventMetadataDefinition,
175
205
  eventFilter: PrivateEventFilter,
176
206
  ): Promise<PrivateEvent<T>[]>;
177
207
  getChainInfo(): Promise<ChainInfo>;
178
- getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
208
+ getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
209
+ getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
179
210
  registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
180
211
  getAddressBook(): Promise<Aliased<AztecAddress>[]>;
181
212
  getAccounts(): Promise<Aliased<AztecAddress>[]>;
@@ -187,9 +218,12 @@ export type Wallet = {
187
218
  simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
188
219
  simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
189
220
  profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
190
- sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
191
- createAuthWit(from: AztecAddress, messageHashOrIntent: Fr | IntentInnerHash | CallIntent): Promise<AuthWitness>;
192
- batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
221
+ sendTx<W extends InteractionWaitOptions = undefined>(
222
+ exec: ExecutionPayload,
223
+ opts: SendOptions<W>,
224
+ ): Promise<SendReturn<W>>;
225
+ createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
226
+ batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
193
227
  };
194
228
 
195
229
  export const FunctionCallSchema = z.object({
@@ -227,11 +261,19 @@ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
227
261
  estimateGas: optional(z.boolean()),
228
262
  });
229
263
 
264
+ export const WaitOptsSchema = z.object({
265
+ ignoreDroppedReceiptsFor: optional(z.number()),
266
+ timeout: optional(z.number()),
267
+ interval: optional(z.number()),
268
+ dontThrowOnRevert: optional(z.boolean()),
269
+ });
270
+
230
271
  export const SendOptionsSchema = z.object({
231
272
  from: schemas.AztecAddress,
232
273
  authWitnesses: optional(z.array(AuthWitness.schema)),
233
274
  capsules: optional(z.array(Capsule.schema)),
234
275
  fee: optional(GasSettingsOptionSchema),
276
+ wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
235
277
  });
236
278
 
237
279
  export const SimulateOptionsSchema = z.object({
@@ -250,7 +292,6 @@ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
250
292
  });
251
293
 
252
294
  export const MessageHashOrIntentSchema = z.union([
253
- schemas.Fr,
254
295
  z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
255
296
  z.object({
256
297
  caller: schemas.AztecAddress,
@@ -258,45 +299,6 @@ export const MessageHashOrIntentSchema = z.union([
258
299
  }),
259
300
  ]);
260
301
 
261
- export const BatchedMethodSchema = z.union([
262
- z.object({
263
- name: z.literal('registerSender'),
264
- args: z.tuple([schemas.AztecAddress, optional(z.string())]),
265
- }),
266
- z.object({
267
- name: z.literal('registerContract'),
268
- args: z.tuple([ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
269
- }),
270
- z.object({
271
- name: z.literal('sendTx'),
272
- args: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]),
273
- }),
274
- z.object({
275
- name: z.literal('simulateUtility'),
276
- args: z.tuple([FunctionCallSchema, optional(z.array(AuthWitness.schema))]),
277
- }),
278
- z.object({
279
- name: z.literal('simulateTx'),
280
- args: z.tuple([ExecutionPayloadSchema, SimulateOptionsSchema]),
281
- }),
282
- ]);
283
-
284
- export const ContractMetadataSchema = zodFor<ContractMetadata>()(
285
- z.object({
286
- contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
287
- isContractInitialized: z.boolean(),
288
- isContractPublished: z.boolean(),
289
- }),
290
- );
291
-
292
- export const ContractClassMetadataSchema = zodFor<ContractClassMetadata>()(
293
- z.object({
294
- contractClass: z.union([ContractClassWithIdSchema, z.undefined()]),
295
- isContractClassPubliclyRegistered: z.boolean(),
296
- artifact: z.union([ContractArtifactSchema, z.undefined()]),
297
- }),
298
- );
299
-
300
302
  export const EventMetadataDefinitionSchema = z.object({
301
303
  eventSelector: schemas.EventSelector,
302
304
  abiType: AbiTypeSchema,
@@ -318,14 +320,30 @@ export const PrivateEventFilterSchema = z.object({
318
320
  toBlock: optional(BlockNumberPositiveSchema),
319
321
  });
320
322
 
321
- export const WalletSchema: ApiSchemaFor<Wallet> = {
323
+ export const ContractMetadataSchema = z.object({
324
+ instance: optional(ContractInstanceWithAddressSchema),
325
+ isContractInitialized: z.boolean(),
326
+ isContractPublished: z.boolean(),
327
+ isContractUpdated: z.boolean(),
328
+ updatedContractClassId: optional(schemas.Fr),
329
+ });
330
+
331
+ export const ContractClassMetadataSchema = z.object({
332
+ isArtifactRegistered: z.boolean(),
333
+ isContractClassPubliclyRegistered: z.boolean(),
334
+ });
335
+
336
+ /**
337
+ * Record of all wallet method schemas (excluding batch).
338
+ * This is the single source of truth for method schemas - batch schemas are derived from this.
339
+ */
340
+ const WalletMethodSchemas = {
322
341
  getChainInfo: z
323
342
  .function()
324
343
  .args()
325
344
  .returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
326
- getContractClassMetadata: z.function().args(schemas.Fr, optional(z.boolean())).returns(ContractClassMetadataSchema),
327
345
  getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
328
- getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
346
+ getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
329
347
  getPrivateEvents: z
330
348
  .function()
331
349
  .args(EventMetadataDefinitionSchema, PrivateEventFilterSchema)
@@ -349,21 +367,51 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
349
367
  .args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
350
368
  .returns(UtilitySimulationResult.schema),
351
369
  profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
352
- sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
370
+ sendTx: z
371
+ .function()
372
+ .args(ExecutionPayloadSchema, SendOptionsSchema)
373
+ .returns(z.union([TxHash.schema, TxReceipt.schema])),
353
374
  createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
375
+ };
376
+
377
+ /**
378
+ * Creates batch schemas from the individual wallet methods.
379
+ * This allows us to define them once and derive batch schemas automatically,
380
+ * reducing duplication and ensuring consistency.
381
+ */
382
+ function createBatchSchemas<T extends Record<string, z.ZodFunction<z.ZodTuple<any, any>, z.ZodTypeAny>>>(
383
+ methodSchemas: T,
384
+ ) {
385
+ const names = Object.keys(methodSchemas) as (keyof T)[];
386
+
387
+ const namesAndArgs = names.map(name =>
388
+ z.object({
389
+ name: z.literal(name),
390
+ args: methodSchemas[name].parameters(),
391
+ }),
392
+ );
393
+
394
+ const namesAndReturns = names.map(name =>
395
+ z.object({
396
+ name: z.literal(name),
397
+ result: methodSchemas[name].returnType(),
398
+ }),
399
+ );
400
+
401
+ // Type assertion needed because discriminatedUnion expects a tuple type [T, T, ...T[]]
402
+ // but we're building the array dynamically. The runtime behavior is correct.
403
+ return {
404
+ input: z.discriminatedUnion('name', namesAndArgs as [(typeof namesAndArgs)[0], ...typeof namesAndArgs]),
405
+ output: z.discriminatedUnion('name', namesAndReturns as [(typeof namesAndReturns)[0], ...typeof namesAndReturns]),
406
+ };
407
+ }
408
+
409
+ const { input: BatchedMethodSchema, output: BatchedResultSchema } = createBatchSchemas(WalletMethodSchemas);
410
+
411
+ export { BatchedMethodSchema, BatchedResultSchema };
412
+
413
+ export const WalletSchema: ApiSchemaFor<Wallet> = {
414
+ ...WalletMethodSchemas,
354
415
  // @ts-expect-error - ApiSchemaFor cannot properly type generic methods with readonly arrays
355
- batch: z
356
- .function()
357
- .args(z.array(BatchedMethodSchema))
358
- .returns(
359
- z.array(
360
- z.discriminatedUnion('name', [
361
- z.object({ name: z.literal('registerSender'), result: schemas.AztecAddress }),
362
- z.object({ name: z.literal('registerContract'), result: ContractInstanceWithAddressSchema }),
363
- z.object({ name: z.literal('sendTx'), result: TxHash.schema }),
364
- z.object({ name: z.literal('simulateUtility'), result: UtilitySimulationResult.schema }),
365
- z.object({ name: z.literal('simulateTx'), result: TxSimulationResult.schema }),
366
- ]),
367
- ),
368
- ),
416
+ batch: z.function().args(z.array(BatchedMethodSchema)).returns(z.array(BatchedResultSchema)),
369
417
  };
@@ -1,19 +0,0 @@
1
- import type { AuthWitnessProvider, EntrypointInterface } from '@aztec/entrypoints/interfaces';
2
- import type { Fr } from '@aztec/foundation/curves/bn254';
3
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import type { CompleteAddress } from '@aztec/stdlib/contract';
5
- /**
6
- * Handler for interfacing with an account. Knows how to create transaction execution
7
- * requests and authorize actions for its corresponding account.
8
- */
9
- export interface AccountInterface extends EntrypointInterface, AuthWitnessProvider {
10
- /** Returns the complete address for this account. */
11
- getCompleteAddress(): CompleteAddress;
12
- /** Returns the address for this account. */
13
- getAddress(): AztecAddress;
14
- /** Returns the chain id for this account */
15
- getChainId(): Fr;
16
- /** Returns the rollup version for this account */
17
- getVersion(): Fr;
18
- }
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWNjb3VudC9pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUM5RixPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUk5RDs7O0dBR0c7QUFDSCxNQUFNLFdBQVcsZ0JBQWlCLFNBQVEsbUJBQW1CLEVBQUUsbUJBQW1CO0lBQ2hGLHFEQUFxRDtJQUNyRCxrQkFBa0IsSUFBSSxlQUFlLENBQUM7SUFFdEMsNENBQTRDO0lBQzVDLFVBQVUsSUFBSSxZQUFZLENBQUM7SUFFM0IsNENBQTRDO0lBQzVDLFVBQVUsSUFBSSxFQUFFLENBQUM7SUFFakIsa0RBQWtEO0lBQ2xELFVBQVUsSUFBSSxFQUFFLENBQUM7Q0FDbEIifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/account/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB,EAAE,mBAAmB;IAChF,qDAAqD;IACrD,kBAAkB,IAAI,eAAe,CAAC;IAEtC,4CAA4C;IAC5C,UAAU,IAAI,YAAY,CAAC;IAE3B,4CAA4C;IAC5C,UAAU,IAAI,EAAE,CAAC;IAEjB,kDAAkD;IAClD,UAAU,IAAI,EAAE,CAAC;CAClB"}
@@ -1,5 +0,0 @@
1
- // docs:start:account-interface
2
- /**
3
- * Handler for interfacing with an account. Knows how to create transaction execution
4
- * requests and authorize actions for its corresponding account.
5
- */ export { }; // docs:end:account-interface
@@ -1,48 +0,0 @@
1
- import type { FieldsOf } from '@aztec/foundation/types';
2
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
- import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
4
- import type { Wallet } from '../wallet/wallet.js';
5
- import type { ContractBase } from './contract_base.js';
6
- import { SentTx, type WaitOpts } from './sent_tx.js';
7
- /** Options related to waiting for a deployment tx. */
8
- export type DeployedWaitOpts = WaitOpts & {
9
- /** Wallet to use for creating a contract instance. Uses the one set in the deployer constructor if not set. */
10
- wallet?: Wallet;
11
- };
12
- /** Extends a transaction receipt with a contract instance that represents the newly deployed contract. */
13
- export type DeployTxReceipt<TContract extends ContractBase = ContractBase> = FieldsOf<TxReceipt> & {
14
- /** Instance of the newly deployed contract. */
15
- contract: TContract;
16
- /** The deployed contract instance with address and metadata. */
17
- instance: ContractInstanceWithAddress;
18
- };
19
- /**
20
- * A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
21
- */
22
- export declare class DeploySentTx<TContract extends ContractBase = ContractBase> extends SentTx {
23
- private postDeployCtor;
24
- /** A getter for the deployed contract instance */
25
- private instanceGetter;
26
- private log;
27
- constructor(wallet: Wallet, sendTx: () => Promise<TxHash>, postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
28
- /** A getter for the deployed contract instance */
29
- instanceGetter: () => Promise<ContractInstanceWithAddress>);
30
- /**
31
- * Returns the contract instance for this deployment.
32
- * @returns The deployed contract instance with address and metadata.
33
- */
34
- getInstance(): Promise<ContractInstanceWithAddress>;
35
- /**
36
- * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
37
- * @param opts - Options for configuring the waiting for the tx to be mined.
38
- * @returns The deployed contract instance.
39
- */
40
- deployed(opts?: DeployedWaitOpts): Promise<TContract>;
41
- /**
42
- * Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
43
- * @param opts - Options for configuring the waiting for the tx to be mined.
44
- * @returns The transaction receipt with the deployed contract instance.
45
- */
46
- wait(opts?: DeployedWaitOpts): Promise<DeployTxReceipt<TContract>>;
47
- }
48
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X3NlbnRfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdC9kZXBsb3lfc2VudF90eC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN4RCxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRS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,EAAE,2BAA2B,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY,CAAC,SAAS,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,MAAM;IAMnF,OAAO,CAAC,cAAc;IACtB,kDAAkD;IAClD,OAAO,CAAC,cAAc;IAPxB,OAAO,CAAC,GAAG,CAA0C;IAErD,YACE,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACrB,cAAc,EAAE,CAAC,QAAQ,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,KAAK,SAAS;IAC5F,kDAAkD;IAC1C,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,EAGnE;IAED;;;OAGG;IACU,WAAW,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAE/D;IAED;;;;OAIG;IACU,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAIjE;IAED;;;;OAIG;IACmB,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAUvF;CACF"}
@@ -1,46 +0,0 @@
1
- import { createLogger } from '@aztec/foundation/log';
2
- import { SentTx } from './sent_tx.js';
3
- /**
4
- * A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
5
- */ export class DeploySentTx extends SentTx {
6
- postDeployCtor;
7
- instanceGetter;
8
- log;
9
- constructor(wallet, sendTx, postDeployCtor, /** A getter for the deployed contract instance */ instanceGetter){
10
- super(wallet, sendTx), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter, this.log = createLogger('aztecjs:deploy_sent_tx');
11
- }
12
- /**
13
- * Returns the contract instance for this deployment.
14
- * @returns The deployed contract instance with address and metadata.
15
- */ async getInstance() {
16
- return await this.instanceGetter();
17
- }
18
- /**
19
- * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
20
- * @param opts - Options for configuring the waiting for the tx to be mined.
21
- * @returns The deployed contract instance.
22
- */ async deployed(opts) {
23
- const receipt = await this.wait(opts);
24
- this.log.info(`Contract ${receipt.instance.address.toString()} successfully deployed.`);
25
- return receipt.contract;
26
- }
27
- /**
28
- * Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
29
- * @param opts - Options for configuring the waiting for the tx to be mined.
30
- * @returns The transaction receipt with the deployed contract instance.
31
- */ async wait(opts) {
32
- const receipt = await super.wait(opts);
33
- // In the case of DeploySentTx we have a guarantee that this.walletOrNode is a Wallet so we can cast it to Wallet.
34
- const contractWallet = opts?.wallet ?? this.walletOrNode;
35
- if (!contractWallet) {
36
- throw new Error(`A wallet is required for creating a contract instance`);
37
- }
38
- const instance = await this.instanceGetter();
39
- const contract = this.postDeployCtor(instance, contractWallet);
40
- return {
41
- ...receipt,
42
- contract,
43
- instance
44
- };
45
- }
46
- }
@@ -1,9 +0,0 @@
1
- import type { Wallet } from '../wallet/wallet.js';
2
- import { UnsafeContract } from './unsafe_contract.js';
3
- /** Returns a Contract wrapper for the contract class registry. */
4
- export declare function getClassRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
5
- /** Returns a Contract wrapper for the contract instance registry. */
6
- export declare function getInstanceRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
7
- /** Returns a Contract wrapper for the fee juice contract */
8
- export declare function getFeeJuice(wallet: Wallet): Promise<UnsafeContract>;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdG9jb2xfY29udHJhY3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3QvcHJvdG9jb2xfY29udHJhY3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ2xELE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV0RCxrRUFBa0U7QUFDbEUsd0JBQXNCLHdCQUF3QixDQUFDLE1BQU0sRUFBRSxNQUFNLDJCQVE1RDtBQUVELHFFQUFxRTtBQUNyRSx3QkFBc0IsMkJBQTJCLENBQUMsTUFBTSxFQUFFLE1BQU0sMkJBTy9EO0FBRUQsNERBQTREO0FBQzVELHdCQUFzQixXQUFXLENBQUMsTUFBTSxFQUFFLE1BQU0sMkJBTy9DIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/protocol_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,kEAAkE;AAClE,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,2BAQ5D;AAED,qEAAqE;AACrE,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,MAAM,2BAO/D;AAED,4DAA4D;AAC5D,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,2BAO/C"}
@@ -1,26 +0,0 @@
1
- import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
- import { UnsafeContract } from './unsafe_contract.js';
3
- /** Returns a Contract wrapper for the contract class registry. */ export async function getClassRegistryContract(wallet) {
4
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegistry);
5
- if (!contractInstance) {
6
- throw new Error("ContractClassRegistry is not registered in this wallet's instance");
7
- }
8
- const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
9
- return new UnsafeContract(contractInstance, artifact, wallet);
10
- }
11
- /** Returns a Contract wrapper for the contract instance registry. */ export async function getInstanceRegistryContract(wallet) {
12
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceRegistry);
13
- if (!contractInstance) {
14
- throw new Error("ContractInstanceRegistry is not registered in this wallet's instance");
15
- }
16
- const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
17
- return new UnsafeContract(contractInstance, artifact, wallet);
18
- }
19
- /** Returns a Contract wrapper for the fee juice contract */ export async function getFeeJuice(wallet) {
20
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.FeeJuice);
21
- if (!contractInstance) {
22
- throw new Error("FeeJuice is not registered in this wallet's instance");
23
- }
24
- const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
25
- return new UnsafeContract(contractInstance, artifact, wallet);
26
- }
@@ -1,50 +0,0 @@
1
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
2
- import { TxHash, type TxReceipt } from '@aztec/stdlib/tx';
3
- import type { Wallet } from '../wallet/wallet.js';
4
- /** Options related to waiting for a tx. */
5
- export type WaitOpts = {
6
- /** The amount of time to ignore TxStatus.DROPPED receipts (in seconds) due to the presumption that it is being propagated by the p2p network. Defaults to 5. */
7
- ignoreDroppedReceiptsFor?: number;
8
- /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
9
- timeout?: number;
10
- /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
11
- interval?: number;
12
- /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
13
- dontThrowOnRevert?: boolean;
14
- };
15
- export declare const DefaultWaitOpts: WaitOpts;
16
- /**
17
- * The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch
18
- * its hash, receipt, and mining status.
19
- */
20
- export declare class SentTx {
21
- protected walletOrNode: Wallet | AztecNode;
22
- protected sendTxPromise: Promise<void>;
23
- protected sendTxError?: Error;
24
- protected txHash?: TxHash;
25
- constructor(walletOrNode: Wallet | AztecNode, sendTx: () => Promise<TxHash>);
26
- /**
27
- * Retrieves the transaction hash of the SentTx instance.
28
- * The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.
29
- *
30
- * @returns A promise that resolves to the transaction hash of the SentTx instance.
31
- * TODO(#7717): Don't throw here.
32
- */
33
- getTxHash(): Promise<TxHash>;
34
- /**
35
- * Retrieve the transaction receipt associated with the current SentTx instance.
36
- * The function fetches the transaction hash using 'getTxHash' and then queries
37
- * the PXE to get the corresponding transaction receipt.
38
- *
39
- * @returns A promise that resolves to a TxReceipt object representing the fetched transaction receipt.
40
- */
41
- getReceipt(): Promise<TxReceipt>;
42
- /**
43
- * Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.
44
- * @param opts - Options for configuring the waiting for the tx to be mined.
45
- * @returns The transaction receipt.
46
- */
47
- wait(opts?: WaitOpts): Promise<TxReceipt>;
48
- protected waitForReceipt(opts?: WaitOpts): Promise<TxReceipt>;
49
- }
50
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VudF90eC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0L3NlbnRfdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLE1BQU0sRUFBRSxLQUFLLFNBQVMsRUFBWSxNQUFNLGtCQUFrQixDQUFDO0FBRXBFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRWxELDJDQUEyQztBQUMzQyxNQUFNLE1BQU0sUUFBUSxHQUFHO0lBQ3JCLGdLQUFnSztJQUNoSyx3QkFBd0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNsQyw2RkFBNkY7SUFDN0YsT0FBTyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2pCLHNHQUFzRztJQUN0RyxRQUFRLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDbEIsMEhBQTBIO0lBQzFILGlCQUFpQixDQU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