@polkadot/types-codec 8.11.2 → 8.12.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/cjs/extended/WrapperKeepOpaque.js +1 -1
- package/cjs/native/Date.js +5 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/utils/sanitize.js +1 -1
- package/extended/WrapperKeepOpaque.js +2 -2
- package/native/Date.js +5 -1
- package/package.json +3 -4
- package/packageInfo.js +1 -1
- package/utils/sanitize.js +1 -1
- package/mod.d.ts +0 -1
|
@@ -20,7 +20,7 @@ function decodeRaw(registry, typeName, value) {
|
|
|
20
20
|
|
|
21
21
|
if ((0, _util.isU8a)(value) || (0, _util.isHex)(value)) {
|
|
22
22
|
try {
|
|
23
|
-
const [, u8a] = (0, _util.isHex)(value)
|
|
23
|
+
const [, u8a] = (0, _util.isHex)(value) ? [0, (0, _util.u8aToU8a)(value)] : value instanceof _Raw.Raw ? [0, value.subarray()] : (0, _util.compactStripLength)(value);
|
|
24
24
|
return [Type, new Type(registry, u8a), value];
|
|
25
25
|
} catch {
|
|
26
26
|
return [Type, null, value];
|
package/cjs/native/Date.js
CHANGED
|
@@ -10,6 +10,10 @@ var _util = require("@polkadot/util");
|
|
|
10
10
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
11
11
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
12
|
const BITLENGTH = 64;
|
|
13
|
+
const U8A_OPTS = {
|
|
14
|
+
bitLength: BITLENGTH,
|
|
15
|
+
isLe: true
|
|
16
|
+
};
|
|
13
17
|
|
|
14
18
|
function decodeDate(value) {
|
|
15
19
|
if ((0, _util.isU8a)(value)) {
|
|
@@ -170,7 +174,7 @@ class CodecDate extends Date {
|
|
|
170
174
|
|
|
171
175
|
|
|
172
176
|
toU8a(isBare) {
|
|
173
|
-
return (0, _util.bnToU8a)(this.toNumber(),
|
|
177
|
+
return (0, _util.bnToU8a)(this.toNumber(), U8A_OPTS);
|
|
174
178
|
}
|
|
175
179
|
|
|
176
180
|
}
|
package/cjs/packageInfo.js
CHANGED
package/cjs/utils/sanitize.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.trim = trim;
|
|
|
18
18
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
19
19
|
// SPDX-License-Identifier: Apache-2.0
|
|
20
20
|
const BOUNDED = ['BTreeMap', 'BTreeSet', 'HashMap', 'Vec'];
|
|
21
|
-
const ALLOWED_BOXES = BOUNDED.concat(['Compact', 'DoNotConstruct', 'Int', 'Linkage', 'Range', 'RangeInclusive', 'Result', 'Option', 'UInt', 'WrapperKeepOpaque', 'WrapperOpaque']);
|
|
21
|
+
const ALLOWED_BOXES = BOUNDED.concat(['Compact', 'DoNotConstruct', 'Int', 'Linkage', 'Range', 'RangeInclusive', 'Result', 'Opaque', 'Option', 'UInt', 'WrapperKeepOpaque', 'WrapperOpaque']);
|
|
22
22
|
const BOX_PRECEDING = ['<', '(', '[', '"', ',', ' ']; // start of vec, tuple, fixed array, part of struct def or in tuple
|
|
23
23
|
|
|
24
24
|
const mappings = [// alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { compactAddLength, compactStripLength, compactToU8a, isHex, isU8a } from '@polkadot/util';
|
|
3
|
+
import { compactAddLength, compactStripLength, compactToU8a, isHex, isU8a, u8aToU8a } from '@polkadot/util';
|
|
4
4
|
import { Raw } from "../native/Raw.js";
|
|
5
5
|
import { typeToConstructor } from "../utils/index.js";
|
|
6
6
|
import { Bytes } from "./Bytes.js";
|
|
@@ -10,7 +10,7 @@ function decodeRaw(registry, typeName, value) {
|
|
|
10
10
|
|
|
11
11
|
if (isU8a(value) || isHex(value)) {
|
|
12
12
|
try {
|
|
13
|
-
const [, u8a] = isHex(value)
|
|
13
|
+
const [, u8a] = isHex(value) ? [0, u8aToU8a(value)] : value instanceof Raw ? [0, value.subarray()] : compactStripLength(value);
|
|
14
14
|
return [Type, new Type(registry, u8a), value];
|
|
15
15
|
} catch {
|
|
16
16
|
return [Type, null, value];
|
package/native/Date.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { BN, bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
|
|
4
4
|
const BITLENGTH = 64;
|
|
5
|
+
const U8A_OPTS = {
|
|
6
|
+
bitLength: BITLENGTH,
|
|
7
|
+
isLe: true
|
|
8
|
+
};
|
|
5
9
|
|
|
6
10
|
function decodeDate(value) {
|
|
7
11
|
if (isU8a(value)) {
|
|
@@ -160,7 +164,7 @@ export class CodecDate extends Date {
|
|
|
160
164
|
|
|
161
165
|
|
|
162
166
|
toU8a(isBare) {
|
|
163
|
-
return bnToU8a(this.toNumber(),
|
|
167
|
+
return bnToU8a(this.toNumber(), U8A_OPTS);
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./cjs/detectPackage.js"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "8.
|
|
23
|
+
"version": "8.12.2",
|
|
24
24
|
"main": "./cjs/index.js",
|
|
25
25
|
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
@@ -212,7 +212,6 @@
|
|
|
212
212
|
"require": "./cjs/extended/WrapperOpaque.js",
|
|
213
213
|
"default": "./extended/WrapperOpaque.js"
|
|
214
214
|
},
|
|
215
|
-
"./mod.d.ts": "./mod.d.ts",
|
|
216
215
|
"./native": {
|
|
217
216
|
"types": "./native/index.d.ts",
|
|
218
217
|
"require": "./cjs/native/index.js",
|
|
@@ -436,7 +435,7 @@
|
|
|
436
435
|
},
|
|
437
436
|
"dependencies": {
|
|
438
437
|
"@babel/runtime": "^7.18.6",
|
|
439
|
-
"@polkadot/util": "^
|
|
440
|
-
"@polkadot/x-bigint": "^
|
|
438
|
+
"@polkadot/util": "^10.0.2",
|
|
439
|
+
"@polkadot/x-bigint": "^10.0.2"
|
|
441
440
|
}
|
|
442
441
|
}
|
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.
|
|
8
|
+
version: '8.12.2'
|
|
9
9
|
};
|
package/utils/sanitize.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
const BOUNDED = ['BTreeMap', 'BTreeSet', 'HashMap', 'Vec'];
|
|
4
|
-
const ALLOWED_BOXES = BOUNDED.concat(['Compact', 'DoNotConstruct', 'Int', 'Linkage', 'Range', 'RangeInclusive', 'Result', 'Option', 'UInt', 'WrapperKeepOpaque', 'WrapperOpaque']);
|
|
4
|
+
const ALLOWED_BOXES = BOUNDED.concat(['Compact', 'DoNotConstruct', 'Int', 'Linkage', 'Range', 'RangeInclusive', 'Result', 'Opaque', 'Option', 'UInt', 'WrapperKeepOpaque', 'WrapperOpaque']);
|
|
5
5
|
const BOX_PRECEDING = ['<', '(', '[', '"', ',', ' ']; // start of vec, tuple, fixed array, part of struct def or in tuple
|
|
6
6
|
|
|
7
7
|
const mappings = [// alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport
|
package/mod.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './index';
|