envio 3.3.0-alpha.4 → 3.3.0-alpha.6
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/evm.schema.json +10 -0
- package/package.json +7 -7
- package/src/Batch.res.mjs +1 -1
- package/src/BatchProcessing.res +5 -0
- package/src/BatchProcessing.res.mjs +6 -0
- package/src/ChainState.res +41 -7
- package/src/ChainState.res.mjs +22 -18
- package/src/ChainState.resi +3 -1
- package/src/Config.res +3 -0
- package/src/Config.res.mjs +3 -1
- package/src/Core.res +0 -3
- package/src/ExitOnCaughtUp.res +10 -2
- package/src/ExitOnCaughtUp.res.mjs +10 -1
- package/src/FetchState.res +63 -133
- package/src/FetchState.res.mjs +107 -166
- package/src/IndexerState.res +4 -0
- package/src/IndexerState.res.mjs +8 -1
- package/src/IndexerState.resi +1 -0
- package/src/IndexingAddresses.res +105 -0
- package/src/IndexingAddresses.res.mjs +100 -0
- package/src/IndexingAddresses.resi +32 -0
- package/src/Main.res +4 -15
- package/src/Main.res.mjs +6 -14
- package/src/Metrics.res +33 -0
- package/src/Metrics.res.mjs +39 -0
- package/src/Prometheus.res +2 -20
- package/src/Prometheus.res.mjs +83 -95
- package/src/SimulateDeadInputTracker.res +85 -0
- package/src/SimulateDeadInputTracker.res.mjs +73 -0
- package/src/SimulateDeadInputTracker.resi +12 -0
- package/src/SimulateItems.res +23 -42
- package/src/SimulateItems.res.mjs +12 -30
- package/src/TestIndexer.res +3 -27
- package/src/TestIndexer.res.mjs +2 -9
- package/src/bindings/Viem.res +0 -41
- package/src/bindings/Viem.res.mjs +1 -43
- package/src/sources/Evm.res +7 -36
- package/src/sources/Evm.res.mjs +4 -36
- package/src/sources/EvmChain.res +4 -2
- package/src/sources/EvmChain.res.mjs +3 -2
- package/src/sources/EvmRpcClient.res +36 -5
- package/src/sources/EvmRpcClient.res.mjs +7 -4
- package/src/sources/HyperSyncClient.res +0 -35
- package/src/sources/HyperSyncClient.res.mjs +1 -8
- package/src/sources/Rpc.res +15 -47
- package/src/sources/Rpc.res.mjs +25 -56
- package/src/sources/RpcSource.res +289 -204
- package/src/sources/RpcSource.res.mjs +293 -303
- package/src/sources/SimulateSource.res +1 -0
- package/src/sources/SimulateSource.res.mjs +2 -1
- package/src/sources/Source.res +4 -0
- package/src/sources/Svm.res +7 -15
- package/src/sources/Svm.res.mjs +4 -15
- package/src/sources/TransactionStore.res +14 -2
- package/src/sources/TransactionStore.res.mjs +10 -2
package/src/sources/Rpc.res.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import * as Rest from "../vendored/Rest.res.mjs";
|
|
|
4
4
|
import * as Viem from "viem";
|
|
5
5
|
import * as Utils from "../Utils.res.mjs";
|
|
6
6
|
import * as Address from "../Address.res.mjs";
|
|
7
|
+
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
7
8
|
import * as Stdlib_BigInt from "@rescript/runtime/lib/es6/Stdlib_BigInt.js";
|
|
8
9
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
9
10
|
import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
|
|
@@ -48,8 +49,21 @@ async function jsonRpcFetcher(args) {
|
|
|
48
49
|
return response;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
function makeClient(url) {
|
|
52
|
-
|
|
52
|
+
function makeClient(url, headers) {
|
|
53
|
+
let fetcher = headers !== undefined ? async args => {
|
|
54
|
+
let headers$1 = args.headers;
|
|
55
|
+
let headers$2 = headers$1 !== undefined ? headers$1 : ({});
|
|
56
|
+
Stdlib_Dict.forEachWithKey(headers, (value, key) => {
|
|
57
|
+
headers$2[key] = value;
|
|
58
|
+
});
|
|
59
|
+
return await jsonRpcFetcher({
|
|
60
|
+
body: args.body,
|
|
61
|
+
headers: headers$2,
|
|
62
|
+
method: args.method,
|
|
63
|
+
path: args.path
|
|
64
|
+
});
|
|
65
|
+
} : jsonRpcFetcher;
|
|
66
|
+
return Rest.client(url, fetcher);
|
|
53
67
|
}
|
|
54
68
|
|
|
55
69
|
function makeHexSchema(fromStr) {
|
|
@@ -81,14 +95,6 @@ let decimalFloatSchema = S$RescriptSchema.transform(S$RescriptSchema.string, s =
|
|
|
81
95
|
}
|
|
82
96
|
}));
|
|
83
97
|
|
|
84
|
-
let topicFilterSchema = S$RescriptSchema.union([
|
|
85
|
-
S$RescriptSchema.literal(null),
|
|
86
|
-
S$RescriptSchema.schema(s => (s.m(S$RescriptSchema.array(S$RescriptSchema.string)))),
|
|
87
|
-
S$RescriptSchema.schema(s => (s.m(S$RescriptSchema.string)))
|
|
88
|
-
]);
|
|
89
|
-
|
|
90
|
-
let topicQuerySchema = S$RescriptSchema.array(topicFilterSchema);
|
|
91
|
-
|
|
92
98
|
function makeTopicQuery(topic0Opt, topic1Opt, topic2Opt, topic3Opt) {
|
|
93
99
|
let topic0 = topic0Opt !== undefined ? topic0Opt : [];
|
|
94
100
|
let topic1 = topic1Opt !== undefined ? topic1Opt : [];
|
|
@@ -130,41 +136,9 @@ function mapTopicQuery(param) {
|
|
|
130
136
|
return makeTopicQuery(param.topic0, param.topic1, param.topic2, param.topic3);
|
|
131
137
|
}
|
|
132
138
|
|
|
133
|
-
let paramsSchema = S$RescriptSchema.object(s => ({
|
|
134
|
-
fromBlock: s.f("fromBlock", hexIntSchema),
|
|
135
|
-
toBlock: s.f("toBlock", hexIntSchema),
|
|
136
|
-
address: s.f("address", S$RescriptSchema.option(S$RescriptSchema.array(Address.schema))),
|
|
137
|
-
topics: s.f("topics", topicQuerySchema)
|
|
138
|
-
}));
|
|
139
|
-
|
|
140
|
-
let fullParamsSchema = S$RescriptSchema.tuple1(paramsSchema);
|
|
141
|
-
|
|
142
|
-
let logSchema = S$RescriptSchema.object(s => ({
|
|
143
|
-
address: s.f("address", Address.schema),
|
|
144
|
-
topics: s.f("topics", S$RescriptSchema.array(S$RescriptSchema.string)),
|
|
145
|
-
data: s.f("data", S$RescriptSchema.string),
|
|
146
|
-
blockNumber: s.f("blockNumber", hexIntSchema),
|
|
147
|
-
transactionHash: s.f("transactionHash", S$RescriptSchema.string),
|
|
148
|
-
transactionIndex: s.f("transactionIndex", hexIntSchema),
|
|
149
|
-
blockHash: s.f("blockHash", S$RescriptSchema.string),
|
|
150
|
-
logIndex: s.f("logIndex", hexIntSchema),
|
|
151
|
-
removed: s.f("removed", S$RescriptSchema.bool)
|
|
152
|
-
}));
|
|
153
|
-
|
|
154
|
-
let resultSchema = S$RescriptSchema.array(logSchema);
|
|
155
|
-
|
|
156
|
-
let route = makeRpcRoute("eth_getLogs", fullParamsSchema, resultSchema);
|
|
157
|
-
|
|
158
139
|
let GetLogs = {
|
|
159
|
-
topicFilterSchema: topicFilterSchema,
|
|
160
|
-
topicQuerySchema: topicQuerySchema,
|
|
161
140
|
makeTopicQuery: makeTopicQuery,
|
|
162
|
-
mapTopicQuery: mapTopicQuery
|
|
163
|
-
paramsSchema: paramsSchema,
|
|
164
|
-
fullParamsSchema: fullParamsSchema,
|
|
165
|
-
logSchema: logSchema,
|
|
166
|
-
resultSchema: resultSchema,
|
|
167
|
-
route: route
|
|
141
|
+
mapTopicQuery: mapTopicQuery
|
|
168
142
|
};
|
|
169
143
|
|
|
170
144
|
let blockSchema = S$RescriptSchema.object(s => ({
|
|
@@ -190,22 +164,22 @@ let blockSchema = S$RescriptSchema.object(s => ({
|
|
|
190
164
|
uncles: s.f("uncles", S$RescriptSchema.$$null(S$RescriptSchema.array(S$RescriptSchema.string)))
|
|
191
165
|
}));
|
|
192
166
|
|
|
193
|
-
let paramsSchema
|
|
167
|
+
let paramsSchema = S$RescriptSchema.tuple(s => ({
|
|
194
168
|
blockNumber: s.item(0, hexIntSchema),
|
|
195
169
|
includeTransactions: s.item(1, S$RescriptSchema.bool)
|
|
196
170
|
}));
|
|
197
171
|
|
|
198
|
-
let resultSchema
|
|
172
|
+
let resultSchema = S$RescriptSchema.$$null(blockSchema);
|
|
199
173
|
|
|
200
|
-
let route
|
|
174
|
+
let route = makeRpcRoute("eth_getBlockByNumber", paramsSchema, resultSchema);
|
|
201
175
|
|
|
202
|
-
let rawRoute = makeRpcRoute("eth_getBlockByNumber", paramsSchema
|
|
176
|
+
let rawRoute = makeRpcRoute("eth_getBlockByNumber", paramsSchema, S$RescriptSchema.$$null(S$RescriptSchema.json(false)));
|
|
203
177
|
|
|
204
178
|
let GetBlockByNumber = {
|
|
205
179
|
blockSchema: blockSchema,
|
|
206
|
-
paramsSchema: paramsSchema
|
|
207
|
-
resultSchema: resultSchema
|
|
208
|
-
route: route
|
|
180
|
+
paramsSchema: paramsSchema,
|
|
181
|
+
resultSchema: resultSchema,
|
|
182
|
+
route: route,
|
|
209
183
|
rawRoute: rawRoute
|
|
210
184
|
};
|
|
211
185
|
|
|
@@ -221,12 +195,8 @@ let GetTransactionReceipt = {
|
|
|
221
195
|
rawRoute: rawRoute$2
|
|
222
196
|
};
|
|
223
197
|
|
|
224
|
-
async function getLogs(client, param) {
|
|
225
|
-
return await Rest.fetch(route, param, client);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
198
|
async function getBlock(client, blockNumber) {
|
|
229
|
-
return await Rest.fetch(route
|
|
199
|
+
return await Rest.fetch(route, {
|
|
230
200
|
blockNumber: blockNumber,
|
|
231
201
|
includeTransactions: false
|
|
232
202
|
}, client);
|
|
@@ -252,7 +222,6 @@ export {
|
|
|
252
222
|
GetBlockByNumber,
|
|
253
223
|
GetTransactionByHash,
|
|
254
224
|
GetTransactionReceipt,
|
|
255
|
-
getLogs,
|
|
256
225
|
getBlock,
|
|
257
226
|
getRawBlock,
|
|
258
227
|
}
|