UNPKG

1.61 kBTypeScriptView Raw
1import { Queue } from '../utils/queue';
2import { CalldataBlock } from './calldata_block';
3/**
4 * Iterator class for Calldata Blocks. Blocks follows the order
5 * they should be put into calldata that is passed to he EVM.
6 *
7 * Example #1:
8 * Let root = Set {
9 * Blob{} A,
10 * Pointer {
11 * Blob{} a
12 * } B,
13 * Blob{} C
14 * }
15 * It will iterate as follows: [A, B, C, B.a]
16 *
17 * Example #2:
18 * Let root = Set {
19 * Blob{} A,
20 * Pointer {
21 * Blob{} a
22 * Pointer {
23 * Blob{} b
24 * }
25 * } B,
26 * Pointer {
27 * Blob{} c
28 * } C
29 * }
30 * It will iterate as follows: [A, B, C, B.a, B.b, C.c]
31 */
32declare abstract class BaseIterator implements Iterable<CalldataBlock> {
33 protected readonly _root: CalldataBlock;
34 protected readonly _queue: Queue<CalldataBlock>;
35 private static _createQueue;
36 constructor(root: CalldataBlock);
37 [Symbol.iterator](): {
38 next: () => IteratorResult<CalldataBlock>;
39 };
40 abstract nextBlock(): CalldataBlock | undefined;
41}
42export declare class CalldataIterator extends BaseIterator {
43 constructor(root: CalldataBlock);
44 nextBlock(): CalldataBlock | undefined;
45}
46export declare class ReverseCalldataIterator extends BaseIterator {
47 constructor(root: CalldataBlock);
48 nextBlock(): CalldataBlock | undefined;
49}
50export {};
51//# sourceMappingURL=iterator.d.ts.map
\No newline at end of file