@aztec/aztec.js 0.0.1-commit.9b94fc1 → 0.0.1-commit.bf2612ae

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 (186) 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 +9 -10
  5. package/dest/account/account_contract.d.ts.map +1 -1
  6. package/dest/account/account_with_secret_key.d.ts +21 -9
  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 +4 -3
  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 +6 -7
  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/fields.d.ts +3 -2
  25. package/dest/api/fields.d.ts.map +1 -1
  26. package/dest/api/fields.js +2 -1
  27. package/dest/api/node.d.ts +8 -4
  28. package/dest/api/node.d.ts.map +1 -1
  29. package/dest/api/node.js +7 -3
  30. package/dest/api/protocol.d.ts +7 -1
  31. package/dest/api/protocol.d.ts.map +1 -1
  32. package/dest/api/protocol.js +6 -0
  33. package/dest/api/tx.d.ts +2 -2
  34. package/dest/api/tx.d.ts.map +1 -1
  35. package/dest/api/tx.js +1 -1
  36. package/dest/api/wallet.d.ts +2 -2
  37. package/dest/api/wallet.d.ts.map +1 -1
  38. package/dest/api/wallet.js +1 -1
  39. package/dest/authorization/call_authorization_request.d.ts +23 -2
  40. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  41. package/dest/contract/base_contract_interaction.d.ts +8 -10
  42. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  43. package/dest/contract/base_contract_interaction.js +5 -17
  44. package/dest/contract/batch_call.d.ts +1 -1
  45. package/dest/contract/batch_call.d.ts.map +1 -1
  46. package/dest/contract/batch_call.js +3 -1
  47. package/dest/contract/contract_base.d.ts +4 -1
  48. package/dest/contract/contract_base.d.ts.map +1 -1
  49. package/dest/contract/contract_function_interaction.d.ts +1 -1
  50. package/dest/contract/deploy_method.d.ts +64 -17
  51. package/dest/contract/deploy_method.d.ts.map +1 -1
  52. package/dest/contract/deploy_method.js +42 -24
  53. package/dest/contract/interaction_options.d.ts +42 -5
  54. package/dest/contract/interaction_options.d.ts.map +1 -1
  55. package/dest/contract/interaction_options.js +8 -1
  56. package/dest/contract/protocol_contracts/auth-registry.d.ts +36 -0
  57. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  58. package/dest/contract/protocol_contracts/auth-registry.js +963 -0
  59. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +35 -0
  60. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  61. package/dest/contract/protocol_contracts/contract-class-registry.js +784 -0
  62. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +31 -0
  63. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  64. package/dest/contract/protocol_contracts/contract-instance-registry.js +858 -0
  65. package/dest/contract/protocol_contracts/fee-juice.d.ts +30 -0
  66. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  67. package/dest/contract/protocol_contracts/fee-juice.js +827 -0
  68. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  69. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  70. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +563 -0
  71. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  72. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  73. package/dest/contract/protocol_contracts/public-checks.js +579 -0
  74. package/dest/contract/wait_for_proven.d.ts +2 -2
  75. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  76. package/dest/contract/wait_for_proven.js +1 -1
  77. package/dest/contract/wait_opts.d.ts +16 -0
  78. package/dest/contract/wait_opts.d.ts.map +1 -0
  79. package/dest/contract/wait_opts.js +5 -0
  80. package/dest/deployment/broadcast_function.js +4 -4
  81. package/dest/deployment/publish_class.js +3 -3
  82. package/dest/deployment/publish_instance.d.ts +2 -2
  83. package/dest/deployment/publish_instance.d.ts.map +1 -1
  84. package/dest/deployment/publish_instance.js +3 -3
  85. package/dest/ethereum/portal_manager.d.ts +9 -6
  86. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  87. package/dest/ethereum/portal_manager.js +17 -18
  88. package/dest/fee/fee_juice_payment_method_with_claim.js +1 -1
  89. package/dest/fee/private_fee_payment_method.js +1 -1
  90. package/dest/fee/public_fee_payment_method.js +1 -1
  91. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  92. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  93. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  94. package/dest/utils/abi_types.d.ts +2 -2
  95. package/dest/utils/abi_types.d.ts.map +1 -1
  96. package/dest/utils/authwit.d.ts +9 -7
  97. package/dest/utils/authwit.d.ts.map +1 -1
  98. package/dest/utils/authwit.js +6 -10
  99. package/dest/utils/cross_chain.d.ts +2 -2
  100. package/dest/utils/cross_chain.d.ts.map +1 -1
  101. package/dest/utils/fee_juice.js +1 -1
  102. package/dest/utils/field_compressed_string.js +1 -1
  103. package/dest/utils/node.d.ts +12 -1
  104. package/dest/utils/node.d.ts.map +1 -1
  105. package/dest/utils/node.js +46 -0
  106. package/dest/utils/pub_key.d.ts +2 -2
  107. package/dest/utils/pub_key.d.ts.map +1 -1
  108. package/dest/utils/pub_key.js +1 -1
  109. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +5 -8
  110. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  111. package/dest/wallet/account_entrypoint_meta_payment_method.js +28 -43
  112. package/dest/wallet/account_manager.d.ts +6 -9
  113. package/dest/wallet/account_manager.d.ts.map +1 -1
  114. package/dest/wallet/account_manager.js +6 -12
  115. package/dest/wallet/deploy_account_method.d.ts +35 -7
  116. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  117. package/dest/wallet/deploy_account_method.js +8 -6
  118. package/dest/wallet/wallet.d.ts +292 -960
  119. package/dest/wallet/wallet.d.ts.map +1 -1
  120. package/dest/wallet/wallet.js +76 -90
  121. package/package.json +15 -13
  122. package/src/account/account.ts +34 -58
  123. package/src/account/account_contract.ts +7 -8
  124. package/src/account/account_with_secret_key.ts +34 -9
  125. package/src/account/index.ts +3 -2
  126. package/src/account/signerless_account.ts +14 -13
  127. package/src/api/account.ts +9 -3
  128. package/src/api/authorization.ts +1 -0
  129. package/src/api/contract.ts +22 -7
  130. package/src/api/fields.ts +2 -1
  131. package/src/api/node.ts +7 -3
  132. package/src/api/protocol.ts +7 -0
  133. package/src/api/tx.ts +2 -0
  134. package/src/api/wallet.ts +9 -2
  135. package/src/authorization/call_authorization_request.ts +1 -1
  136. package/src/contract/base_contract_interaction.ts +27 -15
  137. package/src/contract/batch_call.ts +4 -2
  138. package/src/contract/deploy_method.ts +123 -30
  139. package/src/contract/interaction_options.ts +49 -4
  140. package/src/contract/protocol_contracts/auth-registry.ts +545 -0
  141. package/src/contract/protocol_contracts/contract-class-registry.ts +433 -0
  142. package/src/contract/protocol_contracts/contract-instance-registry.ts +493 -0
  143. package/src/contract/protocol_contracts/fee-juice.ts +457 -0
  144. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +329 -0
  145. package/src/contract/protocol_contracts/public-checks.ts +315 -0
  146. package/src/contract/wait_for_proven.ts +1 -1
  147. package/src/contract/wait_opts.ts +21 -0
  148. package/src/deployment/broadcast_function.ts +4 -4
  149. package/src/deployment/publish_class.ts +3 -3
  150. package/src/deployment/publish_instance.ts +3 -6
  151. package/src/ethereum/portal_manager.ts +20 -24
  152. package/src/fee/fee_juice_payment_method_with_claim.ts +1 -1
  153. package/src/fee/private_fee_payment_method.ts +1 -1
  154. package/src/fee/public_fee_payment_method.ts +1 -1
  155. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  156. package/src/utils/abi_types.ts +1 -1
  157. package/src/utils/authwit.ts +20 -8
  158. package/src/utils/cross_chain.ts +1 -1
  159. package/src/utils/fee_juice.ts +1 -1
  160. package/src/utils/field_compressed_string.ts +1 -1
  161. package/src/utils/node.ts +62 -0
  162. package/src/utils/pub_key.ts +2 -2
  163. package/src/wallet/account_entrypoint_meta_payment_method.ts +28 -60
  164. package/src/wallet/account_manager.ts +6 -14
  165. package/src/wallet/deploy_account_method.ts +38 -14
  166. package/src/wallet/wallet.ts +192 -93
  167. package/dest/account/interface.d.ts +0 -19
  168. package/dest/account/interface.d.ts.map +0 -1
  169. package/dest/account/interface.js +0 -5
  170. package/dest/contract/deploy_sent_tx.d.ts +0 -48
  171. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  172. package/dest/contract/deploy_sent_tx.js +0 -46
  173. package/dest/contract/protocol_contracts.d.ts +0 -9
  174. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  175. package/dest/contract/protocol_contracts.js +0 -26
  176. package/dest/contract/sent_tx.d.ts +0 -51
  177. package/dest/contract/sent_tx.d.ts.map +0 -1
  178. package/dest/contract/sent_tx.js +0 -90
  179. package/dest/contract/unsafe_contract.d.ts +0 -15
  180. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  181. package/dest/contract/unsafe_contract.js +0 -6
  182. package/src/account/interface.ts +0 -25
  183. package/src/contract/deploy_sent_tx.ts +0 -75
  184. package/src/contract/protocol_contracts.ts +0 -35
  185. package/src/contract/sent_tx.ts +0 -130
  186. package/src/contract/unsafe_contract.ts +0 -19
@@ -1,6 +1,8 @@
1
1
  import type { ChainInfo } from '@aztec/entrypoints/interfaces';
2
- import type { Fr } from '@aztec/foundation/fields';
2
+ import { BlockNumber, BlockNumberPositiveSchema } from '@aztec/foundation/branded-types';
3
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
4
  import {
5
+ type AbiDecoded,
4
6
  AbiTypeSchema,
5
7
  type ContractArtifact,
6
8
  ContractArtifactSchema,
@@ -10,15 +12,9 @@ import {
10
12
  } from '@aztec/stdlib/abi';
11
13
  import { AuthWitness } from '@aztec/stdlib/auth-witness';
12
14
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
13
- import {
14
- type ContractClassMetadata,
15
- ContractClassWithIdSchema,
16
- type ContractInstanceWithAddress,
17
- ContractInstanceWithAddressSchema,
18
- type ContractMetadata,
19
- } from '@aztec/stdlib/contract';
15
+ import { type ContractInstanceWithAddress, ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
20
16
  import { Gas } from '@aztec/stdlib/gas';
21
- import { AbiDecodedSchema, type ApiSchemaFor, type ZodFor, optional, schemas } from '@aztec/stdlib/schemas';
17
+ import { AbiDecodedSchema, type ApiSchemaFor, optional, schemas, zodFor } from '@aztec/stdlib/schemas';
22
18
  import {
23
19
  Capsule,
24
20
  HashedValues,
@@ -27,17 +23,21 @@ import {
27
23
  TxReceipt,
28
24
  TxSimulationResult,
29
25
  UtilitySimulationResult,
26
+ inTxSchema,
30
27
  } from '@aztec/stdlib/tx';
31
- import type { ExecutionPayload } from '@aztec/stdlib/tx';
28
+ import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
32
29
 
33
30
  import { z } from 'zod';
34
31
 
35
- import type {
36
- FeeEstimationOptions,
37
- GasSettingsOption,
38
- ProfileInteractionOptions,
39
- SendInteractionOptions,
40
- 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,
41
41
  } from '../contract/interaction_options.js';
42
42
  import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
43
43
 
@@ -57,7 +57,7 @@ export type Aliased<T> = {
57
57
 
58
58
  /**
59
59
  * Options for simulating interactions with the wallet. Overrides the fee settings of an interaction with
60
- * 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
61
61
  * fee payment method or not
62
62
  */
63
63
  export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
@@ -67,7 +67,7 @@ export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
67
67
 
68
68
  /**
69
69
  * Options for profiling interactions with the wallet. Overrides the fee settings of an interaction with
70
- * 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
71
71
  * fee payment method or not
72
72
  */
73
73
  export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
@@ -77,45 +77,54 @@ export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
77
77
 
78
78
  /**
79
79
  * Options for sending/proving interactions with the wallet. Overrides the fee settings of an interaction with
80
- * 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
81
81
  * fee payment method or not
82
82
  */
83
- export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
83
+ export type SendOptions<W extends InteractionWaitOptions = undefined> = Omit<
84
+ SendInteractionOptionsWithoutWait,
85
+ 'fee'
86
+ > & {
84
87
  /** The fee options */
85
88
  fee?: GasSettingsOption;
89
+ /** Whether to wait for the transaction to be mined */
90
+ wait?: W;
86
91
  };
87
92
 
88
93
  /**
89
- * 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).
90
95
  */
91
- export type BatchableMethods = Pick<
92
- Wallet,
93
- 'registerContract' | 'sendTx' | 'registerSender' | 'simulateUtility' | 'simulateTx'
94
- >;
96
+ export type BatchableMethods = Omit<Wallet, 'batch'>;
95
97
 
96
98
  /**
97
- * From the batchable methods, we create a type that represents a method call with its name and arguments.
98
- * This is what the wallet will accept as arguments to the `batch` method.
99
+ * A method call with its name and arguments.
99
100
  */
100
- export type BatchedMethod<T extends keyof BatchableMethods> = {
101
+ type BatchedMethodInternal<T extends keyof BatchableMethods> = {
101
102
  /** The method name */
102
103
  name: T;
103
104
  /** The method arguments */
104
105
  args: Parameters<BatchableMethods[T]>;
105
106
  };
106
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
+
107
116
  /**
108
117
  * Helper type to extract the return type of a batched method
109
118
  */
110
119
  export type BatchedMethodResult<T> =
111
- T extends BatchedMethod<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
120
+ T extends BatchedMethodInternal<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
112
121
 
113
122
  /**
114
123
  * Wrapper type for batch results that includes the method name for discriminated union deserialization.
115
124
  * Each result is wrapped as \{ name: 'methodName', result: ActualResult \} to allow proper deserialization
116
125
  * when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).
117
126
  */
118
- export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMethods>> = {
127
+ export type BatchedMethodResultWrapper<T extends BatchedMethod> = {
119
128
  /** The method name */
120
129
  name: T['name'];
121
130
  /** The method result */
@@ -125,25 +134,79 @@ export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMe
125
134
  /**
126
135
  * Maps a tuple of BatchedMethod to a tuple of their wrapped return types
127
136
  */
128
- export type BatchResults<T extends readonly BatchedMethod<keyof BatchableMethods>[]> = {
137
+ export type BatchResults<T extends readonly BatchedMethod[]> = {
129
138
  [K in keyof T]: BatchedMethodResultWrapper<T[K]>;
130
139
  };
131
140
 
141
+ /**
142
+ * Filter options when querying private events.
143
+ */
144
+ export type PrivateEventFilter = {
145
+ /** The address of the contract that emitted the events. */
146
+ contractAddress: AztecAddress;
147
+ /** Addresses of accounts that are in scope for this filter. */
148
+ scopes: AztecAddress[];
149
+ /** Transaction in which the events were emitted. */
150
+ txHash?: TxHash;
151
+ /** The block number from which to start fetching events (inclusive).
152
+ * Optional. If provided, it must be greater or equal than 1.
153
+ * Defaults to the initial L2 block number (INITIAL_L2_BLOCK_NUM).
154
+ * */
155
+ fromBlock?: BlockNumber;
156
+ /** The block number until which to fetch logs (not inclusive).
157
+ * Optional. If provided, it must be greater than fromBlock.
158
+ * Defaults to the latest known block to PXE + 1.
159
+ */
160
+ toBlock?: BlockNumber;
161
+ };
162
+
163
+ /**
164
+ * An ABI decoded private event with associated metadata.
165
+ */
166
+ export type PrivateEvent<T> = {
167
+ /** The ABI decoded event */
168
+ event: T;
169
+ /** Metadata describing event context information such as tx and block */
170
+ metadata: InTx;
171
+ };
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
+
132
199
  /**
133
200
  * The wallet interface.
134
201
  */
135
202
  export type Wallet = {
136
- getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
137
- getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
138
203
  getPrivateEvents<T>(
139
- contractAddress: AztecAddress,
140
204
  eventMetadata: EventMetadataDefinition,
141
- from: number,
142
- numBlocks: number,
143
- recipients: AztecAddress[],
144
- ): Promise<T[]>;
205
+ eventFilter: PrivateEventFilter,
206
+ ): Promise<PrivateEvent<T>[]>;
145
207
  getChainInfo(): Promise<ChainInfo>;
146
- getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
208
+ getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
209
+ getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
147
210
  registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
148
211
  getAddressBook(): Promise<Aliased<AztecAddress>[]>;
149
212
  getAccounts(): Promise<Aliased<AztecAddress>[]>;
@@ -155,9 +218,12 @@ export type Wallet = {
155
218
  simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
156
219
  simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
157
220
  profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
158
- sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
159
- createAuthWit(from: AztecAddress, messageHashOrIntent: Fr | IntentInnerHash | CallIntent): Promise<AuthWitness>;
160
- 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>>;
161
227
  };
162
228
 
163
229
  export const FunctionCallSchema = z.object({
@@ -195,11 +261,19 @@ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
195
261
  estimateGas: optional(z.boolean()),
196
262
  });
197
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
+
198
271
  export const SendOptionsSchema = z.object({
199
272
  from: schemas.AztecAddress,
200
273
  authWitnesses: optional(z.array(AuthWitness.schema)),
201
274
  capsules: optional(z.array(Capsule.schema)),
202
275
  fee: optional(GasSettingsOptionSchema),
276
+ wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
203
277
  });
204
278
 
205
279
  export const SimulateOptionsSchema = z.object({
@@ -218,7 +292,6 @@ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
218
292
  });
219
293
 
220
294
  export const MessageHashOrIntentSchema = z.union([
221
- schemas.Fr,
222
295
  z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
223
296
  z.object({
224
297
  caller: schemas.AztecAddress,
@@ -226,59 +299,55 @@ export const MessageHashOrIntentSchema = z.union([
226
299
  }),
227
300
  ]);
228
301
 
229
- export const BatchedMethodSchema = z.union([
230
- z.object({
231
- name: z.literal('registerSender'),
232
- args: z.tuple([schemas.AztecAddress, optional(z.string())]),
233
- }),
234
- z.object({
235
- name: z.literal('registerContract'),
236
- args: z.tuple([ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
237
- }),
238
- z.object({
239
- name: z.literal('sendTx'),
240
- args: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]),
241
- }),
242
- z.object({
243
- name: z.literal('simulateUtility'),
244
- args: z.tuple([FunctionCallSchema, optional(z.array(AuthWitness.schema))]),
245
- }),
302
+ export const EventMetadataDefinitionSchema = z.object({
303
+ eventSelector: schemas.EventSelector,
304
+ abiType: AbiTypeSchema,
305
+ fieldNames: z.array(z.string()),
306
+ });
307
+
308
+ export const PrivateEventSchema: z.ZodType<any> = zodFor<PrivateEvent<AbiDecoded>>()(
246
309
  z.object({
247
- name: z.literal('simulateTx'),
248
- args: z.tuple([ExecutionPayloadSchema, SimulateOptionsSchema]),
310
+ event: AbiDecodedSchema,
311
+ metadata: inTxSchema(),
249
312
  }),
250
- ]);
313
+ );
314
+
315
+ export const PrivateEventFilterSchema = z.object({
316
+ contractAddress: schemas.AztecAddress,
317
+ scopes: z.array(schemas.AztecAddress),
318
+ txHash: optional(TxHash.schema),
319
+ fromBlock: optional(BlockNumberPositiveSchema),
320
+ toBlock: optional(BlockNumberPositiveSchema),
321
+ });
251
322
 
252
323
  export const ContractMetadataSchema = z.object({
253
- contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
324
+ instance: optional(ContractInstanceWithAddressSchema),
254
325
  isContractInitialized: z.boolean(),
255
326
  isContractPublished: z.boolean(),
256
- }) satisfies ZodFor<ContractMetadata>;
327
+ isContractUpdated: z.boolean(),
328
+ updatedContractClassId: optional(schemas.Fr),
329
+ });
257
330
 
258
331
  export const ContractClassMetadataSchema = z.object({
259
- contractClass: z.union([ContractClassWithIdSchema, z.undefined()]),
332
+ isArtifactRegistered: z.boolean(),
260
333
  isContractClassPubliclyRegistered: z.boolean(),
261
- artifact: z.union([ContractArtifactSchema, z.undefined()]),
262
- }) satisfies ZodFor<ContractClassMetadata>;
263
-
264
- export const EventMetadataDefinitionSchema = z.object({
265
- eventSelector: schemas.EventSelector,
266
- abiType: AbiTypeSchema,
267
- fieldNames: z.array(z.string()),
268
334
  });
269
335
 
270
- export const WalletSchema: ApiSchemaFor<Wallet> = {
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 = {
271
341
  getChainInfo: z
272
342
  .function()
273
343
  .args()
274
344
  .returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
275
- getContractClassMetadata: z.function().args(schemas.Fr, optional(z.boolean())).returns(ContractClassMetadataSchema),
276
345
  getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
277
- getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
346
+ getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
278
347
  getPrivateEvents: z
279
348
  .function()
280
- .args(schemas.AztecAddress, EventMetadataDefinitionSchema, z.number(), z.number(), z.array(schemas.AztecAddress))
281
- .returns(z.array(AbiDecodedSchema)),
349
+ .args(EventMetadataDefinitionSchema, PrivateEventFilterSchema)
350
+ .returns(z.array(PrivateEventSchema)),
282
351
  registerSender: z.function().args(schemas.AztecAddress, optional(z.string())).returns(schemas.AztecAddress),
283
352
  getAddressBook: z
284
353
  .function()
@@ -298,21 +367,51 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
298
367
  .args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
299
368
  .returns(UtilitySimulationResult.schema),
300
369
  profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
301
- 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])),
302
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,
303
415
  // @ts-expect-error - ApiSchemaFor cannot properly type generic methods with readonly arrays
304
- batch: z
305
- .function()
306
- .args(z.array(BatchedMethodSchema))
307
- .returns(
308
- z.array(
309
- z.discriminatedUnion('name', [
310
- z.object({ name: z.literal('registerSender'), result: schemas.AztecAddress }),
311
- z.object({ name: z.literal('registerContract'), result: ContractInstanceWithAddressSchema }),
312
- z.object({ name: z.literal('sendTx'), result: TxHash.schema }),
313
- z.object({ name: z.literal('simulateUtility'), result: UtilitySimulationResult.schema }),
314
- z.object({ name: z.literal('simulateTx'), result: TxSimulationResult.schema }),
315
- ]),
316
- ),
317
- ),
416
+ batch: z.function().args(z.array(BatchedMethodSchema)).returns(z.array(BatchedResultSchema)),
318
417
  };
@@ -1,19 +0,0 @@
1
- import type { AuthWitnessProvider, EntrypointInterface } from '@aztec/entrypoints/interfaces';
2
- import type { Fr } from '@aztec/foundation/fields';
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWNjb3VudC9pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUM5RixPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUNuRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUk5RDs7O0dBR0c7QUFDSCxNQUFNLFdBQVcsZ0JBQWlCLFNBQVEsbUJBQW1CLEVBQUUsbUJBQW1CO0lBQ2hGLHFEQUFxRDtJQUNyRCxrQkFBa0IsSUFBSSxlQUFlLENBQUM7SUFFdEMsNENBQTRDO0lBQzVDLFVBQVUsSUFBSSxZQUFZLENBQUM7SUFFM0IsNENBQTRDO0lBQzVDLFVBQVUsSUFBSSxFQUFFLENBQUM7SUFFakIsa0RBQWtEO0lBQ2xELFVBQVUsSUFBSSxFQUFFLENBQUM7Q0FDbEIifQ==
@@ -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,0BAA0B,CAAC;AACnD,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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X3NlbnRfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdC9kZXBsb3lfc2VudF90eC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN4RCxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztB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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,51 +0,0 @@
1
- import type { FieldsOf } from '@aztec/foundation/types';
2
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
- import { TxHash, type TxReceipt } from '@aztec/stdlib/tx';
4
- import type { Wallet } from '../wallet/wallet.js';
5
- /** Options related to waiting for a tx. */
6
- export type WaitOpts = {
7
- /** 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. */
8
- ignoreDroppedReceiptsFor?: number;
9
- /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
10
- timeout?: number;
11
- /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
12
- interval?: number;
13
- /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
14
- dontThrowOnRevert?: boolean;
15
- };
16
- export declare const DefaultWaitOpts: WaitOpts;
17
- /**
18
- * The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch
19
- * its hash, receipt, and mining status.
20
- */
21
- export declare class SentTx {
22
- protected walletOrNode: Wallet | AztecNode;
23
- protected sendTxPromise: Promise<void>;
24
- protected sendTxError?: Error;
25
- protected txHash?: TxHash;
26
- constructor(walletOrNode: Wallet | AztecNode, sendTx: () => Promise<TxHash>);
27
- /**
28
- * Retrieves the transaction hash of the SentTx instance.
29
- * The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.
30
- *
31
- * @returns A promise that resolves to the transaction hash of the SentTx instance.
32
- * TODO(#7717): Don't throw here.
33
- */
34
- getTxHash(): Promise<TxHash>;
35
- /**
36
- * Retrieve the transaction receipt associated with the current SentTx instance.
37
- * The function fetches the transaction hash using 'getTxHash' and then queries
38
- * the PXE to get the corresponding transaction receipt.
39
- *
40
- * @returns A promise that resolves to a TxReceipt object representing the fetched transaction receipt.
41
- */
42
- getReceipt(): Promise<TxReceipt>;
43
- /**
44
- * Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.
45
- * @param opts - Options for configuring the waiting for the tx to be mined.
46
- * @returns The transaction receipt.
47
- */
48
- wait(opts?: WaitOpts): Promise<FieldsOf<TxReceipt>>;
49
- protected waitForReceipt(opts?: WaitOpts): Promise<TxReceipt>;
50
- }
51
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VudF90eC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0L3NlbnRfdHgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDeEQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLE1BQU0sRUFBRSxLQUFLLFNBQVMsRUFBWSxNQUFNLGtCQUFrQixDQUFDO0FBRXBFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRWxELDJDQUEyQztBQUMzQyxNQUFNLE1BQU0sUUFBUSxHQUFHO0lBQ3JCLGdLQUFnSztJQUNoSyx3QkFBd0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNsQyw2RkFBNkY7SUFDN0YsT0FBTyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2pCLHNHQUFzRztJQUN0RyxRQUFRLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDbEIsMEhBQTBIO0lBQzFILGlCQUFpQixDQUFDLE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