@polkadot/types-codec 7.7.2-1 → 7.7.2-10
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.cjs +27 -1
- package/abstract/AbstractArray.d.ts +7 -1
- package/abstract/AbstractArray.js +27 -1
- package/abstract/AbstractInt.cjs +11 -0
- package/abstract/AbstractInt.d.ts +5 -1
- package/abstract/AbstractInt.js +11 -0
- package/base/Base.cjs +8 -0
- package/base/Base.d.ts +5 -1
- package/base/Base.js +8 -0
- package/base/Compact.cjs +11 -0
- package/base/Compact.d.ts +5 -1
- package/base/Compact.js +11 -0
- package/base/DoNotConstruct.cjs +4 -0
- package/base/DoNotConstruct.d.ts +2 -1
- package/base/DoNotConstruct.js +4 -0
- package/base/Enum.cjs +11 -0
- package/base/Enum.d.ts +5 -1
- package/base/Enum.js +11 -0
- package/base/Null.cjs +11 -0
- package/base/Null.d.ts +5 -1
- package/base/Null.js +11 -0
- package/base/Option.cjs +11 -0
- package/base/Option.d.ts +5 -1
- package/base/Option.js +11 -0
- package/base/Tuple.cjs +12 -7
- package/base/Tuple.d.ts +5 -1
- package/base/Tuple.js +12 -7
- package/base/VecFixed.cjs +12 -6
- package/base/VecFixed.d.ts +5 -1
- package/base/VecFixed.js +12 -6
- package/extended/BTreeSet.cjs +17 -0
- package/extended/BTreeSet.d.ts +5 -1
- package/extended/BTreeSet.js +17 -0
- package/extended/BitVec.cjs +14 -0
- package/extended/BitVec.d.ts +5 -1
- package/extended/BitVec.js +14 -0
- package/extended/Bytes.cjs +14 -0
- package/extended/Bytes.d.ts +5 -1
- package/extended/Bytes.js +14 -0
- package/extended/Map.cjs +19 -1
- package/extended/Map.d.ts +5 -1
- package/extended/Map.js +19 -1
- package/extended/WrapperKeepOpaque.cjs +14 -0
- package/extended/WrapperKeepOpaque.d.ts +5 -1
- package/extended/WrapperKeepOpaque.js +15 -1
- package/native/Bool.cjs +11 -0
- package/native/Bool.d.ts +5 -1
- package/native/Bool.js +11 -0
- package/native/Date.cjs +14 -3
- package/native/Date.d.ts +7 -3
- package/native/Date.js +14 -3
- package/native/Json.cjs +8 -0
- package/native/Json.d.ts +5 -1
- package/native/Json.js +8 -0
- package/native/Raw.cjs +11 -0
- package/native/Raw.d.ts +5 -1
- package/native/Raw.js +11 -0
- package/native/Set.cjs +11 -0
- package/native/Set.d.ts +5 -1
- package/native/Set.js +11 -0
- package/native/Struct.cjs +19 -0
- package/native/Struct.d.ts +5 -1
- package/native/Struct.js +19 -0
- package/native/Text.cjs +15 -0
- package/native/Text.d.ts +5 -1
- package/native/Text.js +16 -1
- package/package.json +3 -3
- package/packageInfo.cjs +1 -1
- package/packageInfo.js +1 -1
- package/types/codec.d.ts +9 -0
package/native/Struct.cjs
CHANGED
|
@@ -218,6 +218,25 @@ class Struct extends Map {
|
|
|
218
218
|
getAtIndex(index) {
|
|
219
219
|
return this.toArray()[index];
|
|
220
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
inspect() {
|
|
227
|
+
const inner = new Array();
|
|
228
|
+
|
|
229
|
+
for (const [k, v] of this.entries()) {
|
|
230
|
+
inner.push({ ...v.inspect(),
|
|
231
|
+
name: k.toString()
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
inner,
|
|
237
|
+
value: new Uint8Array()
|
|
238
|
+
};
|
|
239
|
+
}
|
|
221
240
|
/**
|
|
222
241
|
* @description Converts the Object to an standard JavaScript Array
|
|
223
242
|
*/
|
package/native/Struct.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, BareOpts, Codec, CodecClass, IStruct, IU8a, Registry } from '../types';
|
|
2
|
+
import type { AnyJson, BareOpts, Codec, CodecClass, Inspect, IStruct, IU8a, Registry } from '../types';
|
|
3
3
|
declare type TypesDef<T = Codec> = Record<string, string | CodecClass<T>>;
|
|
4
4
|
/**
|
|
5
5
|
* @name Struct
|
|
@@ -60,6 +60,10 @@ export declare class Struct<S extends TypesDef = TypesDef, V extends {
|
|
|
60
60
|
* @description Returns the values of a member at a specific index (Rather use get(name) for performance)
|
|
61
61
|
*/
|
|
62
62
|
getAtIndex(index: number): Codec;
|
|
63
|
+
/**
|
|
64
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
65
|
+
*/
|
|
66
|
+
inspect(): Inspect;
|
|
63
67
|
/**
|
|
64
68
|
* @description Converts the Object to an standard JavaScript Array
|
|
65
69
|
*/
|
package/native/Struct.js
CHANGED
|
@@ -186,6 +186,25 @@ export class Struct extends Map {
|
|
|
186
186
|
getAtIndex(index) {
|
|
187
187
|
return this.toArray()[index];
|
|
188
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
inspect() {
|
|
195
|
+
const inner = new Array();
|
|
196
|
+
|
|
197
|
+
for (const [k, v] of this.entries()) {
|
|
198
|
+
inner.push({ ...v.inspect(),
|
|
199
|
+
name: k.toString()
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return {
|
|
204
|
+
inner,
|
|
205
|
+
value: new Uint8Array()
|
|
206
|
+
};
|
|
207
|
+
}
|
|
189
208
|
/**
|
|
190
209
|
* @description Converts the Object to an standard JavaScript Array
|
|
191
210
|
*/
|
package/native/Text.cjs
CHANGED
|
@@ -125,6 +125,21 @@ class Text extends String {
|
|
|
125
125
|
eq(other) {
|
|
126
126
|
return (0, _util.isString)(other) ? this.toString() === other.toString() : false;
|
|
127
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
inspect() {
|
|
134
|
+
const value = (0, _util.stringToU8a)(super.toString());
|
|
135
|
+
return {
|
|
136
|
+
inner: [{
|
|
137
|
+
inner: [],
|
|
138
|
+
value
|
|
139
|
+
}],
|
|
140
|
+
value: (0, _util.compactToU8a)(value.length)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
128
143
|
/**
|
|
129
144
|
* @description Set an override value for this
|
|
130
145
|
*/
|
package/native/Text.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyU8a, Codec, IU8a, Registry } from '../types';
|
|
2
|
+
import type { AnyU8a, Codec, Inspect, IU8a, Registry } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* @name Text
|
|
5
5
|
* @description
|
|
@@ -39,6 +39,10 @@ export declare class Text extends String implements Codec {
|
|
|
39
39
|
* @description Compares the value of the input to see if there is a match
|
|
40
40
|
*/
|
|
41
41
|
eq(other?: unknown): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
44
|
+
*/
|
|
45
|
+
inspect(): Inspect;
|
|
42
46
|
/**
|
|
43
47
|
* @description Set an override value for this
|
|
44
48
|
*/
|
package/native/Text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { assert, compactAddLength, compactFromU8a, hexToU8a, isHex, isString, isU8a, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
|
3
|
+
import { assert, compactAddLength, compactFromU8a, compactToU8a, hexToU8a, isHex, isString, isU8a, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
|
4
4
|
import { Raw } from "./Raw.js";
|
|
5
5
|
const MAX_LENGTH = 128 * 1024;
|
|
6
6
|
/** @internal */
|
|
@@ -99,6 +99,21 @@ export class Text extends String {
|
|
|
99
99
|
eq(other) {
|
|
100
100
|
return isString(other) ? this.toString() === other.toString() : false;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
inspect() {
|
|
108
|
+
const value = stringToU8a(super.toString());
|
|
109
|
+
return {
|
|
110
|
+
inner: [{
|
|
111
|
+
inner: [],
|
|
112
|
+
value
|
|
113
|
+
}],
|
|
114
|
+
value: compactToU8a(value.length)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
102
117
|
/**
|
|
103
118
|
* @description Set an override value for this
|
|
104
119
|
*/
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./detectPackage.cjs"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "7.7.2-
|
|
23
|
+
"version": "7.7.2-10",
|
|
24
24
|
"main": "index.cjs",
|
|
25
25
|
"module": "index.js",
|
|
26
26
|
"types": "index.d.ts",
|
|
@@ -404,7 +404,7 @@
|
|
|
404
404
|
}
|
|
405
405
|
},
|
|
406
406
|
"dependencies": {
|
|
407
|
-
"@babel/runtime": "^7.17.
|
|
408
|
-
"@polkadot/util": "^8.3.
|
|
407
|
+
"@babel/runtime": "^7.17.2",
|
|
408
|
+
"@polkadot/util": "^8.3.4-10"
|
|
409
409
|
}
|
|
410
410
|
}
|
package/packageInfo.cjs
CHANGED
package/packageInfo.js
CHANGED
package/types/codec.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import type { AnyJson } from './helpers';
|
|
|
3
3
|
import type { IU8a } from './interfaces';
|
|
4
4
|
import type { Registry } from './registry';
|
|
5
5
|
export declare type BareOpts = boolean | Record<string, boolean>;
|
|
6
|
+
export interface Inspect {
|
|
7
|
+
inner: Inspect[];
|
|
8
|
+
name?: string;
|
|
9
|
+
value?: Uint8Array;
|
|
10
|
+
}
|
|
6
11
|
/**
|
|
7
12
|
* @name Codec
|
|
8
13
|
* @description
|
|
@@ -39,6 +44,10 @@ export interface Codec {
|
|
|
39
44
|
* @description Compares the value of the input to see if there is a match
|
|
40
45
|
*/
|
|
41
46
|
eq(other?: unknown): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @description Returns a breakdown of the hex encoding for this Codec
|
|
49
|
+
*/
|
|
50
|
+
inspect(): Inspect;
|
|
42
51
|
/**
|
|
43
52
|
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
|
44
53
|
*/
|