@polkadot/types-codec 10.1.4 → 10.2.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.
- package/abstract/Array.d.ts +9 -0
- package/abstract/Array.js +9 -0
- package/abstract/Int.d.ts +0 -1
- package/abstract/Int.js +0 -1
- package/base/Compact.d.ts +0 -1
- package/base/Compact.js +0 -1
- package/base/DoNotConstruct.d.ts +27 -0
- package/base/DoNotConstruct.js +27 -0
- package/base/Null.d.ts +0 -1
- package/base/Null.js +0 -1
- package/cjs/abstract/Array.js +9 -0
- package/cjs/abstract/Int.js +0 -1
- package/cjs/base/Compact.js +0 -1
- package/cjs/base/DoNotConstruct.js +27 -0
- package/cjs/base/Null.js +0 -1
- package/cjs/extended/BitVec.js +4 -1
- package/cjs/extended/Linkage.js +8 -2
- package/cjs/native/Bool.js +0 -1
- package/cjs/native/Date.js +0 -1
- package/cjs/native/Float.js +4 -2
- package/cjs/native/Raw.js +0 -1
- package/cjs/native/Set.js +0 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/primitive/ISize.js +18 -0
- package/cjs/primitive/index.js +4 -1
- package/extended/BitVec.d.ts +3 -0
- package/extended/BitVec.js +4 -1
- package/extended/Linkage.d.ts +7 -1
- package/extended/Linkage.js +8 -2
- package/native/Bool.d.ts +0 -1
- package/native/Bool.js +0 -1
- package/native/Date.d.ts +0 -1
- package/native/Date.js +0 -1
- package/native/Float.d.ts +1 -1
- package/native/Float.js +4 -2
- package/native/Raw.d.ts +0 -1
- package/native/Raw.js +0 -1
- package/native/Set.d.ts +0 -1
- package/native/Set.js +0 -1
- package/package.json +8 -3
- package/packageInfo.js +1 -1
- package/primitive/ISize.d.ts +12 -0
- package/primitive/ISize.js +14 -0
- package/primitive/index.d.ts +1 -0
- package/primitive/index.js +1 -0
- package/types/codec.d.ts +2 -1
package/abstract/Array.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ export declare abstract class AbstractArray<T extends Codec> extends Array<T> im
|
|
|
42
42
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
43
43
|
*/
|
|
44
44
|
inspect(): Inspect;
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
* @description Internal per-item inspection of internal values
|
|
48
|
+
*/
|
|
45
49
|
inspectInner(): Inspect[];
|
|
46
50
|
/**
|
|
47
51
|
* @description Converts the Object to an standard JavaScript Array
|
|
@@ -76,5 +80,10 @@ export declare abstract class AbstractArray<T extends Codec> extends Array<T> im
|
|
|
76
80
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
77
81
|
*/
|
|
78
82
|
toU8a(isBare?: boolean): Uint8Array;
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
* @description Internal per-item SCALE encoding of contained values
|
|
86
|
+
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
87
|
+
*/
|
|
79
88
|
toU8aInner(isBare?: boolean): Uint8Array[];
|
|
80
89
|
}
|
package/abstract/Array.js
CHANGED
|
@@ -65,6 +65,10 @@ export class AbstractArray extends Array {
|
|
|
65
65
|
outer: [compactToU8a(this.length)]
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @description Internal per-item inspection of internal values
|
|
71
|
+
*/
|
|
68
72
|
inspectInner() {
|
|
69
73
|
const inner = new Array(this.length);
|
|
70
74
|
for (let i = 0; i < this.length; i++) {
|
|
@@ -136,6 +140,11 @@ export class AbstractArray extends Array {
|
|
|
136
140
|
? u8aConcatStrict(encoded)
|
|
137
141
|
: u8aConcatStrict([compactToU8a(this.length), ...encoded]);
|
|
138
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
* @description Internal per-item SCALE encoding of contained values
|
|
146
|
+
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
147
|
+
*/
|
|
139
148
|
toU8aInner(isBare) {
|
|
140
149
|
const encoded = new Array(this.length);
|
|
141
150
|
for (let i = 0; i < this.length; i++) {
|
package/abstract/Int.d.ts
CHANGED
|
@@ -76,7 +76,6 @@ export declare abstract class AbstractInt extends BN implements INumber {
|
|
|
76
76
|
toString(base?: number): string;
|
|
77
77
|
/**
|
|
78
78
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
79
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
80
79
|
*/
|
|
81
80
|
toU8a(_isBare?: boolean): Uint8Array;
|
|
82
81
|
}
|
package/abstract/Int.js
CHANGED
|
@@ -211,7 +211,6 @@ export class AbstractInt extends BN {
|
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
214
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
215
214
|
*/
|
|
216
215
|
toU8a(_isBare) {
|
|
217
216
|
return bnToU8a(this, {
|
package/base/Compact.d.ts
CHANGED
|
@@ -84,7 +84,6 @@ export declare class Compact<T extends INumber> implements ICompact<T> {
|
|
|
84
84
|
toString(): string;
|
|
85
85
|
/**
|
|
86
86
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
87
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
88
87
|
*/
|
|
89
88
|
toU8a(_isBare?: boolean): Uint8Array;
|
|
90
89
|
/**
|
package/base/Compact.js
CHANGED
|
@@ -147,7 +147,6 @@ export class Compact {
|
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
149
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
150
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
151
150
|
*/
|
|
152
151
|
toU8a(_isBare) {
|
|
153
152
|
return compactToU8a(__classPrivateFieldGet(this, _Compact_raw, "f").toBn());
|
package/base/DoNotConstruct.d.ts
CHANGED
|
@@ -24,13 +24,40 @@ export declare class DoNotConstruct implements Codec {
|
|
|
24
24
|
* @description Checks if the value is an empty value (always true)
|
|
25
25
|
*/
|
|
26
26
|
get isEmpty(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @description Unimplemented
|
|
29
|
+
*/
|
|
27
30
|
eq(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @description Unimplemented
|
|
33
|
+
*/
|
|
28
34
|
inspect(): Inspect;
|
|
35
|
+
/**
|
|
36
|
+
* @description Unimplemented
|
|
37
|
+
*/
|
|
29
38
|
toHex(): HexString;
|
|
39
|
+
/**
|
|
40
|
+
* @description Unimplemented
|
|
41
|
+
*/
|
|
30
42
|
toHuman(): AnyJson;
|
|
43
|
+
/**
|
|
44
|
+
* @description Unimplemented
|
|
45
|
+
*/
|
|
31
46
|
toJSON(): AnyJson;
|
|
47
|
+
/**
|
|
48
|
+
* @description Unimplemented
|
|
49
|
+
*/
|
|
32
50
|
toPrimitive(): AnyJson;
|
|
51
|
+
/**
|
|
52
|
+
* @description Unimplemented
|
|
53
|
+
*/
|
|
33
54
|
toRawType(): string;
|
|
55
|
+
/**
|
|
56
|
+
* @description Unimplemented
|
|
57
|
+
*/
|
|
34
58
|
toString(): string;
|
|
59
|
+
/**
|
|
60
|
+
* @description Unimplemented
|
|
61
|
+
*/
|
|
35
62
|
toU8a(): Uint8Array;
|
|
36
63
|
}
|
package/base/DoNotConstruct.js
CHANGED
|
@@ -37,30 +37,57 @@ export class DoNotConstruct {
|
|
|
37
37
|
get isEmpty() {
|
|
38
38
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @description Unimplemented
|
|
42
|
+
*/
|
|
40
43
|
eq() {
|
|
41
44
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
42
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* @description Unimplemented
|
|
48
|
+
*/
|
|
43
49
|
inspect() {
|
|
44
50
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
45
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* @description Unimplemented
|
|
54
|
+
*/
|
|
46
55
|
toHex() {
|
|
47
56
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
48
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @description Unimplemented
|
|
60
|
+
*/
|
|
49
61
|
toHuman() {
|
|
50
62
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
51
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* @description Unimplemented
|
|
66
|
+
*/
|
|
52
67
|
toJSON() {
|
|
53
68
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
54
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @description Unimplemented
|
|
72
|
+
*/
|
|
55
73
|
toPrimitive() {
|
|
56
74
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
57
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* @description Unimplemented
|
|
78
|
+
*/
|
|
58
79
|
toRawType() {
|
|
59
80
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
60
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* @description Unimplemented
|
|
84
|
+
*/
|
|
61
85
|
toString() {
|
|
62
86
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
63
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* @description Unimplemented
|
|
90
|
+
*/
|
|
64
91
|
toU8a() {
|
|
65
92
|
throw __classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
66
93
|
}
|
package/base/Null.d.ts
CHANGED
|
@@ -51,7 +51,6 @@ export declare class Null implements Codec {
|
|
|
51
51
|
toString(): string;
|
|
52
52
|
/**
|
|
53
53
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
54
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
55
54
|
*/
|
|
56
55
|
toU8a(_isBare?: boolean): Uint8Array;
|
|
57
56
|
}
|
package/base/Null.js
CHANGED
package/cjs/abstract/Array.js
CHANGED
|
@@ -68,6 +68,10 @@ class AbstractArray extends Array {
|
|
|
68
68
|
outer: [(0, util_1.compactToU8a)(this.length)]
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
* @description Internal per-item inspection of internal values
|
|
74
|
+
*/
|
|
71
75
|
inspectInner() {
|
|
72
76
|
const inner = new Array(this.length);
|
|
73
77
|
for (let i = 0; i < this.length; i++) {
|
|
@@ -139,6 +143,11 @@ class AbstractArray extends Array {
|
|
|
139
143
|
? (0, util_1.u8aConcatStrict)(encoded)
|
|
140
144
|
: (0, util_1.u8aConcatStrict)([(0, util_1.compactToU8a)(this.length), ...encoded]);
|
|
141
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* @internal
|
|
148
|
+
* @description Internal per-item SCALE encoding of contained values
|
|
149
|
+
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
150
|
+
*/
|
|
142
151
|
toU8aInner(isBare) {
|
|
143
152
|
const encoded = new Array(this.length);
|
|
144
153
|
for (let i = 0; i < this.length; i++) {
|
package/cjs/abstract/Int.js
CHANGED
|
@@ -214,7 +214,6 @@ class AbstractInt extends util_1.BN {
|
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
216
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
217
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
218
217
|
*/
|
|
219
218
|
toU8a(_isBare) {
|
|
220
219
|
return (0, util_1.bnToU8a)(this, {
|
package/cjs/base/Compact.js
CHANGED
|
@@ -150,7 +150,6 @@ class Compact {
|
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
153
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
154
153
|
*/
|
|
155
154
|
toU8a(_isBare) {
|
|
156
155
|
return (0, util_1.compactToU8a)(tslib_1.__classPrivateFieldGet(this, _Compact_raw, "f").toBn());
|
|
@@ -40,30 +40,57 @@ class DoNotConstruct {
|
|
|
40
40
|
get isEmpty() {
|
|
41
41
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* @description Unimplemented
|
|
45
|
+
*/
|
|
43
46
|
eq() {
|
|
44
47
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
45
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* @description Unimplemented
|
|
51
|
+
*/
|
|
46
52
|
inspect() {
|
|
47
53
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
48
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @description Unimplemented
|
|
57
|
+
*/
|
|
49
58
|
toHex() {
|
|
50
59
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
51
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @description Unimplemented
|
|
63
|
+
*/
|
|
52
64
|
toHuman() {
|
|
53
65
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
54
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @description Unimplemented
|
|
69
|
+
*/
|
|
55
70
|
toJSON() {
|
|
56
71
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
57
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* @description Unimplemented
|
|
75
|
+
*/
|
|
58
76
|
toPrimitive() {
|
|
59
77
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
60
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @description Unimplemented
|
|
81
|
+
*/
|
|
61
82
|
toRawType() {
|
|
62
83
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
63
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* @description Unimplemented
|
|
87
|
+
*/
|
|
64
88
|
toString() {
|
|
65
89
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
66
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @description Unimplemented
|
|
93
|
+
*/
|
|
67
94
|
toU8a() {
|
|
68
95
|
throw tslib_1.__classPrivateFieldGet(this, _DoNotConstruct_neverError, "f");
|
|
69
96
|
}
|
package/cjs/base/Null.js
CHANGED
package/cjs/extended/BitVec.js
CHANGED
|
@@ -58,6 +58,9 @@ class BitVec extends Raw_js_1.Raw {
|
|
|
58
58
|
outer: [(0, util_1.compactToU8a)(tslib_1.__classPrivateFieldGet(this, _BitVec_decodedLength, "f")), super.toU8a()]
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
63
|
+
*/
|
|
61
64
|
toHuman() {
|
|
62
65
|
return `0b${[...this.toU8a(true)]
|
|
63
66
|
.map((d) => `00000000${d.toString(2)}`.slice(-8))
|
|
@@ -75,7 +78,7 @@ class BitVec extends Raw_js_1.Raw {
|
|
|
75
78
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
76
79
|
*/
|
|
77
80
|
toU8a(isBare) {
|
|
78
|
-
const bitVec = super.toU8a();
|
|
81
|
+
const bitVec = super.toU8a(isBare);
|
|
79
82
|
return isBare
|
|
80
83
|
? bitVec
|
|
81
84
|
: (0, util_1.u8aConcatStrict)([(0, util_1.compactToU8a)(tslib_1.__classPrivateFieldGet(this, _BitVec_decodedLength, "f")), bitVec]);
|
package/cjs/extended/Linkage.js
CHANGED
|
@@ -25,9 +25,15 @@ class Linkage extends Struct_js_1.Struct {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @description Returns the next item the Linkage is pointing to
|
|
30
|
+
*/
|
|
28
31
|
get previous() {
|
|
29
32
|
return this.get('previous');
|
|
30
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @description Returns the previous item the Linkage is pointing to
|
|
36
|
+
*/
|
|
31
37
|
get next() {
|
|
32
38
|
return this.get('next');
|
|
33
39
|
}
|
|
@@ -40,12 +46,12 @@ class Linkage extends Struct_js_1.Struct {
|
|
|
40
46
|
/**
|
|
41
47
|
* @description Custom toU8a which with bare mode does not return the linkage if empty
|
|
42
48
|
*/
|
|
43
|
-
toU8a() {
|
|
49
|
+
toU8a(isBare) {
|
|
44
50
|
// As part of a storage query (where these appear), in the case of empty, the values
|
|
45
51
|
// are NOT populated by the node - follow the same logic, leaving it empty
|
|
46
52
|
return this.isEmpty
|
|
47
53
|
? EMPTY
|
|
48
|
-
: super.toU8a();
|
|
54
|
+
: super.toU8a(isBare);
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
exports.Linkage = Linkage;
|
package/cjs/native/Bool.js
CHANGED
|
@@ -102,7 +102,6 @@ class bool extends Boolean {
|
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
105
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
106
105
|
*/
|
|
107
106
|
toU8a(_isBare) {
|
|
108
107
|
return new Uint8Array([this.valueOf() ? 1 : 0]);
|
package/cjs/native/Date.js
CHANGED
|
@@ -133,7 +133,6 @@ class CodecDate extends Date {
|
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
135
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
136
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
137
136
|
*/
|
|
138
137
|
toU8a(_isBare) {
|
|
139
138
|
return (0, util_1.bnToU8a)(this.toNumber(), U8A_OPTS);
|
package/cjs/native/Float.js
CHANGED
|
@@ -99,8 +99,10 @@ class Float extends Number {
|
|
|
99
99
|
/**
|
|
100
100
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
101
101
|
*/
|
|
102
|
-
toU8a() {
|
|
103
|
-
return (0, util_1.floatToU8a)(this, {
|
|
102
|
+
toU8a(_isBare) {
|
|
103
|
+
return (0, util_1.floatToU8a)(this, {
|
|
104
|
+
bitLength: tslib_1.__classPrivateFieldGet(this, _Float_bitLength, "f")
|
|
105
|
+
});
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
exports.Float = Float;
|
package/cjs/native/Raw.js
CHANGED
|
@@ -123,7 +123,6 @@ class Raw extends Uint8Array {
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
126
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
127
126
|
*/
|
|
128
127
|
toU8a(_isBare) {
|
|
129
128
|
return Uint8Array.from(this);
|
package/cjs/native/Set.js
CHANGED
|
@@ -206,7 +206,6 @@ class CodecSet extends Set {
|
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
209
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
210
209
|
*/
|
|
211
210
|
toU8a(_isBare) {
|
|
212
211
|
return (0, util_1.bnToU8a)(this.valueEncoded, {
|
package/cjs/packageInfo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageInfo = void 0;
|
|
4
|
-
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.
|
|
4
|
+
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.2.2' };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isize = void 0;
|
|
4
|
+
const I32_js_1 = require("./I32.js");
|
|
5
|
+
/**
|
|
6
|
+
* @name ISize
|
|
7
|
+
* @description
|
|
8
|
+
* A System default signed number, typically used in RPC to report non-consensus
|
|
9
|
+
* data. It is a wrapper for [[I32]] as a WASM default (as generated by Rust bindings).
|
|
10
|
+
* It is not to be used, since it creates consensus mismatches.
|
|
11
|
+
*/
|
|
12
|
+
class isize extends I32_js_1.i32 {
|
|
13
|
+
constructor(registry, value) {
|
|
14
|
+
super(registry, value);
|
|
15
|
+
throw new Error('The `isize` type should not be used. Since it is platform-specific, it creates incompatibilities between native (generally i64) and WASM (always i32) code. Use one of the `i32` or `i64` types explicitly.');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.isize = isize;
|
package/cjs/primitive/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.USize = exports.usize = exports.U256 = exports.u256 = exports.U128 = exports.u128 = exports.U64 = exports.u64 = exports.U32 = exports.u32 = exports.U16 = exports.u16 = exports.U8 = exports.u8 = exports.I256 = exports.i256 = exports.I128 = exports.i128 = exports.I64 = exports.i64 = exports.I32 = exports.i32 = exports.I16 = exports.i16 = exports.I8 = exports.i8 = exports.F64 = exports.f64 = exports.F32 = exports.f32 = void 0;
|
|
3
|
+
exports.USize = exports.usize = exports.U256 = exports.u256 = exports.U128 = exports.u128 = exports.U64 = exports.u64 = exports.U32 = exports.u32 = exports.U16 = exports.u16 = exports.U8 = exports.u8 = exports.ISize = exports.isize = exports.I256 = exports.i256 = exports.I128 = exports.i128 = exports.I64 = exports.i64 = exports.I32 = exports.i32 = exports.I16 = exports.i16 = exports.I8 = exports.i8 = exports.F64 = exports.f64 = exports.F32 = exports.f32 = void 0;
|
|
4
4
|
var F32_js_1 = require("./F32.js");
|
|
5
5
|
Object.defineProperty(exports, "f32", { enumerable: true, get: function () { return F32_js_1.f32; } });
|
|
6
6
|
Object.defineProperty(exports, "F32", { enumerable: true, get: function () { return F32_js_1.f32; } });
|
|
@@ -25,6 +25,9 @@ Object.defineProperty(exports, "I128", { enumerable: true, get: function () { re
|
|
|
25
25
|
var I256_js_1 = require("./I256.js");
|
|
26
26
|
Object.defineProperty(exports, "i256", { enumerable: true, get: function () { return I256_js_1.i256; } });
|
|
27
27
|
Object.defineProperty(exports, "I256", { enumerable: true, get: function () { return I256_js_1.i256; } });
|
|
28
|
+
var ISize_js_1 = require("./ISize.js");
|
|
29
|
+
Object.defineProperty(exports, "isize", { enumerable: true, get: function () { return ISize_js_1.isize; } });
|
|
30
|
+
Object.defineProperty(exports, "ISize", { enumerable: true, get: function () { return ISize_js_1.isize; } });
|
|
28
31
|
var U8_js_1 = require("./U8.js");
|
|
29
32
|
Object.defineProperty(exports, "u8", { enumerable: true, get: function () { return U8_js_1.u8; } });
|
|
30
33
|
Object.defineProperty(exports, "U8", { enumerable: true, get: function () { return U8_js_1.u8; } });
|
package/extended/BitVec.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export declare class BitVec extends Raw {
|
|
|
17
17
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
18
18
|
*/
|
|
19
19
|
inspect(): Inspect;
|
|
20
|
+
/**
|
|
21
|
+
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
22
|
+
*/
|
|
20
23
|
toHuman(): string;
|
|
21
24
|
/**
|
|
22
25
|
* @description Returns the base runtime type name for this instance
|
package/extended/BitVec.js
CHANGED
|
@@ -55,6 +55,9 @@ export class BitVec extends Raw {
|
|
|
55
55
|
outer: [compactToU8a(__classPrivateFieldGet(this, _BitVec_decodedLength, "f")), super.toU8a()]
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
60
|
+
*/
|
|
58
61
|
toHuman() {
|
|
59
62
|
return `0b${[...this.toU8a(true)]
|
|
60
63
|
.map((d) => `00000000${d.toString(2)}`.slice(-8))
|
|
@@ -72,7 +75,7 @@ export class BitVec extends Raw {
|
|
|
72
75
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
73
76
|
*/
|
|
74
77
|
toU8a(isBare) {
|
|
75
|
-
const bitVec = super.toU8a();
|
|
78
|
+
const bitVec = super.toU8a(isBare);
|
|
76
79
|
return isBare
|
|
77
80
|
? bitVec
|
|
78
81
|
: u8aConcatStrict([compactToU8a(__classPrivateFieldGet(this, _BitVec_decodedLength, "f")), bitVec]);
|
package/extended/Linkage.d.ts
CHANGED
|
@@ -10,7 +10,13 @@ type TypeWithValues = [CodecClass, any[]];
|
|
|
10
10
|
export declare class Linkage<T extends Codec> extends Struct {
|
|
11
11
|
constructor(registry: Registry, Type: CodecClass | string, value?: unknown);
|
|
12
12
|
static withKey<O extends Codec>(Type: CodecClass | string): CodecClass<Linkage<O>>;
|
|
13
|
+
/**
|
|
14
|
+
* @description Returns the next item the Linkage is pointing to
|
|
15
|
+
*/
|
|
13
16
|
get previous(): Option<T>;
|
|
17
|
+
/**
|
|
18
|
+
* @description Returns the previous item the Linkage is pointing to
|
|
19
|
+
*/
|
|
14
20
|
get next(): Option<T>;
|
|
15
21
|
/**
|
|
16
22
|
* @description Returns the base runtime type name for this instance
|
|
@@ -19,7 +25,7 @@ export declare class Linkage<T extends Codec> extends Struct {
|
|
|
19
25
|
/**
|
|
20
26
|
* @description Custom toU8a which with bare mode does not return the linkage if empty
|
|
21
27
|
*/
|
|
22
|
-
toU8a(): Uint8Array;
|
|
28
|
+
toU8a(isBare?: boolean): Uint8Array;
|
|
23
29
|
}
|
|
24
30
|
/**
|
|
25
31
|
* @name LinkageResult
|
package/extended/Linkage.js
CHANGED
|
@@ -22,9 +22,15 @@ export class Linkage extends Struct {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* @description Returns the next item the Linkage is pointing to
|
|
27
|
+
*/
|
|
25
28
|
get previous() {
|
|
26
29
|
return this.get('previous');
|
|
27
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @description Returns the previous item the Linkage is pointing to
|
|
33
|
+
*/
|
|
28
34
|
get next() {
|
|
29
35
|
return this.get('next');
|
|
30
36
|
}
|
|
@@ -37,12 +43,12 @@ export class Linkage extends Struct {
|
|
|
37
43
|
/**
|
|
38
44
|
* @description Custom toU8a which with bare mode does not return the linkage if empty
|
|
39
45
|
*/
|
|
40
|
-
toU8a() {
|
|
46
|
+
toU8a(isBare) {
|
|
41
47
|
// As part of a storage query (where these appear), in the case of empty, the values
|
|
42
48
|
// are NOT populated by the node - follow the same logic, leaving it empty
|
|
43
49
|
return this.isEmpty
|
|
44
50
|
? EMPTY
|
|
45
|
-
: super.toU8a();
|
|
51
|
+
: super.toU8a(isBare);
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
/**
|
package/native/Bool.d.ts
CHANGED
|
@@ -66,7 +66,6 @@ export declare class bool extends Boolean implements Codec {
|
|
|
66
66
|
toString(): string;
|
|
67
67
|
/**
|
|
68
68
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
69
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
70
69
|
*/
|
|
71
70
|
toU8a(_isBare?: boolean): Uint8Array;
|
|
72
71
|
}
|
package/native/Bool.js
CHANGED
|
@@ -99,7 +99,6 @@ export class bool extends Boolean {
|
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
102
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
103
102
|
*/
|
|
104
103
|
toU8a(_isBare) {
|
|
105
104
|
return new Uint8Array([this.valueOf() ? 1 : 0]);
|
package/native/Date.d.ts
CHANGED
|
@@ -80,7 +80,6 @@ export declare class CodecDate extends Date implements INumber {
|
|
|
80
80
|
toString(): string;
|
|
81
81
|
/**
|
|
82
82
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
83
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
84
83
|
*/
|
|
85
84
|
toU8a(_isBare?: boolean): Uint8Array;
|
|
86
85
|
}
|
package/native/Date.js
CHANGED
|
@@ -130,7 +130,6 @@ export class CodecDate extends Date {
|
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
133
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
134
133
|
*/
|
|
135
134
|
toU8a(_isBare) {
|
|
136
135
|
return bnToU8a(this.toNumber(), U8A_OPTS);
|
package/native/Float.d.ts
CHANGED
package/native/Float.js
CHANGED
|
@@ -96,8 +96,10 @@ export class Float extends Number {
|
|
|
96
96
|
/**
|
|
97
97
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
98
98
|
*/
|
|
99
|
-
toU8a() {
|
|
100
|
-
return floatToU8a(this, {
|
|
99
|
+
toU8a(_isBare) {
|
|
100
|
+
return floatToU8a(this, {
|
|
101
|
+
bitLength: __classPrivateFieldGet(this, _Float_bitLength, "f")
|
|
102
|
+
});
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
_Float_bitLength = new WeakMap();
|
package/native/Raw.d.ts
CHANGED
|
@@ -78,7 +78,6 @@ export declare class Raw extends Uint8Array implements IU8a {
|
|
|
78
78
|
toString(): string;
|
|
79
79
|
/**
|
|
80
80
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
81
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
82
81
|
*/
|
|
83
82
|
toU8a(_isBare?: boolean): Uint8Array;
|
|
84
83
|
/**
|
package/native/Raw.js
CHANGED
|
@@ -120,7 +120,6 @@ export class Raw extends Uint8Array {
|
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
123
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
124
123
|
*/
|
|
125
124
|
toU8a(_isBare) {
|
|
126
125
|
return Uint8Array.from(this);
|
package/native/Set.d.ts
CHANGED
|
@@ -79,7 +79,6 @@ export declare class CodecSet extends Set<string> implements ISet<string> {
|
|
|
79
79
|
toString(): string;
|
|
80
80
|
/**
|
|
81
81
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
82
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
83
82
|
*/
|
|
84
83
|
toU8a(_isBare?: boolean): Uint8Array;
|
|
85
84
|
}
|
package/native/Set.js
CHANGED
|
@@ -203,7 +203,6 @@ export class CodecSet extends Set {
|
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
205
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
206
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
207
206
|
*/
|
|
208
207
|
toU8a(_isBare) {
|
|
209
208
|
return bnToU8a(this.valueEncoded, {
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"./cjs/detectPackage.js"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "10.
|
|
21
|
+
"version": "10.2.2",
|
|
22
22
|
"main": "./cjs/index.js",
|
|
23
23
|
"module": "./index.js",
|
|
24
24
|
"types": "./index.d.ts",
|
|
@@ -318,6 +318,11 @@
|
|
|
318
318
|
"require": "./cjs/primitive/I8.js",
|
|
319
319
|
"default": "./primitive/I8.js"
|
|
320
320
|
},
|
|
321
|
+
"./primitive/ISize": {
|
|
322
|
+
"types": "./primitive/ISize.d.ts",
|
|
323
|
+
"require": "./cjs/primitive/ISize.js",
|
|
324
|
+
"default": "./primitive/ISize.js"
|
|
325
|
+
},
|
|
321
326
|
"./primitive/U128": {
|
|
322
327
|
"types": "./primitive/U128.d.ts",
|
|
323
328
|
"require": "./cjs/primitive/U128.js",
|
|
@@ -435,8 +440,8 @@
|
|
|
435
440
|
}
|
|
436
441
|
},
|
|
437
442
|
"dependencies": {
|
|
438
|
-
"@polkadot/util": "^11.1.
|
|
439
|
-
"@polkadot/x-bigint": "^11.1.
|
|
443
|
+
"@polkadot/util": "^11.1.3",
|
|
444
|
+
"@polkadot/x-bigint": "^11.1.3",
|
|
440
445
|
"tslib": "^2.5.0"
|
|
441
446
|
}
|
|
442
447
|
}
|
package/packageInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageInfo = { name: '@polkadot/types-codec', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.
|
|
1
|
+
export const packageInfo = { name: '@polkadot/types-codec', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.2.2' };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Registry } from '../types/index.js';
|
|
2
|
+
import { i32 } from './I32.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name ISize
|
|
5
|
+
* @description
|
|
6
|
+
* A System default signed number, typically used in RPC to report non-consensus
|
|
7
|
+
* data. It is a wrapper for [[I32]] as a WASM default (as generated by Rust bindings).
|
|
8
|
+
* It is not to be used, since it creates consensus mismatches.
|
|
9
|
+
*/
|
|
10
|
+
export declare class isize extends i32 {
|
|
11
|
+
constructor(registry: Registry, value?: unknown);
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { i32 } from './I32.js';
|
|
2
|
+
/**
|
|
3
|
+
* @name ISize
|
|
4
|
+
* @description
|
|
5
|
+
* A System default signed number, typically used in RPC to report non-consensus
|
|
6
|
+
* data. It is a wrapper for [[I32]] as a WASM default (as generated by Rust bindings).
|
|
7
|
+
* It is not to be used, since it creates consensus mismatches.
|
|
8
|
+
*/
|
|
9
|
+
export class isize extends i32 {
|
|
10
|
+
constructor(registry, value) {
|
|
11
|
+
super(registry, value);
|
|
12
|
+
throw new Error('The `isize` type should not be used. Since it is platform-specific, it creates incompatibilities between native (generally i64) and WASM (always i32) code. Use one of the `i32` or `i64` types explicitly.');
|
|
13
|
+
}
|
|
14
|
+
}
|
package/primitive/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { i32, i32 as I32 } from './I32.js';
|
|
|
6
6
|
export { i64, i64 as I64 } from './I64.js';
|
|
7
7
|
export { i128, i128 as I128 } from './I128.js';
|
|
8
8
|
export { i256, i256 as I256 } from './I256.js';
|
|
9
|
+
export { isize, isize as ISize } from './ISize.js';
|
|
9
10
|
export { u8, u8 as U8 } from './U8.js';
|
|
10
11
|
export { u16, u16 as U16 } from './U16.js';
|
|
11
12
|
export { u32, u32 as U32 } from './U32.js';
|
package/primitive/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { i32, i32 as I32 } from './I32.js';
|
|
|
6
6
|
export { i64, i64 as I64 } from './I64.js';
|
|
7
7
|
export { i128, i128 as I128 } from './I128.js';
|
|
8
8
|
export { i256, i256 as I256 } from './I256.js';
|
|
9
|
+
export { isize, isize as ISize } from './ISize.js';
|
|
9
10
|
export { u8, u8 as U8 } from './U8.js';
|
|
10
11
|
export { u16, u16 as U16 } from './U16.js';
|
|
11
12
|
export { u32, u32 as U32 } from './U32.js';
|
package/types/codec.d.ts
CHANGED
|
@@ -90,7 +90,8 @@ export interface Codec {
|
|
|
90
90
|
toString(): string;
|
|
91
91
|
/**
|
|
92
92
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
93
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal
|
|
93
|
+
* @param isBare true when the value has none of the type-specific prefixes (internal use, only available on
|
|
94
|
+
* some Codec types, specifically those that add encodings such as length of indexes)
|
|
94
95
|
*/
|
|
95
96
|
toU8a(isBare?: BareOpts): Uint8Array;
|
|
96
97
|
}
|