@polkadot/types-codec 9.5.2 → 9.6.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 (152) hide show
  1. package/abstract/Array.js +15 -44
  2. package/abstract/Base.js +12 -28
  3. package/abstract/BigInt.js +3 -2
  4. package/abstract/Int.js +25 -52
  5. package/abstract/index.js +1 -0
  6. package/base/Compact.js +21 -45
  7. package/base/DoNotConstruct.js +3 -19
  8. package/base/Enum.js +37 -88
  9. package/base/Int.js +2 -5
  10. package/base/Null.js +12 -23
  11. package/base/Option.js +23 -59
  12. package/base/Result.js +8 -19
  13. package/base/Tuple.js +12 -29
  14. package/base/UInt.js +2 -4
  15. package/base/Vec.js +7 -25
  16. package/base/VecAny.js +2 -2
  17. package/base/VecFixed.js +8 -20
  18. package/base/index.js +1 -0
  19. package/bundle.js +1 -0
  20. package/cjs/abstract/Array.js +13 -47
  21. package/cjs/abstract/Base.js +12 -30
  22. package/cjs/abstract/BigInt.js +1 -4
  23. package/cjs/abstract/Int.js +25 -55
  24. package/cjs/abstract/index.js +0 -3
  25. package/cjs/base/Compact.js +21 -48
  26. package/cjs/base/DoNotConstruct.js +3 -21
  27. package/cjs/base/Enum.js +34 -92
  28. package/cjs/base/Int.js +0 -7
  29. package/cjs/base/Null.js +10 -25
  30. package/cjs/base/Option.js +23 -63
  31. package/cjs/base/Result.js +6 -21
  32. package/cjs/base/Tuple.js +12 -33
  33. package/cjs/base/UInt.js +0 -6
  34. package/cjs/base/Vec.js +7 -31
  35. package/cjs/base/VecAny.js +0 -4
  36. package/cjs/base/VecFixed.js +8 -25
  37. package/cjs/base/index.js +0 -12
  38. package/cjs/bundle.js +0 -13
  39. package/cjs/detectPackage.js +2 -4
  40. package/cjs/extended/BTreeMap.js +1 -5
  41. package/cjs/extended/BTreeSet.js +17 -57
  42. package/cjs/extended/BitVec.js +11 -25
  43. package/cjs/extended/Bytes.js +9 -20
  44. package/cjs/extended/HashMap.js +1 -5
  45. package/cjs/extended/Linkage.js +5 -20
  46. package/cjs/extended/Map.js +16 -62
  47. package/cjs/extended/OptionBool.js +8 -21
  48. package/cjs/extended/Range.js +3 -13
  49. package/cjs/extended/RangeInclusive.js +1 -6
  50. package/cjs/extended/Type.js +1 -7
  51. package/cjs/extended/U8aFixed.js +2 -15
  52. package/cjs/extended/WrapperKeepOpaque.js +8 -28
  53. package/cjs/extended/WrapperOpaque.js +2 -8
  54. package/cjs/extended/index.js +0 -14
  55. package/cjs/index.js +0 -3
  56. package/cjs/native/Bool.js +14 -32
  57. package/cjs/native/Date.js +18 -40
  58. package/cjs/native/Float.js +11 -29
  59. package/cjs/native/Json.js +14 -33
  60. package/cjs/native/Raw.js +18 -41
  61. package/cjs/native/Set.js +21 -67
  62. package/cjs/native/Struct.data.js +1 -0
  63. package/cjs/native/Struct.js +33 -83
  64. package/cjs/native/Text.js +20 -44
  65. package/cjs/native/index.js +0 -8
  66. package/cjs/packageInfo.js +3 -1
  67. package/cjs/primitive/F32.js +0 -3
  68. package/cjs/primitive/F64.js +0 -3
  69. package/cjs/primitive/I128.js +0 -3
  70. package/cjs/primitive/I16.js +0 -3
  71. package/cjs/primitive/I256.js +0 -3
  72. package/cjs/primitive/I32.js +0 -3
  73. package/cjs/primitive/I64.js +0 -3
  74. package/cjs/primitive/I8.js +0 -3
  75. package/cjs/primitive/U128.js +0 -3
  76. package/cjs/primitive/U16.js +0 -3
  77. package/cjs/primitive/U256.js +0 -3
  78. package/cjs/primitive/U32.js +0 -3
  79. package/cjs/primitive/U64.js +0 -3
  80. package/cjs/primitive/U8.js +0 -3
  81. package/cjs/primitive/USize.js +0 -4
  82. package/cjs/primitive/index.js +0 -15
  83. package/cjs/types/index.js +0 -8
  84. package/cjs/utils/compareArray.js +1 -4
  85. package/cjs/utils/compareMap.js +4 -9
  86. package/cjs/utils/compareSet.js +4 -6
  87. package/cjs/utils/decodeU8a.js +10 -18
  88. package/cjs/utils/index.js +0 -9
  89. package/cjs/utils/mapToTypeMap.js +0 -4
  90. package/cjs/utils/sanitize.js +66 -71
  91. package/cjs/utils/sortValues.js +5 -18
  92. package/cjs/utils/typeToConstructor.js +1 -2
  93. package/cjs/utils/typesToMap.js +1 -3
  94. package/cjs/utils/util.js +1 -2
  95. package/detectOther.js +2 -0
  96. package/detectPackage.js +2 -0
  97. package/extended/BTreeMap.js +1 -2
  98. package/extended/BTreeSet.js +17 -53
  99. package/extended/BitVec.js +13 -22
  100. package/extended/Bytes.js +11 -17
  101. package/extended/HashMap.js +1 -2
  102. package/extended/Linkage.js +5 -12
  103. package/extended/Map.js +16 -54
  104. package/extended/OptionBool.js +8 -17
  105. package/extended/Range.js +4 -11
  106. package/extended/RangeInclusive.js +1 -3
  107. package/extended/Type.js +3 -4
  108. package/extended/U8aFixed.js +4 -12
  109. package/extended/WrapperKeepOpaque.js +8 -23
  110. package/extended/WrapperOpaque.js +2 -5
  111. package/extended/index.js +1 -0
  112. package/index.js +1 -0
  113. package/native/Bool.js +16 -30
  114. package/native/Date.js +18 -37
  115. package/native/Float.js +12 -27
  116. package/native/Json.js +16 -30
  117. package/native/Raw.js +20 -39
  118. package/native/Set.js +21 -63
  119. package/native/Struct.data.js +1 -0
  120. package/native/Struct.js +33 -80
  121. package/native/Text.js +20 -40
  122. package/native/index.js +1 -0
  123. package/package.json +2 -2
  124. package/packageInfo.js +3 -1
  125. package/primitive/F32.js +2 -1
  126. package/primitive/F64.js +2 -1
  127. package/primitive/I128.js +2 -1
  128. package/primitive/I16.js +2 -1
  129. package/primitive/I256.js +2 -1
  130. package/primitive/I32.js +2 -1
  131. package/primitive/I64.js +2 -1
  132. package/primitive/I8.js +2 -1
  133. package/primitive/U128.js +2 -1
  134. package/primitive/U16.js +2 -1
  135. package/primitive/U256.js +2 -1
  136. package/primitive/U32.js +2 -1
  137. package/primitive/U64.js +2 -1
  138. package/primitive/U8.js +2 -1
  139. package/primitive/USize.js +2 -2
  140. package/primitive/index.js +1 -0
  141. package/types/index.js +1 -0
  142. package/utils/compareArray.js +4 -3
  143. package/utils/compareMap.js +4 -7
  144. package/utils/compareSet.js +4 -5
  145. package/utils/decodeU8a.js +12 -15
  146. package/utils/index.js +1 -0
  147. package/utils/mapToTypeMap.js +2 -3
  148. package/utils/sanitize.js +66 -60
  149. package/utils/sortValues.js +6 -15
  150. package/utils/typeToConstructor.js +1 -0
  151. package/utils/typesToMap.js +1 -2
  152. package/utils/util.js +1 -0
@@ -1,25 +1,23 @@
1
1
  // Copyright 2017-2022 @polkadot/types-codec authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  import { compactFromU8aLim, compactToU8a, isHex, isU8a, logger, stringify, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
4
5
  import { compareSet, decodeU8aVec, sortSet, typeToConstructor } from "../utils/index.js";
5
6
  const l = logger('BTreeSet');
6
- /** @internal */
7
7
 
8
+ /** @internal */
8
9
  function decodeSetFromU8a(registry, ValClass, u8a) {
9
10
  const output = new Set();
10
11
  const [offset, count] = compactFromU8aLim(u8a);
11
12
  const result = new Array(count);
12
13
  const [decodedLength] = decodeU8aVec(registry, result, u8a, offset, ValClass);
13
-
14
14
  for (let i = 0; i < count; i++) {
15
15
  output.add(result[i]);
16
16
  }
17
-
18
17
  return [ValClass, output, decodedLength];
19
18
  }
20
- /** @internal */
21
-
22
19
 
20
+ /** @internal */
23
21
  function decodeSetFromSet(registry, ValClass, value) {
24
22
  const output = new Set();
25
23
  value.forEach(val => {
@@ -32,6 +30,7 @@ function decodeSetFromSet(registry, ValClass, value) {
32
30
  });
33
31
  return [ValClass, output, 0];
34
32
  }
33
+
35
34
  /**
36
35
  * Decode input to pass into constructor.
37
36
  *
@@ -46,11 +45,8 @@ function decodeSetFromSet(registry, ValClass, value) {
46
45
  * @param jsonSet
47
46
  * @internal
48
47
  */
49
-
50
-
51
48
  function decodeSet(registry, valType, value) {
52
49
  const ValClass = typeToConstructor(registry, valType);
53
-
54
50
  if (!value) {
55
51
  return [ValClass, new Set(), 0];
56
52
  } else if (isU8a(value) || isHex(value)) {
@@ -58,13 +54,10 @@ function decodeSet(registry, valType, value) {
58
54
  } else if (Array.isArray(value) || value instanceof Set) {
59
55
  return decodeSetFromSet(registry, ValClass, value);
60
56
  }
61
-
62
57
  throw new Error('BTreeSet: cannot decode type');
63
58
  }
64
-
65
59
  export class BTreeSet extends Set {
66
60
  #ValClass;
67
-
68
61
  constructor(registry, valType, rawValue) {
69
62
  const [ValClass, values, decodedLength] = decodeSet(registry, valType, rawValue);
70
63
  super(sortSet(values));
@@ -72,162 +65,133 @@ export class BTreeSet extends Set {
72
65
  this.initialU8aLength = decodedLength;
73
66
  this.#ValClass = ValClass;
74
67
  }
75
-
76
68
  static with(valType) {
77
69
  return class extends BTreeSet {
78
70
  constructor(registry, value) {
79
71
  super(registry, valType, value);
80
72
  }
81
-
82
73
  };
83
74
  }
75
+
84
76
  /**
85
77
  * @description The length of the value when encoded as a Uint8Array
86
78
  */
87
-
88
-
89
79
  get encodedLength() {
90
80
  let len = compactToU8a(this.size).length;
91
-
92
81
  for (const v of this.values()) {
93
82
  len += v.encodedLength;
94
83
  }
95
-
96
84
  return len;
97
85
  }
86
+
98
87
  /**
99
88
  * @description Returns a hash of the value
100
89
  */
101
-
102
-
103
90
  get hash() {
104
91
  return this.registry.hash(this.toU8a());
105
92
  }
93
+
106
94
  /**
107
95
  * @description Checks if the value is an empty value
108
96
  */
109
-
110
-
111
97
  get isEmpty() {
112
98
  return this.size === 0;
113
99
  }
100
+
114
101
  /**
115
102
  * @description The actual set values as a string[]
116
103
  */
117
-
118
-
119
104
  get strings() {
120
105
  return [...super.values()].map(v => v.toString());
121
106
  }
107
+
122
108
  /**
123
109
  * @description Compares the value of the input to see if there is a match
124
110
  */
125
-
126
-
127
111
  eq(other) {
128
112
  return compareSet(this, other);
129
113
  }
114
+
130
115
  /**
131
116
  * @description Returns a breakdown of the hex encoding for this Codec
132
117
  */
133
-
134
-
135
118
  inspect() {
136
119
  const inner = new Array();
137
-
138
120
  for (const v of this.values()) {
139
121
  inner.push(v.inspect());
140
122
  }
141
-
142
123
  return {
143
124
  inner,
144
125
  outer: [compactToU8a(this.size)]
145
126
  };
146
127
  }
128
+
147
129
  /**
148
130
  * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
149
131
  */
150
-
151
-
152
132
  toHex() {
153
133
  return u8aToHex(this.toU8a());
154
134
  }
135
+
155
136
  /**
156
137
  * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
157
138
  */
158
-
159
-
160
139
  toHuman(isExtended) {
161
140
  const json = [];
162
-
163
141
  for (const v of this.values()) {
164
142
  json.push(v.toHuman(isExtended));
165
143
  }
166
-
167
144
  return json;
168
145
  }
146
+
169
147
  /**
170
148
  * @description Converts the Object to JSON, typically used for RPC transfers
171
149
  */
172
-
173
-
174
150
  toJSON() {
175
151
  const json = [];
176
-
177
152
  for (const v of this.values()) {
178
153
  json.push(v.toJSON());
179
154
  }
180
-
181
155
  return json;
182
156
  }
157
+
183
158
  /**
184
159
  * @description Returns the base runtime type name for this instance
185
160
  */
186
-
187
-
188
161
  toRawType() {
189
162
  return `BTreeSet<${this.registry.getClassName(this.#ValClass) || new this.#ValClass(this.registry).toRawType()}>`;
190
163
  }
164
+
191
165
  /**
192
166
  * @description Converts the value in a best-fit primitive form
193
167
  */
194
-
195
-
196
168
  toPrimitive() {
197
169
  const json = [];
198
-
199
170
  for (const v of this.values()) {
200
171
  json.push(v.toPrimitive());
201
172
  }
202
-
203
173
  return json;
204
174
  }
175
+
205
176
  /**
206
177
  * @description Returns the string representation of the value
207
178
  */
208
-
209
-
210
179
  toString() {
211
180
  return stringify(this.toJSON());
212
181
  }
182
+
213
183
  /**
214
184
  * @description Encodes the value as a Uint8Array as per the SCALE specifications
215
185
  * @param isBare true when the value has none of the type-specific prefixes (internal)
216
186
  */
217
-
218
-
219
187
  toU8a(isBare) {
220
188
  const encoded = new Array();
221
-
222
189
  if (!isBare) {
223
190
  encoded.push(compactToU8a(this.size));
224
191
  }
225
-
226
192
  for (const v of this.values()) {
227
193
  encoded.push(v.toU8a(isBare));
228
194
  }
229
-
230
195
  return u8aConcatStrict(encoded);
231
196
  }
232
-
233
197
  }
@@ -1,94 +1,85 @@
1
1
  // Copyright 2017-2022 @polkadot/types-codec authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  import { compactFromU8aLim, compactToU8a, isString, u8aConcatStrict, u8aToU8a } from '@polkadot/util';
4
5
  import { Raw } from "../native/Raw.js";
5
- /** @internal */
6
6
 
7
+ /** @internal */
7
8
  function decodeBitVecU8a(value) {
8
9
  if (!value || !value.length) {
9
10
  return [0, new Uint8Array()];
10
- } // handle all other Uint8Array inputs, these do have a length prefix which is the number of bits encoded
11
-
11
+ }
12
12
 
13
+ // handle all other Uint8Array inputs, these do have a length prefix which is the number of bits encoded
13
14
  const [offset, length] = compactFromU8aLim(value);
14
15
  const total = offset + Math.ceil(length / 8);
15
-
16
16
  if (total > value.length) {
17
17
  throw new Error(`BitVec: required length less than remainder, expected at least ${total}, found ${value.length}`);
18
18
  }
19
-
20
19
  return [length, value.subarray(offset, total)];
21
20
  }
22
- /** @internal */
23
-
24
21
 
22
+ /** @internal */
25
23
  function decodeBitVec(value) {
26
24
  if (Array.isArray(value) || isString(value)) {
27
25
  const u8a = u8aToU8a(value);
28
26
  return [u8a.length / 8, u8a];
29
27
  }
30
-
31
28
  return decodeBitVecU8a(value);
32
29
  }
30
+
33
31
  /**
34
32
  * @name BitVec
35
33
  * @description
36
34
  * A BitVec that represents an array of bits. The bits are however stored encoded. The difference between this
37
35
  * and a normal Bytes would be that the length prefix indicates the number of bits encoded, not the bytes
38
36
  */
39
-
40
-
41
37
  export class BitVec extends Raw {
42
38
  #decodedLength;
43
- #isMsb; // In lieu of having the Msb/Lsb identifiers passed through, we default to assuming
39
+ #isMsb;
40
+
41
+ // In lieu of having the Msb/Lsb identifiers passed through, we default to assuming
44
42
  // we are dealing with Lsb, which is the default (as of writing) BitVec format used
45
43
  // in the Polkadot code (this only affects the toHuman displays)
46
-
47
44
  constructor(registry, value, isMsb = false) {
48
45
  const [decodedLength, u8a] = decodeBitVec(value);
49
46
  super(registry, u8a);
50
47
  this.#decodedLength = decodedLength;
51
48
  this.#isMsb = isMsb;
52
49
  }
50
+
53
51
  /**
54
52
  * @description The length of the value when encoded as a Uint8Array
55
53
  */
56
-
57
-
58
54
  get encodedLength() {
59
55
  return this.length + compactToU8a(this.#decodedLength).length;
60
56
  }
57
+
61
58
  /**
62
59
  * @description Returns a breakdown of the hex encoding for this Codec
63
60
  */
64
-
65
-
66
61
  inspect() {
67
62
  return {
68
63
  outer: [compactToU8a(this.#decodedLength), super.toU8a()]
69
64
  };
70
65
  }
71
-
72
66
  toHuman() {
73
67
  return `0b${[...this.toU8a(true)].map(d => `00000000${d.toString(2)}`.slice(-8)).map(s => this.#isMsb ? s : s.split('').reverse().join('')).join('_')}`;
74
68
  }
69
+
75
70
  /**
76
71
  * @description Returns the base runtime type name for this instance
77
72
  */
78
-
79
-
80
73
  toRawType() {
81
74
  return 'BitVec';
82
75
  }
76
+
83
77
  /**
84
78
  * @description Encodes the value as a Uint8Array as per the SCALE specifications
85
79
  * @param isBare true when the value has none of the type-specific prefixes (internal)
86
80
  */
87
-
88
-
89
81
  toU8a(isBare) {
90
82
  const bitVec = super.toU8a();
91
83
  return isBare ? bitVec : u8aConcatStrict([compactToU8a(this.#decodedLength), bitVec]);
92
84
  }
93
-
94
85
  }
package/extended/Bytes.js CHANGED
@@ -1,28 +1,29 @@
1
1
  // Copyright 2017-2022 @polkadot/types-codec authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  import { compactAddLength, compactFromU8aLim, compactToU8a, isString, isU8a, u8aToU8a } from '@polkadot/util';
4
- import { Raw } from "../native/Raw.js"; // Bytes are used for things like on-chain code, so it has a healthy limit
5
+ import { Raw } from "../native/Raw.js";
5
6
 
7
+ // Bytes are used for things like on-chain code, so it has a healthy limit
6
8
  const MAX_LENGTH = 10 * 1024 * 1024;
7
- /** @internal */
8
9
 
10
+ /** @internal */
9
11
  function decodeBytesU8a(value) {
10
12
  if (!value.length) {
11
13
  return [new Uint8Array(), 0];
12
- } // handle all other Uint8Array inputs, these do have a length prefix
13
-
14
+ }
14
15
 
16
+ // handle all other Uint8Array inputs, these do have a length prefix
15
17
  const [offset, length] = compactFromU8aLim(value);
16
18
  const total = offset + length;
17
-
18
19
  if (length > MAX_LENGTH) {
19
20
  throw new Error(`Bytes length ${length.toString()} exceeds ${MAX_LENGTH}`);
20
21
  } else if (total > value.length) {
21
22
  throw new Error(`Bytes: required length less than remainder, expected at least ${total}, found ${value.length}`);
22
23
  }
23
-
24
24
  return [value.subarray(offset, total), total];
25
25
  }
26
+
26
27
  /**
27
28
  * @name Bytes
28
29
  * @description
@@ -30,48 +31,41 @@ function decodeBytesU8a(value) {
30
31
  * is that this version allows for length-encoding. (i.e. it is a variable-item codec, the same
31
32
  * as what is found in [[Text]] and [[Vec]])
32
33
  */
33
-
34
-
35
34
  export class Bytes extends Raw {
36
35
  constructor(registry, value) {
37
36
  const [u8a, decodedLength] = isU8a(value) && !(value instanceof Raw) ? decodeBytesU8a(value) : Array.isArray(value) || isString(value) ? [u8aToU8a(value), 0] : [value, 0];
38
37
  super(registry, u8a, decodedLength);
39
38
  }
39
+
40
40
  /**
41
41
  * @description The length of the value when encoded as a Uint8Array
42
42
  */
43
-
44
-
45
43
  get encodedLength() {
46
44
  return this.length + compactToU8a(this.length).length;
47
45
  }
46
+
48
47
  /**
49
48
  * @description Returns a breakdown of the hex encoding for this Codec
50
49
  */
51
-
52
-
53
50
  inspect(isBare) {
54
51
  const clength = compactToU8a(this.length);
55
52
  return {
56
53
  outer: isBare ? [super.toU8a()] : this.length ? [clength, super.toU8a()] : [clength]
57
54
  };
58
55
  }
56
+
59
57
  /**
60
58
  * @description Returns the base runtime type name for this instance
61
59
  */
62
-
63
-
64
60
  toRawType() {
65
61
  return 'Bytes';
66
62
  }
63
+
67
64
  /**
68
65
  * @description Encodes the value as a Uint8Array as per the SCALE specifications
69
66
  * @param isBare true when the value has none of the type-specific prefixes (internal)
70
67
  */
71
-
72
-
73
68
  toU8a(isBare) {
74
69
  return isBare ? super.toU8a(isBare) : compactAddLength(this);
75
70
  }
76
-
77
71
  }
@@ -1,5 +1,6 @@
1
1
  // Copyright 2017-2022 @polkadot/types-codec authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  import { CodecMap } from "./Map.js";
4
5
  export class HashMap extends CodecMap {
5
6
  static with(keyType, valType) {
@@ -7,8 +8,6 @@ export class HashMap extends CodecMap {
7
8
  constructor(registry, value) {
8
9
  super(registry, keyType, valType, value);
9
10
  }
10
-
11
11
  };
12
12
  }
13
-
14
13
  }
@@ -1,15 +1,16 @@
1
1
  // Copyright 2017-2022 @polkadot/types-codec authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
3
4
  import { Option } from "../base/Option.js";
4
5
  import { Tuple } from "../base/Tuple.js";
5
6
  import { Vec } from "../base/Vec.js";
6
7
  import { Struct } from "../native/Struct.js";
7
8
  const EMPTY = new Uint8Array();
9
+
8
10
  /**
9
11
  * @name Linkage
10
12
  * @description The wrapper for the result from a LinkedMap
11
13
  */
12
-
13
14
  export class Linkage extends Struct {
14
15
  constructor(registry, Type, value) {
15
16
  super(registry, {
@@ -18,48 +19,41 @@ export class Linkage extends Struct {
18
19
  next: Option.with(Type)
19
20
  }, value);
20
21
  }
21
-
22
22
  static withKey(Type) {
23
23
  return class extends Linkage {
24
24
  constructor(registry, value) {
25
25
  super(registry, Type, value);
26
26
  }
27
-
28
27
  };
29
28
  }
30
-
31
29
  get previous() {
32
30
  return this.get('previous');
33
31
  }
34
-
35
32
  get next() {
36
33
  return this.get('next');
37
34
  }
35
+
38
36
  /**
39
37
  * @description Returns the base runtime type name for this instance
40
38
  */
41
-
42
-
43
39
  toRawType() {
44
40
  return `Linkage<${this.next.toRawType(true)}>`;
45
41
  }
42
+
46
43
  /**
47
44
  * @description Custom toU8a which with bare mode does not return the linkage if empty
48
45
  */
49
-
50
-
51
46
  toU8a() {
52
47
  // As part of a storage query (where these appear), in the case of empty, the values
53
48
  // are NOT populated by the node - follow the same logic, leaving it empty
54
49
  return this.isEmpty ? EMPTY : super.toU8a();
55
50
  }
56
-
57
51
  }
52
+
58
53
  /**
59
54
  * @name LinkageResult
60
55
  * @description A Linkage keys/Values tuple
61
56
  */
62
-
63
57
  export class LinkageResult extends Tuple {
64
58
  constructor(registry, [TypeKey, keys], [TypeValue, values]) {
65
59
  super(registry, {
@@ -67,5 +61,4 @@ export class LinkageResult extends Tuple {
67
61
  Values: Vec.with(TypeValue)
68
62
  }, [keys, values]);
69
63
  }
70
-
71
64
  }