@lifi/widget 2.0.0-beta.12 → 2.0.0-beta.13
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/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +2 -2
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/package.json +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/format.d.ts +1 -1
- package/utils/format.js +2 -2
package/utils/format.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const formatTokenAmount: (amount?: string, decimals?: number, decimalPlaces?: number) => string;
|
|
7
7
|
export declare const formatSlippage: (slippage?: string, defaultValue?: string, returnInitial?: boolean) => string;
|
|
8
|
-
export declare const formatInputAmount: (amount: string, decimals?: number, returnInitial?: boolean) => string;
|
|
8
|
+
export declare const formatInputAmount: (amount: string, decimals?: number | null, returnInitial?: boolean) => string;
|
|
9
9
|
export declare const formatTokenPrice: (amount?: string, price?: string) => number;
|
package/utils/format.js
CHANGED
|
@@ -45,7 +45,7 @@ export const formatSlippage = (slippage = '', defaultValue = '', returnInitial =
|
|
|
45
45
|
}
|
|
46
46
|
return parsedSlippage.toString();
|
|
47
47
|
};
|
|
48
|
-
export const formatInputAmount = (amount, decimals =
|
|
48
|
+
export const formatInputAmount = (amount, decimals = null, returnInitial = false) => {
|
|
49
49
|
if (!amount) {
|
|
50
50
|
return amount;
|
|
51
51
|
}
|
|
@@ -64,7 +64,7 @@ export const formatInputAmount = (amount, decimals = 0, returnInitial = false) =
|
|
|
64
64
|
return formattedAmount;
|
|
65
65
|
}
|
|
66
66
|
let [integer, fraction = ''] = formattedAmount.split('.');
|
|
67
|
-
if (fraction.length > decimals) {
|
|
67
|
+
if (decimals !== null && fraction.length > decimals) {
|
|
68
68
|
fraction = fraction.slice(0, decimals);
|
|
69
69
|
}
|
|
70
70
|
integer = integer.replace(/^0+|-/, '');
|