-
Notifications
You must be signed in to change notification settings - Fork 0
/
logBloom.ts
41 lines (35 loc) · 1016 Bytes
/
logBloom.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { EntityStorage } from '@aleph-indexer/core'
import { EthereumLogBloom } from '../../../../../types.js'
export type EthereumLogBloomEntity = EthereumLogBloom
export type EthereumLogBloomStorage = EntityStorage<EthereumLogBloom>
export enum EthereumLogBloomDALIndex {
Timestamp = 'timestamp',
}
const timestampKey = {
get: (e: EthereumLogBloomEntity) => e.timestamp,
length: EntityStorage.TimestampLength,
}
const heightKey = {
get: (e: EthereumLogBloomEntity) => e.height,
// @note: up to 10**9 [9 digits] enough for 300 years
length: 8,
}
/**
* Creates a new block storage for the ethereum fetcher.
* @param path Path to the database.
*/
export function createEthereumLogBloomDAL(
path: string,
): EthereumLogBloomStorage {
return new EntityStorage<EthereumLogBloomEntity>({
name: 'fetcher_block_log_bloom',
path,
key: [heightKey],
indexes: [
{
name: EthereumLogBloomDALIndex.Timestamp,
key: [timestampKey], // signature?
},
],
})
}