envio 3.3.0-alpha.7 → 3.3.0-alpha.8
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/index.d.ts +23 -5
- package/package.json +6 -6
- package/src/Api.res +1 -1
- package/src/Api.res.mjs +1 -1
- package/src/ChainFetching.res +21 -10
- package/src/ChainFetching.res.mjs +11 -10
- package/src/ChainState.res +328 -165
- package/src/ChainState.res.mjs +205 -100
- package/src/ChainState.resi +16 -7
- package/src/Config.res +11 -27
- package/src/Config.res.mjs +8 -7
- package/src/Core.res +7 -0
- package/src/CrossChainState.res +53 -80
- package/src/CrossChainState.res.mjs +43 -59
- package/src/CrossChainState.resi +1 -1
- package/src/Ecosystem.res +3 -3
- package/src/Ecosystem.res.mjs +3 -3
- package/src/Envio.res +14 -9
- package/src/EventConfigBuilder.res +105 -56
- package/src/EventConfigBuilder.res.mjs +69 -33
- package/src/EventProcessing.res +19 -15
- package/src/EventProcessing.res.mjs +13 -12
- package/src/FetchState.res +375 -171
- package/src/FetchState.res.mjs +249 -251
- package/src/HandlerLoader.res +7 -112
- package/src/HandlerLoader.res.mjs +1 -87
- package/src/HandlerRegister.res +209 -6
- package/src/HandlerRegister.res.mjs +90 -5
- package/src/HandlerRegister.resi +13 -2
- package/src/IndexerState.res +6 -3
- package/src/IndexerState.res.mjs +3 -3
- package/src/IndexerState.resi +1 -1
- package/src/IndexingAddresses.res +10 -7
- package/src/IndexingAddresses.res.mjs +8 -7
- package/src/IndexingAddresses.resi +3 -1
- package/src/Internal.res +82 -36
- package/src/Internal.res.mjs +11 -1
- package/src/Main.res +22 -23
- package/src/Main.res.mjs +15 -17
- package/src/Metrics.res +43 -2
- package/src/Metrics.res.mjs +39 -3
- package/src/Prometheus.res +0 -35
- package/src/Prometheus.res.mjs +33 -68
- package/src/RawEvent.res +7 -2
- package/src/RawEvent.res.mjs +4 -4
- package/src/SimulateItems.res +20 -7
- package/src/SimulateItems.res.mjs +7 -11
- package/src/TestIndexer.res +1 -1
- package/src/TestIndexer.res.mjs +1 -1
- package/src/sources/BlockStore.res +46 -0
- package/src/sources/BlockStore.res.mjs +24 -0
- package/src/sources/EventRouter.res +19 -12
- package/src/sources/EventRouter.res.mjs +7 -5
- package/src/sources/Evm.res +54 -4
- package/src/sources/Evm.res.mjs +43 -4
- package/src/sources/EvmChain.res +14 -18
- package/src/sources/EvmChain.res.mjs +12 -13
- package/src/sources/FieldMask.res +39 -0
- package/src/sources/FieldMask.res.mjs +42 -0
- package/src/sources/Fuel.res +5 -2
- package/src/sources/Fuel.res.mjs +4 -3
- package/src/sources/HyperFuelSource.res +31 -40
- package/src/sources/HyperFuelSource.res.mjs +52 -44
- package/src/sources/HyperSync.res +31 -9
- package/src/sources/HyperSync.res.mjs +47 -31
- package/src/sources/HyperSync.resi +10 -3
- package/src/sources/HyperSyncClient.res +15 -4
- package/src/sources/HyperSyncHeightStream.res +1 -8
- package/src/sources/HyperSyncHeightStream.res.mjs +0 -2
- package/src/sources/HyperSyncSource.res +37 -58
- package/src/sources/HyperSyncSource.res.mjs +42 -42
- package/src/sources/RpcSource.res +91 -82
- package/src/sources/RpcSource.res.mjs +76 -45
- package/src/sources/RpcWebSocketHeightStream.res +0 -5
- package/src/sources/RpcWebSocketHeightStream.res.mjs +0 -2
- package/src/sources/SimulateSource.res +5 -3
- package/src/sources/SimulateSource.res.mjs +12 -4
- package/src/sources/Source.res +19 -5
- package/src/sources/SourceManager.res +62 -6
- package/src/sources/SourceManager.res.mjs +55 -8
- package/src/sources/SourceManager.resi +10 -0
- package/src/sources/Svm.res +14 -10
- package/src/sources/Svm.res.mjs +23 -6
- package/src/sources/SvmHyperSyncClient.res +5 -6
- package/src/sources/SvmHyperSyncSource.res +82 -41
- package/src/sources/SvmHyperSyncSource.res.mjs +86 -41
- package/src/sources/TransactionStore.res +6 -107
- package/src/sources/TransactionStore.res.mjs +5 -86
- package/svm.schema.json +19 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Core from "../Core.res.mjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as FieldMask from "./FieldMask.res.mjs";
|
|
5
5
|
|
|
6
6
|
function make(ecosystem, shouldChecksum) {
|
|
7
7
|
let ctor = Core.getAddon().TransactionStore;
|
|
@@ -15,97 +15,16 @@ function make(ecosystem, shouldChecksum) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
let codes = {};
|
|
20
|
-
fields.forEach((name, i) => {
|
|
21
|
-
codes[name] = i;
|
|
22
|
-
});
|
|
23
|
-
return codes;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let pow2 = (c => Math.pow(2, c));
|
|
27
|
-
|
|
28
|
-
function maskFromFields(selectedTransactionFields, codes) {
|
|
29
|
-
let mask = {
|
|
30
|
-
contents: 0
|
|
31
|
-
};
|
|
32
|
-
selectedTransactionFields.forEach(name => {
|
|
33
|
-
let code = codes[name];
|
|
34
|
-
if (code !== undefined) {
|
|
35
|
-
mask.contents = mask.contents + pow2(code);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return mask.contents;
|
|
40
|
-
}
|
|
18
|
+
let makeMaskFn = FieldMask.makeMaskFn;
|
|
41
19
|
|
|
42
|
-
|
|
43
|
-
let codes = fieldCodes(fields);
|
|
44
|
-
return selectedTransactionFields => maskFromFields(selectedTransactionFields, codes);
|
|
45
|
-
}
|
|
20
|
+
let orMask = FieldMask.orMask;
|
|
46
21
|
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
async function materializeItems(store, items) {
|
|
50
|
-
let blockNumbers = [];
|
|
51
|
-
let transactionIndices = [];
|
|
52
|
-
let masks = [];
|
|
53
|
-
let payloadGroups = [];
|
|
54
|
-
let anySelected = {
|
|
55
|
-
contents: false
|
|
56
|
-
};
|
|
57
|
-
items.forEach(item => {
|
|
58
|
-
if (item.kind !== 0) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
let match = item.payload.transaction;
|
|
62
|
-
if (!(match == null)) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
let transactionIndex = item.transactionIndex;
|
|
66
|
-
let blockNumber = item.blockNumber;
|
|
67
|
-
let mask = item.eventConfig.transactionFieldMask;
|
|
68
|
-
if (mask !== 0) {
|
|
69
|
-
anySelected.contents = true;
|
|
70
|
-
}
|
|
71
|
-
let last = payloadGroups.length - 1 | 0;
|
|
72
|
-
if (last >= 0 && blockNumbers[last] === blockNumber && transactionIndices[last] === transactionIndex) {
|
|
73
|
-
payloadGroups[last].push(item.payload);
|
|
74
|
-
masks[last] = orMask(masks[last], mask);
|
|
75
|
-
} else {
|
|
76
|
-
blockNumbers.push(blockNumber);
|
|
77
|
-
transactionIndices.push(transactionIndex);
|
|
78
|
-
masks.push(mask);
|
|
79
|
-
payloadGroups.push([item.payload]);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
if (!Utils.$$Array.notEmpty(payloadGroups)) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (anySelected.contents) {
|
|
86
|
-
let txs = await store.materialize(blockNumbers, transactionIndices, masks);
|
|
87
|
-
payloadGroups.forEach((payloads, i) => {
|
|
88
|
-
let tx = txs[i];
|
|
89
|
-
payloads.forEach(payload => {
|
|
90
|
-
payload.transaction = tx;
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
payloadGroups.forEach(payloads => {
|
|
96
|
-
payloads.forEach(payload => {
|
|
97
|
-
payload.transaction = {};
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
22
|
+
let fieldCodes = FieldMask.fieldCodes;
|
|
101
23
|
|
|
102
24
|
export {
|
|
103
25
|
make,
|
|
104
|
-
fieldCodes,
|
|
105
|
-
pow2,
|
|
106
|
-
maskFromFields,
|
|
107
26
|
makeMaskFn,
|
|
108
27
|
orMask,
|
|
109
|
-
|
|
28
|
+
fieldCodes,
|
|
110
29
|
}
|
|
111
30
|
/* Core Not a pure module */
|
package/svm.schema.json
CHANGED
|
@@ -472,6 +472,16 @@
|
|
|
472
472
|
"$ref": "#/$defs/SvmTransactionField"
|
|
473
473
|
}
|
|
474
474
|
},
|
|
475
|
+
"block_fields": {
|
|
476
|
+
"description": "Block fields to include on each matched instruction's `block`, as a list of field names. `slot`/`time`/`hash` are always included; this adds `height`/`parentSlot`/`parentHash`.",
|
|
477
|
+
"type": [
|
|
478
|
+
"array",
|
|
479
|
+
"null"
|
|
480
|
+
],
|
|
481
|
+
"items": {
|
|
482
|
+
"$ref": "#/$defs/SvmBlockField"
|
|
483
|
+
}
|
|
484
|
+
},
|
|
475
485
|
"log_fields": {
|
|
476
486
|
"description": "Set to `true` to include program logs scoped to each matched instruction.",
|
|
477
487
|
"type": [
|
|
@@ -505,6 +515,15 @@
|
|
|
505
515
|
"version"
|
|
506
516
|
]
|
|
507
517
|
},
|
|
518
|
+
"SvmBlockField": {
|
|
519
|
+
"description": "Selectable block field names (camelCase), matching the public\n`instruction.block` shape. `slot`/`time`/`hash` are always included,\nso everything here is opt-in on top of that trio.",
|
|
520
|
+
"type": "string",
|
|
521
|
+
"enum": [
|
|
522
|
+
"height",
|
|
523
|
+
"parentSlot",
|
|
524
|
+
"parentHash"
|
|
525
|
+
]
|
|
526
|
+
},
|
|
508
527
|
"ArgDef": {
|
|
509
528
|
"description": "One named argument of an instruction. Mirrors\n`hypersync_client_solana::decode::NamedField`.",
|
|
510
529
|
"type": "object",
|