@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.
- 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 +10 -16
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +8 -14
- package/dest/api/node.d.ts +4 -8
- package/dest/api/node.d.ts.map +1 -1
- package/dest/api/node.js +3 -7
- 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 +10 -8
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +17 -5
- package/dest/contract/deploy_method.d.ts +16 -63
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +19 -36
- package/dest/contract/deploy_sent_tx.d.ts +48 -0
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -0
- package/dest/contract/deploy_sent_tx.js +46 -0
- package/dest/contract/interaction_options.d.ts +5 -42
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +1 -8
- 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 +14 -1
- 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 +14 -1
- 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 +14 -1
- 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 +14 -1
- 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 +14 -1
- 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 +14 -1
- package/dest/contract/sent_tx.d.ts +50 -0
- package/dest/contract/sent_tx.d.ts.map +1 -0
- package/dest/contract/sent_tx.js +90 -0
- package/dest/contract/wait_for_proven.js +1 -1
- package/dest/utils/authwit.d.ts +6 -6
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +6 -2
- package/dest/utils/node.d.ts +1 -12
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +0 -46
- package/dest/wallet/deploy_account_method.d.ts +5 -19
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/wallet.d.ts +18 -63
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +3 -16
- package/package.json +9 -9
- package/src/api/block.ts +1 -1
- package/src/api/contract.ts +7 -22
- package/src/api/node.ts +3 -7
- package/src/api/tx.ts +0 -2
- package/src/api/wallet.ts +0 -5
- package/src/contract/base_contract_interaction.ts +15 -27
- package/src/contract/deploy_method.ts +23 -115
- package/src/contract/deploy_sent_tx.ts +75 -0
- package/src/contract/interaction_options.ts +4 -49
- package/src/contract/protocol_contracts/auth-registry.ts +12 -3
- package/src/contract/protocol_contracts/contract-class-registry.ts +12 -3
- package/src/contract/protocol_contracts/contract-instance-registry.ts +12 -3
- package/src/contract/protocol_contracts/fee-juice.ts +12 -3
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +12 -3
- package/src/contract/protocol_contracts/public-checks.ts +12 -3
- package/src/contract/sent_tx.ts +129 -0
- package/src/contract/wait_for_proven.ts +1 -1
- package/src/utils/authwit.ts +4 -16
- package/src/utils/node.ts +0 -62
- package/src/wallet/deploy_account_method.ts +4 -19
- package/src/wallet/wallet.ts +11 -31
- package/dest/contract/wait_opts.d.ts +0 -16
- package/dest/contract/wait_opts.d.ts.map +0 -1
- package/dest/contract/wait_opts.js +0 -5
- package/src/contract/wait_opts.ts +0 -21
|
@@ -9,46 +9,27 @@ import {
|
|
|
9
9
|
getContractInstanceFromInstantiationParams,
|
|
10
10
|
} from '@aztec/stdlib/contract';
|
|
11
11
|
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
12
|
-
import { type Capsule,
|
|
12
|
+
import { type Capsule, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
|
|
13
13
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
14
14
|
|
|
15
15
|
import { publishContractClass } from '../deployment/publish_class.js';
|
|
16
16
|
import { publishInstance } from '../deployment/publish_instance.js';
|
|
17
|
-
import type {
|
|
17
|
+
import type { Wallet } from '../wallet/wallet.js';
|
|
18
18
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
19
19
|
import type { ContractBase } from './contract_base.js';
|
|
20
20
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
21
|
+
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
21
22
|
import { getGasLimits } from './get_gas_limits.js';
|
|
22
23
|
import {
|
|
23
|
-
NO_WAIT,
|
|
24
|
-
type NoWait,
|
|
25
24
|
type ProfileInteractionOptions,
|
|
26
25
|
type RequestInteractionOptions,
|
|
27
|
-
type
|
|
26
|
+
type SendInteractionOptions,
|
|
28
27
|
type SimulationInteractionFeeOptions,
|
|
29
28
|
type SimulationReturn,
|
|
30
29
|
toProfileOptions,
|
|
31
30
|
toSendOptions,
|
|
32
31
|
toSimulateOptions,
|
|
33
32
|
} from './interaction_options.js';
|
|
34
|
-
import type { WaitOpts } from './wait_opts.js';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Wait options specific to deployment transactions.
|
|
38
|
-
* Extends WaitOpts with a flag to return the full receipt instead of just the contract.
|
|
39
|
-
*/
|
|
40
|
-
export type DeployWaitOptions = WaitOpts & {
|
|
41
|
-
/** If true, return the full DeployTxReceipt instead of just the contract. Defaults to false. */
|
|
42
|
-
returnReceipt?: boolean;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Type for wait options in deployment interactions.
|
|
47
|
-
* - NO_WAIT symbol: Don't wait, return TxHash immediately
|
|
48
|
-
* - DeployWaitOptions: Wait with custom options
|
|
49
|
-
* - undefined: Wait with default options
|
|
50
|
-
*/
|
|
51
|
-
export type DeployInteractionWaitOptions = NoWait | DeployWaitOptions | undefined;
|
|
52
33
|
|
|
53
34
|
/**
|
|
54
35
|
* Options for deploying a contract on the Aztec network.
|
|
@@ -74,34 +55,21 @@ export type RequestDeployOptions = RequestInteractionOptions & {
|
|
|
74
55
|
};
|
|
75
56
|
|
|
76
57
|
/**
|
|
77
|
-
*
|
|
58
|
+
* Extends the deployment options with the required parameters to send the transaction
|
|
78
59
|
*/
|
|
79
|
-
export type
|
|
60
|
+
export type DeployOptions = Omit<RequestDeployOptions, 'deployer'> & {
|
|
80
61
|
/**
|
|
81
62
|
* Set to true to *not* include the sender in the address computation. This option
|
|
82
63
|
* is mutually exclusive with "deployer"
|
|
83
64
|
*/
|
|
84
65
|
universalDeploy?: boolean;
|
|
85
|
-
} & Pick<
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Extends the deployment options with the required parameters to send the transaction.
|
|
89
|
-
*/
|
|
90
|
-
export type DeployOptions<W extends DeployInteractionWaitOptions = undefined> = DeployOptionsWithoutWait & {
|
|
91
|
-
/**
|
|
92
|
-
* Options for waiting for the transaction to be mined.
|
|
93
|
-
* - undefined (default): wait with default options and return the contract instance
|
|
94
|
-
* - DeployWaitOptions: wait with custom options and return contract or receipt based on returnReceipt flag
|
|
95
|
-
* - NO_WAIT: return TxHash immediately without waiting
|
|
96
|
-
*/
|
|
97
|
-
wait?: W;
|
|
98
|
-
};
|
|
66
|
+
} & Pick<SendInteractionOptions, 'from' | 'fee'>;
|
|
99
67
|
|
|
100
68
|
/**
|
|
101
69
|
* Options for simulating the deployment of a contract
|
|
102
70
|
* Allows skipping certain validations and computing gas estimations
|
|
103
71
|
*/
|
|
104
|
-
export type SimulateDeployOptions = Omit<
|
|
72
|
+
export type SimulateDeployOptions = Omit<DeployOptions, 'fee'> & {
|
|
105
73
|
/** The fee options for the transaction. */
|
|
106
74
|
fee?: SimulationInteractionFeeOptions;
|
|
107
75
|
/** Simulate without checking for the validity of the resulting transaction,
|
|
@@ -115,29 +83,6 @@ export type SimulateDeployOptions = Omit<DeployOptionsWithoutWait, 'fee'> & {
|
|
|
115
83
|
includeMetadata?: boolean;
|
|
116
84
|
};
|
|
117
85
|
|
|
118
|
-
/** Receipt for a deployment transaction with the deployed contract instance. */
|
|
119
|
-
export type DeployTxReceipt<TContract extends ContractBase = ContractBase> = TxReceipt & {
|
|
120
|
-
/** Type-safe wrapper around the deployed contract instance, linked to the deployment wallet */
|
|
121
|
-
contract: TContract;
|
|
122
|
-
/** The deployed contract instance with address and metadata. */
|
|
123
|
-
instance: ContractInstanceWithAddress;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Represents the result type of deploying a contract.
|
|
128
|
-
* - If wait is NO_WAIT, returns TxHash immediately.
|
|
129
|
-
* - If wait has returnReceipt: true, returns DeployTxReceipt after waiting.
|
|
130
|
-
* - Otherwise (undefined or DeployWaitOptions without returnReceipt), returns TContract after waiting.
|
|
131
|
-
*/
|
|
132
|
-
export type DeployReturn<TContract extends ContractBase, W extends DeployInteractionWaitOptions> = W extends NoWait
|
|
133
|
-
? TxHash
|
|
134
|
-
: W extends {
|
|
135
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
136
|
-
returnReceipt: true;
|
|
137
|
-
}
|
|
138
|
-
? DeployTxReceipt<TContract>
|
|
139
|
-
: TContract;
|
|
140
|
-
|
|
141
86
|
/**
|
|
142
87
|
* Contract interaction for deployment.
|
|
143
88
|
* Handles class publication, instance publication, and initialization of the contract.
|
|
@@ -147,6 +92,8 @@ export type DeployReturn<TContract extends ContractBase, W extends DeployInterac
|
|
|
147
92
|
* then technically the contract has already been "created", and all of the contract's
|
|
148
93
|
* functions (private and utility) can be interacted-with immediately, without any
|
|
149
94
|
* "deployment tx".
|
|
95
|
+
*
|
|
96
|
+
* Extends the BaseContractInteraction class.
|
|
150
97
|
*/
|
|
151
98
|
export class DeployMethod<TContract extends ContractBase = ContractBase> extends BaseContractInteraction {
|
|
152
99
|
/** The contract instance to be deployed. */
|
|
@@ -195,30 +142,13 @@ export class DeployMethod<TContract extends ContractBase = ContractBase> extends
|
|
|
195
142
|
return finalExecutionPayload;
|
|
196
143
|
}
|
|
197
144
|
|
|
198
|
-
convertDeployOptionsToRequestOptions(options:
|
|
145
|
+
convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
|
|
199
146
|
return {
|
|
200
147
|
...options,
|
|
201
148
|
deployer: !options?.universalDeploy ? options.from : undefined,
|
|
202
149
|
};
|
|
203
150
|
}
|
|
204
151
|
|
|
205
|
-
/**
|
|
206
|
-
* Converts DeployOptions to SendOptions, stripping out the returnReceipt flag if present.
|
|
207
|
-
* @param options - Deploy options with wait parameter
|
|
208
|
-
* @returns Send options with wait parameter
|
|
209
|
-
*/
|
|
210
|
-
private convertDeployOptionsToSendOptions<W extends DeployInteractionWaitOptions>(
|
|
211
|
-
options: DeployOptions<W>,
|
|
212
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
213
|
-
): SendOptions<W extends { returnReceipt: true } ? WaitOpts : W> {
|
|
214
|
-
return {
|
|
215
|
-
...toSendOptions({
|
|
216
|
-
...options,
|
|
217
|
-
wait: options.wait as any,
|
|
218
|
-
}),
|
|
219
|
-
} as any;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
152
|
/**
|
|
223
153
|
* Adds this contract to the wallet and returns the Contract object.
|
|
224
154
|
* @param options - Deployment options.
|
|
@@ -302,42 +232,20 @@ export class DeployMethod<TContract extends ContractBase = ContractBase> extends
|
|
|
302
232
|
|
|
303
233
|
/**
|
|
304
234
|
* Send a contract deployment transaction (initialize and/or publish) using the provided options.
|
|
305
|
-
*
|
|
235
|
+
* This function extends the 'send' method from the ContractFunctionInteraction class,
|
|
236
|
+
* allowing us to send a transaction specifically for contract deployment.
|
|
306
237
|
*
|
|
307
238
|
* @param options - An object containing various deployment options such as contractAddressSalt and from.
|
|
308
|
-
* @returns
|
|
239
|
+
* @returns A SentTx object that returns the receipt and the deployed contract instance.
|
|
309
240
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
public override async send(options: DeployOptions<DeployInteractionWaitOptions>): Promise<any> {
|
|
319
|
-
const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
|
|
320
|
-
const sendOptions = this.convertDeployOptionsToSendOptions(options);
|
|
321
|
-
|
|
322
|
-
if (options.wait === NO_WAIT) {
|
|
323
|
-
const txHash = await this.wallet.sendTx(executionPayload, sendOptions as SendOptions<NoWait>);
|
|
324
|
-
this.log.debug(`Sent deployment tx ${txHash.hash} of ${this.artifact.name} contract`);
|
|
325
|
-
return txHash;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const receipt = await this.wallet.sendTx(executionPayload, sendOptions as SendOptions<WaitOpts | undefined>);
|
|
329
|
-
this.log.debug(`Deployed ${this.artifact.name} contract in tx ${receipt.txHash}`);
|
|
330
|
-
|
|
331
|
-
// Attach contract instance
|
|
332
|
-
const instance = await this.getInstance(options);
|
|
333
|
-
const contract = this.postDeployCtor(instance, this.wallet) as TContract;
|
|
334
|
-
|
|
335
|
-
// Return full receipt if requested, otherwise just the contract
|
|
336
|
-
if (options.wait && typeof options.wait === 'object' && options.wait.returnReceipt) {
|
|
337
|
-
return { ...receipt, contract, instance };
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
return contract;
|
|
241
|
+
public override send(options: DeployOptions): DeploySentTx<TContract> {
|
|
242
|
+
const sendTx = async () => {
|
|
243
|
+
const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
|
|
244
|
+
const sendOptions = toSendOptions(options);
|
|
245
|
+
return this.wallet.sendTx(executionPayload, sendOptions);
|
|
246
|
+
};
|
|
247
|
+
this.log.debug(`Sent deployment tx of ${this.artifact.name} contract`);
|
|
248
|
+
return new DeploySentTx(this.wallet, sendTx, this.postDeployCtor, () => this.getInstance(options));
|
|
341
249
|
}
|
|
342
250
|
|
|
343
251
|
/**
|
|
@@ -388,7 +296,7 @@ export class DeployMethod<TContract extends ContractBase = ContractBase> extends
|
|
|
388
296
|
*
|
|
389
297
|
* @returns An object containing the function return value and profile result.
|
|
390
298
|
*/
|
|
391
|
-
public async profile(options:
|
|
299
|
+
public async profile(options: DeployOptions & ProfileInteractionOptions): Promise<TxProfileResult> {
|
|
392
300
|
const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
|
|
393
301
|
return await this.wallet.profileTx(executionPayload, {
|
|
394
302
|
...toProfileOptions(options),
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
5
|
+
|
|
6
|
+
import type { Wallet } from '../wallet/wallet.js';
|
|
7
|
+
import type { ContractBase } from './contract_base.js';
|
|
8
|
+
import { SentTx, type WaitOpts } from './sent_tx.js';
|
|
9
|
+
|
|
10
|
+
/** Options related to waiting for a deployment tx. */
|
|
11
|
+
export type DeployedWaitOpts = WaitOpts & {
|
|
12
|
+
/** Wallet to use for creating a contract instance. Uses the one set in the deployer constructor if not set. */
|
|
13
|
+
wallet?: Wallet;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** Extends a transaction receipt with a contract instance that represents the newly deployed contract. */
|
|
17
|
+
export type DeployTxReceipt<TContract extends ContractBase = ContractBase> = FieldsOf<TxReceipt> & {
|
|
18
|
+
/** Instance of the newly deployed contract. */
|
|
19
|
+
contract: TContract;
|
|
20
|
+
/** The deployed contract instance with address and metadata. */
|
|
21
|
+
instance: ContractInstanceWithAddress;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
|
|
26
|
+
*/
|
|
27
|
+
export class DeploySentTx<TContract extends ContractBase = ContractBase> extends SentTx {
|
|
28
|
+
private log = createLogger('aztecjs:deploy_sent_tx');
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
wallet: Wallet,
|
|
32
|
+
sendTx: () => Promise<TxHash>,
|
|
33
|
+
private postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
|
|
34
|
+
/** A getter for the deployed contract instance */
|
|
35
|
+
private instanceGetter: () => Promise<ContractInstanceWithAddress>,
|
|
36
|
+
) {
|
|
37
|
+
super(wallet, sendTx);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the contract instance for this deployment.
|
|
42
|
+
* @returns The deployed contract instance with address and metadata.
|
|
43
|
+
*/
|
|
44
|
+
public async getInstance(): Promise<ContractInstanceWithAddress> {
|
|
45
|
+
return await this.instanceGetter();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
50
|
+
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
51
|
+
* @returns The deployed contract instance.
|
|
52
|
+
*/
|
|
53
|
+
public async deployed(opts?: DeployedWaitOpts): Promise<TContract> {
|
|
54
|
+
const receipt = await this.wait(opts);
|
|
55
|
+
this.log.info(`Contract ${receipt.instance.address.toString()} successfully deployed.`);
|
|
56
|
+
return receipt.contract;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
|
|
61
|
+
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
62
|
+
* @returns The transaction receipt with the deployed contract instance.
|
|
63
|
+
*/
|
|
64
|
+
public override async wait(opts?: DeployedWaitOpts): Promise<DeployTxReceipt<TContract>> {
|
|
65
|
+
const receipt = await super.wait(opts);
|
|
66
|
+
// In the case of DeploySentTx we have a guarantee that this.walletOrNode is a Wallet so we can cast it to Wallet.
|
|
67
|
+
const contractWallet = opts?.wallet ?? (this.walletOrNode as Wallet);
|
|
68
|
+
if (!contractWallet) {
|
|
69
|
+
throw new Error(`A wallet is required for creating a contract instance`);
|
|
70
|
+
}
|
|
71
|
+
const instance = await this.instanceGetter();
|
|
72
|
+
const contract = this.postDeployCtor(instance, contractWallet) as TContract;
|
|
73
|
+
return { ...receipt, contract, instance };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -2,11 +2,10 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
2
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
5
|
-
import type { Capsule, OffchainEffect, SimulationStats
|
|
5
|
+
import type { Capsule, OffchainEffect, SimulationStats } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
7
|
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
8
8
|
import type { ProfileOptions, SendOptions, SimulateOptions } from '../wallet/index.js';
|
|
9
|
-
import type { WaitOpts } from './wait_opts.js';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Options used to tweak the simulation and add gas estimation capabilities
|
|
@@ -56,47 +55,15 @@ export type RequestInteractionOptions = {
|
|
|
56
55
|
};
|
|
57
56
|
|
|
58
57
|
/**
|
|
59
|
-
*
|
|
60
|
-
* We use this instead of false to avoid confusion with falsy checks.
|
|
61
|
-
*/
|
|
62
|
-
export const NO_WAIT = 'NO_WAIT' as const;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Type for the NO_WAIT constant.
|
|
66
|
-
*/
|
|
67
|
-
export type NoWait = typeof NO_WAIT;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Type for wait options in interactions.
|
|
71
|
-
* - NO_WAIT symbol: Don't wait for confirmation, return TxHash immediately
|
|
72
|
-
* - WaitOpts object: Wait with custom options and return receipt/result
|
|
73
|
-
* - undefined: Wait with default options and return receipt/result
|
|
74
|
-
*/
|
|
75
|
-
export type InteractionWaitOptions = NoWait | WaitOpts | undefined;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Base options for calling a (constrained) function in a contract, without wait parameter.
|
|
58
|
+
* Represents options for calling a (constrained) function in a contract.
|
|
79
59
|
*/
|
|
80
|
-
export type
|
|
60
|
+
export type SendInteractionOptions = RequestInteractionOptions & {
|
|
81
61
|
/** The sender's Aztec address. */
|
|
82
62
|
from: AztecAddress;
|
|
83
63
|
/** The fee options for the transaction. */
|
|
84
64
|
fee?: InteractionFeeOptions;
|
|
85
65
|
};
|
|
86
66
|
|
|
87
|
-
/**
|
|
88
|
-
* Represents options for calling a (constrained) function in a contract.
|
|
89
|
-
*/
|
|
90
|
-
export type SendInteractionOptions<W extends InteractionWaitOptions = undefined> = SendInteractionOptionsWithoutWait & {
|
|
91
|
-
/**
|
|
92
|
-
* Whether to wait for the transaction to be mined.
|
|
93
|
-
* - undefined (default): wait with default options and return TxReceipt
|
|
94
|
-
* - WaitOpts object: wait with custom options and return TxReceipt
|
|
95
|
-
* - NO_WAIT: return txHash immediately without waiting
|
|
96
|
-
*/
|
|
97
|
-
wait?: W;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
67
|
/**
|
|
101
68
|
* Represents the options for simulating a contract function interaction.
|
|
102
69
|
* Allows specifying the address from which the method should be called.
|
|
@@ -143,22 +110,11 @@ export type SimulationReturn<T extends boolean | undefined> = T extends true
|
|
|
143
110
|
}
|
|
144
111
|
: any;
|
|
145
112
|
|
|
146
|
-
/**
|
|
147
|
-
* Represents the result type of sending a transaction.
|
|
148
|
-
* If `wait` is NO_WAIT, returns TxHash immediately without waiting.
|
|
149
|
-
* If `wait` is undefined or WaitOpts, returns TReturn (defaults to TxReceipt) after waiting.
|
|
150
|
-
*/
|
|
151
|
-
export type SendReturn<T extends InteractionWaitOptions, TReturn = TxReceipt> = T extends NoWait ? TxHash : TReturn;
|
|
152
|
-
|
|
153
113
|
/**
|
|
154
114
|
* Transforms and cleans up the higher level SendInteractionOptions defined by the interaction into
|
|
155
115
|
* SendOptions, which are the ones that can be serialized and forwarded to the wallet
|
|
156
|
-
* @param options - The send interaction options with optional wait parameter
|
|
157
|
-
* @returns The send options to forward to the wallet
|
|
158
116
|
*/
|
|
159
|
-
export function toSendOptions
|
|
160
|
-
options: SendInteractionOptions<W>,
|
|
161
|
-
): SendOptions<W> {
|
|
117
|
+
export function toSendOptions(options: SendInteractionOptions): SendOptions {
|
|
162
118
|
return {
|
|
163
119
|
...options,
|
|
164
120
|
fee: {
|
|
@@ -170,7 +126,6 @@ export function toSendOptions<W extends InteractionWaitOptions = undefined>(
|
|
|
170
126
|
...options.fee?.gasSettings,
|
|
171
127
|
},
|
|
172
128
|
},
|
|
173
|
-
wait: options.wait, // Pass through wait option
|
|
174
129
|
};
|
|
175
130
|
}
|
|
176
131
|
|
|
@@ -165,9 +165,18 @@ const AuthRegistryContractArtifact: ContractArtifact = {
|
|
|
165
165
|
error_kind: 'string',
|
|
166
166
|
string: '0 has a square root; you cannot claim it is not square',
|
|
167
167
|
},
|
|
168
|
+
'9885968605480832328': {
|
|
169
|
+
error_kind: 'string',
|
|
170
|
+
string: 'Attempted to read past the length of a CapsuleArray',
|
|
171
|
+
},
|
|
168
172
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
169
173
|
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
174
|
+
'11021520179822076911': {
|
|
175
|
+
error_kind: 'string',
|
|
176
|
+
string: 'Attempted to delete past the length of a CapsuleArray',
|
|
177
|
+
},
|
|
170
178
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
179
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
171
180
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
172
181
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
173
182
|
'13557316507370296400': {
|
|
@@ -235,7 +244,7 @@ const AuthRegistryContractArtifact: ContractArtifact = {
|
|
|
235
244
|
{
|
|
236
245
|
...{
|
|
237
246
|
functionType: FunctionType.UTILITY,
|
|
238
|
-
name: '
|
|
247
|
+
name: 'sync_private_state',
|
|
239
248
|
isOnlySelf: false,
|
|
240
249
|
isStatic: false,
|
|
241
250
|
isInitializer: false,
|
|
@@ -535,8 +544,8 @@ export class AuthRegistryContract extends ContractBase {
|
|
|
535
544
|
/** set_reject_all(reject: boolean) */
|
|
536
545
|
set_reject_all: ((reject: boolean) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
537
546
|
|
|
538
|
-
/**
|
|
539
|
-
|
|
547
|
+
/** sync_private_state() */
|
|
548
|
+
sync_private_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
540
549
|
|
|
541
550
|
/** utility_is_consumable(on_behalf_of: struct, message_hash: field) */
|
|
542
551
|
utility_is_consumable: ((on_behalf_of: AztecAddressLike, message_hash: FieldLike) => ContractFunctionInteraction) &
|
|
@@ -250,9 +250,18 @@ const ContractClassRegistryContractArtifact: ContractArtifact = {
|
|
|
250
250
|
error_kind: 'string',
|
|
251
251
|
string: '0 has a square root; you cannot claim it is not square',
|
|
252
252
|
},
|
|
253
|
+
'9885968605480832328': {
|
|
254
|
+
error_kind: 'string',
|
|
255
|
+
string: 'Attempted to read past the length of a CapsuleArray',
|
|
256
|
+
},
|
|
253
257
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
254
258
|
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
259
|
+
'11021520179822076911': {
|
|
260
|
+
error_kind: 'string',
|
|
261
|
+
string: 'Attempted to delete past the length of a CapsuleArray',
|
|
262
|
+
},
|
|
255
263
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
264
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
256
265
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
257
266
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
258
267
|
'13557316507370296400': {
|
|
@@ -281,7 +290,7 @@ const ContractClassRegistryContractArtifact: ContractArtifact = {
|
|
|
281
290
|
{
|
|
282
291
|
...{
|
|
283
292
|
functionType: FunctionType.UTILITY,
|
|
284
|
-
name: '
|
|
293
|
+
name: 'sync_private_state',
|
|
285
294
|
isOnlySelf: false,
|
|
286
295
|
isStatic: false,
|
|
287
296
|
isInitializer: false,
|
|
@@ -427,7 +436,7 @@ export class ContractClassRegistryContract extends ContractBase {
|
|
|
427
436
|
) => ContractFunctionInteraction) &
|
|
428
437
|
Pick<ContractMethod, 'selector'>;
|
|
429
438
|
|
|
430
|
-
/**
|
|
431
|
-
|
|
439
|
+
/** sync_private_state() */
|
|
440
|
+
sync_private_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
432
441
|
};
|
|
433
442
|
}
|
|
@@ -228,9 +228,18 @@ const ContractInstanceRegistryContractArtifact: ContractArtifact = {
|
|
|
228
228
|
error_kind: 'string',
|
|
229
229
|
string: '0 has a square root; you cannot claim it is not square',
|
|
230
230
|
},
|
|
231
|
+
'9885968605480832328': {
|
|
232
|
+
error_kind: 'string',
|
|
233
|
+
string: 'Attempted to read past the length of a CapsuleArray',
|
|
234
|
+
},
|
|
231
235
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
232
236
|
'10791800398362570014': { error_kind: 'string', string: 'extend_from_bounded_vec out of bounds' },
|
|
237
|
+
'11021520179822076911': {
|
|
238
|
+
error_kind: 'string',
|
|
239
|
+
string: 'Attempted to delete past the length of a CapsuleArray',
|
|
240
|
+
},
|
|
233
241
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
242
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
234
243
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
235
244
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
236
245
|
'13557316507370296400': {
|
|
@@ -291,7 +300,7 @@ const ContractInstanceRegistryContractArtifact: ContractArtifact = {
|
|
|
291
300
|
{
|
|
292
301
|
...{
|
|
293
302
|
functionType: FunctionType.UTILITY,
|
|
294
|
-
name: '
|
|
303
|
+
name: 'sync_private_state',
|
|
295
304
|
isOnlySelf: false,
|
|
296
305
|
isStatic: false,
|
|
297
306
|
isInitializer: false,
|
|
@@ -483,8 +492,8 @@ export class ContractInstanceRegistryContract extends ContractBase {
|
|
|
483
492
|
set_update_delay: ((new_update_delay: bigint | number) => ContractFunctionInteraction) &
|
|
484
493
|
Pick<ContractMethod, 'selector'>;
|
|
485
494
|
|
|
486
|
-
/**
|
|
487
|
-
|
|
495
|
+
/** sync_private_state() */
|
|
496
|
+
sync_private_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
488
497
|
|
|
489
498
|
/** update(new_contract_class_id: struct) */
|
|
490
499
|
update: ((new_contract_class_id: WrappedFieldLike) => ContractFunctionInteraction) &
|
|
@@ -172,9 +172,18 @@ 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
|
+
},
|
|
175
179
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
176
180
|
'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
|
+
},
|
|
177
185
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
186
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
178
187
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
179
188
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
180
189
|
'13557316507370296400': {
|
|
@@ -241,7 +250,7 @@ const FeeJuiceContractArtifact: ContractArtifact = {
|
|
|
241
250
|
{
|
|
242
251
|
...{
|
|
243
252
|
functionType: FunctionType.UTILITY,
|
|
244
|
-
name: '
|
|
253
|
+
name: 'sync_private_state',
|
|
245
254
|
isOnlySelf: false,
|
|
246
255
|
isStatic: false,
|
|
247
256
|
isInitializer: false,
|
|
@@ -451,7 +460,7 @@ export class FeeJuiceContract extends ContractBase {
|
|
|
451
460
|
/** public_dispatch(selector: field) */
|
|
452
461
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
453
462
|
|
|
454
|
-
/**
|
|
455
|
-
|
|
463
|
+
/** sync_private_state() */
|
|
464
|
+
sync_private_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
456
465
|
};
|
|
457
466
|
}
|
|
@@ -164,9 +164,18 @@ 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
|
+
},
|
|
167
171
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
168
172
|
'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
|
+
},
|
|
169
177
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
178
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
170
179
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
171
180
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
172
181
|
'13557316507370296400': {
|
|
@@ -195,7 +204,7 @@ const MultiCallEntrypointContractArtifact: ContractArtifact = {
|
|
|
195
204
|
{
|
|
196
205
|
...{
|
|
197
206
|
functionType: FunctionType.UTILITY,
|
|
198
|
-
name: '
|
|
207
|
+
name: 'sync_private_state',
|
|
199
208
|
isOnlySelf: false,
|
|
200
209
|
isStatic: false,
|
|
201
210
|
isInitializer: false,
|
|
@@ -323,7 +332,7 @@ export class MultiCallEntrypointContract extends ContractBase {
|
|
|
323
332
|
/** public_dispatch(selector: field) */
|
|
324
333
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
325
334
|
|
|
326
|
-
/**
|
|
327
|
-
|
|
335
|
+
/** sync_private_state() */
|
|
336
|
+
sync_private_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
328
337
|
};
|
|
329
338
|
}
|
|
@@ -97,9 +97,18 @@ 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
|
+
},
|
|
100
104
|
'10135509984888824963': { error_kind: 'fmtstring', length: 58, item_types: [{ kind: 'field' }] },
|
|
101
105
|
'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
|
+
},
|
|
102
110
|
'11692359521570349358': { error_kind: 'fmtstring', length: 40, item_types: [] },
|
|
111
|
+
'12327971061804302172': { error_kind: 'fmtstring', length: 98, item_types: [] },
|
|
103
112
|
'12469291177396340830': { error_kind: 'string', string: 'call to assert_max_bit_size' },
|
|
104
113
|
'12913276134398371456': { error_kind: 'string', string: 'push out of bounds' },
|
|
105
114
|
'13557316507370296400': {
|
|
@@ -158,7 +167,7 @@ const PublicChecksContractArtifact: ContractArtifact = {
|
|
|
158
167
|
{
|
|
159
168
|
...{
|
|
160
169
|
functionType: FunctionType.UTILITY,
|
|
161
|
-
name: '
|
|
170
|
+
name: 'sync_private_state',
|
|
162
171
|
isOnlySelf: false,
|
|
163
172
|
isStatic: false,
|
|
164
173
|
isInitializer: false,
|
|
@@ -309,7 +318,7 @@ export class PublicChecksContract extends ContractBase {
|
|
|
309
318
|
/** public_dispatch(selector: field) */
|
|
310
319
|
public_dispatch: ((selector: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
311
320
|
|
|
312
|
-
/**
|
|
313
|
-
|
|
321
|
+
/** sync_private_state() */
|
|
322
|
+
sync_private_state: (() => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
|
|
314
323
|
};
|
|
315
324
|
}
|