@polkadot/types-codec 10.9.1 → 10.10.1
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 +1 -3
- package/base/Enum.js +1 -1
- package/base/Tuple.d.ts +1 -3
- package/cjs/base/Enum.js +1 -1
- package/cjs/extended/BitVec.js +1 -1
- package/cjs/extended/OptionBool.js +1 -1
- package/cjs/native/Bool.js +1 -1
- package/cjs/native/Json.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/extended/BitVec.js +1 -1
- package/extended/OptionBool.js +1 -1
- package/native/Bool.js +1 -1
- package/native/Json.js +1 -1
- package/native/Struct.d.ts +1 -1
- package/package.json +4 -4
- package/packageInfo.js +1 -1
package/base/Enum.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
2
|
import type { AnyJson, Codec, CodecClass, DefinitionSetter, IEnum, Inspect, IU8a, Registry } from '../types/index.js';
|
|
3
|
-
export
|
|
4
|
-
new (registry: Registry, value?: any, index?: number): T;
|
|
5
|
-
}
|
|
3
|
+
export type EnumCodecClass<T = Codec> = new (registry: Registry, value?: any, index?: number) => T;
|
|
6
4
|
interface Definition {
|
|
7
5
|
def: TypesDef;
|
|
8
6
|
isBasic: boolean;
|
package/base/Enum.js
CHANGED
|
@@ -47,7 +47,7 @@ function extractDef(registry, _def) {
|
|
|
47
47
|
}
|
|
48
48
|
function getEntryType(def, checkIdx) {
|
|
49
49
|
const values = Object.values(def);
|
|
50
|
-
for (let i = 0
|
|
50
|
+
for (let i = 0, count = values.length; i < count; i++) {
|
|
51
51
|
const { Type, index } = values[i];
|
|
52
52
|
if (index === checkIdx) {
|
|
53
53
|
return Type;
|
package/base/Tuple.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { AnyTupleValue, Codec, CodecClass, DefinitionSetter, Inspect, ITuple, Registry } from '../types/index.js';
|
|
2
2
|
import { AbstractArray } from '../abstract/Array.js';
|
|
3
3
|
type TupleType = (CodecClass | string);
|
|
4
|
-
type TupleTypes = TupleType[] |
|
|
5
|
-
[index: string]: CodecClass | string;
|
|
6
|
-
};
|
|
4
|
+
type TupleTypes = TupleType[] | Record<string, CodecClass | string>;
|
|
7
5
|
type Definition = [CodecClass[], string[]];
|
|
8
6
|
/**
|
|
9
7
|
* @name Tuple
|
package/cjs/base/Enum.js
CHANGED
|
@@ -50,7 +50,7 @@ function extractDef(registry, _def) {
|
|
|
50
50
|
}
|
|
51
51
|
function getEntryType(def, checkIdx) {
|
|
52
52
|
const values = Object.values(def);
|
|
53
|
-
for (let i = 0
|
|
53
|
+
for (let i = 0, count = values.length; i < count; i++) {
|
|
54
54
|
const { Type, index } = values[i];
|
|
55
55
|
if (index === checkIdx) {
|
|
56
56
|
return Type;
|
package/cjs/extended/BitVec.js
CHANGED
|
@@ -5,7 +5,7 @@ const util_1 = require("@polkadot/util");
|
|
|
5
5
|
const Raw_js_1 = require("../native/Raw.js");
|
|
6
6
|
/** @internal */
|
|
7
7
|
function decodeBitVecU8a(value) {
|
|
8
|
-
if (!value
|
|
8
|
+
if (!value?.length) {
|
|
9
9
|
return [0, new Uint8Array()];
|
|
10
10
|
}
|
|
11
11
|
// handle all other Uint8Array inputs, these do have a length prefix which is the number of bits encoded
|
|
@@ -28,7 +28,7 @@ class OptionBool extends Option_js_1.Option {
|
|
|
28
28
|
* @description The length of the value when encoded as a Uint8Array
|
|
29
29
|
*/
|
|
30
30
|
get encodedLength() {
|
|
31
|
-
return 1;
|
|
31
|
+
return 1 | 0;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* @description Checks if the value is an empty value (always false)
|
package/cjs/native/Bool.js
CHANGED
package/cjs/native/Json.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.
|
|
4
|
+
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.10.1' };
|
package/extended/BitVec.js
CHANGED
|
@@ -2,7 +2,7 @@ import { compactFromU8aLim, compactToU8a, isString, u8aConcatStrict, u8aToU8a }
|
|
|
2
2
|
import { Raw } from '../native/Raw.js';
|
|
3
3
|
/** @internal */
|
|
4
4
|
function decodeBitVecU8a(value) {
|
|
5
|
-
if (!value
|
|
5
|
+
if (!value?.length) {
|
|
6
6
|
return [0, new Uint8Array()];
|
|
7
7
|
}
|
|
8
8
|
// handle all other Uint8Array inputs, these do have a length prefix which is the number of bits encoded
|
package/extended/OptionBool.js
CHANGED
package/native/Bool.js
CHANGED
package/native/Json.js
CHANGED
package/native/Struct.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare class Struct<S extends TypesDef = TypesDef, V extends {
|
|
|
64
64
|
/**
|
|
65
65
|
* @description Returns the a types value by name
|
|
66
66
|
*/
|
|
67
|
-
getT<T>(key: string): T;
|
|
67
|
+
getT<T = Codec>(key: string): T;
|
|
68
68
|
/**
|
|
69
69
|
* @description Returns a breakdown of the hex encoding for this Codec
|
|
70
70
|
*/
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"./cjs/detectPackage.js"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "10.
|
|
21
|
+
"version": "10.10.1",
|
|
22
22
|
"main": "./cjs/index.js",
|
|
23
23
|
"module": "./index.js",
|
|
24
24
|
"types": "./index.d.ts",
|
|
@@ -516,8 +516,8 @@
|
|
|
516
516
|
}
|
|
517
517
|
},
|
|
518
518
|
"dependencies": {
|
|
519
|
-
"@polkadot/util": "^12.
|
|
520
|
-
"@polkadot/x-bigint": "^12.
|
|
521
|
-
"tslib": "^2.
|
|
519
|
+
"@polkadot/util": "^12.5.1",
|
|
520
|
+
"@polkadot/x-bigint": "^12.5.1",
|
|
521
|
+
"tslib": "^2.6.2"
|
|
522
522
|
}
|
|
523
523
|
}
|
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
|
+
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.10.1' };
|