@aztec/pxe 3.0.0-devnet.2 → 3.0.0-devnet.2-patch.1
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/bin/check_oracle_version.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +105 -15
- package/dest/config/index.d.ts +2 -10
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +7 -13
- package/dest/config/package_info.d.ts +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -6
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +15 -16
- package/dest/contract_function_simulator/execution_data_provider.d.ts +13 -19
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +9 -7
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +21 -13
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +12 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -1
- package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +17 -10
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -4
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +31 -14
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +4 -3
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +8 -12
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +20 -7
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +13 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +5 -4
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +15 -13
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +50 -25
- package/dest/entrypoints/client/bundle/index.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +13 -4
- package/dest/entrypoints/client/lazy/index.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +13 -4
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +13 -20
- package/dest/error_enriching.d.ts +1 -1
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +8 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +4 -4
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +26 -25
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +6 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/pxe.d.ts +26 -19
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +35 -50
- package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -1
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
- package/dest/storage/address_data_provider/index.d.ts +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +2 -2
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -1
- package/dest/storage/capsule_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +3 -13
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -12
- package/dest/storage/contract_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +1 -1
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/note_data_provider/index.d.ts +2 -2
- package/dest/storage/note_data_provider/index.d.ts.map +1 -1
- package/dest/storage/note_data_provider/index.js +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +8 -7
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +27 -13
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +30 -14
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +47 -25
- package/dest/storage/sync_data_provider/index.d.ts +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +3 -2
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
- package/dest/storage/tagging_data_provider/index.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
- package/dest/synchronizer/index.d.ts +1 -1
- package/dest/synchronizer/synchronizer.d.ts +3 -2
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +2 -1
- package/dest/tagging/constants.d.ts +1 -1
- package/dest/tagging/index.d.ts +1 -1
- package/dest/tagging/siloed_tag.d.ts +2 -2
- package/dest/tagging/siloed_tag.d.ts.map +1 -1
- package/dest/tagging/siloed_tag.js +1 -1
- package/dest/tagging/tag.d.ts +2 -2
- package/dest/tagging/tag.d.ts.map +1 -1
- package/dest/tagging/tag.js +1 -1
- package/dest/tagging/utils.d.ts +1 -1
- package/package.json +20 -19
- package/src/bin/check_oracle_version.ts +130 -20
- package/src/config/index.ts +8 -23
- package/src/contract_function_simulator/contract_function_simulator.ts +23 -18
- package/src/contract_function_simulator/execution_data_provider.ts +18 -18
- package/src/contract_function_simulator/execution_note_cache.ts +22 -11
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +24 -8
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
- package/src/contract_function_simulator/oracle/oracle.ts +40 -10
- package/src/contract_function_simulator/oracle/private_execution.ts +3 -2
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +17 -4
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +22 -9
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/pxe_oracle_interface.ts +98 -59
- package/src/entrypoints/client/bundle/utils.ts +10 -4
- package/src/entrypoints/client/lazy/utils.ts +10 -5
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/utils.ts +13 -31
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +47 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
- package/src/private_kernel/private_kernel_execution_prover.ts +27 -31
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +4 -3
- package/src/pxe.ts +50 -75
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +1 -18
- package/src/storage/contract_data_provider/private_functions_tree.ts +1 -1
- package/src/storage/note_data_provider/index.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +34 -15
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +69 -35
- package/src/storage/sync_data_provider/sync_data_provider.ts +2 -1
- package/src/synchronizer/synchronizer.ts +2 -1
- package/src/tagging/siloed_tag.ts +2 -2
- package/src/tagging/tag.ts +2 -2
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/src/storage/note_data_provider/note_dao.ts +0 -154
package/dest/pxe.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
4
4
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
5
|
import { KeyStore } from '@aztec/key-store';
|
|
6
6
|
import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
7
7
|
import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
8
|
-
import { FunctionSelector, FunctionType,
|
|
8
|
+
import { FunctionSelector, FunctionType, decodeFunctionSignature, encodeArguments } from '@aztec/stdlib/abi';
|
|
9
9
|
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
10
10
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
11
|
-
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
12
|
-
import { UniqueNote } from '@aztec/stdlib/note';
|
|
11
|
+
import { computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
13
12
|
import { PrivateSimulationResult, TxProfileResult, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
14
13
|
import { inspect } from 'util';
|
|
15
14
|
import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
|
|
@@ -18,6 +17,7 @@ import { ProxiedContractDataProviderFactory } from './contract_function_simulato
|
|
|
18
17
|
import { ProxiedNodeFactory } from './contract_function_simulator/proxied_node.js';
|
|
19
18
|
import { PXEOracleInterface } from './contract_function_simulator/pxe_oracle_interface.js';
|
|
20
19
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
20
|
+
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
21
21
|
import { PrivateKernelExecutionProver } from './private_kernel/private_kernel_execution_prover.js';
|
|
22
22
|
import { PrivateKernelOracleImpl } from './private_kernel/private_kernel_oracle_impl.js';
|
|
23
23
|
import { AddressDataProvider } from './storage/address_data_provider/address_data_provider.js';
|
|
@@ -146,7 +146,7 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
146
146
|
async #getFunctionCall(functionName, args, to) {
|
|
147
147
|
const contract = await this.contractDataProvider.getContract(to);
|
|
148
148
|
if (!contract) {
|
|
149
|
-
throw new Error(`Unknown contract ${to}: add it to PXE by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/
|
|
149
|
+
throw new Error(`Unknown contract ${to}: add it to PXE by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`);
|
|
150
150
|
}
|
|
151
151
|
const functionDao = contract.functions.find((f)=>f.name === functionName);
|
|
152
152
|
if (!functionDao) {
|
|
@@ -232,7 +232,7 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
232
232
|
* @param proofCreator - The proof creator to use for proving the execution.
|
|
233
233
|
* @param privateExecutionResult - The result of the private execution
|
|
234
234
|
* @param config - The configuration for the kernel execution prover.
|
|
235
|
-
* @returns An object that contains the output of the kernel execution, including the
|
|
235
|
+
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
236
236
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, config) {
|
|
237
237
|
const simulationAnchorBlock = privateExecutionResult.getSimulationAnchorBlockNumber();
|
|
238
238
|
const kernelOracle = new PrivateKernelOracleImpl(this.contractDataProvider, this.keyStore, this.node, simulationAnchorBlock);
|
|
@@ -454,19 +454,9 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
454
454
|
* @returns The requested notes.
|
|
455
455
|
*/ async getNotes(filter) {
|
|
456
456
|
// We need to manually trigger private state sync to have a guarantee that all the notes are available.
|
|
457
|
-
await this
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
const completeAddresses = await this.addressDataProvider.getCompleteAddresses();
|
|
461
|
-
const completeAddressIndex = completeAddresses.findIndex((completeAddress)=>completeAddress.address.equals(dao.recipient));
|
|
462
|
-
const completeAddress = completeAddresses[completeAddressIndex];
|
|
463
|
-
if (completeAddress === undefined) {
|
|
464
|
-
throw new Error(`Cannot find complete address for recipient ${dao.recipient.toString()}`);
|
|
465
|
-
}
|
|
466
|
-
const recipient = completeAddress.address;
|
|
467
|
-
return new UniqueNote(dao.note, recipient, dao.contractAddress, dao.storageSlot, dao.txHash, dao.noteNonce);
|
|
468
|
-
});
|
|
469
|
-
return Promise.all(uniqueNotes);
|
|
457
|
+
const call = await this.#getFunctionCall('sync_private_state', [], filter.contractAddress);
|
|
458
|
+
await this.simulateUtility(call);
|
|
459
|
+
return this.noteDataProvider.getNotes(filter);
|
|
470
460
|
}
|
|
471
461
|
/**
|
|
472
462
|
* Proves the private portion of a simulated transaction, ready to send to the network
|
|
@@ -488,7 +478,7 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
488
478
|
const syncTime = syncTimer.ms();
|
|
489
479
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
490
480
|
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest);
|
|
491
|
-
const { publicInputs,
|
|
481
|
+
const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
492
482
|
simulate: false,
|
|
493
483
|
skipFeeEnforcement: false,
|
|
494
484
|
profileMode: 'none'
|
|
@@ -509,7 +499,7 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
509
499
|
this.log.debug(`Proving completed in ${totalTime}ms`, {
|
|
510
500
|
timings
|
|
511
501
|
});
|
|
512
|
-
const txProvingResult = new TxProvingResult(privateExecutionResult, publicInputs,
|
|
502
|
+
const txProvingResult = new TxProvingResult(privateExecutionResult, publicInputs, chonkProof, {
|
|
513
503
|
timings,
|
|
514
504
|
nodeRPCCalls: contractFunctionSimulator?.getStats().nodeRPCCalls
|
|
515
505
|
});
|
|
@@ -640,9 +630,8 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
640
630
|
let executionSteps = [];
|
|
641
631
|
if (skipKernels) {
|
|
642
632
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
643
|
-
// can either be the first nullifier in the tx or the
|
|
644
|
-
|
|
645
|
-
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO) ? await txRequest.toTxRequest().hash() : privateExecutionResult.firstNullifier;
|
|
633
|
+
// can either be the first nullifier in the tx or the protocol nullifier if there are none.
|
|
634
|
+
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO) ? await computeProtocolNullifier(await txRequest.toTxRequest().hash()) : privateExecutionResult.firstNullifier;
|
|
646
635
|
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, this.contractDataProvider));
|
|
647
636
|
} else {
|
|
648
637
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
@@ -710,15 +699,12 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
710
699
|
/**
|
|
711
700
|
* Simulate the execution of a contract utility function.
|
|
712
701
|
*
|
|
713
|
-
* @param
|
|
714
|
-
* @param args - The arguments to be provided to the function.
|
|
715
|
-
* @param to - The address of the contract to be called.
|
|
702
|
+
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
716
703
|
* @param authwits - (Optional) The authentication witnesses required for the function call.
|
|
717
|
-
* @param from - (Optional) The msg sender to set for the call.
|
|
718
704
|
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
719
705
|
* default to all.
|
|
720
706
|
* @returns The result of the utility function call, structured based on the function ABI.
|
|
721
|
-
*/ simulateUtility(
|
|
707
|
+
*/ simulateUtility(call, authwits, scopes) {
|
|
722
708
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
723
709
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
724
710
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
@@ -728,15 +714,14 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
728
714
|
const syncTimer = new Timer();
|
|
729
715
|
await this.synchronizer.sync();
|
|
730
716
|
const syncTime = syncTimer.ms();
|
|
731
|
-
const functionCall = await this.#getFunctionCall(functionName, args, to);
|
|
732
717
|
const functionTimer = new Timer();
|
|
733
718
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
734
|
-
const executionResult = await this.#simulateUtility(contractFunctionSimulator,
|
|
719
|
+
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes);
|
|
735
720
|
const functionTime = functionTimer.ms();
|
|
736
721
|
const totalTime = totalTimer.ms();
|
|
737
722
|
const perFunction = [
|
|
738
723
|
{
|
|
739
|
-
functionName,
|
|
724
|
+
functionName: call.name,
|
|
740
725
|
time: functionTime
|
|
741
726
|
}
|
|
742
727
|
];
|
|
@@ -755,31 +740,31 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
755
740
|
}
|
|
756
741
|
};
|
|
757
742
|
} catch (err) {
|
|
743
|
+
const { to, name, args } = call;
|
|
758
744
|
const stringifiedArgs = args.map((arg)=>arg.toString()).join(', ');
|
|
759
|
-
throw this.#contextualizeError(err, `simulateUtility ${to}:${
|
|
745
|
+
throw this.#contextualizeError(err, `simulateUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes?.map((s)=>s.toString()).join(', ') ?? 'undefined'}`);
|
|
760
746
|
}
|
|
761
747
|
});
|
|
762
748
|
}
|
|
763
749
|
/**
|
|
764
750
|
* Returns the private events given search parameters.
|
|
765
|
-
* @param
|
|
766
|
-
* @param
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
751
|
+
* @param eventSelector - Event selector to search for.
|
|
752
|
+
* @param filter
|
|
753
|
+
* contractAddress - The address of the contract to get events from. Required.
|
|
754
|
+
* scopes - One or more event scope addresses to filter by. Required.
|
|
755
|
+
* fromBlock - The block number to search from (inclusive). Optional. If provided, it must be >= 0.
|
|
756
|
+
* Defaults to 0.
|
|
757
|
+
* If toBlock is defined but fromBlock is not, fromBlock defaults to toBlock - 1.
|
|
758
|
+
* toBlock - The block number to search up to (exclusive). Optional. If provided, it must be > 0.
|
|
759
|
+
* Defaults to the latest known block to PXE + 1.
|
|
760
|
+
* @returns - The packed events with block and tx metadata.
|
|
761
|
+
*/ async getPrivateEvents(eventSelector, filter) {
|
|
776
762
|
// We need to manually trigger private state sync to have a guarantee that all the events are available.
|
|
777
|
-
await this
|
|
778
|
-
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
return decodedEvents;
|
|
763
|
+
const call = await this.#getFunctionCall('sync_private_state', [], filter.contractAddress);
|
|
764
|
+
await this.simulateUtility(call);
|
|
765
|
+
const sanitizedFilter = await new PrivateEventFilterValidator(this.syncDataProvider).validate(filter);
|
|
766
|
+
this.log.error(`Getting private events for ${sanitizedFilter.contractAddress.toString()} from ${sanitizedFilter.fromBlock} to ${sanitizedFilter.toBlock}`);
|
|
767
|
+
return this.privateEventDataProvider.getPrivateEvents(eventSelector, sanitizedFilter);
|
|
783
768
|
}
|
|
784
769
|
/**
|
|
785
770
|
* Stops the PXE's job queue.
|
|
@@ -8,4 +8,4 @@ export declare class AddressDataProvider {
|
|
|
8
8
|
getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
|
|
9
9
|
getCompleteAddresses(): Promise<CompleteAddress[]>;
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzc19kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9hZGRyZXNzX2RhdGFfcHJvdmlkZXIvYWRkcmVzc19kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFtQixpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN6RixPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFekQscUJBQWEsbUJBQW1COztJQUs5QixZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFLbkM7SUFFRCxrQkFBa0IsQ0FBQyxlQUFlLEVBQUUsZUFBZSxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0EwQnJFO0lBWUQsa0JBQWtCLENBQUMsT0FBTyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsZUFBZSxHQUFHLFNBQVMsQ0FBQyxDQUU5RTtJQUVLLG9CQUFvQixJQUFJLE9BQU8sQ0FBQyxlQUFlLEVBQUUsQ0FBQyxDQUl2RDtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/address_data_provider/address_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,mBAAmB;;
|
|
1
|
+
{"version":3,"file":"address_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/address_data_provider/address_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,mBAAmB;;IAK9B,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA0BrE;IAYD,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAE9E;IAEK,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAIvD;CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AddressDataProvider } from './address_data_provider.js';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2FkZHJlc3NfZGF0YV9wcm92aWRlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQyJ9
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { type Logger } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -22,4 +22,4 @@ export declare class CapsuleDataProvider {
|
|
|
22
22
|
readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr): Promise<Fr[][]>;
|
|
23
23
|
setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=
|
|
25
|
+
//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RSxFQUFFLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRSxVQUFVLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0F3QnRHO0lBRUQ7Ozs7Ozs7T0FPRztJQUNILG9CQUFvQixDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsUUFBUSxFQUFFLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBZ0JoRztJQUVELGdCQUFnQixDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsUUFBUSxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBQyxDQXNCN0U7SUFFRCxlQUFlLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsRUFBRSxFQUFFLE9BQU8sRUFBRSxFQUFFLEVBQUUsRUFBRSxpQkFtQjNFO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capsule_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_data_provider/capsule_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"capsule_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_data_provider/capsule_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,qBAAa,mBAAmB;;IAM9B,MAAM,EAAE,MAAM,CAAC;IAEf,YAAY,KAAK,EAAE,iBAAiB,EAMnC;IAEK,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UJBQW1CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQyJ9
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
|
-
import { type ContractArtifact, type FunctionAbi, type
|
|
5
|
+
import { type ContractArtifact, type FunctionAbi, type FunctionArtifactWithContractName, type FunctionDebugMetadata, FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
7
|
import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
8
8
|
/**
|
|
@@ -35,16 +35,6 @@ export declare class ContractDataProvider {
|
|
|
35
35
|
*/
|
|
36
36
|
getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionArtifactWithContractName | undefined>;
|
|
37
37
|
getPublicFunctionArtifact(contractAddress: AztecAddress): Promise<FunctionArtifactWithContractName | undefined>;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
40
|
-
* The function is identified by its name, which is unique within a contract.
|
|
41
|
-
* Throws if the contract has not been added to the database.
|
|
42
|
-
*
|
|
43
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
44
|
-
* @param functionName - The name of the function.
|
|
45
|
-
* @returns The corresponding function's artifact as an object
|
|
46
|
-
*/
|
|
47
|
-
getFunctionArtifactByName(contractAddress: AztecAddress, functionName: string): Promise<FunctionArtifact | undefined>;
|
|
48
38
|
getFunctionAbi(contractAddress: AztecAddress, selector: FunctionSelector): Promise<FunctionAbi | undefined>;
|
|
49
39
|
/**
|
|
50
40
|
* Retrieves the debug metadata of a specified function within a given contract.
|
|
@@ -71,4 +61,4 @@ export declare class ContractDataProvider {
|
|
|
71
61
|
getDebugContractName(contractAddress: AztecAddress): Promise<string | undefined>;
|
|
72
62
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
73
63
|
}
|
|
74
|
-
//# sourceMappingURL=
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfZGF0YV9wcm92aWRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY29udHJhY3RfZGF0YV9wcm92aWRlci9jb250cmFjdF9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEVBQ0wsS0FBSyxnQkFBZ0IsRUFDckIsS0FBSyxXQUFXLEVBRWhCLEtBQUssZ0NBQWdDLEVBQ3JDLEtBQUsscUJBQXFCLEVBQzFCLGdCQUFnQixFQUtqQixNQUFNLG1CQUFtQixDQUFDO0FBQzNCLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEVBQ0wsS0FBSyxhQUFhLEVBQ2xCLEtBQUssMkJBQTJCLEVBR2pDLE1BQU0sd0JBQXdCLENBQUM7QUFJaEM7Ozs7OztHQU1HO0FBQ0gscUJBQWEsb0JBQW9COztJQVcvQixZQU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tJQUVZLGNBQWMsQ0FDekIsZUFBZSxFQUFFLFlBQVksRUFDN0IsUUFBUSxFQUFFLGdCQUFnQixHQUN6QixPQUFPLENBQUMsV0FBVyxHQUFHLFNBQVMsQ0FBQyxDQUdsQztJQUVEOzs7Ozs7Ozs7T0FTRztJQUNVLHdCQUF3QixDQUNuQyxlQUFlLEVBQUUsWUFBWSxFQUM3QixRQUFRLEVBQUUsZ0JBQWdCLEdBQ3pCLE9BQU8sQ0FBQyxxQkFBcUIsR0FBRyxTQUFTLENBQUMsQ0FJNUM7SUFFWSw4QkFBOEIsQ0FDekMsZUFBZSxFQUFFLFlBQVksR0FDNUIsT0FBTyxDQUFDLHFCQUFxQixHQUFHLFNBQVMsQ0FBQyxDQUk1QztJQUVEOzs7Ozs7OztPQVFHO0lBQ1UsNEJBQTRCLENBQ3ZDLGVBQWUsRUFBRSxFQUFFLEVBQ25CLFFBQVEsRUFBRSxnQkFBZ0IsR0FDekIsT0FBTyxDQUFDLGlCQUFpQixDQUFDLE9BQU8sb0JBQW9CLENBQUMsR0FBRyxTQUFTLENBQUMsQ0FHckU7SUFFWSxvQkFBb0IsQ0FBQyxlQUFlLEVBQUUsWUFBWSwrQkFHOUQ7SUFFWSxvQkFBb0IsQ0FBQyxlQUFlLEVBQUUsWUFBWSxFQUFFLFFBQVEsRUFBRSxnQkFBZ0IsbUJBSTFGO0NBNkJGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,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CAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,gCAAgC,GAAG,SAAS,CAAC,CAIvD;IAEY,yBAAyB,CACpC,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,gCAAgC,GAAG,SAAS,CAAC,CAIvD;IAEY,cAAc,CACzB,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAGlC;IAED;;;;;;;;;OASG;IACU,wBAAwB,CACnC,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAI5C;IAEY,8BAA8B,CACzC,eAAe,EAAE,YAAY,GAC5B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAI5C;IAED;;;;;;;;OAQG;IACU,4BAA4B,CACvC,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,GAAG,SAAS,CAAC,CAGrE;IAEY,oBAAoB,CAAC,eAAe,EAAE,YAAY,+BAG9D;IAEY,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,mBAI1F;CA6BF"}
|
|
@@ -123,18 +123,6 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
123
123
|
contractName: artifact.name
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Retrieves the artifact of a specified function within a given contract.
|
|
128
|
-
* The function is identified by its name, which is unique within a contract.
|
|
129
|
-
* Throws if the contract has not been added to the database.
|
|
130
|
-
*
|
|
131
|
-
* @param contractAddress - The AztecAddress representing the contract containing the function.
|
|
132
|
-
* @param functionName - The name of the function.
|
|
133
|
-
* @returns The corresponding function's artifact as an object
|
|
134
|
-
*/ async getFunctionArtifactByName(contractAddress, functionName) {
|
|
135
|
-
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
136
|
-
return artifact?.functions.find((fn)=>fn.name === functionName);
|
|
137
|
-
}
|
|
138
126
|
async getFunctionAbi(contractAddress, selector) {
|
|
139
127
|
const artifact = await this.#getContractArtifactByAddress(contractAddress);
|
|
140
128
|
return artifact && await this.#findFunctionAbiBySelector(artifact, selector);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ContractDataProvider } from './contract_data_provider.js';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X2RhdGFfcHJvdmlkZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sNkJBQTZCLENBQUMifQ==
|
|
@@ -24,4 +24,4 @@ export declare class PrivateFunctionsTree {
|
|
|
24
24
|
getFunctionMembershipWitness(selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
|
|
25
25
|
private getTree;
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mdW5jdGlvbnNfdHJlZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY29udHJhY3RfZGF0YV9wcm92aWRlci9wcml2YXRlX2Z1bmN0aW9uc190cmVlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR3hELE9BQU8sRUFBRSxpQkFBaUIsRUFBbUIsTUFBTSx5QkFBeUIsQ0FBQztBQUM3RSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFBZ0IsTUFBTSxtQkFBbUIsQ0FBQztBQVExRjs7Ozs7R0FLRztBQUNILHFCQUFhLG9CQUFvQjtJQUdYLE9BQU8sQ0FBQyxRQUFRLENBQUMsZ0JBQWdCO0lBRnJELE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBYTtJQUUxQixPQUFPLGVBQXFFO0lBRTVFLE9BQWEsTUFBTSxDQUFDLFFBQVEsRUFBRSxnQkFBZ0IsaUNBTzdDO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDVSw0QkFBNEIsQ0FDdkMsUUFBUSxFQUFFLGdCQUFnQixHQUN6QixPQUFPLENBQUMsaUJBQWlCLENBQUMsT0FBTyxvQkFBb0IsQ0FBQyxDQUFDLENBZXpEO1lBRWEsT0FBTztDQU10QiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;
|
|
1
|
+
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO,eAAqE;IAE5E,OAAa,MAAM,CAAC,QAAQ,EAAE,gBAAgB,iCAO7C;IAED;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAezD;YAEa,OAAO;CAMtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
4
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
5
|
import { FunctionType } from '@aztec/stdlib/abi';
|
package/dest/storage/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export * from './sync_data_provider/index.js';
|
|
|
6
6
|
export * from './tagging_data_provider/index.js';
|
|
7
7
|
export * from './metadata.js';
|
|
8
8
|
export * from './private_event_data_provider/private_event_data_provider.js';
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsa0NBQWtDLENBQUM7QUFDakQsY0FBYyxrQ0FBa0MsQ0FBQztBQUNqRCxjQUFjLG1DQUFtQyxDQUFDO0FBQ2xELGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYywrQkFBK0IsQ0FBQztBQUM5QyxjQUFjLGtDQUFrQyxDQUFDO0FBQ2pELGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMsOERBQThELENBQUMifQ==
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const PXE_DATA_SCHEMA_VERSION = 2;
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0YWRhdGEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdG9yYWdlL21ldGFkYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSx1QkFBdUIsSUFBSSxDQUFDIn0=
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { NoteDao } from '
|
|
1
|
+
export { NoteDao } from '@aztec/stdlib/note';
|
|
2
2
|
export { NoteDataProvider } from './note_data_provider.js';
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL25vdGVfZGF0YV9wcm92aWRlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDN0MsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { NoteDao } from '
|
|
1
|
+
export { NoteDao } from '@aztec/stdlib/note';
|
|
2
2
|
export { NoteDataProvider } from './note_data_provider.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type {
|
|
4
|
+
import type { DataInBlock } from '@aztec/stdlib/block';
|
|
5
5
|
import { type NotesFilter } from '@aztec/stdlib/note';
|
|
6
|
-
import { NoteDao } from '
|
|
6
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
7
7
|
/**
|
|
8
8
|
* NoteDataProvider manages the storage and retrieval of notes.
|
|
9
9
|
*
|
|
@@ -62,8 +62,9 @@ export declare class NoteDataProvider {
|
|
|
62
62
|
* parameters.
|
|
63
63
|
*
|
|
64
64
|
* @param filter - Filter criteria including contractAddress (required), and optional
|
|
65
|
-
* storageSlot, status, scopes and siloedNullifier.
|
|
66
|
-
* @returns
|
|
65
|
+
* owner, storageSlot, status, scopes, and siloedNullifier.
|
|
66
|
+
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
67
|
+
* returned once if this is the case)
|
|
67
68
|
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
68
69
|
*/
|
|
69
70
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
@@ -78,6 +79,6 @@ export declare class NoteDataProvider {
|
|
|
78
79
|
* @returns Promise resolving to array of nullified NoteDao objects
|
|
79
80
|
* @throws Error if any nullifier is not found in the active notes
|
|
80
81
|
*/
|
|
81
|
-
applyNullifiers(nullifiers:
|
|
82
|
+
applyNullifiers(nullifiers: DataInBlock<Fr>[]): Promise<NoteDao[]>;
|
|
82
83
|
}
|
|
83
|
-
//# sourceMappingURL=
|
|
84
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9ub3RlX2RhdGFfcHJvdmlkZXIvbm90ZV9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRXpELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFxQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVGLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RCxPQUFPLEVBQWMsS0FBSyxXQUFXLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNsRSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFN0M7Ozs7O0lBS0k7QUFDSixxQkFBYSxnQkFBZ0I7O0lBaUIzQixPQUFPLGVBZ0JOO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDSCxPQUFvQixNQUFNLENBQUMsS0FBSyxFQUFFLGlCQUFpQixHQUFHLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQU85RTtJQUVEOzs7Ozs7OztPQVFHO0lBQ1UsUUFBUSxDQUFDLEtBQUssRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQVkzRDtJQUVEOzs7Ozs7Ozs7T0FTRztJQUNILFFBQVEsQ0FBQyxLQUFLLEVBQUUsT0FBTyxFQUFFLEVBQUUsS0FBSyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBZ0I3RDtJQUVEOzs7Ozs7Ozs7T0FTRztJQUNVLDBCQUEwQixDQUFDLFdBQVcsRUFBRSxNQUFNLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FHdEc7SUF1RkQ7Ozs7Ozs7Ozs7O09BV0c7SUFDRyxRQUFRLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUMsQ0F3R3REO0lBRUQ7Ozs7Ozs7Ozs7T0FVRztJQUNILGVBQWUsQ0FBQyxVQUFVLEVBQUUsV0FBVyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEdBQUcsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBOERqRTtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;IAKI;AACJ,qBAAa,gBAAgB;;IAiB3B,OAAO,eAgBN;IAED;;;;;;;;OAQG;IACH,OAAoB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAO9E;IAED;;;;;;;;OAQG;IACU,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAY3D;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB7D;IAED;;;;;;;;;OASG;IACU,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtG;IAuFD;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAwGtD;IAED;;;;;;;;;;OAUG;IACH,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CA8DjE;CACF"}
|
|
@@ -2,7 +2,7 @@ import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
|
2
2
|
import { toArray } from '@aztec/foundation/iterable';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { NoteStatus } from '@aztec/stdlib/note';
|
|
5
|
-
import { NoteDao } from '
|
|
5
|
+
import { NoteDao } from '@aztec/stdlib/note';
|
|
6
6
|
/**
|
|
7
7
|
* NoteDataProvider manages the storage and retrieval of notes.
|
|
8
8
|
*
|
|
@@ -158,11 +158,11 @@ import { NoteDao } from './note_dao.js';
|
|
|
158
158
|
const noteIndex = toBufferBE(dao.index, 32).toString('hex');
|
|
159
159
|
await this.#notes.set(noteIndex, dao.toBuffer());
|
|
160
160
|
await this.#nullifierToNoteId.set(dao.siloedNullifier.toString(), noteIndex);
|
|
161
|
-
|
|
161
|
+
const scopes = await toArray(this.#nullifiedNotesToScope.getValuesAsync(noteIndex));
|
|
162
162
|
if (scopes.length === 0) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
// We should never run into this error because notes always have a scope assigned to them - either on initial
|
|
164
|
+
// insertion via `addNotes` or when removing their nullifiers.
|
|
165
|
+
throw new Error(`No scopes found for nullified note with index ${noteIndex}`);
|
|
166
166
|
}
|
|
167
167
|
for (const scope of scopes){
|
|
168
168
|
await this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(), noteIndex);
|
|
@@ -185,8 +185,9 @@ import { NoteDao } from './note_dao.js';
|
|
|
185
185
|
* parameters.
|
|
186
186
|
*
|
|
187
187
|
* @param filter - Filter criteria including contractAddress (required), and optional
|
|
188
|
-
* storageSlot, status, scopes and siloedNullifier.
|
|
189
|
-
* @returns
|
|
188
|
+
* owner, storageSlot, status, scopes, and siloedNullifier.
|
|
189
|
+
* @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
|
|
190
|
+
* returned once if this is the case)
|
|
190
191
|
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
191
192
|
*/ async getNotes(filter) {
|
|
192
193
|
filter.status = filter.status ?? NoteStatus.ACTIVE;
|
|
@@ -237,6 +238,9 @@ import { NoteDao } from './note_dao.js';
|
|
|
237
238
|
if (!note.contractAddress.equals(filter.contractAddress)) {
|
|
238
239
|
continue;
|
|
239
240
|
}
|
|
241
|
+
if (filter.owner && !note.owner.equals(filter.owner)) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
240
244
|
if (filter.storageSlot && !note.storageSlot.equals(filter.storageSlot)) {
|
|
241
245
|
continue;
|
|
242
246
|
}
|
|
@@ -246,7 +250,14 @@ import { NoteDao } from './note_dao.js';
|
|
|
246
250
|
result.push(note);
|
|
247
251
|
}
|
|
248
252
|
}
|
|
249
|
-
|
|
253
|
+
// A note might be present in multiple scopes - we ensure it is only returned once
|
|
254
|
+
const deduplicated = [];
|
|
255
|
+
for (const note of result){
|
|
256
|
+
if (!deduplicated.some((existing)=>existing.equals(note))) {
|
|
257
|
+
deduplicated.push(note);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return deduplicated;
|
|
250
261
|
}
|
|
251
262
|
/**
|
|
252
263
|
* Transitions notes from "active" to "nullified" state.
|
|
@@ -280,7 +291,12 @@ import { NoteDao } from './note_dao.js';
|
|
|
280
291
|
if (!noteBuffer) {
|
|
281
292
|
throw new Error('Note not found in applyNullifiers');
|
|
282
293
|
}
|
|
283
|
-
const noteScopes = await toArray(this.#notesToScope.getValuesAsync(noteIndex))
|
|
294
|
+
const noteScopes = await toArray(this.#notesToScope.getValuesAsync(noteIndex));
|
|
295
|
+
if (noteScopes.length === 0) {
|
|
296
|
+
// We should never run into this error because notes always have a scope assigned to them - either on initial
|
|
297
|
+
// insertion via `addNotes` or when removing their nullifiers.
|
|
298
|
+
throw new Error('Note scopes are missing in applyNullifiers');
|
|
299
|
+
}
|
|
284
300
|
const note = NoteDao.fromBuffer(noteBuffer);
|
|
285
301
|
nullifiedNotes.push(note);
|
|
286
302
|
await this.#notes.delete(noteIndex);
|
|
@@ -290,10 +306,8 @@ import { NoteDao } from './note_dao.js';
|
|
|
290
306
|
await this.#notesByContractAndScope.get(scope).deleteValue(note.contractAddress.toString(), noteIndex);
|
|
291
307
|
await this.#notesByStorageSlotAndScope.get(scope).deleteValue(note.storageSlot.toString(), noteIndex);
|
|
292
308
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
await this.#nullifiedNotesToScope.set(noteIndex, scope);
|
|
296
|
-
}
|
|
309
|
+
for (const scope of noteScopes){
|
|
310
|
+
await this.#nullifiedNotesToScope.set(noteIndex, scope);
|
|
297
311
|
}
|
|
298
312
|
await this.#nullifiedNotes.set(noteIndex, note.toBuffer());
|
|
299
313
|
await this.#nullifiersByBlockNumber.set(blockNumber, nullifier.toString());
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
3
|
import type { EventSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type
|
|
5
|
+
import { type InTx, TxHash } from '@aztec/stdlib/tx';
|
|
6
|
+
import type { PackedPrivateEvent } from '../../pxe.js';
|
|
7
|
+
export type PrivateEventDataProviderFilter = {
|
|
8
|
+
contractAddress: AztecAddress;
|
|
9
|
+
fromBlock: number;
|
|
10
|
+
toBlock: number;
|
|
11
|
+
scopes: AztecAddress[];
|
|
12
|
+
txHash?: TxHash;
|
|
13
|
+
};
|
|
14
|
+
type PrivateEventMetadata = InTx & {
|
|
15
|
+
contractAddress: AztecAddress;
|
|
16
|
+
scope: AztecAddress;
|
|
17
|
+
};
|
|
6
18
|
/**
|
|
7
19
|
* Stores decrypted private event logs.
|
|
8
20
|
*/
|
|
@@ -12,24 +24,28 @@ export declare class PrivateEventDataProvider {
|
|
|
12
24
|
constructor(store: AztecAsyncKVStore);
|
|
13
25
|
/**
|
|
14
26
|
* Store a private event log.
|
|
15
|
-
* @param contractAddress - The address of the contract that emitted the event.
|
|
16
|
-
* @param recipient - The recipient of the event.
|
|
17
27
|
* @param eventSelector - The event selector of the event.
|
|
18
28
|
* @param msgContent - The content of the event.
|
|
19
|
-
* @param txHash - The transaction hash of the event log.
|
|
20
29
|
* @param eventCommitmentIndex - The index of the event commitment in the nullifier tree.
|
|
21
|
-
* @param
|
|
30
|
+
* @param metadata
|
|
31
|
+
* contractAddress - The address of the contract that emitted the event.
|
|
32
|
+
* scope - The address to which the event is scoped.
|
|
33
|
+
* txHash - The transaction hash of the event log.
|
|
34
|
+
* blockNumber - The block number in which the event was emitted.
|
|
22
35
|
*/
|
|
23
|
-
storePrivateEventLog(
|
|
36
|
+
storePrivateEventLog(eventSelector: EventSelector, msgContent: Fr[], eventCommitmentIndex: number, metadata: PrivateEventMetadata): Promise<void>;
|
|
24
37
|
/**
|
|
25
38
|
* Returns the private events given search parameters.
|
|
26
|
-
* @param contractAddress - The address of the contract to get events from.
|
|
27
|
-
* @param from - The block number to search from.
|
|
28
|
-
* @param numBlocks - The amount of blocks to search.
|
|
29
|
-
* @param recipients - The addresses that decrypted the logs.
|
|
30
39
|
* @param eventSelector - The event selector to filter by.
|
|
31
|
-
* @
|
|
40
|
+
* @param filter - Filtering criteria:
|
|
41
|
+
* contractAddress: The address of the contract to get events from.
|
|
42
|
+
* fromBlock: The block number to search from (inclusive).
|
|
43
|
+
* toBlock: The block number to search upto (exclusive).
|
|
44
|
+
* scope: - The addresses that decrypted the logs.
|
|
45
|
+
* @returns - The event log contents, augmented with metadata about
|
|
46
|
+
* the transaction and block it the event was included in .
|
|
32
47
|
*/
|
|
33
|
-
getPrivateEvents(
|
|
48
|
+
getPrivateEvents(eventSelector: EventSelector, filter: PrivateEventDataProviderFilter): Promise<PackedPrivateEvent[]>;
|
|
34
49
|
}
|
|
35
|
-
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9ldmVudF9kYXRhX3Byb3ZpZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9wcml2YXRlX2V2ZW50X2RhdGFfcHJvdmlkZXIvcHJpdmF0ZV9ldmVudF9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxFQUFFL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QmY7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ1UsZ0JBQWdCLENBQzNCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLE1BQU0sRUFBRSw4QkFBOEIsR0FDckMsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0F3Qy9CO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_event_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_data_provider/private_event_data_provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_event_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_data_provider/private_event_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,eAAe,EAAE,YAAY,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAUF,KAAK,oBAAoB,GAAG,IAAI,GAAG;IACjC,eAAe,EAAE,YAAY,CAAC;IAC9B,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,wBAAwB;;IASnC,MAAM,yCAA+C;IAErD,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAMD;;;;;;;;;;OAUG;IACH,oBAAoB,CAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,EAAE,EAChB,oBAAoB,EAAE,MAAM,EAC5B,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC,CA8Bf;IAED;;;;;;;;;;OAUG;IACU,gBAAgB,CAC3B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAwC/B;CACF"}
|