@polkadot/types-codec 7.6.2-9 → 7.7.2-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstract/AbstractArray.cjs +27 -1
- package/abstract/AbstractArray.d.ts +7 -1
- package/abstract/AbstractArray.js +27 -1
- package/abstract/AbstractInt.cjs +11 -0
- package/abstract/AbstractInt.d.ts +5 -1
- package/abstract/AbstractInt.js +11 -0
- package/base/Base.cjs +8 -0
- package/base/Base.d.ts +5 -1
- package/base/Base.js +8 -0
- package/base/Compact.cjs +11 -0
- package/base/Compact.d.ts +5 -1
- package/base/Compact.js +11 -0
- package/base/DoNotConstruct.cjs +4 -0
- package/base/DoNotConstruct.d.ts +2 -1
- package/base/DoNotConstruct.js +4 -0
- package/base/Enum.cjs +11 -0
- package/base/Enum.d.ts +5 -1
- package/base/Enum.js +11 -0
- package/base/Null.cjs +11 -0
- package/base/Null.d.ts +5 -1
- package/base/Null.js +11 -0
- package/base/Option.cjs +11 -0
- package/base/Option.d.ts +5 -1
- package/base/Option.js +11 -0
- package/base/Tuple.cjs +12 -7
- package/base/Tuple.d.ts +5 -1
- package/base/Tuple.js +12 -7
- package/base/VecFixed.cjs +12 -6
- package/base/VecFixed.d.ts +5 -1
- package/base/VecFixed.js +12 -6
- package/extended/BTreeSet.cjs +17 -0
- package/extended/BTreeSet.d.ts +5 -1
- package/extended/BTreeSet.js +17 -0
- package/extended/BitVec.cjs +14 -0
- package/extended/BitVec.d.ts +5 -1
- package/extended/BitVec.js +14 -0
- package/extended/Bytes.cjs +14 -0
- package/extended/Bytes.d.ts +5 -1
- package/extended/Bytes.js +14 -0
- package/extended/Map.cjs +19 -1
- package/extended/Map.d.ts +5 -1
- package/extended/Map.js +19 -1
- package/extended/WrapperKeepOpaque.cjs +14 -0
- package/extended/WrapperKeepOpaque.d.ts +5 -1
- package/extended/WrapperKeepOpaque.js +15 -1
- package/native/Bool.cjs +11 -0
- package/native/Bool.d.ts +5 -1
- package/native/Bool.js +11 -0
- package/native/Date.cjs +14 -3
- package/native/Date.d.ts +7 -3
- package/native/Date.js +14 -3
- package/native/Json.cjs +8 -0
- package/native/Json.d.ts +5 -1
- package/native/Json.js +8 -0
- package/native/Raw.cjs +11 -0
- package/native/Raw.d.ts +5 -1
- package/native/Raw.js +11 -0
- package/native/Set.cjs +11 -0
- package/native/Set.d.ts +5 -1
- package/native/Set.js +11 -0
- package/native/Struct.cjs +19 -0
- package/native/Struct.d.ts +5 -1
- package/native/Struct.js +19 -0
- package/native/Text.cjs +15 -0
- package/native/Text.d.ts +5 -1
- package/native/Text.js +16 -1
- package/package.json +3 -3
- package/packageInfo.cjs +1 -1
- package/packageInfo.js +1 -1
- 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
|
+
value: (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
|
|
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
|
+
value: 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
|
|
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.
|
package/abstract/AbstractInt.cjs
CHANGED
|
@@ -140,6 +140,17 @@ 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
|
+
inner: [],
|
|
151
|
+
value: this.toU8a()
|
|
152
|
+
};
|
|
153
|
+
}
|
|
143
154
|
/**
|
|
144
155
|
* @description True if this value is the max of the type
|
|
145
156
|
*/
|
|
@@ -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
|
*/
|
package/abstract/AbstractInt.js
CHANGED
|
@@ -110,6 +110,17 @@ 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
|
+
inner: [],
|
|
121
|
+
value: this.toU8a()
|
|
122
|
+
};
|
|
123
|
+
}
|
|
113
124
|
/**
|
|
114
125
|
* @description True if this value is the max of the type
|
|
115
126
|
*/
|
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,17 @@ 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
|
+
inner: [],
|
|
124
|
+
value: this.toU8a()
|
|
125
|
+
};
|
|
126
|
+
}
|
|
116
127
|
/**
|
|
117
128
|
* @description Returns a BigInt representation of the number
|
|
118
129
|
*/
|
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,17 @@ 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
|
+
inner: [],
|
|
97
|
+
value: this.toU8a()
|
|
98
|
+
};
|
|
99
|
+
}
|
|
89
100
|
/**
|
|
90
101
|
* @description Returns a BigInt representation of the number
|
|
91
102
|
*/
|
package/base/DoNotConstruct.cjs
CHANGED
|
@@ -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
|
}
|
package/base/DoNotConstruct.d.ts
CHANGED
|
@@ -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;
|
package/base/DoNotConstruct.js
CHANGED
package/base/Enum.cjs
CHANGED
|
@@ -354,6 +354,17 @@ 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
|
+
return {
|
|
364
|
+
inner: this.isBasic ? [] : [(0, _classPrivateFieldLooseBase2.default)(this, _raw)[_raw].inspect()],
|
|
365
|
+
value: new Uint8Array([this.index])
|
|
366
|
+
};
|
|
367
|
+
}
|
|
357
368
|
/**
|
|
358
369
|
* @description Returns a hex string representation of the value
|
|
359
370
|
*/
|
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,17 @@ 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
|
+
return {
|
|
309
|
+
inner: this.isBasic ? [] : [this.#raw.inspect()],
|
|
310
|
+
value: new Uint8Array([this.index])
|
|
311
|
+
};
|
|
312
|
+
}
|
|
302
313
|
/**
|
|
303
314
|
* @description Returns a hex string representation of the value
|
|
304
315
|
*/
|
package/base/Null.cjs
CHANGED
|
@@ -55,6 +55,17 @@ 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
|
+
inner: [],
|
|
66
|
+
value: new Uint8Array()
|
|
67
|
+
};
|
|
68
|
+
}
|
|
58
69
|
/**
|
|
59
70
|
* @description Returns a hex string representation of the value
|
|
60
71
|
*/
|
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,17 @@ 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
|
+
inner: [],
|
|
57
|
+
value: new Uint8Array()
|
|
58
|
+
};
|
|
59
|
+
}
|
|
49
60
|
/**
|
|
50
61
|
* @description Returns a hex string representation of the value
|
|
51
62
|
*/
|
package/base/Option.cjs
CHANGED
|
@@ -160,6 +160,17 @@ 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
|
+
return {
|
|
170
|
+
inner: this.isSome ? [(0, _classPrivateFieldLooseBase2.default)(this, _raw)[_raw].inspect()] : [],
|
|
171
|
+
value: new Uint8Array(this.isSome ? [1] : [0])
|
|
172
|
+
};
|
|
173
|
+
}
|
|
163
174
|
/**
|
|
164
175
|
* @description Returns a hex string representation of the value
|
|
165
176
|
*/
|
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,17 @@ 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
|
+
return {
|
|
138
|
+
inner: this.isSome ? [this.#raw.inspect()] : [],
|
|
139
|
+
value: new Uint8Array(this.isSome ? [1] : [0])
|
|
140
|
+
};
|
|
141
|
+
}
|
|
131
142
|
/**
|
|
132
143
|
* @description Returns a hex string representation of the value
|
|
133
144
|
*/
|
package/base/Tuple.cjs
CHANGED
|
@@ -93,6 +93,17 @@ 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
|
+
value: new Uint8Array()
|
|
105
|
+
};
|
|
106
|
+
}
|
|
96
107
|
/**
|
|
97
108
|
* @description Returns the base runtime type name for this instance
|
|
98
109
|
*/
|
|
@@ -118,13 +129,7 @@ class Tuple extends _AbstractArray.AbstractArray {
|
|
|
118
129
|
|
|
119
130
|
|
|
120
131
|
toU8a(isBare) {
|
|
121
|
-
|
|
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);
|
|
132
|
+
return (0, _util.u8aConcat)(...this.toU8aInner(isBare));
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
}
|
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,17 @@ 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
|
+
value: new Uint8Array()
|
|
85
|
+
};
|
|
86
|
+
}
|
|
76
87
|
/**
|
|
77
88
|
* @description Returns the base runtime type name for this instance
|
|
78
89
|
*/
|
|
@@ -98,13 +109,7 @@ export class Tuple extends AbstractArray {
|
|
|
98
109
|
|
|
99
110
|
|
|
100
111
|
toU8a(isBare) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
for (let i = 0; i < this.length; i++) {
|
|
104
|
-
encoded[i] = this[i].toU8a(isBare);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return u8aConcat(...encoded);
|
|
112
|
+
return u8aConcat(...this.toU8aInner(isBare));
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
}
|
package/base/VecFixed.cjs
CHANGED
|
@@ -85,16 +85,22 @@ 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
|
+
value: new Uint8Array()
|
|
97
|
+
};
|
|
98
|
+
}
|
|
88
99
|
|
|
89
100
|
toU8a() {
|
|
90
101
|
// we override, we don't add the length prefix for ourselves, and at the same time we
|
|
91
102
|
// ignore isBare on entries, since they should be properly encoded at all times
|
|
92
|
-
const encoded =
|
|
93
|
-
|
|
94
|
-
for (let i = 0; i < this.length; i++) {
|
|
95
|
-
encoded[i] = this[i].toU8a();
|
|
96
|
-
}
|
|
97
|
-
|
|
103
|
+
const encoded = this.toU8aInner();
|
|
98
104
|
return encoded.length ? (0, _util.u8aConcat)(...encoded) : new Uint8Array([]);
|
|
99
105
|
}
|
|
100
106
|
/**
|
package/base/VecFixed.d.ts
CHANGED
|
@@ -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
|
package/base/VecFixed.js
CHANGED
|
@@ -63,16 +63,22 @@ export class VecFixed extends AbstractArray {
|
|
|
63
63
|
|
|
64
64
|
return total;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
inspect() {
|
|
72
|
+
return {
|
|
73
|
+
inner: this.inspectInner(),
|
|
74
|
+
value: new Uint8Array()
|
|
75
|
+
};
|
|
76
|
+
}
|
|
66
77
|
|
|
67
78
|
toU8a() {
|
|
68
79
|
// we override, we don't add the length prefix for ourselves, and at the same time we
|
|
69
80
|
// ignore isBare on entries, since they should be properly encoded at all times
|
|
70
|
-
const encoded =
|
|
71
|
-
|
|
72
|
-
for (let i = 0; i < this.length; i++) {
|
|
73
|
-
encoded[i] = this[i].toU8a();
|
|
74
|
-
}
|
|
75
|
-
|
|
81
|
+
const encoded = this.toU8aInner();
|
|
76
82
|
return encoded.length ? u8aConcat(...encoded) : new Uint8Array([]);
|
|
77
83
|
}
|
|
78
84
|
/**
|