@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.
- package/abstract/Array.js +15 -44
- package/abstract/Base.js +12 -28
- package/abstract/BigInt.js +3 -2
- package/abstract/Int.js +25 -52
- package/abstract/index.js +1 -0
- package/base/Compact.js +21 -45
- package/base/DoNotConstruct.js +3 -19
- package/base/Enum.js +37 -88
- package/base/Int.js +2 -5
- package/base/Null.js +12 -23
- package/base/Option.js +23 -59
- package/base/Result.js +8 -19
- package/base/Tuple.js +12 -29
- package/base/UInt.js +2 -4
- package/base/Vec.js +7 -25
- package/base/VecAny.js +2 -2
- package/base/VecFixed.js +8 -20
- package/base/index.js +1 -0
- package/bundle.js +1 -0
- package/cjs/abstract/Array.js +13 -47
- package/cjs/abstract/Base.js +12 -30
- package/cjs/abstract/BigInt.js +1 -4
- package/cjs/abstract/Int.js +25 -55
- package/cjs/abstract/index.js +0 -3
- package/cjs/base/Compact.js +21 -48
- package/cjs/base/DoNotConstruct.js +3 -21
- package/cjs/base/Enum.js +34 -92
- package/cjs/base/Int.js +0 -7
- package/cjs/base/Null.js +10 -25
- package/cjs/base/Option.js +23 -63
- package/cjs/base/Result.js +6 -21
- package/cjs/base/Tuple.js +12 -33
- package/cjs/base/UInt.js +0 -6
- package/cjs/base/Vec.js +7 -31
- package/cjs/base/VecAny.js +0 -4
- package/cjs/base/VecFixed.js +8 -25
- package/cjs/base/index.js +0 -12
- package/cjs/bundle.js +0 -13
- package/cjs/detectPackage.js +2 -4
- package/cjs/extended/BTreeMap.js +1 -5
- package/cjs/extended/BTreeSet.js +17 -57
- package/cjs/extended/BitVec.js +11 -25
- package/cjs/extended/Bytes.js +9 -20
- package/cjs/extended/HashMap.js +1 -5
- package/cjs/extended/Linkage.js +5 -20
- package/cjs/extended/Map.js +16 -62
- package/cjs/extended/OptionBool.js +8 -21
- package/cjs/extended/Range.js +3 -13
- package/cjs/extended/RangeInclusive.js +1 -6
- package/cjs/extended/Type.js +1 -7
- package/cjs/extended/U8aFixed.js +2 -15
- package/cjs/extended/WrapperKeepOpaque.js +8 -28
- package/cjs/extended/WrapperOpaque.js +2 -8
- package/cjs/extended/index.js +0 -14
- package/cjs/index.js +0 -3
- package/cjs/native/Bool.js +14 -32
- package/cjs/native/Date.js +18 -40
- package/cjs/native/Float.js +11 -29
- package/cjs/native/Json.js +14 -33
- package/cjs/native/Raw.js +18 -41
- package/cjs/native/Set.js +21 -67
- package/cjs/native/Struct.data.js +1 -0
- package/cjs/native/Struct.js +33 -83
- package/cjs/native/Text.js +20 -44
- package/cjs/native/index.js +0 -8
- package/cjs/packageInfo.js +3 -1
- package/cjs/primitive/F32.js +0 -3
- package/cjs/primitive/F64.js +0 -3
- package/cjs/primitive/I128.js +0 -3
- package/cjs/primitive/I16.js +0 -3
- package/cjs/primitive/I256.js +0 -3
- package/cjs/primitive/I32.js +0 -3
- package/cjs/primitive/I64.js +0 -3
- package/cjs/primitive/I8.js +0 -3
- package/cjs/primitive/U128.js +0 -3
- package/cjs/primitive/U16.js +0 -3
- package/cjs/primitive/U256.js +0 -3
- package/cjs/primitive/U32.js +0 -3
- package/cjs/primitive/U64.js +0 -3
- package/cjs/primitive/U8.js +0 -3
- package/cjs/primitive/USize.js +0 -4
- package/cjs/primitive/index.js +0 -15
- package/cjs/types/index.js +0 -8
- package/cjs/utils/compareArray.js +1 -4
- package/cjs/utils/compareMap.js +4 -9
- package/cjs/utils/compareSet.js +4 -6
- package/cjs/utils/decodeU8a.js +10 -18
- package/cjs/utils/index.js +0 -9
- package/cjs/utils/mapToTypeMap.js +0 -4
- package/cjs/utils/sanitize.js +66 -71
- package/cjs/utils/sortValues.js +5 -18
- package/cjs/utils/typeToConstructor.js +1 -2
- package/cjs/utils/typesToMap.js +1 -3
- package/cjs/utils/util.js +1 -2
- package/detectOther.js +2 -0
- package/detectPackage.js +2 -0
- package/extended/BTreeMap.js +1 -2
- package/extended/BTreeSet.js +17 -53
- package/extended/BitVec.js +13 -22
- package/extended/Bytes.js +11 -17
- package/extended/HashMap.js +1 -2
- package/extended/Linkage.js +5 -12
- package/extended/Map.js +16 -54
- package/extended/OptionBool.js +8 -17
- package/extended/Range.js +4 -11
- package/extended/RangeInclusive.js +1 -3
- package/extended/Type.js +3 -4
- package/extended/U8aFixed.js +4 -12
- package/extended/WrapperKeepOpaque.js +8 -23
- package/extended/WrapperOpaque.js +2 -5
- package/extended/index.js +1 -0
- package/index.js +1 -0
- package/native/Bool.js +16 -30
- package/native/Date.js +18 -37
- package/native/Float.js +12 -27
- package/native/Json.js +16 -30
- package/native/Raw.js +20 -39
- package/native/Set.js +21 -63
- package/native/Struct.data.js +1 -0
- package/native/Struct.js +33 -80
- package/native/Text.js +20 -40
- package/native/index.js +1 -0
- package/package.json +2 -2
- package/packageInfo.js +3 -1
- package/primitive/F32.js +2 -1
- package/primitive/F64.js +2 -1
- package/primitive/I128.js +2 -1
- package/primitive/I16.js +2 -1
- package/primitive/I256.js +2 -1
- package/primitive/I32.js +2 -1
- package/primitive/I64.js +2 -1
- package/primitive/I8.js +2 -1
- package/primitive/U128.js +2 -1
- package/primitive/U16.js +2 -1
- package/primitive/U256.js +2 -1
- package/primitive/U32.js +2 -1
- package/primitive/U64.js +2 -1
- package/primitive/U8.js +2 -1
- package/primitive/USize.js +2 -2
- package/primitive/index.js +1 -0
- package/types/index.js +1 -0
- package/utils/compareArray.js +4 -3
- package/utils/compareMap.js +4 -7
- package/utils/compareSet.js +4 -5
- package/utils/decodeU8a.js +12 -15
- package/utils/index.js +1 -0
- package/utils/mapToTypeMap.js +2 -3
- package/utils/sanitize.js +66 -60
- package/utils/sortValues.js +6 -15
- package/utils/typeToConstructor.js +1 -0
- package/utils/typesToMap.js +1 -2
- package/utils/util.js +1 -0
package/cjs/native/Text.js
CHANGED
|
@@ -4,44 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Text = void 0;
|
|
7
|
-
|
|
8
7
|
var _util = require("@polkadot/util");
|
|
9
|
-
|
|
10
8
|
var _Raw = require("./Raw");
|
|
11
|
-
|
|
12
9
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
13
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
+
|
|
14
12
|
const MAX_LENGTH = 128 * 1024;
|
|
15
|
-
/** @internal */
|
|
16
13
|
|
|
14
|
+
/** @internal */
|
|
17
15
|
function decodeText(value) {
|
|
18
16
|
if ((0, _util.isU8a)(value)) {
|
|
19
17
|
if (!value.length) {
|
|
20
18
|
return ['', 0];
|
|
21
|
-
}
|
|
22
|
-
// (the same applies in e.g. Bytes, where length is added at encoding-time)
|
|
23
|
-
|
|
19
|
+
}
|
|
24
20
|
|
|
21
|
+
// for Raw, the internal buffer does not have an internal length
|
|
22
|
+
// (the same applies in e.g. Bytes, where length is added at encoding-time)
|
|
25
23
|
if (value instanceof _Raw.Raw) {
|
|
26
24
|
return [(0, _util.u8aToString)(value), 0];
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
const [offset, length] = (0, _util.compactFromU8aLim)(value);
|
|
30
27
|
const total = offset + length;
|
|
31
|
-
|
|
32
28
|
if (length > MAX_LENGTH) {
|
|
33
29
|
throw new Error(`Text: length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
|
34
30
|
} else if (total > value.length) {
|
|
35
31
|
throw new Error(`Text: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
return [(0, _util.u8aToString)(value.subarray(offset, total)), total];
|
|
39
34
|
} else if ((0, _util.isHex)(value)) {
|
|
40
35
|
return [(0, _util.u8aToString)((0, _util.hexToU8a)(value)), 0];
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
return [value ? value.toString() : '', 0];
|
|
44
38
|
}
|
|
39
|
+
|
|
45
40
|
/**
|
|
46
41
|
* @name Text
|
|
47
42
|
* @description
|
|
@@ -50,140 +45,121 @@ function decodeText(value) {
|
|
|
50
45
|
* object, inheriting all methods exposed from `String`.
|
|
51
46
|
* @noInheritDoc
|
|
52
47
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
48
|
class Text extends String {
|
|
56
49
|
#override = null;
|
|
57
|
-
|
|
58
50
|
constructor(registry, value) {
|
|
59
51
|
const [str, decodedLength] = decodeText(value);
|
|
60
52
|
super(str);
|
|
61
53
|
this.registry = registry;
|
|
62
54
|
this.initialU8aLength = decodedLength;
|
|
63
55
|
}
|
|
56
|
+
|
|
64
57
|
/**
|
|
65
58
|
* @description The length of the value when encoded as a Uint8Array
|
|
66
59
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
60
|
get encodedLength() {
|
|
70
61
|
return this.toU8a().length;
|
|
71
62
|
}
|
|
63
|
+
|
|
72
64
|
/**
|
|
73
65
|
* @description returns a hash of the contents
|
|
74
66
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
67
|
get hash() {
|
|
78
68
|
return this.registry.hash(this.toU8a());
|
|
79
69
|
}
|
|
70
|
+
|
|
80
71
|
/**
|
|
81
72
|
* @description Checks if the value is an empty value
|
|
82
73
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
74
|
get isEmpty() {
|
|
86
75
|
return this.length === 0;
|
|
87
76
|
}
|
|
77
|
+
|
|
88
78
|
/**
|
|
89
79
|
* @description The length of the value
|
|
90
80
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
81
|
get length() {
|
|
94
82
|
// only included here since we ignore inherited docs
|
|
95
83
|
return super.length;
|
|
96
84
|
}
|
|
85
|
+
|
|
97
86
|
/**
|
|
98
87
|
* @description Compares the value of the input to see if there is a match
|
|
99
88
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
89
|
eq(other) {
|
|
103
90
|
return (0, _util.isString)(other) ? this.toString() === other.toString() : false;
|
|
104
91
|
}
|
|
92
|
+
|
|
105
93
|
/**
|
|
106
94
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
107
95
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
96
|
inspect() {
|
|
111
97
|
const value = (0, _util.stringToU8a)(super.toString());
|
|
112
98
|
return {
|
|
113
99
|
outer: value.length ? [(0, _util.compactToU8a)(value.length), value] : [(0, _util.compactToU8a)(value.length)]
|
|
114
100
|
};
|
|
115
101
|
}
|
|
102
|
+
|
|
116
103
|
/**
|
|
117
104
|
* @description Set an override value for this
|
|
118
105
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
106
|
setOverride(override) {
|
|
122
107
|
this.#override = override;
|
|
123
108
|
}
|
|
109
|
+
|
|
124
110
|
/**
|
|
125
111
|
* @description Returns a hex string representation of the value
|
|
126
112
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
113
|
toHex() {
|
|
130
114
|
// like with Vec<u8>, when we are encoding to hex, we don't actually add
|
|
131
115
|
// the length prefix (it is already implied by the actual string length)
|
|
132
116
|
return (0, _util.u8aToHex)(this.toU8a(true));
|
|
133
117
|
}
|
|
118
|
+
|
|
134
119
|
/**
|
|
135
120
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
136
121
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
122
|
toHuman() {
|
|
140
123
|
return this.toJSON();
|
|
141
124
|
}
|
|
125
|
+
|
|
142
126
|
/**
|
|
143
127
|
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
144
128
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
129
|
toJSON() {
|
|
148
130
|
return this.toString();
|
|
149
131
|
}
|
|
132
|
+
|
|
150
133
|
/**
|
|
151
134
|
* @description Converts the value in a best-fit primitive form
|
|
152
135
|
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
136
|
toPrimitive() {
|
|
156
137
|
return this.toJSON();
|
|
157
138
|
}
|
|
139
|
+
|
|
158
140
|
/**
|
|
159
141
|
* @description Returns the base runtime type name for this instance
|
|
160
142
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
143
|
toRawType() {
|
|
164
144
|
return 'Text';
|
|
165
145
|
}
|
|
146
|
+
|
|
166
147
|
/**
|
|
167
148
|
* @description Returns the string representation of the value
|
|
168
149
|
*/
|
|
169
|
-
|
|
170
|
-
|
|
171
150
|
toString() {
|
|
172
151
|
return this.#override || super.toString();
|
|
173
152
|
}
|
|
153
|
+
|
|
174
154
|
/**
|
|
175
155
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
176
156
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
177
157
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
158
|
toU8a(isBare) {
|
|
181
159
|
// NOTE Here we use the super toString (we are not taking overrides into account,
|
|
182
160
|
// rather encoding the original value the string was constructed with)
|
|
183
161
|
const encoded = (0, _util.stringToU8a)(super.toString());
|
|
184
162
|
return isBare ? encoded : (0, _util.compactAddLength)(encoded);
|
|
185
163
|
}
|
|
186
|
-
|
|
187
164
|
}
|
|
188
|
-
|
|
189
165
|
exports.Text = Text;
|
package/cjs/native/index.js
CHANGED
|
@@ -69,19 +69,11 @@ Object.defineProperty(exports, "bool", {
|
|
|
69
69
|
return _Bool.bool;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
|
|
73
72
|
var _Bool = require("./Bool");
|
|
74
|
-
|
|
75
73
|
var _Date = require("./Date");
|
|
76
|
-
|
|
77
74
|
var _Float = require("./Float");
|
|
78
|
-
|
|
79
75
|
var _Json = require("./Json");
|
|
80
|
-
|
|
81
76
|
var _Raw = require("./Raw");
|
|
82
|
-
|
|
83
77
|
var _Set = require("./Set");
|
|
84
|
-
|
|
85
78
|
var _Struct = require("./Struct");
|
|
86
|
-
|
|
87
79
|
var _Text = require("./Text");
|
package/cjs/packageInfo.js
CHANGED
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.packageInfo = void 0;
|
|
7
7
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
|
|
9
10
|
// Do not edit, auto-generated by @polkadot/dev
|
|
11
|
+
|
|
10
12
|
const packageInfo = {
|
|
11
13
|
name: '@polkadot/types-codec',
|
|
12
14
|
path: typeof __dirname === 'string' ? __dirname : 'auto',
|
|
13
15
|
type: 'cjs',
|
|
14
|
-
version: '9.
|
|
16
|
+
version: '9.6.2'
|
|
15
17
|
};
|
|
16
18
|
exports.packageInfo = packageInfo;
|
package/cjs/primitive/F32.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.f32 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Float = require("../native/Float");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class f32 extends _Float.Float.with(32) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__FloatType = 'f32';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.f32 = f32;
|
package/cjs/primitive/F64.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.f64 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Float = require("../native/Float");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class f64 extends _Float.Float.with(64) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__FloatType = 'f64';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.f64 = f64;
|
package/cjs/primitive/I128.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.i128 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Int = require("../base/Int");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class i128 extends _Int.Int.with(128) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__IntType = 'i128';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.i128 = i128;
|
package/cjs/primitive/I16.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.i16 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Int = require("../base/Int");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class i16 extends _Int.Int.with(16) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__IntType = 'i16';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.i16 = i16;
|
package/cjs/primitive/I256.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.i256 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Int = require("../base/Int");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class i256 extends _Int.Int.with(256) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__IntType = 'i256';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.i256 = i256;
|
package/cjs/primitive/I32.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.i32 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Int = require("../base/Int");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class i32 extends _Int.Int.with(32) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__IntType = 'i32';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.i32 = i32;
|
package/cjs/primitive/I64.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.i64 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Int = require("../base/Int");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class i64 extends _Int.Int.with(64) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__IntType = 'i64';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.i64 = i64;
|
package/cjs/primitive/I8.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.i8 = void 0;
|
|
7
|
-
|
|
8
7
|
var _Int = require("../base/Int");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class i8 extends _Int.Int.with(8) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__IntType = 'i8';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.i8 = i8;
|
package/cjs/primitive/U128.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.u128 = void 0;
|
|
7
|
-
|
|
8
7
|
var _UInt = require("../base/UInt");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class u128 extends _UInt.UInt.with(128) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__UIntType = 'u128';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.u128 = u128;
|
package/cjs/primitive/U16.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.u16 = void 0;
|
|
7
|
-
|
|
8
7
|
var _UInt = require("../base/UInt");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class u16 extends _UInt.UInt.with(16) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__UIntType = 'u16';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.u16 = u16;
|
package/cjs/primitive/U256.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.u256 = void 0;
|
|
7
|
-
|
|
8
7
|
var _UInt = require("../base/UInt");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class u256 extends _UInt.UInt.with(256) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__UIntType = 'u256';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.u256 = u256;
|
package/cjs/primitive/U32.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.u32 = void 0;
|
|
7
|
-
|
|
8
7
|
var _UInt = require("../base/UInt");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class u32 extends _UInt.UInt.with(32) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__UIntType = 'u32';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.u32 = u32;
|
package/cjs/primitive/U64.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.u64 = void 0;
|
|
7
|
-
|
|
8
7
|
var _UInt = require("../base/UInt");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class u64 extends _UInt.UInt.with(64) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__UIntType = 'u64';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.u64 = u64;
|
package/cjs/primitive/U8.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.u8 = void 0;
|
|
7
|
-
|
|
8
7
|
var _UInt = require("../base/UInt");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -19,5 +17,4 @@ class u8 extends _UInt.UInt.with(8) {
|
|
|
19
17
|
// NOTE without this, we cannot properly determine extensions
|
|
20
18
|
__UIntType = 'u8';
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.u8 = u8;
|
package/cjs/primitive/USize.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.usize = void 0;
|
|
7
|
-
|
|
8
7
|
var _U = require("./U32");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
10
|
|
|
@@ -22,7 +20,5 @@ class usize extends _U.u32 {
|
|
|
22
20
|
super(registry, value);
|
|
23
21
|
throw new Error('The `usize` type should not be used. Since it is platform-specific, it creates incompatibilities between native (generally u64) and WASM (always u32) code. Use one of the `u32` or `u64` types explicitly.');
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
exports.usize = usize;
|
package/cjs/primitive/index.js
CHANGED
|
@@ -183,33 +183,18 @@ Object.defineProperty(exports, "usize", {
|
|
|
183
183
|
return _USize.usize;
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
|
-
|
|
187
186
|
var _F = require("./F32");
|
|
188
|
-
|
|
189
187
|
var _F2 = require("./F64");
|
|
190
|
-
|
|
191
188
|
var _I = require("./I8");
|
|
192
|
-
|
|
193
189
|
var _I2 = require("./I16");
|
|
194
|
-
|
|
195
190
|
var _I3 = require("./I32");
|
|
196
|
-
|
|
197
191
|
var _I4 = require("./I64");
|
|
198
|
-
|
|
199
192
|
var _I5 = require("./I128");
|
|
200
|
-
|
|
201
193
|
var _I6 = require("./I256");
|
|
202
|
-
|
|
203
194
|
var _U = require("./U8");
|
|
204
|
-
|
|
205
195
|
var _U2 = require("./U16");
|
|
206
|
-
|
|
207
196
|
var _U3 = require("./U32");
|
|
208
|
-
|
|
209
197
|
var _U4 = require("./U64");
|
|
210
|
-
|
|
211
198
|
var _U5 = require("./U128");
|
|
212
|
-
|
|
213
199
|
var _U6 = require("./U256");
|
|
214
|
-
|
|
215
200
|
var _USize = require("./USize");
|
package/cjs/types/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _codec = require("./codec");
|
|
8
|
-
|
|
9
7
|
Object.keys(_codec).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _codec[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_codec).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _helpers = require("./helpers");
|
|
21
|
-
|
|
22
18
|
Object.keys(_helpers).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _helpers[key]) return;
|
|
@@ -29,9 +25,7 @@ Object.keys(_helpers).forEach(function (key) {
|
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
});
|
|
32
|
-
|
|
33
28
|
var _interfaces = require("./interfaces");
|
|
34
|
-
|
|
35
29
|
Object.keys(_interfaces).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
37
31
|
if (key in exports && exports[key] === _interfaces[key]) return;
|
|
@@ -42,9 +36,7 @@ Object.keys(_interfaces).forEach(function (key) {
|
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
38
|
});
|
|
45
|
-
|
|
46
39
|
var _registry = require("./registry");
|
|
47
|
-
|
|
48
40
|
Object.keys(_registry).forEach(function (key) {
|
|
49
41
|
if (key === "default" || key === "__esModule") return;
|
|
50
42
|
if (key in exports && exports[key] === _registry[key]) return;
|
|
@@ -4,19 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.compareArray = compareArray;
|
|
7
|
-
|
|
8
7
|
var _util = require("@polkadot/util");
|
|
9
|
-
|
|
10
8
|
var _util2 = require("./util");
|
|
11
|
-
|
|
12
9
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
13
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
+
|
|
14
12
|
// NOTE These are used internally and when comparing objects, expects that
|
|
15
13
|
// when the second is an Codec[] that the first has to be as well
|
|
16
14
|
function compareArray(a, b) {
|
|
17
15
|
if (Array.isArray(b)) {
|
|
18
16
|
return a.length === b.length && (0, _util.isUndefined)(a.find((v, index) => (0, _util2.hasEq)(v) ? !v.eq(b[index]) : v !== b[index]));
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
return false;
|
|
22
19
|
}
|
package/cjs/utils/compareMap.js
CHANGED
|
@@ -4,28 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.compareMap = compareMap;
|
|
7
|
-
|
|
8
7
|
var _util = require("@polkadot/util");
|
|
9
|
-
|
|
10
8
|
var _util2 = require("./util");
|
|
11
|
-
|
|
12
9
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
13
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
+
|
|
14
12
|
function hasMismatch(a, b) {
|
|
15
13
|
return (0, _util.isUndefined)(a) || ((0, _util2.hasEq)(a) ? !a.eq(b) : a !== b);
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
function notEntry(value) {
|
|
19
16
|
return !Array.isArray(value) || value.length !== 2;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
function compareMapArray(a, b) {
|
|
23
19
|
// equal number of entries and each entry in the array should match
|
|
24
20
|
return a.size === b.length && !b.some(e => notEntry(e) || hasMismatch(a.get(e[0]), e[1]));
|
|
25
|
-
}
|
|
26
|
-
// when the second is an Map<string, Codec> that the first has to be as well
|
|
27
|
-
|
|
21
|
+
}
|
|
28
22
|
|
|
23
|
+
// NOTE These are used internally and when comparing objects, expects that
|
|
24
|
+
// when the second is an Map<string, Codec> that the first has to be as well
|
|
29
25
|
function compareMap(a, b) {
|
|
30
26
|
if (Array.isArray(b)) {
|
|
31
27
|
return compareMapArray(a, b);
|
|
@@ -34,6 +30,5 @@ function compareMap(a, b) {
|
|
|
34
30
|
} else if ((0, _util.isObject)(b)) {
|
|
35
31
|
return compareMapArray(a, Object.entries(b));
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
return false;
|
|
39
34
|
}
|
package/cjs/utils/compareSet.js
CHANGED
|
@@ -4,18 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.compareSet = compareSet;
|
|
7
|
-
|
|
8
7
|
var _util = require("@polkadot/util");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
|
+
|
|
12
11
|
function compareSetArray(a, b) {
|
|
13
12
|
// equal number of entries and each entry in the array should match
|
|
14
13
|
return a.size === b.length && !b.some(e => !a.has(e));
|
|
15
|
-
}
|
|
16
|
-
// when the second is an Set<string, Codec> that the first has to be as well
|
|
17
|
-
|
|
14
|
+
}
|
|
18
15
|
|
|
16
|
+
// NOTE These are used internally and when comparing objects, expects that
|
|
17
|
+
// when the second is an Set<string, Codec> that the first has to be as well
|
|
19
18
|
function compareSet(a, b) {
|
|
20
19
|
if (Array.isArray(b)) {
|
|
21
20
|
return compareSetArray(a, b);
|
|
@@ -24,6 +23,5 @@ function compareSet(a, b) {
|
|
|
24
23
|
} else if ((0, _util.isObject)(b)) {
|
|
25
24
|
return compareSetArray(a, Object.values(b));
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
return false;
|
|
29
27
|
}
|