@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/base/VecFixed.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
3
4
|
import { isU8a, u8aConcatStrict } from '@polkadot/util';
|
|
4
5
|
import { AbstractArray } from "../abstract/Array.js";
|
|
5
6
|
import { decodeU8aVec, typeToConstructor } from "../utils/index.js";
|
|
6
7
|
import { decodeVec } from "./Vec.js";
|
|
7
|
-
|
|
8
8
|
function noopSetDefinition(d) {
|
|
9
9
|
return d;
|
|
10
10
|
}
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* @name VecFixed
|
|
13
14
|
* @description
|
|
14
15
|
* This manages codec arrays of a fixed length
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
17
|
export class VecFixed extends AbstractArray {
|
|
19
18
|
#Type;
|
|
20
|
-
|
|
21
19
|
constructor(registry, Type, length, value = [], {
|
|
22
20
|
definition,
|
|
23
21
|
setDefinition = noopSetDefinition
|
|
@@ -26,12 +24,11 @@ export class VecFixed extends AbstractArray {
|
|
|
26
24
|
this.#Type = definition || setDefinition(typeToConstructor(registry, Type));
|
|
27
25
|
this.initialU8aLength = (isU8a(value) ? decodeU8aVec(registry, this, value, 0, this.#Type) : decodeVec(registry, this, value, 0, this.#Type))[1];
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
static with(Type, length) {
|
|
31
|
-
let definition;
|
|
28
|
+
let definition;
|
|
32
29
|
|
|
30
|
+
// eslint-disable-next-line no-return-assign
|
|
33
31
|
const setDefinition = d => definition = d;
|
|
34
|
-
|
|
35
32
|
return class extends VecFixed {
|
|
36
33
|
constructor(registry, value) {
|
|
37
34
|
super(registry, Type, length, value, {
|
|
@@ -39,55 +36,46 @@ export class VecFixed extends AbstractArray {
|
|
|
39
36
|
setDefinition
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
};
|
|
44
40
|
}
|
|
41
|
+
|
|
45
42
|
/**
|
|
46
43
|
* @description The type for the items
|
|
47
44
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
45
|
get Type() {
|
|
51
46
|
return new this.#Type(this.registry).toRawType();
|
|
52
47
|
}
|
|
48
|
+
|
|
53
49
|
/**
|
|
54
50
|
* @description The length of the value when encoded as a Uint8Array
|
|
55
51
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
52
|
get encodedLength() {
|
|
59
53
|
let total = 0;
|
|
60
|
-
|
|
61
54
|
for (let i = 0; i < this.length; i++) {
|
|
62
55
|
total += this[i].encodedLength;
|
|
63
56
|
}
|
|
64
|
-
|
|
65
57
|
return total;
|
|
66
58
|
}
|
|
59
|
+
|
|
67
60
|
/**
|
|
68
61
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
69
62
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
63
|
inspect() {
|
|
73
64
|
return {
|
|
74
65
|
inner: this.inspectInner()
|
|
75
66
|
};
|
|
76
67
|
}
|
|
77
|
-
|
|
78
68
|
toU8a() {
|
|
79
69
|
// we override, we don't add the length prefix for ourselves, and at the same time we
|
|
80
70
|
// ignore isBare on entries, since they should be properly encoded at all times
|
|
81
71
|
const encoded = this.toU8aInner();
|
|
82
72
|
return encoded.length ? u8aConcatStrict(encoded) : new Uint8Array([]);
|
|
83
73
|
}
|
|
74
|
+
|
|
84
75
|
/**
|
|
85
76
|
* @description Returns the base runtime type name for this instance
|
|
86
77
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
78
|
toRawType() {
|
|
90
79
|
return `[${this.Type};${this.length}]`;
|
|
91
80
|
}
|
|
92
|
-
|
|
93
81
|
}
|
package/base/index.js
CHANGED
package/bundle.js
CHANGED
package/cjs/abstract/Array.js
CHANGED
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AbstractArray = void 0;
|
|
7
|
-
|
|
8
7
|
var _util = require("@polkadot/util");
|
|
9
|
-
|
|
10
8
|
var _compareArray = require("../utils/compareArray");
|
|
11
|
-
|
|
12
9
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
13
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
14
11
|
|
|
@@ -27,179 +24,148 @@ class AbstractArray extends Array {
|
|
|
27
24
|
static get [Symbol.species]() {
|
|
28
25
|
return Array;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
constructor(registry, length) {
|
|
32
28
|
super(length);
|
|
33
29
|
this.registry = registry;
|
|
34
30
|
}
|
|
31
|
+
|
|
35
32
|
/**
|
|
36
33
|
* @description The length of the value when encoded as a Uint8Array
|
|
37
34
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
35
|
get encodedLength() {
|
|
41
36
|
// We need to loop through all entries since they may have a variable length themselves,
|
|
42
37
|
// e.g. when a Vec or Compact is contained withing, it has a variable length based on data
|
|
43
38
|
let total = (0, _util.compactToU8a)(this.length).length;
|
|
44
|
-
|
|
45
39
|
for (let i = 0; i < this.length; i++) {
|
|
46
40
|
total += this[i].encodedLength;
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
return total;
|
|
50
43
|
}
|
|
44
|
+
|
|
51
45
|
/**
|
|
52
46
|
* @description returns a hash of the contents
|
|
53
47
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
48
|
get hash() {
|
|
57
49
|
return this.registry.hash(this.toU8a());
|
|
58
50
|
}
|
|
51
|
+
|
|
59
52
|
/**
|
|
60
53
|
* @description Checks if the value is an empty value
|
|
61
54
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
55
|
get isEmpty() {
|
|
65
56
|
return this.length === 0;
|
|
66
57
|
}
|
|
58
|
+
|
|
67
59
|
/**
|
|
68
60
|
* @description The length of the value
|
|
69
61
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
62
|
get length() {
|
|
73
63
|
// only included here since we ignore inherited docs
|
|
74
64
|
return super.length;
|
|
75
65
|
}
|
|
66
|
+
|
|
76
67
|
/**
|
|
77
68
|
* @description Compares the value of the input to see if there is a match
|
|
78
69
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
70
|
eq(other) {
|
|
82
71
|
return (0, _compareArray.compareArray)(this, other);
|
|
83
72
|
}
|
|
73
|
+
|
|
84
74
|
/**
|
|
85
75
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
86
76
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
77
|
inspect() {
|
|
90
78
|
return {
|
|
91
79
|
inner: this.inspectInner(),
|
|
92
80
|
outer: [(0, _util.compactToU8a)(this.length)]
|
|
93
81
|
};
|
|
94
82
|
}
|
|
95
|
-
|
|
96
83
|
inspectInner() {
|
|
97
84
|
const inner = new Array(this.length);
|
|
98
|
-
|
|
99
85
|
for (let i = 0; i < this.length; i++) {
|
|
100
86
|
inner[i] = this[i].inspect();
|
|
101
87
|
}
|
|
102
|
-
|
|
103
88
|
return inner;
|
|
104
89
|
}
|
|
90
|
+
|
|
105
91
|
/**
|
|
106
92
|
* @description Converts the Object to an standard JavaScript Array
|
|
107
93
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
94
|
toArray() {
|
|
111
95
|
return Array.from(this);
|
|
112
96
|
}
|
|
97
|
+
|
|
113
98
|
/**
|
|
114
99
|
* @description Returns a hex string representation of the value
|
|
115
100
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
101
|
toHex() {
|
|
119
102
|
return (0, _util.u8aToHex)(this.toU8a());
|
|
120
103
|
}
|
|
104
|
+
|
|
121
105
|
/**
|
|
122
106
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
123
107
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
108
|
toHuman(isExtended) {
|
|
127
109
|
const result = new Array(this.length);
|
|
128
|
-
|
|
129
110
|
for (let i = 0; i < this.length; i++) {
|
|
130
111
|
result[i] = this[i] && this[i].toHuman(isExtended);
|
|
131
112
|
}
|
|
132
|
-
|
|
133
113
|
return result;
|
|
134
114
|
}
|
|
115
|
+
|
|
135
116
|
/**
|
|
136
117
|
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
137
118
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
119
|
toJSON() {
|
|
141
120
|
const result = new Array(this.length);
|
|
142
|
-
|
|
143
121
|
for (let i = 0; i < this.length; i++) {
|
|
144
122
|
// We actually log inside the U8a decoding and use JSON.stringify(...), which
|
|
145
123
|
// means that the Vec may be partially populated (same applies to toHuman, same check)
|
|
146
124
|
result[i] = this[i] && this[i].toJSON();
|
|
147
125
|
}
|
|
148
|
-
|
|
149
126
|
return result;
|
|
150
127
|
}
|
|
128
|
+
|
|
151
129
|
/**
|
|
152
130
|
* @description Converts the value in a best-fit primitive form
|
|
153
131
|
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
132
|
toPrimitive() {
|
|
157
133
|
const result = new Array(this.length);
|
|
158
|
-
|
|
159
134
|
for (let i = 0; i < this.length; i++) {
|
|
160
135
|
result[i] = this[i] && this[i].toPrimitive();
|
|
161
136
|
}
|
|
162
|
-
|
|
163
137
|
return result;
|
|
164
138
|
}
|
|
139
|
+
|
|
165
140
|
/**
|
|
166
141
|
* @description Returns the base runtime type name for this instance
|
|
167
142
|
*/
|
|
168
143
|
|
|
169
|
-
|
|
170
144
|
/**
|
|
171
145
|
* @description Returns the string representation of the value
|
|
172
146
|
*/
|
|
173
147
|
toString() {
|
|
174
148
|
const result = new Array(this.length);
|
|
175
|
-
|
|
176
149
|
for (let i = 0; i < this.length; i++) {
|
|
177
150
|
result[i] = this[i].toString();
|
|
178
151
|
}
|
|
179
|
-
|
|
180
152
|
return `[${result.join(', ')}]`;
|
|
181
153
|
}
|
|
154
|
+
|
|
182
155
|
/**
|
|
183
156
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
184
157
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
185
158
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
159
|
toU8a(isBare) {
|
|
189
160
|
const encoded = this.toU8aInner();
|
|
190
161
|
return isBare ? (0, _util.u8aConcatStrict)(encoded) : (0, _util.u8aConcatStrict)([(0, _util.compactToU8a)(this.length), ...encoded]);
|
|
191
162
|
}
|
|
192
|
-
|
|
193
163
|
toU8aInner(isBare) {
|
|
194
164
|
const encoded = new Array(this.length);
|
|
195
|
-
|
|
196
165
|
for (let i = 0; i < this.length; i++) {
|
|
197
166
|
encoded[i] = this[i].toU8a(isBare);
|
|
198
167
|
}
|
|
199
|
-
|
|
200
168
|
return encoded;
|
|
201
169
|
}
|
|
202
|
-
|
|
203
170
|
}
|
|
204
|
-
|
|
205
171
|
exports.AbstractArray = AbstractArray;
|
package/cjs/abstract/Base.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AbstractBase = void 0;
|
|
7
|
-
|
|
8
7
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
9
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
9
|
|
|
@@ -14,118 +13,101 @@ exports.AbstractBase = void 0;
|
|
|
14
13
|
*/
|
|
15
14
|
class AbstractBase {
|
|
16
15
|
#raw;
|
|
17
|
-
|
|
18
16
|
constructor(registry, value, initialU8aLength) {
|
|
19
17
|
this.#raw = value;
|
|
20
18
|
this.initialU8aLength = initialU8aLength;
|
|
21
19
|
this.registry = registry;
|
|
22
20
|
}
|
|
21
|
+
|
|
23
22
|
/**
|
|
24
23
|
* @description The length of the value when encoded as a Uint8Array
|
|
25
24
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
25
|
get encodedLength() {
|
|
29
26
|
return this.toU8a().length;
|
|
30
27
|
}
|
|
28
|
+
|
|
31
29
|
/**
|
|
32
30
|
* @description returns a hash of the contents
|
|
33
31
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
32
|
get hash() {
|
|
37
33
|
return this.registry.hash(this.toU8a());
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
get inner() {
|
|
41
36
|
return this.#raw;
|
|
42
37
|
}
|
|
38
|
+
|
|
43
39
|
/**
|
|
44
40
|
* @description Checks if the value is an empty value
|
|
45
41
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
42
|
get isEmpty() {
|
|
49
43
|
return this.#raw.isEmpty;
|
|
50
44
|
}
|
|
45
|
+
|
|
51
46
|
/**
|
|
52
47
|
* @description Compares the value of the input to see if there is a match
|
|
53
48
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
49
|
eq(other) {
|
|
57
50
|
return this.#raw.eq(other);
|
|
58
51
|
}
|
|
52
|
+
|
|
59
53
|
/**
|
|
60
54
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
61
55
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
56
|
inspect() {
|
|
65
57
|
return this.#raw.inspect();
|
|
66
58
|
}
|
|
59
|
+
|
|
67
60
|
/**
|
|
68
61
|
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
|
69
62
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
63
|
toHex(isLe) {
|
|
73
64
|
return this.#raw.toHex(isLe);
|
|
74
65
|
}
|
|
66
|
+
|
|
75
67
|
/**
|
|
76
68
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
77
69
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
70
|
toHuman(isExtended) {
|
|
81
71
|
return this.#raw.toHuman(isExtended);
|
|
82
72
|
}
|
|
73
|
+
|
|
83
74
|
/**
|
|
84
75
|
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
85
76
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
77
|
toJSON() {
|
|
89
78
|
return this.#raw.toJSON();
|
|
90
79
|
}
|
|
80
|
+
|
|
91
81
|
/**
|
|
92
82
|
* @description Converts the value in a best-fit primitive form
|
|
93
83
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
84
|
toPrimitive() {
|
|
97
85
|
return this.#raw.toPrimitive();
|
|
98
86
|
}
|
|
87
|
+
|
|
99
88
|
/**
|
|
100
89
|
* @description Returns the string representation of the value
|
|
101
90
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
91
|
toString() {
|
|
105
92
|
return this.#raw.toString();
|
|
106
93
|
}
|
|
94
|
+
|
|
107
95
|
/**
|
|
108
96
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
109
97
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
110
98
|
*/
|
|
111
|
-
|
|
112
|
-
|
|
113
99
|
toU8a(isBare) {
|
|
114
100
|
return this.#raw.toU8a(isBare);
|
|
115
101
|
}
|
|
102
|
+
|
|
116
103
|
/**
|
|
117
104
|
* @description Returns the base runtime type name for this instance
|
|
118
105
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
106
|
toRawType() {
|
|
122
107
|
return 'Base';
|
|
123
108
|
}
|
|
124
|
-
|
|
125
109
|
unwrap() {
|
|
126
110
|
return this.#raw;
|
|
127
111
|
}
|
|
128
|
-
|
|
129
112
|
}
|
|
130
|
-
|
|
131
113
|
exports.AbstractBase = AbstractBase;
|
package/cjs/abstract/BigInt.js
CHANGED
|
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AbstractBigInt = void 0;
|
|
7
|
-
|
|
8
7
|
var _xBigint = require("@polkadot/x-bigint");
|
|
9
|
-
|
|
10
8
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
|
+
|
|
12
11
|
// @ts-expect-error not extensible, we make it extensible here
|
|
13
12
|
class AbstractBigInt extends _xBigint.BigInt {
|
|
14
13
|
// @ts-expect-error super() not required, the self magic does that
|
|
@@ -17,7 +16,5 @@ class AbstractBigInt extends _xBigint.BigInt {
|
|
|
17
16
|
Object.setPrototypeOf(self, AbstractBigInt.prototype);
|
|
18
17
|
return self;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
exports.AbstractBigInt = AbstractBigInt;
|