@polkadot/types-codec 10.1.3 → 10.1.4
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/Int.d.ts +2 -2
- package/abstract/Int.js +2 -4
- package/base/Compact.d.ts +1 -1
- package/base/Compact.js +1 -2
- package/base/Null.d.ts +1 -1
- package/base/Null.js +1 -2
- package/base/Vec.d.ts +1 -1
- package/base/Vec.js +5 -5
- package/cjs/abstract/Int.js +2 -4
- package/cjs/base/Compact.js +1 -2
- package/cjs/base/Null.js +1 -2
- package/cjs/base/Vec.js +5 -5
- package/cjs/native/Bool.js +1 -2
- package/cjs/native/Date.js +1 -2
- package/cjs/native/Json.js +1 -2
- package/cjs/native/Raw.js +1 -2
- package/cjs/native/Set.js +1 -2
- package/cjs/native/Struct.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/utils/decodeU8a.js +1 -1
- package/native/Bool.d.ts +1 -1
- package/native/Bool.js +1 -2
- package/native/Date.d.ts +1 -1
- package/native/Date.js +1 -2
- package/native/Json.d.ts +1 -1
- package/native/Json.js +1 -2
- package/native/Raw.d.ts +1 -1
- package/native/Raw.js +1 -2
- package/native/Set.d.ts +1 -1
- package/native/Set.js +1 -2
- package/native/Struct.js +1 -1
- package/package.json +3 -3
- package/packageInfo.js +1 -1
- package/utils/decodeU8a.js +1 -1
package/abstract/Int.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare abstract class AbstractInt extends BN implements INumber {
|
|
|
56
56
|
/**
|
|
57
57
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
58
58
|
*/
|
|
59
|
-
toHuman(
|
|
59
|
+
toHuman(_isExpanded?: boolean): string;
|
|
60
60
|
/**
|
|
61
61
|
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
62
62
|
*/
|
|
@@ -78,5 +78,5 @@ export declare abstract class AbstractInt extends BN implements INumber {
|
|
|
78
78
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
79
79
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
80
80
|
*/
|
|
81
|
-
toU8a(
|
|
81
|
+
toU8a(_isBare?: boolean): Uint8Array;
|
|
82
82
|
}
|
package/abstract/Int.js
CHANGED
|
@@ -156,8 +156,7 @@ export class AbstractInt extends BN {
|
|
|
156
156
|
/**
|
|
157
157
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
158
158
|
*/
|
|
159
|
-
|
|
160
|
-
toHuman(isExpanded) {
|
|
159
|
+
toHuman(_isExpanded) {
|
|
161
160
|
const rawType = this.toRawType();
|
|
162
161
|
if (rawType === 'Balance') {
|
|
163
162
|
return this.isMax()
|
|
@@ -214,8 +213,7 @@ export class AbstractInt extends BN {
|
|
|
214
213
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
215
214
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
216
215
|
*/
|
|
217
|
-
|
|
218
|
-
toU8a(isBare) {
|
|
216
|
+
toU8a(_isBare) {
|
|
219
217
|
return bnToU8a(this, {
|
|
220
218
|
bitLength: this.bitLength(),
|
|
221
219
|
isLe: true,
|
package/base/Compact.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export declare class Compact<T extends INumber> implements ICompact<T> {
|
|
|
86
86
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
87
87
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
88
88
|
*/
|
|
89
|
-
toU8a(
|
|
89
|
+
toU8a(_isBare?: boolean): Uint8Array;
|
|
90
90
|
/**
|
|
91
91
|
* @description Returns the embedded [[UInt]] or [[Moment]] value
|
|
92
92
|
*/
|
package/base/Compact.js
CHANGED
|
@@ -149,8 +149,7 @@ export class Compact {
|
|
|
149
149
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
150
150
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
151
151
|
*/
|
|
152
|
-
|
|
153
|
-
toU8a(isBare) {
|
|
152
|
+
toU8a(_isBare) {
|
|
154
153
|
return compactToU8a(__classPrivateFieldGet(this, _Compact_raw, "f").toBn());
|
|
155
154
|
}
|
|
156
155
|
/**
|
package/base/Null.d.ts
CHANGED
|
@@ -53,5 +53,5 @@ export declare class Null implements Codec {
|
|
|
53
53
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
54
54
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
55
55
|
*/
|
|
56
|
-
toU8a(
|
|
56
|
+
toU8a(_isBare?: boolean): Uint8Array;
|
|
57
57
|
}
|
package/base/Null.js
CHANGED
|
@@ -69,8 +69,7 @@ export class Null {
|
|
|
69
69
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
70
70
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
71
71
|
*/
|
|
72
|
-
|
|
73
|
-
toU8a(isBare) {
|
|
72
|
+
toU8a(_isBare) {
|
|
74
73
|
return new Uint8Array();
|
|
75
74
|
}
|
|
76
75
|
}
|
package/base/Vec.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare class Vec<T extends Codec> extends AbstractArray<T> {
|
|
|
24
24
|
/**
|
|
25
25
|
* @description Finds the index of the value in the array
|
|
26
26
|
*/
|
|
27
|
-
indexOf(
|
|
27
|
+
indexOf(other?: unknown): number;
|
|
28
28
|
/**
|
|
29
29
|
* @description Returns the base runtime type name for this instance
|
|
30
30
|
*/
|
package/base/Vec.js
CHANGED
|
@@ -86,13 +86,13 @@ export class Vec extends AbstractArray {
|
|
|
86
86
|
/**
|
|
87
87
|
* @description Finds the index of the value in the array
|
|
88
88
|
*/
|
|
89
|
-
indexOf(
|
|
89
|
+
indexOf(other) {
|
|
90
90
|
// convert type first, this removes overhead from the eq
|
|
91
|
-
const
|
|
92
|
-
?
|
|
93
|
-
: new (__classPrivateFieldGet(this, _Vec_Type, "f"))(this.registry,
|
|
91
|
+
const check = other instanceof __classPrivateFieldGet(this, _Vec_Type, "f")
|
|
92
|
+
? other
|
|
93
|
+
: new (__classPrivateFieldGet(this, _Vec_Type, "f"))(this.registry, other);
|
|
94
94
|
for (let i = 0; i < this.length; i++) {
|
|
95
|
-
if (
|
|
95
|
+
if (check.eq(this[i])) {
|
|
96
96
|
return i;
|
|
97
97
|
}
|
|
98
98
|
}
|
package/cjs/abstract/Int.js
CHANGED
|
@@ -159,8 +159,7 @@ class AbstractInt extends util_1.BN {
|
|
|
159
159
|
/**
|
|
160
160
|
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
161
161
|
*/
|
|
162
|
-
|
|
163
|
-
toHuman(isExpanded) {
|
|
162
|
+
toHuman(_isExpanded) {
|
|
164
163
|
const rawType = this.toRawType();
|
|
165
164
|
if (rawType === 'Balance') {
|
|
166
165
|
return this.isMax()
|
|
@@ -217,8 +216,7 @@ class AbstractInt extends util_1.BN {
|
|
|
217
216
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
218
217
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
219
218
|
*/
|
|
220
|
-
|
|
221
|
-
toU8a(isBare) {
|
|
219
|
+
toU8a(_isBare) {
|
|
222
220
|
return (0, util_1.bnToU8a)(this, {
|
|
223
221
|
bitLength: this.bitLength(),
|
|
224
222
|
isLe: true,
|
package/cjs/base/Compact.js
CHANGED
|
@@ -152,8 +152,7 @@ class Compact {
|
|
|
152
152
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
153
153
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
154
154
|
*/
|
|
155
|
-
|
|
156
|
-
toU8a(isBare) {
|
|
155
|
+
toU8a(_isBare) {
|
|
157
156
|
return (0, util_1.compactToU8a)(tslib_1.__classPrivateFieldGet(this, _Compact_raw, "f").toBn());
|
|
158
157
|
}
|
|
159
158
|
/**
|
package/cjs/base/Null.js
CHANGED
|
@@ -72,8 +72,7 @@ class Null {
|
|
|
72
72
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
73
73
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
74
74
|
*/
|
|
75
|
-
|
|
76
|
-
toU8a(isBare) {
|
|
75
|
+
toU8a(_isBare) {
|
|
77
76
|
return new Uint8Array();
|
|
78
77
|
}
|
|
79
78
|
}
|
package/cjs/base/Vec.js
CHANGED
|
@@ -90,13 +90,13 @@ class Vec extends Array_js_1.AbstractArray {
|
|
|
90
90
|
/**
|
|
91
91
|
* @description Finds the index of the value in the array
|
|
92
92
|
*/
|
|
93
|
-
indexOf(
|
|
93
|
+
indexOf(other) {
|
|
94
94
|
// convert type first, this removes overhead from the eq
|
|
95
|
-
const
|
|
96
|
-
?
|
|
97
|
-
: new (tslib_1.__classPrivateFieldGet(this, _Vec_Type, "f"))(this.registry,
|
|
95
|
+
const check = other instanceof tslib_1.__classPrivateFieldGet(this, _Vec_Type, "f")
|
|
96
|
+
? other
|
|
97
|
+
: new (tslib_1.__classPrivateFieldGet(this, _Vec_Type, "f"))(this.registry, other);
|
|
98
98
|
for (let i = 0; i < this.length; i++) {
|
|
99
|
-
if (
|
|
99
|
+
if (check.eq(this[i])) {
|
|
100
100
|
return i;
|
|
101
101
|
}
|
|
102
102
|
}
|
package/cjs/native/Bool.js
CHANGED
|
@@ -104,8 +104,7 @@ class bool extends Boolean {
|
|
|
104
104
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
105
105
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
106
106
|
*/
|
|
107
|
-
|
|
108
|
-
toU8a(isBare) {
|
|
107
|
+
toU8a(_isBare) {
|
|
109
108
|
return new Uint8Array([this.valueOf() ? 1 : 0]);
|
|
110
109
|
}
|
|
111
110
|
}
|
package/cjs/native/Date.js
CHANGED
|
@@ -135,8 +135,7 @@ class CodecDate extends Date {
|
|
|
135
135
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
136
136
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
137
137
|
*/
|
|
138
|
-
|
|
139
|
-
toU8a(isBare) {
|
|
138
|
+
toU8a(_isBare) {
|
|
140
139
|
return (0, util_1.bnToU8a)(this.toNumber(), U8A_OPTS);
|
|
141
140
|
}
|
|
142
141
|
}
|
package/cjs/native/Json.js
CHANGED
package/cjs/native/Raw.js
CHANGED
|
@@ -125,8 +125,7 @@ class Raw extends Uint8Array {
|
|
|
125
125
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
126
126
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
127
127
|
*/
|
|
128
|
-
|
|
129
|
-
toU8a(isBare) {
|
|
128
|
+
toU8a(_isBare) {
|
|
130
129
|
return Uint8Array.from(this);
|
|
131
130
|
}
|
|
132
131
|
/**
|
package/cjs/native/Set.js
CHANGED
|
@@ -208,8 +208,7 @@ class CodecSet extends Set {
|
|
|
208
208
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
209
209
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
210
210
|
*/
|
|
211
|
-
|
|
212
|
-
toU8a(isBare) {
|
|
211
|
+
toU8a(_isBare) {
|
|
213
212
|
return (0, util_1.bnToU8a)(this.valueEncoded, {
|
|
214
213
|
bitLength: tslib_1.__classPrivateFieldGet(this, _CodecSet_byteLength, "f") * 8,
|
|
215
214
|
isLe: true
|
package/cjs/native/Struct.js
CHANGED
package/cjs/packageInfo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageInfo = void 0;
|
|
4
|
-
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.1.
|
|
4
|
+
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.1.4' };
|
package/cjs/utils/decodeU8a.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.decodeU8aVec = exports.decodeU8aStruct = exports.decodeU8a = void 0;
|
|
4
4
|
const util_1 = require("@polkadot/util");
|
|
5
5
|
/** @internal */
|
|
6
|
-
function formatFailure(registry, fn,
|
|
6
|
+
function formatFailure(registry, fn, _result, { message }, u8a, i, count, Type, key) {
|
|
7
7
|
let type = '';
|
|
8
8
|
try {
|
|
9
9
|
type = `: ${new Type(registry).toRawType()}`;
|
package/native/Bool.d.ts
CHANGED
|
@@ -68,5 +68,5 @@ export declare class bool extends Boolean implements Codec {
|
|
|
68
68
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
69
69
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
70
70
|
*/
|
|
71
|
-
toU8a(
|
|
71
|
+
toU8a(_isBare?: boolean): Uint8Array;
|
|
72
72
|
}
|
package/native/Bool.js
CHANGED
|
@@ -101,8 +101,7 @@ export class bool extends Boolean {
|
|
|
101
101
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
102
102
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
103
103
|
*/
|
|
104
|
-
|
|
105
|
-
toU8a(isBare) {
|
|
104
|
+
toU8a(_isBare) {
|
|
106
105
|
return new Uint8Array([this.valueOf() ? 1 : 0]);
|
|
107
106
|
}
|
|
108
107
|
}
|
package/native/Date.d.ts
CHANGED
|
@@ -82,5 +82,5 @@ export declare class CodecDate extends Date implements INumber {
|
|
|
82
82
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
83
83
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
84
84
|
*/
|
|
85
|
-
toU8a(
|
|
85
|
+
toU8a(_isBare?: boolean): Uint8Array;
|
|
86
86
|
}
|
package/native/Date.js
CHANGED
|
@@ -132,8 +132,7 @@ export class CodecDate extends Date {
|
|
|
132
132
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
133
133
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
134
134
|
*/
|
|
135
|
-
|
|
136
|
-
toU8a(isBare) {
|
|
135
|
+
toU8a(_isBare) {
|
|
137
136
|
return bnToU8a(this.toNumber(), U8A_OPTS);
|
|
138
137
|
}
|
|
139
138
|
}
|
package/native/Json.d.ts
CHANGED
package/native/Json.js
CHANGED
package/native/Raw.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export declare class Raw extends Uint8Array implements IU8a {
|
|
|
80
80
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
81
81
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
82
82
|
*/
|
|
83
|
-
toU8a(
|
|
83
|
+
toU8a(_isBare?: boolean): Uint8Array;
|
|
84
84
|
/**
|
|
85
85
|
* @description Returns the wrapped data as a UTF-8 string
|
|
86
86
|
*/
|
package/native/Raw.js
CHANGED
|
@@ -122,8 +122,7 @@ export class Raw extends Uint8Array {
|
|
|
122
122
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
123
123
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
124
124
|
*/
|
|
125
|
-
|
|
126
|
-
toU8a(isBare) {
|
|
125
|
+
toU8a(_isBare) {
|
|
127
126
|
return Uint8Array.from(this);
|
|
128
127
|
}
|
|
129
128
|
/**
|
package/native/Set.d.ts
CHANGED
|
@@ -81,6 +81,6 @@ export declare class CodecSet extends Set<string> implements ISet<string> {
|
|
|
81
81
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
82
82
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
83
83
|
*/
|
|
84
|
-
toU8a(
|
|
84
|
+
toU8a(_isBare?: boolean): Uint8Array;
|
|
85
85
|
}
|
|
86
86
|
export {};
|
package/native/Set.js
CHANGED
|
@@ -205,8 +205,7 @@ export class CodecSet extends Set {
|
|
|
205
205
|
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
206
206
|
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
207
207
|
*/
|
|
208
|
-
|
|
209
|
-
toU8a(isBare) {
|
|
208
|
+
toU8a(_isBare) {
|
|
210
209
|
return bnToU8a(this.valueEncoded, {
|
|
211
210
|
bitLength: __classPrivateFieldGet(this, _CodecSet_byteLength, "f") * 8,
|
|
212
211
|
isLe: true
|
package/native/Struct.js
CHANGED
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"./cjs/detectPackage.js"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "10.1.
|
|
21
|
+
"version": "10.1.4",
|
|
22
22
|
"main": "./cjs/index.js",
|
|
23
23
|
"module": "./index.js",
|
|
24
24
|
"types": "./index.d.ts",
|
|
@@ -435,8 +435,8 @@
|
|
|
435
435
|
}
|
|
436
436
|
},
|
|
437
437
|
"dependencies": {
|
|
438
|
-
"@polkadot/util": "^11.
|
|
439
|
-
"@polkadot/x-bigint": "^11.
|
|
438
|
+
"@polkadot/util": "^11.1.1",
|
|
439
|
+
"@polkadot/x-bigint": "^11.1.1",
|
|
440
440
|
"tslib": "^2.5.0"
|
|
441
441
|
}
|
|
442
442
|
}
|
package/packageInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageInfo = { name: '@polkadot/types-codec', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.1.
|
|
1
|
+
export const packageInfo = { name: '@polkadot/types-codec', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.1.4' };
|
package/utils/decodeU8a.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u8aToHex } from '@polkadot/util';
|
|
2
2
|
/** @internal */
|
|
3
|
-
function formatFailure(registry, fn,
|
|
3
|
+
function formatFailure(registry, fn, _result, { message }, u8a, i, count, Type, key) {
|
|
4
4
|
let type = '';
|
|
5
5
|
try {
|
|
6
6
|
type = `: ${new Type(registry).toRawType()}`;
|