@polkadot/types-codec 10.0.1 → 10.1.2

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.
Files changed (171) hide show
  1. package/abstract/Array.d.ts +1 -1
  2. package/abstract/Array.js +0 -4
  3. package/abstract/Base.d.ts +1 -1
  4. package/abstract/Base.js +18 -19
  5. package/abstract/Int.d.ts +1 -1
  6. package/abstract/Int.js +11 -14
  7. package/abstract/Object.d.ts +1 -1
  8. package/abstract/Object.js +0 -5
  9. package/abstract/index.d.ts +3 -3
  10. package/base/Compact.d.ts +1 -1
  11. package/base/Compact.js +24 -25
  12. package/base/DoNotConstruct.d.ts +1 -1
  13. package/base/DoNotConstruct.js +19 -19
  14. package/base/Enum.d.ts +1 -1
  15. package/base/Enum.js +54 -53
  16. package/base/Int.d.ts +2 -2
  17. package/base/Null.d.ts +1 -1
  18. package/base/Null.js +3 -6
  19. package/base/Option.d.ts +1 -1
  20. package/base/Option.js +21 -22
  21. package/base/Result.d.ts +2 -2
  22. package/base/Tuple.d.ts +2 -2
  23. package/base/Tuple.js +10 -7
  24. package/base/UInt.d.ts +2 -2
  25. package/base/Vec.d.ts +2 -2
  26. package/base/Vec.js +12 -9
  27. package/base/VecAny.d.ts +2 -2
  28. package/base/VecFixed.d.ts +2 -2
  29. package/base/VecFixed.js +9 -6
  30. package/base/index.d.ts +12 -12
  31. package/bundle.d.ts +7 -7
  32. package/cjs/abstract/Array.js +2 -2
  33. package/cjs/abstract/index.js +6 -6
  34. package/cjs/base/Compact.js +2 -2
  35. package/cjs/base/Enum.js +8 -8
  36. package/cjs/base/Int.js +2 -2
  37. package/cjs/base/Option.js +4 -4
  38. package/cjs/base/Result.js +2 -2
  39. package/cjs/base/Tuple.js +8 -8
  40. package/cjs/base/UInt.js +2 -2
  41. package/cjs/base/Vec.js +6 -6
  42. package/cjs/base/VecAny.js +2 -2
  43. package/cjs/base/VecFixed.js +7 -7
  44. package/cjs/base/index.js +24 -24
  45. package/cjs/bundle.js +8 -8
  46. package/cjs/detectPackage.js +3 -3
  47. package/cjs/extended/BTreeMap.js +2 -2
  48. package/cjs/extended/BTreeSet.js +5 -5
  49. package/cjs/extended/BitVec.js +2 -2
  50. package/cjs/extended/Bytes.js +3 -3
  51. package/cjs/extended/HashMap.js +2 -2
  52. package/cjs/extended/Linkage.js +10 -10
  53. package/cjs/extended/Map.js +15 -15
  54. package/cjs/extended/OptionBool.js +5 -5
  55. package/cjs/extended/Range.js +2 -2
  56. package/cjs/extended/RangeInclusive.js +2 -2
  57. package/cjs/extended/Type.js +4 -4
  58. package/cjs/extended/U8aFixed.js +2 -2
  59. package/cjs/extended/WrapperKeepOpaque.js +6 -6
  60. package/cjs/extended/WrapperOpaque.js +2 -2
  61. package/cjs/extended/index.js +29 -29
  62. package/cjs/index.js +2 -2
  63. package/cjs/native/Json.js +2 -2
  64. package/cjs/native/Set.js +2 -2
  65. package/cjs/native/Struct.js +5 -5
  66. package/cjs/native/Text.js +2 -2
  67. package/cjs/native/index.js +19 -19
  68. package/cjs/packageInfo.js +1 -1
  69. package/cjs/primitive/F32.js +2 -2
  70. package/cjs/primitive/F64.js +2 -2
  71. package/cjs/primitive/I128.js +2 -2
  72. package/cjs/primitive/I16.js +2 -2
  73. package/cjs/primitive/I256.js +2 -2
  74. package/cjs/primitive/I32.js +2 -2
  75. package/cjs/primitive/I64.js +2 -2
  76. package/cjs/primitive/I8.js +2 -2
  77. package/cjs/primitive/U128.js +2 -2
  78. package/cjs/primitive/U16.js +2 -2
  79. package/cjs/primitive/U256.js +2 -2
  80. package/cjs/primitive/U32.js +2 -2
  81. package/cjs/primitive/U64.js +2 -2
  82. package/cjs/primitive/U8.js +2 -2
  83. package/cjs/primitive/USize.js +2 -2
  84. package/cjs/primitive/index.js +45 -45
  85. package/cjs/types/index.js +4 -4
  86. package/cjs/utils/compareArray.js +2 -2
  87. package/cjs/utils/compareMap.js +2 -2
  88. package/cjs/utils/index.js +22 -22
  89. package/cjs/utils/mapToTypeMap.js +2 -2
  90. package/extended/BTreeMap.d.ts +2 -2
  91. package/extended/BTreeSet.d.ts +1 -1
  92. package/extended/BTreeSet.js +7 -8
  93. package/extended/BitVec.d.ts +2 -2
  94. package/extended/BitVec.js +12 -9
  95. package/extended/Bytes.d.ts +2 -2
  96. package/extended/HashMap.d.ts +2 -2
  97. package/extended/Linkage.d.ts +4 -4
  98. package/extended/Map.d.ts +1 -1
  99. package/extended/Map.js +11 -12
  100. package/extended/OptionBool.d.ts +3 -3
  101. package/extended/Range.d.ts +2 -2
  102. package/extended/Range.js +7 -4
  103. package/extended/RangeInclusive.d.ts +2 -2
  104. package/extended/Type.d.ts +2 -2
  105. package/extended/U8aFixed.d.ts +2 -2
  106. package/extended/WrapperKeepOpaque.d.ts +2 -2
  107. package/extended/WrapperKeepOpaque.js +23 -20
  108. package/extended/WrapperOpaque.d.ts +2 -2
  109. package/extended/index.d.ts +14 -14
  110. package/index.d.ts +2 -2
  111. package/native/Bool.d.ts +1 -1
  112. package/native/Bool.js +1 -4
  113. package/native/Date.d.ts +1 -1
  114. package/native/Date.js +1 -4
  115. package/native/Float.d.ts +1 -1
  116. package/native/Float.js +8 -10
  117. package/native/Json.d.ts +1 -1
  118. package/native/Json.js +0 -4
  119. package/native/Raw.d.ts +1 -1
  120. package/native/Raw.js +0 -4
  121. package/native/Set.d.ts +1 -1
  122. package/native/Set.js +35 -34
  123. package/native/Struct.d.ts +1 -1
  124. package/native/Struct.js +22 -21
  125. package/native/Text.d.ts +1 -1
  126. package/native/Text.js +7 -8
  127. package/native/index.d.ts +8 -8
  128. package/package.json +3 -3
  129. package/packageInfo.js +1 -1
  130. package/primitive/F32.d.ts +2 -2
  131. package/primitive/F32.js +5 -2
  132. package/primitive/F64.d.ts +2 -2
  133. package/primitive/F64.js +5 -2
  134. package/primitive/I128.d.ts +2 -2
  135. package/primitive/I128.js +5 -2
  136. package/primitive/I16.d.ts +2 -2
  137. package/primitive/I16.js +5 -2
  138. package/primitive/I256.d.ts +2 -2
  139. package/primitive/I256.js +5 -2
  140. package/primitive/I32.d.ts +2 -2
  141. package/primitive/I32.js +5 -2
  142. package/primitive/I64.d.ts +2 -2
  143. package/primitive/I64.js +5 -2
  144. package/primitive/I8.d.ts +2 -2
  145. package/primitive/I8.js +5 -2
  146. package/primitive/U128.d.ts +2 -2
  147. package/primitive/U128.js +5 -2
  148. package/primitive/U16.d.ts +2 -2
  149. package/primitive/U16.js +5 -2
  150. package/primitive/U256.d.ts +2 -2
  151. package/primitive/U256.js +5 -2
  152. package/primitive/U32.d.ts +2 -2
  153. package/primitive/U32.js +5 -2
  154. package/primitive/U64.d.ts +2 -2
  155. package/primitive/U64.js +5 -2
  156. package/primitive/U8.d.ts +2 -2
  157. package/primitive/U8.js +5 -2
  158. package/primitive/USize.d.ts +2 -2
  159. package/primitive/index.d.ts +15 -15
  160. package/types/codec.d.ts +3 -3
  161. package/types/helpers.d.ts +1 -1
  162. package/types/index.d.ts +4 -4
  163. package/types/interfaces.d.ts +2 -2
  164. package/types/registry.d.ts +3 -3
  165. package/utils/decodeU8a.d.ts +1 -1
  166. package/utils/index.d.ts +9 -9
  167. package/utils/mapToTypeMap.d.ts +1 -1
  168. package/utils/sanitize.d.ts +1 -1
  169. package/utils/sortValues.d.ts +1 -1
  170. package/utils/typeToConstructor.d.ts +1 -1
  171. package/utils/typesToMap.d.ts +1 -1
package/base/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { Compact } from './Compact';
2
- export { DoNotConstruct } from './DoNotConstruct';
3
- export { Enum } from './Enum';
4
- export { Int } from './Int';
5
- export { Null } from './Null';
6
- export { Option } from './Option';
7
- export { Result } from './Result';
8
- export { Tuple } from './Tuple';
9
- export { UInt } from './UInt';
10
- export { Vec } from './Vec';
11
- export { VecAny } from './VecAny';
12
- export { VecFixed } from './VecFixed';
1
+ export { Compact } from './Compact.js';
2
+ export { DoNotConstruct } from './DoNotConstruct.js';
3
+ export { Enum } from './Enum.js';
4
+ export { Int } from './Int.js';
5
+ export { Null } from './Null.js';
6
+ export { Option } from './Option.js';
7
+ export { Result } from './Result.js';
8
+ export { Tuple } from './Tuple.js';
9
+ export { UInt } from './UInt.js';
10
+ export { Vec } from './Vec.js';
11
+ export { VecAny } from './VecAny.js';
12
+ export { VecFixed } from './VecFixed.js';
package/bundle.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { packageInfo } from './packageInfo';
2
- export * from './abstract';
3
- export * from './base';
4
- export * from './extended';
5
- export * from './native';
6
- export * from './primitive';
7
- export * from './utils';
1
+ export { packageInfo } from './packageInfo.js';
2
+ export * from './abstract/index.js';
3
+ export * from './base/index.js';
4
+ export * from './extended/index.js';
5
+ export * from './native/index.js';
6
+ export * from './primitive/index.js';
7
+ export * from './utils/index.js';
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractArray = void 0;
4
4
  const util_1 = require("@polkadot/util");
5
- const compareArray_1 = require("../utils/compareArray");
5
+ const compareArray_js_1 = require("../utils/compareArray.js");
6
6
  /**
7
7
  * @name AbstractArray
8
8
  * @description
@@ -57,7 +57,7 @@ class AbstractArray extends Array {
57
57
  * @description Compares the value of the input to see if there is a match
58
58
  */
59
59
  eq(other) {
60
- return (0, compareArray_1.compareArray)(this, other);
60
+ return (0, compareArray_js_1.compareArray)(this, other);
61
61
  }
62
62
  /**
63
63
  * @description Returns a breakdown of the hex encoding for this Codec
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractInt = exports.AbstractBase = exports.AbstractArray = void 0;
4
- var Array_1 = require("./Array");
5
- Object.defineProperty(exports, "AbstractArray", { enumerable: true, get: function () { return Array_1.AbstractArray; } });
6
- var Base_1 = require("./Base");
7
- Object.defineProperty(exports, "AbstractBase", { enumerable: true, get: function () { return Base_1.AbstractBase; } });
8
- var Int_1 = require("./Int");
9
- Object.defineProperty(exports, "AbstractInt", { enumerable: true, get: function () { return Int_1.AbstractInt; } });
4
+ var Array_js_1 = require("./Array.js");
5
+ Object.defineProperty(exports, "AbstractArray", { enumerable: true, get: function () { return Array_js_1.AbstractArray; } });
6
+ var Base_js_1 = require("./Base.js");
7
+ Object.defineProperty(exports, "AbstractBase", { enumerable: true, get: function () { return Base_js_1.AbstractBase; } });
8
+ var Int_js_1 = require("./Int.js");
9
+ Object.defineProperty(exports, "AbstractInt", { enumerable: true, get: function () { return Int_js_1.AbstractInt; } });
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Compact = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const utils_1 = require("../utils");
7
+ const index_js_1 = require("../utils/index.js");
8
8
  function noopSetDefinition(d) {
9
9
  return d;
10
10
  }
@@ -39,7 +39,7 @@ class Compact {
39
39
  _Compact_Type.set(this, void 0);
40
40
  _Compact_raw.set(this, void 0);
41
41
  this.registry = registry;
42
- tslib_1.__classPrivateFieldSet(this, _Compact_Type, definition || setDefinition((0, utils_1.typeToConstructor)(registry, Type)), "f");
42
+ tslib_1.__classPrivateFieldSet(this, _Compact_Type, definition || setDefinition((0, index_js_1.typeToConstructor)(registry, Type)), "f");
43
43
  const [raw, decodedLength] = decodeCompact(registry, tslib_1.__classPrivateFieldGet(this, _Compact_Type, "f"), value);
44
44
  this.initialU8aLength = decodedLength;
45
45
  tslib_1.__classPrivateFieldSet(this, _Compact_raw, raw, "f");
package/cjs/base/Enum.js CHANGED
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Enum = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const utils_1 = require("../utils");
8
- const Null_1 = require("./Null");
7
+ const index_js_1 = require("../utils/index.js");
8
+ const Null_js_1 = require("./Null.js");
9
9
  function noopSetDefinition(d) {
10
10
  return d;
11
11
  }
@@ -25,24 +25,24 @@ function extractDef(registry, _def) {
25
25
  let isIndexed;
26
26
  if (Array.isArray(_def)) {
27
27
  for (let i = 0; i < _def.length; i++) {
28
- def[_def[i]] = { Type: Null_1.Null, index: i };
28
+ def[_def[i]] = { Type: Null_js_1.Null, index: i };
29
29
  }
30
30
  isBasic = true;
31
31
  isIndexed = false;
32
32
  }
33
33
  else if (isRustEnum(_def)) {
34
- const [Types, keys] = (0, utils_1.mapToTypeMap)(registry, _def);
34
+ const [Types, keys] = (0, index_js_1.mapToTypeMap)(registry, _def);
35
35
  for (let i = 0; i < keys.length; i++) {
36
36
  def[keys[i]] = { Type: Types[i], index: i };
37
37
  }
38
- isBasic = !Object.values(def).some(({ Type }) => Type !== Null_1.Null);
38
+ isBasic = !Object.values(def).some(({ Type }) => Type !== Null_js_1.Null);
39
39
  isIndexed = false;
40
40
  }
41
41
  else {
42
42
  const entries = Object.entries(_def);
43
43
  for (let i = 0; i < entries.length; i++) {
44
44
  const [key, index] = entries[i];
45
- def[key] = { Type: Null_1.Null, index };
45
+ def[key] = { Type: Null_js_1.Null, index };
46
46
  }
47
47
  isBasic = true;
48
48
  isIndexed = true;
@@ -225,7 +225,7 @@ class Enum {
225
225
  * @description Checks if the Enum points to a [[Null]] type
226
226
  */
227
227
  get isNone() {
228
- return tslib_1.__classPrivateFieldGet(this, _Enum_raw, "f") instanceof Null_1.Null;
228
+ return tslib_1.__classPrivateFieldGet(this, _Enum_raw, "f") instanceof Null_js_1.Null;
229
229
  }
230
230
  /**
231
231
  * @description The available keys for this enum
@@ -339,7 +339,7 @@ class Enum {
339
339
  : this.defKeys;
340
340
  }
341
341
  const entries = Object.entries(tslib_1.__classPrivateFieldGet(this, _Enum_def, "f"));
342
- return (0, utils_1.typesToMap)(this.registry, entries.reduce((out, [key, { Type }], i) => {
342
+ return (0, index_js_1.typesToMap)(this.registry, entries.reduce((out, [key, { Type }], i) => {
343
343
  out[0][i] = Type;
344
344
  out[1][i] = key;
345
345
  return out;
package/cjs/base/Int.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Int = void 0;
4
- const Int_1 = require("../abstract/Int");
4
+ const Int_js_1 = require("../abstract/Int.js");
5
5
  /**
6
6
  * @name Int
7
7
  * @description
@@ -12,7 +12,7 @@ const Int_1 = require("../abstract/Int");
12
12
  * is available here.
13
13
  * @noInheritDoc
14
14
  */
15
- class Int extends Int_1.AbstractInt {
15
+ class Int extends Int_js_1.AbstractInt {
16
16
  constructor(registry, value = 0, bitLength) {
17
17
  super(registry, value, bitLength, true);
18
18
  }
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Option = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const utils_1 = require("../utils");
8
- const Null_1 = require("./Null");
7
+ const index_js_1 = require("../utils/index.js");
8
+ const Null_js_1 = require("./Null.js");
9
9
  function noopSetDefinition(d) {
10
10
  return d;
11
11
  }
12
- class None extends Null_1.Null {
12
+ class None extends Null_js_1.Null {
13
13
  /**
14
14
  * @description Returns the base runtime type name for this instance
15
15
  */
@@ -60,7 +60,7 @@ class Option {
60
60
  constructor(registry, typeName, value, { definition, setDefinition = noopSetDefinition } = {}) {
61
61
  _Option_Type.set(this, void 0);
62
62
  _Option_raw.set(this, void 0);
63
- const Type = definition || setDefinition((0, utils_1.typeToConstructor)(registry, typeName));
63
+ const Type = definition || setDefinition((0, index_js_1.typeToConstructor)(registry, typeName));
64
64
  const decoded = (0, util_1.isU8a)(value) && value.length && !(0, util_1.isCodec)(value)
65
65
  ? value[0] === 0
66
66
  ? new None(registry)
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Result = void 0;
4
- const Enum_1 = require("./Enum");
4
+ const Enum_js_1 = require("./Enum.js");
5
5
  /**
6
6
  * @name Result
7
7
  * @description
8
8
  * A Result maps to the Rust Result type, that can either wrap a success or error value
9
9
  */
10
- class Result extends Enum_1.Enum {
10
+ class Result extends Enum_js_1.Enum {
11
11
  constructor(registry, Ok, Err, value) {
12
12
  // NOTE This is order-dependent, Ok (with index 0) needs to be first
13
13
  // eslint-disable-next-line sort-keys
package/cjs/base/Tuple.js CHANGED
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Tuple = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const Array_1 = require("../abstract/Array");
8
- const utils_1 = require("../utils");
7
+ const Array_js_1 = require("../abstract/Array.js");
8
+ const index_js_1 = require("../utils/index.js");
9
9
  function noopSetDefinition(d) {
10
10
  return d;
11
11
  }
@@ -27,7 +27,7 @@ function decodeTuple(registry, result, value, Classes) {
27
27
  return [result, 0];
28
28
  }
29
29
  else if ((0, util_1.isHex)(value)) {
30
- return (0, utils_1.decodeU8a)(registry, result, (0, util_1.u8aToU8a)(value), Classes);
30
+ return (0, index_js_1.decodeU8a)(registry, result, (0, util_1.u8aToU8a)(value), Classes);
31
31
  }
32
32
  else if (!value || !result.length) {
33
33
  const Types = Classes[0];
@@ -44,17 +44,17 @@ function decodeTuple(registry, result, value, Classes) {
44
44
  * A Tuple defines an anonymous fixed-length array, where each element has its
45
45
  * own type. It extends the base JS `Array` object.
46
46
  */
47
- class Tuple extends Array_1.AbstractArray {
47
+ class Tuple extends Array_js_1.AbstractArray {
48
48
  constructor(registry, Types, value, { definition, setDefinition = noopSetDefinition } = {}) {
49
49
  const Classes = definition || setDefinition(Array.isArray(Types)
50
- ? [Types.map((t) => (0, utils_1.typeToConstructor)(registry, t)), []]
50
+ ? [Types.map((t) => (0, index_js_1.typeToConstructor)(registry, t)), []]
51
51
  : (0, util_1.isFunction)(Types) || (0, util_1.isString)(Types)
52
- ? [[(0, utils_1.typeToConstructor)(registry, Types)], []]
53
- : (0, utils_1.mapToTypeMap)(registry, Types));
52
+ ? [[(0, index_js_1.typeToConstructor)(registry, Types)], []]
53
+ : (0, index_js_1.mapToTypeMap)(registry, Types));
54
54
  super(registry, Classes[0].length);
55
55
  _Tuple_Types.set(this, void 0);
56
56
  this.initialU8aLength = ((0, util_1.isU8a)(value)
57
- ? (0, utils_1.decodeU8a)(registry, this, value, Classes)
57
+ ? (0, index_js_1.decodeU8a)(registry, this, value, Classes)
58
58
  : decodeTuple(registry, this, value, Classes))[1];
59
59
  tslib_1.__classPrivateFieldSet(this, _Tuple_Types, Classes, "f");
60
60
  }
package/cjs/base/UInt.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UInt = void 0;
4
- const Int_1 = require("../abstract/Int");
4
+ const Int_js_1 = require("../abstract/Int.js");
5
5
  /**
6
6
  * @name UInt
7
7
  * @description
@@ -12,7 +12,7 @@ const Int_1 = require("../abstract/Int");
12
12
  * is available here.
13
13
  * @noInheritDoc
14
14
  */
15
- class UInt extends Int_1.AbstractInt {
15
+ class UInt extends Int_js_1.AbstractInt {
16
16
  static with(bitLength, typeName) {
17
17
  return class extends UInt {
18
18
  constructor(registry, value) {
package/cjs/base/Vec.js CHANGED
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Vec = exports.decodeVec = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const Array_1 = require("../abstract/Array");
8
- const utils_1 = require("../utils");
7
+ const Array_js_1 = require("../abstract/Array.js");
8
+ const index_js_1 = require("../utils/index.js");
9
9
  const MAX_LENGTH = 64 * 1024;
10
10
  const l = (0, util_1.logger)('Vec');
11
11
  function noopSetDefinition(d) {
@@ -51,7 +51,7 @@ function decodeVec(registry, result, value, startAt, Type) {
51
51
  return [0, 0];
52
52
  }
53
53
  // we don't need more checks, we already limited it via the length decoding
54
- return (0, utils_1.decodeU8aVec)(registry, result, (0, util_1.u8aToU8a)(value), startAt, Type);
54
+ return (0, index_js_1.decodeU8aVec)(registry, result, (0, util_1.u8aToU8a)(value), startAt, Type);
55
55
  }
56
56
  exports.decodeVec = decodeVec;
57
57
  /**
@@ -61,14 +61,14 @@ exports.decodeVec = decodeVec;
61
61
  * construction with the passed `Type` in the constructor. It is an extension to Array, providing
62
62
  * specific encoding/decoding on top of the base type.
63
63
  */
64
- class Vec extends Array_1.AbstractArray {
64
+ class Vec extends Array_js_1.AbstractArray {
65
65
  constructor(registry, Type, value = [], { definition, setDefinition = noopSetDefinition } = {}) {
66
66
  const [decodeFrom, length, startAt] = decodeVecLength(value);
67
67
  super(registry, length);
68
68
  _Vec_Type.set(this, void 0);
69
- tslib_1.__classPrivateFieldSet(this, _Vec_Type, definition || setDefinition((0, utils_1.typeToConstructor)(registry, Type)), "f");
69
+ tslib_1.__classPrivateFieldSet(this, _Vec_Type, definition || setDefinition((0, index_js_1.typeToConstructor)(registry, Type)), "f");
70
70
  this.initialU8aLength = ((0, util_1.isU8a)(decodeFrom)
71
- ? (0, utils_1.decodeU8aVec)(registry, this, decodeFrom, startAt, tslib_1.__classPrivateFieldGet(this, _Vec_Type, "f"))
71
+ ? (0, index_js_1.decodeU8aVec)(registry, this, decodeFrom, startAt, tslib_1.__classPrivateFieldGet(this, _Vec_Type, "f"))
72
72
  : decodeVec(registry, this, decodeFrom, startAt, tslib_1.__classPrivateFieldGet(this, _Vec_Type, "f")))[0];
73
73
  }
74
74
  static with(Type) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VecAny = void 0;
4
- const Array_1 = require("../abstract/Array");
4
+ const Array_js_1 = require("../abstract/Array.js");
5
5
  /**
6
6
  * @name VecAny
7
7
  * @description
@@ -9,7 +9,7 @@ const Array_1 = require("../abstract/Array");
9
9
  * a vector, this can be used to manage array-like structures with variable arguments of
10
10
  * any types
11
11
  */
12
- class VecAny extends Array_1.AbstractArray {
12
+ class VecAny extends Array_js_1.AbstractArray {
13
13
  /**
14
14
  * @description Returns the base runtime type name for this instance
15
15
  */
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.VecFixed = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const Array_1 = require("../abstract/Array");
8
- const utils_1 = require("../utils");
9
- const Vec_1 = require("./Vec");
7
+ const Array_js_1 = require("../abstract/Array.js");
8
+ const index_js_1 = require("../utils/index.js");
9
+ const Vec_js_1 = require("./Vec.js");
10
10
  function noopSetDefinition(d) {
11
11
  return d;
12
12
  }
@@ -15,14 +15,14 @@ function noopSetDefinition(d) {
15
15
  * @description
16
16
  * This manages codec arrays of a fixed length
17
17
  */
18
- class VecFixed extends Array_1.AbstractArray {
18
+ class VecFixed extends Array_js_1.AbstractArray {
19
19
  constructor(registry, Type, length, value = [], { definition, setDefinition = noopSetDefinition } = {}) {
20
20
  super(registry, length);
21
21
  _VecFixed_Type.set(this, void 0);
22
- tslib_1.__classPrivateFieldSet(this, _VecFixed_Type, definition || setDefinition((0, utils_1.typeToConstructor)(registry, Type)), "f");
22
+ tslib_1.__classPrivateFieldSet(this, _VecFixed_Type, definition || setDefinition((0, index_js_1.typeToConstructor)(registry, Type)), "f");
23
23
  this.initialU8aLength = ((0, util_1.isU8a)(value)
24
- ? (0, utils_1.decodeU8aVec)(registry, this, value, 0, tslib_1.__classPrivateFieldGet(this, _VecFixed_Type, "f"))
25
- : (0, Vec_1.decodeVec)(registry, this, value, 0, tslib_1.__classPrivateFieldGet(this, _VecFixed_Type, "f")))[1];
24
+ ? (0, index_js_1.decodeU8aVec)(registry, this, value, 0, tslib_1.__classPrivateFieldGet(this, _VecFixed_Type, "f"))
25
+ : (0, Vec_js_1.decodeVec)(registry, this, value, 0, tslib_1.__classPrivateFieldGet(this, _VecFixed_Type, "f")))[1];
26
26
  }
27
27
  static with(Type, length) {
28
28
  let definition;
package/cjs/base/index.js CHANGED
@@ -1,27 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VecFixed = exports.VecAny = exports.Vec = exports.UInt = exports.Tuple = exports.Result = exports.Option = exports.Null = exports.Int = exports.Enum = exports.DoNotConstruct = exports.Compact = void 0;
4
- var Compact_1 = require("./Compact");
5
- Object.defineProperty(exports, "Compact", { enumerable: true, get: function () { return Compact_1.Compact; } });
6
- var DoNotConstruct_1 = require("./DoNotConstruct");
7
- Object.defineProperty(exports, "DoNotConstruct", { enumerable: true, get: function () { return DoNotConstruct_1.DoNotConstruct; } });
8
- var Enum_1 = require("./Enum");
9
- Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return Enum_1.Enum; } });
10
- var Int_1 = require("./Int");
11
- Object.defineProperty(exports, "Int", { enumerable: true, get: function () { return Int_1.Int; } });
12
- var Null_1 = require("./Null");
13
- Object.defineProperty(exports, "Null", { enumerable: true, get: function () { return Null_1.Null; } });
14
- var Option_1 = require("./Option");
15
- Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return Option_1.Option; } });
16
- var Result_1 = require("./Result");
17
- Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return Result_1.Result; } });
18
- var Tuple_1 = require("./Tuple");
19
- Object.defineProperty(exports, "Tuple", { enumerable: true, get: function () { return Tuple_1.Tuple; } });
20
- var UInt_1 = require("./UInt");
21
- Object.defineProperty(exports, "UInt", { enumerable: true, get: function () { return UInt_1.UInt; } });
22
- var Vec_1 = require("./Vec");
23
- Object.defineProperty(exports, "Vec", { enumerable: true, get: function () { return Vec_1.Vec; } });
24
- var VecAny_1 = require("./VecAny");
25
- Object.defineProperty(exports, "VecAny", { enumerable: true, get: function () { return VecAny_1.VecAny; } });
26
- var VecFixed_1 = require("./VecFixed");
27
- Object.defineProperty(exports, "VecFixed", { enumerable: true, get: function () { return VecFixed_1.VecFixed; } });
4
+ var Compact_js_1 = require("./Compact.js");
5
+ Object.defineProperty(exports, "Compact", { enumerable: true, get: function () { return Compact_js_1.Compact; } });
6
+ var DoNotConstruct_js_1 = require("./DoNotConstruct.js");
7
+ Object.defineProperty(exports, "DoNotConstruct", { enumerable: true, get: function () { return DoNotConstruct_js_1.DoNotConstruct; } });
8
+ var Enum_js_1 = require("./Enum.js");
9
+ Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return Enum_js_1.Enum; } });
10
+ var Int_js_1 = require("./Int.js");
11
+ Object.defineProperty(exports, "Int", { enumerable: true, get: function () { return Int_js_1.Int; } });
12
+ var Null_js_1 = require("./Null.js");
13
+ Object.defineProperty(exports, "Null", { enumerable: true, get: function () { return Null_js_1.Null; } });
14
+ var Option_js_1 = require("./Option.js");
15
+ Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return Option_js_1.Option; } });
16
+ var Result_js_1 = require("./Result.js");
17
+ Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return Result_js_1.Result; } });
18
+ var Tuple_js_1 = require("./Tuple.js");
19
+ Object.defineProperty(exports, "Tuple", { enumerable: true, get: function () { return Tuple_js_1.Tuple; } });
20
+ var UInt_js_1 = require("./UInt.js");
21
+ Object.defineProperty(exports, "UInt", { enumerable: true, get: function () { return UInt_js_1.UInt; } });
22
+ var Vec_js_1 = require("./Vec.js");
23
+ Object.defineProperty(exports, "Vec", { enumerable: true, get: function () { return Vec_js_1.Vec; } });
24
+ var VecAny_js_1 = require("./VecAny.js");
25
+ Object.defineProperty(exports, "VecAny", { enumerable: true, get: function () { return VecAny_js_1.VecAny; } });
26
+ var VecFixed_js_1 = require("./VecFixed.js");
27
+ Object.defineProperty(exports, "VecFixed", { enumerable: true, get: function () { return VecFixed_js_1.VecFixed; } });
package/cjs/bundle.js CHANGED
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageInfo = void 0;
4
4
  const tslib_1 = require("tslib");
5
- var packageInfo_1 = require("./packageInfo");
6
- Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_1.packageInfo; } });
7
- tslib_1.__exportStar(require("./abstract"), exports);
8
- tslib_1.__exportStar(require("./base"), exports);
9
- tslib_1.__exportStar(require("./extended"), exports);
10
- tslib_1.__exportStar(require("./native"), exports);
11
- tslib_1.__exportStar(require("./primitive"), exports);
12
- tslib_1.__exportStar(require("./utils"), exports);
5
+ var packageInfo_js_1 = require("./packageInfo.js");
6
+ Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
7
+ tslib_1.__exportStar(require("./abstract/index.js"), exports);
8
+ tslib_1.__exportStar(require("./base/index.js"), exports);
9
+ tslib_1.__exportStar(require("./extended/index.js"), exports);
10
+ tslib_1.__exportStar(require("./native/index.js"), exports);
11
+ tslib_1.__exportStar(require("./primitive/index.js"), exports);
12
+ tslib_1.__exportStar(require("./utils/index.js"), exports);
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const util_1 = require("@polkadot/util");
5
- const detectOther_1 = tslib_1.__importDefault(require("./detectOther"));
6
- const packageInfo_1 = require("./packageInfo");
7
- (0, util_1.detectPackage)(packageInfo_1.packageInfo, null, detectOther_1.default);
5
+ const detectOther_js_1 = tslib_1.__importDefault(require("./detectOther.js"));
6
+ const packageInfo_js_1 = require("./packageInfo.js");
7
+ (0, util_1.detectPackage)(packageInfo_js_1.packageInfo, null, detectOther_js_1.default);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BTreeMap = void 0;
4
- const Map_1 = require("./Map");
5
- class BTreeMap extends Map_1.CodecMap {
4
+ const Map_js_1 = require("./Map.js");
5
+ class BTreeMap extends Map_js_1.CodecMap {
6
6
  static with(keyType, valType) {
7
7
  return class extends BTreeMap {
8
8
  constructor(registry, value) {
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.BTreeSet = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const utils_1 = require("../utils");
7
+ const index_js_1 = require("../utils/index.js");
8
8
  const l = (0, util_1.logger)('BTreeSet');
9
9
  /** @internal */
10
10
  function decodeSetFromU8a(registry, ValClass, u8a) {
11
11
  const output = new Set();
12
12
  const [offset, count] = (0, util_1.compactFromU8aLim)(u8a);
13
13
  const result = new Array(count);
14
- const [decodedLength] = (0, utils_1.decodeU8aVec)(registry, result, u8a, offset, ValClass);
14
+ const [decodedLength] = (0, index_js_1.decodeU8aVec)(registry, result, u8a, offset, ValClass);
15
15
  for (let i = 0; i < count; i++) {
16
16
  output.add(result[i]);
17
17
  }
@@ -46,7 +46,7 @@ function decodeSetFromSet(registry, ValClass, value) {
46
46
  * @internal
47
47
  */
48
48
  function decodeSet(registry, valType, value) {
49
- const ValClass = (0, utils_1.typeToConstructor)(registry, valType);
49
+ const ValClass = (0, index_js_1.typeToConstructor)(registry, valType);
50
50
  if (!value) {
51
51
  return [ValClass, new Set(), 0];
52
52
  }
@@ -61,7 +61,7 @@ function decodeSet(registry, valType, value) {
61
61
  class BTreeSet extends Set {
62
62
  constructor(registry, valType, rawValue) {
63
63
  const [ValClass, values, decodedLength] = decodeSet(registry, valType, rawValue);
64
- super((0, utils_1.sortSet)(values));
64
+ super((0, index_js_1.sortSet)(values));
65
65
  _BTreeSet_ValClass.set(this, void 0);
66
66
  this.registry = registry;
67
67
  this.initialU8aLength = decodedLength;
@@ -106,7 +106,7 @@ class BTreeSet extends Set {
106
106
  * @description Compares the value of the input to see if there is a match
107
107
  */
108
108
  eq(other) {
109
- return (0, utils_1.compareSet)(this, other);
109
+ return (0, index_js_1.compareSet)(this, other);
110
110
  }
111
111
  /**
112
112
  * @description Returns a breakdown of the hex encoding for this Codec
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.BitVec = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const util_1 = require("@polkadot/util");
7
- const Raw_1 = require("../native/Raw");
7
+ const Raw_js_1 = require("../native/Raw.js");
8
8
  /** @internal */
9
9
  function decodeBitVecU8a(value) {
10
10
  if (!value || !value.length) {
@@ -32,7 +32,7 @@ function decodeBitVec(value) {
32
32
  * A BitVec that represents an array of bits. The bits are however stored encoded. The difference between this
33
33
  * and a normal Bytes would be that the length prefix indicates the number of bits encoded, not the bytes
34
34
  */
35
- class BitVec extends Raw_1.Raw {
35
+ class BitVec extends Raw_js_1.Raw {
36
36
  // In lieu of having the Msb/Lsb identifiers passed through, we default to assuming
37
37
  // we are dealing with Lsb, which is the default (as of writing) BitVec format used
38
38
  // in the Polkadot code (this only affects the toHuman displays)
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Bytes = void 0;
4
4
  const util_1 = require("@polkadot/util");
5
- const Raw_1 = require("../native/Raw");
5
+ const Raw_js_1 = require("../native/Raw.js");
6
6
  const MAX_LENGTH = 10 * 1024 * 1024;
7
7
  /** @internal */
8
8
  function decodeBytesU8a(value) {
@@ -27,9 +27,9 @@ function decodeBytesU8a(value) {
27
27
  * is that this version allows for length-encoding. (i.e. it is a variable-item codec, the same
28
28
  * as what is found in [[Text]] and [[Vec]])
29
29
  */
30
- class Bytes extends Raw_1.Raw {
30
+ class Bytes extends Raw_js_1.Raw {
31
31
  constructor(registry, value) {
32
- const [u8a, decodedLength] = (0, util_1.isU8a)(value) && !(value instanceof Raw_1.Raw)
32
+ const [u8a, decodedLength] = (0, util_1.isU8a)(value) && !(value instanceof Raw_js_1.Raw)
33
33
  ? decodeBytesU8a(value)
34
34
  : Array.isArray(value) || (0, util_1.isString)(value)
35
35
  ? [(0, util_1.u8aToU8a)(value), 0]
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HashMap = void 0;
4
- const Map_1 = require("./Map");
5
- class HashMap extends Map_1.CodecMap {
4
+ const Map_js_1 = require("./Map.js");
5
+ class HashMap extends Map_js_1.CodecMap {
6
6
  static with(keyType, valType) {
7
7
  return class extends HashMap {
8
8
  constructor(registry, value) {
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LinkageResult = exports.Linkage = void 0;
4
- const Option_1 = require("../base/Option");
5
- const Tuple_1 = require("../base/Tuple");
6
- const Vec_1 = require("../base/Vec");
7
- const Struct_1 = require("../native/Struct");
4
+ const Option_js_1 = require("../base/Option.js");
5
+ const Tuple_js_1 = require("../base/Tuple.js");
6
+ const Vec_js_1 = require("../base/Vec.js");
7
+ const Struct_js_1 = require("../native/Struct.js");
8
8
  const EMPTY = new Uint8Array();
9
9
  /**
10
10
  * @name Linkage
11
11
  * @description The wrapper for the result from a LinkedMap
12
12
  */
13
- class Linkage extends Struct_1.Struct {
13
+ class Linkage extends Struct_js_1.Struct {
14
14
  constructor(registry, Type, value) {
15
15
  super(registry, {
16
- previous: Option_1.Option.with(Type),
16
+ previous: Option_js_1.Option.with(Type),
17
17
  // eslint-disable-next-line sort-keys
18
- next: Option_1.Option.with(Type)
18
+ next: Option_js_1.Option.with(Type)
19
19
  }, value);
20
20
  }
21
21
  static withKey(Type) {
@@ -53,11 +53,11 @@ exports.Linkage = Linkage;
53
53
  * @name LinkageResult
54
54
  * @description A Linkage keys/Values tuple
55
55
  */
56
- class LinkageResult extends Tuple_1.Tuple {
56
+ class LinkageResult extends Tuple_js_1.Tuple {
57
57
  constructor(registry, [TypeKey, keys], [TypeValue, values]) {
58
58
  super(registry, {
59
- Keys: Vec_1.Vec.with(TypeKey),
60
- Values: Vec_1.Vec.with(TypeValue)
59
+ Keys: Vec_js_1.Vec.with(TypeKey),
60
+ Values: Vec_js_1.Vec.with(TypeValue)
61
61
  }, [keys, values]);
62
62
  }
63
63
  }