@aztec/aztec.js 0.0.1-commit.3469e52 → 0.0.1-commit.59e663cd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/api/block.d.ts +2 -2
- package/dest/api/block.d.ts.map +1 -1
- package/dest/api/block.js +1 -1
- package/dest/api/contract.d.ts +16 -10
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +14 -8
- package/dest/api/node.d.ts +8 -4
- package/dest/api/node.d.ts.map +1 -1
- package/dest/api/node.js +7 -3
- package/dest/api/tx.d.ts +2 -2
- package/dest/api/tx.d.ts.map +1 -1
- package/dest/api/tx.js +1 -1
- package/dest/api/wallet.d.ts +2 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -1
- package/dest/contract/base_contract_interaction.d.ts +8 -10
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +5 -17
- package/dest/contract/deploy_method.d.ts +63 -16
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +36 -19
- package/dest/contract/interaction_options.d.ts +42 -5
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +8 -1
- package/dest/contract/protocol_contracts/auth-registry.d.ts +3 -3
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/auth-registry.js +1 -14
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +3 -3
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-class-registry.js +1 -14
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +3 -3
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/contract-instance-registry.js +1 -14
- package/dest/contract/protocol_contracts/fee-juice.d.ts +3 -3
- package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/fee-juice.js +1 -14
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +3 -3
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/multi-call-entrypoint.js +1 -14
- package/dest/contract/protocol_contracts/public-checks.d.ts +3 -3
- package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -1
- package/dest/contract/protocol_contracts/public-checks.js +1 -14
- package/dest/contract/wait_for_proven.js +1 -1
- package/dest/contract/wait_opts.d.ts +16 -0
- package/dest/contract/wait_opts.d.ts.map +1 -0
- package/dest/contract/wait_opts.js +5 -0
- package/dest/utils/authwit.d.ts +6 -6
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +2 -6
- package/dest/utils/node.d.ts +12 -1
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +46 -0
- package/dest/wallet/deploy_account_method.d.ts +19 -5
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/wallet.d.ts +63 -18
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +16 -3
- package/package.json +9 -9
- package/src/api/block.ts +1 -1
- package/src/api/contract.ts +22 -7
- package/src/api/node.ts +7 -3
- package/src/api/tx.ts +2 -0
- package/src/api/wallet.ts +5 -0
- package/src/contract/base_contract_interaction.ts +27 -15
- package/src/contract/deploy_method.ts +115 -23
- package/src/contract/interaction_options.ts +49 -4
- package/src/contract/protocol_contracts/auth-registry.ts +3 -12
- package/src/contract/protocol_contracts/contract-class-registry.ts +3 -12
- package/src/contract/protocol_contracts/contract-instance-registry.ts +3 -12
- package/src/contract/protocol_contracts/fee-juice.ts +3 -12
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +3 -12
- package/src/contract/protocol_contracts/public-checks.ts +3 -12
- package/src/contract/wait_for_proven.ts +1 -1
- package/src/contract/wait_opts.ts +21 -0
- package/src/utils/authwit.ts +16 -4
- package/src/utils/node.ts +62 -0
- package/src/wallet/deploy_account_method.ts +19 -4
- package/src/wallet/wallet.ts +32 -12
- package/dest/contract/deploy_sent_tx.d.ts +0 -48
- package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
- package/dest/contract/deploy_sent_tx.js +0 -46
- package/dest/contract/sent_tx.d.ts +0 -50
- package/dest/contract/sent_tx.d.ts.map +0 -1
- package/dest/contract/sent_tx.js +0 -90
- package/src/contract/deploy_sent_tx.ts +0 -75
- package/src/contract/sent_tx.ts +0 -129
|
@@ -172,18 +172,9 @@ const FeeJuiceContractArtifact: ContractArtifact = {
|
|
|
172
172
|
error_kind: 'string',
|
|
173
173
|
string: '0 has a square root; you cannot claim it is not square',
|
|
174
174
|
},
|
|
175
|
-
'9885968605480832328': {
|
|
176
|
-
error_kind: 'string',
|
|
177
|
-
string: 'Attempted to read past the length of a CapsuleArray',
|
|
178
|
-
},
|
|
179
175
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
180
176
|
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
181
|
-
'11021520179822076911': {
|
|
182
|
-
error_kind: 'string',
|
|
183
|
-
string: 'Attempted to delete past the length of a CapsuleArray',
|
|
184
|
-
},
|
|
185
177
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
186
|
-
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
187
178
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
188
179
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
189
180
|
'13557316507370296400': {
|
|
@@ -250,7 +241,7 @@ const FeeJuiceContractArtifact: ContractArtifact = {
|
|
|
250
241
|
{
|
|
251
242
|
...{
|
|
252
243
|
functionType: FunctionType.UTILITY,
|
|
253
|
-
name: '
|
|
244
|
+
name: 'sync_state',
|
|
254
245
|
isOnlySelf: false,
|
|
255
246
|
isStatic: false,
|
|
256
247
|
isInitializer: false,
|
|
@@ -460,7 +451,7 @@ export class FeeJuiceContract extends ContractBase {
|
|
|
460
451
|
/** public_dispatch(selector: field) */
|
|
461
452
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
462
453
|
|
|
463
|
-
/**
|
|
464
|
-
|
|
454
|
+
/** sync_state() */
|
|
455
|
+
sync_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
465
456
|
};
|
|
466
457
|
}
|
|
@@ -164,18 +164,9 @@ const MultiCallEntrypointContractArtifact: ContractArtifact = {
|
|
|
164
164
|
error_kind: 'string',
|
|
165
165
|
string: '0 has a square root; you cannot claim it is not square',
|
|
166
166
|
},
|
|
167
|
-
'9885968605480832328': {
|
|
168
|
-
error_kind: 'string',
|
|
169
|
-
string: 'Attempted to read past the length of a CapsuleArray',
|
|
170
|
-
},
|
|
171
167
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
172
168
|
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
173
|
-
'11021520179822076911': {
|
|
174
|
-
error_kind: 'string',
|
|
175
|
-
string: 'Attempted to delete past the length of a CapsuleArray',
|
|
176
|
-
},
|
|
177
169
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
178
|
-
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
179
170
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
180
171
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
181
172
|
'13557316507370296400': {
|
|
@@ -204,7 +195,7 @@ const MultiCallEntrypointContractArtifact: ContractArtifact = {
|
|
|
204
195
|
{
|
|
205
196
|
...{
|
|
206
197
|
functionType: FunctionType.UTILITY,
|
|
207
|
-
name: '
|
|
198
|
+
name: 'sync_state',
|
|
208
199
|
isOnlySelf: false,
|
|
209
200
|
isStatic: false,
|
|
210
201
|
isInitializer: false,
|
|
@@ -332,7 +323,7 @@ export class MultiCallEntrypointContract extends ContractBase {
|
|
|
332
323
|
/** public_dispatch(selector: field) */
|
|
333
324
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
334
325
|
|
|
335
|
-
/**
|
|
336
|
-
|
|
326
|
+
/** sync_state() */
|
|
327
|
+
sync_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
337
328
|
};
|
|
338
329
|
}
|
|
@@ -97,18 +97,9 @@ const PublicChecksContractArtifact: ContractArtifact = {
|
|
|
97
97
|
error_kind: 'string',
|
|
98
98
|
string: '0 has a square root; you cannot claim it is not square',
|
|
99
99
|
},
|
|
100
|
-
'9885968605480832328': {
|
|
101
|
-
error_kind: 'string',
|
|
102
|
-
string: 'Attempted to read past the length of a CapsuleArray',
|
|
103
|
-
},
|
|
104
100
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
105
101
|
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
106
|
-
'11021520179822076911': {
|
|
107
|
-
error_kind: 'string',
|
|
108
|
-
string: 'Attempted to delete past the length of a CapsuleArray',
|
|
109
|
-
},
|
|
110
102
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
111
|
-
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
112
103
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
113
104
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
114
105
|
'13557316507370296400': {
|
|
@@ -167,7 +158,7 @@ const PublicChecksContractArtifact: ContractArtifact = {
|
|
|
167
158
|
{
|
|
168
159
|
...{
|
|
169
160
|
functionType: FunctionType.UTILITY,
|
|
170
|
-
name: '
|
|
161
|
+
name: 'sync_state',
|
|
171
162
|
isOnlySelf: false,
|
|
172
163
|
isStatic: false,
|
|
173
164
|
isInitializer: false,
|
|
@@ -318,7 +309,7 @@ export class PublicChecksContract extends ContractBase {
|
|
|
318
309
|
/** public_dispatch(selector: field) */
|
|
319
310
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
320
311
|
|
|
321
|
-
/**
|
|
322
|
-
|
|
312
|
+
/** sync_state() */
|
|
313
|
+
sync_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
323
314
|
};
|
|
324
315
|
}
|
|
@@ -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 './
|
|
5
|
+
import { DefaultWaitOpts } from './wait_opts.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Options for waiting for a transaction to be proven.
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
package/src/utils/authwit.ts
CHANGED
|
@@ -5,16 +5,18 @@ 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 { TxProfileResult } from '@aztec/stdlib/tx';
|
|
8
|
+
import type { TxHash, TxProfileResult, TxReceipt } from '@aztec/stdlib/tx';
|
|
9
9
|
|
|
10
10
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
11
11
|
import type {
|
|
12
|
+
InteractionWaitOptions,
|
|
12
13
|
ProfileInteractionOptions,
|
|
13
14
|
SendInteractionOptions,
|
|
15
|
+
SendInteractionOptionsWithoutWait,
|
|
16
|
+
SendReturn,
|
|
14
17
|
SimulateInteractionOptions,
|
|
15
18
|
SimulationReturn,
|
|
16
19
|
} from '../contract/interaction_options.js';
|
|
17
|
-
import type { SentTx } from '../contract/sent_tx.js';
|
|
18
20
|
import type { Wallet } from '../wallet/index.js';
|
|
19
21
|
|
|
20
22
|
/** Intent with an inner hash */
|
|
@@ -286,9 +288,19 @@ export class SetPublicAuthwitContractInteraction extends ContractFunctionInterac
|
|
|
286
288
|
* Overrides the send method, adding the sender of the authwit (authorizer) as from
|
|
287
289
|
* and preventing misuse
|
|
288
290
|
* @param options - An optional object containing 'fee' options information
|
|
289
|
-
* @returns A
|
|
291
|
+
* @returns A TxReceipt (if wait is true/undefined) or TxHash (if wait is false)
|
|
290
292
|
*/
|
|
291
|
-
|
|
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> {
|
|
292
304
|
return super.send({ ...options, from: this.from });
|
|
293
305
|
}
|
|
294
306
|
|
package/src/utils/node.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
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';
|
|
4
8
|
|
|
5
9
|
export const waitForNode = async (node: AztecNode, logger?: Logger) => {
|
|
6
10
|
await retryUntil(async () => {
|
|
@@ -16,4 +20,62 @@ export const waitForNode = async (node: AztecNode, logger?: Logger) => {
|
|
|
16
20
|
}, 'RPC Get Node Info');
|
|
17
21
|
};
|
|
18
22
|
|
|
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
|
+
|
|
19
81
|
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
|
|
13
|
+
type DeployOptionsWithoutWait,
|
|
14
14
|
type RequestDeployOptions,
|
|
15
15
|
type SimulateDeployOptions,
|
|
16
16
|
} from '../contract/deploy_method.js';
|
|
17
|
-
import type { FeePaymentMethodOption } from '../contract/interaction_options.js';
|
|
17
|
+
import type { FeePaymentMethodOption, InteractionWaitOptions } 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,12 +36,27 @@ 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
|
+
|
|
39
46
|
/**
|
|
40
47
|
* The configuration options for the send/prove methods. Omits:
|
|
41
48
|
* - The contractAddressSalt, since for account contracts that is fixed in the constructor.
|
|
42
49
|
* - UniversalDeployment flag, since account contracts are always deployed with it set to true
|
|
43
50
|
*/
|
|
44
|
-
export type DeployAccountOptions =
|
|
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
|
+
};
|
|
45
60
|
|
|
46
61
|
/**
|
|
47
62
|
* The configuration options for the simulate method. Omits the contractAddressSalt, since
|
|
@@ -122,7 +137,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
122
137
|
return mergeExecutionPayloads(executionPayloads);
|
|
123
138
|
}
|
|
124
139
|
|
|
125
|
-
override convertDeployOptionsToRequestOptions(options:
|
|
140
|
+
override convertDeployOptionsToRequestOptions(options: DeployAccountOptionsWithoutWait): RequestDeployOptions {
|
|
126
141
|
return {
|
|
127
142
|
...options,
|
|
128
143
|
// Deployer is handled in the request method and forcibly set to undefined,
|
package/src/wallet/wallet.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
15
15
|
import { type ContractInstanceWithAddress, ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
|
|
16
16
|
import { Gas } from '@aztec/stdlib/gas';
|
|
17
17
|
import { AbiDecodedSchema, type ApiSchemaFor, optional, schemas, zodFor } from '@aztec/stdlib/schemas';
|
|
18
|
+
import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
|
|
18
19
|
import {
|
|
19
20
|
Capsule,
|
|
20
21
|
HashedValues,
|
|
@@ -25,16 +26,18 @@ import {
|
|
|
25
26
|
UtilitySimulationResult,
|
|
26
27
|
inTxSchema,
|
|
27
28
|
} from '@aztec/stdlib/tx';
|
|
28
|
-
import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
|
|
29
29
|
|
|
30
30
|
import { z } from 'zod';
|
|
31
31
|
|
|
32
|
-
import
|
|
33
|
-
FeeEstimationOptions,
|
|
34
|
-
GasSettingsOption,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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,
|
|
38
41
|
} from '../contract/interaction_options.js';
|
|
39
42
|
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
40
43
|
|
|
@@ -77,9 +80,14 @@ export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
|
|
|
77
80
|
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
78
81
|
* fee payment method or not
|
|
79
82
|
*/
|
|
80
|
-
export type SendOptions =
|
|
83
|
+
export type SendOptions<W extends InteractionWaitOptions = undefined> = Omit<
|
|
84
|
+
SendInteractionOptionsWithoutWait,
|
|
85
|
+
'fee'
|
|
86
|
+
> & {
|
|
81
87
|
/** The fee options */
|
|
82
88
|
fee?: GasSettingsOption;
|
|
89
|
+
/** Whether to wait for the transaction to be mined */
|
|
90
|
+
wait?: W;
|
|
83
91
|
};
|
|
84
92
|
|
|
85
93
|
/**
|
|
@@ -197,7 +205,6 @@ export type Wallet = {
|
|
|
197
205
|
eventFilter: PrivateEventFilter,
|
|
198
206
|
): Promise<PrivateEvent<T>[]>;
|
|
199
207
|
getChainInfo(): Promise<ChainInfo>;
|
|
200
|
-
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
201
208
|
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
202
209
|
getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
|
|
203
210
|
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
|
|
@@ -211,7 +218,10 @@ export type Wallet = {
|
|
|
211
218
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
212
219
|
simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
|
|
213
220
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
214
|
-
sendTx
|
|
221
|
+
sendTx<W extends InteractionWaitOptions = undefined>(
|
|
222
|
+
exec: ExecutionPayload,
|
|
223
|
+
opts: SendOptions<W>,
|
|
224
|
+
): Promise<SendReturn<W>>;
|
|
215
225
|
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
|
|
216
226
|
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
|
|
217
227
|
};
|
|
@@ -251,11 +261,19 @@ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
|
|
|
251
261
|
estimateGas: optional(z.boolean()),
|
|
252
262
|
});
|
|
253
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
|
+
|
|
254
271
|
export const SendOptionsSchema = z.object({
|
|
255
272
|
from: schemas.AztecAddress,
|
|
256
273
|
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
257
274
|
capsules: optional(z.array(Capsule.schema)),
|
|
258
275
|
fee: optional(GasSettingsOptionSchema),
|
|
276
|
+
wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
|
|
259
277
|
});
|
|
260
278
|
|
|
261
279
|
export const SimulateOptionsSchema = z.object({
|
|
@@ -324,7 +342,6 @@ const WalletMethodSchemas = {
|
|
|
324
342
|
.function()
|
|
325
343
|
.args()
|
|
326
344
|
.returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
|
|
327
|
-
getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
|
|
328
345
|
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
329
346
|
getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
|
|
330
347
|
getPrivateEvents: z
|
|
@@ -350,7 +367,10 @@ const WalletMethodSchemas = {
|
|
|
350
367
|
.args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
|
|
351
368
|
.returns(UtilitySimulationResult.schema),
|
|
352
369
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
353
|
-
sendTx: z
|
|
370
|
+
sendTx: z
|
|
371
|
+
.function()
|
|
372
|
+
.args(ExecutionPayloadSchema, SendOptionsSchema)
|
|
373
|
+
.returns(z.union([TxHash.schema, TxReceipt.schema])),
|
|
354
374
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
355
375
|
};
|
|
356
376
|
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X3NlbnRfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdC9kZXBsb3lfc2VudF90eC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN4RCxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzFFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN2RCxPQUFPLEVBQUUsTUFBTSxFQUFFLEtBQUssUUFBUSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBRXJELHNEQUFzRDtBQUN0RCxNQUFNLE1BQU0sZ0JBQWdCLEdBQUcsUUFBUSxHQUFHO0lBQ3hDLCtHQUErRztJQUMvRyxNQUFNLENBQUMsRUF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cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,EAGnE;IAED;;;OAGG;IACU,WAAW,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAE/D;IAED;;;;OAIG;IACU,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAIjE;IAED;;;;OAIG;IACmB,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAUvF;CACF"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { SentTx } from './sent_tx.js';
|
|
3
|
-
/**
|
|
4
|
-
* A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
|
|
5
|
-
*/ export class DeploySentTx extends SentTx {
|
|
6
|
-
postDeployCtor;
|
|
7
|
-
instanceGetter;
|
|
8
|
-
log;
|
|
9
|
-
constructor(wallet, sendTx, postDeployCtor, /** A getter for the deployed contract instance */ instanceGetter){
|
|
10
|
-
super(wallet, sendTx), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter, this.log = createLogger('aztecjs:deploy_sent_tx');
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Returns the contract instance for this deployment.
|
|
14
|
-
* @returns The deployed contract instance with address and metadata.
|
|
15
|
-
*/ async getInstance() {
|
|
16
|
-
return await this.instanceGetter();
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
20
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
21
|
-
* @returns The deployed contract instance.
|
|
22
|
-
*/ async deployed(opts) {
|
|
23
|
-
const receipt = await this.wait(opts);
|
|
24
|
-
this.log.info(`Contract ${receipt.instance.address.toString()} successfully deployed.`);
|
|
25
|
-
return receipt.contract;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
|
|
29
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
30
|
-
* @returns The transaction receipt with the deployed contract instance.
|
|
31
|
-
*/ async wait(opts) {
|
|
32
|
-
const receipt = await super.wait(opts);
|
|
33
|
-
// In the case of DeploySentTx we have a guarantee that this.walletOrNode is a Wallet so we can cast it to Wallet.
|
|
34
|
-
const contractWallet = opts?.wallet ?? this.walletOrNode;
|
|
35
|
-
if (!contractWallet) {
|
|
36
|
-
throw new Error(`A wallet is required for creating a contract instance`);
|
|
37
|
-
}
|
|
38
|
-
const instance = await this.instanceGetter();
|
|
39
|
-
const contract = this.postDeployCtor(instance, contractWallet);
|
|
40
|
-
return {
|
|
41
|
-
...receipt,
|
|
42
|
-
contract,
|
|
43
|
-
instance
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
2
|
-
import { TxHash, type TxReceipt } from '@aztec/stdlib/tx';
|
|
3
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
4
|
-
/** Options related to waiting for a tx. */
|
|
5
|
-
export type WaitOpts = {
|
|
6
|
-
/** The amount of time to ignore TxStatus.DROPPED receipts (in seconds) due to the presumption that it is being propagated by the p2p network. Defaults to 5. */
|
|
7
|
-
ignoreDroppedReceiptsFor?: number;
|
|
8
|
-
/** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
|
|
9
|
-
timeout?: number;
|
|
10
|
-
/** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
|
|
11
|
-
interval?: number;
|
|
12
|
-
/** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
|
|
13
|
-
dontThrowOnRevert?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export declare const DefaultWaitOpts: WaitOpts;
|
|
16
|
-
/**
|
|
17
|
-
* The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch
|
|
18
|
-
* its hash, receipt, and mining status.
|
|
19
|
-
*/
|
|
20
|
-
export declare class SentTx {
|
|
21
|
-
protected walletOrNode: Wallet | AztecNode;
|
|
22
|
-
protected sendTxPromise: Promise<void>;
|
|
23
|
-
protected sendTxError?: Error;
|
|
24
|
-
protected txHash?: TxHash;
|
|
25
|
-
constructor(walletOrNode: Wallet | AztecNode, sendTx: () => Promise<TxHash>);
|
|
26
|
-
/**
|
|
27
|
-
* Retrieves the transaction hash of the SentTx instance.
|
|
28
|
-
* The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.
|
|
29
|
-
*
|
|
30
|
-
* @returns A promise that resolves to the transaction hash of the SentTx instance.
|
|
31
|
-
* TODO(#7717): Don't throw here.
|
|
32
|
-
*/
|
|
33
|
-
getTxHash(): Promise<TxHash>;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieve the transaction receipt associated with the current SentTx instance.
|
|
36
|
-
* The function fetches the transaction hash using 'getTxHash' and then queries
|
|
37
|
-
* the PXE to get the corresponding transaction receipt.
|
|
38
|
-
*
|
|
39
|
-
* @returns A promise that resolves to a TxReceipt object representing the fetched transaction receipt.
|
|
40
|
-
*/
|
|
41
|
-
getReceipt(): Promise<TxReceipt>;
|
|
42
|
-
/**
|
|
43
|
-
* Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.
|
|
44
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
45
|
-
* @returns The transaction receipt.
|
|
46
|
-
*/
|
|
47
|
-
wait(opts?: WaitOpts): Promise<TxReceipt>;
|
|
48
|
-
protected waitForReceipt(opts?: WaitOpts): Promise<TxReceipt>;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VudF90eC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3J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