@aztec/pxe 3.0.0-nightly.20251105 → 3.0.0-nightly.20251107
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/pxe.d.ts +14 -5
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +5 -9
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +1 -7
- 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 +3 -2
- package/package.json +16 -16
- package/src/pxe.ts +19 -24
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +4 -9
package/dest/pxe.d.ts
CHANGED
|
@@ -3,14 +3,23 @@ import { type Logger } from '@aztec/foundation/log';
|
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
import { type ProtocolContractsProvider } from '@aztec/protocol-contracts';
|
|
5
5
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
6
|
-
import { type ContractArtifact,
|
|
6
|
+
import { type ContractArtifact, EventSelector } from '@aztec/stdlib/abi';
|
|
7
7
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
8
8
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
+
import type { L2BlockHash } from '@aztec/stdlib/block';
|
|
9
10
|
import { CompleteAddress, type ContractClassWithId, type ContractInstanceWithAddress, type PartialAddress } from '@aztec/stdlib/contract';
|
|
10
11
|
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
11
12
|
import { type NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
12
|
-
import { SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
13
|
+
import { SimulationOverrides, TxExecutionRequest, TxHash, TxProfileResult, TxProvingResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
13
14
|
import type { PXEConfig } from './config/index.js';
|
|
15
|
+
export type PrivateEvent = {
|
|
16
|
+
packedEvent: Fr[];
|
|
17
|
+
blockNumber: number;
|
|
18
|
+
blockHash: L2BlockHash;
|
|
19
|
+
txHash: TxHash;
|
|
20
|
+
recipient: AztecAddress;
|
|
21
|
+
eventSelector: EventSelector;
|
|
22
|
+
};
|
|
14
23
|
/**
|
|
15
24
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
16
25
|
* manage private state of users.
|
|
@@ -218,13 +227,13 @@ export declare class PXE {
|
|
|
218
227
|
/**
|
|
219
228
|
* Returns the private events given search parameters.
|
|
220
229
|
* @param contractAddress - The address of the contract to get events from.
|
|
221
|
-
* @param
|
|
230
|
+
* @param eventSelector - Event selector to search for.
|
|
222
231
|
* @param from - The block number to search from.
|
|
223
232
|
* @param numBlocks - The amount of blocks to search.
|
|
224
233
|
* @param recipients - The addresses that decrypted the logs.
|
|
225
|
-
* @returns - The
|
|
234
|
+
* @returns - The packed events with block and tx metadata.
|
|
226
235
|
*/
|
|
227
|
-
getPrivateEvents
|
|
236
|
+
getPrivateEvents(contractAddress: AztecAddress, eventSelector: EventSelector, from: number, numBlocks: number, recipients: AztecAddress[]): Promise<PrivateEvent[]>;
|
|
228
237
|
/**
|
|
229
238
|
* Stops the PXE's job queue.
|
|
230
239
|
*/
|
package/dest/pxe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../src/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAIlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,KAAK,yBAAyB,EAAyB,MAAM,2BAA2B,CAAC;AAClG,OAAO,KAAK,EA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AAE,OAAc,GAClC,OAAO,CAAC,eAAe,CAAC;IAoE3B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,UAAU,CACf,SAAS,EAAE,kBAAkB,EAC7B,cAAc,EAAE,OAAO,EACvB,gBAAgB,GAAE,OAAe,EACjC,kBAAkB,GAAE,OAAe,EACnC,SAAS,CAAC,EAAE,mBAAmB,EAC/B,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,kBAAkB,CAAC;IAgI9B;;;;;;;;;;;OAWG;IACI,eAAe,CACpB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,GAAG,EAAE,EACX,EAAE,EAAE,YAAY,EAChB,QAAQ,CAAC,EAAE,WAAW,EAAE,EACxB,KAAK,CAAC,EAAE,YAAY,EACpB,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,uBAAuB,CAAC;IA6CnC;;;;;;;;OAQG;IACU,gBAAgB,CAC3B,eAAe,EAAE,YAAY,EAC7B,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,GACzB,OAAO,CAAC,YAAY,EAAE,CAAC;IAa1B;;OAEG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dest/pxe.js
CHANGED
|
@@ -5,7 +5,7 @@ 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
11
|
import { computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
@@ -762,23 +762,19 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
762
762
|
/**
|
|
763
763
|
* Returns the private events given search parameters.
|
|
764
764
|
* @param contractAddress - The address of the contract to get events from.
|
|
765
|
-
* @param
|
|
765
|
+
* @param eventSelector - Event selector to search for.
|
|
766
766
|
* @param from - The block number to search from.
|
|
767
767
|
* @param numBlocks - The amount of blocks to search.
|
|
768
768
|
* @param recipients - The addresses that decrypted the logs.
|
|
769
|
-
* @returns - The
|
|
770
|
-
*/ async getPrivateEvents(contractAddress,
|
|
769
|
+
* @returns - The packed events with block and tx metadata.
|
|
770
|
+
*/ async getPrivateEvents(contractAddress, eventSelector, from, numBlocks, recipients) {
|
|
771
771
|
if (recipients.length === 0) {
|
|
772
772
|
throw new Error('Recipients are required to get private events');
|
|
773
773
|
}
|
|
774
774
|
this.log.verbose(`Getting private events for ${contractAddress.toString()} from ${from} to ${from + numBlocks}`);
|
|
775
775
|
// We need to manually trigger private state sync to have a guarantee that all the events are available.
|
|
776
776
|
await this.simulateUtility('sync_private_state', [], contractAddress);
|
|
777
|
-
|
|
778
|
-
const decodedEvents = events.map((event)=>decodeFromAbi([
|
|
779
|
-
eventMetadataDef.abiType
|
|
780
|
-
], event.msgContent));
|
|
781
|
-
return decodedEvents;
|
|
777
|
+
return this.privateEventDataProvider.getPrivateEvents(contractAddress, from, numBlocks, recipients, eventSelector);
|
|
782
778
|
}
|
|
783
779
|
/**
|
|
784
780
|
* Stops the PXE's job queue.
|
|
@@ -4,13 +4,7 @@ import type { EventSelector } from '@aztec/stdlib/abi';
|
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
6
6
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
7
|
-
|
|
8
|
-
msgContent: Fr[];
|
|
9
|
-
blockNumber: number;
|
|
10
|
-
blockHash: L2BlockHash;
|
|
11
|
-
txHash: TxHash;
|
|
12
|
-
recipient: AztecAddress;
|
|
13
|
-
};
|
|
7
|
+
import type { PrivateEvent } from '../../pxe.js';
|
|
14
8
|
/**
|
|
15
9
|
* Stores decrypted private event logs.
|
|
16
10
|
*/
|
|
@@ -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":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,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;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;
|
|
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":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,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;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAUjD;;GAEG;AACH,qBAAa,wBAAwB;;IASnC,MAAM,yCAA+C;gBAEzC,KAAK,EAAE,iBAAiB;IAOpC;;;;;;;;;OASG;IACH,oBAAoB,CAClB,eAAe,EAAE,YAAY,EAC7B,SAAS,EAAE,YAAY,EACvB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,MAAM,EAC5B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,WAAW,GACrB,OAAO,CAAC,IAAI,CAAC;IA8BhB;;;;;;;;OAQG;IACU,gBAAgB,CAC3B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,EAC1B,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC;CAsC3B"}
|
|
@@ -88,11 +88,12 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
88
88
|
events.push({
|
|
89
89
|
eventCommitmentIndex: entry.eventCommitmentIndex,
|
|
90
90
|
event: {
|
|
91
|
-
msgContent,
|
|
91
|
+
packedEvent: msgContent,
|
|
92
92
|
blockNumber: entry.blockNumber,
|
|
93
93
|
recipient,
|
|
94
94
|
txHash,
|
|
95
|
-
blockHash
|
|
95
|
+
blockHash,
|
|
96
|
+
eventSelector
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251107",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
65
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
66
|
-
"@aztec/builder": "3.0.0-nightly.
|
|
67
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
68
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
69
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
70
|
-
"@aztec/key-store": "3.0.0-nightly.
|
|
71
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
73
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
74
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
75
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
76
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
64
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251107",
|
|
65
|
+
"@aztec/bb.js": "3.0.0-nightly.20251107",
|
|
66
|
+
"@aztec/builder": "3.0.0-nightly.20251107",
|
|
67
|
+
"@aztec/constants": "3.0.0-nightly.20251107",
|
|
68
|
+
"@aztec/ethereum": "3.0.0-nightly.20251107",
|
|
69
|
+
"@aztec/foundation": "3.0.0-nightly.20251107",
|
|
70
|
+
"@aztec/key-store": "3.0.0-nightly.20251107",
|
|
71
|
+
"@aztec/kv-store": "3.0.0-nightly.20251107",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251107",
|
|
73
|
+
"@aztec/noir-types": "3.0.0-nightly.20251107",
|
|
74
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251107",
|
|
75
|
+
"@aztec/simulator": "3.0.0-nightly.20251107",
|
|
76
|
+
"@aztec/stdlib": "3.0.0-nightly.20251107",
|
|
77
77
|
"koa": "^2.16.1",
|
|
78
78
|
"koa-router": "^13.1.1",
|
|
79
79
|
"lodash.omit": "^4.5.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
85
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20251107",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20251107",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.omit": "^4.5.7",
|
package/src/pxe.ts
CHANGED
|
@@ -9,16 +9,16 @@ import { type ProtocolContractsProvider, protocolContractNames } from '@aztec/pr
|
|
|
9
9
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
10
10
|
import {
|
|
11
11
|
type ContractArtifact,
|
|
12
|
-
|
|
12
|
+
EventSelector,
|
|
13
13
|
FunctionCall,
|
|
14
14
|
FunctionSelector,
|
|
15
15
|
FunctionType,
|
|
16
|
-
decodeFromAbi,
|
|
17
16
|
decodeFunctionSignature,
|
|
18
17
|
encodeArguments,
|
|
19
18
|
} from '@aztec/stdlib/abi';
|
|
20
19
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
21
20
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
21
|
+
import type { L2BlockHash } from '@aztec/stdlib/block';
|
|
22
22
|
import {
|
|
23
23
|
CompleteAddress,
|
|
24
24
|
type ContractClassWithId,
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
type SimulationTimings,
|
|
47
47
|
Tx,
|
|
48
48
|
TxExecutionRequest,
|
|
49
|
+
TxHash,
|
|
49
50
|
TxProfileResult,
|
|
50
51
|
TxProvingResult,
|
|
51
52
|
TxSimulationResult,
|
|
@@ -73,14 +74,20 @@ import { AddressDataProvider } from './storage/address_data_provider/address_dat
|
|
|
73
74
|
import { CapsuleDataProvider } from './storage/capsule_data_provider/capsule_data_provider.js';
|
|
74
75
|
import { ContractDataProvider } from './storage/contract_data_provider/contract_data_provider.js';
|
|
75
76
|
import { NoteDataProvider } from './storage/note_data_provider/note_data_provider.js';
|
|
76
|
-
import {
|
|
77
|
-
type PrivateEvent,
|
|
78
|
-
PrivateEventDataProvider,
|
|
79
|
-
} from './storage/private_event_data_provider/private_event_data_provider.js';
|
|
77
|
+
import { PrivateEventDataProvider } from './storage/private_event_data_provider/private_event_data_provider.js';
|
|
80
78
|
import { SyncDataProvider } from './storage/sync_data_provider/sync_data_provider.js';
|
|
81
79
|
import { TaggingDataProvider } from './storage/tagging_data_provider/tagging_data_provider.js';
|
|
82
80
|
import { Synchronizer } from './synchronizer/index.js';
|
|
83
81
|
|
|
82
|
+
export type PrivateEvent = {
|
|
83
|
+
packedEvent: Fr[];
|
|
84
|
+
blockNumber: number;
|
|
85
|
+
blockHash: L2BlockHash;
|
|
86
|
+
txHash: TxHash;
|
|
87
|
+
recipient: AztecAddress;
|
|
88
|
+
eventSelector: EventSelector;
|
|
89
|
+
};
|
|
90
|
+
|
|
84
91
|
/**
|
|
85
92
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
86
93
|
* manage private state of users.
|
|
@@ -1066,19 +1073,19 @@ export class PXE {
|
|
|
1066
1073
|
/**
|
|
1067
1074
|
* Returns the private events given search parameters.
|
|
1068
1075
|
* @param contractAddress - The address of the contract to get events from.
|
|
1069
|
-
* @param
|
|
1076
|
+
* @param eventSelector - Event selector to search for.
|
|
1070
1077
|
* @param from - The block number to search from.
|
|
1071
1078
|
* @param numBlocks - The amount of blocks to search.
|
|
1072
1079
|
* @param recipients - The addresses that decrypted the logs.
|
|
1073
|
-
* @returns - The
|
|
1080
|
+
* @returns - The packed events with block and tx metadata.
|
|
1074
1081
|
*/
|
|
1075
|
-
public async getPrivateEvents
|
|
1082
|
+
public async getPrivateEvents(
|
|
1076
1083
|
contractAddress: AztecAddress,
|
|
1077
|
-
|
|
1084
|
+
eventSelector: EventSelector,
|
|
1078
1085
|
from: number,
|
|
1079
1086
|
numBlocks: number,
|
|
1080
1087
|
recipients: AztecAddress[],
|
|
1081
|
-
): Promise<
|
|
1088
|
+
): Promise<PrivateEvent[]> {
|
|
1082
1089
|
if (recipients.length === 0) {
|
|
1083
1090
|
throw new Error('Recipients are required to get private events');
|
|
1084
1091
|
}
|
|
@@ -1088,19 +1095,7 @@ export class PXE {
|
|
|
1088
1095
|
// We need to manually trigger private state sync to have a guarantee that all the events are available.
|
|
1089
1096
|
await this.simulateUtility('sync_private_state', [], contractAddress);
|
|
1090
1097
|
|
|
1091
|
-
|
|
1092
|
-
contractAddress,
|
|
1093
|
-
from,
|
|
1094
|
-
numBlocks,
|
|
1095
|
-
recipients,
|
|
1096
|
-
eventMetadataDef.eventSelector,
|
|
1097
|
-
);
|
|
1098
|
-
|
|
1099
|
-
const decodedEvents = events.map(
|
|
1100
|
-
(event: PrivateEvent): T => decodeFromAbi([eventMetadataDef.abiType], event.msgContent) as T,
|
|
1101
|
-
);
|
|
1102
|
-
|
|
1103
|
-
return decodedEvents;
|
|
1098
|
+
return this.privateEventDataProvider.getPrivateEvents(contractAddress, from, numBlocks, recipients, eventSelector);
|
|
1104
1099
|
}
|
|
1105
1100
|
|
|
1106
1101
|
/**
|
|
@@ -7,6 +7,8 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
7
7
|
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
8
8
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
9
9
|
|
|
10
|
+
import type { PrivateEvent } from '../../pxe.js';
|
|
11
|
+
|
|
10
12
|
interface PrivateEventEntry {
|
|
11
13
|
msgContent: Buffer;
|
|
12
14
|
blockNumber: number;
|
|
@@ -15,14 +17,6 @@ interface PrivateEventEntry {
|
|
|
15
17
|
txHash: Buffer;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
export type PrivateEvent = {
|
|
19
|
-
msgContent: Fr[];
|
|
20
|
-
blockNumber: number;
|
|
21
|
-
blockHash: L2BlockHash;
|
|
22
|
-
txHash: TxHash;
|
|
23
|
-
recipient: AztecAddress;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
20
|
/**
|
|
27
21
|
* Stores decrypted private event logs.
|
|
28
22
|
*/
|
|
@@ -131,11 +125,12 @@ export class PrivateEventDataProvider {
|
|
|
131
125
|
events.push({
|
|
132
126
|
eventCommitmentIndex: entry.eventCommitmentIndex,
|
|
133
127
|
event: {
|
|
134
|
-
msgContent,
|
|
128
|
+
packedEvent: msgContent,
|
|
135
129
|
blockNumber: entry.blockNumber,
|
|
136
130
|
recipient,
|
|
137
131
|
txHash,
|
|
138
132
|
blockHash,
|
|
133
|
+
eventSelector,
|
|
139
134
|
},
|
|
140
135
|
});
|
|
141
136
|
}
|