@polkadot/types-codec 9.13.1 → 9.13.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 +1 -1
- package/abstract/Int.js +2 -0
- package/base/Int.d.ts +1 -1
- package/base/Vec.js +1 -6
- package/cjs/abstract/Int.js +2 -0
- package/cjs/base/Vec.js +1 -6
- package/cjs/packageInfo.js +1 -1
- package/package.json +1 -1
- package/packageInfo.js +1 -1
package/abstract/Int.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare abstract class AbstractInt extends BN implements INumber {
|
|
|
16
16
|
createdAtHash?: IU8a;
|
|
17
17
|
initialU8aLength?: number;
|
|
18
18
|
isStorageFallback?: boolean;
|
|
19
|
-
constructor(registry: Registry, value?: AnyNumber, bitLength?: UIntBitLength, isSigned?: boolean);
|
|
19
|
+
constructor(registry: Registry, value?: AnyNumber | null, bitLength?: UIntBitLength, isSigned?: boolean);
|
|
20
20
|
/**
|
|
21
21
|
* @description returns a hash of the contents
|
|
22
22
|
*/
|
package/abstract/Int.js
CHANGED
|
@@ -49,6 +49,8 @@ function decodeAbstractInt(value, isNegative) {
|
|
|
49
49
|
throw new Error('Unable to construct number from multi-key object');
|
|
50
50
|
}
|
|
51
51
|
return decodeAbstractInt(value[keys[0]], isNegative);
|
|
52
|
+
} else if (!value) {
|
|
53
|
+
return 0;
|
|
52
54
|
}
|
|
53
55
|
throw new Error(`Unable to create BN from unknown type ${typeof value}`);
|
|
54
56
|
}
|
package/base/Int.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ import { AbstractInt } from '../abstract/Int';
|
|
|
11
11
|
* @noInheritDoc
|
|
12
12
|
*/
|
|
13
13
|
export declare class Int extends AbstractInt {
|
|
14
|
-
constructor(registry: Registry, value?: AnyNumber, bitLength?: UIntBitLength);
|
|
14
|
+
constructor(registry: Registry, value?: AnyNumber | null, bitLength?: UIntBitLength);
|
|
15
15
|
static with(bitLength: UIntBitLength, typeName?: string): CodecClass<Int>;
|
|
16
16
|
}
|
package/base/Vec.js
CHANGED
|
@@ -63,12 +63,7 @@ export class Vec extends AbstractArray {
|
|
|
63
63
|
const [decodeFrom, length, startAt] = decodeVecLength(value);
|
|
64
64
|
super(registry, length);
|
|
65
65
|
this.#Type = definition || setDefinition(typeToConstructor(registry, Type));
|
|
66
|
-
|
|
67
|
-
this.initialU8aLength = (isU8a(decodeFrom) ? decodeU8aVec(registry, this, decodeFrom, startAt, this.#Type) : decodeVec(registry, this, decodeFrom, startAt, this.#Type))[0];
|
|
68
|
-
} catch (e) {
|
|
69
|
-
console.error(decodeFrom, length, startAt);
|
|
70
|
-
throw e;
|
|
71
|
-
}
|
|
66
|
+
this.initialU8aLength = (isU8a(decodeFrom) ? decodeU8aVec(registry, this, decodeFrom, startAt, this.#Type) : decodeVec(registry, this, decodeFrom, startAt, this.#Type))[0];
|
|
72
67
|
}
|
|
73
68
|
static with(Type) {
|
|
74
69
|
let definition;
|
package/cjs/abstract/Int.js
CHANGED
|
@@ -56,6 +56,8 @@ function decodeAbstractInt(value, isNegative) {
|
|
|
56
56
|
throw new Error('Unable to construct number from multi-key object');
|
|
57
57
|
}
|
|
58
58
|
return decodeAbstractInt(value[keys[0]], isNegative);
|
|
59
|
+
} else if (!value) {
|
|
60
|
+
return 0;
|
|
59
61
|
}
|
|
60
62
|
throw new Error(`Unable to create BN from unknown type ${typeof value}`);
|
|
61
63
|
}
|
package/cjs/base/Vec.js
CHANGED
|
@@ -72,12 +72,7 @@ class Vec extends _Array.AbstractArray {
|
|
|
72
72
|
const [decodeFrom, length, startAt] = decodeVecLength(value);
|
|
73
73
|
super(registry, length);
|
|
74
74
|
this.#Type = definition || setDefinition((0, _utils.typeToConstructor)(registry, Type));
|
|
75
|
-
|
|
76
|
-
this.initialU8aLength = ((0, _util.isU8a)(decodeFrom) ? (0, _utils.decodeU8aVec)(registry, this, decodeFrom, startAt, this.#Type) : decodeVec(registry, this, decodeFrom, startAt, this.#Type))[0];
|
|
77
|
-
} catch (e) {
|
|
78
|
-
console.error(decodeFrom, length, startAt);
|
|
79
|
-
throw e;
|
|
80
|
-
}
|
|
75
|
+
this.initialU8aLength = ((0, _util.isU8a)(decodeFrom) ? (0, _utils.decodeU8aVec)(registry, this, decodeFrom, startAt, this.#Type) : decodeVec(registry, this, decodeFrom, startAt, this.#Type))[0];
|
|
81
76
|
}
|
|
82
77
|
static with(Type) {
|
|
83
78
|
let definition;
|
package/cjs/packageInfo.js
CHANGED
package/package.json
CHANGED
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@polkadot/types-codec',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '9.13.
|
|
10
|
+
version: '9.13.4'
|
|
11
11
|
};
|