@typeberry/convert 0.11.0-6310ba4 → 0.11.0-9d838d3
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.js +4 -26
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -11546,13 +11546,6 @@ var KnownChainSpec;
|
|
|
11546
11546
|
/** Full chain spec. */
|
|
11547
11547
|
KnownChainSpec["Full"] = "full";
|
|
11548
11548
|
})(KnownChainSpec || (KnownChainSpec = {}));
|
|
11549
|
-
/** Persistent regular-node database backend. */
|
|
11550
|
-
var RegularStateBackend;
|
|
11551
|
-
(function (RegularStateBackend) {
|
|
11552
|
-
/** @deprecated lmdb remains available as an explicit fallback, but fjall is the default backend. */
|
|
11553
|
-
RegularStateBackend["Lmdb"] = "lmdb";
|
|
11554
|
-
RegularStateBackend["Fjall"] = "fjall";
|
|
11555
|
-
})(RegularStateBackend || (RegularStateBackend = {}));
|
|
11556
11549
|
const knownChainSpecFromJson = json.fromString((input, ctx) => {
|
|
11557
11550
|
switch (input) {
|
|
11558
11551
|
case KnownChainSpec.Tiny:
|
|
@@ -11563,23 +11556,12 @@ const knownChainSpecFromJson = json.fromString((input, ctx) => {
|
|
|
11563
11556
|
throw Error(`unknown network flavor: ${input} at ${ctx}`);
|
|
11564
11557
|
}
|
|
11565
11558
|
});
|
|
11566
|
-
const regularStateBackendFromJson = json.fromString((input, ctx) => {
|
|
11567
|
-
switch (input) {
|
|
11568
|
-
case RegularStateBackend.Lmdb:
|
|
11569
|
-
return RegularStateBackend.Lmdb;
|
|
11570
|
-
case RegularStateBackend.Fjall:
|
|
11571
|
-
return RegularStateBackend.Fjall;
|
|
11572
|
-
default:
|
|
11573
|
-
throw Error(`unknown state backend: ${input} at ${ctx}`);
|
|
11574
|
-
}
|
|
11575
|
-
});
|
|
11576
11559
|
class NodeConfiguration {
|
|
11577
11560
|
$schema;
|
|
11578
11561
|
version;
|
|
11579
11562
|
flavor;
|
|
11580
11563
|
chainSpec;
|
|
11581
11564
|
databaseBasePath;
|
|
11582
|
-
stateBackend;
|
|
11583
11565
|
authorship;
|
|
11584
11566
|
rpc;
|
|
11585
11567
|
static fromJson = json.object({
|
|
@@ -11588,21 +11570,18 @@ class NodeConfiguration {
|
|
|
11588
11570
|
flavor: knownChainSpecFromJson,
|
|
11589
11571
|
chain_spec: JipChainSpec.fromJson,
|
|
11590
11572
|
database_base_path: json.optional("string"),
|
|
11591
|
-
state_backend: json.optional(regularStateBackendFromJson),
|
|
11592
11573
|
authorship: AuthorshipOptions.fromJson,
|
|
11593
11574
|
rpc: json.optional(RpcOptions.fromJson),
|
|
11594
11575
|
}, NodeConfiguration.new);
|
|
11595
|
-
static new({ $schema, version, flavor, chain_spec, database_base_path,
|
|
11576
|
+
static new({ $schema, version, flavor, chain_spec, database_base_path, authorship, rpc }) {
|
|
11596
11577
|
if (version !== 1) {
|
|
11597
11578
|
throw new Error("Only version=1 config is supported.");
|
|
11598
11579
|
}
|
|
11599
|
-
return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined,
|
|
11580
|
+
return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined, authorship, rpc ?? undefined);
|
|
11600
11581
|
}
|
|
11601
11582
|
constructor($schema, version, flavor, chainSpec,
|
|
11602
11583
|
/** If database path is not provided, we load an in-memory db. */
|
|
11603
|
-
databaseBasePath,
|
|
11604
|
-
/** Persistent database backend used when `databaseBasePath` is set. */
|
|
11605
|
-
stateBackend, authorship,
|
|
11584
|
+
databaseBasePath, authorship,
|
|
11606
11585
|
/** Optional RPC server configuration. When present, an in-process RPC server is started. */
|
|
11607
11586
|
rpc) {
|
|
11608
11587
|
this.$schema = $schema;
|
|
@@ -11610,7 +11589,6 @@ class NodeConfiguration {
|
|
|
11610
11589
|
this.flavor = flavor;
|
|
11611
11590
|
this.chainSpec = chainSpec;
|
|
11612
11591
|
this.databaseBasePath = databaseBasePath;
|
|
11613
|
-
this.stateBackend = stateBackend;
|
|
11614
11592
|
this.authorship = authorship;
|
|
11615
11593
|
this.rpc = rpc;
|
|
11616
11594
|
}
|
|
@@ -16168,7 +16146,7 @@ function loadState(spec, blake2b, entries) {
|
|
|
16168
16146
|
* (incomplete in-memory view).
|
|
16169
16147
|
* - `SerializedState<LeafDb>`: Disk-backed trie storage-leaf nodes live on
|
|
16170
16148
|
* disk and load on demand; cheap to update (no data duplication) and re-compute
|
|
16171
|
-
* the `stateRoot`.
|
|
16149
|
+
* the `stateRoot`.
|
|
16172
16150
|
* - `SerializedState<StateEntries>`: serialized state represented as a simple in-memory
|
|
16173
16151
|
* hashmap of `key -> value` entries.
|
|
16174
16152
|
*/
|