envio 3.0.0-alpha.21 → 3.0.0-alpha.22
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/bin.mjs +2 -48
- package/evm.schema.json +67 -0
- package/fuel.schema.json +67 -0
- package/index.d.ts +822 -38
- package/index.js +5 -3
- package/package.json +10 -8
- package/rescript.json +5 -9
- package/src/Address.res +4 -5
- package/src/Address.res.mjs +9 -12
- package/src/Api.res +15 -0
- package/src/Api.res.mjs +20 -0
- package/src/Batch.res +32 -34
- package/src/Batch.res.mjs +172 -187
- package/src/Bin.res +89 -0
- package/src/Bin.res.mjs +97 -0
- package/src/ChainFetcher.res +33 -57
- package/src/ChainFetcher.res.mjs +197 -227
- package/src/ChainManager.res +6 -14
- package/src/ChainManager.res.mjs +74 -85
- package/src/ChainMap.res +14 -16
- package/src/ChainMap.res.mjs +38 -38
- package/src/Config.res +193 -135
- package/src/Config.res.mjs +566 -592
- package/src/Core.res +182 -0
- package/src/Core.res.mjs +207 -0
- package/src/Ecosystem.res +25 -4
- package/src/Ecosystem.res.mjs +12 -13
- package/src/Env.res +20 -13
- package/src/Env.res.mjs +124 -113
- package/src/EnvSafe.res +269 -0
- package/src/EnvSafe.res.mjs +296 -0
- package/src/EnvSafe.resi +18 -0
- package/src/Envio.res +37 -26
- package/src/Envio.res.mjs +59 -60
- package/src/ErrorHandling.res +2 -2
- package/src/ErrorHandling.res.mjs +15 -15
- package/src/EventConfigBuilder.res +219 -81
- package/src/EventConfigBuilder.res.mjs +259 -202
- package/src/EventProcessing.res +27 -38
- package/src/EventProcessing.res.mjs +165 -183
- package/src/EventUtils.res +11 -11
- package/src/EventUtils.res.mjs +21 -22
- package/src/EvmTypes.res +0 -1
- package/src/EvmTypes.res.mjs +5 -5
- package/src/FetchState.res +360 -256
- package/src/FetchState.res.mjs +958 -914
- package/src/GlobalState.res +365 -351
- package/src/GlobalState.res.mjs +958 -992
- package/src/GlobalStateManager.res +1 -2
- package/src/GlobalStateManager.res.mjs +36 -44
- package/src/HandlerLoader.res +107 -23
- package/src/HandlerLoader.res.mjs +128 -38
- package/src/HandlerRegister.res +127 -103
- package/src/HandlerRegister.res.mjs +164 -164
- package/src/HandlerRegister.resi +12 -4
- package/src/Hasura.res +35 -22
- package/src/Hasura.res.mjs +158 -167
- package/src/InMemoryStore.res +20 -27
- package/src/InMemoryStore.res.mjs +64 -80
- package/src/InMemoryTable.res +34 -39
- package/src/InMemoryTable.res.mjs +165 -170
- package/src/Internal.res +52 -33
- package/src/Internal.res.mjs +84 -81
- package/src/LazyLoader.res.mjs +55 -61
- package/src/LoadLayer.res +77 -78
- package/src/LoadLayer.res.mjs +160 -189
- package/src/LoadManager.res +16 -21
- package/src/LoadManager.res.mjs +79 -84
- package/src/LogSelection.res +236 -68
- package/src/LogSelection.res.mjs +211 -141
- package/src/Logging.res +13 -9
- package/src/Logging.res.mjs +130 -143
- package/src/Main.res +428 -51
- package/src/Main.res.mjs +528 -271
- package/src/Persistence.res +77 -84
- package/src/Persistence.res.mjs +131 -132
- package/src/PgStorage.res +291 -167
- package/src/PgStorage.res.mjs +797 -817
- package/src/Prometheus.res +50 -58
- package/src/Prometheus.res.mjs +345 -373
- package/src/ReorgDetection.res +22 -24
- package/src/ReorgDetection.res.mjs +100 -106
- package/src/SafeCheckpointTracking.res +7 -7
- package/src/SafeCheckpointTracking.res.mjs +40 -43
- package/src/SimulateItems.res +41 -49
- package/src/SimulateItems.res.mjs +257 -272
- package/src/Sink.res +2 -2
- package/src/Sink.res.mjs +22 -26
- package/src/TableIndices.res +1 -2
- package/src/TableIndices.res.mjs +42 -48
- package/src/TestIndexer.res +196 -189
- package/src/TestIndexer.res.mjs +536 -536
- package/src/TestIndexerProxyStorage.res +15 -16
- package/src/TestIndexerProxyStorage.res.mjs +98 -122
- package/src/TestIndexerWorker.res +4 -0
- package/src/TestIndexerWorker.res.mjs +7 -0
- package/src/Throttler.res +3 -3
- package/src/Throttler.res.mjs +23 -24
- package/src/Time.res +1 -1
- package/src/Time.res.mjs +18 -21
- package/src/TopicFilter.res +3 -3
- package/src/TopicFilter.res.mjs +29 -30
- package/src/UserContext.res +93 -54
- package/src/UserContext.res.mjs +197 -182
- package/src/Utils.res +141 -86
- package/src/Utils.res.mjs +334 -295
- package/src/bindings/BigDecimal.res +0 -2
- package/src/bindings/BigDecimal.res.mjs +19 -23
- package/src/bindings/ClickHouse.res +28 -27
- package/src/bindings/ClickHouse.res.mjs +243 -240
- package/src/bindings/DateFns.res +11 -11
- package/src/bindings/DateFns.res.mjs +7 -7
- package/src/bindings/EventSource.res.mjs +2 -2
- package/src/bindings/Express.res +2 -5
- package/src/bindings/Hrtime.res +2 -2
- package/src/bindings/Hrtime.res.mjs +30 -32
- package/src/bindings/Lodash.res.mjs +1 -1
- package/src/bindings/NodeJs.res +14 -9
- package/src/bindings/NodeJs.res.mjs +20 -20
- package/src/bindings/Pino.res +8 -10
- package/src/bindings/Pino.res.mjs +40 -43
- package/src/bindings/Postgres.res +2 -5
- package/src/bindings/Postgres.res.mjs +9 -9
- package/src/bindings/PromClient.res +17 -2
- package/src/bindings/PromClient.res.mjs +30 -7
- package/src/bindings/SDSL.res.mjs +2 -2
- package/src/bindings/Viem.res +4 -4
- package/src/bindings/Viem.res.mjs +20 -22
- package/src/bindings/Vitest.res +1 -1
- package/src/bindings/Vitest.res.mjs +2 -2
- package/src/bindings/WebSocket.res +1 -1
- package/src/db/EntityHistory.res +9 -3
- package/src/db/EntityHistory.res.mjs +84 -59
- package/src/db/InternalTable.res +62 -60
- package/src/db/InternalTable.res.mjs +271 -203
- package/src/db/Schema.res +1 -2
- package/src/db/Schema.res.mjs +28 -32
- package/src/db/Table.res +28 -27
- package/src/db/Table.res.mjs +276 -292
- package/src/sources/EventRouter.res +21 -16
- package/src/sources/EventRouter.res.mjs +55 -57
- package/src/sources/Evm.res +17 -1
- package/src/sources/Evm.res.mjs +16 -8
- package/src/sources/EvmChain.res +15 -17
- package/src/sources/EvmChain.res.mjs +40 -42
- package/src/sources/Fuel.res +14 -1
- package/src/sources/Fuel.res.mjs +16 -8
- package/src/sources/FuelSDK.res +1 -1
- package/src/sources/FuelSDK.res.mjs +6 -8
- package/src/sources/HyperFuel.res +8 -10
- package/src/sources/HyperFuel.res.mjs +113 -123
- package/src/sources/HyperFuelClient.res.mjs +6 -7
- package/src/sources/HyperFuelSource.res +19 -20
- package/src/sources/HyperFuelSource.res.mjs +339 -356
- package/src/sources/HyperSync.res +11 -13
- package/src/sources/HyperSync.res.mjs +206 -220
- package/src/sources/HyperSyncClient.res +5 -7
- package/src/sources/HyperSyncClient.res.mjs +70 -75
- package/src/sources/HyperSyncHeightStream.res +8 -9
- package/src/sources/HyperSyncHeightStream.res.mjs +78 -86
- package/src/sources/HyperSyncJsonApi.res +18 -15
- package/src/sources/HyperSyncJsonApi.res.mjs +201 -231
- package/src/sources/HyperSyncSource.res +17 -21
- package/src/sources/HyperSyncSource.res.mjs +268 -290
- package/src/sources/Rpc.res +5 -5
- package/src/sources/Rpc.res.mjs +168 -192
- package/src/sources/RpcSource.res +166 -167
- package/src/sources/RpcSource.res.mjs +972 -1046
- package/src/sources/RpcWebSocketHeightStream.res +10 -11
- package/src/sources/RpcWebSocketHeightStream.res.mjs +131 -145
- package/src/sources/SimulateSource.res +1 -1
- package/src/sources/SimulateSource.res.mjs +35 -38
- package/src/sources/Source.res +1 -1
- package/src/sources/Source.res.mjs +3 -3
- package/src/sources/SourceManager.res +39 -20
- package/src/sources/SourceManager.res.mjs +340 -371
- package/src/sources/SourceManager.resi +2 -1
- package/src/sources/Svm.res +12 -5
- package/src/sources/Svm.res.mjs +44 -41
- package/src/tui/Tui.res +23 -12
- package/src/tui/Tui.res.mjs +292 -290
- package/src/tui/bindings/Ink.res +2 -4
- package/src/tui/bindings/Ink.res.mjs +35 -41
- package/src/tui/components/BufferedProgressBar.res +7 -7
- package/src/tui/components/BufferedProgressBar.res.mjs +46 -46
- package/src/tui/components/CustomHooks.res +1 -2
- package/src/tui/components/CustomHooks.res.mjs +102 -122
- package/src/tui/components/Messages.res +1 -2
- package/src/tui/components/Messages.res.mjs +38 -42
- package/src/tui/components/SyncETA.res +10 -11
- package/src/tui/components/SyncETA.res.mjs +178 -196
- package/src/tui/components/TuiData.res +1 -1
- package/src/tui/components/TuiData.res.mjs +7 -6
- package/src/vendored/Rest.res +52 -66
- package/src/vendored/Rest.res.mjs +324 -364
- package/svm.schema.json +67 -0
- package/src/Address.gen.ts +0 -8
- package/src/Config.gen.ts +0 -19
- package/src/Envio.gen.ts +0 -55
- package/src/EvmTypes.gen.ts +0 -6
- package/src/InMemoryStore.gen.ts +0 -6
- package/src/Internal.gen.ts +0 -64
- package/src/PgStorage.gen.ts +0 -10
- package/src/PgStorage.res.d.mts +0 -5
- package/src/Types.ts +0 -56
- package/src/bindings/BigDecimal.gen.ts +0 -14
- package/src/bindings/BigDecimal.res.d.mts +0 -5
- package/src/bindings/BigInt.gen.ts +0 -10
- package/src/bindings/BigInt.res +0 -70
- package/src/bindings/BigInt.res.d.mts +0 -5
- package/src/bindings/BigInt.res.mjs +0 -154
- package/src/bindings/Ethers.res.d.mts +0 -5
- package/src/bindings/Pino.gen.ts +0 -17
- package/src/bindings/Postgres.gen.ts +0 -8
- package/src/bindings/Postgres.res.d.mts +0 -5
- package/src/bindings/Promise.res +0 -67
- package/src/bindings/Promise.res.mjs +0 -26
- package/src/db/InternalTable.gen.ts +0 -36
- package/src/sources/HyperSyncClient.gen.ts +0 -19
package/src/sources/Rpc.res
CHANGED
|
@@ -26,9 +26,9 @@ let makeRpcRoute = (method: string, paramsSchema, resultSchema) => {
|
|
|
26
26
|
let jsonRpcFetcher: Rest.ApiFetcher.t = async args => {
|
|
27
27
|
let response = await Rest.ApiFetcher.default(args)
|
|
28
28
|
let data: {..} = response.data->Obj.magic
|
|
29
|
-
switch data["error"]->
|
|
29
|
+
switch data["error"]->Nullable.toOption {
|
|
30
30
|
| Some(error) =>
|
|
31
|
-
|
|
31
|
+
throw(
|
|
32
32
|
JsonRpcError({
|
|
33
33
|
code: error["code"],
|
|
34
34
|
message: error["message"],
|
|
@@ -59,7 +59,7 @@ external parseFloat: string => float = "Number"
|
|
|
59
59
|
let decimalFloatSchema: S.schema<float> = S.string->S.transform(s => {
|
|
60
60
|
parser: str => {
|
|
61
61
|
let v = parseFloat(str)
|
|
62
|
-
if
|
|
62
|
+
if Float.isNaN(v) {
|
|
63
63
|
s.fail("The string is not a valid decimal number")
|
|
64
64
|
} else {
|
|
65
65
|
v
|
|
@@ -89,7 +89,7 @@ module GetLogs = {
|
|
|
89
89
|
|
|
90
90
|
//Remove all empty topics from the end of the array
|
|
91
91
|
while isLastTopicEmpty() {
|
|
92
|
-
topics->
|
|
92
|
+
topics->Array.pop->ignore
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
let toTopicFilter = topic => {
|
|
@@ -172,7 +172,7 @@ module GetBlockByNumber = {
|
|
|
172
172
|
stateRoot: hex,
|
|
173
173
|
timestamp: int,
|
|
174
174
|
totalDifficulty: option<bigint>,
|
|
175
|
-
transactions: array<
|
|
175
|
+
transactions: array<JSON.t>,
|
|
176
176
|
transactionsRoot: hex,
|
|
177
177
|
uncles: option<array<hex>>,
|
|
178
178
|
}
|
package/src/sources/Rpc.res.mjs
CHANGED
|
@@ -3,50 +3,48 @@
|
|
|
3
3
|
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
|
-
import * as $$BigInt from "../bindings/BigInt.res.mjs";
|
|
7
6
|
import * as Address from "../Address.res.mjs";
|
|
8
|
-
import * as Belt_Array from "rescript/lib/es6/
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
7
|
+
import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
|
|
8
|
+
import * as Stdlib_BigInt from "@rescript/runtime/lib/es6/Stdlib_BigInt.js";
|
|
9
|
+
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
11
10
|
import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
|
|
11
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
let JsonRpcError = /* @__PURE__ */Primitive_exceptions.create("Rpc.JsonRpcError");
|
|
14
14
|
|
|
15
15
|
function makeRpcRoute(method, paramsSchema, resultSchema) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
};
|
|
16
|
+
let idSchema = S$RescriptSchema.literal(1);
|
|
17
|
+
let versionSchema = S$RescriptSchema.literal("2.0");
|
|
18
|
+
return () => ({
|
|
19
|
+
method: "POST",
|
|
20
|
+
path: "",
|
|
21
|
+
input: s => {
|
|
22
|
+
s.field("method", S$RescriptSchema.literal(method));
|
|
23
|
+
s.field("id", idSchema);
|
|
24
|
+
s.field("jsonrpc", versionSchema);
|
|
25
|
+
return s.field("params", paramsSchema);
|
|
26
|
+
},
|
|
27
|
+
responses: [s => {
|
|
28
|
+
s.field("jsonrpc", versionSchema);
|
|
29
|
+
s.field("id", idSchema);
|
|
30
|
+
return s.field("result", resultSchema);
|
|
31
|
+
}]
|
|
32
|
+
});
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
async function jsonRpcFetcher(args) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
let response = await Rest.ApiFetcher.$$default(args);
|
|
37
|
+
let data = response.data;
|
|
38
|
+
let error = data.error;
|
|
41
39
|
if (!(error == null)) {
|
|
42
40
|
throw {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
RE_EXN_ID: JsonRpcError,
|
|
42
|
+
_1: {
|
|
43
|
+
code: error.code,
|
|
44
|
+
message: error.message
|
|
45
|
+
},
|
|
46
|
+
Error: new Error()
|
|
47
|
+
};
|
|
50
48
|
}
|
|
51
49
|
return response;
|
|
52
50
|
}
|
|
@@ -56,78 +54,66 @@ function makeClient(url) {
|
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
function makeHexSchema(fromStr) {
|
|
59
|
-
return S$RescriptSchema.transform(S$RescriptSchema.string,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return Viem.toHex(value);
|
|
71
|
-
})
|
|
72
|
-
};
|
|
73
|
-
}));
|
|
57
|
+
return S$RescriptSchema.transform(S$RescriptSchema.string, s => ({
|
|
58
|
+
p: str => {
|
|
59
|
+
let v = fromStr(str);
|
|
60
|
+
if (v !== undefined) {
|
|
61
|
+
return Primitive_option.valFromOption(v);
|
|
62
|
+
} else {
|
|
63
|
+
return s.fail("The string is not valid hex", undefined);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
s: value => Viem.toHex(value)
|
|
67
|
+
}));
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return s.m(S$RescriptSchema.array(S$RescriptSchema.string));
|
|
99
|
-
}),
|
|
100
|
-
S$RescriptSchema.schema(function (s) {
|
|
101
|
-
return s.m(S$RescriptSchema.string);
|
|
102
|
-
})
|
|
103
|
-
]);
|
|
104
|
-
|
|
105
|
-
var topicQuerySchema = S$RescriptSchema.array(topicFilterSchema);
|
|
70
|
+
let hexBigintSchema = makeHexSchema(Stdlib_BigInt.fromString);
|
|
71
|
+
|
|
72
|
+
let hexIntSchema = makeHexSchema(v => Number(v));
|
|
73
|
+
|
|
74
|
+
let decimalFloatSchema = S$RescriptSchema.transform(S$RescriptSchema.string, s => ({
|
|
75
|
+
p: str => {
|
|
76
|
+
let v = Number(str);
|
|
77
|
+
if (Number.isNaN(v)) {
|
|
78
|
+
return s.fail("The string is not a valid decimal number", undefined);
|
|
79
|
+
} else {
|
|
80
|
+
return v;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
|
|
85
|
+
let topicFilterSchema = S$RescriptSchema.union([
|
|
86
|
+
S$RescriptSchema.literal(null),
|
|
87
|
+
S$RescriptSchema.schema(s => (s.m(S$RescriptSchema.array(S$RescriptSchema.string)))),
|
|
88
|
+
S$RescriptSchema.schema(s => (s.m(S$RescriptSchema.string)))
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
let topicQuerySchema = S$RescriptSchema.array(topicFilterSchema);
|
|
106
92
|
|
|
107
93
|
function makeTopicQuery(topic0Opt, topic1Opt, topic2Opt, topic3Opt) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
94
|
+
let topic0 = topic0Opt !== undefined ? topic0Opt : [];
|
|
95
|
+
let topic1 = topic1Opt !== undefined ? topic1Opt : [];
|
|
96
|
+
let topic2 = topic2Opt !== undefined ? topic2Opt : [];
|
|
97
|
+
let topic3 = topic3Opt !== undefined ? topic3Opt : [];
|
|
98
|
+
let topics = [
|
|
113
99
|
topic0,
|
|
114
100
|
topic1,
|
|
115
101
|
topic2,
|
|
116
102
|
topic3
|
|
117
103
|
];
|
|
118
|
-
|
|
119
|
-
|
|
104
|
+
let isLastTopicEmpty = () => {
|
|
105
|
+
let match = Utils.$$Array.last(topics);
|
|
120
106
|
if (match !== undefined) {
|
|
121
107
|
return match.length === 0;
|
|
122
108
|
} else {
|
|
123
109
|
return false;
|
|
124
110
|
}
|
|
125
111
|
};
|
|
126
|
-
while(isLastTopicEmpty()) {
|
|
112
|
+
while (isLastTopicEmpty()) {
|
|
127
113
|
topics.pop();
|
|
128
114
|
};
|
|
129
|
-
|
|
130
|
-
|
|
115
|
+
let toTopicFilter = topic => {
|
|
116
|
+
let len = topic.length;
|
|
131
117
|
if (len !== 1) {
|
|
132
118
|
if (len !== 0) {
|
|
133
119
|
return topic;
|
|
@@ -135,7 +121,7 @@ function makeTopicQuery(topic0Opt, topic1Opt, topic2Opt, topic3Opt) {
|
|
|
135
121
|
return null;
|
|
136
122
|
}
|
|
137
123
|
}
|
|
138
|
-
|
|
124
|
+
let single = topic[0];
|
|
139
125
|
return single;
|
|
140
126
|
};
|
|
141
127
|
return Belt_Array.map(topics, toTopicFilter);
|
|
@@ -145,36 +131,32 @@ function mapTopicQuery(param) {
|
|
|
145
131
|
return makeTopicQuery(param.topic0, param.topic1, param.topic2, param.topic3);
|
|
146
132
|
}
|
|
147
133
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var route = makeRpcRoute("eth_getLogs", fullParamsSchema, resultSchema);
|
|
176
|
-
|
|
177
|
-
var GetLogs = {
|
|
134
|
+
let paramsSchema = S$RescriptSchema.object(s => ({
|
|
135
|
+
fromBlock: s.f("fromBlock", hexIntSchema),
|
|
136
|
+
toBlock: s.f("toBlock", hexIntSchema),
|
|
137
|
+
address: s.f("address", S$RescriptSchema.option(S$RescriptSchema.array(Address.schema))),
|
|
138
|
+
topics: s.f("topics", topicQuerySchema)
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
let fullParamsSchema = S$RescriptSchema.tuple1(paramsSchema);
|
|
142
|
+
|
|
143
|
+
let logSchema = S$RescriptSchema.object(s => ({
|
|
144
|
+
address: s.f("address", Address.schema),
|
|
145
|
+
topics: s.f("topics", S$RescriptSchema.array(S$RescriptSchema.string)),
|
|
146
|
+
data: s.f("data", S$RescriptSchema.string),
|
|
147
|
+
blockNumber: s.f("blockNumber", hexIntSchema),
|
|
148
|
+
transactionHash: s.f("transactionHash", S$RescriptSchema.string),
|
|
149
|
+
transactionIndex: s.f("transactionIndex", hexIntSchema),
|
|
150
|
+
blockHash: s.f("blockHash", S$RescriptSchema.string),
|
|
151
|
+
logIndex: s.f("logIndex", hexIntSchema),
|
|
152
|
+
removed: s.f("removed", S$RescriptSchema.bool)
|
|
153
|
+
}));
|
|
154
|
+
|
|
155
|
+
let resultSchema = S$RescriptSchema.array(logSchema);
|
|
156
|
+
|
|
157
|
+
let route = makeRpcRoute("eth_getLogs", fullParamsSchema, resultSchema);
|
|
158
|
+
|
|
159
|
+
let GetLogs = {
|
|
178
160
|
topicFilterSchema: topicFilterSchema,
|
|
179
161
|
topicQuerySchema: topicQuerySchema,
|
|
180
162
|
makeTopicQuery: makeTopicQuery,
|
|
@@ -186,45 +168,41 @@ var GetLogs = {
|
|
|
186
168
|
route: route
|
|
187
169
|
};
|
|
188
170
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var rawRoute = makeRpcRoute("eth_getBlockByNumber", paramsSchema$1, S$RescriptSchema.$$null(S$RescriptSchema.json(false)));
|
|
226
|
-
|
|
227
|
-
var GetBlockByNumber = {
|
|
171
|
+
let blockSchema = S$RescriptSchema.object(s => ({
|
|
172
|
+
difficulty: s.f("difficulty", S$RescriptSchema.$$null(hexBigintSchema)),
|
|
173
|
+
extraData: s.f("extraData", S$RescriptSchema.string),
|
|
174
|
+
gasLimit: s.f("gasLimit", hexBigintSchema),
|
|
175
|
+
gasUsed: s.f("gasUsed", hexBigintSchema),
|
|
176
|
+
hash: s.f("hash", S$RescriptSchema.string),
|
|
177
|
+
logsBloom: s.f("logsBloom", S$RescriptSchema.string),
|
|
178
|
+
miner: s.f("miner", Address.schema),
|
|
179
|
+
mixHash: s.f("mixHash", S$RescriptSchema.$$null(S$RescriptSchema.string)),
|
|
180
|
+
nonce: s.f("nonce", S$RescriptSchema.$$null(hexBigintSchema)),
|
|
181
|
+
number: s.f("number", hexIntSchema),
|
|
182
|
+
parentHash: s.f("parentHash", S$RescriptSchema.string),
|
|
183
|
+
receiptsRoot: s.f("receiptsRoot", S$RescriptSchema.string),
|
|
184
|
+
sha3Uncles: s.f("sha3Uncles", S$RescriptSchema.string),
|
|
185
|
+
size: s.f("size", hexBigintSchema),
|
|
186
|
+
stateRoot: s.f("stateRoot", S$RescriptSchema.string),
|
|
187
|
+
timestamp: s.f("timestamp", hexIntSchema),
|
|
188
|
+
totalDifficulty: s.f("totalDifficulty", S$RescriptSchema.$$null(hexBigintSchema)),
|
|
189
|
+
transactions: s.f("transactions", S$RescriptSchema.array(S$RescriptSchema.json(false))),
|
|
190
|
+
transactionsRoot: s.f("transactionsRoot", S$RescriptSchema.string),
|
|
191
|
+
uncles: s.f("uncles", S$RescriptSchema.$$null(S$RescriptSchema.array(S$RescriptSchema.string)))
|
|
192
|
+
}));
|
|
193
|
+
|
|
194
|
+
let paramsSchema$1 = S$RescriptSchema.tuple(s => ({
|
|
195
|
+
blockNumber: s.item(0, hexIntSchema),
|
|
196
|
+
includeTransactions: s.item(1, S$RescriptSchema.bool)
|
|
197
|
+
}));
|
|
198
|
+
|
|
199
|
+
let resultSchema$1 = S$RescriptSchema.$$null(blockSchema);
|
|
200
|
+
|
|
201
|
+
let route$1 = makeRpcRoute("eth_getBlockByNumber", paramsSchema$1, resultSchema$1);
|
|
202
|
+
|
|
203
|
+
let rawRoute = makeRpcRoute("eth_getBlockByNumber", paramsSchema$1, S$RescriptSchema.$$null(S$RescriptSchema.json(false)));
|
|
204
|
+
|
|
205
|
+
let GetBlockByNumber = {
|
|
228
206
|
blockSchema: blockSchema,
|
|
229
207
|
paramsSchema: paramsSchema$1,
|
|
230
208
|
resultSchema: resultSchema$1,
|
|
@@ -232,60 +210,58 @@ var GetBlockByNumber = {
|
|
|
232
210
|
rawRoute: rawRoute
|
|
233
211
|
};
|
|
234
212
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}), hexIntSchema);
|
|
213
|
+
let route$2 = makeRpcRoute("eth_blockNumber", S$RescriptSchema.tuple(param => {}), hexIntSchema);
|
|
238
214
|
|
|
239
|
-
|
|
215
|
+
let GetBlockHeight = {
|
|
240
216
|
route: route$2
|
|
241
217
|
};
|
|
242
218
|
|
|
243
|
-
|
|
219
|
+
let rawRoute$1 = makeRpcRoute("eth_getTransactionByHash", S$RescriptSchema.tuple1(S$RescriptSchema.string), S$RescriptSchema.$$null(S$RescriptSchema.json(false)));
|
|
244
220
|
|
|
245
|
-
|
|
221
|
+
let GetTransactionByHash = {
|
|
246
222
|
rawRoute: rawRoute$1
|
|
247
223
|
};
|
|
248
224
|
|
|
249
|
-
|
|
225
|
+
let rawRoute$2 = makeRpcRoute("eth_getTransactionReceipt", S$RescriptSchema.tuple1(S$RescriptSchema.string), S$RescriptSchema.$$null(S$RescriptSchema.json(false)));
|
|
250
226
|
|
|
251
|
-
|
|
227
|
+
let GetTransactionReceipt = {
|
|
252
228
|
rawRoute: rawRoute$2
|
|
253
229
|
};
|
|
254
230
|
|
|
255
231
|
async function getLogs(client, param) {
|
|
256
|
-
return await Rest
|
|
232
|
+
return await Rest.fetch(route, param, client);
|
|
257
233
|
}
|
|
258
234
|
|
|
259
235
|
async function getBlock(client, blockNumber) {
|
|
260
|
-
return await Rest
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
236
|
+
return await Rest.fetch(route$1, {
|
|
237
|
+
blockNumber: blockNumber,
|
|
238
|
+
includeTransactions: false
|
|
239
|
+
}, client);
|
|
264
240
|
}
|
|
265
241
|
|
|
266
242
|
async function getRawBlock(client, blockNumber) {
|
|
267
|
-
return await Rest
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
243
|
+
return await Rest.fetch(rawRoute, {
|
|
244
|
+
blockNumber: blockNumber,
|
|
245
|
+
includeTransactions: false
|
|
246
|
+
}, client);
|
|
271
247
|
}
|
|
272
248
|
|
|
273
249
|
export {
|
|
274
|
-
JsonRpcError
|
|
275
|
-
makeRpcRoute
|
|
276
|
-
jsonRpcFetcher
|
|
277
|
-
makeClient
|
|
278
|
-
makeHexSchema
|
|
279
|
-
hexBigintSchema
|
|
280
|
-
hexIntSchema
|
|
281
|
-
decimalFloatSchema
|
|
282
|
-
GetLogs
|
|
283
|
-
GetBlockByNumber
|
|
284
|
-
GetBlockHeight
|
|
285
|
-
GetTransactionByHash
|
|
286
|
-
GetTransactionReceipt
|
|
287
|
-
getLogs
|
|
288
|
-
getBlock
|
|
289
|
-
getRawBlock
|
|
250
|
+
JsonRpcError,
|
|
251
|
+
makeRpcRoute,
|
|
252
|
+
jsonRpcFetcher,
|
|
253
|
+
makeClient,
|
|
254
|
+
makeHexSchema,
|
|
255
|
+
hexBigintSchema,
|
|
256
|
+
hexIntSchema,
|
|
257
|
+
decimalFloatSchema,
|
|
258
|
+
GetLogs,
|
|
259
|
+
GetBlockByNumber,
|
|
260
|
+
GetBlockHeight,
|
|
261
|
+
GetTransactionByHash,
|
|
262
|
+
GetTransactionReceipt,
|
|
263
|
+
getLogs,
|
|
264
|
+
getBlock,
|
|
265
|
+
getRawBlock,
|
|
290
266
|
}
|
|
291
267
|
/* hexBigintSchema Not a pure module */
|