@polkadot/types-codec 7.4.2-7 → 7.5.2-0
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.js +0 -4
- package/abstract/AbstractInt.js +10 -24
- package/base/Base.js +15 -29
- package/base/Compact.js +20 -34
- package/base/DoNotConstruct.js +14 -23
- package/base/Enum.js +36 -70
- package/base/Null.js +2 -3
- package/base/Option.js +19 -37
- package/base/Tuple.js +5 -11
- package/base/Vec.js +6 -12
- package/base/VecFixed.js +4 -10
- package/extended/BTreeSet.js +4 -13
- package/extended/BitVec.js +5 -11
- package/extended/Map.js +8 -27
- package/extended/Range.js +4 -10
- package/extended/WrapperKeepOpaque.cjs +11 -3
- package/extended/WrapperKeepOpaque.d.ts +4 -2
- package/extended/WrapperKeepOpaque.js +15 -24
- package/extended/WrapperOpaque.cjs +7 -31
- package/extended/WrapperOpaque.d.ts +6 -10
- package/extended/WrapperOpaque.js +7 -30
- package/native/Bool.js +0 -2
- package/native/Date.js +0 -2
- package/native/Json.js +0 -2
- package/native/Raw.js +0 -3
- package/native/Set.js +18 -32
- package/native/Struct.js +12 -30
- package/native/Text.js +7 -20
- package/package.json +2 -2
- package/packageInfo.cjs +1 -1
- package/packageInfo.js +1 -1
- package/primitive/I128.js +2 -5
- package/primitive/I16.js +2 -5
- package/primitive/I256.js +2 -5
- package/primitive/I32.js +2 -5
- package/primitive/I64.js +2 -5
- package/primitive/I8.js +2 -5
- package/primitive/U128.js +2 -5
- package/primitive/U16.js +2 -5
- package/primitive/U256.js +2 -5
- package/primitive/U32.js +2 -5
- package/primitive/U64.js +2 -5
- package/primitive/U8.js +2 -5
package/native/Text.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
|
-
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
4
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
3
|
import { assert, compactAddLength, compactFromU8a, hexToU8a, isHex, isString, isU8a, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
|
@@ -42,26 +40,15 @@ function decodeText(value) {
|
|
|
42
40
|
// - Strings should probably be trimmed (docs do come through with extra padding)
|
|
43
41
|
|
|
44
42
|
|
|
45
|
-
var _initialU8aLength = /*#__PURE__*/_classPrivateFieldLooseKey("initialU8aLength");
|
|
46
|
-
|
|
47
|
-
var _override = /*#__PURE__*/_classPrivateFieldLooseKey("override");
|
|
48
|
-
|
|
49
43
|
export class Text extends String {
|
|
44
|
+
#initialU8aLength;
|
|
45
|
+
#override = null;
|
|
46
|
+
|
|
50
47
|
constructor(registry, value) {
|
|
51
48
|
const [str, decodedLength] = decodeText(value);
|
|
52
49
|
super(str);
|
|
53
|
-
this.registry = void 0;
|
|
54
|
-
this.createdAtHash = void 0;
|
|
55
|
-
Object.defineProperty(this, _initialU8aLength, {
|
|
56
|
-
writable: true,
|
|
57
|
-
value: void 0
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(this, _override, {
|
|
60
|
-
writable: true,
|
|
61
|
-
value: null
|
|
62
|
-
});
|
|
63
50
|
this.registry = registry;
|
|
64
|
-
|
|
51
|
+
this.#initialU8aLength = decodedLength;
|
|
65
52
|
}
|
|
66
53
|
/**
|
|
67
54
|
* @description The length of the value when encoded as a Uint8Array
|
|
@@ -77,7 +64,7 @@ export class Text extends String {
|
|
|
77
64
|
|
|
78
65
|
|
|
79
66
|
get initialU8aLength() {
|
|
80
|
-
return
|
|
67
|
+
return this.#initialU8aLength;
|
|
81
68
|
}
|
|
82
69
|
/**
|
|
83
70
|
* @description returns a hash of the contents
|
|
@@ -118,7 +105,7 @@ export class Text extends String {
|
|
|
118
105
|
|
|
119
106
|
|
|
120
107
|
setOverride(override) {
|
|
121
|
-
|
|
108
|
+
this.#override = override;
|
|
122
109
|
}
|
|
123
110
|
/**
|
|
124
111
|
* @description Returns a hex string representation of the value
|
|
@@ -160,7 +147,7 @@ export class Text extends String {
|
|
|
160
147
|
|
|
161
148
|
|
|
162
149
|
toString() {
|
|
163
|
-
return
|
|
150
|
+
return this.#override || super.toString();
|
|
164
151
|
}
|
|
165
152
|
/**
|
|
166
153
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./detectPackage.cjs"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "7.
|
|
23
|
+
"version": "7.5.2-0",
|
|
24
24
|
"main": "index.cjs",
|
|
25
25
|
"module": "index.js",
|
|
26
26
|
"types": "index.d.ts",
|
|
@@ -400,6 +400,6 @@
|
|
|
400
400
|
},
|
|
401
401
|
"dependencies": {
|
|
402
402
|
"@babel/runtime": "^7.16.7",
|
|
403
|
-
"@polkadot/util": "^8.3.
|
|
403
|
+
"@polkadot/util": "^8.3.3"
|
|
404
404
|
}
|
|
405
405
|
}
|
package/packageInfo.cjs
CHANGED
package/packageInfo.js
CHANGED
package/primitive/I128.js
CHANGED
|
@@ -8,9 +8,6 @@ import { Int } from "../base/Int.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class i128 extends Int.with(128) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__IntType = 'i128';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__IntType = 'i128';
|
|
16
13
|
}
|
package/primitive/I16.js
CHANGED
package/primitive/I256.js
CHANGED
|
@@ -8,9 +8,6 @@ import { Int } from "../base/Int.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class i256 extends Int.with(256) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__IntType = 'i256';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__IntType = 'i256';
|
|
16
13
|
}
|
package/primitive/I32.js
CHANGED
package/primitive/I64.js
CHANGED
package/primitive/I8.js
CHANGED
package/primitive/U128.js
CHANGED
|
@@ -8,9 +8,6 @@ import { UInt } from "../base/UInt.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class u128 extends UInt.with(128) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__UIntType = 'u128';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__UIntType = 'u128';
|
|
16
13
|
}
|
package/primitive/U16.js
CHANGED
|
@@ -8,9 +8,6 @@ import { UInt } from "../base/UInt.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class u16 extends UInt.with(16) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__UIntType = 'u16';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__UIntType = 'u16';
|
|
16
13
|
}
|
package/primitive/U256.js
CHANGED
|
@@ -8,9 +8,6 @@ import { UInt } from "../base/UInt.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class u256 extends UInt.with(256) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__UIntType = 'u256';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__UIntType = 'u256';
|
|
16
13
|
}
|
package/primitive/U32.js
CHANGED
|
@@ -8,9 +8,6 @@ import { UInt } from "../base/UInt.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class u32 extends UInt.with(32) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__UIntType = 'u32';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__UIntType = 'u32';
|
|
16
13
|
}
|
package/primitive/U64.js
CHANGED
|
@@ -8,9 +8,6 @@ import { UInt } from "../base/UInt.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class u64 extends UInt.with(64) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__UIntType = 'u64';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__UIntType = 'u64';
|
|
16
13
|
}
|
package/primitive/U8.js
CHANGED
|
@@ -8,9 +8,6 @@ import { UInt } from "../base/UInt.js";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export class u8 extends UInt.with(8) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.__UIntType = 'u8';
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
// NOTE without this, we cannot properly determine extensions
|
|
12
|
+
__UIntType = 'u8';
|
|
16
13
|
}
|