@polkadot/types-codec 7.2.2-9 → 7.3.2-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/abstract/AbstractInt.cjs +4 -0
- package/abstract/AbstractInt.js +5 -1
- package/detectPackage.cjs +1 -1
- package/detectPackage.js +1 -1
- package/package.json +2 -2
- package/packageInfo.cjs +1 -1
- package/packageInfo.js +1 -1
package/abstract/AbstractInt.cjs
CHANGED
|
@@ -42,6 +42,10 @@ function decodeAbstractInt(value, bitLength, isNegative) {
|
|
|
42
42
|
isLe: false,
|
|
43
43
|
isNegative
|
|
44
44
|
}).toString();
|
|
45
|
+
} else if ((0, _util.isNumber)(value)) {
|
|
46
|
+
(0, _util.assert)(value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER && Math.floor(value) === value, 'Number needs to be an integer <= Number.MAX_SAFE_INTEGER, i.e. 2 ^ 53 - 1');
|
|
47
|
+
} else if ((0, _util.isString)(value)) {
|
|
48
|
+
(0, _util.assert)(!(value.includes('.') || value.includes(',') || value.includes('e')), 'String should not contain decimal points or scientific notation');
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
return (0, _util.bnToBn)(value).toString();
|
package/abstract/AbstractInt.js
CHANGED
|
@@ -2,7 +2,7 @@ import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivate
|
|
|
2
2
|
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
3
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBn, isHex, isU8a, u8aToBn } from '@polkadot/util';
|
|
5
|
+
import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBn, isHex, isNumber, isString, isU8a, u8aToBn } from '@polkadot/util';
|
|
6
6
|
export const DEFAULT_UINT_BITS = 64; // Maximum allowed integer for JS is 2^53 - 1, set limit at 52
|
|
7
7
|
// In this case however, we always print any >32 as hex
|
|
8
8
|
|
|
@@ -29,6 +29,10 @@ function decodeAbstractInt(value, bitLength, isNegative) {
|
|
|
29
29
|
isLe: false,
|
|
30
30
|
isNegative
|
|
31
31
|
}).toString();
|
|
32
|
+
} else if (isNumber(value)) {
|
|
33
|
+
assert(value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER && Math.floor(value) === value, 'Number needs to be an integer <= Number.MAX_SAFE_INTEGER, i.e. 2 ^ 53 - 1');
|
|
34
|
+
} else if (isString(value)) {
|
|
35
|
+
assert(!(value.includes('.') || value.includes(',') || value.includes('e')), 'String should not contain decimal points or scientific notation');
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
return bnToBn(value).toString();
|
package/detectPackage.cjs
CHANGED
|
@@ -11,4 +11,4 @@ var _packageInfo = require("./packageInfo.cjs");
|
|
|
11
11
|
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
|
12
12
|
// SPDX-License-Identifier: Apache-2.0
|
|
13
13
|
// Do not edit, auto-generated by @polkadot/dev
|
|
14
|
-
(0, _util.detectPackage)(_packageInfo.packageInfo,
|
|
14
|
+
(0, _util.detectPackage)(_packageInfo.packageInfo, null, _detectOther.default);
|
package/detectPackage.js
CHANGED
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./detectPackage.cjs"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "7.
|
|
23
|
+
"version": "7.3.2-2",
|
|
24
24
|
"main": "index.cjs",
|
|
25
25
|
"module": "index.js",
|
|
26
26
|
"types": "index.d.ts",
|
|
@@ -400,6 +400,6 @@
|
|
|
400
400
|
},
|
|
401
401
|
"dependencies": {
|
|
402
402
|
"@babel/runtime": "^7.16.7",
|
|
403
|
-
"@polkadot/util": "^8.
|
|
403
|
+
"@polkadot/util": "^8.3.1"
|
|
404
404
|
}
|
|
405
405
|
}
|
package/packageInfo.cjs
CHANGED
package/packageInfo.js
CHANGED