@aztec/aztec.js 0.0.1-commit.2ed92850 → 0.0.1-commit.3469e52

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 (86) hide show
  1. package/dest/api/block.d.ts +2 -2
  2. package/dest/api/block.d.ts.map +1 -1
  3. package/dest/api/block.js +1 -1
  4. package/dest/api/contract.d.ts +10 -16
  5. package/dest/api/contract.d.ts.map +1 -1
  6. package/dest/api/contract.js +8 -14
  7. package/dest/api/node.d.ts +4 -8
  8. package/dest/api/node.d.ts.map +1 -1
  9. package/dest/api/node.js +3 -7
  10. package/dest/api/tx.d.ts +2 -2
  11. package/dest/api/tx.d.ts.map +1 -1
  12. package/dest/api/tx.js +1 -1
  13. package/dest/api/wallet.d.ts +2 -2
  14. package/dest/api/wallet.d.ts.map +1 -1
  15. package/dest/api/wallet.js +1 -1
  16. package/dest/contract/base_contract_interaction.d.ts +10 -8
  17. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  18. package/dest/contract/base_contract_interaction.js +17 -5
  19. package/dest/contract/deploy_method.d.ts +16 -63
  20. package/dest/contract/deploy_method.d.ts.map +1 -1
  21. package/dest/contract/deploy_method.js +19 -36
  22. package/dest/contract/deploy_sent_tx.d.ts +48 -0
  23. package/dest/contract/deploy_sent_tx.d.ts.map +1 -0
  24. package/dest/contract/deploy_sent_tx.js +46 -0
  25. package/dest/contract/interaction_options.d.ts +5 -42
  26. package/dest/contract/interaction_options.d.ts.map +1 -1
  27. package/dest/contract/interaction_options.js +1 -8
  28. package/dest/contract/protocol_contracts/auth-registry.d.ts +3 -3
  29. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -1
  30. package/dest/contract/protocol_contracts/auth-registry.js +14 -1
  31. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +3 -3
  32. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
  33. package/dest/contract/protocol_contracts/contract-class-registry.js +14 -1
  34. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +3 -3
  35. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -1
  36. package/dest/contract/protocol_contracts/contract-instance-registry.js +14 -1
  37. package/dest/contract/protocol_contracts/fee-juice.d.ts +3 -3
  38. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -1
  39. package/dest/contract/protocol_contracts/fee-juice.js +14 -1
  40. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +3 -3
  41. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -1
  42. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +14 -1
  43. package/dest/contract/protocol_contracts/public-checks.d.ts +3 -3
  44. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -1
  45. package/dest/contract/protocol_contracts/public-checks.js +14 -1
  46. package/dest/contract/sent_tx.d.ts +50 -0
  47. package/dest/contract/sent_tx.d.ts.map +1 -0
  48. package/dest/contract/sent_tx.js +90 -0
  49. package/dest/contract/wait_for_proven.js +1 -1
  50. package/dest/utils/authwit.d.ts +6 -6
  51. package/dest/utils/authwit.d.ts.map +1 -1
  52. package/dest/utils/authwit.js +6 -2
  53. package/dest/utils/node.d.ts +1 -12
  54. package/dest/utils/node.d.ts.map +1 -1
  55. package/dest/utils/node.js +0 -46
  56. package/dest/wallet/deploy_account_method.d.ts +5 -19
  57. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  58. package/dest/wallet/wallet.d.ts +18 -63
  59. package/dest/wallet/wallet.d.ts.map +1 -1
  60. package/dest/wallet/wallet.js +3 -16
  61. package/package.json +9 -9
  62. package/src/api/block.ts +1 -1
  63. package/src/api/contract.ts +7 -22
  64. package/src/api/node.ts +3 -7
  65. package/src/api/tx.ts +0 -2
  66. package/src/api/wallet.ts +0 -5
  67. package/src/contract/base_contract_interaction.ts +15 -27
  68. package/src/contract/deploy_method.ts +23 -115
  69. package/src/contract/deploy_sent_tx.ts +75 -0
  70. package/src/contract/interaction_options.ts +4 -49
  71. package/src/contract/protocol_contracts/auth-registry.ts +12 -3
  72. package/src/contract/protocol_contracts/contract-class-registry.ts +12 -3
  73. package/src/contract/protocol_contracts/contract-instance-registry.ts +12 -3
  74. package/src/contract/protocol_contracts/fee-juice.ts +12 -3
  75. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +12 -3
  76. package/src/contract/protocol_contracts/public-checks.ts +12 -3
  77. package/src/contract/sent_tx.ts +129 -0
  78. package/src/contract/wait_for_proven.ts +1 -1
  79. package/src/utils/authwit.ts +4 -16
  80. package/src/utils/node.ts +0 -62
  81. package/src/wallet/deploy_account_method.ts +4 -19
  82. package/src/wallet/wallet.ts +11 -31
  83. package/dest/contract/wait_opts.d.ts +0 -16
  84. package/dest/contract/wait_opts.d.ts.map +0 -1
  85. package/dest/contract/wait_opts.js +0 -5
  86. package/src/contract/wait_opts.ts +0 -21
@@ -0,0 +1,129 @@
1
+ import { promiseWithResolvers } from '@aztec/foundation/promise';
2
+ import { retryUntil } from '@aztec/foundation/retry';
3
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
+ import { TxHash, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
5
+
6
+ import type { Wallet } from '../wallet/wallet.js';
7
+
8
+ /** Options related to waiting for a tx. */
9
+ export type WaitOpts = {
10
+ /** 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. */
11
+ ignoreDroppedReceiptsFor?: number;
12
+ /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
13
+ timeout?: number;
14
+ /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
15
+ interval?: number;
16
+ /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
17
+ dontThrowOnRevert?: boolean;
18
+ };
19
+
20
+ export const DefaultWaitOpts: WaitOpts = {
21
+ ignoreDroppedReceiptsFor: 5,
22
+ timeout: 300,
23
+ interval: 1,
24
+ };
25
+
26
+ /**
27
+ * The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch
28
+ * its hash, receipt, and mining status.
29
+ */
30
+ export class SentTx {
31
+ protected sendTxPromise: Promise<void>;
32
+ protected sendTxError?: Error;
33
+ protected txHash?: TxHash;
34
+
35
+ constructor(
36
+ protected walletOrNode: Wallet | AztecNode,
37
+ sendTx: () => Promise<TxHash>,
38
+ ) {
39
+ const { promise, resolve } = promiseWithResolvers<void>();
40
+ this.sendTxPromise = promise;
41
+ sendTx()
42
+ .then(txHash => {
43
+ this.txHash = txHash;
44
+ resolve();
45
+ })
46
+ .catch(err => {
47
+ this.sendTxError = err;
48
+ // Calling resolve instead of reject here because we want to throw the error when getTxHash is called.
49
+ resolve();
50
+ });
51
+ }
52
+
53
+ /**
54
+ * Retrieves the transaction hash of the SentTx instance.
55
+ * The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.
56
+ *
57
+ * @returns A promise that resolves to the transaction hash of the SentTx instance.
58
+ * TODO(#7717): Don't throw here.
59
+ */
60
+ public async getTxHash(): Promise<TxHash> {
61
+ // Make sure sendTx has been resolved, which can be triggered when it returns a txHash or when it throws an error.
62
+ await this.sendTxPromise;
63
+
64
+ // If sendTx threw an error, throw it.
65
+ if (this.sendTxError) {
66
+ throw this.sendTxError;
67
+ }
68
+
69
+ // sendTx returned a txHash if it's been resolved and no error was set.
70
+ return Promise.resolve(this.txHash!);
71
+ }
72
+
73
+ /**
74
+ * Retrieve the transaction receipt associated with the current SentTx instance.
75
+ * The function fetches the transaction hash using 'getTxHash' and then queries
76
+ * the PXE to get the corresponding transaction receipt.
77
+ *
78
+ * @returns A promise that resolves to a TxReceipt object representing the fetched transaction receipt.
79
+ */
80
+ public async getReceipt(): Promise<TxReceipt> {
81
+ const txHash = await this.getTxHash();
82
+ return await this.walletOrNode.getTxReceipt(txHash);
83
+ }
84
+
85
+ /**
86
+ * Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.
87
+ * @param opts - Options for configuring the waiting for the tx to be mined.
88
+ * @returns The transaction receipt.
89
+ */
90
+ public async wait(opts?: WaitOpts): Promise<TxReceipt> {
91
+ const receipt = await this.waitForReceipt(opts);
92
+ if (receipt.status !== TxStatus.SUCCESS && !opts?.dontThrowOnRevert) {
93
+ throw new Error(
94
+ `Transaction ${(await this.getTxHash()).toString()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`,
95
+ );
96
+ }
97
+ return receipt;
98
+ }
99
+
100
+ protected async waitForReceipt(opts?: WaitOpts): Promise<TxReceipt> {
101
+ const txHash = await this.getTxHash();
102
+ const startTime = Date.now();
103
+ const ignoreDroppedReceiptsFor = opts?.ignoreDroppedReceiptsFor ?? DefaultWaitOpts.ignoreDroppedReceiptsFor;
104
+
105
+ return await retryUntil(
106
+ async () => {
107
+ const txReceipt = await this.walletOrNode.getTxReceipt(txHash);
108
+ // If receipt is not yet available, try again
109
+ if (txReceipt.status === TxStatus.PENDING) {
110
+ return undefined;
111
+ }
112
+ // If the tx was "dropped", either return it or ignore based on timing.
113
+ // We can ignore it at first because the transaction may have been sent to node 1, and now we're asking node 2 for the receipt.
114
+ // If we don't allow a short grace period, we could incorrectly return a TxReceipt with status DROPPED.
115
+ if (txReceipt.status === TxStatus.DROPPED) {
116
+ const elapsedSeconds = (Date.now() - startTime) / 1000;
117
+ if (!ignoreDroppedReceiptsFor || elapsedSeconds > ignoreDroppedReceiptsFor) {
118
+ return txReceipt;
119
+ }
120
+ return undefined;
121
+ }
122
+ return txReceipt;
123
+ },
124
+ 'isMined',
125
+ opts?.timeout ?? DefaultWaitOpts.timeout,
126
+ opts?.interval ?? DefaultWaitOpts.interval,
127
+ );
128
+ }
129
+ }
@@ -2,7 +2,7 @@ import { retryUntil } from '@aztec/foundation/retry';
2
2
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
3
  import type { TxReceipt } from '@aztec/stdlib/tx';
4
4
 
5
- import { DefaultWaitOpts } from './wait_opts.js';
5
+ import { DefaultWaitOpts } from './sent_tx.js';
6
6
 
7
7
  /**
8
8
  * Options for waiting for a transaction to be proven.
@@ -5,18 +5,16 @@ import { type ABIParameterVisibility, type FunctionAbi, type FunctionCall, Funct
5
5
  import { AuthWitness, computeInnerAuthWitHash, computeOuterAuthWitHash } from '@aztec/stdlib/auth-witness';
6
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
7
  import { computeVarArgsHash } from '@aztec/stdlib/hash';
8
- import type { TxHash, TxProfileResult, TxReceipt } from '@aztec/stdlib/tx';
8
+ import type { TxProfileResult } from '@aztec/stdlib/tx';
9
9
 
10
10
  import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
11
11
  import type {
12
- InteractionWaitOptions,
13
12
  ProfileInteractionOptions,
14
13
  SendInteractionOptions,
15
- SendInteractionOptionsWithoutWait,
16
- SendReturn,
17
14
  SimulateInteractionOptions,
18
15
  SimulationReturn,
19
16
  } from '../contract/interaction_options.js';
17
+ import type { SentTx } from '../contract/sent_tx.js';
20
18
  import type { Wallet } from '../wallet/index.js';
21
19
 
22
20
  /** Intent with an inner hash */
@@ -288,19 +286,9 @@ export class SetPublicAuthwitContractInteraction extends ContractFunctionInterac
288
286
  * Overrides the send method, adding the sender of the authwit (authorizer) as from
289
287
  * and preventing misuse
290
288
  * @param options - An optional object containing 'fee' options information
291
- * @returns A TxReceipt (if wait is true/undefined) or TxHash (if wait is false)
289
+ * @returns A SentTx instance for tracking the transaction status and information.
292
290
  */
293
- // Overload for when wait is not specified at all - returns TxReceipt
294
- public override send(options?: Omit<SendInteractionOptionsWithoutWait, 'from'>): Promise<TxReceipt>;
295
- // Generic overload for explicit wait values
296
- // eslint-disable-next-line jsdoc/require-jsdoc
297
- public override send<W extends InteractionWaitOptions>(
298
- options?: Omit<SendInteractionOptions<W>, 'from'>,
299
- ): Promise<SendReturn<W>>;
300
- // eslint-disable-next-line jsdoc/require-jsdoc
301
- public override send(
302
- options?: Omit<SendInteractionOptions<InteractionWaitOptions>, 'from'>,
303
- ): Promise<TxReceipt | TxHash> {
291
+ public override send(options: Omit<SendInteractionOptions, 'from'> = {}): SentTx {
304
292
  return super.send({ ...options, from: this.from });
305
293
  }
306
294
 
package/src/utils/node.ts CHANGED
@@ -1,10 +1,6 @@
1
1
  import type { Logger } from '@aztec/foundation/log';
2
2
  import { retryUntil } from '@aztec/foundation/retry';
3
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
- import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
5
- import { SortedTxStatuses, TxStatus } from '@aztec/stdlib/tx';
6
-
7
- import { DefaultWaitOpts, type WaitOpts } from '../contract/wait_opts.js';
8
4
 
9
5
  export const waitForNode = async (node: AztecNode, logger?: Logger) => {
10
6
  await retryUntil(async () => {
@@ -20,62 +16,4 @@ export const waitForNode = async (node: AztecNode, logger?: Logger) => {
20
16
  }, 'RPC Get Node Info');
21
17
  };
22
18
 
23
- /** Returns true if the receipt status is at least the desired status level. */
24
- function hasReachedStatus(receipt: TxReceipt, desiredStatus: TxStatus): boolean {
25
- return SortedTxStatuses.indexOf(receipt.status) >= SortedTxStatuses.indexOf(desiredStatus);
26
- }
27
-
28
- /**
29
- * Waits for a transaction to be mined and returns its receipt.
30
- * @param node - The Aztec node to query for transaction status
31
- * @param txHash - The hash of the transaction to wait for
32
- * @param opts - Optional configuration for waiting behavior
33
- * @returns The transaction receipt
34
- * @throws If the transaction fails and dontThrowOnRevert is not set
35
- */
36
- export async function waitForTx(node: AztecNode, txHash: TxHash, opts?: WaitOpts): Promise<TxReceipt> {
37
- const startTime = Date.now();
38
- const ignoreDroppedReceiptsFor = opts?.ignoreDroppedReceiptsFor ?? DefaultWaitOpts.ignoreDroppedReceiptsFor;
39
- const waitForStatus = opts?.waitForStatus ?? TxStatus.CHECKPOINTED;
40
-
41
- const receipt = await retryUntil(
42
- async () => {
43
- const txReceipt = await node.getTxReceipt(txHash);
44
- // If receipt is not yet available, try again
45
- if (txReceipt.isPending()) {
46
- return undefined;
47
- }
48
- // If the tx was "dropped", either return it or ignore based on timing.
49
- // We can ignore it at first because the transaction may have been sent to node 1, and now we're asking node 2 for the receipt.
50
- // If we don't allow a short grace period, we could incorrectly return a TxReceipt with status DROPPED.
51
- if (txReceipt.isDropped()) {
52
- const elapsedSeconds = (Date.now() - startTime) / 1000;
53
- if (!ignoreDroppedReceiptsFor || elapsedSeconds > ignoreDroppedReceiptsFor) {
54
- return txReceipt;
55
- }
56
- return undefined;
57
- }
58
- // Check if the receipt has reached the desired status level
59
- if (!hasReachedStatus(txReceipt, waitForStatus)) {
60
- return undefined;
61
- }
62
- return txReceipt;
63
- },
64
- 'isMined',
65
- opts?.timeout ?? DefaultWaitOpts.timeout,
66
- opts?.interval ?? DefaultWaitOpts.interval,
67
- );
68
-
69
- if (!receipt.isMined()) {
70
- throw new Error(`Transaction ${txHash.toString()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`);
71
- }
72
- if (!receipt.hasExecutionSucceeded() && !opts?.dontThrowOnRevert) {
73
- throw new Error(
74
- `Transaction ${txHash.toString()} reverted: ${receipt.executionResult}. Reason: ${receipt.error ?? 'unknown'}`,
75
- );
76
- }
77
-
78
- return receipt;
79
- }
80
-
81
19
  export { createAztecNodeClient, type AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -10,11 +10,11 @@ import type { Contract } from '../contract/contract.js';
10
10
  import type { ContractBase } from '../contract/contract_base.js';
11
11
  import {
12
12
  DeployMethod,
13
- type DeployOptionsWithoutWait,
13
+ type DeployOptions,
14
14
  type RequestDeployOptions,
15
15
  type SimulateDeployOptions,
16
16
  } from '../contract/deploy_method.js';
17
- import type { FeePaymentMethodOption, InteractionWaitOptions } from '../contract/interaction_options.js';
17
+ import type { FeePaymentMethodOption } from '../contract/interaction_options.js';
18
18
  import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
19
19
  import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
20
20
  import type { Wallet } from './index.js';
@@ -36,27 +36,12 @@ export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAd
36
36
  fee?: DeployAccountFeePaymentMethodOption;
37
37
  };
38
38
 
39
- /**
40
- * Base configuration options for the send/prove methods without wait parameter. Omits:
41
- * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
42
- * - UniversalDeployment flag, since account contracts are always deployed with it set to true
43
- */
44
- export type DeployAccountOptionsWithoutWait = Omit<DeployOptionsWithoutWait, 'contractAddressSalt' | 'universalDeploy'>;
45
-
46
39
  /**
47
40
  * The configuration options for the send/prove methods. Omits:
48
41
  * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
49
42
  * - UniversalDeployment flag, since account contracts are always deployed with it set to true
50
43
  */
51
- export type DeployAccountOptions<W extends InteractionWaitOptions = undefined> = DeployAccountOptionsWithoutWait & {
52
- /**
53
- * Whether to wait for the transaction to be mined.
54
- * - undefined (default): wait with default options and return TxReceipt
55
- * - WaitOpts object: wait with custom options and return TxReceipt
56
- * - false: return txHash immediately without waiting
57
- */
58
- wait?: W;
59
- };
44
+ export type DeployAccountOptions = Omit<DeployOptions, 'contractAddressSalt' | 'universalDeploy'>;
60
45
 
61
46
  /**
62
47
  * The configuration options for the simulate method. Omits the contractAddressSalt, since
@@ -137,7 +122,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
137
122
  return mergeExecutionPayloads(executionPayloads);
138
123
  }
139
124
 
140
- override convertDeployOptionsToRequestOptions(options: DeployAccountOptionsWithoutWait): RequestDeployOptions {
125
+ override convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
141
126
  return {
142
127
  ...options,
143
128
  // Deployer is handled in the request method and forcibly set to undefined,
@@ -29,15 +29,12 @@ import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
29
29
 
30
30
  import { z } from 'zod';
31
31
 
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,
32
+ import type {
33
+ FeeEstimationOptions,
34
+ GasSettingsOption,
35
+ ProfileInteractionOptions,
36
+ SendInteractionOptions,
37
+ SimulateInteractionOptions,
41
38
  } from '../contract/interaction_options.js';
42
39
  import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
43
40
 
@@ -80,14 +77,9 @@ export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
80
77
  * a simplified version that only hints at the wallet whether the interaction contains a
81
78
  * fee payment method or not
82
79
  */
83
- export type SendOptions<W extends InteractionWaitOptions = undefined> = Omit<
84
- SendInteractionOptionsWithoutWait,
85
- 'fee'
86
- > & {
80
+ export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
87
81
  /** The fee options */
88
82
  fee?: GasSettingsOption;
89
- /** Whether to wait for the transaction to be mined */
90
- wait?: W;
91
83
  };
92
84
 
93
85
  /**
@@ -205,6 +197,7 @@ export type Wallet = {
205
197
  eventFilter: PrivateEventFilter,
206
198
  ): Promise<PrivateEvent<T>[]>;
207
199
  getChainInfo(): Promise<ChainInfo>;
200
+ getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
208
201
  getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
209
202
  getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
210
203
  registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
@@ -218,10 +211,7 @@ export type Wallet = {
218
211
  simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
219
212
  simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
220
213
  profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
221
- sendTx<W extends InteractionWaitOptions = undefined>(
222
- exec: ExecutionPayload,
223
- opts: SendOptions<W>,
224
- ): Promise<SendReturn<W>>;
214
+ sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
225
215
  createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
226
216
  batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
227
217
  };
@@ -261,19 +251,11 @@ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
261
251
  estimateGas: optional(z.boolean()),
262
252
  });
263
253
 
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
-
271
254
  export const SendOptionsSchema = z.object({
272
255
  from: schemas.AztecAddress,
273
256
  authWitnesses: optional(z.array(AuthWitness.schema)),
274
257
  capsules: optional(z.array(Capsule.schema)),
275
258
  fee: optional(GasSettingsOptionSchema),
276
- wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
277
259
  });
278
260
 
279
261
  export const SimulateOptionsSchema = z.object({
@@ -342,6 +324,7 @@ const WalletMethodSchemas = {
342
324
  .function()
343
325
  .args()
344
326
  .returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
327
+ getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
345
328
  getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
346
329
  getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
347
330
  getPrivateEvents: z
@@ -367,10 +350,7 @@ const WalletMethodSchemas = {
367
350
  .args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
368
351
  .returns(UtilitySimulationResult.schema),
369
352
  profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
370
- sendTx: z
371
- .function()
372
- .args(ExecutionPayloadSchema, SendOptionsSchema)
373
- .returns(z.union([TxHash.schema, TxReceipt.schema])),
353
+ sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
374
354
  createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
375
355
  };
376
356
 
@@ -1,16 +0,0 @@
1
- import type { TxStatus } from '@aztec/stdlib/tx';
2
- /** Options related to waiting for a tx. */
3
- export type WaitOpts = {
4
- /** 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. */
5
- ignoreDroppedReceiptsFor?: number;
6
- /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
7
- timeout?: number;
8
- /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
9
- interval?: number;
10
- /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
11
- dontThrowOnRevert?: boolean;
12
- /** The minimum inclusion status to wait for. If set, waits until the receipt reaches this status or higher. Defaults to CHECKPOINTED. */
13
- waitForStatus?: TxStatus;
14
- };
15
- export declare const DefaultWaitOpts: WaitOpts;
16
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FpdF9vcHRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3Qvd2FpdF9vcHRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRWpELDJDQUEyQztBQUMzQyxNQUFNLE1BQU0sUUFBUSxHQUFHO0lBQ3JCLGdLQUFnSztJQUNoSyx3QkFBd0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNsQyw2RkFBNkY7SUFDN0YsT0FBTyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2pCLHNHQUFzRztJQUN0RyxRQUFRLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDbEIsMEhBQTBIO0lBQzFILGlCQUFpQixDQUFDLEVBQUUsT0FBTyxDQUFDO0lBQzVCLHlJQUF5STtJQUN6SSxhQUFhLENBQUMsRUFBRSxRQUFRLENBQUM7Q0FDMUIsQ0FBQztBQUVGLGVBQU8sTUFBTSxlQUFlLEVBQUUsUUFJN0IsQ0FBQyJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"wait_opts.d.ts","sourceRoot":"","sources":["../../src/contract/wait_opts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,GAAG;IACrB,gKAAgK;IAChK,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0HAA0H;IAC1H,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,yIAAyI;IACzI,aAAa,CAAC,EAAE,QAAQ,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,QAI7B,CAAC"}
@@ -1,5 +0,0 @@
1
- export const DefaultWaitOpts = {
2
- ignoreDroppedReceiptsFor: 5,
3
- timeout: 300,
4
- interval: 1
5
- };
@@ -1,21 +0,0 @@
1
- import type { TxStatus } from '@aztec/stdlib/tx';
2
-
3
- /** Options related to waiting for a tx. */
4
- export type WaitOpts = {
5
- /** 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. */
6
- ignoreDroppedReceiptsFor?: number;
7
- /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
8
- timeout?: number;
9
- /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
10
- interval?: number;
11
- /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
12
- dontThrowOnRevert?: boolean;
13
- /** The minimum inclusion status to wait for. If set, waits until the receipt reaches this status or higher. Defaults to CHECKPOINTED. */
14
- waitForStatus?: TxStatus;
15
- };
16
-
17
- export const DefaultWaitOpts: WaitOpts = {
18
- ignoreDroppedReceiptsFor: 5,
19
- timeout: 300,
20
- interval: 1,
21
- };