@nadohq/shared 0.1.0-alpha.52 → 0.1.0-alpha.53
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/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types/balanceTypes.d.cts +4 -4
- package/dist/types/balanceTypes.d.ts +4 -4
- package/dist/types/healthTypes.d.cts +4 -4
- package/dist/types/healthTypes.d.ts +4 -4
- package/dist/types/marketTypes.d.cts +4 -4
- package/dist/types/marketTypes.d.ts +4 -4
- package/dist/types/productTypes.d.cts +16 -16
- package/dist/types/productTypes.d.ts +16 -16
- package/dist/utils/balanceValue.d.cts +4 -4
- package/dist/utils/balanceValue.d.ts +4 -4
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/interest.d.cts +7 -7
- package/dist/utils/interest.d.ts +7 -7
- package/dist/utils/math/BigDecimals.d.cts +5 -5
- package/dist/utils/math/BigDecimals.d.ts +5 -5
- package/dist/utils/math/bigDecimal.cjs +5 -15
- package/dist/utils/math/bigDecimal.cjs.map +1 -1
- package/dist/utils/math/bigDecimal.d.cts +4 -4
- package/dist/utils/math/bigDecimal.d.ts +4 -4
- package/dist/utils/math/bigDecimal.js +3 -3
- package/dist/utils/math/bigDecimal.js.map +1 -1
- package/dist/utils/math/clamp.d.cts +4 -4
- package/dist/utils/math/clamp.d.ts +4 -4
- package/dist/utils/math/decimalAdjustment.d.cts +2 -2
- package/dist/utils/math/decimalAdjustment.d.ts +2 -2
- package/dist/utils/math/index.d.cts +1 -1
- package/dist/utils/math/index.d.ts +1 -1
- package/dist/utils/math/sumBigDecimalBy.d.cts +2 -2
- package/dist/utils/math/sumBigDecimalBy.d.ts +2 -2
- package/dist/utils/toPrintableObject.d.cts +2 -2
- package/dist/utils/toPrintableObject.d.ts +2 -2
- package/package.json +2 -2
- package/src/utils/math/bigDecimal.ts +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -61,7 +61,7 @@ export { getDefaultRecvTime } from './utils/orders/recvTime.cjs';
|
|
|
61
61
|
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './utils/productTypeFilter.cjs';
|
|
62
62
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './utils/time.cjs';
|
|
63
63
|
export { toPrintableObject } from './utils/toPrintableObject.cjs';
|
|
64
|
-
export {
|
|
64
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
65
65
|
import 'viem/chains';
|
|
66
66
|
import 'viem';
|
|
67
67
|
import 'abitype';
|
package/dist/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export { getDefaultRecvTime } from './utils/orders/recvTime.js';
|
|
|
61
61
|
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './utils/productTypeFilter.js';
|
|
62
62
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './utils/time.js';
|
|
63
63
|
export { toPrintableObject } from './utils/toPrintableObject.js';
|
|
64
|
-
export {
|
|
64
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
65
65
|
import 'viem/chains';
|
|
66
66
|
import 'viem';
|
|
67
67
|
import 'abitype';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
import { HealthType } from './healthTypes.cjs';
|
|
3
3
|
import { ProductEngineType, SpotProduct, PerpProduct } from './productTypes.cjs';
|
|
4
4
|
|
|
5
5
|
type BalanceSide = 'long' | 'short';
|
|
6
|
-
type BalanceHealthContributions = Record<HealthType,
|
|
6
|
+
type BalanceHealthContributions = Record<HealthType, BigNumber>;
|
|
7
7
|
/**
|
|
8
8
|
* Shared properties of a product balance
|
|
9
9
|
*/
|
|
10
10
|
interface BaseBalance {
|
|
11
11
|
type: ProductEngineType;
|
|
12
12
|
productId: number;
|
|
13
|
-
amount:
|
|
13
|
+
amount: BigNumber;
|
|
14
14
|
healthContributions: BalanceHealthContributions;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -22,7 +22,7 @@ interface PerpBalance extends BaseBalance {
|
|
|
22
22
|
* As there is no "quote" product for the perp engine, this is a representation of the net quote balance
|
|
23
23
|
* associated with the position. The entry cost and funding is rolled into this.
|
|
24
24
|
*/
|
|
25
|
-
vQuoteBalance:
|
|
25
|
+
vQuoteBalance: BigNumber;
|
|
26
26
|
}
|
|
27
27
|
type PerpBalanceWithProduct = PerpBalance & PerpProduct;
|
|
28
28
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
import { HealthType } from './healthTypes.js';
|
|
3
3
|
import { ProductEngineType, SpotProduct, PerpProduct } from './productTypes.js';
|
|
4
4
|
|
|
5
5
|
type BalanceSide = 'long' | 'short';
|
|
6
|
-
type BalanceHealthContributions = Record<HealthType,
|
|
6
|
+
type BalanceHealthContributions = Record<HealthType, BigNumber>;
|
|
7
7
|
/**
|
|
8
8
|
* Shared properties of a product balance
|
|
9
9
|
*/
|
|
10
10
|
interface BaseBalance {
|
|
11
11
|
type: ProductEngineType;
|
|
12
12
|
productId: number;
|
|
13
|
-
amount:
|
|
13
|
+
amount: BigNumber;
|
|
14
14
|
healthContributions: BalanceHealthContributions;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -22,7 +22,7 @@ interface PerpBalance extends BaseBalance {
|
|
|
22
22
|
* As there is no "quote" product for the perp engine, this is a representation of the net quote balance
|
|
23
23
|
* associated with the position. The entry cost and funding is rolled into this.
|
|
24
24
|
*/
|
|
25
|
-
vQuoteBalance:
|
|
25
|
+
vQuoteBalance: BigNumber;
|
|
26
26
|
}
|
|
27
27
|
type PerpBalanceWithProduct = PerpBalance & PerpProduct;
|
|
28
28
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
type HealthType = 'maintenance' | 'initial' | 'unweighted';
|
|
4
4
|
interface HealthStatus {
|
|
5
|
-
health:
|
|
6
|
-
assets:
|
|
7
|
-
liabilities:
|
|
5
|
+
health: BigNumber;
|
|
6
|
+
assets: BigNumber;
|
|
7
|
+
liabilities: BigNumber;
|
|
8
8
|
}
|
|
9
9
|
type HealthStatusByType = Record<HealthType, HealthStatus>;
|
|
10
10
|
interface HealthGroup {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
type HealthType = 'maintenance' | 'initial' | 'unweighted';
|
|
4
4
|
interface HealthStatus {
|
|
5
|
-
health:
|
|
6
|
-
assets:
|
|
7
|
-
liabilities:
|
|
5
|
+
health: BigNumber;
|
|
6
|
+
assets: BigNumber;
|
|
7
|
+
liabilities: BigNumber;
|
|
8
8
|
}
|
|
9
9
|
type HealthStatusByType = Record<HealthType, HealthStatus>;
|
|
10
10
|
interface HealthGroup {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
import { ProductEngineType, Product, PerpProduct, SpotProduct } from './productTypes.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,9 +8,9 @@ interface Market {
|
|
|
8
8
|
productId: number;
|
|
9
9
|
type: ProductEngineType;
|
|
10
10
|
product: Product;
|
|
11
|
-
minSize:
|
|
12
|
-
priceIncrement:
|
|
13
|
-
sizeIncrement:
|
|
11
|
+
minSize: BigNumber;
|
|
12
|
+
priceIncrement: BigNumber;
|
|
13
|
+
sizeIncrement: BigNumber;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Perp market with perp product info
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
import { ProductEngineType, Product, PerpProduct, SpotProduct } from './productTypes.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,9 +8,9 @@ interface Market {
|
|
|
8
8
|
productId: number;
|
|
9
9
|
type: ProductEngineType;
|
|
10
10
|
product: Product;
|
|
11
|
-
minSize:
|
|
12
|
-
priceIncrement:
|
|
13
|
-
sizeIncrement:
|
|
11
|
+
minSize: BigNumber;
|
|
12
|
+
priceIncrement: BigNumber;
|
|
13
|
+
sizeIncrement: BigNumber;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Perp market with perp product info
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Representation of the ProductEngineType enum used within the contract
|
|
@@ -19,20 +19,20 @@ declare function toProductEngineType(val: number): ProductEngineType;
|
|
|
19
19
|
interface BaseProduct {
|
|
20
20
|
type: ProductEngineType;
|
|
21
21
|
productId: number;
|
|
22
|
-
oraclePrice:
|
|
23
|
-
longWeightInitial:
|
|
24
|
-
shortWeightInitial:
|
|
25
|
-
longWeightMaintenance:
|
|
26
|
-
shortWeightMaintenance:
|
|
22
|
+
oraclePrice: BigNumber;
|
|
23
|
+
longWeightInitial: BigNumber;
|
|
24
|
+
shortWeightInitial: BigNumber;
|
|
25
|
+
longWeightMaintenance: BigNumber;
|
|
26
|
+
shortWeightMaintenance: BigNumber;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Represents a product stored in PerpEngine
|
|
30
30
|
*/
|
|
31
31
|
interface PerpProduct extends BaseProduct {
|
|
32
32
|
type: ProductEngineType.PERP;
|
|
33
|
-
openInterest:
|
|
34
|
-
cumulativeFundingLong:
|
|
35
|
-
cumulativeFundingShort:
|
|
33
|
+
openInterest: BigNumber;
|
|
34
|
+
cumulativeFundingLong: BigNumber;
|
|
35
|
+
cumulativeFundingShort: BigNumber;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Represents a product stored in SpotEngine.
|
|
@@ -42,13 +42,13 @@ interface PerpProduct extends BaseProduct {
|
|
|
42
42
|
interface SpotProduct extends BaseProduct {
|
|
43
43
|
type: ProductEngineType.SPOT;
|
|
44
44
|
tokenAddr: string;
|
|
45
|
-
interestFloor:
|
|
46
|
-
interestInflectionUtil:
|
|
47
|
-
interestSmallCap:
|
|
48
|
-
interestLargeCap:
|
|
49
|
-
minDepositRate:
|
|
50
|
-
totalDeposited:
|
|
51
|
-
totalBorrowed:
|
|
45
|
+
interestFloor: BigNumber;
|
|
46
|
+
interestInflectionUtil: BigNumber;
|
|
47
|
+
interestSmallCap: BigNumber;
|
|
48
|
+
interestLargeCap: BigNumber;
|
|
49
|
+
minDepositRate: BigNumber;
|
|
50
|
+
totalDeposited: BigNumber;
|
|
51
|
+
totalBorrowed: BigNumber;
|
|
52
52
|
}
|
|
53
53
|
type Product = PerpProduct | SpotProduct;
|
|
54
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Representation of the ProductEngineType enum used within the contract
|
|
@@ -19,20 +19,20 @@ declare function toProductEngineType(val: number): ProductEngineType;
|
|
|
19
19
|
interface BaseProduct {
|
|
20
20
|
type: ProductEngineType;
|
|
21
21
|
productId: number;
|
|
22
|
-
oraclePrice:
|
|
23
|
-
longWeightInitial:
|
|
24
|
-
shortWeightInitial:
|
|
25
|
-
longWeightMaintenance:
|
|
26
|
-
shortWeightMaintenance:
|
|
22
|
+
oraclePrice: BigNumber;
|
|
23
|
+
longWeightInitial: BigNumber;
|
|
24
|
+
shortWeightInitial: BigNumber;
|
|
25
|
+
longWeightMaintenance: BigNumber;
|
|
26
|
+
shortWeightMaintenance: BigNumber;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Represents a product stored in PerpEngine
|
|
30
30
|
*/
|
|
31
31
|
interface PerpProduct extends BaseProduct {
|
|
32
32
|
type: ProductEngineType.PERP;
|
|
33
|
-
openInterest:
|
|
34
|
-
cumulativeFundingLong:
|
|
35
|
-
cumulativeFundingShort:
|
|
33
|
+
openInterest: BigNumber;
|
|
34
|
+
cumulativeFundingLong: BigNumber;
|
|
35
|
+
cumulativeFundingShort: BigNumber;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Represents a product stored in SpotEngine.
|
|
@@ -42,13 +42,13 @@ interface PerpProduct extends BaseProduct {
|
|
|
42
42
|
interface SpotProduct extends BaseProduct {
|
|
43
43
|
type: ProductEngineType.SPOT;
|
|
44
44
|
tokenAddr: string;
|
|
45
|
-
interestFloor:
|
|
46
|
-
interestInflectionUtil:
|
|
47
|
-
interestSmallCap:
|
|
48
|
-
interestLargeCap:
|
|
49
|
-
minDepositRate:
|
|
50
|
-
totalDeposited:
|
|
51
|
-
totalBorrowed:
|
|
45
|
+
interestFloor: BigNumber;
|
|
46
|
+
interestInflectionUtil: BigNumber;
|
|
47
|
+
interestSmallCap: BigNumber;
|
|
48
|
+
interestLargeCap: BigNumber;
|
|
49
|
+
minDepositRate: BigNumber;
|
|
50
|
+
totalDeposited: BigNumber;
|
|
51
|
+
totalBorrowed: BigNumber;
|
|
52
52
|
}
|
|
53
53
|
type Product = PerpProduct | SpotProduct;
|
|
54
54
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PerpBalanceWithProduct, SpotBalanceWithProduct } from '../types/balanceTypes.cjs';
|
|
2
|
-
import
|
|
2
|
+
import { BigNumber } from 'bignumber.js';
|
|
3
3
|
import '../types/healthTypes.cjs';
|
|
4
4
|
import '../types/productTypes.cjs';
|
|
5
5
|
|
|
@@ -8,18 +8,18 @@ import '../types/productTypes.cjs';
|
|
|
8
8
|
*
|
|
9
9
|
* @param balanceWithProduct
|
|
10
10
|
*/
|
|
11
|
-
declare function calcSpotBalanceValue(balanceWithProduct: SpotBalanceWithProduct):
|
|
11
|
+
declare function calcSpotBalanceValue(balanceWithProduct: SpotBalanceWithProduct): BigNumber;
|
|
12
12
|
/**
|
|
13
13
|
* Calculates the notional value of a perp balance, in terms of quote units
|
|
14
14
|
*
|
|
15
15
|
* @param balanceWithProduct
|
|
16
16
|
*/
|
|
17
|
-
declare function calcPerpBalanceNotionalValue(balanceWithProduct: PerpBalanceWithProduct):
|
|
17
|
+
declare function calcPerpBalanceNotionalValue(balanceWithProduct: PerpBalanceWithProduct): BigNumber;
|
|
18
18
|
/**
|
|
19
19
|
* Calculates the true quote value of a perp balance, which is the same as its unrealized pnl / unsettled quote, in terms of quote units
|
|
20
20
|
*
|
|
21
21
|
* @param balanceWithProduct
|
|
22
22
|
*/
|
|
23
|
-
declare function calcPerpBalanceValue(balanceWithProduct: PerpBalanceWithProduct):
|
|
23
|
+
declare function calcPerpBalanceValue(balanceWithProduct: PerpBalanceWithProduct): BigNumber;
|
|
24
24
|
|
|
25
25
|
export { calcPerpBalanceNotionalValue, calcPerpBalanceValue, calcSpotBalanceValue };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PerpBalanceWithProduct, SpotBalanceWithProduct } from '../types/balanceTypes.js';
|
|
2
|
-
import
|
|
2
|
+
import { BigNumber } from 'bignumber.js';
|
|
3
3
|
import '../types/healthTypes.js';
|
|
4
4
|
import '../types/productTypes.js';
|
|
5
5
|
|
|
@@ -8,18 +8,18 @@ import '../types/productTypes.js';
|
|
|
8
8
|
*
|
|
9
9
|
* @param balanceWithProduct
|
|
10
10
|
*/
|
|
11
|
-
declare function calcSpotBalanceValue(balanceWithProduct: SpotBalanceWithProduct):
|
|
11
|
+
declare function calcSpotBalanceValue(balanceWithProduct: SpotBalanceWithProduct): BigNumber;
|
|
12
12
|
/**
|
|
13
13
|
* Calculates the notional value of a perp balance, in terms of quote units
|
|
14
14
|
*
|
|
15
15
|
* @param balanceWithProduct
|
|
16
16
|
*/
|
|
17
|
-
declare function calcPerpBalanceNotionalValue(balanceWithProduct: PerpBalanceWithProduct):
|
|
17
|
+
declare function calcPerpBalanceNotionalValue(balanceWithProduct: PerpBalanceWithProduct): BigNumber;
|
|
18
18
|
/**
|
|
19
19
|
* Calculates the true quote value of a perp balance, which is the same as its unrealized pnl / unsettled quote, in terms of quote units
|
|
20
20
|
*
|
|
21
21
|
* @param balanceWithProduct
|
|
22
22
|
*/
|
|
23
|
-
declare function calcPerpBalanceValue(balanceWithProduct: PerpBalanceWithProduct):
|
|
23
|
+
declare function calcPerpBalanceValue(balanceWithProduct: PerpBalanceWithProduct): BigNumber;
|
|
24
24
|
|
|
25
25
|
export { calcPerpBalanceNotionalValue, calcPerpBalanceValue, calcSpotBalanceValue };
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -25,7 +25,7 @@ export { getDefaultRecvTime } from './orders/recvTime.cjs';
|
|
|
25
25
|
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './productTypeFilter.cjs';
|
|
26
26
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './time.cjs';
|
|
27
27
|
export { toPrintableObject } from './toPrintableObject.cjs';
|
|
28
|
-
export {
|
|
28
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
29
29
|
import '../types/balanceTypes.cjs';
|
|
30
30
|
import '../types/healthTypes.cjs';
|
|
31
31
|
import '../types/productTypes.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export { getDefaultRecvTime } from './orders/recvTime.js';
|
|
|
25
25
|
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './productTypeFilter.js';
|
|
26
26
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './time.js';
|
|
27
27
|
export { toPrintableObject } from './toPrintableObject.js';
|
|
28
|
-
export {
|
|
28
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
29
29
|
import '../types/balanceTypes.js';
|
|
30
30
|
import '../types/healthTypes.js';
|
|
31
31
|
import '../types/productTypes.js';
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { SpotProduct } from '../types/productTypes.cjs';
|
|
2
2
|
import { BigDecimalish } from './math/bigDecimal.cjs';
|
|
3
|
-
import
|
|
3
|
+
import { BigNumber } from 'bignumber.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Calculate amount total borrowed for a product
|
|
7
7
|
*/
|
|
8
|
-
declare function calcTotalBorrowed(totalBorrowsNormalized: BigDecimalish, cumulativeBorrowsMultiplierX18: BigDecimalish):
|
|
8
|
+
declare function calcTotalBorrowed(totalBorrowsNormalized: BigDecimalish, cumulativeBorrowsMultiplierX18: BigDecimalish): BigNumber;
|
|
9
9
|
/**
|
|
10
10
|
* Calculate amount total deposited for a product.
|
|
11
11
|
*/
|
|
12
|
-
declare function calcTotalDeposited(totalDepositsNormalized: BigDecimalish, cumulativeDepositsMultiplierX18: BigDecimalish):
|
|
12
|
+
declare function calcTotalDeposited(totalDepositsNormalized: BigDecimalish, cumulativeDepositsMultiplierX18: BigDecimalish): BigNumber;
|
|
13
13
|
/**
|
|
14
14
|
* Calculates utilization ratio = abs(total borrowed / total deposited)
|
|
15
15
|
*
|
|
16
16
|
* @param product Spot product
|
|
17
17
|
*/
|
|
18
|
-
declare function calcUtilizationRatio(product: SpotProduct):
|
|
18
|
+
declare function calcUtilizationRatio(product: SpotProduct): BigNumber;
|
|
19
19
|
/**
|
|
20
20
|
* Calculates per-second borrow interest rate for a product. For example, a returned rate of 0.1 indicates 10% borrower
|
|
21
21
|
* interest. The calculation for interest rate is as follows:
|
|
@@ -30,14 +30,14 @@ declare function calcUtilizationRatio(product: SpotProduct): BigDecimal__default
|
|
|
30
30
|
*
|
|
31
31
|
* @param product Spot product
|
|
32
32
|
*/
|
|
33
|
-
declare function calcBorrowRatePerSecond(product: SpotProduct):
|
|
33
|
+
declare function calcBorrowRatePerSecond(product: SpotProduct): BigNumber;
|
|
34
34
|
/**
|
|
35
35
|
* Calculates borrower interest rate compounded for a period of time.
|
|
36
36
|
*
|
|
37
37
|
* @param product Spot product
|
|
38
38
|
* @param seconds Number of seconds for the time period
|
|
39
39
|
*/
|
|
40
|
-
declare function calcBorrowRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, minDepositRate: BigDecimalish):
|
|
40
|
+
declare function calcBorrowRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, minDepositRate: BigDecimalish): BigNumber;
|
|
41
41
|
/**
|
|
42
42
|
* Calculate depositor interest rate compounded for a period of time.
|
|
43
43
|
*
|
|
@@ -45,6 +45,6 @@ declare function calcBorrowRateForTimeRange(product: SpotProduct, seconds: BigDe
|
|
|
45
45
|
* @param seconds Number of seconds for the time period
|
|
46
46
|
* @param interestFeeFrac Fraction of paid borrower interest that is paid as a fee (0.2 = 20% fee)
|
|
47
47
|
*/
|
|
48
|
-
declare function calcRealizedDepositRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, interestFeeFrac: BigDecimalish, minDepositRate: BigDecimalish):
|
|
48
|
+
declare function calcRealizedDepositRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, interestFeeFrac: BigDecimalish, minDepositRate: BigDecimalish): BigNumber;
|
|
49
49
|
|
|
50
50
|
export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio };
|
package/dist/utils/interest.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { SpotProduct } from '../types/productTypes.js';
|
|
2
2
|
import { BigDecimalish } from './math/bigDecimal.js';
|
|
3
|
-
import
|
|
3
|
+
import { BigNumber } from 'bignumber.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Calculate amount total borrowed for a product
|
|
7
7
|
*/
|
|
8
|
-
declare function calcTotalBorrowed(totalBorrowsNormalized: BigDecimalish, cumulativeBorrowsMultiplierX18: BigDecimalish):
|
|
8
|
+
declare function calcTotalBorrowed(totalBorrowsNormalized: BigDecimalish, cumulativeBorrowsMultiplierX18: BigDecimalish): BigNumber;
|
|
9
9
|
/**
|
|
10
10
|
* Calculate amount total deposited for a product.
|
|
11
11
|
*/
|
|
12
|
-
declare function calcTotalDeposited(totalDepositsNormalized: BigDecimalish, cumulativeDepositsMultiplierX18: BigDecimalish):
|
|
12
|
+
declare function calcTotalDeposited(totalDepositsNormalized: BigDecimalish, cumulativeDepositsMultiplierX18: BigDecimalish): BigNumber;
|
|
13
13
|
/**
|
|
14
14
|
* Calculates utilization ratio = abs(total borrowed / total deposited)
|
|
15
15
|
*
|
|
16
16
|
* @param product Spot product
|
|
17
17
|
*/
|
|
18
|
-
declare function calcUtilizationRatio(product: SpotProduct):
|
|
18
|
+
declare function calcUtilizationRatio(product: SpotProduct): BigNumber;
|
|
19
19
|
/**
|
|
20
20
|
* Calculates per-second borrow interest rate for a product. For example, a returned rate of 0.1 indicates 10% borrower
|
|
21
21
|
* interest. The calculation for interest rate is as follows:
|
|
@@ -30,14 +30,14 @@ declare function calcUtilizationRatio(product: SpotProduct): BigDecimal__default
|
|
|
30
30
|
*
|
|
31
31
|
* @param product Spot product
|
|
32
32
|
*/
|
|
33
|
-
declare function calcBorrowRatePerSecond(product: SpotProduct):
|
|
33
|
+
declare function calcBorrowRatePerSecond(product: SpotProduct): BigNumber;
|
|
34
34
|
/**
|
|
35
35
|
* Calculates borrower interest rate compounded for a period of time.
|
|
36
36
|
*
|
|
37
37
|
* @param product Spot product
|
|
38
38
|
* @param seconds Number of seconds for the time period
|
|
39
39
|
*/
|
|
40
|
-
declare function calcBorrowRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, minDepositRate: BigDecimalish):
|
|
40
|
+
declare function calcBorrowRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, minDepositRate: BigDecimalish): BigNumber;
|
|
41
41
|
/**
|
|
42
42
|
* Calculate depositor interest rate compounded for a period of time.
|
|
43
43
|
*
|
|
@@ -45,6 +45,6 @@ declare function calcBorrowRateForTimeRange(product: SpotProduct, seconds: BigDe
|
|
|
45
45
|
* @param seconds Number of seconds for the time period
|
|
46
46
|
* @param interestFeeFrac Fraction of paid borrower interest that is paid as a fee (0.2 = 20% fee)
|
|
47
47
|
*/
|
|
48
|
-
declare function calcRealizedDepositRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, interestFeeFrac: BigDecimalish, minDepositRate: BigDecimalish):
|
|
48
|
+
declare function calcRealizedDepositRateForTimeRange(product: SpotProduct, seconds: BigDecimalish, interestFeeFrac: BigDecimalish, minDepositRate: BigDecimalish): BigNumber;
|
|
49
49
|
|
|
50
50
|
export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as bignumber_js from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
declare const BigDecimals: Readonly<{
|
|
4
|
-
ZERO:
|
|
5
|
-
ONE:
|
|
6
|
-
INF:
|
|
7
|
-
MAX_I128:
|
|
4
|
+
ZERO: bignumber_js.BigNumber;
|
|
5
|
+
ONE: bignumber_js.BigNumber;
|
|
6
|
+
INF: bignumber_js.BigNumber;
|
|
7
|
+
MAX_I128: bignumber_js.BigNumber;
|
|
8
8
|
}>;
|
|
9
9
|
|
|
10
10
|
export { BigDecimals };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as bignumber_js from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
declare const BigDecimals: Readonly<{
|
|
4
|
-
ZERO:
|
|
5
|
-
ONE:
|
|
6
|
-
INF:
|
|
7
|
-
MAX_I128:
|
|
4
|
+
ZERO: bignumber_js.BigNumber;
|
|
5
|
+
ONE: bignumber_js.BigNumber;
|
|
6
|
+
INF: bignumber_js.BigNumber;
|
|
7
|
+
MAX_I128: bignumber_js.BigNumber;
|
|
8
8
|
}>;
|
|
9
9
|
|
|
10
10
|
export { BigDecimals };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,27 +15,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/utils/math/bigDecimal.ts
|
|
31
21
|
var bigDecimal_exports = {};
|
|
32
22
|
__export(bigDecimal_exports, {
|
|
33
|
-
BigDecimal: () => import_bignumber2.
|
|
23
|
+
BigDecimal: () => import_bignumber2.BigNumber,
|
|
34
24
|
toBigDecimal: () => toBigDecimal
|
|
35
25
|
});
|
|
36
26
|
module.exports = __toCommonJS(bigDecimal_exports);
|
|
37
|
-
var import_bignumber =
|
|
38
|
-
var import_bignumber2 =
|
|
27
|
+
var import_bignumber = require("bignumber.js");
|
|
28
|
+
var import_bignumber2 = require("bignumber.js");
|
|
39
29
|
function toBigDecimal(val) {
|
|
40
|
-
if (import_bignumber.
|
|
30
|
+
if (import_bignumber.BigNumber.isBigNumber(val)) {
|
|
41
31
|
return val;
|
|
42
32
|
}
|
|
43
33
|
const bnConstructorVal = (() => {
|
|
@@ -48,7 +38,7 @@ function toBigDecimal(val) {
|
|
|
48
38
|
}
|
|
49
39
|
return JSON.stringify(val);
|
|
50
40
|
})();
|
|
51
|
-
return new import_bignumber.
|
|
41
|
+
return new import_bignumber.BigNumber(bnConstructorVal);
|
|
52
42
|
}
|
|
53
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
44
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import { BigNumber as BigDecimal } from 'bignumber.js';\n\n// Renames `BigNumber` type from `bignumber.js`.\nexport { BigNumber as BigDecimal } from 'bignumber.js';\n\n/**\n * BigDecimal is a renamed `BigNumber` type from `bignumber.js`.\n * Includes valid values & instances for BigDecimal.\n *\n * @see https://mikemcl.github.io/bignumber.js/\n */\nexport type BigDecimalish = BigDecimal | BigDecimal.Value | bigint;\n\n/**\n * Converts a value to an instance of BigDecimal\n *\n * @param val\n */\nexport function toBigDecimal(val: BigDecimalish): BigDecimal {\n if (BigDecimal.isBigNumber(val)) {\n return val;\n }\n\n const bnConstructorVal = (() => {\n if (typeof val === 'string' || typeof val === 'number') {\n return val;\n } else if (typeof val === 'bigint') {\n return val.toString();\n }\n // This is unlikely to occur, but it's here for completeness. Uses the suggestion here: https://typescript-eslint.io/rules/no-base-to-string/#alternatives\n return JSON.stringify(val);\n })();\n return new BigDecimal(bnConstructorVal);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwC;AAGxC,IAAAA,oBAAwC;AAejC,SAAS,aAAa,KAAgC;AAC3D,MAAI,iBAAAC,UAAW,YAAY,GAAG,GAAG;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,MAAM;AAC9B,QAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,UAAU;AACtD,aAAO;AAAA,IACT,WAAW,OAAO,QAAQ,UAAU;AAClC,aAAO,IAAI,SAAS;AAAA,IACtB;AAEA,WAAO,KAAK,UAAU,GAAG;AAAA,EAC3B,GAAG;AACH,SAAO,IAAI,iBAAAA,UAAW,gBAAgB;AACxC;","names":["import_bignumber","BigDecimal"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export {
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* BigDecimal is a renamed `BigNumber` type from `bignumber.js`.
|
|
@@ -7,12 +7,12 @@ export { default as BigDecimal } from 'bignumber.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @see https://mikemcl.github.io/bignumber.js/
|
|
9
9
|
*/
|
|
10
|
-
type BigDecimalish =
|
|
10
|
+
type BigDecimalish = BigNumber | BigNumber.Value | bigint;
|
|
11
11
|
/**
|
|
12
12
|
* Converts a value to an instance of BigDecimal
|
|
13
13
|
*
|
|
14
14
|
* @param val
|
|
15
15
|
*/
|
|
16
|
-
declare function toBigDecimal(val: BigDecimalish):
|
|
16
|
+
declare function toBigDecimal(val: BigDecimalish): BigNumber;
|
|
17
17
|
|
|
18
18
|
export { type BigDecimalish, toBigDecimal };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export {
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* BigDecimal is a renamed `BigNumber` type from `bignumber.js`.
|
|
@@ -7,12 +7,12 @@ export { default as BigDecimal } from 'bignumber.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @see https://mikemcl.github.io/bignumber.js/
|
|
9
9
|
*/
|
|
10
|
-
type BigDecimalish =
|
|
10
|
+
type BigDecimalish = BigNumber | BigNumber.Value | bigint;
|
|
11
11
|
/**
|
|
12
12
|
* Converts a value to an instance of BigDecimal
|
|
13
13
|
*
|
|
14
14
|
* @param val
|
|
15
15
|
*/
|
|
16
|
-
declare function toBigDecimal(val: BigDecimalish):
|
|
16
|
+
declare function toBigDecimal(val: BigDecimalish): BigNumber;
|
|
17
17
|
|
|
18
18
|
export { type BigDecimalish, toBigDecimal };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../../chunk-5WRI5ZAA.js";
|
|
2
2
|
|
|
3
3
|
// src/utils/math/bigDecimal.ts
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { BigNumber as BigDecimal } from "bignumber.js";
|
|
5
|
+
import { BigNumber } from "bignumber.js";
|
|
6
6
|
function toBigDecimal(val) {
|
|
7
7
|
if (BigDecimal.isBigNumber(val)) {
|
|
8
8
|
return val;
|
|
@@ -18,7 +18,7 @@ function toBigDecimal(val) {
|
|
|
18
18
|
return new BigDecimal(bnConstructorVal);
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
BigNumber as BigDecimal,
|
|
22
22
|
toBigDecimal
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=bigDecimal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import { BigNumber as BigDecimal } from 'bignumber.js';\n\n// Renames `BigNumber` type from `bignumber.js`.\nexport { BigNumber as BigDecimal } from 'bignumber.js';\n\n/**\n * BigDecimal is a renamed `BigNumber` type from `bignumber.js`.\n * Includes valid values & instances for BigDecimal.\n *\n * @see https://mikemcl.github.io/bignumber.js/\n */\nexport type BigDecimalish = BigDecimal | BigDecimal.Value | bigint;\n\n/**\n * Converts a value to an instance of BigDecimal\n *\n * @param val\n */\nexport function toBigDecimal(val: BigDecimalish): BigDecimal {\n if (BigDecimal.isBigNumber(val)) {\n return val;\n }\n\n const bnConstructorVal = (() => {\n if (typeof val === 'string' || typeof val === 'number') {\n return val;\n } else if (typeof val === 'bigint') {\n return val.toString();\n }\n // This is unlikely to occur, but it's here for completeness. Uses the suggestion here: https://typescript-eslint.io/rules/no-base-to-string/#alternatives\n return JSON.stringify(val);\n })();\n return new BigDecimal(bnConstructorVal);\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,kBAAkB;AAGxC,SAAsB,iBAAkB;AAejC,SAAS,aAAa,KAAgC;AAC3D,MAAI,WAAW,YAAY,GAAG,GAAG;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,MAAM;AAC9B,QAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,UAAU;AACtD,aAAO;AAAA,IACT,WAAW,OAAO,QAAQ,UAAU;AAClC,aAAO,IAAI,SAAS;AAAA,IACtB;AAEA,WAAO,KAAK,UAAU,GAAG;AAAA,EAC3B,GAAG;AACH,SAAO,IAAI,WAAW,gBAAgB;AACxC;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
interface ClampOptions {
|
|
4
|
-
min?:
|
|
5
|
-
max?:
|
|
4
|
+
min?: BigNumber;
|
|
5
|
+
max?: BigNumber;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Clamps a value between optional minimum and maximum values.
|
|
@@ -10,6 +10,6 @@ interface ClampOptions {
|
|
|
10
10
|
* @param val
|
|
11
11
|
* @param opts Clamp options
|
|
12
12
|
*/
|
|
13
|
-
declare function clampBigDecimal(val:
|
|
13
|
+
declare function clampBigDecimal(val: BigNumber, opts: ClampOptions): BigNumber;
|
|
14
14
|
|
|
15
15
|
export { clampBigDecimal };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
interface ClampOptions {
|
|
4
|
-
min?:
|
|
5
|
-
max?:
|
|
4
|
+
min?: BigNumber;
|
|
5
|
+
max?: BigNumber;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Clamps a value between optional minimum and maximum values.
|
|
@@ -10,6 +10,6 @@ interface ClampOptions {
|
|
|
10
10
|
* @param val
|
|
11
11
|
* @param opts Clamp options
|
|
12
12
|
*/
|
|
13
|
-
declare function clampBigDecimal(val:
|
|
13
|
+
declare function clampBigDecimal(val: BigNumber, opts: ClampOptions): BigNumber;
|
|
14
14
|
|
|
15
15
|
export { clampBigDecimal };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigDecimalish } from './bigDecimal.cjs';
|
|
2
|
-
import
|
|
2
|
+
import { BigNumber } from 'bignumber.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* All Nado balances have 18 decimals. Ex. 1e18 = 1.0
|
|
@@ -12,7 +12,7 @@ declare const NADO_PRODUCT_DECIMALS = 18;
|
|
|
12
12
|
* - If `T` is a `number`, the result is a `number`.
|
|
13
13
|
* - Otherwise, the result is a `BigDecimal`.
|
|
14
14
|
*/
|
|
15
|
-
type AdjustDecimalsResult<T extends BigDecimalish | undefined> = T extends undefined ? undefined : T extends number ? number :
|
|
15
|
+
type AdjustDecimalsResult<T extends BigDecimalish | undefined> = T extends undefined ? undefined : T extends number ? number : BigNumber;
|
|
16
16
|
/**
|
|
17
17
|
* Adds the specified # of decimals to the number. For example, value = 1, decimals = 2, returns 100.
|
|
18
18
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigDecimalish } from './bigDecimal.js';
|
|
2
|
-
import
|
|
2
|
+
import { BigNumber } from 'bignumber.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* All Nado balances have 18 decimals. Ex. 1e18 = 1.0
|
|
@@ -12,7 +12,7 @@ declare const NADO_PRODUCT_DECIMALS = 18;
|
|
|
12
12
|
* - If `T` is a `number`, the result is a `number`.
|
|
13
13
|
* - Otherwise, the result is a `BigDecimal`.
|
|
14
14
|
*/
|
|
15
|
-
type AdjustDecimalsResult<T extends BigDecimalish | undefined> = T extends undefined ? undefined : T extends number ? number :
|
|
15
|
+
type AdjustDecimalsResult<T extends BigDecimalish | undefined> = T extends undefined ? undefined : T extends number ? number : BigNumber;
|
|
16
16
|
/**
|
|
17
17
|
* Adds the specified # of decimals to the number. For example, value = 1, decimals = 2, returns 100.
|
|
18
18
|
*
|
|
@@ -5,4 +5,4 @@ export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './decimalAdj
|
|
|
5
5
|
export { sumBigDecimalBy } from './sumBigDecimalBy.cjs';
|
|
6
6
|
export { toBigInt } from './toBigInt.cjs';
|
|
7
7
|
export { toIntegerString } from './toIntegerString.cjs';
|
|
8
|
-
export {
|
|
8
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
@@ -5,4 +5,4 @@ export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './decimalAdj
|
|
|
5
5
|
export { sumBigDecimalBy } from './sumBigDecimalBy.js';
|
|
6
6
|
export { toBigInt } from './toBigInt.js';
|
|
7
7
|
export { toIntegerString } from './toIntegerString.js';
|
|
8
|
-
export {
|
|
8
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Util function to sum BigDecimal values, inspired by Lodash
|
|
5
5
|
* @param collection
|
|
6
6
|
* @param iteratee
|
|
7
7
|
*/
|
|
8
|
-
declare function sumBigDecimalBy<T>(collection: T[] | null | undefined, iteratee: (value: T) =>
|
|
8
|
+
declare function sumBigDecimalBy<T>(collection: T[] | null | undefined, iteratee: (value: T) => BigNumber.Value): BigNumber;
|
|
9
9
|
|
|
10
10
|
export { sumBigDecimalBy };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Util function to sum BigDecimal values, inspired by Lodash
|
|
5
5
|
* @param collection
|
|
6
6
|
* @param iteratee
|
|
7
7
|
*/
|
|
8
|
-
declare function sumBigDecimalBy<T>(collection: T[] | null | undefined, iteratee: (value: T) =>
|
|
8
|
+
declare function sumBigDecimalBy<T>(collection: T[] | null | undefined, iteratee: (value: T) => BigNumber.Value): BigNumber;
|
|
9
9
|
|
|
10
10
|
export { sumBigDecimalBy };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Util for converting any BigDecimal types into a string so that it can be logged nicely.
|
|
5
5
|
* Handles cyclic references by returning '[Circular]' for already-visited objects.
|
|
6
6
|
*/
|
|
7
7
|
declare function toPrintableObject(obj: null | undefined, seen?: WeakSet<object>): null;
|
|
8
|
-
declare function toPrintableObject(obj:
|
|
8
|
+
declare function toPrintableObject(obj: BigNumber | bigint, seen?: WeakSet<object>): string;
|
|
9
9
|
declare function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;
|
|
10
10
|
|
|
11
11
|
export { toPrintableObject };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Util for converting any BigDecimal types into a string so that it can be logged nicely.
|
|
5
5
|
* Handles cyclic references by returning '[Circular]' for already-visited objects.
|
|
6
6
|
*/
|
|
7
7
|
declare function toPrintableObject(obj: null | undefined, seen?: WeakSet<object>): null;
|
|
8
|
-
declare function toPrintableObject(obj:
|
|
8
|
+
declare function toPrintableObject(obj: BigNumber | bigint, seen?: WeakSet<object>): string;
|
|
9
9
|
declare function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;
|
|
10
10
|
|
|
11
11
|
export { toPrintableObject };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/shared",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Shared utilities, types, and contract helpers for Nado SDK",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"bignumber.js": "^10.0.2",
|
|
53
53
|
"viem": "workspace:*"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "fb95614952e50c99b6acccbb7bab7bca6669f3c0"
|
|
56
56
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumber as BigDecimal } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
// Renames `BigNumber` type from `bignumber.js`.
|
|
4
|
-
export {
|
|
4
|
+
export { BigNumber as BigDecimal } from 'bignumber.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* BigDecimal is a renamed `BigNumber` type from `bignumber.js`.
|