envio 3.0.0-alpha.2 → 3.0.0-alpha.20
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.
- package/README.md +164 -30
- package/bin.mjs +49 -0
- package/evm.schema.json +79 -169
- package/fuel.schema.json +50 -21
- package/index.d.ts +497 -1
- package/index.js +4 -0
- package/package.json +42 -31
- package/rescript.json +4 -1
- package/src/Batch.res +11 -8
- package/src/Batch.res.mjs +11 -9
- package/src/ChainFetcher.res +531 -0
- package/src/ChainFetcher.res.mjs +339 -0
- package/src/ChainManager.res +190 -0
- package/src/ChainManager.res.mjs +166 -0
- package/src/Change.res +3 -3
- package/src/Config.gen.ts +19 -0
- package/src/Config.res +737 -22
- package/src/Config.res.mjs +703 -26
- package/src/{Indexer.res → Ctx.res} +1 -1
- package/src/Ecosystem.res +9 -124
- package/src/Ecosystem.res.mjs +19 -160
- package/src/Env.res +30 -74
- package/src/Env.res.mjs +25 -87
- package/src/Envio.gen.ts +3 -1
- package/src/Envio.res +20 -9
- package/src/EventProcessing.res +469 -0
- package/src/EventProcessing.res.mjs +337 -0
- package/src/EvmTypes.gen.ts +6 -0
- package/src/EvmTypes.res +1 -0
- package/src/FetchState.res +1256 -639
- package/src/FetchState.res.mjs +1135 -612
- package/src/GlobalState.res +1190 -0
- package/src/GlobalState.res.mjs +1183 -0
- package/src/GlobalStateManager.res +68 -0
- package/src/GlobalStateManager.res.mjs +75 -0
- package/src/GlobalStateManager.resi +7 -0
- package/src/HandlerLoader.res +89 -0
- package/src/HandlerLoader.res.mjs +79 -0
- package/src/HandlerRegister.res +357 -0
- package/src/HandlerRegister.res.mjs +299 -0
- package/src/{EventRegister.resi → HandlerRegister.resi} +13 -13
- package/src/Hasura.res +111 -175
- package/src/Hasura.res.mjs +88 -150
- package/src/InMemoryStore.res +1 -1
- package/src/InMemoryStore.res.mjs +3 -3
- package/src/InMemoryTable.res +1 -1
- package/src/InMemoryTable.res.mjs +1 -1
- package/src/Internal.gen.ts +4 -0
- package/src/Internal.res +230 -12
- package/src/Internal.res.mjs +115 -1
- package/src/LoadLayer.res +444 -0
- package/src/LoadLayer.res.mjs +296 -0
- package/src/LoadLayer.resi +32 -0
- package/src/LogSelection.res +33 -27
- package/src/LogSelection.res.mjs +6 -0
- package/src/Logging.res +21 -7
- package/src/Logging.res.mjs +16 -8
- package/src/Main.res +377 -0
- package/src/Main.res.mjs +339 -0
- package/src/Persistence.res +7 -21
- package/src/Persistence.res.mjs +3 -3
- package/src/PgStorage.gen.ts +10 -0
- package/src/PgStorage.res +116 -69
- package/src/PgStorage.res.d.mts +5 -0
- package/src/PgStorage.res.mjs +93 -50
- package/src/Prometheus.res +294 -224
- package/src/Prometheus.res.mjs +353 -340
- package/src/ReorgDetection.res +6 -10
- package/src/ReorgDetection.res.mjs +6 -6
- package/src/SafeCheckpointTracking.res +4 -4
- package/src/SafeCheckpointTracking.res.mjs +2 -2
- package/src/Sink.res +4 -2
- package/src/Sink.res.mjs +2 -1
- package/src/TableIndices.res +0 -1
- package/src/TestIndexer.res +692 -0
- package/src/TestIndexer.res.mjs +527 -0
- package/src/TestIndexerProxyStorage.res +205 -0
- package/src/TestIndexerProxyStorage.res.mjs +151 -0
- package/src/TopicFilter.res +1 -1
- package/src/Types.ts +1 -1
- package/src/UserContext.res +424 -0
- package/src/UserContext.res.mjs +279 -0
- package/src/Utils.res +97 -26
- package/src/Utils.res.mjs +91 -44
- package/src/bindings/BigInt.res +10 -0
- package/src/bindings/BigInt.res.mjs +15 -0
- package/src/bindings/ClickHouse.res +120 -23
- package/src/bindings/ClickHouse.res.mjs +118 -28
- package/src/bindings/DateFns.res +74 -0
- package/src/bindings/DateFns.res.mjs +22 -0
- package/src/bindings/EventSource.res +8 -1
- package/src/bindings/EventSource.res.mjs +8 -1
- package/src/bindings/Express.res +1 -0
- package/src/bindings/Hrtime.res +14 -1
- package/src/bindings/Hrtime.res.mjs +22 -2
- package/src/bindings/Hrtime.resi +4 -0
- package/src/bindings/Lodash.res +0 -1
- package/src/bindings/NodeJs.res +49 -3
- package/src/bindings/NodeJs.res.mjs +11 -3
- package/src/bindings/Pino.res +24 -10
- package/src/bindings/Pino.res.mjs +14 -8
- package/src/bindings/Postgres.gen.ts +8 -0
- package/src/bindings/Postgres.res +5 -1
- package/src/bindings/Postgres.res.d.mts +5 -0
- package/src/bindings/PromClient.res +0 -10
- package/src/bindings/PromClient.res.mjs +0 -3
- package/src/bindings/Vitest.res +142 -0
- package/src/bindings/Vitest.res.mjs +9 -0
- package/src/bindings/WebSocket.res +27 -0
- package/src/bindings/WebSocket.res.mjs +2 -0
- package/src/bindings/Yargs.res +8 -0
- package/src/bindings/Yargs.res.mjs +2 -0
- package/src/db/EntityHistory.res +7 -7
- package/src/db/EntityHistory.res.mjs +9 -9
- package/src/db/InternalTable.res +59 -111
- package/src/db/InternalTable.res.mjs +73 -104
- package/src/db/Table.res +27 -8
- package/src/db/Table.res.mjs +25 -14
- package/src/sources/Evm.res +84 -0
- package/src/sources/Evm.res.mjs +105 -0
- package/src/sources/EvmChain.res +94 -0
- package/src/sources/EvmChain.res.mjs +60 -0
- package/src/sources/Fuel.res +19 -34
- package/src/sources/Fuel.res.mjs +34 -16
- package/src/sources/FuelSDK.res +38 -0
- package/src/sources/FuelSDK.res.mjs +29 -0
- package/src/sources/HyperFuel.res +2 -2
- package/src/sources/HyperFuel.resi +1 -1
- package/src/sources/HyperFuelClient.res +2 -2
- package/src/sources/HyperFuelSource.res +33 -13
- package/src/sources/HyperFuelSource.res.mjs +24 -16
- package/src/sources/HyperSync.res +36 -6
- package/src/sources/HyperSync.res.mjs +9 -7
- package/src/sources/HyperSync.resi +4 -0
- package/src/sources/HyperSyncClient.res +1 -1
- package/src/sources/HyperSyncHeightStream.res +47 -116
- package/src/sources/HyperSyncHeightStream.res.mjs +46 -73
- package/src/sources/HyperSyncSource.res +118 -139
- package/src/sources/HyperSyncSource.res.mjs +104 -121
- package/src/sources/Rpc.res +86 -14
- package/src/sources/Rpc.res.mjs +101 -9
- package/src/sources/RpcSource.res +621 -364
- package/src/sources/RpcSource.res.mjs +843 -410
- package/src/sources/RpcWebSocketHeightStream.res +181 -0
- package/src/sources/RpcWebSocketHeightStream.res.mjs +196 -0
- package/src/sources/Source.res +7 -5
- package/src/sources/SourceManager.res +325 -225
- package/src/sources/SourceManager.res.mjs +314 -171
- package/src/sources/SourceManager.resi +17 -6
- package/src/sources/Svm.res +81 -0
- package/src/sources/Svm.res.mjs +90 -0
- package/src/tui/Tui.res +247 -0
- package/src/tui/Tui.res.mjs +337 -0
- package/src/tui/bindings/Ink.res +371 -0
- package/src/tui/bindings/Ink.res.mjs +72 -0
- package/src/tui/bindings/Style.res +123 -0
- package/src/tui/bindings/Style.res.mjs +2 -0
- package/src/tui/components/BufferedProgressBar.res +40 -0
- package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
- package/src/tui/components/CustomHooks.res +122 -0
- package/src/tui/components/CustomHooks.res.mjs +179 -0
- package/src/tui/components/Messages.res +41 -0
- package/src/tui/components/Messages.res.mjs +75 -0
- package/src/tui/components/SyncETA.res +174 -0
- package/src/tui/components/SyncETA.res.mjs +263 -0
- package/src/tui/components/TuiData.res +47 -0
- package/src/tui/components/TuiData.res.mjs +34 -0
- package/svm.schema.json +112 -0
- package/bin.js +0 -48
- package/src/EventRegister.res +0 -241
- package/src/EventRegister.res.mjs +0 -240
- package/src/bindings/Ethers.gen.ts +0 -14
- package/src/bindings/Ethers.res +0 -204
- package/src/bindings/Ethers.res.mjs +0 -130
- /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import * as $$Array from "rescript/lib/es6/array.js";
|
|
4
4
|
import * as Utils from "./Utils.res.mjs";
|
|
5
|
+
import * as Config from "./Config.res.mjs";
|
|
5
6
|
import * as Js_dict from "rescript/lib/es6/js_dict.js";
|
|
6
7
|
import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
|
|
7
8
|
import * as EventUtils from "./EventUtils.res.mjs";
|
|
8
9
|
import * as ErrorHandling from "./ErrorHandling.res.mjs";
|
|
9
10
|
import * as InMemoryTable from "./InMemoryTable.res.mjs";
|
|
10
|
-
import * as InternalTable from "./db/InternalTable.res.mjs";
|
|
11
11
|
import * as Caml_exceptions from "rescript/lib/es6/caml_exceptions.js";
|
|
12
12
|
|
|
13
13
|
function hashRawEventsKey(key) {
|
|
@@ -102,7 +102,7 @@ function isRollingBack(inMemoryStore) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function setBatchDcs(inMemoryStore, batch, shouldSaveHistory) {
|
|
105
|
-
var inMemTable = getInMemTable(inMemoryStore,
|
|
105
|
+
var inMemTable = getInMemTable(inMemoryStore, Config.DynamicContractRegistry.entityConfig);
|
|
106
106
|
var itemIdx = 0;
|
|
107
107
|
for(var checkpoint = 0 ,checkpoint_finish = batch.checkpointIds.length; checkpoint < checkpoint_finish; ++checkpoint){
|
|
108
108
|
var checkpointId = batch.checkpointIds[checkpoint];
|
|
@@ -114,7 +114,7 @@ function setBatchDcs(inMemoryStore, batch, shouldSaveHistory) {
|
|
|
114
114
|
if (dcs !== undefined) {
|
|
115
115
|
for(var dcIdx = 0 ,dcIdx_finish = dcs.length; dcIdx < dcIdx_finish; ++dcIdx){
|
|
116
116
|
var dc = dcs[dcIdx];
|
|
117
|
-
var entity_id =
|
|
117
|
+
var entity_id = Config.DynamicContractRegistry.makeId(chainId, dc.address);
|
|
118
118
|
var entity_registering_event_block_number = item.blockNumber;
|
|
119
119
|
var entity_registering_event_log_index = item.logIndex;
|
|
120
120
|
var entity_registering_event_block_timestamp = item.timestamp;
|
package/src/InMemoryTable.res
CHANGED
|
@@ -51,7 +51,7 @@ module Entity = {
|
|
|
51
51
|
// Helper to extract entity ID from any entity
|
|
52
52
|
exception UnexpectedIdNotDefinedOnEntity
|
|
53
53
|
let getEntityIdUnsafe = (entity: 'entity): string =>
|
|
54
|
-
switch Utils.magic
|
|
54
|
+
switch (entity->(Utils.magic: 'entity => {"id": option<string>}))["id"] {
|
|
55
55
|
| Some(id) => id
|
|
56
56
|
| None =>
|
|
57
57
|
UnexpectedIdNotDefinedOnEntity->ErrorHandling.mkLogAndRaise(
|
|
@@ -54,7 +54,7 @@ var UnexpectedIdNotDefinedOnEntity = /* @__PURE__ */Caml_exceptions.create("InMe
|
|
|
54
54
|
function getEntityIdUnsafe(entity) {
|
|
55
55
|
var id = entity.id;
|
|
56
56
|
if (id !== undefined) {
|
|
57
|
-
return
|
|
57
|
+
return id;
|
|
58
58
|
} else {
|
|
59
59
|
return ErrorHandling.mkLogAndRaise(undefined, "Property 'id' does not exist on expected entity object", {
|
|
60
60
|
RE_EXN_ID: UnexpectedIdNotDefinedOnEntity
|
package/src/Internal.gen.ts
CHANGED
|
@@ -45,6 +45,10 @@ export type genericHandlerWithLoader<loader,handler,eventFilters> = {
|
|
|
45
45
|
readonly eventFilters?: eventFilters
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
export abstract class fuelEventConfig { protected opaque!: any }; /* simulate opaque types */
|
|
49
|
+
|
|
50
|
+
export abstract class evmEventConfig { protected opaque!: any }; /* simulate opaque types */
|
|
51
|
+
|
|
48
52
|
export type eventOptions<eventFilters> = { readonly wildcard?: boolean; readonly eventFilters?: eventFilters };
|
|
49
53
|
|
|
50
54
|
export type fuelSupplyParams = { readonly subId: string; readonly amount: bigint };
|
package/src/Internal.res
CHANGED
|
@@ -2,6 +2,228 @@ type eventParams
|
|
|
2
2
|
type eventBlock
|
|
3
3
|
type eventTransaction
|
|
4
4
|
|
|
5
|
+
// Field name variants for type-safe field selection.
|
|
6
|
+
// @unboxed compiles to plain strings at runtime, matching JS property names.
|
|
7
|
+
@unboxed
|
|
8
|
+
type evmBlockField =
|
|
9
|
+
| @as("number") Number
|
|
10
|
+
| @as("timestamp") Timestamp
|
|
11
|
+
| @as("hash") Hash
|
|
12
|
+
| @as("parentHash") ParentHash
|
|
13
|
+
| @as("nonce") Nonce
|
|
14
|
+
| @as("sha3Uncles") Sha3Uncles
|
|
15
|
+
| @as("logsBloom") LogsBloom
|
|
16
|
+
| @as("transactionsRoot") TransactionsRoot
|
|
17
|
+
| @as("stateRoot") StateRoot
|
|
18
|
+
| @as("receiptsRoot") ReceiptsRoot
|
|
19
|
+
| @as("miner") Miner
|
|
20
|
+
| @as("difficulty") Difficulty
|
|
21
|
+
| @as("totalDifficulty") TotalDifficulty
|
|
22
|
+
| @as("extraData") ExtraData
|
|
23
|
+
| @as("size") Size
|
|
24
|
+
| @as("gasLimit") GasLimit
|
|
25
|
+
| @as("gasUsed") GasUsed
|
|
26
|
+
| @as("uncles") Uncles
|
|
27
|
+
| @as("baseFeePerGas") BaseFeePerGas
|
|
28
|
+
| @as("blobGasUsed") BlobGasUsed
|
|
29
|
+
| @as("excessBlobGas") ExcessBlobGas
|
|
30
|
+
| @as("parentBeaconBlockRoot") ParentBeaconBlockRoot
|
|
31
|
+
| @as("withdrawalsRoot") WithdrawalsRoot
|
|
32
|
+
| @as("l1BlockNumber") L1BlockNumber
|
|
33
|
+
| @as("sendCount") SendCount
|
|
34
|
+
| @as("sendRoot") SendRoot
|
|
35
|
+
| @as("mixHash") MixHash
|
|
36
|
+
|
|
37
|
+
@unboxed
|
|
38
|
+
type evmTransactionField =
|
|
39
|
+
| @as("transactionIndex") TransactionIndex
|
|
40
|
+
| @as("hash") Hash
|
|
41
|
+
| @as("from") From
|
|
42
|
+
| @as("to") To
|
|
43
|
+
| @as("gas") Gas
|
|
44
|
+
| @as("gasPrice") GasPrice
|
|
45
|
+
| @as("maxPriorityFeePerGas") MaxPriorityFeePerGas
|
|
46
|
+
| @as("maxFeePerGas") MaxFeePerGas
|
|
47
|
+
| @as("cumulativeGasUsed") CumulativeGasUsed
|
|
48
|
+
| @as("effectiveGasPrice") EffectiveGasPrice
|
|
49
|
+
| @as("gasUsed") GasUsed
|
|
50
|
+
| @as("input") Input
|
|
51
|
+
| @as("nonce") Nonce
|
|
52
|
+
| @as("value") Value
|
|
53
|
+
| @as("v") V
|
|
54
|
+
| @as("r") R
|
|
55
|
+
| @as("s") S
|
|
56
|
+
| @as("contractAddress") ContractAddress
|
|
57
|
+
| @as("logsBloom") LogsBloom
|
|
58
|
+
| @as("root") Root
|
|
59
|
+
| @as("status") Status
|
|
60
|
+
| @as("yParity") YParity
|
|
61
|
+
| @as("accessList") AccessList
|
|
62
|
+
| @as("maxFeePerBlobGas") MaxFeePerBlobGas
|
|
63
|
+
| @as("blobVersionedHashes") BlobVersionedHashes
|
|
64
|
+
| @as("type") Type
|
|
65
|
+
| @as("l1Fee") L1Fee
|
|
66
|
+
| @as("l1GasPrice") L1GasPrice
|
|
67
|
+
| @as("l1GasUsed") L1GasUsed
|
|
68
|
+
| @as("l1FeeScalar") L1FeeScalar
|
|
69
|
+
| @as("gasUsedForL1") GasUsedForL1
|
|
70
|
+
| @as("authorizationList") AuthorizationList
|
|
71
|
+
|
|
72
|
+
let allEvmBlockFields: array<evmBlockField> = [
|
|
73
|
+
Number,
|
|
74
|
+
Timestamp,
|
|
75
|
+
Hash,
|
|
76
|
+
ParentHash,
|
|
77
|
+
Nonce,
|
|
78
|
+
Sha3Uncles,
|
|
79
|
+
LogsBloom,
|
|
80
|
+
TransactionsRoot,
|
|
81
|
+
StateRoot,
|
|
82
|
+
ReceiptsRoot,
|
|
83
|
+
Miner,
|
|
84
|
+
Difficulty,
|
|
85
|
+
TotalDifficulty,
|
|
86
|
+
ExtraData,
|
|
87
|
+
Size,
|
|
88
|
+
GasLimit,
|
|
89
|
+
GasUsed,
|
|
90
|
+
Uncles,
|
|
91
|
+
BaseFeePerGas,
|
|
92
|
+
BlobGasUsed,
|
|
93
|
+
ExcessBlobGas,
|
|
94
|
+
ParentBeaconBlockRoot,
|
|
95
|
+
WithdrawalsRoot,
|
|
96
|
+
L1BlockNumber,
|
|
97
|
+
SendCount,
|
|
98
|
+
SendRoot,
|
|
99
|
+
MixHash,
|
|
100
|
+
]
|
|
101
|
+
let evmBlockFieldSchema = S.enum(allEvmBlockFields)
|
|
102
|
+
|
|
103
|
+
let allEvmTransactionFields: array<evmTransactionField> = [
|
|
104
|
+
TransactionIndex,
|
|
105
|
+
Hash,
|
|
106
|
+
From,
|
|
107
|
+
To,
|
|
108
|
+
Gas,
|
|
109
|
+
GasPrice,
|
|
110
|
+
MaxPriorityFeePerGas,
|
|
111
|
+
MaxFeePerGas,
|
|
112
|
+
CumulativeGasUsed,
|
|
113
|
+
EffectiveGasPrice,
|
|
114
|
+
GasUsed,
|
|
115
|
+
Input,
|
|
116
|
+
Nonce,
|
|
117
|
+
Value,
|
|
118
|
+
V,
|
|
119
|
+
R,
|
|
120
|
+
S,
|
|
121
|
+
ContractAddress,
|
|
122
|
+
LogsBloom,
|
|
123
|
+
Root,
|
|
124
|
+
Status,
|
|
125
|
+
YParity,
|
|
126
|
+
AccessList,
|
|
127
|
+
MaxFeePerBlobGas,
|
|
128
|
+
BlobVersionedHashes,
|
|
129
|
+
Type,
|
|
130
|
+
L1Fee,
|
|
131
|
+
L1GasPrice,
|
|
132
|
+
L1GasUsed,
|
|
133
|
+
L1FeeScalar,
|
|
134
|
+
GasUsedForL1,
|
|
135
|
+
AuthorizationList,
|
|
136
|
+
]
|
|
137
|
+
let evmTransactionFieldSchema = S.enum(allEvmTransactionFields)
|
|
138
|
+
|
|
139
|
+
// Static sets of nullable field names — used by RpcSource and HyperSyncSource to wrap schemas with S.nullable
|
|
140
|
+
let evmNullableBlockFields = Utils.Set.fromArray(
|
|
141
|
+
(
|
|
142
|
+
[
|
|
143
|
+
Nonce,
|
|
144
|
+
Difficulty,
|
|
145
|
+
TotalDifficulty,
|
|
146
|
+
Uncles,
|
|
147
|
+
BaseFeePerGas,
|
|
148
|
+
BlobGasUsed,
|
|
149
|
+
ExcessBlobGas,
|
|
150
|
+
ParentBeaconBlockRoot,
|
|
151
|
+
WithdrawalsRoot,
|
|
152
|
+
L1BlockNumber,
|
|
153
|
+
SendCount,
|
|
154
|
+
SendRoot,
|
|
155
|
+
MixHash,
|
|
156
|
+
]: array<evmBlockField>
|
|
157
|
+
),
|
|
158
|
+
)
|
|
159
|
+
let evmNullableTransactionFields = Utils.Set.fromArray(
|
|
160
|
+
(
|
|
161
|
+
[
|
|
162
|
+
GasPrice,
|
|
163
|
+
V,
|
|
164
|
+
R,
|
|
165
|
+
S,
|
|
166
|
+
YParity,
|
|
167
|
+
MaxPriorityFeePerGas,
|
|
168
|
+
MaxFeePerGas,
|
|
169
|
+
MaxFeePerBlobGas,
|
|
170
|
+
BlobVersionedHashes,
|
|
171
|
+
ContractAddress,
|
|
172
|
+
Root,
|
|
173
|
+
Status,
|
|
174
|
+
L1Fee,
|
|
175
|
+
L1GasPrice,
|
|
176
|
+
L1GasUsed,
|
|
177
|
+
L1FeeScalar,
|
|
178
|
+
GasUsedForL1,
|
|
179
|
+
From,
|
|
180
|
+
To,
|
|
181
|
+
Type,
|
|
182
|
+
]: array<evmTransactionField>
|
|
183
|
+
),
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
// Shared EVM transaction fields type used by both RPC and HyperSync sources
|
|
187
|
+
// Field names match HyperSyncClient.ResponseTypes.transaction for consistency
|
|
188
|
+
type evmTransactionFields = {
|
|
189
|
+
from?: Address.t,
|
|
190
|
+
to?: Address.t,
|
|
191
|
+
gas?: bigint,
|
|
192
|
+
gasPrice?: bigint,
|
|
193
|
+
hash?: string,
|
|
194
|
+
input?: string,
|
|
195
|
+
nonce?: bigint,
|
|
196
|
+
transactionIndex?: int,
|
|
197
|
+
value?: bigint,
|
|
198
|
+
// Signature fields - optional for ZKSync EIP-712 compatibility
|
|
199
|
+
v?: string,
|
|
200
|
+
r?: string,
|
|
201
|
+
s?: string,
|
|
202
|
+
yParity?: string,
|
|
203
|
+
// EIP-1559 fields
|
|
204
|
+
maxPriorityFeePerGas?: bigint,
|
|
205
|
+
maxFeePerGas?: bigint,
|
|
206
|
+
// EIP-4844 blob fields
|
|
207
|
+
maxFeePerBlobGas?: bigint,
|
|
208
|
+
blobVersionedHashes?: array<string>,
|
|
209
|
+
// Receipt fields (from joined transaction receipts)
|
|
210
|
+
cumulativeGasUsed?: bigint,
|
|
211
|
+
effectiveGasPrice?: bigint,
|
|
212
|
+
gasUsed?: bigint,
|
|
213
|
+
contractAddress?: string,
|
|
214
|
+
logsBloom?: string,
|
|
215
|
+
@as("type")
|
|
216
|
+
type_?: int,
|
|
217
|
+
root?: string,
|
|
218
|
+
status?: int,
|
|
219
|
+
// L2 specific fields (Optimism, Arbitrum, etc.)
|
|
220
|
+
l1Fee?: bigint,
|
|
221
|
+
l1GasPrice?: bigint,
|
|
222
|
+
l1GasUsed?: bigint,
|
|
223
|
+
l1FeeScalar?: float,
|
|
224
|
+
gasUsedForL1?: bigint,
|
|
225
|
+
}
|
|
226
|
+
|
|
5
227
|
@genType
|
|
6
228
|
type genericEvent<'params, 'block, 'transaction> = {
|
|
7
229
|
params: 'params,
|
|
@@ -65,7 +287,6 @@ type chains = dict<chainInfo>
|
|
|
65
287
|
type loaderReturn
|
|
66
288
|
type handlerContext = private {
|
|
67
289
|
isPreload: bool,
|
|
68
|
-
chains: chains,
|
|
69
290
|
chain: chainInfo,
|
|
70
291
|
}
|
|
71
292
|
type handlerArgs = {
|
|
@@ -107,6 +328,7 @@ type fuelEventKind =
|
|
|
107
328
|
| Burn
|
|
108
329
|
| Transfer
|
|
109
330
|
| Call
|
|
331
|
+
@genType.opaque
|
|
110
332
|
type fuelEventConfig = {
|
|
111
333
|
...eventConfig,
|
|
112
334
|
kind: fuelEventKind,
|
|
@@ -128,12 +350,13 @@ type eventFiltersArgs = {chainId: int, addresses: array<Address.t>}
|
|
|
128
350
|
type eventFilters =
|
|
129
351
|
Static(array<topicSelection>) | Dynamic(array<Address.t> => array<topicSelection>)
|
|
130
352
|
|
|
353
|
+
@genType.opaque
|
|
131
354
|
type evmEventConfig = {
|
|
132
355
|
...eventConfig,
|
|
133
356
|
getEventFiltersOrThrow: ChainMap.Chain.t => eventFilters,
|
|
134
|
-
blockSchema: S.schema<eventBlock>,
|
|
135
|
-
transactionSchema: S.schema<eventTransaction>,
|
|
136
357
|
convertHyperSyncEventArgs: HyperSyncClient.Decoder.decodedEvent => eventParams,
|
|
358
|
+
selectedBlockFields: Utils.Set.t<evmBlockField>,
|
|
359
|
+
selectedTransactionFields: Utils.Set.t<evmTransactionField>,
|
|
137
360
|
}
|
|
138
361
|
type evmContractConfig = {
|
|
139
362
|
name: string,
|
|
@@ -169,7 +392,8 @@ type eventItem = private {
|
|
|
169
392
|
type blockEvent
|
|
170
393
|
|
|
171
394
|
type onBlockArgs = {
|
|
172
|
-
|
|
395
|
+
slot?: int,
|
|
396
|
+
block?: blockEvent,
|
|
173
397
|
context: handlerContext,
|
|
174
398
|
}
|
|
175
399
|
|
|
@@ -244,18 +468,12 @@ let fuelTransferParamsSchema = S.schema(s => {
|
|
|
244
468
|
})
|
|
245
469
|
|
|
246
470
|
type entity = private {id: string}
|
|
247
|
-
type clickHouseSetUpdatesCache = {
|
|
248
|
-
tableName: string,
|
|
249
|
-
convertOrThrow: Change.t<entity> => Js.Json.t,
|
|
250
|
-
}
|
|
251
471
|
type genericEntityConfig<'entity> = {
|
|
252
472
|
name: string,
|
|
253
473
|
index: int,
|
|
254
474
|
schema: S.t<'entity>,
|
|
255
475
|
rowsSchema: S.t<array<'entity>>,
|
|
256
476
|
table: Table.table,
|
|
257
|
-
mutable clickHouseSetUpdatesCache?: clickHouseSetUpdatesCache,
|
|
258
|
-
mutable pgEntityHistoryCache?: EntityHistory.pgEntityHistory<'entity>,
|
|
259
477
|
}
|
|
260
478
|
type entityConfig = genericEntityConfig<entity>
|
|
261
479
|
external fromGenericEntityConfig: genericEntityConfig<'entity> => entityConfig = "%identity"
|
|
@@ -312,11 +530,11 @@ let makeCacheTable = (~effectName) => {
|
|
|
312
530
|
@genType.import(("./Types.ts", "Invalid"))
|
|
313
531
|
type noEventFilters
|
|
314
532
|
|
|
315
|
-
type checkpointId =
|
|
533
|
+
type checkpointId = bigint
|
|
316
534
|
|
|
317
535
|
type reorgCheckpoint = {
|
|
318
536
|
@as("id")
|
|
319
|
-
checkpointId:
|
|
537
|
+
checkpointId: bigint,
|
|
320
538
|
@as("chain_id")
|
|
321
539
|
chainId: int,
|
|
322
540
|
@as("block_number")
|
package/src/Internal.res.mjs
CHANGED
|
@@ -5,6 +5,114 @@ import * as $$BigInt from "./bindings/BigInt.res.mjs";
|
|
|
5
5
|
import * as Address from "./Address.res.mjs";
|
|
6
6
|
import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
|
|
7
7
|
|
|
8
|
+
var allEvmBlockFields = [
|
|
9
|
+
"number",
|
|
10
|
+
"timestamp",
|
|
11
|
+
"hash",
|
|
12
|
+
"parentHash",
|
|
13
|
+
"nonce",
|
|
14
|
+
"sha3Uncles",
|
|
15
|
+
"logsBloom",
|
|
16
|
+
"transactionsRoot",
|
|
17
|
+
"stateRoot",
|
|
18
|
+
"receiptsRoot",
|
|
19
|
+
"miner",
|
|
20
|
+
"difficulty",
|
|
21
|
+
"totalDifficulty",
|
|
22
|
+
"extraData",
|
|
23
|
+
"size",
|
|
24
|
+
"gasLimit",
|
|
25
|
+
"gasUsed",
|
|
26
|
+
"uncles",
|
|
27
|
+
"baseFeePerGas",
|
|
28
|
+
"blobGasUsed",
|
|
29
|
+
"excessBlobGas",
|
|
30
|
+
"parentBeaconBlockRoot",
|
|
31
|
+
"withdrawalsRoot",
|
|
32
|
+
"l1BlockNumber",
|
|
33
|
+
"sendCount",
|
|
34
|
+
"sendRoot",
|
|
35
|
+
"mixHash"
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
var evmBlockFieldSchema = S$RescriptSchema.$$enum(allEvmBlockFields);
|
|
39
|
+
|
|
40
|
+
var allEvmTransactionFields = [
|
|
41
|
+
"transactionIndex",
|
|
42
|
+
"hash",
|
|
43
|
+
"from",
|
|
44
|
+
"to",
|
|
45
|
+
"gas",
|
|
46
|
+
"gasPrice",
|
|
47
|
+
"maxPriorityFeePerGas",
|
|
48
|
+
"maxFeePerGas",
|
|
49
|
+
"cumulativeGasUsed",
|
|
50
|
+
"effectiveGasPrice",
|
|
51
|
+
"gasUsed",
|
|
52
|
+
"input",
|
|
53
|
+
"nonce",
|
|
54
|
+
"value",
|
|
55
|
+
"v",
|
|
56
|
+
"r",
|
|
57
|
+
"s",
|
|
58
|
+
"contractAddress",
|
|
59
|
+
"logsBloom",
|
|
60
|
+
"root",
|
|
61
|
+
"status",
|
|
62
|
+
"yParity",
|
|
63
|
+
"accessList",
|
|
64
|
+
"maxFeePerBlobGas",
|
|
65
|
+
"blobVersionedHashes",
|
|
66
|
+
"type",
|
|
67
|
+
"l1Fee",
|
|
68
|
+
"l1GasPrice",
|
|
69
|
+
"l1GasUsed",
|
|
70
|
+
"l1FeeScalar",
|
|
71
|
+
"gasUsedForL1",
|
|
72
|
+
"authorizationList"
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
var evmTransactionFieldSchema = S$RescriptSchema.$$enum(allEvmTransactionFields);
|
|
76
|
+
|
|
77
|
+
var evmNullableBlockFields = new Set([
|
|
78
|
+
"nonce",
|
|
79
|
+
"difficulty",
|
|
80
|
+
"totalDifficulty",
|
|
81
|
+
"uncles",
|
|
82
|
+
"baseFeePerGas",
|
|
83
|
+
"blobGasUsed",
|
|
84
|
+
"excessBlobGas",
|
|
85
|
+
"parentBeaconBlockRoot",
|
|
86
|
+
"withdrawalsRoot",
|
|
87
|
+
"l1BlockNumber",
|
|
88
|
+
"sendCount",
|
|
89
|
+
"sendRoot",
|
|
90
|
+
"mixHash"
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
var evmNullableTransactionFields = new Set([
|
|
94
|
+
"gasPrice",
|
|
95
|
+
"v",
|
|
96
|
+
"r",
|
|
97
|
+
"s",
|
|
98
|
+
"yParity",
|
|
99
|
+
"maxPriorityFeePerGas",
|
|
100
|
+
"maxFeePerGas",
|
|
101
|
+
"maxFeePerBlobGas",
|
|
102
|
+
"blobVersionedHashes",
|
|
103
|
+
"contractAddress",
|
|
104
|
+
"root",
|
|
105
|
+
"status",
|
|
106
|
+
"l1Fee",
|
|
107
|
+
"l1GasPrice",
|
|
108
|
+
"l1GasUsed",
|
|
109
|
+
"l1FeeScalar",
|
|
110
|
+
"gasUsedForL1",
|
|
111
|
+
"from",
|
|
112
|
+
"to",
|
|
113
|
+
"type"
|
|
114
|
+
]);
|
|
115
|
+
|
|
8
116
|
function getItemChainId(item) {
|
|
9
117
|
if (item.kind === 0) {
|
|
10
118
|
return item.chain;
|
|
@@ -47,6 +155,12 @@ function makeCacheTable(effectName) {
|
|
|
47
155
|
}
|
|
48
156
|
|
|
49
157
|
export {
|
|
158
|
+
allEvmBlockFields ,
|
|
159
|
+
evmBlockFieldSchema ,
|
|
160
|
+
allEvmTransactionFields ,
|
|
161
|
+
evmTransactionFieldSchema ,
|
|
162
|
+
evmNullableBlockFields ,
|
|
163
|
+
evmNullableTransactionFields ,
|
|
50
164
|
getItemChainId ,
|
|
51
165
|
fuelSupplyParamsSchema ,
|
|
52
166
|
fuelTransferParamsSchema ,
|
|
@@ -55,4 +169,4 @@ export {
|
|
|
55
169
|
effectCacheItemRowsSchema ,
|
|
56
170
|
makeCacheTable ,
|
|
57
171
|
}
|
|
58
|
-
/*
|
|
172
|
+
/* evmBlockFieldSchema Not a pure module */
|