@mezo-org/passport 0.5.2-dev.3 → 0.5.2-dev.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/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +1 -1
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js +0 -2
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +1 -1
- package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -1
- package/dist/src/hooks/useAssetsConversionRates.js +9 -36
- package/dist/src/hooks/useAssetsConversionRates.js.map +1 -1
- package/dist/src/hooks/useBorrowData.d.ts +0 -15
- package/dist/src/hooks/useBorrowData.d.ts.map +1 -1
- package/dist/src/hooks/useBorrowData.js +3 -25
- package/dist/src/hooks/useBorrowData.js.map +1 -1
- package/dist/src/hooks/useCollateralPrice.d.ts +17 -0
- package/dist/src/hooks/useCollateralPrice.d.ts.map +1 -0
- package/dist/src/hooks/useCollateralPrice.js +56 -0
- package/dist/src/hooks/useCollateralPrice.js.map +1 -0
- package/dist/src/hooks/useTokensBalances.d.ts.map +1 -1
- package/dist/src/hooks/useTokensBalances.js +0 -7
- package/dist/src/hooks/useTokensBalances.js.map +1 -1
- package/dist/src/lib/contracts/index.d.ts +1 -1
- package/dist/src/lib/contracts/index.d.ts.map +1 -1
- package/dist/src/lib/contracts/index.js +0 -1
- package/dist/src/lib/contracts/index.js.map +1 -1
- package/dist/src/utils/numbers.test.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Dropdown/Root/AccountMusdListing.tsx +0 -2
- package/src/hooks/useAssetsConversionRates.ts +10 -43
- package/src/hooks/useBorrowData.ts +5 -27
- package/src/hooks/useCollateralPrice.ts +64 -0
- package/src/hooks/useTokensBalances.ts +0 -9
- package/src/lib/contracts/index.ts +0 -2
- package/src/utils/numbers.test.ts +0 -1
- package/dist/src/hooks/useTokensBalances copy.d.ts +0 -74
- package/dist/src/hooks/useTokensBalances copy.d.ts.map +0 -1
- package/dist/src/hooks/useTokensBalances copy.js +0 -206
- package/dist/src/hooks/useTokensBalances copy.js.map +0 -1
- package/dist/src/lib/contracts/priceOracle.d.ts +0 -43
- package/dist/src/lib/contracts/priceOracle.d.ts.map +0 -1
- package/dist/src/lib/contracts/priceOracle.js +0 -52
- package/dist/src/lib/contracts/priceOracle.js.map +0 -1
- package/dist/src/utils/chain.d.ts +0 -2
- package/dist/src/utils/chain.d.ts.map +0 -1
- package/dist/src/utils/chain.js +0 -5
- package/dist/src/utils/chain.js.map +0 -1
- package/dist/src/utils/number2.d.ts +0 -106
- package/dist/src/utils/number2.d.ts.map +0 -1
- package/dist/src/utils/number2.js +0 -289
- package/dist/src/utils/number2.js.map +0 -1
- package/dist/src/utils/number2.test.d.ts +0 -2
- package/dist/src/utils/number2.test.d.ts.map +0 -1
- package/dist/src/utils/number2.test.js +0 -223
- package/dist/src/utils/number2.test.js.map +0 -1
- package/src/hooks/useTokensBalances copy.ts +0 -289
- package/src/lib/contracts/priceOracle.ts +0 -53
- package/src/utils/chain.ts +0 -5
- package/src/utils/number2.test.ts +0 -309
- package/src/utils/number2.ts +0 -419
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
// Matches floating point numbers with optional thousands separators
|
|
2
|
-
export const FLOATING_POINT_REGEX = /^[^0-9]*([0-9,]+)(?:\.([0-9]*))?$/;
|
|
3
|
-
const FRIENDLY_DECIMALS_AMOUNT = 6;
|
|
4
|
-
/**
|
|
5
|
-
* HELPER FUNCTIONS
|
|
6
|
-
* These functions are used to convert between floating-point numbers and fixed-point numbers.
|
|
7
|
-
* They handle parsing, conversion, and formatting of numbers with specific decimal places.
|
|
8
|
-
* They shouldn't be used directly in the UI or business logic.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Parses a floating-point string into a fixed-point number representation.
|
|
12
|
-
* @param floatingPointString The floating-point string to parse.
|
|
13
|
-
* @returns The fixed-point number representation or undefined if parsing fails.
|
|
14
|
-
*/
|
|
15
|
-
const parseToFixedPointNumber = (floatingPointString) => {
|
|
16
|
-
if (!floatingPointString.match(FLOATING_POINT_REGEX)) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
const [whole, decimals, ...extra] = floatingPointString.split(".");
|
|
20
|
-
// Only one `.` supported.
|
|
21
|
-
if (extra.length > 0) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
const noThousandsSeparatorWhole = whole.replace(",", "");
|
|
25
|
-
const setDecimals = decimals ?? "";
|
|
26
|
-
try {
|
|
27
|
-
return {
|
|
28
|
-
amount: BigInt([noThousandsSeparatorWhole, setDecimals].join("")),
|
|
29
|
-
decimals: setDecimals.length,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Separates thousands in a number with commas.
|
|
38
|
-
* @param value The value to format.
|
|
39
|
-
* @param minDecimals The minimum number of decimal places.
|
|
40
|
-
* @param maxDecimals The maximum number of decimal places.
|
|
41
|
-
* @returns The formatted value with thousands separators.
|
|
42
|
-
*/
|
|
43
|
-
const separateThousandsWithComma = (value, minDecimals = 0, maxDecimals = 2) => {
|
|
44
|
-
let adjustedValue = value;
|
|
45
|
-
let adjustedMaxDecimals = maxDecimals;
|
|
46
|
-
// If passed value is not numeric we should return 0
|
|
47
|
-
if (Number.isNaN(+value.toString())) {
|
|
48
|
-
adjustedValue = 0;
|
|
49
|
-
}
|
|
50
|
-
if (typeof adjustedValue === "string") {
|
|
51
|
-
adjustedValue = +adjustedValue;
|
|
52
|
-
}
|
|
53
|
-
if (minDecimals > maxDecimals) {
|
|
54
|
-
adjustedMaxDecimals = minDecimals;
|
|
55
|
-
}
|
|
56
|
-
// Ensure maximumFractionDigits is within allowed range [0, 20]
|
|
57
|
-
const safeMaxDecimals = Math.max(0, Math.min(adjustedMaxDecimals, 20));
|
|
58
|
-
// @ts-expect-error - `maximumFractionDigits` wants to get number less than 21,
|
|
59
|
-
// but as the tokens have 18 decimals have, we can safely pass a parameter
|
|
60
|
-
return adjustedValue.toLocaleString("en-US", {
|
|
61
|
-
minimumFractionDigits: minDecimals,
|
|
62
|
-
maximumFractionDigits: safeMaxDecimals,
|
|
63
|
-
roundingMode: "halfExpand",
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
/** PUBLIC HELPER FUNCTIONS for calculations */
|
|
67
|
-
/**
|
|
68
|
-
* Multiplies a bigint with a decimal number, taking into account the decimal places.
|
|
69
|
-
*
|
|
70
|
-
* @param bigint - The bigint value to multiply.
|
|
71
|
-
* @param number - The decimal number to multiply with.
|
|
72
|
-
* @returns The result of the multiplication as a bigint.
|
|
73
|
-
*/
|
|
74
|
-
export const multiplyBigIntWithDecimal = (bigint, number) => {
|
|
75
|
-
const numberString = number.toString();
|
|
76
|
-
const scientificMatch = /^1e-(\d+)$/.exec(numberString);
|
|
77
|
-
// Ensure we can correctly deal with scientific number expression
|
|
78
|
-
if (scientificMatch) {
|
|
79
|
-
const exponent = parseInt(scientificMatch[1], 10);
|
|
80
|
-
const scale = BigInt(10 ** exponent);
|
|
81
|
-
return (bigint * 1n) / scale;
|
|
82
|
-
}
|
|
83
|
-
const decimalsPart = number.toString().split(".")[1];
|
|
84
|
-
const decimalsCount = decimalsPart ? decimalsPart.length : 0;
|
|
85
|
-
if (!decimalsCount)
|
|
86
|
-
return bigint * BigInt(number);
|
|
87
|
-
const scale = BigInt(10 ** decimalsCount);
|
|
88
|
-
const scaledNumber = BigInt(Math.round(number * Number(scale)));
|
|
89
|
-
return (bigint * scaledNumber) / scale;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Converts a fixed-point number to another fixed-point number with a different decimal precision.
|
|
93
|
-
* @param args The arguments for the conversion.
|
|
94
|
-
* - amount: required, the fixed-point number to convert.
|
|
95
|
-
* - decimals: required, the current decimal precision of the number.
|
|
96
|
-
* - targetDecimals: required, the target decimal precision for the conversion.
|
|
97
|
-
* @returns The converted fixed-point number.
|
|
98
|
-
*/
|
|
99
|
-
export const convertDecimals = ({ amount, decimals, targetDecimals, }) => {
|
|
100
|
-
if (decimals >= targetDecimals) {
|
|
101
|
-
return amount / 10n ** BigInt(decimals - targetDecimals);
|
|
102
|
-
}
|
|
103
|
-
return amount * 10n ** BigInt(targetDecimals - decimals);
|
|
104
|
-
};
|
|
105
|
-
/** Helper functions for input components */
|
|
106
|
-
/**
|
|
107
|
-
* Trims decimal places to a specified precision - NO ROUNDING!
|
|
108
|
-
* @param value The value to trim
|
|
109
|
-
* @param precision The number of decimal places to keep
|
|
110
|
-
* @returns The trimmed value
|
|
111
|
-
*/
|
|
112
|
-
export const trimDecimals = (value, precision) => {
|
|
113
|
-
const [integerPart, decimalPart = ""] = value.split(".");
|
|
114
|
-
return decimalPart.length > precision
|
|
115
|
-
? `${integerPart}.${decimalPart.slice(0, precision)}`
|
|
116
|
-
: value;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Trims integer part to a specified length - NO ROUNDING!
|
|
120
|
-
* @param value The value to trim
|
|
121
|
-
* @param precision The number of integer places to keep
|
|
122
|
-
* @returns The trimmed value
|
|
123
|
-
* @deprecated just compare the value to the max allowed value in the input component
|
|
124
|
-
*/
|
|
125
|
-
export const trimBeforeDecimals = (value, precision) => {
|
|
126
|
-
const [integerPart, decimalPart = ""] = value.split(".");
|
|
127
|
-
return integerPart.length > precision
|
|
128
|
-
? `${integerPart.slice(0, precision)}.${decimalPart}`
|
|
129
|
-
: value;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Normalizes a decimal number input by removing invalid characters and preventing multiple dots.
|
|
133
|
-
* @param value The value to normalize
|
|
134
|
-
* @returns The normalized value
|
|
135
|
-
*/
|
|
136
|
-
export const normalizeDecimalNumber = (value) => value.replace(/[^0-9.]/g, "").replace(/\.(?=.*\.)/g, ""); // Remove all dots except the first one
|
|
137
|
-
/**
|
|
138
|
-
* CONVERSION FUNCTIONS
|
|
139
|
-
* These functions convert between floating-point numbers and big integers as well as
|
|
140
|
-
* provide human-readable formats.
|
|
141
|
-
*
|
|
142
|
-
* They are used to ensure that numbers are correctly formatted for display and calculations
|
|
143
|
-
* and should be used in the UI and business logic to ensure correct number formatting.
|
|
144
|
-
*/
|
|
145
|
-
/** Basic conversion bigint <-> float */
|
|
146
|
-
/**
|
|
147
|
-
* Converts a floating-point number to a big integer representation.
|
|
148
|
-
* @param args The arguments for the conversion.
|
|
149
|
-
* - amount: required, the floating-point number to convert.
|
|
150
|
-
* - decimals: optional, the number of decimal places to consider.
|
|
151
|
-
* @returns The big integer representation of the floating-point number.
|
|
152
|
-
*/
|
|
153
|
-
export const floatToBigInt = ({ amount, decimals = 18, }) => {
|
|
154
|
-
const parsedAmount = amount.toString();
|
|
155
|
-
const fixedPointAmount = parseToFixedPointNumber(parsedAmount);
|
|
156
|
-
if (typeof fixedPointAmount === "undefined") {
|
|
157
|
-
return 0n;
|
|
158
|
-
}
|
|
159
|
-
const bigIntAmount = convertDecimals({
|
|
160
|
-
amount: fixedPointAmount.amount,
|
|
161
|
-
decimals: fixedPointAmount.decimals,
|
|
162
|
-
targetDecimals: decimals,
|
|
163
|
-
});
|
|
164
|
-
return bigIntAmount;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* Converts a big integer representation to a floating-point number.
|
|
168
|
-
* @param args The arguments for the conversion.
|
|
169
|
-
* - amount: required, the big integer representation to convert.
|
|
170
|
-
* - decimals: optional, the number of decimal places to consider.
|
|
171
|
-
* - desiredDecimals: optional, the desired number of decimal places for the output.
|
|
172
|
-
* @returns The floating-point representation of the big integer.
|
|
173
|
-
*/
|
|
174
|
-
export const bigIntToFloat = ({ amount, decimals = 18, desiredDecimals = decimals, }) => {
|
|
175
|
-
let isNegative = false;
|
|
176
|
-
let normalizedAmount = amount;
|
|
177
|
-
if (amount < 0n) {
|
|
178
|
-
normalizedAmount = -amount;
|
|
179
|
-
isNegative = true;
|
|
180
|
-
}
|
|
181
|
-
const desiredDecimalsAmount = normalizedAmount / 10n ** BigInt(Math.max(0, decimals - desiredDecimals));
|
|
182
|
-
// Desired decimals amount with additional decimal to check if number
|
|
183
|
-
// should be rounded up
|
|
184
|
-
const desiredDecimalsAmountWithAdditionalDecimal = normalizedAmount /
|
|
185
|
-
10n ** BigInt(Math.max(0, decimals - desiredDecimals - 1));
|
|
186
|
-
// We are getting the first value that has been cut off
|
|
187
|
-
const firstDecimalAfterCutOff = desiredDecimalsAmountWithAdditionalDecimal
|
|
188
|
-
.toString()
|
|
189
|
-
.at(-1);
|
|
190
|
-
// Padding amount when its length is smaller than desired
|
|
191
|
-
const parsedDesiredAmount = desiredDecimalsAmount
|
|
192
|
-
.toString()
|
|
193
|
-
.padStart(desiredDecimals + 1, "0");
|
|
194
|
-
const integersPart = parsedDesiredAmount.slice(0, -desiredDecimals);
|
|
195
|
-
const decimalsPart = parsedDesiredAmount.slice(-desiredDecimals);
|
|
196
|
-
// If number is above or equal to 5 we should round up the number
|
|
197
|
-
const shouldIncreaseDecimalsPart = Number(firstDecimalAfterCutOff) >= 5 && desiredDecimals !== decimals;
|
|
198
|
-
// If above is true we add 1 to the decimals value and convert it back to string
|
|
199
|
-
const adjustedDecimalsPart = shouldIncreaseDecimalsPart
|
|
200
|
-
? (Number(decimalsPart) + 1).toString().padStart(desiredDecimals, "0")
|
|
201
|
-
: decimalsPart;
|
|
202
|
-
// Determining whether integer part needs to be increased due to rounding up
|
|
203
|
-
const shouldIncreaseIntegerPart = (decimalsPart === "0" && adjustedDecimalsPart !== decimalsPart) ||
|
|
204
|
-
adjustedDecimalsPart.length > decimalsPart.length;
|
|
205
|
-
// If above is true we add 1 to the integers value and convert it back to string
|
|
206
|
-
// and set first value of decimals part to 0
|
|
207
|
-
const adjustedIntegersPart = shouldIncreaseIntegerPart
|
|
208
|
-
? (Number(integersPart) + 1).toString()
|
|
209
|
-
: integersPart;
|
|
210
|
-
const decimalsPartAfterIntegersAdjustments = shouldIncreaseIntegerPart
|
|
211
|
-
? `0${adjustedDecimalsPart.slice(1)}`
|
|
212
|
-
: adjustedDecimalsPart;
|
|
213
|
-
// Inserting "." to separate integers part from decimal part
|
|
214
|
-
const desiredAmount = [
|
|
215
|
-
...adjustedIntegersPart,
|
|
216
|
-
".",
|
|
217
|
-
...decimalsPartAfterIntegersAdjustments,
|
|
218
|
-
].join("");
|
|
219
|
-
// Remove trailing zeros and the trailing decimal point (if exists)
|
|
220
|
-
const trimmedDesiredAmount = desiredAmount.replace(/(?:\.0*|(\.\d+?)0+)$/, "$1");
|
|
221
|
-
return isNegative ? `-${trimmedDesiredAmount}` : trimmedDesiredAmount;
|
|
222
|
-
};
|
|
223
|
-
/**
|
|
224
|
-
* Helpers for setting correct arguments and getting unified human-readable
|
|
225
|
-
* formats across the app with _toHumanReadableFormat functions.
|
|
226
|
-
*/
|
|
227
|
-
export const amountAsUSD = (args) => ({
|
|
228
|
-
desiredDecimals: 2,
|
|
229
|
-
minDecimals: 2,
|
|
230
|
-
...args,
|
|
231
|
-
});
|
|
232
|
-
export const amountAsToken = (args) => ({
|
|
233
|
-
desiredDecimals: FRIENDLY_DECIMALS_AMOUNT,
|
|
234
|
-
minDecimals: 0,
|
|
235
|
-
...args,
|
|
236
|
-
});
|
|
237
|
-
export const amountAsMusd = (args) => ({
|
|
238
|
-
desiredDecimals: 2,
|
|
239
|
-
minDecimals: 2,
|
|
240
|
-
decimals: 18, // MUSD has 18 decimals
|
|
241
|
-
...args,
|
|
242
|
-
});
|
|
243
|
-
export const amountAsMats = (args) => ({
|
|
244
|
-
desiredDecimals: 0,
|
|
245
|
-
minDecimals: 0,
|
|
246
|
-
...args,
|
|
247
|
-
});
|
|
248
|
-
/**
|
|
249
|
-
* Converts a floating-point number to a human-readable format - with thousands
|
|
250
|
-
* separators and specified decimal places.
|
|
251
|
-
* @param args The arguments for the conversion.
|
|
252
|
-
* - amount: required, the floating-point number to convert.
|
|
253
|
-
* - desiredDecimals: optional, the desired number of decimal places for the output.
|
|
254
|
-
* - minDecimals: optional, the minimum number of decimal places.
|
|
255
|
-
* @returns The human-readable format of the floating-point number.
|
|
256
|
-
*/
|
|
257
|
-
export const floatToHumanReadableFormat = ({ amount, desiredDecimals = 2, // treat is as an USD amount by default
|
|
258
|
-
minDecimals = 0, }) => separateThousandsWithComma(amount, minDecimals, desiredDecimals);
|
|
259
|
-
export const bigIntToHumanReadableFormat = ({ amount, decimals = 18, desiredDecimals = FRIENDLY_DECIMALS_AMOUNT, // treat is as a token by default
|
|
260
|
-
minDecimals = 0, }) => {
|
|
261
|
-
let isNegative = false;
|
|
262
|
-
let normalizedAmount = amount;
|
|
263
|
-
let adjustedDesiredDecimals = desiredDecimals;
|
|
264
|
-
if (minDecimals > desiredDecimals) {
|
|
265
|
-
adjustedDesiredDecimals = minDecimals;
|
|
266
|
-
}
|
|
267
|
-
if (normalizedAmount < 0n) {
|
|
268
|
-
normalizedAmount = -normalizedAmount;
|
|
269
|
-
isNegative = true;
|
|
270
|
-
}
|
|
271
|
-
const trimmedDesiredAmount = bigIntToFloat({
|
|
272
|
-
amount: normalizedAmount,
|
|
273
|
-
decimals,
|
|
274
|
-
desiredDecimals: adjustedDesiredDecimals,
|
|
275
|
-
});
|
|
276
|
-
if (trimmedDesiredAmount === "0" && normalizedAmount !== 0n) {
|
|
277
|
-
const decimalsString = "1".padStart(adjustedDesiredDecimals, "0");
|
|
278
|
-
return `<0.${decimalsString}`;
|
|
279
|
-
}
|
|
280
|
-
const desiredValue = isNegative
|
|
281
|
-
? `-${trimmedDesiredAmount}`
|
|
282
|
-
: trimmedDesiredAmount;
|
|
283
|
-
return floatToHumanReadableFormat({
|
|
284
|
-
amount: desiredValue,
|
|
285
|
-
desiredDecimals: adjustedDesiredDecimals,
|
|
286
|
-
minDecimals,
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
|
-
//# sourceMappingURL=number2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number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,UAAU;QAC7B,CAAC,CAAC,IAAI,oBAAoB,EAAE;QAC5B,CAAC,CAAC,oBAAoB,CAAA;IAExB,OAAO,0BAA0B,CAAC;QAChC,MAAM,EAAE,YAAY;QACpB,eAAe,EAAE,uBAAuB;QACxC,WAAW;KACZ,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number2.test.d.ts","sourceRoot":"","sources":["../../../src/utils/number2.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { bigIntToFloat, bigIntToHumanReadableFormat, floatToBigInt, floatToHumanReadableFormat, multiplyBigIntWithDecimal, normalizeDecimalNumber, trimBeforeDecimals, trimDecimals, } from "./number2";
|
|
2
|
-
describe("floatToBigInt", () => {
|
|
3
|
-
it("should convert integer string to bigint with default decimals", () => {
|
|
4
|
-
expect(floatToBigInt({ amount: "1" })).toBe(1000000000000000000n);
|
|
5
|
-
});
|
|
6
|
-
it("should convert float string to bigint with default decimals", () => {
|
|
7
|
-
expect(floatToBigInt({ amount: "1.23" })).toBe(1230000000000000000n);
|
|
8
|
-
});
|
|
9
|
-
it("should convert float string to bigint with custom decimals", () => {
|
|
10
|
-
expect(floatToBigInt({ amount: "1.23", decimals: 2 })).toBe(123n);
|
|
11
|
-
expect(floatToBigInt({ amount: "1.2345", decimals: 2 })).toBe(123n);
|
|
12
|
-
expect(floatToBigInt({ amount: "1.2345", decimals: 6 })).toBe(1234500n);
|
|
13
|
-
});
|
|
14
|
-
it("should handle numbers as input", () => {
|
|
15
|
-
expect(floatToBigInt({ amount: 2.5 })).toBe(2500000000000000000n);
|
|
16
|
-
});
|
|
17
|
-
it("should handle zero", () => {
|
|
18
|
-
expect(floatToBigInt({ amount: "0" })).toBe(0n);
|
|
19
|
-
expect(floatToBigInt({ amount: 0 })).toBe(0n);
|
|
20
|
-
});
|
|
21
|
-
it("should handle negative numbers", () => {
|
|
22
|
-
expect(floatToBigInt({ amount: "-1.5" })).toBe(-1500000000000000000n);
|
|
23
|
-
});
|
|
24
|
-
it("should handle numbers with thousands separator", () => {
|
|
25
|
-
expect(floatToBigInt({ amount: "1,234.56" })).toBe(1234560000000000000000n);
|
|
26
|
-
});
|
|
27
|
-
it("should return 0n for invalid input", () => {
|
|
28
|
-
expect(floatToBigInt({ amount: "abc" })).toBe(0n);
|
|
29
|
-
expect(floatToBigInt({ amount: "1.2.3" })).toBe(0n);
|
|
30
|
-
expect(floatToBigInt({ amount: "" })).toBe(0n);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe("bigIntToFloat", () => {
|
|
34
|
-
it("should convert bigint to float string with default decimals", () => {
|
|
35
|
-
expect(bigIntToFloat({ amount: 1000000000000000000n })).toBe("1");
|
|
36
|
-
expect(bigIntToFloat({ amount: 1230000000000000000n })).toBe("1.23");
|
|
37
|
-
});
|
|
38
|
-
it("should convert bigint to float string with custom decimals", () => {
|
|
39
|
-
expect(bigIntToFloat({ amount: 123n, decimals: 2 })).toBe("1.23");
|
|
40
|
-
expect(bigIntToFloat({ amount: 1234500n, decimals: 6 })).toBe("1.2345");
|
|
41
|
-
});
|
|
42
|
-
it("should handle desiredDecimals less than decimals", () => {
|
|
43
|
-
expect(bigIntToFloat({
|
|
44
|
-
amount: 1234567890000000000n,
|
|
45
|
-
decimals: 18,
|
|
46
|
-
desiredDecimals: 2,
|
|
47
|
-
})).toBe("1.23");
|
|
48
|
-
expect(bigIntToFloat({
|
|
49
|
-
amount: 1234567890000000000n,
|
|
50
|
-
decimals: 18,
|
|
51
|
-
desiredDecimals: 6,
|
|
52
|
-
})).toBe("1.234568");
|
|
53
|
-
});
|
|
54
|
-
it("should handle zero", () => {
|
|
55
|
-
expect(bigIntToFloat({ amount: 0n })).toBe("0");
|
|
56
|
-
});
|
|
57
|
-
it("should handle negative numbers", () => {
|
|
58
|
-
expect(bigIntToFloat({ amount: -1500000000000000000n })).toBe("-1.5");
|
|
59
|
-
});
|
|
60
|
-
it("should handle rounding up", () => {
|
|
61
|
-
expect(bigIntToFloat({
|
|
62
|
-
amount: 1249999999999999999n,
|
|
63
|
-
decimals: 18,
|
|
64
|
-
desiredDecimals: 2,
|
|
65
|
-
})).toBe("1.25");
|
|
66
|
-
expect(bigIntToFloat({
|
|
67
|
-
amount: 1234567890000000000n,
|
|
68
|
-
decimals: 18,
|
|
69
|
-
desiredDecimals: 4,
|
|
70
|
-
})).toBe("1.2346");
|
|
71
|
-
});
|
|
72
|
-
it("should handle large numbers", () => {
|
|
73
|
-
expect(bigIntToFloat({
|
|
74
|
-
amount: 123456789012345678901234567890n,
|
|
75
|
-
decimals: 18,
|
|
76
|
-
desiredDecimals: 2,
|
|
77
|
-
})).toBe("123456789012.35");
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe("floatToHumanReadableFormat", () => {
|
|
81
|
-
it("should format number with thousands separator and default decimals", () => {
|
|
82
|
-
expect(floatToHumanReadableFormat({ amount: 1234567.891 })).toBe("1,234,567.89");
|
|
83
|
-
expect(floatToHumanReadableFormat({ amount: "1234567.891" })).toBe("1,234,567.89");
|
|
84
|
-
});
|
|
85
|
-
it("should format with custom decimals", () => {
|
|
86
|
-
expect(floatToHumanReadableFormat({ amount: 1234567.891, desiredDecimals: 3 })).toBe("1,234,567.891");
|
|
87
|
-
expect(floatToHumanReadableFormat({ amount: 1234567.8, desiredDecimals: 0 })).toBe("1,234,568");
|
|
88
|
-
});
|
|
89
|
-
it("should format with minDecimals", () => {
|
|
90
|
-
expect(floatToHumanReadableFormat({
|
|
91
|
-
amount: 1234.5,
|
|
92
|
-
desiredDecimals: 2,
|
|
93
|
-
minDecimals: 1,
|
|
94
|
-
})).toBe("1,234.5");
|
|
95
|
-
expect(floatToHumanReadableFormat({
|
|
96
|
-
amount: 1234.5,
|
|
97
|
-
desiredDecimals: 2,
|
|
98
|
-
minDecimals: 2,
|
|
99
|
-
})).toBe("1,234.50");
|
|
100
|
-
expect(floatToHumanReadableFormat({
|
|
101
|
-
amount: 1234.5,
|
|
102
|
-
desiredDecimals: 2,
|
|
103
|
-
minDecimals: 4,
|
|
104
|
-
})).toBe("1,234.5000");
|
|
105
|
-
});
|
|
106
|
-
it("should return '0' for invalid input", () => {
|
|
107
|
-
expect(floatToHumanReadableFormat({ amount: "abc" })).toBe("0");
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
describe("bigIntToHumanReadableFormat", () => {
|
|
111
|
-
it("should format bigint to human readable string", () => {
|
|
112
|
-
expect(bigIntToHumanReadableFormat({
|
|
113
|
-
amount: 1234567890000000000n,
|
|
114
|
-
decimals: 18,
|
|
115
|
-
desiredDecimals: 2,
|
|
116
|
-
})).toBe("1.23");
|
|
117
|
-
expect(bigIntToHumanReadableFormat({
|
|
118
|
-
amount: 1234567890000000000n,
|
|
119
|
-
decimals: 18,
|
|
120
|
-
desiredDecimals: 6,
|
|
121
|
-
})).toBe("1.234568");
|
|
122
|
-
});
|
|
123
|
-
it("should handle negative values", () => {
|
|
124
|
-
expect(bigIntToHumanReadableFormat({
|
|
125
|
-
amount: -1234567890000000000n,
|
|
126
|
-
decimals: 18,
|
|
127
|
-
desiredDecimals: 2,
|
|
128
|
-
})).toBe("-1.23");
|
|
129
|
-
});
|
|
130
|
-
it("should show <0.01 for very small nonzero values", () => {
|
|
131
|
-
expect(bigIntToHumanReadableFormat({
|
|
132
|
-
amount: 1n,
|
|
133
|
-
decimals: 18,
|
|
134
|
-
desiredDecimals: 2,
|
|
135
|
-
})).toBe("<0.01");
|
|
136
|
-
expect(bigIntToHumanReadableFormat({
|
|
137
|
-
amount: -1n,
|
|
138
|
-
decimals: 18,
|
|
139
|
-
desiredDecimals: 2,
|
|
140
|
-
})).toBe("<0.01");
|
|
141
|
-
});
|
|
142
|
-
it("should format with minDecimals", () => {
|
|
143
|
-
expect(bigIntToHumanReadableFormat({
|
|
144
|
-
amount: 1234000000000000000n,
|
|
145
|
-
decimals: 18,
|
|
146
|
-
desiredDecimals: 2,
|
|
147
|
-
minDecimals: 3,
|
|
148
|
-
})).toBe("1.234");
|
|
149
|
-
expect(bigIntToHumanReadableFormat({
|
|
150
|
-
amount: 1234000000000000000n,
|
|
151
|
-
decimals: 18,
|
|
152
|
-
desiredDecimals: 3,
|
|
153
|
-
minDecimals: 2,
|
|
154
|
-
})).toBe("1.234");
|
|
155
|
-
expect(bigIntToHumanReadableFormat({
|
|
156
|
-
amount: 1234000000000000000n,
|
|
157
|
-
decimals: 18,
|
|
158
|
-
desiredDecimals: 2,
|
|
159
|
-
minDecimals: 4,
|
|
160
|
-
})).toBe("1.2340");
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
describe("multiplyBigIntWithDecimal", () => {
|
|
164
|
-
it("should multiply bigint by integer", () => {
|
|
165
|
-
expect(multiplyBigIntWithDecimal(10n, 2)).toBe(20n);
|
|
166
|
-
});
|
|
167
|
-
it("should multiply bigint by decimal", () => {
|
|
168
|
-
expect(multiplyBigIntWithDecimal(100n, 0.5)).toBe(50n);
|
|
169
|
-
expect(multiplyBigIntWithDecimal(100n, 1.25)).toBe(125n);
|
|
170
|
-
});
|
|
171
|
-
it("should handle scientific notation", () => {
|
|
172
|
-
expect(multiplyBigIntWithDecimal(100n, 1e-2)).toBe(1n);
|
|
173
|
-
});
|
|
174
|
-
it("should handle zero", () => {
|
|
175
|
-
expect(multiplyBigIntWithDecimal(0n, 1.5)).toBe(0n);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
describe("trimDecimals", () => {
|
|
179
|
-
it("should trim decimals to specified precision", () => {
|
|
180
|
-
expect(trimDecimals("1.23456", 2)).toBe("1.23");
|
|
181
|
-
expect(trimDecimals("1.2", 4)).toBe("1.2");
|
|
182
|
-
expect(trimDecimals("1", 2)).toBe("1");
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
describe("trimBeforeDecimals", () => {
|
|
186
|
-
it("should trim integer part to specified length", () => {
|
|
187
|
-
expect(trimBeforeDecimals("12345.67", 3)).toBe("123.67");
|
|
188
|
-
expect(trimBeforeDecimals("12.34", 5)).toBe("12.34");
|
|
189
|
-
expect(trimBeforeDecimals("123456", 2)).toBe("12.");
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
describe("normalizeDecimalNumber", () => {
|
|
193
|
-
it("should remove invalid characters", () => {
|
|
194
|
-
expect(normalizeDecimalNumber("12a3.4b5")).toBe("123.45");
|
|
195
|
-
});
|
|
196
|
-
it("should prevent multiple dots", () => {
|
|
197
|
-
expect(normalizeDecimalNumber("1.2.3")).toBe("12.3");
|
|
198
|
-
expect(normalizeDecimalNumber("1..1.2")).toBe("11.2");
|
|
199
|
-
});
|
|
200
|
-
it("should allow only digits and one dot", () => {
|
|
201
|
-
expect(normalizeDecimalNumber("abc")).toBe("");
|
|
202
|
-
expect(normalizeDecimalNumber("123")).toBe("123");
|
|
203
|
-
});
|
|
204
|
-
it("should handle leading and trailing spaces", () => {
|
|
205
|
-
expect(normalizeDecimalNumber(" 1.23 ")).toBe("1.23");
|
|
206
|
-
expect(normalizeDecimalNumber(" 1.2.3 ")).toBe("12.3");
|
|
207
|
-
});
|
|
208
|
-
it("should handle empty input", () => {
|
|
209
|
-
expect(normalizeDecimalNumber("")).toBe("");
|
|
210
|
-
expect(normalizeDecimalNumber(" ")).toBe("");
|
|
211
|
-
});
|
|
212
|
-
it("should handle numbers with thousands separator", () => {
|
|
213
|
-
expect(normalizeDecimalNumber("1,234.56")).toBe("1234.56");
|
|
214
|
-
expect(normalizeDecimalNumber("1,234,567.89")).toBe("1234567.89");
|
|
215
|
-
});
|
|
216
|
-
it("should handle scientific notation", () => {
|
|
217
|
-
// This function does not support scientific notation as our input is expected
|
|
218
|
-
// to accept only decimal numbers
|
|
219
|
-
expect(normalizeDecimalNumber("1e3")).toBe("13");
|
|
220
|
-
expect(normalizeDecimalNumber("1.23e2")).toBe("1.232");
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
//# sourceMappingURL=number2.test.js.map
|
|
@@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