@chainflip/utils 0.4.1 → 0.4.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/dist/chainflip.cjs +25 -3
- package/dist/chainflip.d.cts +23 -2
- package/dist/chainflip.d.ts +23 -2
- package/dist/chainflip.js +5 -1
- package/dist/{chunk-XFHVSV76.js → chunk-FKSZD3R5.js} +24 -4
- package/dist/consts.cjs +3 -0
- package/dist/consts.d.cts +2 -1
- package/dist/consts.d.ts +2 -1
- package/dist/consts.js +2 -0
- package/dist/date.cjs +13 -388
- package/dist/date.d.cts +3 -2
- package/dist/date.d.ts +3 -2
- package/dist/date.js +17 -383
- package/dist/number.cjs +2 -1347
- package/dist/number.js +2 -5
- package/dist/tickMath.cjs +9 -1346
- package/dist/tickMath.js +4 -6
- package/package.json +6 -3
- package/dist/chunk-WGS2RGVR.js +0 -1348
package/dist/tickMath.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BigNumber
|
|
3
|
-
} from "./chunk-WGS2RGVR.js";
|
|
4
1
|
import {
|
|
5
2
|
assetConstants
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FKSZD3R5.js";
|
|
7
4
|
|
|
8
5
|
// src/tickMath.ts
|
|
6
|
+
import { BigNumber } from "bignumber.js";
|
|
9
7
|
var MIN_TICK = -887272;
|
|
10
8
|
var MAX_TICK = -MIN_TICK;
|
|
11
9
|
var FULL_TICK_RANGE = { start: MIN_TICK, end: MAX_TICK };
|
|
@@ -22,8 +20,8 @@ var rateToTick = (rate, baseAsset) => {
|
|
|
22
20
|
tick = Math.floor(tick);
|
|
23
21
|
return Math.max(MIN_TICK, Math.min(tick, MAX_TICK));
|
|
24
22
|
};
|
|
25
|
-
var sqrtPriceX96ToPrice = (amount) => new BigNumber(amount).div(2
|
|
26
|
-
var priceX128ToPrice = (amount) => new BigNumber(amount).div(2
|
|
23
|
+
var sqrtPriceX96ToPrice = (amount) => new BigNumber(amount).div(new BigNumber(2).pow(96)).pow(2);
|
|
24
|
+
var priceX128ToPrice = (amount) => new BigNumber(amount).div(new BigNumber(2).pow(128));
|
|
27
25
|
export {
|
|
28
26
|
FULL_TICK_RANGE,
|
|
29
27
|
MAX_TICK,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainflip/utils",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -19,9 +19,12 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@noble/hashes": "^1.5.0"
|
|
22
|
+
"@noble/hashes": "^1.5.0"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@date-fns/utc": "^2.1.0",
|
|
23
26
|
"bignumber.js": "^9.1.2",
|
|
24
|
-
"date-fns": "
|
|
27
|
+
"date-fns": "4.1.0"
|
|
25
28
|
},
|
|
26
29
|
"repository": "https://github.com/chainflip-io/chainflip-product-toolkit.git",
|
|
27
30
|
"publishConfig": {
|