@polkadot/types-codec 10.0.1 → 10.1.1

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
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, Inspect, IU8a, IVec, Registry } from '../types';
2
+ import type { AnyJson, Codec, Inspect, IU8a, IVec, Registry } from '../types/index.js';
3
3
  /**
4
4
  * @name AbstractArray
5
5
  * @description
package/abstract/Array.js CHANGED
@@ -8,10 +8,6 @@ import { compareArray } from '../utils/compareArray.js';
8
8
  * @noInheritDoc
9
9
  */
10
10
  export class AbstractArray extends Array {
11
- registry;
12
- createdAtHash;
13
- initialU8aLength;
14
- isStorageFallback;
15
11
  /**
16
12
  * @description This ensures that operators such as clice, filter, map, etc. return
17
13
  * new Array instances (without this we need to apply overrides)
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, BareOpts, Codec, Inspect, IU8a, Registry } from '../types';
2
+ import type { AnyJson, BareOpts, Codec, Inspect, IU8a, Registry } from '../types/index.js';
3
3
  /**
4
4
  * @name Base
5
5
  * @description A type extends the Base class, when it holds a value
package/abstract/Base.js CHANGED
@@ -1,16 +1,14 @@
1
+ var _AbstractBase_raw;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
1
3
  /**
2
4
  * @name Base
3
5
  * @description A type extends the Base class, when it holds a value
4
6
  */
5
7
  export class AbstractBase {
6
- registry;
7
- createdAtHash;
8
- initialU8aLength;
9
- isStorageFallback;
10
- #raw;
11
8
  constructor(registry, value, initialU8aLength) {
9
+ _AbstractBase_raw.set(this, void 0);
12
10
  this.initialU8aLength = initialU8aLength;
13
- this.#raw = value;
11
+ __classPrivateFieldSet(this, _AbstractBase_raw, value, "f");
14
12
  this.registry = registry;
15
13
  }
16
14
  /**
@@ -29,73 +27,74 @@ export class AbstractBase {
29
27
  * @description returns the inner (wrapped value)
30
28
  */
31
29
  get inner() {
32
- return this.#raw;
30
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f");
33
31
  }
34
32
  /**
35
33
  * @description Checks if the value is an empty value
36
34
  */
37
35
  get isEmpty() {
38
- return this.#raw.isEmpty;
36
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").isEmpty;
39
37
  }
40
38
  /**
41
39
  * @description Compares the value of the input to see if there is a match
42
40
  */
43
41
  eq(other) {
44
- return this.#raw.eq(other);
42
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").eq(other);
45
43
  }
46
44
  /**
47
45
  * @description Returns a breakdown of the hex encoding for this Codec
48
46
  */
49
47
  inspect() {
50
- return this.#raw.inspect();
48
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").inspect();
51
49
  }
52
50
  /**
53
51
  * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
54
52
  */
55
53
  toHex(isLe) {
56
- return this.#raw.toHex(isLe);
54
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").toHex(isLe);
57
55
  }
58
56
  /**
59
57
  * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
60
58
  */
61
59
  toHuman(isExtended) {
62
- return this.#raw.toHuman(isExtended);
60
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").toHuman(isExtended);
63
61
  }
64
62
  /**
65
63
  * @description Converts the Object to JSON, typically used for RPC transfers
66
64
  */
67
65
  toJSON() {
68
- return this.#raw.toJSON();
66
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").toJSON();
69
67
  }
70
68
  /**
71
69
  * @description Converts the value in a best-fit primitive form
72
70
  */
73
71
  toPrimitive() {
74
- return this.#raw.toPrimitive();
72
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").toPrimitive();
75
73
  }
76
74
  /**
77
75
  * @description Returns the string representation of the value
78
76
  */
79
77
  toString() {
80
- return this.#raw.toString();
78
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").toString();
81
79
  }
82
80
  /**
83
81
  * @description Encodes the value as a Uint8Array as per the SCALE specifications
84
82
  * @param isBare true when the value has none of the type-specific prefixes (internal)
85
83
  */
86
84
  toU8a(isBare) {
87
- return this.#raw.toU8a(isBare);
85
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f").toU8a(isBare);
88
86
  }
89
87
  /**
90
88
  * @description Returns the inner wrapped value (equivalent to valueOf)
91
89
  */
92
90
  unwrap() {
93
- return this.#raw;
91
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f");
94
92
  }
95
93
  /**
96
94
  * @description Returns the inner wrapped value
97
95
  */
98
96
  valueOf() {
99
- return this.#raw;
97
+ return __classPrivateFieldGet(this, _AbstractBase_raw, "f");
100
98
  }
101
- }
99
+ }
100
+ _AbstractBase_raw = new WeakMap();
package/abstract/Int.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="bn.js" />
2
2
  import type { HexString } from '@polkadot/util/types';
3
- import type { AnyNumber, Inspect, INumber, IU8a, Registry, UIntBitLength } from '../types';
3
+ import type { AnyNumber, Inspect, INumber, IU8a, Registry, UIntBitLength } from '../types/index.js';
4
4
  import { BN } from '@polkadot/util';
5
5
  export declare const DEFAULT_UINT_BITS = 64;
6
6
  /**
package/abstract/Int.js CHANGED
@@ -1,7 +1,9 @@
1
+ var _AbstractInt_bitLength;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
1
3
  import { BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBigInt, isBn, isFunction, isHex, isNumber, isObject, isString, isU8a, u8aToBn, u8aToNumber } from '@polkadot/util';
2
4
  export const DEFAULT_UINT_BITS = 64;
3
5
  const MAX_NUMBER_BITS = 52;
4
- const MUL_P = new BN(1_00_00);
6
+ const MUL_P = new BN(10000);
5
7
  const FORMATTERS = [
6
8
  ['Perquintill', BN_QUINTILL],
7
9
  ['Perbill', BN_BILLION],
@@ -58,13 +60,6 @@ function decodeAbstractInt(value, isNegative) {
58
60
  * @noInheritDoc
59
61
  */
60
62
  export class AbstractInt extends BN {
61
- registry;
62
- encodedLength;
63
- isUnsigned;
64
- createdAtHash;
65
- initialU8aLength;
66
- isStorageFallback;
67
- #bitLength;
68
63
  constructor(registry, value = 0, bitLength = DEFAULT_UINT_BITS, isSigned = false) {
69
64
  // Construct via a string/number, which will be passed in the BN constructor.
70
65
  // It would be ideal to actually return a BN, but there is an issue:
@@ -76,10 +71,11 @@ export class AbstractInt extends BN {
76
71
  ? u8aToNumber(value.subarray(0, bitLength / 8), { isNegative: isSigned })
77
72
  : u8aToBn(value.subarray(0, bitLength / 8), { isLe: true, isNegative: isSigned }).toString()
78
73
  : decodeAbstractInt(value, isSigned));
74
+ _AbstractInt_bitLength.set(this, void 0);
79
75
  this.registry = registry;
80
- this.#bitLength = bitLength;
81
- this.encodedLength = this.#bitLength / 8;
82
- this.initialU8aLength = this.#bitLength / 8;
76
+ __classPrivateFieldSet(this, _AbstractInt_bitLength, bitLength, "f");
77
+ this.encodedLength = __classPrivateFieldGet(this, _AbstractInt_bitLength, "f") / 8;
78
+ this.initialU8aLength = __classPrivateFieldGet(this, _AbstractInt_bitLength, "f") / 8;
83
79
  this.isUnsigned = !isSigned;
84
80
  const isNegative = this.isNeg();
85
81
  const maxBits = bitLength - (isSigned && !isNegative ? 1 : 0);
@@ -106,7 +102,7 @@ export class AbstractInt extends BN {
106
102
  * @description Returns the number of bits in the value
107
103
  */
108
104
  bitLength() {
109
- return this.#bitLength;
105
+ return __classPrivateFieldGet(this, _AbstractInt_bitLength, "f");
110
106
  }
111
107
  /**
112
108
  * @description Compares the value of the input to see if there is a match
@@ -132,7 +128,7 @@ export class AbstractInt extends BN {
132
128
  */
133
129
  isMax() {
134
130
  const u8a = this.toU8a().filter((b) => b === 0xff);
135
- return u8a.length === (this.#bitLength / 8);
131
+ return u8a.length === (__classPrivateFieldGet(this, _AbstractInt_bitLength, "f") / 8);
136
132
  }
137
133
  /**
138
134
  * @description Returns a BigInt representation of the number
@@ -226,4 +222,5 @@ export class AbstractInt extends BN {
226
222
  isNegative: !this.isUnsigned
227
223
  });
228
224
  }
229
- }
225
+ }
226
+ _AbstractInt_bitLength = new WeakMap();
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, BareOpts, CodecObject, Inspect, IU8a, Registry, ToString } from '../types';
2
+ import type { AnyJson, BareOpts, CodecObject, Inspect, IU8a, Registry, ToString } from '../types/index.js';
3
3
  /**
4
4
  * @name Object
5
5
  * @description A type extends the Base class, when it holds a value
@@ -3,11 +3,6 @@
3
3
  * @description A type extends the Base class, when it holds a value
4
4
  */
5
5
  export class AbstractObject {
6
- registry;
7
- createdAtHash;
8
- initialU8aLength;
9
- isStorageFallback;
10
- $;
11
6
  constructor(registry, value, initialU8aLength) {
12
7
  this.$ = value;
13
8
  this.initialU8aLength = initialU8aLength;
@@ -1,3 +1,3 @@
1
- export { AbstractArray } from './Array';
2
- export { AbstractBase } from './Base';
3
- export { AbstractInt } from './Int';
1
+ export { AbstractArray } from './Array.js';
2
+ export { AbstractBase } from './Base.js';
3
+ export { AbstractInt } from './Int.js';
package/base/Compact.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="bn.js" />
2
2
  import type { BN } from '@polkadot/util';
3
3
  import type { HexString } from '@polkadot/util/types';
4
- import type { AnyJson, AnyNumber, CodecClass, ICompact, Inspect, INumber, IU8a, Registry } from '../types';
4
+ import type { AnyJson, AnyNumber, CodecClass, ICompact, Inspect, INumber, IU8a, Registry } from '../types/index.js';
5
5
  interface Options<T> {
6
6
  definition?: CodecClass<T>;
7
7
  setDefinition?: (d: CodecClass<T>) => CodecClass<T>;
package/base/Compact.js CHANGED
@@ -1,3 +1,5 @@
1
+ var _Compact_Type, _Compact_raw;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
1
3
  import { compactFromU8a, compactFromU8aLim, compactToU8a, isU8a } from '@polkadot/util';
2
4
  import { typeToConstructor } from '../utils/index.js';
3
5
  function noopSetDefinition(d) {
@@ -30,18 +32,14 @@ function decodeCompact(registry, Type, value) {
30
32
  * a number and making the compact representation thereof
31
33
  */
32
34
  export class Compact {
33
- registry;
34
- createdAtHash;
35
- initialU8aLength;
36
- isStorageFallback;
37
- #Type;
38
- #raw;
39
35
  constructor(registry, Type, value = 0, { definition, setDefinition = noopSetDefinition } = {}) {
36
+ _Compact_Type.set(this, void 0);
37
+ _Compact_raw.set(this, void 0);
40
38
  this.registry = registry;
41
- this.#Type = definition || setDefinition(typeToConstructor(registry, Type));
42
- const [raw, decodedLength] = decodeCompact(registry, this.#Type, value);
39
+ __classPrivateFieldSet(this, _Compact_Type, definition || setDefinition(typeToConstructor(registry, Type)), "f");
40
+ const [raw, decodedLength] = decodeCompact(registry, __classPrivateFieldGet(this, _Compact_Type, "f"), value);
43
41
  this.initialU8aLength = decodedLength;
44
- this.#raw = raw;
42
+ __classPrivateFieldSet(this, _Compact_raw, raw, "f");
45
43
  }
46
44
  static with(Type) {
47
45
  let definition;
@@ -69,20 +67,20 @@ export class Compact {
69
67
  * @description Checks if the value is an empty value
70
68
  */
71
69
  get isEmpty() {
72
- return this.#raw.isEmpty;
70
+ return __classPrivateFieldGet(this, _Compact_raw, "f").isEmpty;
73
71
  }
74
72
  /**
75
73
  * @description Returns the number of bits in the value
76
74
  */
77
75
  bitLength() {
78
- return this.#raw.bitLength();
76
+ return __classPrivateFieldGet(this, _Compact_raw, "f").bitLength();
79
77
  }
80
78
  /**
81
79
  * @description Compares the value of the input to see if there is a match
82
80
  */
83
81
  eq(other) {
84
- return this.#raw.eq(other instanceof Compact
85
- ? other.#raw
82
+ return __classPrivateFieldGet(this, _Compact_raw, "f").eq(other instanceof Compact
83
+ ? __classPrivateFieldGet(other, _Compact_raw, "f")
86
84
  : other);
87
85
  }
88
86
  /**
@@ -97,55 +95,55 @@ export class Compact {
97
95
  * @description Returns a BigInt representation of the number
98
96
  */
99
97
  toBigInt() {
100
- return this.#raw.toBigInt();
98
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toBigInt();
101
99
  }
102
100
  /**
103
101
  * @description Returns the BN representation of the number
104
102
  */
105
103
  toBn() {
106
- return this.#raw.toBn();
104
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toBn();
107
105
  }
108
106
  /**
109
107
  * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
110
108
  */
111
109
  toHex(isLe) {
112
- return this.#raw.toHex(isLe);
110
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toHex(isLe);
113
111
  }
114
112
  /**
115
113
  * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
116
114
  */
117
115
  toHuman(isExtended) {
118
- return this.#raw.toHuman(isExtended);
116
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toHuman(isExtended);
119
117
  }
120
118
  /**
121
119
  * @description Converts the Object to JSON, typically used for RPC transfers
122
120
  */
123
121
  toJSON() {
124
- return this.#raw.toJSON();
122
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toJSON();
125
123
  }
126
124
  /**
127
125
  * @description Returns the number representation for the value
128
126
  */
129
127
  toNumber() {
130
- return this.#raw.toNumber();
128
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toNumber();
131
129
  }
132
130
  /**
133
131
  * @description Converts the value in a best-fit primitive form
134
132
  */
135
133
  toPrimitive() {
136
- return this.#raw.toPrimitive();
134
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toPrimitive();
137
135
  }
138
136
  /**
139
137
  * @description Returns the base runtime type name for this instance
140
138
  */
141
139
  toRawType() {
142
- return `Compact<${this.registry.getClassName(this.#Type) || this.#raw.toRawType()}>`;
140
+ return `Compact<${this.registry.getClassName(__classPrivateFieldGet(this, _Compact_Type, "f")) || __classPrivateFieldGet(this, _Compact_raw, "f").toRawType()}>`;
143
141
  }
144
142
  /**
145
143
  * @description Returns the string representation of the value
146
144
  */
147
145
  toString() {
148
- return this.#raw.toString();
146
+ return __classPrivateFieldGet(this, _Compact_raw, "f").toString();
149
147
  }
150
148
  /**
151
149
  * @description Encodes the value as a Uint8Array as per the SCALE specifications
@@ -153,12 +151,13 @@ export class Compact {
153
151
  */
154
152
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
155
153
  toU8a(isBare) {
156
- return compactToU8a(this.#raw.toBn());
154
+ return compactToU8a(__classPrivateFieldGet(this, _Compact_raw, "f").toBn());
157
155
  }
158
156
  /**
159
157
  * @description Returns the embedded [[UInt]] or [[Moment]] value
160
158
  */
161
159
  unwrap() {
162
- return this.#raw;
160
+ return __classPrivateFieldGet(this, _Compact_raw, "f");
163
161
  }
164
- }
162
+ }
163
+ _Compact_Type = new WeakMap(), _Compact_raw = new WeakMap();
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, CodecClass, Inspect, IU8a, Registry } from '../types';
2
+ import type { AnyJson, Codec, CodecClass, Inspect, IU8a, Registry } from '../types/index.js';
3
3
  /**
4
4
  * @name DoNotConstruct
5
5
  * @description
@@ -1,17 +1,16 @@
1
+ var _DoNotConstruct_neverError;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
1
3
  /**
2
4
  * @name DoNotConstruct
3
5
  * @description
4
6
  * An unknown type that fails on construction with the type info
5
7
  */
6
8
  export class DoNotConstruct {
7
- registry;
8
- createdAtHash;
9
- isStorageFallback;
10
- #neverError;
11
9
  constructor(registry, typeName = 'DoNotConstruct') {
10
+ _DoNotConstruct_neverError.set(this, void 0);
12
11
  this.registry = registry;
13
- this.#neverError = new Error(`DoNotConstruct: Cannot construct unknown type ${typeName}`);
14
- throw this.#neverError;
12
+ __classPrivateFieldSet(this, _DoNotConstruct_neverError, new Error(`DoNotConstruct: Cannot construct unknown type ${typeName}`), "f");
13
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
15
14
  }
16
15
  static with(typeName) {
17
16
  return class extends DoNotConstruct {
@@ -24,45 +23,46 @@ export class DoNotConstruct {
24
23
  * @description The length of the value when encoded as a Uint8Array
25
24
  */
26
25
  get encodedLength() {
27
- throw this.#neverError;
26
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
28
27
  }
29
28
  /**
30
29
  * @description returns a hash of the contents
31
30
  */
32
31
  get hash() {
33
- throw this.#neverError;
32
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
34
33
  }
35
34
  /**
36
35
  * @description Checks if the value is an empty value (always true)
37
36
  */
38
37
  get isEmpty() {
39
- throw this.#neverError;
38
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
40
39
  }
41
40
  eq() {
42
- throw this.#neverError;
41
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
43
42
  }
44
43
  inspect() {
45
- throw this.#neverError;
44
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
46
45
  }
47
46
  toHex() {
48
- throw this.#neverError;
47
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
49
48
  }
50
49
  toHuman() {
51
- throw this.#neverError;
50
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
52
51
  }
53
52
  toJSON() {
54
- throw this.#neverError;
53
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
55
54
  }
56
55
  toPrimitive() {
57
- throw this.#neverError;
56
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
58
57
  }
59
58
  toRawType() {
60
- throw this.#neverError;
59
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
61
60
  }
62
61
  toString() {
63
- throw this.#neverError;
62
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
64
63
  }
65
64
  toU8a() {
66
- throw this.#neverError;
65
+ throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
67
66
  }
68
- }
67
+ }
68
+ _DoNotConstruct_neverError = new WeakMap();
package/base/Enum.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, CodecClass, IEnum, Inspect, IU8a, Registry } from '../types';
2
+ import type { AnyJson, Codec, CodecClass, IEnum, Inspect, IU8a, Registry } from '../types/index.js';
3
3
  export interface EnumCodecClass<T = Codec> {
4
4
  new (registry: Registry, value?: any, index?: number): T;
5
5
  }