envio 3.5.1-svm-alpha.1 → 3.6.0
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 +7 -0
- package/fuel.schema.json +7 -0
- package/index.d.ts +33 -10
- package/package.json +6 -6
- package/src/ChainState.res +12 -0
- package/src/ChainState.res.mjs +15 -2
- package/src/ChainState.resi +3 -0
- package/src/Config.res +60 -2
- package/src/Config.res.mjs +49 -13
- package/src/EffectState.res +2 -2
- package/src/EffectState.res.mjs +2 -2
- package/src/EntityTables.res +32 -0
- package/src/EntityTables.res.mjs +44 -0
- package/src/Envio.res +7 -7
- package/src/Envio.res.mjs +5 -6
- package/src/Hasura.res +37 -3
- package/src/Hasura.res.mjs +23 -5
- package/src/InMemoryStore.res +48 -8
- package/src/InMemoryStore.res.mjs +37 -7
- package/src/IndexerState.res +30 -24
- package/src/IndexerState.res.mjs +20 -35
- package/src/IndexerState.resi +8 -6
- package/src/Internal.res +29 -11
- package/src/Internal.res.mjs +27 -10
- package/src/LoadLayer.res +39 -8
- package/src/LoadLayer.res.mjs +36 -9
- package/src/LoadLayer.resi +2 -0
- package/src/Persistence.res +12 -1
- package/src/PgStorage.res +183 -37
- package/src/PgStorage.res.mjs +149 -34
- package/src/PruneStaleHistory.res +1 -0
- package/src/PruneStaleHistory.res.mjs +2 -1
- package/src/Sink.res +3 -3
- package/src/Sink.res.mjs +2 -2
- package/src/TestIndexer.res +128 -17
- package/src/TestIndexer.res.mjs +75 -9
- package/src/UserContext.res +19 -4
- package/src/UserContext.res.mjs +15 -9
- package/src/Writing.res +8 -16
- package/src/Writing.res.mjs +10 -10
- package/src/bindings/ClickHouse.res +40 -4
- package/src/bindings/ClickHouse.res.mjs +37 -5
- package/src/db/EntityHistory.res +64 -21
- package/src/db/EntityHistory.res.mjs +43 -22
- package/src/db/InternalTable.res.mjs +31 -31
- package/src/db/Table.res +24 -1
- package/src/db/Table.res.mjs +26 -4
- package/src/sources/SvmHyperSyncClient.res +7 -8
- package/svm.schema.json +11 -10
package/src/db/Table.res.mjs
CHANGED
|
@@ -16,11 +16,12 @@ function makeEnumConfig(name, variants) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function mkField(fieldName, fieldType, fieldSchema, $$default, isArrayOpt, isNullableOpt, isPrimaryKeyOpt, isIndexOpt, linkedEntity, description, postgresDbName, clickhouseDbName) {
|
|
19
|
+
function mkField(fieldName, fieldType, fieldSchema, $$default, isArrayOpt, isNullableOpt, isPrimaryKeyOpt, isIndexOpt, isChainIdOpt, linkedEntity, description, postgresDbName, clickhouseDbName) {
|
|
20
20
|
let isArray = isArrayOpt !== undefined ? isArrayOpt : false;
|
|
21
21
|
let isNullable = isNullableOpt !== undefined ? isNullableOpt : false;
|
|
22
22
|
let isPrimaryKey = isPrimaryKeyOpt !== undefined ? isPrimaryKeyOpt : false;
|
|
23
23
|
let isIndex = isIndexOpt !== undefined ? isIndexOpt : false;
|
|
24
|
+
let isChainId = isChainIdOpt !== undefined ? isChainIdOpt : false;
|
|
24
25
|
return {
|
|
25
26
|
TAG: "Field",
|
|
26
27
|
_0: {
|
|
@@ -31,6 +32,7 @@ function mkField(fieldName, fieldType, fieldSchema, $$default, isArrayOpt, isNul
|
|
|
31
32
|
isNullable: isNullable,
|
|
32
33
|
isPrimaryKey: isPrimaryKey,
|
|
33
34
|
isIndex: isIndex,
|
|
35
|
+
isChainId: isChainId,
|
|
34
36
|
linkedEntity: linkedEntity,
|
|
35
37
|
defaultValue: $$default,
|
|
36
38
|
description: description,
|
|
@@ -225,6 +227,18 @@ function getDerivedFromFields(table) {
|
|
|
225
227
|
});
|
|
226
228
|
}
|
|
227
229
|
|
|
230
|
+
function getChainIdField(table) {
|
|
231
|
+
return Stdlib_Array.findMap(table.fields, field => {
|
|
232
|
+
if (field.TAG !== "Field") {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
let field$1 = field._0;
|
|
236
|
+
if (field$1.isChainId) {
|
|
237
|
+
return field$1;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
228
242
|
function getFieldByName(table, fieldName) {
|
|
229
243
|
return table.fields.find(field => getUserDefinedFieldName(field) === fieldName);
|
|
230
244
|
}
|
|
@@ -288,7 +302,8 @@ let queryFields = Utils.$$WeakMap.memoize(table => {
|
|
|
288
302
|
return dict;
|
|
289
303
|
});
|
|
290
304
|
|
|
291
|
-
function makeRowsSchema(table, rowFieldName) {
|
|
305
|
+
function makeRowsSchema(table, rowFieldName, skipChainIdOpt) {
|
|
306
|
+
let skipChainId = skipChainIdOpt !== undefined ? skipChainIdOpt : false;
|
|
292
307
|
return S$RescriptSchema.array(S$RescriptSchema.object(s => {
|
|
293
308
|
let dict = {};
|
|
294
309
|
table.fields.forEach(field => {
|
|
@@ -296,15 +311,20 @@ function makeRowsSchema(table, rowFieldName) {
|
|
|
296
311
|
return;
|
|
297
312
|
}
|
|
298
313
|
let field$1 = field._0;
|
|
314
|
+
if (field$1.isChainId && skipChainId) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
299
317
|
dict[getApiFieldName(field$1)] = s.f(rowFieldName(field$1), field$1.fieldSchema);
|
|
300
318
|
});
|
|
301
319
|
return dict;
|
|
302
320
|
}));
|
|
303
321
|
}
|
|
304
322
|
|
|
305
|
-
let rowsSchema = Utils.$$WeakMap.memoize(table => makeRowsSchema(table, getApiFieldName));
|
|
323
|
+
let rowsSchema = Utils.$$WeakMap.memoize(table => makeRowsSchema(table, getApiFieldName, undefined));
|
|
324
|
+
|
|
325
|
+
let pgRowsSchema = Utils.$$WeakMap.memoize(table => makeRowsSchema(table, getPgDbFieldName, undefined));
|
|
306
326
|
|
|
307
|
-
let
|
|
327
|
+
let pgEntityRowsSchema = Utils.$$WeakMap.memoize(table => makeRowsSchema(table, getPgDbFieldName, true));
|
|
308
328
|
|
|
309
329
|
let NonExistingTableField = /* @__PURE__ */Primitive_exceptions.create("Table.NonExistingTableField");
|
|
310
330
|
|
|
@@ -465,6 +485,7 @@ export {
|
|
|
465
485
|
getNonDefaultFields,
|
|
466
486
|
getLinkedEntityFields,
|
|
467
487
|
getDerivedFromFields,
|
|
488
|
+
getChainIdField,
|
|
468
489
|
getFieldByName,
|
|
469
490
|
NoIdField,
|
|
470
491
|
getIdFieldOrThrow,
|
|
@@ -477,6 +498,7 @@ export {
|
|
|
477
498
|
makeRowsSchema,
|
|
478
499
|
rowsSchema,
|
|
479
500
|
pgRowsSchema,
|
|
501
|
+
pgEntityRowsSchema,
|
|
480
502
|
NonExistingTableField,
|
|
481
503
|
getUnfilteredCompositeIndexesUnsafe,
|
|
482
504
|
toSqlParams,
|
|
@@ -110,13 +110,13 @@ module QueryTypes = {
|
|
|
110
110
|
|
|
111
111
|
type fieldSelection = {block?: array<blockField>, transaction?: array<transactionField>}
|
|
112
112
|
|
|
113
|
-
/** Filter for selecting
|
|
114
|
-
|
|
113
|
+
/** Filter for selecting instructions. All non-empty fields are AND-ed: an
|
|
114
|
+
instruction must match at least one value in every non-empty field.
|
|
115
115
|
|
|
116
116
|
Discriminator filters (d1..d8) take hex-encoded byte prefixes ("0x" optional).
|
|
117
117
|
Account filters (a0..a9) take base58 pubkey strings. */
|
|
118
118
|
type instructionSelection = {
|
|
119
|
-
|
|
119
|
+
programId?: array<string>,
|
|
120
120
|
d1?: array<string>,
|
|
121
121
|
d2?: array<string>,
|
|
122
122
|
d4?: array<string>,
|
|
@@ -129,7 +129,7 @@ module QueryTypes = {
|
|
|
129
129
|
type query = {
|
|
130
130
|
fromSlot: int,
|
|
131
131
|
toSlot?: int,
|
|
132
|
-
|
|
132
|
+
instructions?: array<instructionSelection>,
|
|
133
133
|
includeAllBlocks?: bool,
|
|
134
134
|
fields?: fieldSelection,
|
|
135
135
|
maxNumBlocks?: int,
|
|
@@ -159,16 +159,15 @@ module ResponseTypes = {
|
|
|
159
159
|
slot: int,
|
|
160
160
|
transactionIndex: int,
|
|
161
161
|
instructionAddress: array<int>,
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
programId: string,
|
|
163
|
+
accounts: array<string>,
|
|
164
164
|
data: string,
|
|
165
165
|
d1?: string,
|
|
166
166
|
d2?: string,
|
|
167
167
|
d4?: string,
|
|
168
168
|
d8?: string,
|
|
169
169
|
isInner: bool,
|
|
170
|
-
|
|
171
|
-
txSuccess: bool,
|
|
170
|
+
isCommitted: bool,
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
type queryResponseData = {
|
package/svm.schema.json
CHANGED
|
@@ -49,6 +49,13 @@
|
|
|
49
49
|
}
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
|
+
"disable_default_cross_chain": {
|
|
53
|
+
"description": "Make entities and effect caches per-chain instead of shared across every chain (recommended). Sharing then becomes explicit — add `@crossChain` to an entity in schema.graphql or `crossChain: true` to an effect. (default: false)",
|
|
54
|
+
"type": [
|
|
55
|
+
"boolean",
|
|
56
|
+
"null"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
52
59
|
"ecosystem": {
|
|
53
60
|
"description": "Ecosystem of the project.",
|
|
54
61
|
"$ref": "#/$defs/EcosystemTag"
|
|
@@ -264,15 +271,8 @@
|
|
|
264
271
|
"type": "object",
|
|
265
272
|
"properties": {
|
|
266
273
|
"hypersync_config": {
|
|
267
|
-
"description": "HyperSync Config for fetching historical instructions on this chain.
|
|
268
|
-
"
|
|
269
|
-
{
|
|
270
|
-
"$ref": "#/$defs/HypersyncConfig"
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
"type": "null"
|
|
274
|
-
}
|
|
275
|
-
]
|
|
274
|
+
"description": "HyperSync Config for fetching historical instructions on this chain.",
|
|
275
|
+
"$ref": "#/$defs/HypersyncConfig"
|
|
276
276
|
},
|
|
277
277
|
"programs": {
|
|
278
278
|
"description": "Solana programs to index on this chain.",
|
|
@@ -284,6 +284,7 @@
|
|
|
284
284
|
},
|
|
285
285
|
"additionalProperties": false,
|
|
286
286
|
"required": [
|
|
287
|
+
"hypersync_config",
|
|
287
288
|
"programs"
|
|
288
289
|
]
|
|
289
290
|
},
|
|
@@ -291,7 +292,7 @@
|
|
|
291
292
|
"type": "object",
|
|
292
293
|
"properties": {
|
|
293
294
|
"url": {
|
|
294
|
-
"description": "URL of the HyperSync endpoint
|
|
295
|
+
"description": "URL of the HyperSync endpoint (default: the public Solana HyperSync endpoint at https://solana.hypersync.xyz)",
|
|
295
296
|
"type": "string"
|
|
296
297
|
}
|
|
297
298
|
},
|