@aztec/aztec-node 0.1.0-alpha17 → 0.1.0-alpha21

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.
@@ -3,7 +3,7 @@ import {
3
3
  CONTRACT_TREE_HEIGHT,
4
4
  CircuitsWasm,
5
5
  Fr,
6
- L1_TO_L2_MESSAGES_TREE_HEIGHT,
6
+ L1_TO_L2_MSG_TREE_HEIGHT,
7
7
  PRIVATE_DATA_TREE_HEIGHT,
8
8
  } from '@aztec/circuits.js';
9
9
  import { AztecAddress } from '@aztec/foundation/aztec-address';
@@ -20,6 +20,7 @@ import {
20
20
  L2BlockL2Logs,
21
21
  L2BlockSource,
22
22
  L2LogsSource,
23
+ LogType,
23
24
  MerkleTreeId,
24
25
  Tx,
25
26
  TxHash,
@@ -51,8 +52,8 @@ export class AztecNodeService implements AztecNode {
51
52
  protected merkleTreeDB: MerkleTrees,
52
53
  protected worldStateSynchroniser: WorldStateSynchroniser,
53
54
  protected sequencer: SequencerClient,
54
- protected chainId: Fr,
55
- protected version: Fr,
55
+ protected chainId: number,
56
+ protected version: number,
56
57
  ) {}
57
58
 
58
59
  /**
@@ -97,8 +98,8 @@ export class AztecNodeService implements AztecNode {
97
98
  merkleTreeDB,
98
99
  worldStateSynchroniser,
99
100
  sequencer,
100
- new Fr(config.chainId),
101
- new Fr(config.version),
101
+ config.chainId,
102
+ config.version,
102
103
  );
103
104
  }
104
105
 
@@ -132,7 +133,7 @@ export class AztecNodeService implements AztecNode {
132
133
  * Method to fetch the version of the rollup the node is connected to.
133
134
  * @returns The rollup version.
134
135
  */
135
- public getVersion(): Promise<Fr> {
136
+ public getVersion(): Promise<number> {
136
137
  return Promise.resolve(this.version);
137
138
  }
138
139
 
@@ -140,7 +141,7 @@ export class AztecNodeService implements AztecNode {
140
141
  * Method to fetch the chain id of the base-layer for the rollup.
141
142
  * @returns The chain id.
142
143
  */
143
- public getChainId(): Promise<Fr> {
144
+ public getChainId(): Promise<number> {
144
145
  return Promise.resolve(this.chainId);
145
146
  }
146
147
 
@@ -165,23 +166,15 @@ export class AztecNodeService implements AztecNode {
165
166
  }
166
167
 
167
168
  /**
168
- * Gets the `take` amount of encrypted logs starting from `from`.
169
- * @param from - Number of the L2 block to which corresponds the first encrypted log to be returned.
170
- * @param take - The number of encrypted logs to return.
171
- * @returns The requested encrypted logs.
169
+ * Gets the `take` amount of logs starting from `from`.
170
+ * @param from - Number of the L2 block to which corresponds the first logs to be returned.
171
+ * @param take - The number of logs to return.
172
+ * @param logType - Specifies whether to return encrypted or unencrypted logs.
173
+ * @returns The requested logs.
172
174
  */
173
- public getEncryptedLogs(from: number, take: number): Promise<L2BlockL2Logs[]> {
174
- return this.encryptedLogsSource.getEncryptedLogs(from, take);
175
- }
176
-
177
- /**
178
- * Gets the `take` amount of unencrypted logs starting from `from`.
179
- * @param from - Number of the L2 block to which corresponds the first unencrypted log to be returned.
180
- * @param take - The number of unencrypted logs to return.
181
- * @returns The requested unencrypted logs.
182
- */
183
- public getUnencryptedLogs(from: number, take: number): Promise<L2BlockL2Logs[]> {
184
- return this.unencryptedLogsSource.getUnencryptedLogs(from, take);
175
+ public getLogs(from: number, take: number, logType: LogType): Promise<L2BlockL2Logs[]> {
176
+ const logSource = logType === LogType.ENCRYPTED ? this.encryptedLogsSource : this.unencryptedLogsSource;
177
+ return logSource.getLogs(from, take, logType);
185
178
  }
186
179
 
187
180
  /**
@@ -283,7 +276,7 @@ export class AztecNodeService implements AztecNode {
283
276
  * @param leafIndex - Index of the leaf in the tree.
284
277
  * @returns The sibling path.
285
278
  */
286
- public getL1ToL2MessagesTreePath(leafIndex: bigint): Promise<SiblingPath<typeof L1_TO_L2_MESSAGES_TREE_HEIGHT>> {
279
+ public getL1ToL2MessagesTreePath(leafIndex: bigint): Promise<SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>> {
287
280
  return this.merkleTreeDB.getSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGES_TREE, leafIndex, false);
288
281
  }
289
282