@aztec/aztec.js 0.87.5 → 0.87.7
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/contract/base_contract_interaction.js +1 -1
- package/dest/contract/contract_function_interaction.d.ts +5 -10
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +4 -8
- package/dest/contract/deploy_method.js +1 -1
- package/dest/contract/deploy_proven_tx.d.ts +2 -2
- package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
- package/dest/contract/deploy_proven_tx.js +2 -2
- package/dest/contract/interaction_options.d.ts +3 -2
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/proven_tx.d.ts +3 -3
- package/dest/contract/proven_tx.d.ts.map +1 -1
- package/dest/contract/proven_tx.js +3 -3
- package/dest/wallet/account_wallet.d.ts +1 -1
- package/package.json +8 -8
- package/src/contract/base_contract_interaction.ts +1 -1
- package/src/contract/contract_function_interaction.ts +10 -17
- package/src/contract/deploy_method.ts +1 -1
- package/src/contract/deploy_proven_tx.ts +3 -3
- package/src/contract/interaction_options.ts +3 -2
- package/src/contract/proven_tx.ts +2 -2
|
@@ -36,7 +36,7 @@ import { SentTx } from './sent_tx.js';
|
|
|
36
36
|
*/ async prove(options = {}) {
|
|
37
37
|
// docs:end:prove
|
|
38
38
|
const txProvingResult = await this.proveInternal(options);
|
|
39
|
-
return new ProvenTx(this.wallet, txProvingResult.toTx(), txProvingResult.
|
|
39
|
+
return new ProvenTx(this.wallet, txProvingResult.toTx(), txProvingResult.stats);
|
|
40
40
|
}
|
|
41
41
|
// docs:start:send
|
|
42
42
|
/**
|
|
@@ -2,26 +2,21 @@ import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
|
2
2
|
import { type FunctionAbi } from '@aztec/stdlib/abi';
|
|
3
3
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { Capsule, HashedValues,
|
|
5
|
+
import type { Capsule, HashedValues, SimulationStats, TxExecutionRequest, TxProfileResult } from '@aztec/stdlib/tx';
|
|
6
6
|
import type { Wallet } from '../wallet/wallet.js';
|
|
7
7
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
8
8
|
import type { ProfileMethodOptions, RequestMethodOptions, SendMethodOptions, SimulateMethodOptions } from './interaction_options.js';
|
|
9
9
|
/**
|
|
10
10
|
* Represents the result type of a simulation.
|
|
11
11
|
* By default, it will just be the return value of the simulated function
|
|
12
|
-
* so contract interfaces behave as plain functions. If `
|
|
12
|
+
* so contract interfaces behave as plain functions. If `includeStats` is set to true,
|
|
13
13
|
* it will provide extra information.
|
|
14
14
|
*/
|
|
15
15
|
type SimulationReturn<T extends boolean | undefined> = T extends true ? {
|
|
16
16
|
/**
|
|
17
|
-
* Additional
|
|
17
|
+
* Additional stats about the simulation
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Timings of the different operations performed, including per function breakdown
|
|
22
|
-
*/
|
|
23
|
-
timings?: SimulationTimings;
|
|
24
|
-
};
|
|
19
|
+
stats: SimulationStats;
|
|
25
20
|
/**
|
|
26
21
|
* Return value of the function
|
|
27
22
|
*/
|
|
@@ -60,7 +55,7 @@ export declare class ContractFunctionInteraction extends BaseContractInteraction
|
|
|
60
55
|
* @param options - An optional object containing additional configuration for the transaction.
|
|
61
56
|
* @returns The result of the transaction as returned by the contract function.
|
|
62
57
|
*/
|
|
63
|
-
simulate<T extends SimulateMethodOptions>(options?: T): Promise<SimulationReturn<T['
|
|
58
|
+
simulate<T extends SimulateMethodOptions>(options?: T): Promise<SimulationReturn<T['includeStats']>>;
|
|
64
59
|
/**
|
|
65
60
|
* Simulate a transaction and profile the gate count for each function in the transaction.
|
|
66
61
|
* @param options - Same options as `simulate`, plus profiling method
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_function_interaction.d.ts","sourceRoot":"","sources":["../../src/contract/contract_function_interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAkE,MAAM,mBAAmB,CAAC;AACrH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"contract_function_interaction.d.ts","sourceRoot":"","sources":["../../src/contract/contract_function_interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAkE,MAAM,mBAAmB,CAAC;AACrH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEpH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;AACH,KAAK,gBAAgB,CAAC,CAAC,SAAS,OAAO,GAAG,SAAS,IAAI,CAAC,SAAS,IAAI,GACjE;IACE;;OAEG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC;CACb,GACD,GAAG,CAAC;AAER;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,uBAAuB;IAGpE,SAAS,CAAC,eAAe,EAAE,YAAY;IACvC,SAAS,CAAC,WAAW,EAAE,WAAW;IAClC,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE;IAGrB,OAAO,CAAC,eAAe;gBANvB,MAAM,EAAE,MAAM,EACJ,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,GAAG,EAAE,EACrB,aAAa,GAAE,WAAW,EAAO,EACjC,QAAQ,GAAE,OAAO,EAAO,EAChB,eAAe,GAAE,YAAY,EAAO;IAS9C;;;;;OAKG;IACmB,MAAM,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAc1F;;;;;OAKG;IACmB,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwB5F;;;;;;;;OAQG;IACU,QAAQ,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;IAwDjH;;;;;OAKG;IACU,OAAO,CAClB,OAAO,GAAE,oBAA0E,GAClF,OAAO,CAAC,eAAe,CAAC;IAU3B;;;;;;OAMG;IACI,IAAI,CAAC,EACV,aAAkB,EAClB,QAAa,EACb,eAAoB,GACrB,EAAE;QACD,kDAAkD;QAClD,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;QAC9B,6CAA6C;QAC7C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;QACrB,sDAAsD;QACtD,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;KAClC,GAAG,2BAA2B;CAWhC"}
|
|
@@ -65,11 +65,9 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
|
65
65
|
// docs:end:simulate
|
|
66
66
|
if (this.functionDao.functionType == FunctionType.UTILITY) {
|
|
67
67
|
const utilityResult = await this.wallet.simulateUtility(this.functionDao.name, this.args, this.contractAddress, options.authWitnesses ?? [], options?.from);
|
|
68
|
-
if (options.
|
|
68
|
+
if (options.includeStats) {
|
|
69
69
|
return {
|
|
70
|
-
|
|
71
|
-
timings: utilityResult.timings
|
|
72
|
-
},
|
|
70
|
+
stats: utilityResult.stats,
|
|
73
71
|
result: utilityResult.result
|
|
74
72
|
};
|
|
75
73
|
} else {
|
|
@@ -93,11 +91,9 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
|
93
91
|
rawReturnValues = simulatedTx.getPublicReturnValues()?.[0].values;
|
|
94
92
|
}
|
|
95
93
|
const returnValue = rawReturnValues ? decodeFromAbi(this.functionDao.returnTypes, rawReturnValues) : [];
|
|
96
|
-
if (options.
|
|
94
|
+
if (options.includeStats) {
|
|
97
95
|
return {
|
|
98
|
-
|
|
99
|
-
timings: simulatedTx.timings
|
|
100
|
-
},
|
|
96
|
+
stats: simulatedTx.stats,
|
|
101
97
|
result: returnValue
|
|
102
98
|
};
|
|
103
99
|
} else {
|
|
@@ -178,7 +178,7 @@ import { DeploySentTx } from './deploy_sent_tx.js';
|
|
|
178
178
|
* @returns The proven tx.
|
|
179
179
|
*/ async prove(options) {
|
|
180
180
|
const txProvingResult = await this.proveInternal(options);
|
|
181
|
-
return new DeployProvenTx(this.wallet, txProvingResult.toTx(), this.postDeployCtor, ()=>this.getInstance(options), txProvingResult.
|
|
181
|
+
return new DeployProvenTx(this.wallet, txProvingResult.toTx(), this.postDeployCtor, ()=>this.getInstance(options), txProvingResult.stats);
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* Estimates gas cost for this deployment operation.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
4
4
|
import type { Wallet } from '../wallet/wallet.js';
|
|
5
5
|
import type { Contract } from './contract.js';
|
|
6
6
|
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
@@ -11,7 +11,7 @@ import { ProvenTx } from './proven_tx.js';
|
|
|
11
11
|
export declare class DeployProvenTx<TContract extends Contract = Contract> extends ProvenTx {
|
|
12
12
|
private postDeployCtor;
|
|
13
13
|
private instanceGetter;
|
|
14
|
-
constructor(wallet: Wallet, tx: Tx, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>, instanceGetter: () => Promise<ContractInstanceWithAddress>,
|
|
14
|
+
constructor(wallet: Wallet, tx: Tx, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>, instanceGetter: () => Promise<ContractInstanceWithAddress>, stats?: ProvingStats);
|
|
15
15
|
/**
|
|
16
16
|
* Sends the transaction to the network via the provided wallet.
|
|
17
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy_proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;GAEG;AACH,qBAAa,cAAc,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,QAAQ;IAI/E,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;gBAHtB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,EAAE,EACE,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,EAC7E,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,EAClE,KAAK,CAAC,EAAE,YAAY;IAKtB;;OAEG;IACa,IAAI,IAAI,YAAY,CAAC,SAAS,CAAC;CAOhD"}
|
|
@@ -5,8 +5,8 @@ import { ProvenTx } from './proven_tx.js';
|
|
|
5
5
|
*/ export class DeployProvenTx extends ProvenTx {
|
|
6
6
|
postDeployCtor;
|
|
7
7
|
instanceGetter;
|
|
8
|
-
constructor(wallet, tx, postDeployCtor, instanceGetter,
|
|
9
|
-
super(wallet, tx,
|
|
8
|
+
constructor(wallet, tx, postDeployCtor, instanceGetter, stats){
|
|
9
|
+
super(wallet, tx, stats), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Sends the transaction to the network via the provided wallet.
|
|
@@ -36,8 +36,9 @@ export type SimulateMethodOptions = Pick<SendMethodOptions, 'authWitnesses' | 'c
|
|
|
36
36
|
skipTxValidation?: boolean;
|
|
37
37
|
/** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
|
|
38
38
|
skipFeeEnforcement?: boolean;
|
|
39
|
-
/** Whether to include
|
|
40
|
-
|
|
39
|
+
/** Whether to include performance statistics (e.g. timing information of the different circuits and oracles) in
|
|
40
|
+
* the simulation result, instead of just the return value of the function */
|
|
41
|
+
includeStats?: boolean;
|
|
41
42
|
};
|
|
42
43
|
/**
|
|
43
44
|
* Represents the options for profiling an interaction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction_options.d.ts","sourceRoot":"","sources":["../../src/contract/interaction_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,6CAA6C;IAC7C,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG;IACrD,2CAA2C;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,kKAAkK;IAClK,KAAK,CAAC,EAAE,EAAE,CAAC;IACX,qIAAqI;IACrI,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,iBAAiB,EACjB,eAAe,GAAG,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,aAAa,CAC/D,GAAG;IACF,kCAAkC;IAClC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8HAA8H;IAC9H,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B
|
|
1
|
+
{"version":3,"file":"interaction_options.d.ts","sourceRoot":"","sources":["../../src/contract/interaction_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,6CAA6C;IAC7C,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG;IACrD,2CAA2C;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,kKAAkK;IAClK,KAAK,CAAC,EAAE,EAAE,CAAC;IACX,qIAAqI;IACrI,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,iBAAiB,EACjB,eAAe,GAAG,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,aAAa,CAC/D,GAAG;IACF,kCAAkC;IAClC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8HAA8H;IAC9H,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;iFAC6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,GAAG;IACzD,qEAAqE;IACrE,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,CAAC;IAClD,mDAAmD;IACnD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
2
2
|
import type { Wallet } from '../wallet/wallet.js';
|
|
3
3
|
import { SentTx } from './sent_tx.js';
|
|
4
4
|
/**
|
|
@@ -6,8 +6,8 @@ import { SentTx } from './sent_tx.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class ProvenTx extends Tx {
|
|
8
8
|
protected wallet: Wallet;
|
|
9
|
-
|
|
10
|
-
constructor(wallet: Wallet, tx: Tx,
|
|
9
|
+
stats?: ProvingStats | undefined;
|
|
10
|
+
constructor(wallet: Wallet, tx: Tx, stats?: ProvingStats | undefined);
|
|
11
11
|
protected getPlainDataTx(): Tx;
|
|
12
12
|
/**
|
|
13
13
|
* Sends the transaction to the network via the provided wallet.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,qBAAa,QAAS,SAAQ,EAAE;IAE5B,SAAS,CAAC,MAAM,EAAE,MAAM;IAGjB,KAAK,CAAC,EAAE,YAAY;gBAHjB,MAAM,EAAE,MAAM,EACxB,EAAE,EAAE,EAAE,EAEC,KAAK,CAAC,EAAE,YAAY,YAAA;IAM7B,SAAS,CAAC,cAAc,IAAI,EAAE;IAI9B;;OAEG;IACI,IAAI,IAAI,MAAM;CAOtB"}
|
|
@@ -4,10 +4,10 @@ import { SentTx } from './sent_tx.js';
|
|
|
4
4
|
* A proven transaction that can be sent to the network. Returned by the `prove` method of a contract interaction.
|
|
5
5
|
*/ export class ProvenTx extends Tx {
|
|
6
6
|
wallet;
|
|
7
|
-
|
|
7
|
+
stats;
|
|
8
8
|
constructor(wallet, tx, // eslint-disable-next-line jsdoc/require-jsdoc
|
|
9
|
-
|
|
10
|
-
super(tx.data, tx.clientIvcProof, tx.contractClassLogs, tx.publicFunctionCalldata), this.wallet = wallet, this.
|
|
9
|
+
stats){
|
|
10
|
+
super(tx.data, tx.clientIvcProof, tx.contractClassLogs, tx.publicFunctionCalldata), this.wallet = wallet, this.stats = stats;
|
|
11
11
|
}
|
|
12
12
|
// Clone the TX data to get a serializable object.
|
|
13
13
|
getPlainDataTx() {
|
|
@@ -64,7 +64,7 @@ export declare class AccountWallet extends BaseWallet {
|
|
|
64
64
|
isValidInPublic: boolean;
|
|
65
65
|
}>;
|
|
66
66
|
/** Returns the complete address of the account that implements this wallet. */
|
|
67
|
-
getCompleteAddress(): import("
|
|
67
|
+
getCompleteAddress(): import("../index.js").CompleteAddress;
|
|
68
68
|
/** Returns the address of the account that implements this wallet. */
|
|
69
69
|
getAddress(): AztecAddress;
|
|
70
70
|
private getSetAuthorizedAbi;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec.js",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js",
|
|
4
|
-
"version": "0.87.
|
|
4
|
+
"version": "0.87.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dest/index.js",
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
]
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@aztec/constants": "0.87.
|
|
82
|
-
"@aztec/entrypoints": "0.87.
|
|
83
|
-
"@aztec/ethereum": "0.87.
|
|
84
|
-
"@aztec/foundation": "0.87.
|
|
85
|
-
"@aztec/l1-artifacts": "0.87.
|
|
86
|
-
"@aztec/protocol-contracts": "0.87.
|
|
87
|
-
"@aztec/stdlib": "0.87.
|
|
81
|
+
"@aztec/constants": "0.87.7",
|
|
82
|
+
"@aztec/entrypoints": "0.87.7",
|
|
83
|
+
"@aztec/ethereum": "0.87.7",
|
|
84
|
+
"@aztec/foundation": "0.87.7",
|
|
85
|
+
"@aztec/l1-artifacts": "0.87.7",
|
|
86
|
+
"@aztec/protocol-contracts": "0.87.7",
|
|
87
|
+
"@aztec/stdlib": "0.87.7",
|
|
88
88
|
"axios": "^1.8.2",
|
|
89
89
|
"tslib": "^2.4.0",
|
|
90
90
|
"viem": "2.23.7"
|
|
@@ -61,7 +61,7 @@ export abstract class BaseContractInteraction {
|
|
|
61
61
|
public async prove(options: SendMethodOptions = {}): Promise<ProvenTx> {
|
|
62
62
|
// docs:end:prove
|
|
63
63
|
const txProvingResult = await this.proveInternal(options);
|
|
64
|
-
return new ProvenTx(this.wallet, txProvingResult.toTx(), txProvingResult.
|
|
64
|
+
return new ProvenTx(this.wallet, txProvingResult.toTx(), txProvingResult.stats);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// docs:start:send
|
|
@@ -2,7 +2,7 @@ import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
|
2
2
|
import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi, encodeArguments } from '@aztec/stdlib/abi';
|
|
3
3
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { Capsule, HashedValues,
|
|
5
|
+
import type { Capsule, HashedValues, SimulationStats, TxExecutionRequest, TxProfileResult } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
7
|
import type { Wallet } from '../wallet/wallet.js';
|
|
8
8
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
@@ -16,20 +16,15 @@ import type {
|
|
|
16
16
|
/**
|
|
17
17
|
* Represents the result type of a simulation.
|
|
18
18
|
* By default, it will just be the return value of the simulated function
|
|
19
|
-
* so contract interfaces behave as plain functions. If `
|
|
19
|
+
* so contract interfaces behave as plain functions. If `includeStats` is set to true,
|
|
20
20
|
* it will provide extra information.
|
|
21
21
|
*/
|
|
22
22
|
type SimulationReturn<T extends boolean | undefined> = T extends true
|
|
23
23
|
? {
|
|
24
24
|
/**
|
|
25
|
-
* Additional
|
|
25
|
+
* Additional stats about the simulation
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Timings of the different operations performed, including per function breakdown
|
|
30
|
-
*/
|
|
31
|
-
timings?: SimulationTimings;
|
|
32
|
-
};
|
|
27
|
+
stats: SimulationStats;
|
|
33
28
|
/**
|
|
34
29
|
* Return value of the function
|
|
35
30
|
*/
|
|
@@ -117,11 +112,9 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
117
112
|
* @param options - An optional object containing additional configuration for the transaction.
|
|
118
113
|
* @returns The result of the transaction as returned by the contract function.
|
|
119
114
|
*/
|
|
120
|
-
public async simulate<T extends SimulateMethodOptions>(options?: T): Promise<SimulationReturn<T['
|
|
115
|
+
public async simulate<T extends SimulateMethodOptions>(options?: T): Promise<SimulationReturn<T['includeStats']>>;
|
|
121
116
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
122
|
-
public async simulate(
|
|
123
|
-
options: SimulateMethodOptions = {},
|
|
124
|
-
): Promise<SimulationReturn<typeof options.includeMetadata>> {
|
|
117
|
+
public async simulate(options: SimulateMethodOptions = {}): Promise<SimulationReturn<typeof options.includeStats>> {
|
|
125
118
|
// docs:end:simulate
|
|
126
119
|
if (this.functionDao.functionType == FunctionType.UTILITY) {
|
|
127
120
|
const utilityResult = await this.wallet.simulateUtility(
|
|
@@ -132,9 +125,9 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
132
125
|
options?.from,
|
|
133
126
|
);
|
|
134
127
|
|
|
135
|
-
if (options.
|
|
128
|
+
if (options.includeStats) {
|
|
136
129
|
return {
|
|
137
|
-
|
|
130
|
+
stats: utilityResult.stats,
|
|
138
131
|
result: utilityResult.result,
|
|
139
132
|
};
|
|
140
133
|
} else {
|
|
@@ -168,8 +161,8 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
168
161
|
|
|
169
162
|
const returnValue = rawReturnValues ? decodeFromAbi(this.functionDao.returnTypes, rawReturnValues) : [];
|
|
170
163
|
|
|
171
|
-
if (options.
|
|
172
|
-
return {
|
|
164
|
+
if (options.includeStats) {
|
|
165
|
+
return { stats: simulatedTx.stats, result: returnValue };
|
|
173
166
|
} else {
|
|
174
167
|
return returnValue;
|
|
175
168
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
import type { Wallet } from '../wallet/wallet.js';
|
|
6
6
|
import type { Contract } from './contract.js';
|
|
@@ -16,9 +16,9 @@ export class DeployProvenTx<TContract extends Contract = Contract> extends Prove
|
|
|
16
16
|
tx: Tx,
|
|
17
17
|
private postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
|
|
18
18
|
private instanceGetter: () => Promise<ContractInstanceWithAddress>,
|
|
19
|
-
|
|
19
|
+
stats?: ProvingStats,
|
|
20
20
|
) {
|
|
21
|
-
super(wallet, tx,
|
|
21
|
+
super(wallet, tx, stats);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -42,8 +42,9 @@ export type SimulateMethodOptions = Pick<
|
|
|
42
42
|
skipTxValidation?: boolean;
|
|
43
43
|
/** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
|
|
44
44
|
skipFeeEnforcement?: boolean;
|
|
45
|
-
/** Whether to include
|
|
46
|
-
|
|
45
|
+
/** Whether to include performance statistics (e.g. timing information of the different circuits and oracles) in
|
|
46
|
+
* the simulation result, instead of just the return value of the function */
|
|
47
|
+
includeStats?: boolean;
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
2
2
|
|
|
3
3
|
import type { Wallet } from '../wallet/wallet.js';
|
|
4
4
|
import { SentTx } from './sent_tx.js';
|
|
@@ -11,7 +11,7 @@ export class ProvenTx extends Tx {
|
|
|
11
11
|
protected wallet: Wallet,
|
|
12
12
|
tx: Tx,
|
|
13
13
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
14
|
-
public
|
|
14
|
+
public stats?: ProvingStats,
|
|
15
15
|
) {
|
|
16
16
|
super(tx.data, tx.clientIvcProof, tx.contractClassLogs, tx.publicFunctionCalldata);
|
|
17
17
|
}
|