@polkadot/types-codec 8.14.1 → 8.14.2-11
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/base/Enum.d.ts +0 -5
- package/base/Enum.js +21 -27
- package/base/Result.d.ts +0 -8
- package/base/Result.js +0 -16
- package/cjs/base/Enum.js +21 -27
- package/cjs/base/Result.js +0 -16
- package/cjs/native/Set.js +12 -9
- package/cjs/native/Struct.js +33 -26
- package/cjs/packageInfo.js +1 -1
- package/native/Set.js +12 -9
- package/native/Struct.d.ts +10 -7
- package/native/Struct.js +33 -26
- package/package.json +1 -1
- package/packageInfo.js +1 -1
package/base/Enum.d.ts
CHANGED
|
@@ -58,11 +58,6 @@ export declare class Enum implements IEnum {
|
|
|
58
58
|
* @description Checks if the Enum points to a [[Null]] type
|
|
59
59
|
*/
|
|
60
60
|
get isNone(): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* @description Checks if the Enum points to a [[Null]] type
|
|
63
|
-
* @deprecated use isNone
|
|
64
|
-
*/
|
|
65
|
-
get isNull(): boolean;
|
|
66
61
|
/**
|
|
67
62
|
* @description The available keys for this enum
|
|
68
63
|
*/
|
package/base/Enum.js
CHANGED
|
@@ -192,37 +192,40 @@ export class Enum {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
static with(Types) {
|
|
195
|
-
|
|
196
|
-
const asKeys = new Array(keys.length);
|
|
197
|
-
const isKeys = new Array(keys.length);
|
|
198
|
-
|
|
199
|
-
for (let i = 0; i < keys.length; i++) {
|
|
200
|
-
const name = stringPascalCase(keys[i]);
|
|
201
|
-
asKeys[i] = `as${name}`;
|
|
202
|
-
isKeys[i] = `is${name}`;
|
|
203
|
-
}
|
|
195
|
+
var _class;
|
|
204
196
|
|
|
205
197
|
let definition; // eslint-disable-next-line no-return-assign
|
|
206
198
|
|
|
207
199
|
const setDefinition = d => definition = d;
|
|
208
200
|
|
|
209
|
-
return class extends Enum {
|
|
201
|
+
return _class = class extends Enum {
|
|
210
202
|
constructor(registry, value, index) {
|
|
211
203
|
super(registry, Types, value, index, {
|
|
212
204
|
definition,
|
|
213
205
|
setDefinition
|
|
214
206
|
});
|
|
215
|
-
|
|
216
|
-
objectProperties(this, asKeys, (k, i) => {
|
|
217
|
-
if (!this[isKeys[i]]) {
|
|
218
|
-
throw new Error(`Cannot convert '${this.type}' via ${k}`);
|
|
219
|
-
}
|
|
207
|
+
}
|
|
220
208
|
|
|
221
|
-
|
|
222
|
-
|
|
209
|
+
}, (() => {
|
|
210
|
+
const keys = Array.isArray(Types) ? Types : Object.keys(Types);
|
|
211
|
+
const asKeys = new Array(keys.length);
|
|
212
|
+
const isKeys = new Array(keys.length);
|
|
213
|
+
|
|
214
|
+
for (let i = 0; i < keys.length; i++) {
|
|
215
|
+
const name = stringPascalCase(keys[i]);
|
|
216
|
+
asKeys[i] = `as${name}`;
|
|
217
|
+
isKeys[i] = `is${name}`;
|
|
223
218
|
}
|
|
224
219
|
|
|
225
|
-
|
|
220
|
+
objectProperties(_class.prototype, isKeys, (_, i, self) => self.type === keys[i]);
|
|
221
|
+
objectProperties(_class.prototype, asKeys, (k, i, self) => {
|
|
222
|
+
if (self.type !== keys[i]) {
|
|
223
|
+
throw new Error(`Cannot convert '${self.type}' via ${k}`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return self.value;
|
|
227
|
+
});
|
|
228
|
+
})(), _class;
|
|
226
229
|
}
|
|
227
230
|
/**
|
|
228
231
|
* @description The length of the value when encoded as a Uint8Array
|
|
@@ -280,15 +283,6 @@ export class Enum {
|
|
|
280
283
|
get isNone() {
|
|
281
284
|
return this.#raw instanceof Null;
|
|
282
285
|
}
|
|
283
|
-
/**
|
|
284
|
-
* @description Checks if the Enum points to a [[Null]] type
|
|
285
|
-
* @deprecated use isNone
|
|
286
|
-
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
get isNull() {
|
|
290
|
-
return this.isNone;
|
|
291
|
-
}
|
|
292
286
|
/**
|
|
293
287
|
* @description The available keys for this enum
|
|
294
288
|
*/
|
package/base/Result.d.ts
CHANGED
|
@@ -15,10 +15,6 @@ export declare class Result<O extends Codec, E extends Codec> extends Enum imple
|
|
|
15
15
|
* @description Returns the wrapper Err value (if isErr)
|
|
16
16
|
*/
|
|
17
17
|
get asErr(): E;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use asErr
|
|
20
|
-
*/
|
|
21
|
-
get asError(): E;
|
|
22
18
|
/**
|
|
23
19
|
* @description Returns the wrapper Ok value (if isOk)
|
|
24
20
|
*/
|
|
@@ -31,10 +27,6 @@ export declare class Result<O extends Codec, E extends Codec> extends Enum imple
|
|
|
31
27
|
* @description Checks if the Result wraps an Err value
|
|
32
28
|
*/
|
|
33
29
|
get isErr(): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use isErr
|
|
36
|
-
*/
|
|
37
|
-
get isError(): boolean;
|
|
38
30
|
/**
|
|
39
31
|
* @description Checks if the Result wraps an Ok value
|
|
40
32
|
*/
|
package/base/Result.js
CHANGED
|
@@ -37,14 +37,6 @@ export class Result extends Enum {
|
|
|
37
37
|
|
|
38
38
|
return this.value;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated Use asErr
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
get asError() {
|
|
46
|
-
return this.asErr;
|
|
47
|
-
}
|
|
48
40
|
/**
|
|
49
41
|
* @description Returns the wrapper Ok value (if isOk)
|
|
50
42
|
*/
|
|
@@ -73,14 +65,6 @@ export class Result extends Enum {
|
|
|
73
65
|
get isErr() {
|
|
74
66
|
return !this.isOk;
|
|
75
67
|
}
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated Use isErr
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
get isError() {
|
|
82
|
-
return this.isErr;
|
|
83
|
-
}
|
|
84
68
|
/**
|
|
85
69
|
* @description Checks if the Result wraps an Ok value
|
|
86
70
|
*/
|
package/cjs/base/Enum.js
CHANGED
|
@@ -210,37 +210,40 @@ class Enum {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
static with(Types) {
|
|
213
|
-
|
|
214
|
-
const asKeys = new Array(keys.length);
|
|
215
|
-
const isKeys = new Array(keys.length);
|
|
216
|
-
|
|
217
|
-
for (let i = 0; i < keys.length; i++) {
|
|
218
|
-
const name = (0, _util.stringPascalCase)(keys[i]);
|
|
219
|
-
asKeys[i] = `as${name}`;
|
|
220
|
-
isKeys[i] = `is${name}`;
|
|
221
|
-
}
|
|
213
|
+
var _class;
|
|
222
214
|
|
|
223
215
|
let definition; // eslint-disable-next-line no-return-assign
|
|
224
216
|
|
|
225
217
|
const setDefinition = d => definition = d;
|
|
226
218
|
|
|
227
|
-
return class extends Enum {
|
|
219
|
+
return _class = class extends Enum {
|
|
228
220
|
constructor(registry, value, index) {
|
|
229
221
|
super(registry, Types, value, index, {
|
|
230
222
|
definition,
|
|
231
223
|
setDefinition
|
|
232
224
|
});
|
|
233
|
-
|
|
234
|
-
(0, _util.objectProperties)(this, asKeys, (k, i) => {
|
|
235
|
-
if (!this[isKeys[i]]) {
|
|
236
|
-
throw new Error(`Cannot convert '${this.type}' via ${k}`);
|
|
237
|
-
}
|
|
225
|
+
}
|
|
238
226
|
|
|
239
|
-
|
|
240
|
-
|
|
227
|
+
}, (() => {
|
|
228
|
+
const keys = Array.isArray(Types) ? Types : Object.keys(Types);
|
|
229
|
+
const asKeys = new Array(keys.length);
|
|
230
|
+
const isKeys = new Array(keys.length);
|
|
231
|
+
|
|
232
|
+
for (let i = 0; i < keys.length; i++) {
|
|
233
|
+
const name = (0, _util.stringPascalCase)(keys[i]);
|
|
234
|
+
asKeys[i] = `as${name}`;
|
|
235
|
+
isKeys[i] = `is${name}`;
|
|
241
236
|
}
|
|
242
237
|
|
|
243
|
-
|
|
238
|
+
(0, _util.objectProperties)(_class.prototype, isKeys, (_, i, self) => self.type === keys[i]);
|
|
239
|
+
(0, _util.objectProperties)(_class.prototype, asKeys, (k, i, self) => {
|
|
240
|
+
if (self.type !== keys[i]) {
|
|
241
|
+
throw new Error(`Cannot convert '${self.type}' via ${k}`);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return self.value;
|
|
245
|
+
});
|
|
246
|
+
})(), _class;
|
|
244
247
|
}
|
|
245
248
|
/**
|
|
246
249
|
* @description The length of the value when encoded as a Uint8Array
|
|
@@ -298,15 +301,6 @@ class Enum {
|
|
|
298
301
|
get isNone() {
|
|
299
302
|
return this.#raw instanceof _Null.Null;
|
|
300
303
|
}
|
|
301
|
-
/**
|
|
302
|
-
* @description Checks if the Enum points to a [[Null]] type
|
|
303
|
-
* @deprecated use isNone
|
|
304
|
-
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
get isNull() {
|
|
308
|
-
return this.isNone;
|
|
309
|
-
}
|
|
310
304
|
/**
|
|
311
305
|
* @description The available keys for this enum
|
|
312
306
|
*/
|
package/cjs/base/Result.js
CHANGED
|
@@ -45,14 +45,6 @@ class Result extends _Enum.Enum {
|
|
|
45
45
|
|
|
46
46
|
return this.value;
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Use asErr
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
get asError() {
|
|
54
|
-
return this.asErr;
|
|
55
|
-
}
|
|
56
48
|
/**
|
|
57
49
|
* @description Returns the wrapper Ok value (if isOk)
|
|
58
50
|
*/
|
|
@@ -81,14 +73,6 @@ class Result extends _Enum.Enum {
|
|
|
81
73
|
get isErr() {
|
|
82
74
|
return !this.isOk;
|
|
83
75
|
}
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated Use isErr
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
get isError() {
|
|
90
|
-
return this.isErr;
|
|
91
|
-
}
|
|
92
76
|
/**
|
|
93
77
|
* @description Checks if the Result wraps an Ok value
|
|
94
78
|
*/
|
package/cjs/native/Set.js
CHANGED
|
@@ -109,20 +109,23 @@ class CodecSet extends Set {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
static with(values, bitLength) {
|
|
112
|
-
|
|
113
|
-
const isKeys = new Array(keys.length);
|
|
112
|
+
var _class;
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
isKeys[i] = `is${(0, _util.stringPascalCase)(keys[i])}`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return class extends CodecSet {
|
|
114
|
+
return _class = class extends CodecSet {
|
|
120
115
|
constructor(registry, value) {
|
|
121
116
|
super(registry, values, value, bitLength);
|
|
122
|
-
(0, _util.objectProperties)(this, isKeys, (_, i) => this.strings.includes(keys[i]));
|
|
123
117
|
}
|
|
124
118
|
|
|
125
|
-
}
|
|
119
|
+
}, (() => {
|
|
120
|
+
const keys = Object.keys(values);
|
|
121
|
+
const isKeys = new Array(keys.length);
|
|
122
|
+
|
|
123
|
+
for (let i = 0; i < keys.length; i++) {
|
|
124
|
+
isKeys[i] = `is${(0, _util.stringPascalCase)(keys[i])}`;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
(0, _util.objectProperties)(_class.prototype, isKeys, (_, i, self) => self.strings.includes(keys[i]));
|
|
128
|
+
})(), _class;
|
|
126
129
|
}
|
|
127
130
|
/**
|
|
128
131
|
* @description The length of the value when encoded as a Uint8Array
|
package/cjs/native/Struct.js
CHANGED
|
@@ -106,21 +106,24 @@ class Struct extends Map {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
static with(Types, jsonMap) {
|
|
109
|
-
|
|
109
|
+
var _class;
|
|
110
|
+
|
|
110
111
|
let definition; // eslint-disable-next-line no-return-assign
|
|
111
112
|
|
|
112
113
|
const setDefinition = d => definition = d;
|
|
113
114
|
|
|
114
|
-
return class extends Struct {
|
|
115
|
+
return _class = class extends Struct {
|
|
115
116
|
constructor(registry, value) {
|
|
116
117
|
super(registry, Types, value, jsonMap, {
|
|
117
118
|
definition,
|
|
118
119
|
setDefinition
|
|
119
120
|
});
|
|
120
|
-
(0, _util.objectProperties)(this, keys, k => this.get(k));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
}
|
|
123
|
+
}, (() => {
|
|
124
|
+
const keys = Object.keys(Types);
|
|
125
|
+
(0, _util.objectProperties)(_class.prototype, keys, (k, _, self) => self.get(k));
|
|
126
|
+
})(), _class;
|
|
124
127
|
}
|
|
125
128
|
/**
|
|
126
129
|
* @description The available keys for this struct
|
|
@@ -130,10 +133,6 @@ class Struct extends Map {
|
|
|
130
133
|
get defKeys() {
|
|
131
134
|
return this.#Types[1];
|
|
132
135
|
}
|
|
133
|
-
|
|
134
|
-
getT(key) {
|
|
135
|
-
return this.get(key);
|
|
136
|
-
}
|
|
137
136
|
/**
|
|
138
137
|
* @description Checks if the value is an empty value
|
|
139
138
|
*/
|
|
@@ -148,21 +147,6 @@ class Struct extends Map {
|
|
|
148
147
|
|
|
149
148
|
return true;
|
|
150
149
|
}
|
|
151
|
-
/**
|
|
152
|
-
* @description Returns the Type description of the structure
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
get Type() {
|
|
157
|
-
const result = {};
|
|
158
|
-
const [Types, keys] = this.#Types;
|
|
159
|
-
|
|
160
|
-
for (let i = 0; i < keys.length; i++) {
|
|
161
|
-
result[keys[i]] = new Types[i](this.registry).toRawType();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return result;
|
|
165
|
-
}
|
|
166
150
|
/**
|
|
167
151
|
* @description The length of the value when encoded as a Uint8Array
|
|
168
152
|
*/
|
|
@@ -185,6 +169,21 @@ class Struct extends Map {
|
|
|
185
169
|
get hash() {
|
|
186
170
|
return this.registry.hash(this.toU8a());
|
|
187
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* @description Returns the Type description of the structure
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
get Type() {
|
|
178
|
+
const result = {};
|
|
179
|
+
const [Types, keys] = this.#Types;
|
|
180
|
+
|
|
181
|
+
for (let i = 0; i < keys.length; i++) {
|
|
182
|
+
result[keys[i]] = new Types[i](this.registry).toRawType();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
188
187
|
/**
|
|
189
188
|
* @description Compares the value of the input to see if there is a match
|
|
190
189
|
*/
|
|
@@ -195,12 +194,12 @@ class Struct extends Map {
|
|
|
195
194
|
}
|
|
196
195
|
/**
|
|
197
196
|
* @description Returns a specific names entry in the structure
|
|
198
|
-
* @param
|
|
197
|
+
* @param key The name of the entry to retrieve
|
|
199
198
|
*/
|
|
200
199
|
|
|
201
200
|
|
|
202
|
-
get(
|
|
203
|
-
return super.get(
|
|
201
|
+
get(key) {
|
|
202
|
+
return super.get(key);
|
|
204
203
|
}
|
|
205
204
|
/**
|
|
206
205
|
* @description Returns the values of a member at a specific index (Rather use get(name) for performance)
|
|
@@ -210,6 +209,14 @@ class Struct extends Map {
|
|
|
210
209
|
getAtIndex(index) {
|
|
211
210
|
return this.toArray()[index];
|
|
212
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* @description Returns the a types value by name
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
getT(key) {
|
|
218
|
+
return super.get(key);
|
|
219
|
+
}
|
|
213
220
|
/**
|
|
214
221
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
215
222
|
*/
|
package/cjs/packageInfo.js
CHANGED
package/native/Set.js
CHANGED
|
@@ -97,20 +97,23 @@ export class CodecSet extends Set {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
static with(values, bitLength) {
|
|
100
|
-
|
|
101
|
-
const isKeys = new Array(keys.length);
|
|
100
|
+
var _class;
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
isKeys[i] = `is${stringPascalCase(keys[i])}`;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return class extends CodecSet {
|
|
102
|
+
return _class = class extends CodecSet {
|
|
108
103
|
constructor(registry, value) {
|
|
109
104
|
super(registry, values, value, bitLength);
|
|
110
|
-
objectProperties(this, isKeys, (_, i) => this.strings.includes(keys[i]));
|
|
111
105
|
}
|
|
112
106
|
|
|
113
|
-
}
|
|
107
|
+
}, (() => {
|
|
108
|
+
const keys = Object.keys(values);
|
|
109
|
+
const isKeys = new Array(keys.length);
|
|
110
|
+
|
|
111
|
+
for (let i = 0; i < keys.length; i++) {
|
|
112
|
+
isKeys[i] = `is${stringPascalCase(keys[i])}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
objectProperties(_class.prototype, isKeys, (_, i, self) => self.strings.includes(keys[i]));
|
|
116
|
+
})(), _class;
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
116
119
|
* @description The length of the value when encoded as a Uint8Array
|
package/native/Struct.d.ts
CHANGED
|
@@ -35,15 +35,10 @@ export declare class Struct<S extends TypesDef = TypesDef, V extends {
|
|
|
35
35
|
* @description The available keys for this struct
|
|
36
36
|
*/
|
|
37
37
|
get defKeys(): string[];
|
|
38
|
-
getT<T>(key: string): T;
|
|
39
38
|
/**
|
|
40
39
|
* @description Checks if the value is an empty value
|
|
41
40
|
*/
|
|
42
41
|
get isEmpty(): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* @description Returns the Type description of the structure
|
|
45
|
-
*/
|
|
46
|
-
get Type(): E;
|
|
47
42
|
/**
|
|
48
43
|
* @description The length of the value when encoded as a Uint8Array
|
|
49
44
|
*/
|
|
@@ -52,19 +47,27 @@ export declare class Struct<S extends TypesDef = TypesDef, V extends {
|
|
|
52
47
|
* @description returns a hash of the contents
|
|
53
48
|
*/
|
|
54
49
|
get hash(): IU8a;
|
|
50
|
+
/**
|
|
51
|
+
* @description Returns the Type description of the structure
|
|
52
|
+
*/
|
|
53
|
+
get Type(): E;
|
|
55
54
|
/**
|
|
56
55
|
* @description Compares the value of the input to see if there is a match
|
|
57
56
|
*/
|
|
58
57
|
eq(other?: unknown): boolean;
|
|
59
58
|
/**
|
|
60
59
|
* @description Returns a specific names entry in the structure
|
|
61
|
-
* @param
|
|
60
|
+
* @param key The name of the entry to retrieve
|
|
62
61
|
*/
|
|
63
|
-
get(
|
|
62
|
+
get(key: keyof S): Codec | undefined;
|
|
64
63
|
/**
|
|
65
64
|
* @description Returns the values of a member at a specific index (Rather use get(name) for performance)
|
|
66
65
|
*/
|
|
67
66
|
getAtIndex(index: number): Codec;
|
|
67
|
+
/**
|
|
68
|
+
* @description Returns the a types value by name
|
|
69
|
+
*/
|
|
70
|
+
getT<T>(key: string): T;
|
|
68
71
|
/**
|
|
69
72
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
70
73
|
*/
|
package/native/Struct.js
CHANGED
|
@@ -95,21 +95,24 @@ export class Struct extends Map {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
static with(Types, jsonMap) {
|
|
98
|
-
|
|
98
|
+
var _class;
|
|
99
|
+
|
|
99
100
|
let definition; // eslint-disable-next-line no-return-assign
|
|
100
101
|
|
|
101
102
|
const setDefinition = d => definition = d;
|
|
102
103
|
|
|
103
|
-
return class extends Struct {
|
|
104
|
+
return _class = class extends Struct {
|
|
104
105
|
constructor(registry, value) {
|
|
105
106
|
super(registry, Types, value, jsonMap, {
|
|
106
107
|
definition,
|
|
107
108
|
setDefinition
|
|
108
109
|
});
|
|
109
|
-
objectProperties(this, keys, k => this.get(k));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
}
|
|
112
|
+
}, (() => {
|
|
113
|
+
const keys = Object.keys(Types);
|
|
114
|
+
objectProperties(_class.prototype, keys, (k, _, self) => self.get(k));
|
|
115
|
+
})(), _class;
|
|
113
116
|
}
|
|
114
117
|
/**
|
|
115
118
|
* @description The available keys for this struct
|
|
@@ -119,10 +122,6 @@ export class Struct extends Map {
|
|
|
119
122
|
get defKeys() {
|
|
120
123
|
return this.#Types[1];
|
|
121
124
|
}
|
|
122
|
-
|
|
123
|
-
getT(key) {
|
|
124
|
-
return this.get(key);
|
|
125
|
-
}
|
|
126
125
|
/**
|
|
127
126
|
* @description Checks if the value is an empty value
|
|
128
127
|
*/
|
|
@@ -137,21 +136,6 @@ export class Struct extends Map {
|
|
|
137
136
|
|
|
138
137
|
return true;
|
|
139
138
|
}
|
|
140
|
-
/**
|
|
141
|
-
* @description Returns the Type description of the structure
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
get Type() {
|
|
146
|
-
const result = {};
|
|
147
|
-
const [Types, keys] = this.#Types;
|
|
148
|
-
|
|
149
|
-
for (let i = 0; i < keys.length; i++) {
|
|
150
|
-
result[keys[i]] = new Types[i](this.registry).toRawType();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return result;
|
|
154
|
-
}
|
|
155
139
|
/**
|
|
156
140
|
* @description The length of the value when encoded as a Uint8Array
|
|
157
141
|
*/
|
|
@@ -174,6 +158,21 @@ export class Struct extends Map {
|
|
|
174
158
|
get hash() {
|
|
175
159
|
return this.registry.hash(this.toU8a());
|
|
176
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* @description Returns the Type description of the structure
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
get Type() {
|
|
167
|
+
const result = {};
|
|
168
|
+
const [Types, keys] = this.#Types;
|
|
169
|
+
|
|
170
|
+
for (let i = 0; i < keys.length; i++) {
|
|
171
|
+
result[keys[i]] = new Types[i](this.registry).toRawType();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
177
176
|
/**
|
|
178
177
|
* @description Compares the value of the input to see if there is a match
|
|
179
178
|
*/
|
|
@@ -184,12 +183,12 @@ export class Struct extends Map {
|
|
|
184
183
|
}
|
|
185
184
|
/**
|
|
186
185
|
* @description Returns a specific names entry in the structure
|
|
187
|
-
* @param
|
|
186
|
+
* @param key The name of the entry to retrieve
|
|
188
187
|
*/
|
|
189
188
|
|
|
190
189
|
|
|
191
|
-
get(
|
|
192
|
-
return super.get(
|
|
190
|
+
get(key) {
|
|
191
|
+
return super.get(key);
|
|
193
192
|
}
|
|
194
193
|
/**
|
|
195
194
|
* @description Returns the values of a member at a specific index (Rather use get(name) for performance)
|
|
@@ -199,6 +198,14 @@ export class Struct extends Map {
|
|
|
199
198
|
getAtIndex(index) {
|
|
200
199
|
return this.toArray()[index];
|
|
201
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* @description Returns the a types value by name
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
getT(key) {
|
|
207
|
+
return super.get(key);
|
|
208
|
+
}
|
|
202
209
|
/**
|
|
203
210
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
204
211
|
*/
|
package/package.json
CHANGED
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@polkadot/types-codec',
|
|
6
6
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
7
7
|
type: 'esm',
|
|
8
|
-
version: '8.14.
|
|
8
|
+
version: '8.14.2-11'
|
|
9
9
|
};
|