@polkadot/types-codec 7.7.2-0 → 7.7.2-12

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 (70) hide show
  1. package/abstract/AbstractArray.cjs +27 -1
  2. package/abstract/AbstractArray.d.ts +7 -1
  3. package/abstract/AbstractArray.js +27 -1
  4. package/abstract/AbstractInt.cjs +10 -0
  5. package/abstract/AbstractInt.d.ts +5 -1
  6. package/abstract/AbstractInt.js +10 -0
  7. package/base/Base.cjs +8 -0
  8. package/base/Base.d.ts +5 -1
  9. package/base/Base.js +8 -0
  10. package/base/Compact.cjs +10 -0
  11. package/base/Compact.d.ts +5 -1
  12. package/base/Compact.js +10 -0
  13. package/base/DoNotConstruct.cjs +4 -0
  14. package/base/DoNotConstruct.d.ts +2 -1
  15. package/base/DoNotConstruct.js +4 -0
  16. package/base/Enum.cjs +22 -0
  17. package/base/Enum.d.ts +5 -1
  18. package/base/Enum.js +21 -0
  19. package/base/Null.cjs +8 -0
  20. package/base/Null.d.ts +5 -1
  21. package/base/Null.js +8 -0
  22. package/base/Option.cjs +22 -0
  23. package/base/Option.d.ts +5 -1
  24. package/base/Option.js +21 -0
  25. package/base/Tuple.cjs +11 -7
  26. package/base/Tuple.d.ts +5 -1
  27. package/base/Tuple.js +11 -7
  28. package/base/VecFixed.cjs +11 -6
  29. package/base/VecFixed.d.ts +5 -1
  30. package/base/VecFixed.js +11 -6
  31. package/extended/BTreeSet.cjs +17 -0
  32. package/extended/BTreeSet.d.ts +5 -1
  33. package/extended/BTreeSet.js +17 -0
  34. package/extended/BitVec.cjs +10 -0
  35. package/extended/BitVec.d.ts +5 -1
  36. package/extended/BitVec.js +10 -0
  37. package/extended/Bytes.cjs +11 -0
  38. package/extended/Bytes.d.ts +5 -1
  39. package/extended/Bytes.js +11 -0
  40. package/extended/Map.cjs +19 -1
  41. package/extended/Map.d.ts +5 -1
  42. package/extended/Map.js +19 -1
  43. package/extended/WrapperKeepOpaque.cjs +13 -0
  44. package/extended/WrapperKeepOpaque.d.ts +5 -1
  45. package/extended/WrapperKeepOpaque.js +14 -1
  46. package/native/Bool.cjs +10 -0
  47. package/native/Bool.d.ts +5 -1
  48. package/native/Bool.js +10 -0
  49. package/native/Date.cjs +13 -3
  50. package/native/Date.d.ts +7 -3
  51. package/native/Date.js +13 -3
  52. package/native/Json.cjs +8 -0
  53. package/native/Json.d.ts +5 -1
  54. package/native/Json.js +8 -0
  55. package/native/Raw.cjs +10 -0
  56. package/native/Raw.d.ts +5 -1
  57. package/native/Raw.js +10 -0
  58. package/native/Set.cjs +10 -0
  59. package/native/Set.d.ts +5 -1
  60. package/native/Set.js +10 -0
  61. package/native/Struct.cjs +18 -0
  62. package/native/Struct.d.ts +5 -1
  63. package/native/Struct.js +18 -0
  64. package/native/Text.cjs +11 -0
  65. package/native/Text.d.ts +5 -1
  66. package/native/Text.js +12 -1
  67. package/package.json +3 -3
  68. package/packageInfo.cjs +1 -1
  69. package/packageInfo.js +1 -1
  70. package/types/codec.d.ts +9 -0
@@ -83,6 +83,27 @@ class AbstractArray extends Array {
83
83
  eq(other) {
84
84
  return (0, _compareArray.compareArray)(this, other);
85
85
  }
86
+ /**
87
+ * @description Returns a breakdown of the hex encoding for this Codec
88
+ */
89
+
90
+
91
+ inspect() {
92
+ return {
93
+ inner: this.inspectInner(),
94
+ outer: [(0, _util.compactToU8a)(this.length)]
95
+ };
96
+ }
97
+
98
+ inspectInner() {
99
+ const inner = new Array(this.length);
100
+
101
+ for (let i = 0; i < this.length; i++) {
102
+ inner[i] = this[i].inspect();
103
+ }
104
+
105
+ return inner;
106
+ }
86
107
  /**
87
108
  * @description Converts the Object to an standard JavaScript Array
88
109
  */
@@ -151,13 +172,18 @@ class AbstractArray extends Array {
151
172
 
152
173
 
153
174
  toU8a(isBare) {
175
+ const encoded = this.toU8aInner();
176
+ return isBare ? (0, _util.u8aConcat)(...encoded) : (0, _util.u8aConcat)((0, _util.compactToU8a)(this.length), ...encoded);
177
+ }
178
+
179
+ toU8aInner(isBare) {
154
180
  const encoded = new Array(this.length);
155
181
 
156
182
  for (let i = 0; i < this.length; i++) {
157
183
  encoded[i] = this[i].toU8a(isBare);
158
184
  }
159
185
 
160
- return isBare ? (0, _util.u8aConcat)(...encoded) : (0, _util.u8aConcat)((0, _util.compactToU8a)(this.length), ...encoded);
186
+ return encoded;
161
187
  } // Below are methods that we override. When we do a `new Vec(...).map()`,
162
188
  // we want it to return an Array. We only override the methods that return a
163
189
  // new instance.
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, IU8a, IVec, Registry } from '../types';
2
+ import type { AnyJson, Codec, Inspect, IU8a, IVec, Registry } from '../types';
3
3
  /**
4
4
  * @name AbstractArray
5
5
  * @description
@@ -32,6 +32,11 @@ export declare abstract class AbstractArray<T extends Codec> extends Array<T> im
32
32
  * @description Compares the value of the input to see if there is a match
33
33
  */
34
34
  eq(other?: unknown): boolean;
35
+ /**
36
+ * @description Returns a breakdown of the hex encoding for this Codec
37
+ */
38
+ inspect(): Inspect;
39
+ inspectInner(): Inspect[];
35
40
  /**
36
41
  * @description Converts the Object to an standard JavaScript Array
37
42
  */
@@ -61,6 +66,7 @@ export declare abstract class AbstractArray<T extends Codec> extends Array<T> im
61
66
  * @param isBare true when the value has none of the type-specific prefixes (internal)
62
67
  */
63
68
  toU8a(isBare?: boolean): Uint8Array;
69
+ toU8aInner(isBare?: boolean): Uint8Array[];
64
70
  /**
65
71
  * @description Concatenates two arrays
66
72
  */
@@ -70,6 +70,27 @@ export class AbstractArray extends Array {
70
70
  eq(other) {
71
71
  return compareArray(this, other);
72
72
  }
73
+ /**
74
+ * @description Returns a breakdown of the hex encoding for this Codec
75
+ */
76
+
77
+
78
+ inspect() {
79
+ return {
80
+ inner: this.inspectInner(),
81
+ outer: [compactToU8a(this.length)]
82
+ };
83
+ }
84
+
85
+ inspectInner() {
86
+ const inner = new Array(this.length);
87
+
88
+ for (let i = 0; i < this.length; i++) {
89
+ inner[i] = this[i].inspect();
90
+ }
91
+
92
+ return inner;
93
+ }
73
94
  /**
74
95
  * @description Converts the Object to an standard JavaScript Array
75
96
  */
@@ -138,13 +159,18 @@ export class AbstractArray extends Array {
138
159
 
139
160
 
140
161
  toU8a(isBare) {
162
+ const encoded = this.toU8aInner();
163
+ return isBare ? u8aConcat(...encoded) : u8aConcat(compactToU8a(this.length), ...encoded);
164
+ }
165
+
166
+ toU8aInner(isBare) {
141
167
  const encoded = new Array(this.length);
142
168
 
143
169
  for (let i = 0; i < this.length; i++) {
144
170
  encoded[i] = this[i].toU8a(isBare);
145
171
  }
146
172
 
147
- return isBare ? u8aConcat(...encoded) : u8aConcat(compactToU8a(this.length), ...encoded);
173
+ return encoded;
148
174
  } // Below are methods that we override. When we do a `new Vec(...).map()`,
149
175
  // we want it to return an Array. We only override the methods that return a
150
176
  // new instance.
@@ -140,6 +140,16 @@ class AbstractInt extends _util.BN {
140
140
  isNegative: (0, _classPrivateFieldLooseBase2.default)(this, _isSigned)[_isSigned]
141
141
  }) : (0, _util.bnToBn)(other));
142
142
  }
143
+ /**
144
+ * @description Returns a breakdown of the hex encoding for this Codec
145
+ */
146
+
147
+
148
+ inspect() {
149
+ return {
150
+ outer: [this.toU8a()]
151
+ };
152
+ }
143
153
  /**
144
154
  * @description True if this value is the max of the type
145
155
  */
@@ -1,6 +1,6 @@
1
1
  /// <reference types="bn.js" />
2
2
  import type { HexString } from '@polkadot/util/types';
3
- import type { AnyNumber, INumber, IU8a, Registry, UIntBitLength } from '../types';
3
+ import type { AnyNumber, Inspect, INumber, IU8a, Registry, UIntBitLength } from '../types';
4
4
  import { BN } from '@polkadot/util';
5
5
  export declare const DEFAULT_UINT_BITS = 64;
6
6
  /**
@@ -34,6 +34,10 @@ export declare abstract class AbstractInt extends BN implements INumber {
34
34
  * @description Compares the value of the input to see if there is a match
35
35
  */
36
36
  eq(other?: unknown): boolean;
37
+ /**
38
+ * @description Returns a breakdown of the hex encoding for this Codec
39
+ */
40
+ inspect(): Inspect;
37
41
  /**
38
42
  * @description True if this value is the max of the type
39
43
  */
@@ -110,6 +110,16 @@ export class AbstractInt extends BN {
110
110
  isNegative: this.#isSigned
111
111
  }) : bnToBn(other));
112
112
  }
113
+ /**
114
+ * @description Returns a breakdown of the hex encoding for this Codec
115
+ */
116
+
117
+
118
+ inspect() {
119
+ return {
120
+ outer: [this.toU8a()]
121
+ };
122
+ }
113
123
  /**
114
124
  * @description True if this value is the max of the type
115
125
  */
package/base/Base.cjs CHANGED
@@ -78,6 +78,14 @@ class Base {
78
78
  eq(other) {
79
79
  return (0, _classPrivateFieldLooseBase2.default)(this, _raw)[_raw].eq(other);
80
80
  }
81
+ /**
82
+ * @description Returns a breakdown of the hex encoding for this Codec
83
+ */
84
+
85
+
86
+ inspect() {
87
+ return (0, _classPrivateFieldLooseBase2.default)(this, _raw)[_raw].inspect();
88
+ }
81
89
  /**
82
90
  * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
83
91
  */
package/base/Base.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, BareOpts, Codec, IU8a, Registry } from '../types';
2
+ import type { AnyJson, BareOpts, Codec, Inspect, IU8a, Registry } from '../types';
3
3
  /**
4
4
  * @name Base
5
5
  * @description A type extends the Base class, when it holds a value
@@ -27,6 +27,10 @@ export declare abstract class Base<T extends Codec> implements Codec {
27
27
  * @description Compares the value of the input to see if there is a match
28
28
  */
29
29
  eq(other?: unknown): boolean;
30
+ /**
31
+ * @description Returns a breakdown of the hex encoding for this Codec
32
+ */
33
+ inspect(): Inspect;
30
34
  /**
31
35
  * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
32
36
  */
package/base/Base.js CHANGED
@@ -54,6 +54,14 @@ export class Base {
54
54
  eq(other) {
55
55
  return this.#raw.eq(other);
56
56
  }
57
+ /**
58
+ * @description Returns a breakdown of the hex encoding for this Codec
59
+ */
60
+
61
+
62
+ inspect() {
63
+ return this.#raw.inspect();
64
+ }
57
65
  /**
58
66
  * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
59
67
  */
package/base/Compact.cjs CHANGED
@@ -113,6 +113,16 @@ class Compact {
113
113
  eq(other) {
114
114
  return (0, _classPrivateFieldLooseBase2.default)(this, _raw)[_raw].eq(other instanceof Compact ? (0, _classPrivateFieldLooseBase2.default)(other, _raw)[_raw] : other);
115
115
  }
116
+ /**
117
+ * @description Returns a breakdown of the hex encoding for this Codec
118
+ */
119
+
120
+
121
+ inspect() {
122
+ return {
123
+ outer: [this.toU8a()]
124
+ };
125
+ }
116
126
  /**
117
127
  * @description Returns a BigInt representation of the number
118
128
  */
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, INumber, IU8a, Registry } from '../types';
4
+ import type { AnyJson, AnyNumber, CodecClass, ICompact, Inspect, INumber, IU8a, Registry } from '../types';
5
5
  /**
6
6
  * @name Compact
7
7
  * @description
@@ -39,6 +39,10 @@ export declare class Compact<T extends INumber> implements ICompact<T> {
39
39
  * @description Compares the value of the input to see if there is a match
40
40
  */
41
41
  eq(other?: unknown): boolean;
42
+ /**
43
+ * @description Returns a breakdown of the hex encoding for this Codec
44
+ */
45
+ inspect(): Inspect;
42
46
  /**
43
47
  * @description Returns a BigInt representation of the number
44
48
  */
package/base/Compact.js CHANGED
@@ -86,6 +86,16 @@ export class Compact {
86
86
  eq(other) {
87
87
  return this.#raw.eq(other instanceof Compact ? other.#raw : other);
88
88
  }
89
+ /**
90
+ * @description Returns a breakdown of the hex encoding for this Codec
91
+ */
92
+
93
+
94
+ inspect() {
95
+ return {
96
+ outer: [this.toU8a()]
97
+ };
98
+ }
89
99
  /**
90
100
  * @description Returns a BigInt representation of the number
91
101
  */
@@ -72,6 +72,10 @@ class DoNotConstruct {
72
72
  throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
73
73
  }
74
74
 
75
+ inspect() {
76
+ throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
77
+ }
78
+
75
79
  toHex() {
76
80
  throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
77
81
  }
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, CodecClass, IU8a, Registry } from '../types';
2
+ import type { AnyJson, Codec, CodecClass, Inspect, IU8a, Registry } from '../types';
3
3
  /**
4
4
  * @name DoNotConstruct
5
5
  * @description
@@ -24,6 +24,7 @@ export declare class DoNotConstruct implements Codec {
24
24
  */
25
25
  get isEmpty(): boolean;
26
26
  eq(): boolean;
27
+ inspect(): Inspect;
27
28
  toHex(): HexString;
28
29
  toHuman(): AnyJson;
29
30
  toJSON(): AnyJson;
@@ -52,6 +52,10 @@ export class DoNotConstruct {
52
52
  throw this.#neverError;
53
53
  }
54
54
 
55
+ inspect() {
56
+ throw this.#neverError;
57
+ }
58
+
55
59
  toHex() {
56
60
  throw this.#neverError;
57
61
  }
package/base/Enum.cjs CHANGED
@@ -354,6 +354,28 @@ class Enum {
354
354
 
355
355
  return this.value.eq(other);
356
356
  }
357
+ /**
358
+ * @description Returns a breakdown of the hex encoding for this Codec
359
+ */
360
+
361
+
362
+ inspect() {
363
+ if (this.isBasic) {
364
+ return {
365
+ outer: [new Uint8Array([this.index])]
366
+ };
367
+ }
368
+
369
+ const {
370
+ inner,
371
+ outer = []
372
+ } = (0, _classPrivateFieldLooseBase2.default)(this, _raw)[_raw].inspect();
373
+
374
+ return {
375
+ inner,
376
+ outer: [new Uint8Array([this.index]), ...outer]
377
+ };
378
+ }
357
379
  /**
358
380
  * @description Returns a hex string representation of the value
359
381
  */
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, IU8a, Registry } from '../types';
2
+ import type { AnyJson, Codec, CodecClass, IEnum, Inspect, IU8a, Registry } from '../types';
3
3
  export interface EnumCodecClass<T = Codec> {
4
4
  new (registry: Registry, value?: any, index?: number): T;
5
5
  }
@@ -69,6 +69,10 @@ export declare class Enum implements IEnum {
69
69
  * @description Compares the value of the input to see if there is a match
70
70
  */
71
71
  eq(other?: unknown): boolean;
72
+ /**
73
+ * @description Returns a breakdown of the hex encoding for this Codec
74
+ */
75
+ inspect(): Inspect;
72
76
  /**
73
77
  * @description Returns a hex string representation of the value
74
78
  */
package/base/Enum.js CHANGED
@@ -299,6 +299,27 @@ export class Enum {
299
299
 
300
300
  return this.value.eq(other);
301
301
  }
302
+ /**
303
+ * @description Returns a breakdown of the hex encoding for this Codec
304
+ */
305
+
306
+
307
+ inspect() {
308
+ if (this.isBasic) {
309
+ return {
310
+ outer: [new Uint8Array([this.index])]
311
+ };
312
+ }
313
+
314
+ const {
315
+ inner,
316
+ outer = []
317
+ } = this.#raw.inspect();
318
+ return {
319
+ inner,
320
+ outer: [new Uint8Array([this.index]), ...outer]
321
+ };
322
+ }
302
323
  /**
303
324
  * @description Returns a hex string representation of the value
304
325
  */
package/base/Null.cjs CHANGED
@@ -55,6 +55,14 @@ class Null {
55
55
  eq(other) {
56
56
  return other instanceof Null || (0, _util.isNull)(other);
57
57
  }
58
+ /**
59
+ * @description Returns a breakdown of the hex encoding for this Codec
60
+ */
61
+
62
+
63
+ inspect() {
64
+ return {};
65
+ }
58
66
  /**
59
67
  * @description Returns a hex string representation of the value
60
68
  */
package/base/Null.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { Codec, IU8a, Registry } from '../types';
2
+ import type { Codec, Inspect, IU8a, Registry } from '../types';
3
3
  /**
4
4
  * @name Null
5
5
  * @description
@@ -26,6 +26,10 @@ export declare class Null implements Codec {
26
26
  * @description Compares the value of the input to see if there is a match
27
27
  */
28
28
  eq(other?: unknown): boolean;
29
+ /**
30
+ * @description Returns a breakdown of the hex encoding for this Codec
31
+ */
32
+ inspect(): Inspect;
29
33
  /**
30
34
  * @description Returns a hex string representation of the value
31
35
  */
package/base/Null.js CHANGED
@@ -46,6 +46,14 @@ export class Null {
46
46
  eq(other) {
47
47
  return other instanceof Null || isNull(other);
48
48
  }
49
+ /**
50
+ * @description Returns a breakdown of the hex encoding for this Codec
51
+ */
52
+
53
+
54
+ inspect() {
55
+ return {};
56
+ }
49
57
  /**
50
58
  * @description Returns a hex string representation of the value
51
59
  */
package/base/Option.cjs CHANGED
@@ -160,6 +160,28 @@ class Option {
160
160
 
161
161
  return this.value.eq(other);
162
162
  }
163
+ /**
164
+ * @description Returns a breakdown of the hex encoding for this Codec
165
+ */
166
+
167
+
168
+ inspect() {
169
+ if (this.isNone) {
170
+ return {
171
+ outer: [new Uint8Array([0])]
172
+ };
173
+ }
174
+
175
+ const {
176
+ inner,
177
+ outer = []
178
+ } = (0, _classPrivateFieldLooseBase2.default)(this, _raw)[_raw].inspect();
179
+
180
+ return {
181
+ inner,
182
+ outer: [new Uint8Array([1]), ...outer]
183
+ };
184
+ }
163
185
  /**
164
186
  * @description Returns a hex string representation of the value
165
187
  */
package/base/Option.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, CodecClass, IOption, IU8a, Registry } from '../types';
2
+ import type { AnyJson, Codec, CodecClass, Inspect, IOption, IU8a, Registry } from '../types';
3
3
  /**
4
4
  * @name Option
5
5
  * @description
@@ -46,6 +46,10 @@ export declare class Option<T extends Codec> implements IOption<T> {
46
46
  * @description Compares the value of the input to see if there is a match
47
47
  */
48
48
  eq(other?: unknown): boolean;
49
+ /**
50
+ * @description Returns a breakdown of the hex encoding for this Codec
51
+ */
52
+ inspect(): Inspect;
49
53
  /**
50
54
  * @description Returns a hex string representation of the value
51
55
  */
package/base/Option.js CHANGED
@@ -128,6 +128,27 @@ export class Option {
128
128
 
129
129
  return this.value.eq(other);
130
130
  }
131
+ /**
132
+ * @description Returns a breakdown of the hex encoding for this Codec
133
+ */
134
+
135
+
136
+ inspect() {
137
+ if (this.isNone) {
138
+ return {
139
+ outer: [new Uint8Array([0])]
140
+ };
141
+ }
142
+
143
+ const {
144
+ inner,
145
+ outer = []
146
+ } = this.#raw.inspect();
147
+ return {
148
+ inner,
149
+ outer: [new Uint8Array([1]), ...outer]
150
+ };
151
+ }
131
152
  /**
132
153
  * @description Returns a hex string representation of the value
133
154
  */
package/base/Tuple.cjs CHANGED
@@ -93,6 +93,16 @@ class Tuple extends _AbstractArray.AbstractArray {
93
93
  get Types() {
94
94
  return Array.isArray((0, _classPrivateFieldLooseBase2.default)(this, _Types)[_Types]) ? (0, _classPrivateFieldLooseBase2.default)(this, _Types)[_Types].map(T => new T(this.registry).toRawType()) : Object.keys((0, _classPrivateFieldLooseBase2.default)(this, _Types)[_Types]);
95
95
  }
96
+ /**
97
+ * @description Returns a breakdown of the hex encoding for this Codec
98
+ */
99
+
100
+
101
+ inspect() {
102
+ return {
103
+ inner: this.inspectInner()
104
+ };
105
+ }
96
106
  /**
97
107
  * @description Returns the base runtime type name for this instance
98
108
  */
@@ -118,13 +128,7 @@ class Tuple extends _AbstractArray.AbstractArray {
118
128
 
119
129
 
120
130
  toU8a(isBare) {
121
- const encoded = new Array(this.length);
122
-
123
- for (let i = 0; i < this.length; i++) {
124
- encoded[i] = this[i].toU8a(isBare);
125
- }
126
-
127
- return (0, _util.u8aConcat)(...encoded);
131
+ return (0, _util.u8aConcat)(...this.toU8aInner(isBare));
128
132
  }
129
133
 
130
134
  }
package/base/Tuple.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AnyTupleValue, Codec, CodecClass, ITuple, Registry } from '../types';
1
+ import type { AnyTupleValue, Codec, CodecClass, Inspect, ITuple, Registry } from '../types';
2
2
  import { AbstractArray } from '../abstract/AbstractArray';
3
3
  declare type TupleType = (CodecClass | string);
4
4
  declare type TupleTypes = TupleType[] | {
@@ -22,6 +22,10 @@ export declare class Tuple extends AbstractArray<Codec> implements ITuple<Codec[
22
22
  * @description The types definition of the tuple
23
23
  */
24
24
  get Types(): string[];
25
+ /**
26
+ * @description Returns a breakdown of the hex encoding for this Codec
27
+ */
28
+ inspect(): Inspect;
25
29
  /**
26
30
  * @description Returns the base runtime type name for this instance
27
31
  */
package/base/Tuple.js CHANGED
@@ -73,6 +73,16 @@ export class Tuple extends AbstractArray {
73
73
  get Types() {
74
74
  return Array.isArray(this.#Types) ? this.#Types.map(T => new T(this.registry).toRawType()) : Object.keys(this.#Types);
75
75
  }
76
+ /**
77
+ * @description Returns a breakdown of the hex encoding for this Codec
78
+ */
79
+
80
+
81
+ inspect() {
82
+ return {
83
+ inner: this.inspectInner()
84
+ };
85
+ }
76
86
  /**
77
87
  * @description Returns the base runtime type name for this instance
78
88
  */
@@ -98,13 +108,7 @@ export class Tuple extends AbstractArray {
98
108
 
99
109
 
100
110
  toU8a(isBare) {
101
- const encoded = new Array(this.length);
102
-
103
- for (let i = 0; i < this.length; i++) {
104
- encoded[i] = this[i].toU8a(isBare);
105
- }
106
-
107
- return u8aConcat(...encoded);
111
+ return u8aConcat(...this.toU8aInner(isBare));
108
112
  }
109
113
 
110
114
  }
package/base/VecFixed.cjs CHANGED
@@ -85,16 +85,21 @@ class VecFixed extends _AbstractArray.AbstractArray {
85
85
 
86
86
  return total;
87
87
  }
88
+ /**
89
+ * @description Returns a breakdown of the hex encoding for this Codec
90
+ */
91
+
92
+
93
+ inspect() {
94
+ return {
95
+ inner: this.inspectInner()
96
+ };
97
+ }
88
98
 
89
99
  toU8a() {
90
100
  // we override, we don't add the length prefix for ourselves, and at the same time we
91
101
  // ignore isBare on entries, since they should be properly encoded at all times
92
- const encoded = new Array(this.length);
93
-
94
- for (let i = 0; i < this.length; i++) {
95
- encoded[i] = this[i].toU8a();
96
- }
97
-
102
+ const encoded = this.toU8aInner();
98
103
  return encoded.length ? (0, _util.u8aConcat)(...encoded) : new Uint8Array([]);
99
104
  }
100
105
  /**
@@ -1,5 +1,5 @@
1
1
  import type { HexString } from '@polkadot/util/types';
2
- import type { Codec, CodecClass, Registry } from '../types';
2
+ import type { Codec, CodecClass, Inspect, Registry } from '../types';
3
3
  import { AbstractArray } from '../abstract/AbstractArray';
4
4
  /**
5
5
  * @name VecFixed
@@ -18,6 +18,10 @@ export declare class VecFixed<T extends Codec> extends AbstractArray<T> {
18
18
  * @description The length of the value when encoded as a Uint8Array
19
19
  */
20
20
  get encodedLength(): number;
21
+ /**
22
+ * @description Returns a breakdown of the hex encoding for this Codec
23
+ */
24
+ inspect(): Inspect;
21
25
  toU8a(): Uint8Array;
22
26
  /**
23
27
  * @description Returns the base runtime type name for this instance