@aztec/stdlib 3.0.0-nightly.20250926 → 3.0.0-nightly.20250928

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dest/abi/event_metadata_definition.d.ts +8 -0
  2. package/dest/abi/event_metadata_definition.d.ts.map +1 -0
  3. package/dest/abi/event_metadata_definition.js +1 -0
  4. package/dest/abi/index.d.ts +1 -0
  5. package/dest/abi/index.d.ts.map +1 -1
  6. package/dest/abi/index.js +1 -0
  7. package/dest/block/body.d.ts.map +1 -1
  8. package/dest/block/body.js +0 -5
  9. package/dest/contract/contract_class_metadata.d.ts +8 -0
  10. package/dest/contract/contract_class_metadata.d.ts.map +1 -0
  11. package/dest/contract/contract_class_metadata.js +1 -0
  12. package/dest/contract/contract_metadata.d.ts +7 -0
  13. package/dest/contract/contract_metadata.d.ts.map +1 -0
  14. package/dest/contract/contract_metadata.js +1 -0
  15. package/dest/contract/index.d.ts +2 -0
  16. package/dest/contract/index.d.ts.map +1 -1
  17. package/dest/contract/index.js +2 -0
  18. package/dest/interfaces/client.d.ts +0 -1
  19. package/dest/interfaces/client.d.ts.map +1 -1
  20. package/dest/interfaces/client.js +0 -1
  21. package/dest/interfaces/proving-job.d.ts +5 -5
  22. package/dest/interfaces/proving-job.d.ts.map +1 -1
  23. package/dest/interfaces/proving-job.js +3 -3
  24. package/dest/interfaces/server_circuit_prover.d.ts +2 -2
  25. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  26. package/dest/logs/contract_class_log.d.ts +1 -1
  27. package/dest/logs/contract_class_log.d.ts.map +1 -1
  28. package/dest/logs/contract_class_log.js +1 -3
  29. package/dest/rollup/base_rollup_hints.d.ts +2 -10
  30. package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
  31. package/dest/rollup/base_rollup_hints.js +4 -9
  32. package/dest/rollup/index.d.ts +1 -0
  33. package/dest/rollup/index.d.ts.map +1 -1
  34. package/dest/rollup/index.js +1 -0
  35. package/dest/rollup/public_tube_private_inputs.d.ts +4 -2
  36. package/dest/rollup/public_tube_private_inputs.d.ts.map +1 -1
  37. package/dest/rollup/public_tube_private_inputs.js +7 -3
  38. package/dest/rollup/public_tube_public_inputs.d.ts +20 -0
  39. package/dest/rollup/public_tube_public_inputs.d.ts.map +1 -0
  40. package/dest/rollup/public_tube_public_inputs.js +41 -0
  41. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts +4 -4
  42. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts.map +1 -1
  43. package/dest/rollup/public_tx_base_rollup_private_inputs.js +2 -2
  44. package/dest/tests/factories.d.ts +2 -0
  45. package/dest/tests/factories.d.ts.map +1 -1
  46. package/dest/tests/factories.js +6 -3
  47. package/dest/tx/tx_effect.d.ts +3 -33
  48. package/dest/tx/tx_effect.d.ts.map +1 -1
  49. package/dest/tx/tx_effect.js +58 -191
  50. package/package.json +8 -8
  51. package/src/abi/event_metadata_definition.ts +8 -0
  52. package/src/abi/index.ts +1 -0
  53. package/src/block/body.ts +1 -7
  54. package/src/contract/contract_class_metadata.ts +8 -0
  55. package/src/contract/contract_metadata.ts +7 -0
  56. package/src/contract/index.ts +2 -0
  57. package/src/interfaces/client.ts +0 -1
  58. package/src/interfaces/proving-job.ts +4 -4
  59. package/src/interfaces/server_circuit_prover.ts +2 -7
  60. package/src/logs/contract_class_log.ts +2 -3
  61. package/src/rollup/base_rollup_hints.ts +0 -7
  62. package/src/rollup/index.ts +1 -0
  63. package/src/rollup/public_tube_private_inputs.ts +10 -3
  64. package/src/rollup/public_tube_public_inputs.ts +52 -0
  65. package/src/rollup/public_tx_base_rollup_private_inputs.ts +3 -3
  66. package/src/tests/factories.ts +6 -6
  67. package/src/tx/tx_effect.ts +59 -204
  68. package/dest/interfaces/pxe.d.ts +0 -235
  69. package/dest/interfaces/pxe.d.ts.map +0 -1
  70. package/dest/interfaces/pxe.js +0 -13
  71. package/src/interfaces/pxe.ts +0 -284
@@ -1,235 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import { z } from 'zod';
3
- import { type AbiType, type ContractArtifact } from '../abi/abi.js';
4
- import type { EventSelector } from '../abi/event_selector.js';
5
- import { AuthWitness } from '../auth_witness/auth_witness.js';
6
- import type { AztecAddress } from '../aztec-address/index.js';
7
- import { CompleteAddress, type ContractClassWithId, type ContractInstanceWithAddress, type PartialAddress, type ProtocolContractAddresses } from '../contract/index.js';
8
- import { UniqueNote } from '../note/extended_note.js';
9
- import type { NotesFilter } from '../note/notes_filter.js';
10
- import { SimulationOverrides, TxExecutionRequest, TxSimulationResult } from '../tx/index.js';
11
- import { TxProfileResult, UtilitySimulationResult } from '../tx/profiling.js';
12
- import { TxProvingResult } from '../tx/proven_tx.js';
13
- /**
14
- * Private eXecution Environment (PXE) runs locally for each user, providing functionality for all the operations
15
- * needed to interact with the Aztec network, including account management, private data management,
16
- * transaction local simulation, and access to an Aztec node. This interface, as part of a Wallet,
17
- * is exposed to dapps for interacting with the network on behalf of the user.
18
- */
19
- export interface PXE {
20
- /**
21
- * Registers a user account in PXE given its master encryption private key.
22
- * Once a new account is registered, the PXE Service will trial-decrypt all published notes on
23
- * the chain and store those that correspond to the registered account. Will do nothing if the
24
- * account is already registered.
25
- *
26
- * @param secretKey - Secret key of the corresponding user master public key.
27
- * @param partialAddress - The partial address of the account contract corresponding to the account being registered.
28
- * @returns The complete address of the account.
29
- */
30
- registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress>;
31
- /**
32
- * Retrieves the user accounts registered on this PXE Service.
33
- * @returns An array of the accounts registered on this PXE Service.
34
- */
35
- getRegisteredAccounts(): Promise<CompleteAddress[]>;
36
- /**
37
- * Registers a user contact in PXE.
38
- *
39
- * Once a new contact is registered, the PXE Service will be able to receive notes tagged from this contact.
40
- * Will do nothing if the account is already registered.
41
- *
42
- * @param address - Address of the user to add to the address book
43
- * @returns The address address of the account.
44
- */
45
- registerSender(address: AztecAddress): Promise<AztecAddress>;
46
- /**
47
- * Retrieves the addresses stored as senders on this PXE Service.
48
- * @returns An array of the senders on this PXE Service.
49
- */
50
- getSenders(): Promise<AztecAddress[]>;
51
- /**
52
- * Removes a sender in the address book.
53
- */
54
- removeSender(address: AztecAddress): Promise<void>;
55
- /**
56
- * Registers a contract class in the PXE without registering any associated contract instance with it.
57
- *
58
- * @param artifact - The build artifact for the contract class.
59
- */
60
- registerContractClass(artifact: ContractArtifact): Promise<void>;
61
- /**
62
- * Adds deployed contracts to the PXE Service. Deployed contract information is used to access the
63
- * contract code when simulating local transactions. This is automatically called by aztec.js when
64
- * deploying a contract. Dapps that wish to interact with contracts already deployed should register
65
- * these contracts in their users' PXE Service through this method.
66
- *
67
- * @param contract - A contract instance to register, with an optional artifact which can be omitted if the contract class has already been registered.
68
- */
69
- registerContract(contract: {
70
- instance: ContractInstanceWithAddress;
71
- artifact?: ContractArtifact;
72
- }): Promise<void>;
73
- /**
74
- * Updates a deployed contract in the PXE Service. This is used to update the contract artifact when
75
- * an update has happened, so the new code can be used in the simulation of local transactions.
76
- * This is called by aztec.js when instantiating a contract in a given address with a mismatching artifact.
77
- * @param contractAddress - The address of the contract to update.
78
- * @param artifact - The updated artifact for the contract.
79
- * @throws If the artifact's contract class is not found in the PXE or if the contract class is different from
80
- * the current one (current one from the point of view of the node to which the PXE is connected).
81
- */
82
- updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void>;
83
- /**
84
- * Retrieves the addresses of contracts added to this PXE Service.
85
- * @returns An array of contracts addresses registered on this PXE Service.
86
- */
87
- getContracts(): Promise<AztecAddress[]>;
88
- /**
89
- * Proves the private portion of a simulated transaction, ready to send to the network
90
- * (where validators prove the public portion).
91
- *
92
- * @param txRequest - An authenticated tx request ready for proving
93
- * @returns A result containing the proof and public inputs of the tail circuit.
94
- * @throws If contract code not found, or public simulation reverts.
95
- * Also throws if simulatePublic is true and public simulation reverts.
96
- */
97
- proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult>;
98
- /**
99
- * Simulates a transaction based on the provided preauthenticated execution request.
100
- * This will run a local simulation of private execution (and optionally of public as well), run the
101
- * kernel circuits to ensure adherence to protocol rules (without generating a proof), and return the
102
- * simulation results .
103
- *
104
- *
105
- * Note that this is used with `ContractFunctionInteraction::simulateTx` to bypass certain checks.
106
- * In that case, the transaction returned is only potentially ready to be sent to the network for execution.
107
- *
108
- *
109
- * @param txRequest - An authenticated tx request ready for simulation
110
- * @param simulatePublic - Whether to simulate the public part of the transaction.
111
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
112
- * @param skipFeeEnforcement - (Optional) If false, fees are enforced.
113
- * @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
114
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
115
- * @returns A simulated transaction result object that includes public and private return values.
116
- * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
117
- * Also throws if simulatePublic is true and public simulation reverts.
118
- */
119
- simulateTx(txRequest: TxExecutionRequest, simulatePublic: boolean, skipTxValidation?: boolean, skipFeeEnforcement?: boolean, overrides?: SimulationOverrides, scopes?: AztecAddress[]): Promise<TxSimulationResult>;
120
- /**
121
- * Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
122
- *
123
- * @param txRequest - An authenticated tx request ready for simulation
124
- * @param msgSender - (Optional) The message sender to use for the simulation.
125
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
126
- * @returns A trace of the program execution with gate counts.
127
- * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
128
- */
129
- profileTx(txRequest: TxExecutionRequest, profileMode: 'gates' | 'execution-steps' | 'full', skipProofGeneration?: boolean, msgSender?: AztecAddress): Promise<TxProfileResult>;
130
- /**
131
- * Gets notes registered in this PXE based on the provided filter.
132
- * @param filter - The filter to apply to the notes.
133
- * @returns The requested notes.
134
- */
135
- getNotes(filter: NotesFilter): Promise<UniqueNote[]>;
136
- /**
137
- * Simulate the execution of a contract utility function.
138
- *
139
- * @param functionName - The name of the utility contract function to be called.
140
- * @param args - The arguments to be provided to the function.
141
- * @param to - The address of the contract to be called.
142
- * @param authwits - (Optional) The authentication witnesses required for the function call.
143
- * @param from - (Optional) The msg sender to set for the call.
144
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
145
- * default to all.
146
- * @returns The result of the utility function call, structured based on the function ABI.
147
- */
148
- simulateUtility(functionName: string, args: any[], to: AztecAddress, authwits?: AuthWitness[], from?: AztecAddress, scopes?: AztecAddress[]): Promise<UtilitySimulationResult>;
149
- /**
150
- * Returns information about this PXE.
151
- */
152
- getPXEInfo(): Promise<PXEInfo>;
153
- /**
154
- * Returns the contract metadata given an address.
155
- * The metadata consists of its contract instance, which includes the contract class identifier,
156
- * initialization hash, deployment salt, and public keys hash; whether the contract instance has been initialized;
157
- * and whether the contract instance with the given address has been publicly deployed.
158
- * @remark - it queries the node to check whether the contract instance has been initialized / publicly deployed through a node.
159
- * This query is not dependent on the PXE.
160
- * @param address - The address that the contract instance resides at.
161
- * @returns - It returns the contract metadata
162
- * TODO(@spalladino): Should we return the public keys in plain as well here?
163
- */
164
- getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
165
- /**
166
- * Returns the contract class metadata given a contract class id.
167
- * The metadata consists of its contract class, whether it has been publicly registered, and its artifact.
168
- * @remark - it queries the node to check whether the contract class with the given id has been publicly registered.
169
- * @param id - Identifier of the class.
170
- * @param includeArtifact - Identifier of the class.
171
- * @returns - It returns the contract class metadata, with the artifact field being optional, and will only be returned if true is passed in
172
- * for `includeArtifact`
173
- * TODO(@spalladino): The PXE actually holds artifacts and not classes, what should we return? Also,
174
- * should the pxe query the node for contract public info, and merge it with its own definitions?
175
- * TODO(@spalladino): This method is strictly needed to decide whether to publicly register a class or not
176
- * during a public deployment. We probably want a nicer and more general API for this, but it'll have to
177
- * do for the time being.
178
- */
179
- getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
180
- /**
181
- * Returns the private events given search parameters.
182
- * @param contractAddress - The address of the contract to get events from.
183
- * @param eventMetadata - Metadata of the event. This should be the class generated from the contract. e.g. Contract.events.Event
184
- * @param from - The block number to search from.
185
- * @param numBlocks - The amount of blocks to search.
186
- * @param recipients - The addresses that decrypted the logs.
187
- * @returns - The deserialized events.
188
- */
189
- getPrivateEvents<T>(contractAddress: AztecAddress, eventMetadata: EventMetadataDefinition, from: number, numBlocks: number, recipients: AztecAddress[]): Promise<T[]>;
190
- /**
191
- * Stops the PXE's job queue.
192
- */
193
- stop(): Promise<void>;
194
- }
195
- export type EventMetadataDefinition = {
196
- eventSelector: EventSelector;
197
- abiType: AbiType;
198
- fieldNames: string[];
199
- };
200
- export declare const EventMetadataDefinitionSchema: z.ZodObject<{
201
- eventSelector: z.ZodType<EventSelector, any, string>;
202
- abiType: z.ZodType<AbiType, z.ZodTypeDef, AbiType>;
203
- fieldNames: z.ZodArray<z.ZodString, "many">;
204
- }, "strip", z.ZodTypeAny, {
205
- eventSelector: EventSelector;
206
- abiType: AbiType;
207
- fieldNames: string[];
208
- }, {
209
- eventSelector: string;
210
- abiType: AbiType;
211
- fieldNames: string[];
212
- }>;
213
- /** This is used in getting events via the filter */
214
- export declare enum EventType {
215
- Encrypted = "Encrypted",
216
- Unencrypted = "Unencrypted"
217
- }
218
- /** Provides basic information about the running PXE. */
219
- export interface PXEInfo {
220
- /** Version as tracked in the aztec-packages repository. */
221
- pxeVersion: string;
222
- /** Protocol contract addresses */
223
- protocolContractAddresses: ProtocolContractAddresses;
224
- }
225
- export interface ContractMetadata {
226
- contractInstance?: ContractInstanceWithAddress | undefined;
227
- isContractInitialized: boolean;
228
- isContractPublished: boolean;
229
- }
230
- export interface ContractClassMetadata {
231
- contractClass?: ContractClassWithId | undefined;
232
- isContractClassPubliclyRegistered: boolean;
233
- artifact?: ContractArtifact | undefined;
234
- }
235
- //# sourceMappingURL=pxe.d.ts.map
@@ -1 +0,0 @@
1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C;CACtD;AAED,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAC3D,qBAAqB,EAAE,OAAO,CAAC;IAC/B,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,iCAAiC,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACzC"}
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- import { AbiTypeSchema } from '../abi/abi.js';
3
- import { schemas } from '../schemas/schemas.js';
4
- export const EventMetadataDefinitionSchema = z.object({
5
- eventSelector: schemas.EventSelector,
6
- abiType: AbiTypeSchema,
7
- fieldNames: z.array(z.string())
8
- });
9
- /** This is used in getting events via the filter */ export var EventType = /*#__PURE__*/ function(EventType) {
10
- EventType["Encrypted"] = "Encrypted";
11
- EventType["Unencrypted"] = "Unencrypted";
12
- return EventType;
13
- }({});
@@ -1,284 +0,0 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
-
3
- import { z } from 'zod';
4
-
5
- import { type AbiType, AbiTypeSchema, type ContractArtifact } from '../abi/abi.js';
6
- import type { EventSelector } from '../abi/event_selector.js';
7
- import { AuthWitness } from '../auth_witness/auth_witness.js';
8
- import type { AztecAddress } from '../aztec-address/index.js';
9
- import {
10
- CompleteAddress,
11
- type ContractClassWithId,
12
- type ContractInstanceWithAddress,
13
- type PartialAddress,
14
- type ProtocolContractAddresses,
15
- } from '../contract/index.js';
16
- import { UniqueNote } from '../note/extended_note.js';
17
- import type { NotesFilter } from '../note/notes_filter.js';
18
- import { schemas } from '../schemas/schemas.js';
19
- import { SimulationOverrides, TxExecutionRequest, TxSimulationResult } from '../tx/index.js';
20
- import { TxProfileResult, UtilitySimulationResult } from '../tx/profiling.js';
21
- import { TxProvingResult } from '../tx/proven_tx.js';
22
-
23
- // docs:start:pxe-interface
24
- /**
25
- * Private eXecution Environment (PXE) runs locally for each user, providing functionality for all the operations
26
- * needed to interact with the Aztec network, including account management, private data management,
27
- * transaction local simulation, and access to an Aztec node. This interface, as part of a Wallet,
28
- * is exposed to dapps for interacting with the network on behalf of the user.
29
- */
30
- export interface PXE {
31
- /**
32
- * Registers a user account in PXE given its master encryption private key.
33
- * Once a new account is registered, the PXE Service will trial-decrypt all published notes on
34
- * the chain and store those that correspond to the registered account. Will do nothing if the
35
- * account is already registered.
36
- *
37
- * @param secretKey - Secret key of the corresponding user master public key.
38
- * @param partialAddress - The partial address of the account contract corresponding to the account being registered.
39
- * @returns The complete address of the account.
40
- */
41
- registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress>;
42
-
43
- /**
44
- * Retrieves the user accounts registered on this PXE Service.
45
- * @returns An array of the accounts registered on this PXE Service.
46
- */
47
- getRegisteredAccounts(): Promise<CompleteAddress[]>;
48
-
49
- /**
50
- * Registers a user contact in PXE.
51
- *
52
- * Once a new contact is registered, the PXE Service will be able to receive notes tagged from this contact.
53
- * Will do nothing if the account is already registered.
54
- *
55
- * @param address - Address of the user to add to the address book
56
- * @returns The address address of the account.
57
- */
58
- registerSender(address: AztecAddress): Promise<AztecAddress>;
59
-
60
- /**
61
- * Retrieves the addresses stored as senders on this PXE Service.
62
- * @returns An array of the senders on this PXE Service.
63
- */
64
- getSenders(): Promise<AztecAddress[]>;
65
-
66
- /**
67
- * Removes a sender in the address book.
68
- */
69
- removeSender(address: AztecAddress): Promise<void>;
70
-
71
- /**
72
- * Registers a contract class in the PXE without registering any associated contract instance with it.
73
- *
74
- * @param artifact - The build artifact for the contract class.
75
- */
76
- registerContractClass(artifact: ContractArtifact): Promise<void>;
77
-
78
- /**
79
- * Adds deployed contracts to the PXE Service. Deployed contract information is used to access the
80
- * contract code when simulating local transactions. This is automatically called by aztec.js when
81
- * deploying a contract. Dapps that wish to interact with contracts already deployed should register
82
- * these contracts in their users' PXE Service through this method.
83
- *
84
- * @param contract - A contract instance to register, with an optional artifact which can be omitted if the contract class has already been registered.
85
- */
86
- registerContract(contract: { instance: ContractInstanceWithAddress; artifact?: ContractArtifact }): Promise<void>;
87
-
88
- /**
89
- * Updates a deployed contract in the PXE Service. This is used to update the contract artifact when
90
- * an update has happened, so the new code can be used in the simulation of local transactions.
91
- * This is called by aztec.js when instantiating a contract in a given address with a mismatching artifact.
92
- * @param contractAddress - The address of the contract to update.
93
- * @param artifact - The updated artifact for the contract.
94
- * @throws If the artifact's contract class is not found in the PXE or if the contract class is different from
95
- * the current one (current one from the point of view of the node to which the PXE is connected).
96
- */
97
- updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void>;
98
-
99
- /**
100
- * Retrieves the addresses of contracts added to this PXE Service.
101
- * @returns An array of contracts addresses registered on this PXE Service.
102
- */
103
- getContracts(): Promise<AztecAddress[]>;
104
-
105
- /**
106
- * Proves the private portion of a simulated transaction, ready to send to the network
107
- * (where validators prove the public portion).
108
- *
109
- * @param txRequest - An authenticated tx request ready for proving
110
- * @returns A result containing the proof and public inputs of the tail circuit.
111
- * @throws If contract code not found, or public simulation reverts.
112
- * Also throws if simulatePublic is true and public simulation reverts.
113
- */
114
- proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult>;
115
-
116
- /**
117
- * Simulates a transaction based on the provided preauthenticated execution request.
118
- * This will run a local simulation of private execution (and optionally of public as well), run the
119
- * kernel circuits to ensure adherence to protocol rules (without generating a proof), and return the
120
- * simulation results .
121
- *
122
- *
123
- * Note that this is used with `ContractFunctionInteraction::simulateTx` to bypass certain checks.
124
- * In that case, the transaction returned is only potentially ready to be sent to the network for execution.
125
- *
126
- *
127
- * @param txRequest - An authenticated tx request ready for simulation
128
- * @param simulatePublic - Whether to simulate the public part of the transaction.
129
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
130
- * @param skipFeeEnforcement - (Optional) If false, fees are enforced.
131
- * @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
132
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
133
- * @returns A simulated transaction result object that includes public and private return values.
134
- * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
135
- * Also throws if simulatePublic is true and public simulation reverts.
136
- */
137
- simulateTx(
138
- txRequest: TxExecutionRequest,
139
- simulatePublic: boolean,
140
- skipTxValidation?: boolean,
141
- skipFeeEnforcement?: boolean,
142
- overrides?: SimulationOverrides,
143
- scopes?: AztecAddress[],
144
- ): Promise<TxSimulationResult>;
145
-
146
- /**
147
- * Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
148
- *
149
- * @param txRequest - An authenticated tx request ready for simulation
150
- * @param msgSender - (Optional) The message sender to use for the simulation.
151
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
152
- * @returns A trace of the program execution with gate counts.
153
- * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
154
- */
155
- profileTx(
156
- txRequest: TxExecutionRequest,
157
- profileMode: 'gates' | 'execution-steps' | 'full',
158
- skipProofGeneration?: boolean,
159
- msgSender?: AztecAddress,
160
- ): Promise<TxProfileResult>;
161
-
162
- /**
163
- * Gets notes registered in this PXE based on the provided filter.
164
- * @param filter - The filter to apply to the notes.
165
- * @returns The requested notes.
166
- */
167
- getNotes(filter: NotesFilter): Promise<UniqueNote[]>;
168
-
169
- /**
170
- * Simulate the execution of a contract utility function.
171
- *
172
- * @param functionName - The name of the utility contract function to be called.
173
- * @param args - The arguments to be provided to the function.
174
- * @param to - The address of the contract to be called.
175
- * @param authwits - (Optional) The authentication witnesses required for the function call.
176
- * @param from - (Optional) The msg sender to set for the call.
177
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
178
- * default to all.
179
- * @returns The result of the utility function call, structured based on the function ABI.
180
- */
181
- simulateUtility(
182
- functionName: string,
183
- args: any[],
184
- to: AztecAddress,
185
- authwits?: AuthWitness[],
186
- from?: AztecAddress,
187
- scopes?: AztecAddress[],
188
- ): Promise<UtilitySimulationResult>;
189
-
190
- /**
191
- * Returns information about this PXE.
192
- */
193
- getPXEInfo(): Promise<PXEInfo>;
194
-
195
- /**
196
- * Returns the contract metadata given an address.
197
- * The metadata consists of its contract instance, which includes the contract class identifier,
198
- * initialization hash, deployment salt, and public keys hash; whether the contract instance has been initialized;
199
- * and whether the contract instance with the given address has been publicly deployed.
200
- * @remark - it queries the node to check whether the contract instance has been initialized / publicly deployed through a node.
201
- * This query is not dependent on the PXE.
202
- * @param address - The address that the contract instance resides at.
203
- * @returns - It returns the contract metadata
204
- * TODO(@spalladino): Should we return the public keys in plain as well here?
205
- */
206
- getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
207
-
208
- /**
209
- * Returns the contract class metadata given a contract class id.
210
- * The metadata consists of its contract class, whether it has been publicly registered, and its artifact.
211
- * @remark - it queries the node to check whether the contract class with the given id has been publicly registered.
212
- * @param id - Identifier of the class.
213
- * @param includeArtifact - Identifier of the class.
214
- * @returns - It returns the contract class metadata, with the artifact field being optional, and will only be returned if true is passed in
215
- * for `includeArtifact`
216
- * TODO(@spalladino): The PXE actually holds artifacts and not classes, what should we return? Also,
217
- * should the pxe query the node for contract public info, and merge it with its own definitions?
218
- * TODO(@spalladino): This method is strictly needed to decide whether to publicly register a class or not
219
- * during a public deployment. We probably want a nicer and more general API for this, but it'll have to
220
- * do for the time being.
221
- */
222
- getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
223
-
224
- /**
225
- * Returns the private events given search parameters.
226
- * @param contractAddress - The address of the contract to get events from.
227
- * @param eventMetadata - Metadata of the event. This should be the class generated from the contract. e.g. Contract.events.Event
228
- * @param from - The block number to search from.
229
- * @param numBlocks - The amount of blocks to search.
230
- * @param recipients - The addresses that decrypted the logs.
231
- * @returns - The deserialized events.
232
- */
233
- getPrivateEvents<T>(
234
- contractAddress: AztecAddress,
235
- eventMetadata: EventMetadataDefinition,
236
- from: number,
237
- numBlocks: number,
238
- recipients: AztecAddress[],
239
- ): Promise<T[]>;
240
-
241
- /**
242
- * Stops the PXE's job queue.
243
- */
244
- stop(): Promise<void>;
245
- }
246
- // docs:end:pxe-interface
247
-
248
- export type EventMetadataDefinition = {
249
- eventSelector: EventSelector;
250
- abiType: AbiType;
251
- fieldNames: string[];
252
- };
253
-
254
- export const EventMetadataDefinitionSchema = z.object({
255
- eventSelector: schemas.EventSelector,
256
- abiType: AbiTypeSchema,
257
- fieldNames: z.array(z.string()),
258
- });
259
-
260
- /** This is used in getting events via the filter */
261
- export enum EventType {
262
- Encrypted = 'Encrypted',
263
- Unencrypted = 'Unencrypted',
264
- }
265
-
266
- /** Provides basic information about the running PXE. */
267
- export interface PXEInfo {
268
- /** Version as tracked in the aztec-packages repository. */
269
- pxeVersion: string;
270
- /** Protocol contract addresses */
271
- protocolContractAddresses: ProtocolContractAddresses;
272
- }
273
-
274
- export interface ContractMetadata {
275
- contractInstance?: ContractInstanceWithAddress | undefined;
276
- isContractInitialized: boolean;
277
- isContractPublished: boolean;
278
- }
279
-
280
- export interface ContractClassMetadata {
281
- contractClass?: ContractClassWithId | undefined;
282
- isContractClassPubliclyRegistered: boolean;
283
- artifact?: ContractArtifact | undefined;
284
- }