UNPKG

1.24 kBTypeScriptView Raw
1import { Block, GetOptions, IterOptions } from '@neo-one/client-common';
2import { Monitor } from '@neo-one/monitor';
3interface Client {
4 readonly getBlockCount: (monitor?: Monitor) => Promise<number>;
5 readonly getBlock: (index: number, options?: GetOptions) => Promise<Block>;
6}
7interface AsyncBlockIteratorOptions {
8 readonly client: Client;
9 readonly options: IterOptions;
10 readonly fetchTimeoutMS?: number;
11 readonly batchSize?: number;
12}
13export declare class AsyncBlockIterator implements AsyncIterator<Block> {
14 private readonly client;
15 private readonly mutableItems;
16 private mutableResolvers;
17 private mutableDone;
18 private mutableCurrentIndex;
19 private mutableFetching;
20 private mutableStartHeight;
21 private readonly indexStop;
22 private readonly fetchTimeoutMS;
23 private readonly batchSize;
24 private readonly monitor;
25 constructor({ client, options: { indexStart, indexStop, monitor }, fetchTimeoutMS, batchSize, }: AsyncBlockIteratorOptions);
26 [Symbol.asyncIterator](): this;
27 next(): Promise<IteratorResult<Block>>;
28 private write;
29 private error;
30 private push;
31 private done;
32 private fetch;
33 private asyncFetch;
34 private fetchOne;
35}
36export {};