@aztec/aztec.js 3.0.0-nightly.20251022 → 3.0.0-nightly.20251024

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 (114) hide show
  1. package/dest/account/account.d.ts +2 -2
  2. package/dest/account/account_contract.d.ts +1 -1
  3. package/dest/account/account_contract.d.ts.map +1 -1
  4. package/dest/api/abi.d.ts +1 -0
  5. package/dest/api/abi.d.ts.map +1 -1
  6. package/dest/api/addresses.d.ts +1 -0
  7. package/dest/api/addresses.d.ts.map +1 -1
  8. package/dest/api/addresses.js +1 -0
  9. package/dest/api/block.d.ts +3 -0
  10. package/dest/api/block.d.ts.map +1 -0
  11. package/dest/api/block.js +2 -0
  12. package/dest/api/contract.d.ts +2 -4
  13. package/dest/api/contract.d.ts.map +1 -1
  14. package/dest/api/contract.js +1 -2
  15. package/dest/api/crypto.d.ts +2 -0
  16. package/dest/api/crypto.d.ts.map +1 -0
  17. package/dest/api/crypto.js +1 -0
  18. package/dest/api/keys.d.ts +4 -0
  19. package/dest/api/keys.d.ts.map +1 -0
  20. package/dest/api/keys.js +3 -0
  21. package/dest/api/log.d.ts +1 -0
  22. package/dest/api/log.d.ts.map +1 -1
  23. package/dest/api/log.js +1 -0
  24. package/dest/api/messaging.d.ts +3 -0
  25. package/dest/api/messaging.d.ts.map +1 -0
  26. package/dest/api/messaging.js +2 -0
  27. package/dest/api/node.d.ts +21 -0
  28. package/dest/api/node.d.ts.map +1 -0
  29. package/dest/api/node.js +18 -0
  30. package/dest/api/note.d.ts +2 -0
  31. package/dest/api/note.d.ts.map +1 -0
  32. package/dest/api/note.js +1 -0
  33. package/dest/api/protocol.d.ts +3 -0
  34. package/dest/api/protocol.d.ts.map +1 -0
  35. package/dest/api/protocol.js +2 -0
  36. package/dest/api/trees.d.ts +3 -0
  37. package/dest/api/trees.d.ts.map +1 -0
  38. package/dest/api/trees.js +2 -0
  39. package/dest/api/tx.d.ts +2 -0
  40. package/dest/api/tx.d.ts.map +1 -0
  41. package/dest/api/tx.js +1 -0
  42. package/dest/api/utils.d.ts +10 -4
  43. package/dest/api/utils.d.ts.map +1 -1
  44. package/dest/api/utils.js +10 -3
  45. package/dest/api/wallet.d.ts +3 -1
  46. package/dest/api/wallet.d.ts.map +1 -1
  47. package/dest/api/wallet.js +3 -1
  48. package/dest/contract/base_contract_interaction.d.ts +3 -18
  49. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  50. package/dest/contract/base_contract_interaction.js +5 -26
  51. package/dest/contract/contract_base.d.ts +1 -1
  52. package/dest/contract/contract_base.d.ts.map +1 -1
  53. package/dest/contract/deploy_method.d.ts +2 -10
  54. package/dest/contract/deploy_method.d.ts.map +1 -1
  55. package/dest/contract/deploy_method.js +4 -16
  56. package/dest/contract/wait_for_proven.d.ts +1 -1
  57. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  58. package/dest/utils/authwit.d.ts +0 -7
  59. package/dest/utils/authwit.d.ts.map +1 -1
  60. package/dest/utils/authwit.js +0 -11
  61. package/dest/wallet/account_manager.d.ts +1 -1
  62. package/dest/wallet/account_manager.d.ts.map +1 -1
  63. package/dest/wallet/base_wallet.d.ts +11 -5
  64. package/dest/wallet/base_wallet.d.ts.map +1 -1
  65. package/dest/wallet/base_wallet.js +18 -9
  66. package/dest/wallet/wallet.d.ts +20 -10
  67. package/dest/wallet/wallet.d.ts.map +1 -1
  68. package/dest/wallet/wallet.js +17 -9
  69. package/package.json +21 -17
  70. package/src/api/abi.ts +11 -0
  71. package/src/api/addresses.ts +1 -0
  72. package/src/api/block.ts +2 -0
  73. package/src/api/contract.ts +9 -3
  74. package/src/api/crypto.ts +1 -0
  75. package/src/api/keys.ts +8 -0
  76. package/src/api/log.ts +1 -0
  77. package/src/api/messaging.ts +2 -0
  78. package/src/api/node.ts +20 -0
  79. package/src/api/note.ts +1 -0
  80. package/src/api/protocol.ts +2 -0
  81. package/src/api/trees.ts +2 -0
  82. package/src/api/tx.ts +11 -0
  83. package/src/api/utils.ts +12 -12
  84. package/src/api/wallet.ts +28 -7
  85. package/src/contract/base_contract_interaction.ts +6 -36
  86. package/src/contract/deploy_method.ts +6 -27
  87. package/src/contract/wait_for_proven.ts +1 -1
  88. package/src/utils/authwit.ts +0 -10
  89. package/src/wallet/base_wallet.ts +16 -12
  90. package/src/wallet/wallet.ts +29 -13
  91. package/dest/api/interfaces.d.ts +0 -2
  92. package/dest/api/interfaces.d.ts.map +0 -1
  93. package/dest/api/interfaces.js +0 -1
  94. package/dest/api/log_id.d.ts +0 -2
  95. package/dest/api/log_id.d.ts.map +0 -1
  96. package/dest/api/log_id.js +0 -1
  97. package/dest/api/tx_hash.d.ts +0 -2
  98. package/dest/api/tx_hash.d.ts.map +0 -1
  99. package/dest/api/tx_hash.js +0 -1
  100. package/dest/contract/deploy_proven_tx.d.ts +0 -21
  101. package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
  102. package/dest/contract/deploy_proven_tx.js +0 -21
  103. package/dest/contract/proven_tx.d.ts +0 -21
  104. package/dest/contract/proven_tx.d.ts.map +0 -1
  105. package/dest/contract/proven_tx.js +0 -23
  106. package/dest/index.d.ts +0 -58
  107. package/dest/index.d.ts.map +0 -1
  108. package/dest/index.js +0 -61
  109. package/src/api/interfaces.ts +0 -1
  110. package/src/api/log_id.ts +0 -1
  111. package/src/api/tx_hash.ts +0 -1
  112. package/src/contract/deploy_proven_tx.ts +0 -45
  113. package/src/contract/proven_tx.ts +0 -36
  114. package/src/index.ts +0 -84
@@ -1,11 +1,10 @@
1
1
  import type { ExecutionPayload } from '@aztec/entrypoints/payload';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
4
- import type { Capsule, TxProvingResult } from '@aztec/stdlib/tx';
4
+ import type { Capsule } from '@aztec/stdlib/tx';
5
5
 
6
6
  import type { Wallet } from '../wallet/wallet.js';
7
7
  import { type RequestInteractionOptions, type SendInteractionOptions, toSendOptions } from './interaction_options.js';
8
- import { ProvenTx } from './proven_tx.js';
9
8
  import { SentTx } from './sent_tx.js';
10
9
 
11
10
  /**
@@ -29,51 +28,22 @@ export abstract class BaseContractInteraction {
29
28
  */
30
29
  public abstract request(options?: RequestInteractionOptions): Promise<ExecutionPayload>;
31
30
 
32
- /**
33
- * Creates a transaction execution request, simulates and proves it. Differs from .prove in
34
- * that its result does not include the wallet nor the composed tx object, but only the proving result.
35
- * This object can then be used to either create a ProvenTx ready to be sent, or directly send the transaction.
36
- * @param options - optional arguments to be used in the creation of the transaction
37
- * @returns The proving result.
38
- */
39
- protected async proveInternal(options: SendInteractionOptions): Promise<TxProvingResult> {
40
- const executionPayload = await this.request(options);
41
- const proveOptions = await toSendOptions(options);
42
- return await this.wallet.proveTx(executionPayload, proveOptions);
43
- }
44
-
45
- // docs:start:prove
46
- /**
47
- * Proves a transaction execution request and returns a tx object ready to be sent.
48
- * @param options - optional arguments to be used in the creation of the transaction
49
- * @returns The resulting transaction
50
- */
51
- public async prove(options: SendInteractionOptions): Promise<ProvenTx> {
52
- // docs:end:prove
53
- const txProvingResult = await this.proveInternal(options);
54
- return new ProvenTx(
55
- this.wallet,
56
- await txProvingResult.toTx(),
57
- txProvingResult.getOffchainEffects(),
58
- txProvingResult.stats,
59
- );
60
- }
61
-
62
31
  // docs:start:send
63
32
  /**
64
33
  * Sends a transaction to the contract function with the specified options.
65
34
  * This function throws an error if called on a utility function.
66
35
  * It creates and signs the transaction if necessary, and returns a SentTx instance,
67
36
  * which can be used to track the transaction status, receipt, and events.
68
- * @param options - An optional object containing 'from' property representing
69
- * the AztecAddress of the sender. If not provided, the default address is used.
37
+ * @param options - An object containing 'from' property representing
38
+ * the AztecAddress of the sender and optional fee configuration
70
39
  * @returns A SentTx instance for tracking the transaction status and information.
71
40
  */
72
41
  public send(options: SendInteractionOptions): SentTx {
73
42
  // docs:end:send
74
43
  const sendTx = async () => {
75
- const txProvingResult = await this.proveInternal(options);
76
- return this.wallet.sendTx(await txProvingResult.toTx());
44
+ const executionPayload = await this.request(options);
45
+ const sendOptions = await toSendOptions(options);
46
+ return this.wallet.sendTx(executionPayload, sendOptions);
77
47
  };
78
48
  return new SentTx(this.wallet, sendTx);
79
49
  }
@@ -10,7 +10,7 @@ import {
10
10
  getContractInstanceFromInstantiationParams,
11
11
  } from '@aztec/stdlib/contract';
12
12
  import type { PublicKeys } from '@aztec/stdlib/keys';
13
- import { type Capsule, type TxProfileResult, TxProvingResult, collectOffchainEffects } from '@aztec/stdlib/tx';
13
+ import { type Capsule, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
14
14
 
15
15
  import { publishContractClass } from '../deployment/publish_class.js';
16
16
  import { publishInstance } from '../deployment/publish_instance.js';
@@ -19,7 +19,6 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
19
19
  import type { Contract } from './contract.js';
20
20
  import type { ContractBase } from './contract_base.js';
21
21
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
22
- import { DeployProvenTx } from './deploy_proven_tx.js';
23
22
  import { DeploySentTx } from './deploy_sent_tx.js';
24
23
  import { getGasLimits } from './get_gas_limits.js';
25
24
  import {
@@ -142,7 +141,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
142
141
  return finalExecutionPayload;
143
142
  }
144
143
 
145
- protected convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
144
+ convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
146
145
  return {
147
146
  ...options,
148
147
  deployer: !options?.universalDeploy ? options.from : undefined,
@@ -229,12 +228,6 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
229
228
  return mergeExecutionPayloads(executionsPayloads);
230
229
  }
231
230
 
232
- override async proveInternal(options: DeployOptions): Promise<TxProvingResult> {
233
- const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
234
- const proveOptions = await toSendOptions(options);
235
- return await this.wallet.proveTx(executionPayload, proveOptions);
236
- }
237
-
238
231
  /**
239
232
  * Send a contract deployment transaction (initialize and/or publish) using the provided options.
240
233
  * This function extends the 'send' method from the ContractFunctionInteraction class,
@@ -244,8 +237,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
244
237
  * @returns A SentTx object that returns the receipt and the deployed contract instance.
245
238
  */
246
239
  public override send(options: DeployOptions): DeploySentTx<TContract> {
247
- const sendTx = () => {
248
- return super.send(options).getTxHash();
240
+ const sendTx = async () => {
241
+ const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
242
+ const sendOptions = await toSendOptions(options);
243
+ return this.wallet.sendTx(executionPayload, sendOptions);
249
244
  };
250
245
  this.log.debug(`Sent deployment tx of ${this.artifact.name} contract`);
251
246
  return new DeploySentTx(this.wallet, sendTx, this.postDeployCtor, () => this.getInstance(options));
@@ -270,22 +265,6 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
270
265
  return this.instance;
271
266
  }
272
267
 
273
- /**
274
- * Prove the request.
275
- * @param options - initialization and publication options.
276
- * @returns The proven tx.
277
- */
278
- public override async prove(options: DeployOptions): Promise<DeployProvenTx<TContract>> {
279
- const txProvingResult = await this.proveInternal(options);
280
- return await DeployProvenTx.fromProvingResult(
281
- this.wallet,
282
- txProvingResult,
283
- this.postDeployCtor,
284
- () => this.getInstance(options),
285
- txProvingResult.stats,
286
- );
287
- }
288
-
289
268
  /**
290
269
  * Simulate the deployment
291
270
  *
@@ -1,7 +1,7 @@
1
1
  import { retryUntil } from '@aztec/foundation/retry';
2
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import type { TxReceipt } from '@aztec/stdlib/tx';
3
4
 
4
- import type { TxReceipt } from '../index.js';
5
5
  import { DefaultWaitOpts } from './sent_tx.js';
6
6
 
7
7
  /**
@@ -248,16 +248,6 @@ export class SetPublicAuthwitContractInteraction extends ContractFunctionInterac
248
248
  return new SetPublicAuthwitContractInteraction(wallet, from, messageHash, authorized);
249
249
  }
250
250
 
251
- /**
252
- * Overrides the proveInternal method, adding the sender of the authwit (authorizer) as from
253
- * and preventing misuse
254
- * @param options - An optional object containing additional configuration for the transaction.
255
- * @returns The result of the transaction as returned by the contract function.
256
- */
257
- public override proveInternal(options: Omit<SendInteractionOptions, 'from'>) {
258
- return super.proveInternal({ ...options, from: this.from });
259
- }
260
-
261
251
  /**
262
252
  * Overrides the simulate method, adding the sender of the authwit (authorizer) as from
263
253
  * and preventing misuse
@@ -25,11 +25,9 @@ import { SimulationError } from '@aztec/stdlib/errors';
25
25
  import { Gas, GasSettings } from '@aztec/stdlib/gas';
26
26
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
27
27
  import type {
28
- Tx,
29
28
  TxExecutionRequest,
30
29
  TxHash,
31
30
  TxProfileResult,
32
- TxProvingResult,
33
31
  TxReceipt,
34
32
  TxSimulationResult,
35
33
  UtilitySimulationResult,
@@ -89,7 +87,14 @@ export abstract class BaseWallet implements Wallet {
89
87
 
90
88
  abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
91
89
 
92
- async getSenders(): Promise<Aliased<AztecAddress>[]> {
90
+ /**
91
+ * Returns the list of aliased contacts associated with the wallet.
92
+ * This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
93
+ * - Senders: Addresses we check during synching in case they sent us notes,
94
+ * - Contacts: more general concept akin to a phone's contact list.
95
+ * @returns The aliased collection of AztecAddresses that form this wallet's address book
96
+ */
97
+ async getAddressBook(): Promise<Aliased<AztecAddress>[]> {
93
98
  const senders: AztecAddress[] = await this.pxe.getSenders();
94
99
  return senders.map(sender => ({ item: sender, alias: '' }));
95
100
  }
@@ -139,7 +144,8 @@ export abstract class BaseWallet implements Wallet {
139
144
 
140
145
  const fn = this[name] as (...args: any[]) => Promise<any>;
141
146
  const result = await fn.apply(this, args);
142
- results.push(result);
147
+ // Wrap result with method name for discriminated union deserialization
148
+ results.push({ name, result });
143
149
  }
144
150
  return results as BatchResults<T>;
145
151
  }
@@ -280,26 +286,24 @@ export abstract class BaseWallet implements Wallet {
280
286
  return this.pxe.profileTx(txRequest, opts.profileMode, opts.skipProofGeneration ?? true);
281
287
  }
282
288
 
283
- async proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxProvingResult> {
289
+ async sendTx(executionPayload: ExecutionPayload, opts: SendOptions): Promise<TxHash> {
284
290
  const fee = await this.getDefaultFeeOptions(opts.from, opts.fee);
285
- const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
286
- return this.pxe.proveTx(txRequest);
287
- }
288
-
289
- async sendTx(tx: Tx): Promise<TxHash> {
291
+ const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, opts.from, fee);
292
+ const provenTx = await this.pxe.proveTx(txRequest);
293
+ const tx = await provenTx.toTx();
290
294
  const txHash = tx.getTxHash();
291
295
  if (await this.aztecNode.getTxEffect(txHash)) {
292
296
  throw new Error(`A settled tx with equal hash ${txHash.toString()} exists.`);
293
297
  }
294
298
  this.log.debug(`Sending transaction ${txHash}`);
295
299
  await this.aztecNode.sendTx(tx).catch(err => {
296
- throw this.#contextualizeError(err, inspect(tx));
300
+ throw this.contextualizeError(err, inspect(tx));
297
301
  });
298
302
  this.log.info(`Sent transaction ${txHash}`);
299
303
  return txHash;
300
304
  }
301
305
 
302
- #contextualizeError(err: Error, ...context: string[]): Error {
306
+ protected contextualizeError(err: Error, ...context: string[]): Error {
303
307
  let contextStr = '';
304
308
  if (context.length > 0) {
305
309
  contextStr = `\nContext:\n${context.join('\n')}`;
@@ -25,10 +25,8 @@ import { AbiDecodedSchema, type ApiSchemaFor, type ZodFor, optional, schemas } f
25
25
  import {
26
26
  Capsule,
27
27
  HashedValues,
28
- Tx,
29
28
  TxHash,
30
29
  TxProfileResult,
31
- TxProvingResult,
32
30
  TxReceipt,
33
31
  TxSimulationResult,
34
32
  UtilitySimulationResult,
@@ -109,7 +107,7 @@ export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
109
107
  /**
110
108
  * Helper type that represents all methods that can be batched.
111
109
  */
112
- export type BatchableMethods = Pick<Wallet, 'registerContract' | 'proveTx' | 'registerSender'>;
110
+ export type BatchableMethods = Pick<Wallet, 'registerContract' | 'sendTx' | 'registerSender'>;
113
111
 
114
112
  /**
115
113
  * From the batchable methods, we create a type that represents a method call with its name and arguments.
@@ -129,10 +127,22 @@ export type BatchedMethodResult<T> =
129
127
  T extends BatchedMethod<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
130
128
 
131
129
  /**
132
- * Maps a tuple of BatchedMethod to a tuple of their return types
130
+ * Wrapper type for batch results that includes the method name for discriminated union deserialization.
131
+ * Each result is wrapped as \{ name: 'methodName', result: ActualResult \} to allow proper deserialization
132
+ * when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).
133
+ */
134
+ export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMethods>> = {
135
+ /** The method name */
136
+ name: T['name'];
137
+ /** The method result */
138
+ result: BatchedMethodResult<T>;
139
+ };
140
+
141
+ /**
142
+ * Maps a tuple of BatchedMethod to a tuple of their wrapped return types
133
143
  */
134
144
  export type BatchResults<T extends readonly BatchedMethod<keyof BatchableMethods>[]> = {
135
- [K in keyof T]: BatchedMethodResult<T[K]>;
145
+ [K in keyof T]: BatchedMethodResultWrapper<T[K]>;
136
146
  };
137
147
 
138
148
  /**
@@ -151,7 +161,7 @@ export type Wallet = {
151
161
  getChainInfo(): Promise<ChainInfo>;
152
162
  getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
153
163
  registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
154
- getSenders(): Promise<Aliased<AztecAddress>[]>;
164
+ getAddressBook(): Promise<Aliased<AztecAddress>[]>;
155
165
  getAccounts(): Promise<Aliased<AztecAddress>[]>;
156
166
  registerContract(
157
167
  instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
@@ -174,8 +184,7 @@ export type Wallet = {
174
184
  authwits?: AuthWitness[],
175
185
  ): Promise<UtilitySimulationResult>;
176
186
  profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
177
- proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxProvingResult>;
178
- sendTx(tx: Tx): Promise<TxHash>;
187
+ sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
179
188
  createAuthWit(
180
189
  from: AztecAddress,
181
190
  messageHashOrIntent: Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent,
@@ -276,7 +285,7 @@ export const BatchedMethodSchema = z.union([
276
285
  args: z.tuple([InstanceDataSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
277
286
  }),
278
287
  z.object({
279
- name: z.literal('proveTx'),
288
+ name: z.literal('sendTx'),
280
289
  args: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]),
281
290
  }),
282
291
  ]);
@@ -312,7 +321,7 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
312
321
  .args(schemas.AztecAddress, EventMetadataDefinitionSchema, z.number(), z.number(), z.array(schemas.AztecAddress))
313
322
  .returns(z.array(AbiDecodedSchema)),
314
323
  registerSender: z.function().args(schemas.AztecAddress, optional(z.string())).returns(schemas.AztecAddress),
315
- getSenders: z
324
+ getAddressBook: z
316
325
  .function()
317
326
  .args()
318
327
  .returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
@@ -330,12 +339,19 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
330
339
  .args(z.string(), z.array(z.any()), schemas.AztecAddress, optional(z.array(AuthWitness.schema)))
331
340
  .returns(UtilitySimulationResult.schema),
332
341
  profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
333
- proveTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxProvingResult.schema),
334
- sendTx: z.function().args(Tx.schema).returns(TxHash.schema),
342
+ sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
335
343
  createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
336
344
  // @ts-expect-error - ApiSchemaFor cannot properly type generic methods with readonly arrays
337
345
  batch: z
338
346
  .function()
339
347
  .args(z.array(BatchedMethodSchema))
340
- .returns(z.array(z.union([schemas.AztecAddress, ContractInstanceWithAddressSchema, TxProvingResult.schema]))),
348
+ .returns(
349
+ z.array(
350
+ z.discriminatedUnion('name', [
351
+ z.object({ name: z.literal('registerSender'), result: schemas.AztecAddress }),
352
+ z.object({ name: z.literal('registerContract'), result: ContractInstanceWithAddressSchema }),
353
+ z.object({ name: z.literal('sendTx'), result: TxHash.schema }),
354
+ ]),
355
+ ),
356
+ ),
341
357
  };
@@ -1,2 +0,0 @@
1
- export type { AztecNode } from '@aztec/stdlib/interfaces/client';
2
- //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/api/interfaces.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1 +0,0 @@
1
- export { };
@@ -1,2 +0,0 @@
1
- export { LogId } from '@aztec/stdlib/logs';
2
- //# sourceMappingURL=log_id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log_id.d.ts","sourceRoot":"","sources":["../../src/api/log_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- export { LogId } from '@aztec/stdlib/logs';
@@ -1,2 +0,0 @@
1
- export { TxHash } from '@aztec/stdlib/tx';
2
- //# sourceMappingURL=tx_hash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tx_hash.d.ts","sourceRoot":"","sources":["../../src/api/tx_hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- export { TxHash } from '@aztec/stdlib/tx';
@@ -1,21 +0,0 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
- import type { ProvingStats, TxProvingResult } from '@aztec/stdlib/tx';
4
- import type { Wallet } from '../wallet/wallet.js';
5
- import type { Contract } from './contract.js';
6
- import { DeploySentTx } from './deploy_sent_tx.js';
7
- import { ProvenTx } from './proven_tx.js';
8
- /**
9
- * A proven transaction that can be sent to the network. Returned by the `prove` method of a contract deployment.
10
- */
11
- export declare class DeployProvenTx<TContract extends Contract = Contract> extends ProvenTx {
12
- private postDeployCtor;
13
- private instanceGetter;
14
- private constructor();
15
- static fromProvingResult<TContract extends Contract = Contract>(wallet: Wallet, txProvingResult: TxProvingResult, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>, instanceGetter: () => Promise<ContractInstanceWithAddress>, stats?: ProvingStats): Promise<DeployProvenTx<TContract>>;
16
- /**
17
- * Sends the transaction to the network via the provided wallet.
18
- */
19
- send(): DeploySentTx<TContract>;
20
- }
21
- //# sourceMappingURL=deploy_proven_tx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy_proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAkB,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;GAEG;AACH,qBAAa,cAAc,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,QAAQ;IAK/E,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;IALxB,OAAO;WAWM,iBAAiB,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EAClE,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,EAC7E,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,EAC1D,KAAK,CAAC,EAAE,YAAY,GACnB,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAKrC;;OAEG;IACa,IAAI,IAAI,YAAY,CAAC,SAAS,CAAC;CAKhD"}
@@ -1,21 +0,0 @@
1
- import { DeploySentTx } from './deploy_sent_tx.js';
2
- import { ProvenTx } from './proven_tx.js';
3
- /**
4
- * A proven transaction that can be sent to the network. Returned by the `prove` method of a contract deployment.
5
- */ export class DeployProvenTx extends ProvenTx {
6
- postDeployCtor;
7
- instanceGetter;
8
- constructor(wallet, tx, offchainEffects, postDeployCtor, instanceGetter, stats){
9
- super(wallet, tx, offchainEffects, stats), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter;
10
- }
11
- static async fromProvingResult(wallet, txProvingResult, postDeployCtor, instanceGetter, stats) {
12
- const tx = await txProvingResult.toTx();
13
- return new DeployProvenTx(wallet, tx, txProvingResult.getOffchainEffects(), postDeployCtor, instanceGetter, stats);
14
- }
15
- /**
16
- * Sends the transaction to the network via the provided wallet.
17
- */ send() {
18
- const sendTx = ()=>this.wallet.sendTx(this);
19
- return new DeploySentTx(this.wallet, sendTx, this.postDeployCtor, this.instanceGetter);
20
- }
21
- }
@@ -1,21 +0,0 @@
1
- import { type OffchainEffect, type ProvingStats, Tx } from '@aztec/stdlib/tx';
2
- import type { Wallet } from '../wallet/wallet.js';
3
- import { SentTx } from './sent_tx.js';
4
- /**
5
- * A proven transaction that can be sent to the network. Returned by the `prove` method of a contract interaction.
6
- */
7
- export declare class ProvenTx extends Tx {
8
- #private;
9
- /** The offchain effects emitted during the execution of the transaction. */
10
- offchainEffects: OffchainEffect[];
11
- stats?: ProvingStats | undefined;
12
- constructor(wallet: Wallet, tx: Tx,
13
- /** The offchain effects emitted during the execution of the transaction. */
14
- offchainEffects: OffchainEffect[], stats?: ProvingStats | undefined);
15
- protected get wallet(): Wallet;
16
- /**
17
- * Sends the transaction to the network via the provided wallet.
18
- */
19
- send(): SentTx;
20
- }
21
- //# sourceMappingURL=proven_tx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,qBAAa,QAAS,SAAQ,EAAE;;IAM5B,4EAA4E;IACrE,eAAe,EAAE,cAAc,EAAE;IAEjC,KAAK,CAAC,EAAE,YAAY;gBAL3B,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,EAAE;IACN,4EAA4E;IACrE,eAAe,EAAE,cAAc,EAAE,EAEjC,KAAK,CAAC,EAAE,YAAY,YAAA;IAM7B,SAAS,KAAK,MAAM,IAAI,MAAM,CAE7B;IAED;;OAEG;IACI,IAAI,IAAI,MAAM;CAKtB"}
@@ -1,23 +0,0 @@
1
- import { Tx } from '@aztec/stdlib/tx';
2
- import { SentTx } from './sent_tx.js';
3
- /**
4
- * A proven transaction that can be sent to the network. Returned by the `prove` method of a contract interaction.
5
- */ export class ProvenTx extends Tx {
6
- offchainEffects;
7
- stats;
8
- #wallet;
9
- constructor(wallet, tx, /** The offchain effects emitted during the execution of the transaction. */ offchainEffects, // eslint-disable-next-line jsdoc/require-jsdoc
10
- stats){
11
- super(tx.txHash, tx.data, tx.clientIvcProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.offchainEffects = offchainEffects, this.stats = stats;
12
- this.#wallet = wallet;
13
- }
14
- get wallet() {
15
- return this.#wallet;
16
- }
17
- /**
18
- * Sends the transaction to the network via the provided wallet.
19
- */ send() {
20
- const sendTx = ()=>this.#wallet.sendTx(this);
21
- return new SentTx(this.#wallet, sendTx);
22
- }
23
- }
package/dest/index.d.ts DELETED
@@ -1,58 +0,0 @@
1
- /**
2
- * This is our public api.
3
- * Do NOT "export * from ..." here.
4
- * Everything here should be explicit, to ensure we can clearly see everything we're exposing to the world.
5
- * If it's exposed, people will use it, and then we can't remove/change the api without breaking client code.
6
- * At the time of writing we overexpose things that should only be internal.
7
- *
8
- * TODO: Review and narrow scope of public api.
9
- * We should also consider exposing subsections of the api via package.json exports, like we do with foundation.
10
- * This can allow consumers to import much smaller parts of the library to incur less overhead.
11
- * It will also allow web bundlers do perform intelligent chunking of bundles etc.
12
- * Some work as been done on this within the api folder, providing the alternative import style of e.g.:
13
- * ```typescript
14
- * import { TxHash } from '@aztec.js/tx_hash'
15
- * import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/aztec.js/abi';
16
- * import { AztecAddress } from '@aztec/aztec.js/addresses';
17
- * import { EthAddress } from '@aztec/aztec.js/eth_address';
18
- * ```
19
- *
20
- * TODO: Ultimately reimplement this mega exporter by mega exporting a granular api (then deprecate it).
21
- */
22
- export { Fq, Fr, Point, GrumpkinScalar } from '@aztec/foundation/fields';
23
- export { SiblingPath } from '@aztec/foundation/trees';
24
- export { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
25
- export { MerkleTreeId, merkleTreeIds } from '@aztec/stdlib/trees';
26
- export { type PublicKey, PublicKeys } from '@aztec/stdlib/keys';
27
- export { computeSecretHash } from '@aztec/stdlib/hash';
28
- export { computeAppNullifierSecretKey, deriveKeys, deriveMasterIncomingViewingSecretKey, deriveMasterNullifierSecretKey, } from '@aztec/stdlib/keys';
29
- export { getTimestampRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
30
- export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables, } from '@aztec/stdlib/tx';
31
- export { Body, L2Block } from '@aztec/stdlib/block';
32
- export { LogId, type LogFilter } from '@aztec/stdlib/logs';
33
- export { L1ToL2Message, L2Actor, L1Actor } from '@aztec/stdlib/messaging';
34
- export { UniqueNote, ExtendedNote, Comparator, Note } from '@aztec/stdlib/note';
35
- export { ProtocolContractAddress } from '@aztec/protocol-contracts';
36
- export { toBigIntBE } from '@aztec/foundation/bigint-buffer';
37
- export { sha256, Grumpkin, Schnorr } from '@aztec/foundation/crypto';
38
- export { makeFetch } from '@aztec/foundation/json-rpc/client';
39
- export { retry, retryUntil } from '@aztec/foundation/retry';
40
- export { to2Fields, toBigInt } from '@aztec/foundation/serialize';
41
- export { sleep } from '@aztec/foundation/sleep';
42
- export { elapsed } from '@aztec/foundation/timer';
43
- export { type FieldsOf } from '@aztec/foundation/types';
44
- export { fileURLToPath } from '@aztec/foundation/url';
45
- export * from './api/abi.js';
46
- export * from './api/authorization.js';
47
- export * from './api/account.js';
48
- export * from './api/addresses.js';
49
- export * from './api/deployment.js';
50
- export * from './api/ethereum.js';
51
- export * from './api/events.js';
52
- export * from './api/eth_address.js';
53
- export * from './api/fee.js';
54
- export * from './api/log.js';
55
- export * from './api/contract.js';
56
- export * from './api/utils.js';
57
- export * from './api/wallet.js';
58
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,4BAA4B,EAC5B,UAAU,EACV,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEhF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAKpE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAKtD,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
package/dest/index.js DELETED
@@ -1,61 +0,0 @@
1
- /**
2
- * This is our public api.
3
- * Do NOT "export * from ..." here.
4
- * Everything here should be explicit, to ensure we can clearly see everything we're exposing to the world.
5
- * If it's exposed, people will use it, and then we can't remove/change the api without breaking client code.
6
- * At the time of writing we overexpose things that should only be internal.
7
- *
8
- * TODO: Review and narrow scope of public api.
9
- * We should also consider exposing subsections of the api via package.json exports, like we do with foundation.
10
- * This can allow consumers to import much smaller parts of the library to incur less overhead.
11
- * It will also allow web bundlers do perform intelligent chunking of bundles etc.
12
- * Some work as been done on this within the api folder, providing the alternative import style of e.g.:
13
- * ```typescript
14
- * import { TxHash } from '@aztec.js/tx_hash'
15
- * import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/aztec.js/abi';
16
- * import { AztecAddress } from '@aztec/aztec.js/addresses';
17
- * import { EthAddress } from '@aztec/aztec.js/eth_address';
18
- * ```
19
- *
20
- * TODO: Ultimately reimplement this mega exporter by mega exporting a granular api (then deprecate it).
21
- */ export { Fq, Fr, Point, GrumpkinScalar } from '@aztec/foundation/fields';
22
- export { SiblingPath } from '@aztec/foundation/trees';
23
- export { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
24
- export { MerkleTreeId, merkleTreeIds } from '@aztec/stdlib/trees';
25
- export { PublicKeys } from '@aztec/stdlib/keys';
26
- export { computeSecretHash } from '@aztec/stdlib/hash';
27
- export { computeAppNullifierSecretKey, deriveKeys, deriveMasterIncomingViewingSecretKey, deriveMasterNullifierSecretKey } from '@aztec/stdlib/keys';
28
- export { getTimestampRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
29
- export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables } from '@aztec/stdlib/tx';
30
- export { Body, L2Block } from '@aztec/stdlib/block';
31
- export { LogId } from '@aztec/stdlib/logs';
32
- export { L1ToL2Message, L2Actor, L1Actor } from '@aztec/stdlib/messaging';
33
- export { UniqueNote, ExtendedNote, Comparator, Note } from '@aztec/stdlib/note';
34
- export { ProtocolContractAddress } from '@aztec/protocol-contracts';
35
- // TODO: These kinds of things have no place on our public api.
36
- // External devs will almost certainly have their own methods of doing these things.
37
- // If we want to use them in our own "aztec.js consuming code", import them from foundation as needed.
38
- export { toBigIntBE } from '@aztec/foundation/bigint-buffer';
39
- export { sha256, Grumpkin, Schnorr } from '@aztec/foundation/crypto';
40
- export { makeFetch } from '@aztec/foundation/json-rpc/client';
41
- export { retry, retryUntil } from '@aztec/foundation/retry';
42
- export { to2Fields, toBigInt } from '@aztec/foundation/serialize';
43
- export { sleep } from '@aztec/foundation/sleep';
44
- export { elapsed } from '@aztec/foundation/timer';
45
- export { fileURLToPath } from '@aztec/foundation/url';
46
- // Start of section that exports public api via granular api.
47
- // Here you *can* do `export *` as the granular api defacto exports things explicitly.
48
- // This entire index file will be deprecated at some point after we're satisfied.
49
- export * from './api/abi.js';
50
- export * from './api/authorization.js';
51
- export * from './api/account.js';
52
- export * from './api/addresses.js';
53
- export * from './api/deployment.js';
54
- export * from './api/ethereum.js';
55
- export * from './api/events.js';
56
- export * from './api/eth_address.js';
57
- export * from './api/fee.js';
58
- export * from './api/log.js';
59
- export * from './api/contract.js';
60
- export * from './api/utils.js';
61
- export * from './api/wallet.js';
@@ -1 +0,0 @@
1
- export type { AztecNode } from '@aztec/stdlib/interfaces/client';
package/src/api/log_id.ts DELETED
@@ -1 +0,0 @@
1
- export { LogId } from '@aztec/stdlib/logs';
@@ -1 +0,0 @@
1
- export { TxHash } from '@aztec/stdlib/tx';