@typeberry/convert 0.9.0-3f2c45b → 0.9.0-4a9f363
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 +36 -7
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5033,6 +5033,7 @@ function isResult(x) {
|
|
|
5033
5033
|
|
|
5034
5034
|
|
|
5035
5035
|
|
|
5036
|
+
|
|
5036
5037
|
// EXTERNAL MODULE: ./node_modules/minimist/index.js
|
|
5037
5038
|
var minimist = __nccwpck_require__(595);
|
|
5038
5039
|
var minimist_default = /*#__PURE__*/__nccwpck_require__.n(minimist);
|
|
@@ -8831,9 +8832,11 @@ class SortedArray {
|
|
|
8831
8832
|
removeOne(v) {
|
|
8832
8833
|
const findIdx = this.binarySearch(v);
|
|
8833
8834
|
if (findIdx.isEqual) {
|
|
8834
|
-
// remove the element
|
|
8835
|
-
this.array.splice(findIdx.idx, 1);
|
|
8835
|
+
// remove the element and return the stored one
|
|
8836
|
+
const [removed] = this.array.splice(findIdx.idx, 1);
|
|
8837
|
+
return removed;
|
|
8836
8838
|
}
|
|
8839
|
+
return undefined;
|
|
8837
8840
|
}
|
|
8838
8841
|
has(v) {
|
|
8839
8842
|
return this.binarySearch(v).isEqual;
|
|
@@ -8988,8 +8991,12 @@ class SortedSet extends SortedArray {
|
|
|
8988
8991
|
*/
|
|
8989
8992
|
replace(v) {
|
|
8990
8993
|
const findIdx = this.binarySearch(v);
|
|
8991
|
-
|
|
8992
|
-
|
|
8994
|
+
if (findIdx.isEqual) {
|
|
8995
|
+
const [displaced] = this.array.splice(findIdx.idx, 1, v);
|
|
8996
|
+
return displaced;
|
|
8997
|
+
}
|
|
8998
|
+
this.array.splice(findIdx.idx, 0, v);
|
|
8999
|
+
return undefined;
|
|
8993
9000
|
}
|
|
8994
9001
|
/** Create a new SortedSet from two sorted collections. */
|
|
8995
9002
|
static fromTwoSortedCollections(first, second) {
|
|
@@ -11520,6 +11527,13 @@ var KnownChainSpec;
|
|
|
11520
11527
|
/** Full chain spec. */
|
|
11521
11528
|
KnownChainSpec["Full"] = "full";
|
|
11522
11529
|
})(KnownChainSpec || (KnownChainSpec = {}));
|
|
11530
|
+
/** Persistent regular-node database backend. */
|
|
11531
|
+
var RegularStateBackend;
|
|
11532
|
+
(function (RegularStateBackend) {
|
|
11533
|
+
/** @deprecated lmdb remains available as an explicit fallback, but fjall is the default backend. */
|
|
11534
|
+
RegularStateBackend["Lmdb"] = "lmdb";
|
|
11535
|
+
RegularStateBackend["Fjall"] = "fjall";
|
|
11536
|
+
})(RegularStateBackend || (RegularStateBackend = {}));
|
|
11523
11537
|
const knownChainSpecFromJson = json.fromString((input, ctx) => {
|
|
11524
11538
|
switch (input) {
|
|
11525
11539
|
case KnownChainSpec.Tiny:
|
|
@@ -11530,12 +11544,23 @@ const knownChainSpecFromJson = json.fromString((input, ctx) => {
|
|
|
11530
11544
|
throw Error(`unknown network flavor: ${input} at ${ctx}`);
|
|
11531
11545
|
}
|
|
11532
11546
|
});
|
|
11547
|
+
const regularStateBackendFromJson = json.fromString((input, ctx) => {
|
|
11548
|
+
switch (input) {
|
|
11549
|
+
case RegularStateBackend.Lmdb:
|
|
11550
|
+
return RegularStateBackend.Lmdb;
|
|
11551
|
+
case RegularStateBackend.Fjall:
|
|
11552
|
+
return RegularStateBackend.Fjall;
|
|
11553
|
+
default:
|
|
11554
|
+
throw Error(`unknown state backend: ${input} at ${ctx}`);
|
|
11555
|
+
}
|
|
11556
|
+
});
|
|
11533
11557
|
class NodeConfiguration {
|
|
11534
11558
|
$schema;
|
|
11535
11559
|
version;
|
|
11536
11560
|
flavor;
|
|
11537
11561
|
chainSpec;
|
|
11538
11562
|
databaseBasePath;
|
|
11563
|
+
stateBackend;
|
|
11539
11564
|
authorship;
|
|
11540
11565
|
static fromJson = json.object({
|
|
11541
11566
|
$schema: "string",
|
|
@@ -11543,22 +11568,26 @@ class NodeConfiguration {
|
|
|
11543
11568
|
flavor: knownChainSpecFromJson,
|
|
11544
11569
|
chain_spec: JipChainSpec.fromJson,
|
|
11545
11570
|
database_base_path: json.optional("string"),
|
|
11571
|
+
state_backend: json.optional(regularStateBackendFromJson),
|
|
11546
11572
|
authorship: AuthorshipOptions.fromJson,
|
|
11547
11573
|
}, NodeConfiguration.new);
|
|
11548
|
-
static new({ $schema, version, flavor, chain_spec, database_base_path, authorship }) {
|
|
11574
|
+
static new({ $schema, version, flavor, chain_spec, database_base_path, state_backend, authorship, }) {
|
|
11549
11575
|
if (version !== 1) {
|
|
11550
11576
|
throw new Error("Only version=1 config is supported.");
|
|
11551
11577
|
}
|
|
11552
|
-
return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined, authorship);
|
|
11578
|
+
return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined, state_backend ?? RegularStateBackend.Fjall, authorship);
|
|
11553
11579
|
}
|
|
11554
11580
|
constructor($schema, version, flavor, chainSpec,
|
|
11555
11581
|
/** If database path is not provided, we load an in-memory db. */
|
|
11556
|
-
databaseBasePath,
|
|
11582
|
+
databaseBasePath,
|
|
11583
|
+
/** Persistent database backend used when `databaseBasePath` is set. */
|
|
11584
|
+
stateBackend, authorship) {
|
|
11557
11585
|
this.$schema = $schema;
|
|
11558
11586
|
this.version = version;
|
|
11559
11587
|
this.flavor = flavor;
|
|
11560
11588
|
this.chainSpec = chainSpec;
|
|
11561
11589
|
this.databaseBasePath = databaseBasePath;
|
|
11590
|
+
this.stateBackend = stateBackend;
|
|
11562
11591
|
this.authorship = authorship;
|
|
11563
11592
|
}
|
|
11564
11593
|
}
|