-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
133 lines (108 loc) · 3.19 KB
/
types.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Common
import {
AccountStateStorage,
AccountEntityHistoryState,
BaseFetcherJobRunnerOptions,
BaseFetcherPaginationCursors,
BaseFetcherPaginationResponse,
FetcherState,
} from '@aleph-indexer/framework'
import {
EthereumRawBlock,
EthereumRawLog,
EthereumAccountTransactionHistoryStorageEntity,
} from '../../../types.js'
export type EthereumFetcherJobRunnerOptions<C> = Omit<
BaseFetcherJobRunnerOptions<C>,
'handleFetch' | 'updateCursors' | 'interval'
> & {
interval?: number
iterationFetchLimit?: number
}
// Blocks
export type EthereumBlockHistoryPaginationCursor = {
height: number
timestamp: number
signature: string
}
export type EthereumBlockHistoryPaginationCursors =
BaseFetcherPaginationCursors<EthereumBlockHistoryPaginationCursor>
export type EthereumBlockPaginationResponse = BaseFetcherPaginationResponse<
EthereumRawBlock,
EthereumBlockHistoryPaginationCursor
>
export type EthereumFetchBlocksOptions = {
before?: number
until?: number
iterationLimit?: number
pageLimit?: number
}
// Transaction Signatures
export type EthereumAccountTransactionHistoryPaginationCursor = {
height: number
timestamp: number
signature: string
}
export type EthereumTransactionHistoryPaginationCursors =
BaseFetcherPaginationCursors<EthereumAccountTransactionHistoryPaginationCursor>
export type EthereumTransactionHistoryPaginationResponse =
BaseFetcherPaginationResponse<
EthereumAccountTransactionHistoryStorageEntity,
EthereumAccountTransactionHistoryPaginationCursor
>
export type EthereumFetchSignaturesOptions = {
account: string
before?: number
until?: number
iterationLimit?: number
pageLimit?: number
}
export type EthereumAccountTransactionHistoryState =
AccountEntityHistoryState<EthereumAccountTransactionHistoryPaginationCursor> & {
firstHeight?: number
lastHeight?: number
firstSignature?: string
lastSignature?: string
}
// Logs
export type EthereumAccountLogHistoryPaginationCursor = {
height: number
timestamp: number
}
export type EthereumLogHistoryPaginationCursors =
BaseFetcherPaginationCursors<EthereumAccountLogHistoryPaginationCursor>
export type EthereumLogHistoryPaginationResponse =
BaseFetcherPaginationResponse<
EthereumRawLog,
EthereumAccountLogHistoryPaginationCursor
>
export type EthereumLogHistoryFetcherJobRunnerOptions =
EthereumFetcherJobRunnerOptions<EthereumLogHistoryPaginationCursors>
export type EthereumFetchLogsOptions = {
account: string
before?: number
until?: number
iterationLimit?: number
pageLimit?: number
isContractAccount?: boolean
}
export type EthereumAccountLogHistoryState =
AccountEntityHistoryState<EthereumAccountLogHistoryPaginationCursor> & {
firstHeight?: number
lastHeight?: number
}
// Account State
export type EthereumAccountStateFetcherOptions = {
account: string
subscribeChanges?: boolean
}
export type EthereumAccountState = {
account: string
balance: string
}
export type EthereumAccountStateStorage =
AccountStateStorage<EthereumAccountState>
export type EthereumFetcherState = FetcherState<{
firstBlock?: EthereumAccountTransactionHistoryPaginationCursor
lastBlock?: EthereumAccountTransactionHistoryPaginationCursor
}>