@aztec/aztec.js 0.0.1-commit.d431d1c → 0.0.1-commit.db765a8
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.
- package/dest/api/abi.d.ts +2 -2
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/block.d.ts +2 -2
- package/dest/api/block.d.ts.map +1 -1
- package/dest/api/block.js +1 -1
- package/dest/api/contract.d.ts +18 -12
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +16 -10
- package/dest/api/deployment.d.ts +1 -2
- package/dest/api/deployment.d.ts.map +1 -1
- package/dest/api/deployment.js +0 -1
- package/dest/api/events.d.ts +10 -6
- package/dest/api/events.d.ts.map +1 -1
- package/dest/api/events.js +30 -20
- package/dest/api/fields.d.ts +2 -1
- package/dest/api/fields.d.ts.map +1 -1
- package/dest/api/fields.js +1 -0
- package/dest/api/keys.d.ts +1 -1
- package/dest/api/keys.js +1 -1
- package/dest/api/node.d.ts +8 -4
- package/dest/api/node.d.ts.map +1 -1
- package/dest/api/node.js +7 -3
- package/dest/api/tx.d.ts +2 -2
- package/dest/api/tx.d.ts.map +1 -1
- package/dest/api/tx.js +1 -1
- package/dest/api/wallet.d.ts +3 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +2 -1
- package/dest/contract/base_contract_interaction.d.ts +8 -10
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +5 -17
- package/dest/contract/batch_call.d.ts +3 -3
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +17 -8
- package/dest/contract/contract_function_interaction.d.ts +7 -16
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +107 -18
- package/dest/contract/deploy_method.d.ts +91 -19
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +68 -30
- package/dest/contract/get_gas_limits.js +3 -3
- package/dest/contract/interaction_options.d.ts +99 -21
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +41 -1
- package/dest/contract/protocol_contracts/auth-registry.d.ts +3 -3
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/auth-registry.js +49 -20
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +2 -22
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.js +13 -671
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +2 -11
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-instance-registry.js +80 -486
- package/dest/contract/protocol_contracts/fee-juice.d.ts +1 -10
- package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/fee-juice.js +7 -413
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +3 -3
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/multi-call-entrypoint.js +40 -15
- package/dest/contract/protocol_contracts/public-checks.d.ts +3 -3
- package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/public-checks.js +40 -23
- package/dest/contract/wait_for_proven.js +1 -1
- package/dest/contract/wait_opts.d.ts +16 -0
- package/dest/contract/wait_opts.d.ts.map +1 -0
- package/dest/contract/wait_opts.js +5 -0
- package/dest/fee/fee_juice_payment_method_with_claim.js +6 -6
- package/dest/fee/private_fee_payment_method.js +10 -10
- package/dest/fee/public_fee_payment_method.js +10 -10
- package/dest/fee/sponsored_fee_payment.js +3 -3
- package/dest/utils/abi_types.d.ts +6 -1
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/abi_types.js +1 -1
- package/dest/utils/authwit.d.ts +6 -6
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +12 -12
- package/dest/utils/node.d.ts +12 -1
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +46 -0
- package/dest/wallet/capabilities.d.ts +452 -0
- package/dest/wallet/capabilities.d.ts.map +1 -0
- package/dest/wallet/capabilities.js +3 -0
- package/dest/wallet/deploy_account_method.d.ts +31 -6
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.js +26 -0
- package/dest/wallet/index.d.ts +2 -1
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +1 -0
- package/dest/wallet/wallet.d.ts +1639 -93
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +186 -27
- package/package.json +20 -11
- package/src/api/abi.ts +1 -0
- package/src/api/block.ts +1 -1
- package/src/api/contract.ts +31 -9
- package/src/api/deployment.ts +0 -1
- package/src/api/events.ts +35 -27
- package/src/api/fields.ts +1 -0
- package/src/api/keys.ts +2 -2
- package/src/api/node.ts +7 -3
- package/src/api/tx.ts +2 -0
- package/src/api/wallet.ts +48 -1
- package/src/contract/base_contract_interaction.ts +28 -15
- package/src/contract/batch_call.ts +17 -14
- package/src/contract/contract_function_interaction.ts +114 -26
- package/src/contract/deploy_method.ts +172 -35
- package/src/contract/get_gas_limits.ts +3 -3
- package/src/contract/interaction_options.ts +141 -23
- package/src/contract/protocol_contracts/auth-registry.ts +13 -14
- package/src/contract/protocol_contracts/contract-class-registry.ts +4 -347
- package/src/contract/protocol_contracts/contract-instance-registry.ts +34 -234
- package/src/contract/protocol_contracts/fee-juice.ts +2 -202
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +11 -13
- package/src/contract/protocol_contracts/public-checks.ts +11 -15
- package/src/contract/wait_for_proven.ts +1 -1
- package/src/contract/wait_opts.ts +21 -0
- package/src/fee/fee_juice_payment_method_with_claim.ts +5 -5
- package/src/fee/private_fee_payment_method.ts +7 -7
- package/src/fee/public_fee_payment_method.ts +8 -8
- package/src/fee/sponsored_fee_payment.ts +3 -3
- package/src/utils/abi_types.ts +7 -0
- package/src/utils/authwit.ts +31 -21
- package/src/utils/node.ts +62 -0
- package/src/wallet/capabilities.ts +500 -0
- package/src/wallet/deploy_account_method.ts +56 -4
- package/src/wallet/index.ts +1 -0
- package/src/wallet/wallet.ts +257 -50
- package/dest/contract/deploy_sent_tx.d.ts +0 -48
- package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
- package/dest/contract/deploy_sent_tx.js +0 -46
- package/dest/contract/sent_tx.d.ts +0 -50
- package/dest/contract/sent_tx.d.ts.map +0 -1
- package/dest/contract/sent_tx.js +0 -90
- package/dest/deployment/broadcast_function.d.ts +0 -24
- package/dest/deployment/broadcast_function.d.ts.map +0 -1
- package/dest/deployment/broadcast_function.js +0 -74
- package/src/contract/deploy_sent_tx.ts +0 -75
- package/src/contract/sent_tx.ts +0 -129
- package/src/deployment/broadcast_function.ts +0 -148
package/src/wallet/wallet.ts
CHANGED
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
type ContractArtifact,
|
|
8
8
|
ContractArtifactSchema,
|
|
9
9
|
type EventMetadataDefinition,
|
|
10
|
-
|
|
11
|
-
FunctionType,
|
|
10
|
+
FunctionCall,
|
|
12
11
|
} from '@aztec/stdlib/abi';
|
|
13
12
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
14
13
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
14
|
import { type ContractInstanceWithAddress, ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
|
|
16
15
|
import { Gas } from '@aztec/stdlib/gas';
|
|
17
16
|
import { AbiDecodedSchema, type ApiSchemaFor, optional, schemas, zodFor } from '@aztec/stdlib/schemas';
|
|
17
|
+
import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
|
|
18
18
|
import {
|
|
19
19
|
Capsule,
|
|
20
20
|
HashedValues,
|
|
@@ -22,21 +22,24 @@ import {
|
|
|
22
22
|
TxProfileResult,
|
|
23
23
|
TxReceipt,
|
|
24
24
|
TxSimulationResult,
|
|
25
|
-
|
|
25
|
+
UtilityExecutionResult,
|
|
26
26
|
inTxSchema,
|
|
27
27
|
} from '@aztec/stdlib/tx';
|
|
28
|
-
import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
|
|
29
28
|
|
|
30
29
|
import { z } from 'zod';
|
|
31
30
|
|
|
32
|
-
import
|
|
33
|
-
FeeEstimationOptions,
|
|
34
|
-
GasSettingsOption,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
import {
|
|
32
|
+
type FeeEstimationOptions,
|
|
33
|
+
type GasSettingsOption,
|
|
34
|
+
type InteractionWaitOptions,
|
|
35
|
+
NO_WAIT,
|
|
36
|
+
type ProfileInteractionOptions,
|
|
37
|
+
type SendInteractionOptionsWithoutWait,
|
|
38
|
+
type SendReturn,
|
|
39
|
+
type SimulateInteractionOptions,
|
|
38
40
|
} from '../contract/interaction_options.js';
|
|
39
41
|
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
42
|
+
import type { AppCapabilities, WalletCapabilities } from './capabilities.js';
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
45
|
* A wrapper type that allows any item to be associated with an alias.
|
|
@@ -77,9 +80,14 @@ export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
|
|
|
77
80
|
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
78
81
|
* fee payment method or not
|
|
79
82
|
*/
|
|
80
|
-
export type SendOptions =
|
|
83
|
+
export type SendOptions<W extends InteractionWaitOptions = undefined> = Omit<
|
|
84
|
+
SendInteractionOptionsWithoutWait,
|
|
85
|
+
'fee'
|
|
86
|
+
> & {
|
|
81
87
|
/** The fee options */
|
|
82
88
|
fee?: GasSettingsOption;
|
|
89
|
+
/** Whether to wait for the transaction to be mined */
|
|
90
|
+
wait?: W;
|
|
83
91
|
};
|
|
84
92
|
|
|
85
93
|
/**
|
|
@@ -131,37 +139,66 @@ export type BatchResults<T extends readonly BatchedMethod[]> = {
|
|
|
131
139
|
};
|
|
132
140
|
|
|
133
141
|
/**
|
|
134
|
-
*
|
|
142
|
+
* Base filter options for event queries.
|
|
135
143
|
*/
|
|
136
|
-
export type
|
|
137
|
-
/** The address of the contract that emitted the events. */
|
|
138
|
-
contractAddress: AztecAddress;
|
|
139
|
-
/** Addresses of accounts that are in scope for this filter. */
|
|
140
|
-
scopes: AztecAddress[];
|
|
144
|
+
export type EventFilterBase = {
|
|
141
145
|
/** Transaction in which the events were emitted. */
|
|
142
146
|
txHash?: TxHash;
|
|
143
147
|
/** The block number from which to start fetching events (inclusive).
|
|
144
148
|
* Optional. If provided, it must be greater or equal than 1.
|
|
145
149
|
* Defaults to the initial L2 block number (INITIAL_L2_BLOCK_NUM).
|
|
146
|
-
|
|
150
|
+
*/
|
|
147
151
|
fromBlock?: BlockNumber;
|
|
148
152
|
/** The block number until which to fetch logs (not inclusive).
|
|
149
153
|
* Optional. If provided, it must be greater than fromBlock.
|
|
150
|
-
* Defaults to the latest known block to PXE + 1.
|
|
151
154
|
*/
|
|
152
155
|
toBlock?: BlockNumber;
|
|
153
156
|
};
|
|
154
157
|
|
|
155
158
|
/**
|
|
156
|
-
*
|
|
159
|
+
* Filter options when querying private events.
|
|
157
160
|
*/
|
|
158
|
-
export type
|
|
161
|
+
export type PrivateEventFilter = EventFilterBase & {
|
|
162
|
+
/** The address of the contract that emitted the events. */
|
|
163
|
+
contractAddress: AztecAddress;
|
|
164
|
+
/** Addresses of accounts that are in scope for this filter. */
|
|
165
|
+
scopes: AztecAddress[];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Filter options when querying public events.
|
|
170
|
+
*/
|
|
171
|
+
export type PublicEventFilter = EventFilterBase & {
|
|
172
|
+
/** The address of the contract that emitted the events. */
|
|
173
|
+
contractAddress?: AztecAddress;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* An ABI decoded event with associated metadata.
|
|
178
|
+
* @typeParam T - The decoded event type
|
|
179
|
+
* @typeParam M - Additional metadata fields (empty by default)
|
|
180
|
+
*/
|
|
181
|
+
export type Event<T, M extends object = object> = {
|
|
159
182
|
/** The ABI decoded event */
|
|
160
183
|
event: T;
|
|
161
184
|
/** Metadata describing event context information such as tx and block */
|
|
162
|
-
metadata: InTx;
|
|
185
|
+
metadata: InTx & M;
|
|
163
186
|
};
|
|
164
187
|
|
|
188
|
+
/** An ABI decoded private event with associated metadata. */
|
|
189
|
+
export type PrivateEvent<T> = Event<T>;
|
|
190
|
+
|
|
191
|
+
/** An ABI decoded public event with associated metadata (includes contract address). */
|
|
192
|
+
export type PublicEvent<T> = Event<
|
|
193
|
+
T,
|
|
194
|
+
{
|
|
195
|
+
/**
|
|
196
|
+
* Address of the contract that emitted this event
|
|
197
|
+
*/
|
|
198
|
+
contractAddress: AztecAddress;
|
|
199
|
+
}
|
|
200
|
+
>;
|
|
201
|
+
|
|
165
202
|
/**
|
|
166
203
|
* Contract metadata including deployment and registration status.
|
|
167
204
|
*/
|
|
@@ -188,6 +225,16 @@ export type ContractClassMetadata = {
|
|
|
188
225
|
isContractClassPubliclyRegistered: boolean;
|
|
189
226
|
};
|
|
190
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Options for executing a utility function call.
|
|
230
|
+
*/
|
|
231
|
+
export type ExecuteUtilityOptions = {
|
|
232
|
+
/** The scope for the utility execution (determines which notes and keys are visible). */
|
|
233
|
+
scope: AztecAddress;
|
|
234
|
+
/** Optional auth witnesses to use during execution. */
|
|
235
|
+
authWitnesses?: AuthWitness[];
|
|
236
|
+
};
|
|
237
|
+
|
|
191
238
|
/**
|
|
192
239
|
* The wallet interface.
|
|
193
240
|
*/
|
|
@@ -197,7 +244,6 @@ export type Wallet = {
|
|
|
197
244
|
eventFilter: PrivateEventFilter,
|
|
198
245
|
): Promise<PrivateEvent<T>[]>;
|
|
199
246
|
getChainInfo(): Promise<ChainInfo>;
|
|
200
|
-
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
201
247
|
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
202
248
|
getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
|
|
203
249
|
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
|
|
@@ -209,26 +255,19 @@ export type Wallet = {
|
|
|
209
255
|
secretKey?: Fr,
|
|
210
256
|
): Promise<ContractInstanceWithAddress>;
|
|
211
257
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
212
|
-
|
|
258
|
+
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
|
|
213
259
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
214
|
-
sendTx
|
|
260
|
+
sendTx<W extends InteractionWaitOptions = undefined>(
|
|
261
|
+
exec: ExecutionPayload,
|
|
262
|
+
opts: SendOptions<W>,
|
|
263
|
+
): Promise<SendReturn<W>>;
|
|
215
264
|
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
|
|
265
|
+
requestCapabilities(manifest: AppCapabilities): Promise<WalletCapabilities>;
|
|
216
266
|
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
|
|
217
267
|
};
|
|
218
268
|
|
|
219
|
-
export const FunctionCallSchema = z.object({
|
|
220
|
-
name: z.string(),
|
|
221
|
-
to: schemas.AztecAddress,
|
|
222
|
-
selector: schemas.FunctionSelector,
|
|
223
|
-
type: z.nativeEnum(FunctionType),
|
|
224
|
-
isStatic: z.boolean(),
|
|
225
|
-
hideMsgSender: z.boolean(),
|
|
226
|
-
args: z.array(schemas.Fr),
|
|
227
|
-
returnTypes: z.array(AbiTypeSchema),
|
|
228
|
-
});
|
|
229
|
-
|
|
230
269
|
export const ExecutionPayloadSchema = z.object({
|
|
231
|
-
calls: z.array(
|
|
270
|
+
calls: z.array(FunctionCall.schema),
|
|
232
271
|
authWitnesses: z.array(AuthWitness.schema),
|
|
233
272
|
capsules: z.array(Capsule.schema),
|
|
234
273
|
extraHashedArgs: z.array(HashedValues.schema),
|
|
@@ -251,11 +290,20 @@ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
|
|
|
251
290
|
estimateGas: optional(z.boolean()),
|
|
252
291
|
});
|
|
253
292
|
|
|
293
|
+
export const WaitOptsSchema = z.object({
|
|
294
|
+
ignoreDroppedReceiptsFor: optional(z.number()),
|
|
295
|
+
timeout: optional(z.number()),
|
|
296
|
+
interval: optional(z.number()),
|
|
297
|
+
dontThrowOnRevert: optional(z.boolean()),
|
|
298
|
+
});
|
|
299
|
+
|
|
254
300
|
export const SendOptionsSchema = z.object({
|
|
255
301
|
from: schemas.AztecAddress,
|
|
256
302
|
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
257
303
|
capsules: optional(z.array(Capsule.schema)),
|
|
258
304
|
fee: optional(GasSettingsOptionSchema),
|
|
305
|
+
wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
|
|
306
|
+
additionalScopes: optional(z.array(schemas.AztecAddress)),
|
|
259
307
|
});
|
|
260
308
|
|
|
261
309
|
export const SimulateOptionsSchema = z.object({
|
|
@@ -266,6 +314,7 @@ export const SimulateOptionsSchema = z.object({
|
|
|
266
314
|
skipTxValidation: optional(z.boolean()),
|
|
267
315
|
skipFeeEnforcement: optional(z.boolean()),
|
|
268
316
|
includeMetadata: optional(z.boolean()),
|
|
317
|
+
additionalScopes: optional(z.array(schemas.AztecAddress)),
|
|
269
318
|
});
|
|
270
319
|
|
|
271
320
|
export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
@@ -277,7 +326,7 @@ export const MessageHashOrIntentSchema = z.union([
|
|
|
277
326
|
z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
|
|
278
327
|
z.object({
|
|
279
328
|
caller: schemas.AztecAddress,
|
|
280
|
-
call:
|
|
329
|
+
call: FunctionCall.schema,
|
|
281
330
|
}),
|
|
282
331
|
]);
|
|
283
332
|
|
|
@@ -287,6 +336,21 @@ export const EventMetadataDefinitionSchema = z.object({
|
|
|
287
336
|
fieldNames: z.array(z.string()),
|
|
288
337
|
});
|
|
289
338
|
|
|
339
|
+
const EventFilterBaseSchema = z.object({
|
|
340
|
+
txHash: optional(TxHash.schema),
|
|
341
|
+
fromBlock: optional(BlockNumberPositiveSchema),
|
|
342
|
+
toBlock: optional(BlockNumberPositiveSchema),
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
export const PrivateEventFilterSchema = EventFilterBaseSchema.extend({
|
|
346
|
+
contractAddress: schemas.AztecAddress,
|
|
347
|
+
scopes: z.array(schemas.AztecAddress),
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
export const PublicEventFilterSchema = EventFilterBaseSchema.extend({
|
|
351
|
+
contractAddress: optional(schemas.AztecAddress),
|
|
352
|
+
});
|
|
353
|
+
|
|
290
354
|
export const PrivateEventSchema: z.ZodType<any> = zodFor<PrivateEvent<AbiDecoded>>()(
|
|
291
355
|
z.object({
|
|
292
356
|
event: AbiDecodedSchema,
|
|
@@ -294,13 +358,12 @@ export const PrivateEventSchema: z.ZodType<any> = zodFor<PrivateEvent<AbiDecoded
|
|
|
294
358
|
}),
|
|
295
359
|
);
|
|
296
360
|
|
|
297
|
-
export const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
});
|
|
361
|
+
export const PublicEventSchema = zodFor<PublicEvent<AbiDecoded>>()(
|
|
362
|
+
z.object({
|
|
363
|
+
event: AbiDecodedSchema,
|
|
364
|
+
metadata: z.intersection(inTxSchema(), z.object({ contractAddress: schemas.AztecAddress })),
|
|
365
|
+
}),
|
|
366
|
+
);
|
|
304
367
|
|
|
305
368
|
export const ContractMetadataSchema = z.object({
|
|
306
369
|
instance: optional(ContractInstanceWithAddressSchema),
|
|
@@ -315,6 +378,136 @@ export const ContractClassMetadataSchema = z.object({
|
|
|
315
378
|
isContractClassPubliclyRegistered: z.boolean(),
|
|
316
379
|
});
|
|
317
380
|
|
|
381
|
+
export const ContractFunctionPatternSchema = z.object({
|
|
382
|
+
contract: z.union([schemas.AztecAddress, z.literal('*')]),
|
|
383
|
+
function: z.union([z.string(), z.literal('*')]),
|
|
384
|
+
additionalScopes: optional(z.union([z.array(schemas.AztecAddress), z.literal('*')])),
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
export const AccountsCapabilitySchema = z.object({
|
|
388
|
+
type: z.literal('accounts'),
|
|
389
|
+
canGet: optional(z.boolean()),
|
|
390
|
+
canCreateAuthWit: optional(z.boolean()),
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
export const GrantedAccountsCapabilitySchema = AccountsCapabilitySchema.extend({
|
|
394
|
+
accounts: z.array(z.object({ alias: z.string(), item: schemas.AztecAddress })),
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
export const ContractsCapabilitySchema = z.object({
|
|
398
|
+
type: z.literal('contracts'),
|
|
399
|
+
contracts: z.union([z.literal('*'), z.array(schemas.AztecAddress)]),
|
|
400
|
+
canRegister: optional(z.boolean()),
|
|
401
|
+
canGetMetadata: optional(z.boolean()),
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
export const GrantedContractsCapabilitySchema = ContractsCapabilitySchema;
|
|
405
|
+
|
|
406
|
+
export const ContractClassesCapabilitySchema = z.object({
|
|
407
|
+
type: z.literal('contractClasses'),
|
|
408
|
+
classes: z.union([z.literal('*'), z.array(schemas.Fr)]),
|
|
409
|
+
canGetMetadata: z.boolean(),
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
export const GrantedContractClassesCapabilitySchema = ContractClassesCapabilitySchema;
|
|
413
|
+
|
|
414
|
+
export const SimulationCapabilitySchema = z.object({
|
|
415
|
+
type: z.literal('simulation'),
|
|
416
|
+
transactions: optional(
|
|
417
|
+
z.object({
|
|
418
|
+
scope: z.union([z.literal('*'), z.array(ContractFunctionPatternSchema)]),
|
|
419
|
+
}),
|
|
420
|
+
),
|
|
421
|
+
utilities: optional(
|
|
422
|
+
z.object({
|
|
423
|
+
scope: z.union([z.literal('*'), z.array(ContractFunctionPatternSchema)]),
|
|
424
|
+
}),
|
|
425
|
+
),
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
export const GrantedSimulationCapabilitySchema = SimulationCapabilitySchema;
|
|
429
|
+
|
|
430
|
+
export const TransactionCapabilitySchema = z.object({
|
|
431
|
+
type: z.literal('transaction'),
|
|
432
|
+
scope: z.union([z.literal('*'), z.array(ContractFunctionPatternSchema)]),
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
export const GrantedTransactionCapabilitySchema = TransactionCapabilitySchema;
|
|
436
|
+
|
|
437
|
+
export const DataCapabilitySchema = z.object({
|
|
438
|
+
type: z.literal('data'),
|
|
439
|
+
addressBook: optional(z.boolean()),
|
|
440
|
+
privateEvents: optional(
|
|
441
|
+
z.object({
|
|
442
|
+
contracts: z.union([z.literal('*'), z.array(schemas.AztecAddress)]),
|
|
443
|
+
}),
|
|
444
|
+
),
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
export const GrantedDataCapabilitySchema = DataCapabilitySchema;
|
|
448
|
+
|
|
449
|
+
export const CapabilitySchema = z.discriminatedUnion('type', [
|
|
450
|
+
AccountsCapabilitySchema,
|
|
451
|
+
ContractsCapabilitySchema,
|
|
452
|
+
ContractClassesCapabilitySchema,
|
|
453
|
+
SimulationCapabilitySchema,
|
|
454
|
+
TransactionCapabilitySchema,
|
|
455
|
+
DataCapabilitySchema,
|
|
456
|
+
]);
|
|
457
|
+
|
|
458
|
+
export const GrantedCapabilitySchema = z.discriminatedUnion('type', [
|
|
459
|
+
GrantedAccountsCapabilitySchema,
|
|
460
|
+
GrantedContractsCapabilitySchema,
|
|
461
|
+
GrantedContractClassesCapabilitySchema,
|
|
462
|
+
GrantedSimulationCapabilitySchema,
|
|
463
|
+
GrantedTransactionCapabilitySchema,
|
|
464
|
+
GrantedDataCapabilitySchema,
|
|
465
|
+
]);
|
|
466
|
+
|
|
467
|
+
export const AppCapabilitiesSchema = z.object({
|
|
468
|
+
version: z.literal('1.0'),
|
|
469
|
+
metadata: z.object({
|
|
470
|
+
name: z.string(),
|
|
471
|
+
version: z.string(),
|
|
472
|
+
description: optional(z.string()),
|
|
473
|
+
url: optional(z.string()),
|
|
474
|
+
icon: optional(z.string()),
|
|
475
|
+
}),
|
|
476
|
+
capabilities: z.array(CapabilitySchema),
|
|
477
|
+
behavior: optional(
|
|
478
|
+
z.object({
|
|
479
|
+
mode: optional(z.enum(['strict', 'permissive'])),
|
|
480
|
+
expiration: optional(z.number()),
|
|
481
|
+
}),
|
|
482
|
+
),
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
export const WalletCapabilitiesSchema = z.object({
|
|
486
|
+
version: z.literal('1.0'),
|
|
487
|
+
granted: z.array(GrantedCapabilitySchema),
|
|
488
|
+
wallet: z.object({
|
|
489
|
+
name: z.string(),
|
|
490
|
+
version: z.string(),
|
|
491
|
+
}),
|
|
492
|
+
expiresAt: optional(z.number()),
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
const OffchainEffectSchema = z.object({
|
|
496
|
+
data: z.array(schemas.Fr),
|
|
497
|
+
contractAddress: schemas.AztecAddress,
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
const OffchainMessageSchema = z.object({
|
|
501
|
+
recipient: schemas.AztecAddress,
|
|
502
|
+
payload: z.array(schemas.Fr),
|
|
503
|
+
contractAddress: schemas.AztecAddress,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
const OffchainOutputSchema = z.object({
|
|
507
|
+
offchainEffects: z.array(OffchainEffectSchema),
|
|
508
|
+
offchainMessages: z.array(OffchainMessageSchema),
|
|
509
|
+
});
|
|
510
|
+
|
|
318
511
|
/**
|
|
319
512
|
* Record of all wallet method schemas (excluding batch).
|
|
320
513
|
* This is the single source of truth for method schemas - batch schemas are derived from this.
|
|
@@ -324,7 +517,6 @@ const WalletMethodSchemas = {
|
|
|
324
517
|
.function()
|
|
325
518
|
.args()
|
|
326
519
|
.returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
|
|
327
|
-
getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
|
|
328
520
|
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
329
521
|
getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
|
|
330
522
|
getPrivateEvents: z
|
|
@@ -345,13 +537,28 @@ const WalletMethodSchemas = {
|
|
|
345
537
|
.args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
|
|
346
538
|
.returns(ContractInstanceWithAddressSchema),
|
|
347
539
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
348
|
-
|
|
540
|
+
executeUtility: z
|
|
349
541
|
.function()
|
|
350
|
-
.args(
|
|
351
|
-
|
|
542
|
+
.args(
|
|
543
|
+
FunctionCall.schema,
|
|
544
|
+
z.object({
|
|
545
|
+
scope: schemas.AztecAddress,
|
|
546
|
+
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
547
|
+
}),
|
|
548
|
+
)
|
|
549
|
+
.returns(UtilityExecutionResult.schema),
|
|
352
550
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
353
|
-
sendTx: z
|
|
551
|
+
sendTx: z
|
|
552
|
+
.function()
|
|
553
|
+
.args(ExecutionPayloadSchema, SendOptionsSchema)
|
|
554
|
+
.returns(
|
|
555
|
+
z.union([
|
|
556
|
+
z.object({ txHash: TxHash.schema }).merge(OffchainOutputSchema),
|
|
557
|
+
z.object({ receipt: TxReceipt.schema }).merge(OffchainOutputSchema),
|
|
558
|
+
]),
|
|
559
|
+
),
|
|
354
560
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
561
|
+
requestCapabilities: z.function().args(AppCapabilitiesSchema).returns(WalletCapabilitiesSchema),
|
|
355
562
|
};
|
|
356
563
|
|
|
357
564
|
/**
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X3NlbnRfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdC9kZXBsb3lfc2VudF90eC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN4RCxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEtBQUssRUFBRSxZQ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,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,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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VudF90eC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0L3NlbnRfdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLE1BQU0sRUFBRSxLQUFLLFNBQVMsRUFBWSxNQUFNLGtCQUFrQixDQUFDO0FBRXBFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRWxELDJDQUEyQztBQUMzQyxNQUFNLE1BQU0sUUFBUSxHQUFHO0lBQ3JCLGdLQUFnSztJQUNoSyx3QkFBd0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNsQyw2RkFBNkY7SUFDN0YsT0FBTyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2pCLHNHQUFzRztJQUN0RyxRQUFRLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDbEIsMEhBQTBIO0lBQzFILGlCQUFpQixDQUFDLEVBQUUsT0FBTyxDQUFDO0NBQzdCLENBQUM7QUFFRixlQUFPLE1BQU0sZUFBZSxFQUFFLFFBSTdCLENBQUM7QUFFRjs7O0dBR0c7QUFDSCxxQkFBYSxNQUFNO0lBTWYsU0FBUyxDQUFDLFlBQVksRUFBRSxNQUFNLEdBQUcsU0FBUztJQUw1QyxTQUFTLENBQUMsYUFBYSxFQUFFLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QyxTQUFTLENBQUMsV0FBVyxDQUFDLEVBQUUsS0FBSyxD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