@exodus/bigint 1.1.1 → 2.0.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/package.json +2 -2
- package/src/bn.js +5 -12
- package/src/native-bigint.js +5 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bigint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "bigint wrappers for native BigUnt, bn.js and others",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Exodus Movement, Inc.",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/ExodusMovement/exodus-core/issues?q=is%3Aissue+is%3Aopen+label%3Abigint"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "579a7b3c5f9616ecd269e31fc50c1abc1b25cb9f"
|
|
32
32
|
}
|
package/src/bn.js
CHANGED
|
@@ -11,7 +11,7 @@ const unwrap = (value) => (value instanceof Wrapper ? value.unwrap() : value)
|
|
|
11
11
|
const BI_ZERO = new BN(0)
|
|
12
12
|
|
|
13
13
|
export default class Wrapper {
|
|
14
|
-
static
|
|
14
|
+
static wrapperName = 'bn.js'
|
|
15
15
|
static isUnderlyingInstance(a) {
|
|
16
16
|
return BN.isBN(a)
|
|
17
17
|
}
|
|
@@ -30,14 +30,6 @@ export default class Wrapper {
|
|
|
30
30
|
return new Wrapper(FACTORY_SYMBOL, value)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
static get ZERO() {
|
|
34
|
-
return ZERO
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static get TEN() {
|
|
38
|
-
return TEN
|
|
39
|
-
}
|
|
40
|
-
|
|
41
33
|
__value__
|
|
42
34
|
|
|
43
35
|
constructor(factorySymbol, value) {
|
|
@@ -159,7 +151,8 @@ export default class Wrapper {
|
|
|
159
151
|
toBaseBufferBE(length) {
|
|
160
152
|
return this.__value__.toBuffer('be', length)
|
|
161
153
|
}
|
|
162
|
-
}
|
|
163
154
|
|
|
164
|
-
|
|
165
|
-
|
|
155
|
+
isBigIntWrapper() {
|
|
156
|
+
return true
|
|
157
|
+
}
|
|
158
|
+
}
|
package/src/native-bigint.js
CHANGED
|
@@ -10,7 +10,7 @@ const unwrap = (value) => (value instanceof Wrapper ? value.unwrap() : value)
|
|
|
10
10
|
const BI_ZERO = BigInt(0)
|
|
11
11
|
|
|
12
12
|
export default class Wrapper {
|
|
13
|
-
static
|
|
13
|
+
static wrapperName = 'native-bigint'
|
|
14
14
|
|
|
15
15
|
static wrap(numberLike, base = 10) {
|
|
16
16
|
if (typeof numberLike === 'bigint') return new Wrapper(FACTORY_SYMBOL, numberLike)
|
|
@@ -31,14 +31,6 @@ export default class Wrapper {
|
|
|
31
31
|
return typeof value === 'bigint'
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
static get ZERO() {
|
|
35
|
-
return ZERO
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static get TEN() {
|
|
39
|
-
return TEN
|
|
40
|
-
}
|
|
41
|
-
|
|
42
34
|
__value__
|
|
43
35
|
|
|
44
36
|
constructor(factorySymbol, value) {
|
|
@@ -169,7 +161,8 @@ export default class Wrapper {
|
|
|
169
161
|
const hex = this.__value__.toString(16)
|
|
170
162
|
return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex')
|
|
171
163
|
}
|
|
172
|
-
}
|
|
173
164
|
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
isBigIntWrapper() {
|
|
166
|
+
return true
|
|
167
|
+
}
|
|
168
|
+
}
|