@aztec/aztec.js 0.0.1-commit.f295ac2 → 0.0.1-commit.f2ce05ee
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/account/account.d.ts +25 -40
- package/dest/account/account.d.ts.map +1 -1
- package/dest/account/account.js +19 -47
- package/dest/account/account_contract.d.ts +7 -8
- package/dest/account/account_contract.d.ts.map +1 -1
- package/dest/account/account_with_secret_key.d.ts +18 -7
- package/dest/account/account_with_secret_key.d.ts.map +1 -1
- package/dest/account/account_with_secret_key.js +21 -4
- package/dest/account/index.d.ts +3 -2
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +2 -0
- package/dest/account/signerless_account.d.ts +5 -6
- package/dest/account/signerless_account.d.ts.map +1 -1
- package/dest/account/signerless_account.js +8 -11
- package/dest/api/account.d.ts +2 -4
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +1 -3
- package/dest/api/authorization.d.ts +2 -2
- package/dest/api/authorization.d.ts.map +1 -1
- package/dest/api/authorization.js +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 +16 -10
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +14 -8
- 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/contract_function_interaction.d.ts +3 -12
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +6 -6
- package/dest/contract/deploy_method.d.ts +63 -16
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +36 -19
- package/dest/contract/interaction_options.d.ts +42 -5
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +8 -1
- package/dest/contract/protocol_contracts/auth-registry.d.ts +1 -10
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/auth-registry.js +97 -467
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +2 -11
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.js +10 -422
- 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 -482
- 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 +14 -412
- 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 +23 -14
- 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 +23 -22
- 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/authwit.d.ts +8 -6
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +5 -9
- 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/account_entrypoint_meta_payment_method.d.ts +5 -8
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
- package/dest/wallet/account_entrypoint_meta_payment_method.js +28 -43
- package/dest/wallet/account_manager.d.ts +1 -7
- package/dest/wallet/account_manager.d.ts.map +1 -1
- package/dest/wallet/account_manager.js +5 -11
- package/dest/wallet/capabilities.d.ts +444 -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 +34 -6
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.js +7 -5
- 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 +1493 -94
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +158 -26
- package/package.json +19 -10
- package/src/account/account.ts +34 -58
- package/src/account/account_contract.ts +6 -7
- package/src/account/account_with_secret_key.ts +33 -8
- package/src/account/index.ts +2 -1
- package/src/account/signerless_account.ts +13 -12
- package/src/api/account.ts +9 -3
- package/src/api/authorization.ts +1 -0
- package/src/api/block.ts +1 -1
- package/src/api/contract.ts +22 -7
- 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 +47 -1
- package/src/contract/base_contract_interaction.ts +27 -15
- package/src/contract/contract_function_interaction.ts +13 -6
- package/src/contract/deploy_method.ts +115 -23
- package/src/contract/interaction_options.ts +49 -4
- package/src/contract/protocol_contracts/auth-registry.ts +45 -236
- package/src/contract/protocol_contracts/contract-class-registry.ts +3 -204
- package/src/contract/protocol_contracts/contract-instance-registry.ts +34 -233
- package/src/contract/protocol_contracts/fee-juice.ts +4 -202
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +6 -12
- package/src/contract/protocol_contracts/public-checks.ts +6 -14
- 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/authwit.ts +19 -7
- package/src/utils/node.ts +62 -0
- package/src/wallet/account_entrypoint_meta_payment_method.ts +28 -60
- package/src/wallet/account_manager.ts +5 -13
- package/src/wallet/capabilities.ts +491 -0
- package/src/wallet/deploy_account_method.ts +37 -13
- package/src/wallet/index.ts +1 -0
- package/src/wallet/wallet.ts +214 -48
- package/dest/account/interface.d.ts +0 -19
- package/dest/account/interface.d.ts.map +0 -1
- package/dest/account/interface.js +0 -5
- 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/src/account/interface.ts +0 -25
- package/src/contract/deploy_sent_tx.ts +0 -75
- package/src/contract/sent_tx.ts +0 -129
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,
|
|
@@ -25,18 +25,21 @@ import {
|
|
|
25
25
|
UtilitySimulationResult,
|
|
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.
|
|
160
|
+
*/
|
|
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.
|
|
157
170
|
*/
|
|
158
|
-
export type
|
|
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
|
*/
|
|
@@ -197,7 +234,6 @@ export type Wallet = {
|
|
|
197
234
|
eventFilter: PrivateEventFilter,
|
|
198
235
|
): Promise<PrivateEvent<T>[]>;
|
|
199
236
|
getChainInfo(): Promise<ChainInfo>;
|
|
200
|
-
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
201
237
|
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
202
238
|
getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
|
|
203
239
|
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
|
|
@@ -211,24 +247,17 @@ export type Wallet = {
|
|
|
211
247
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
212
248
|
simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
|
|
213
249
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
214
|
-
sendTx
|
|
215
|
-
|
|
250
|
+
sendTx<W extends InteractionWaitOptions = undefined>(
|
|
251
|
+
exec: ExecutionPayload,
|
|
252
|
+
opts: SendOptions<W>,
|
|
253
|
+
): Promise<SendReturn<W>>;
|
|
254
|
+
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
|
|
255
|
+
requestCapabilities(manifest: AppCapabilities): Promise<WalletCapabilities>;
|
|
216
256
|
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
|
|
217
257
|
};
|
|
218
258
|
|
|
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
259
|
export const ExecutionPayloadSchema = z.object({
|
|
231
|
-
calls: z.array(
|
|
260
|
+
calls: z.array(FunctionCall.schema),
|
|
232
261
|
authWitnesses: z.array(AuthWitness.schema),
|
|
233
262
|
capsules: z.array(Capsule.schema),
|
|
234
263
|
extraHashedArgs: z.array(HashedValues.schema),
|
|
@@ -251,11 +280,19 @@ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
|
|
|
251
280
|
estimateGas: optional(z.boolean()),
|
|
252
281
|
});
|
|
253
282
|
|
|
283
|
+
export const WaitOptsSchema = z.object({
|
|
284
|
+
ignoreDroppedReceiptsFor: optional(z.number()),
|
|
285
|
+
timeout: optional(z.number()),
|
|
286
|
+
interval: optional(z.number()),
|
|
287
|
+
dontThrowOnRevert: optional(z.boolean()),
|
|
288
|
+
});
|
|
289
|
+
|
|
254
290
|
export const SendOptionsSchema = z.object({
|
|
255
291
|
from: schemas.AztecAddress,
|
|
256
292
|
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
257
293
|
capsules: optional(z.array(Capsule.schema)),
|
|
258
294
|
fee: optional(GasSettingsOptionSchema),
|
|
295
|
+
wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
|
|
259
296
|
});
|
|
260
297
|
|
|
261
298
|
export const SimulateOptionsSchema = z.object({
|
|
@@ -274,11 +311,10 @@ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
|
274
311
|
});
|
|
275
312
|
|
|
276
313
|
export const MessageHashOrIntentSchema = z.union([
|
|
277
|
-
schemas.Fr,
|
|
278
314
|
z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
|
|
279
315
|
z.object({
|
|
280
316
|
caller: schemas.AztecAddress,
|
|
281
|
-
call:
|
|
317
|
+
call: FunctionCall.schema,
|
|
282
318
|
}),
|
|
283
319
|
]);
|
|
284
320
|
|
|
@@ -288,6 +324,21 @@ export const EventMetadataDefinitionSchema = z.object({
|
|
|
288
324
|
fieldNames: z.array(z.string()),
|
|
289
325
|
});
|
|
290
326
|
|
|
327
|
+
const EventFilterBaseSchema = z.object({
|
|
328
|
+
txHash: optional(TxHash.schema),
|
|
329
|
+
fromBlock: optional(BlockNumberPositiveSchema),
|
|
330
|
+
toBlock: optional(BlockNumberPositiveSchema),
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
export const PrivateEventFilterSchema = EventFilterBaseSchema.extend({
|
|
334
|
+
contractAddress: schemas.AztecAddress,
|
|
335
|
+
scopes: z.array(schemas.AztecAddress),
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
export const PublicEventFilterSchema = EventFilterBaseSchema.extend({
|
|
339
|
+
contractAddress: optional(schemas.AztecAddress),
|
|
340
|
+
});
|
|
341
|
+
|
|
291
342
|
export const PrivateEventSchema: z.ZodType<any> = zodFor<PrivateEvent<AbiDecoded>>()(
|
|
292
343
|
z.object({
|
|
293
344
|
event: AbiDecodedSchema,
|
|
@@ -295,13 +346,12 @@ export const PrivateEventSchema: z.ZodType<any> = zodFor<PrivateEvent<AbiDecoded
|
|
|
295
346
|
}),
|
|
296
347
|
);
|
|
297
348
|
|
|
298
|
-
export const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
});
|
|
349
|
+
export const PublicEventSchema = zodFor<PublicEvent<AbiDecoded>>()(
|
|
350
|
+
z.object({
|
|
351
|
+
event: AbiDecodedSchema,
|
|
352
|
+
metadata: z.intersection(inTxSchema(), z.object({ contractAddress: schemas.AztecAddress })),
|
|
353
|
+
}),
|
|
354
|
+
);
|
|
305
355
|
|
|
306
356
|
export const ContractMetadataSchema = z.object({
|
|
307
357
|
instance: optional(ContractInstanceWithAddressSchema),
|
|
@@ -316,6 +366,119 @@ export const ContractClassMetadataSchema = z.object({
|
|
|
316
366
|
isContractClassPubliclyRegistered: z.boolean(),
|
|
317
367
|
});
|
|
318
368
|
|
|
369
|
+
export const ContractFunctionPatternSchema = z.object({
|
|
370
|
+
contract: z.union([schemas.AztecAddress, z.literal('*')]),
|
|
371
|
+
function: z.union([z.string(), z.literal('*')]),
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
export const AccountsCapabilitySchema = z.object({
|
|
375
|
+
type: z.literal('accounts'),
|
|
376
|
+
canGet: optional(z.boolean()),
|
|
377
|
+
canCreateAuthWit: optional(z.boolean()),
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
export const GrantedAccountsCapabilitySchema = AccountsCapabilitySchema.extend({
|
|
381
|
+
accounts: z.array(z.object({ alias: z.string(), item: schemas.AztecAddress })),
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
export const ContractsCapabilitySchema = z.object({
|
|
385
|
+
type: z.literal('contracts'),
|
|
386
|
+
contracts: z.union([z.literal('*'), z.array(schemas.AztecAddress)]),
|
|
387
|
+
canRegister: optional(z.boolean()),
|
|
388
|
+
canGetMetadata: optional(z.boolean()),
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
export const GrantedContractsCapabilitySchema = ContractsCapabilitySchema;
|
|
392
|
+
|
|
393
|
+
export const ContractClassesCapabilitySchema = z.object({
|
|
394
|
+
type: z.literal('contractClasses'),
|
|
395
|
+
classes: z.union([z.literal('*'), z.array(schemas.Fr)]),
|
|
396
|
+
canGetMetadata: z.boolean(),
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
export const GrantedContractClassesCapabilitySchema = ContractClassesCapabilitySchema;
|
|
400
|
+
|
|
401
|
+
export const SimulationCapabilitySchema = z.object({
|
|
402
|
+
type: z.literal('simulation'),
|
|
403
|
+
transactions: optional(
|
|
404
|
+
z.object({
|
|
405
|
+
scope: z.union([z.literal('*'), z.array(ContractFunctionPatternSchema)]),
|
|
406
|
+
}),
|
|
407
|
+
),
|
|
408
|
+
utilities: optional(
|
|
409
|
+
z.object({
|
|
410
|
+
scope: z.union([z.literal('*'), z.array(ContractFunctionPatternSchema)]),
|
|
411
|
+
}),
|
|
412
|
+
),
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
export const GrantedSimulationCapabilitySchema = SimulationCapabilitySchema;
|
|
416
|
+
|
|
417
|
+
export const TransactionCapabilitySchema = z.object({
|
|
418
|
+
type: z.literal('transaction'),
|
|
419
|
+
scope: z.union([z.literal('*'), z.array(ContractFunctionPatternSchema)]),
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
export const GrantedTransactionCapabilitySchema = TransactionCapabilitySchema;
|
|
423
|
+
|
|
424
|
+
export const DataCapabilitySchema = z.object({
|
|
425
|
+
type: z.literal('data'),
|
|
426
|
+
addressBook: optional(z.boolean()),
|
|
427
|
+
privateEvents: optional(
|
|
428
|
+
z.object({
|
|
429
|
+
contracts: z.union([z.literal('*'), z.array(schemas.AztecAddress)]),
|
|
430
|
+
}),
|
|
431
|
+
),
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
export const GrantedDataCapabilitySchema = DataCapabilitySchema;
|
|
435
|
+
|
|
436
|
+
export const CapabilitySchema = z.discriminatedUnion('type', [
|
|
437
|
+
AccountsCapabilitySchema,
|
|
438
|
+
ContractsCapabilitySchema,
|
|
439
|
+
ContractClassesCapabilitySchema,
|
|
440
|
+
SimulationCapabilitySchema,
|
|
441
|
+
TransactionCapabilitySchema,
|
|
442
|
+
DataCapabilitySchema,
|
|
443
|
+
]);
|
|
444
|
+
|
|
445
|
+
export const GrantedCapabilitySchema = z.discriminatedUnion('type', [
|
|
446
|
+
GrantedAccountsCapabilitySchema,
|
|
447
|
+
GrantedContractsCapabilitySchema,
|
|
448
|
+
GrantedContractClassesCapabilitySchema,
|
|
449
|
+
GrantedSimulationCapabilitySchema,
|
|
450
|
+
GrantedTransactionCapabilitySchema,
|
|
451
|
+
GrantedDataCapabilitySchema,
|
|
452
|
+
]);
|
|
453
|
+
|
|
454
|
+
export const AppCapabilitiesSchema = z.object({
|
|
455
|
+
version: z.literal('1.0'),
|
|
456
|
+
metadata: z.object({
|
|
457
|
+
name: z.string(),
|
|
458
|
+
version: z.string(),
|
|
459
|
+
description: optional(z.string()),
|
|
460
|
+
url: optional(z.string()),
|
|
461
|
+
icon: optional(z.string()),
|
|
462
|
+
}),
|
|
463
|
+
capabilities: z.array(CapabilitySchema),
|
|
464
|
+
behavior: optional(
|
|
465
|
+
z.object({
|
|
466
|
+
mode: optional(z.enum(['strict', 'permissive'])),
|
|
467
|
+
expiration: optional(z.number()),
|
|
468
|
+
}),
|
|
469
|
+
),
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
export const WalletCapabilitiesSchema = z.object({
|
|
473
|
+
version: z.literal('1.0'),
|
|
474
|
+
granted: z.array(GrantedCapabilitySchema),
|
|
475
|
+
wallet: z.object({
|
|
476
|
+
name: z.string(),
|
|
477
|
+
version: z.string(),
|
|
478
|
+
}),
|
|
479
|
+
expiresAt: optional(z.number()),
|
|
480
|
+
});
|
|
481
|
+
|
|
319
482
|
/**
|
|
320
483
|
* Record of all wallet method schemas (excluding batch).
|
|
321
484
|
* This is the single source of truth for method schemas - batch schemas are derived from this.
|
|
@@ -325,7 +488,6 @@ const WalletMethodSchemas = {
|
|
|
325
488
|
.function()
|
|
326
489
|
.args()
|
|
327
490
|
.returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
|
|
328
|
-
getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
|
|
329
491
|
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
330
492
|
getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
|
|
331
493
|
getPrivateEvents: z
|
|
@@ -348,11 +510,15 @@ const WalletMethodSchemas = {
|
|
|
348
510
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
349
511
|
simulateUtility: z
|
|
350
512
|
.function()
|
|
351
|
-
.args(
|
|
513
|
+
.args(FunctionCall.schema, optional(z.array(AuthWitness.schema)))
|
|
352
514
|
.returns(UtilitySimulationResult.schema),
|
|
353
515
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
354
|
-
sendTx: z
|
|
516
|
+
sendTx: z
|
|
517
|
+
.function()
|
|
518
|
+
.args(ExecutionPayloadSchema, SendOptionsSchema)
|
|
519
|
+
.returns(z.union([TxHash.schema, TxReceipt.schema])),
|
|
355
520
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
521
|
+
requestCapabilities: z.function().args(AppCapabilitiesSchema).returns(WalletCapabilitiesSchema),
|
|
356
522
|
};
|
|
357
523
|
|
|
358
524
|
/**
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWNjb3VudC9pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUM5RixPQUFPLE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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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X3NlbnRfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdC9kZXBsb3lfc2VudF90eC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN4RCxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN2RCxPQUFPLEVBQUUsTUFBTSxFQUFFLEtBQUssUUFBUSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBRXJELHNEQUFzRDtBQUN0RCxNQUFNLE1BQU0sZ0JBQWdCLEdBQUcsUUFBUSxHQUFHO0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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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VudF90eC5kLnRzIiwic291cmN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