@lifi/widget 1.29.6 → 1.30.0
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/components/Card/CardTitle.d.ts +3 -1
- package/cjs/components/Card/CardTitle.js +7 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/Header/WalletHeader.js +2 -2
- package/cjs/components/SendToWallet/SendToWallet.js +18 -10
- package/cjs/components/SendToWallet/SendToWalletButton.js +3 -2
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/Step/StepList.d.ts +1 -0
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/i18n/en.json +1 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/MainPage/MainSwapButton.js +1 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +5 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +6 -3
- package/cjs/types/widget.d.ts +5 -0
- package/cjs/types/widget.js +5 -1
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +1 -2
- package/components/Card/CardTitle.d.ts +3 -1
- package/components/Card/CardTitle.js +7 -1
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/Header/WalletHeader.js +2 -2
- package/components/SendToWallet/SendToWallet.js +18 -10
- package/components/SendToWallet/SendToWalletButton.js +3 -2
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/Step/StepList.d.ts +1 -0
- package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -0
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/i18n/en.json +1 -0
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/MainPage/MainSwapButton.js +1 -1
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/providers/SwapFormProvider/FormUpdater.js +2 -0
- package/providers/SwapFormProvider/SwapFormProvider.d.ts +5 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +6 -3
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +5 -0
- package/types/widget.js +4 -0
- package/utils/format.d.ts +1 -1
- package/utils/format.js +1 -2
package/types/widget.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export declare enum HiddenUI {
|
|
|
19
19
|
ToAddress = "toAddress"
|
|
20
20
|
}
|
|
21
21
|
export type HiddenUIType = `${HiddenUI}`;
|
|
22
|
+
export declare enum RequiredUI {
|
|
23
|
+
ToAddress = "toAddress"
|
|
24
|
+
}
|
|
25
|
+
export type RequiredUIType = `${RequiredUI}`;
|
|
22
26
|
export type Appearance = PaletteMode | 'auto';
|
|
23
27
|
export type ThemeConfig = {
|
|
24
28
|
palette?: Pick<PaletteOptions, 'background' | 'grey' | 'primary' | 'secondary' | 'text'>;
|
|
@@ -73,6 +77,7 @@ export interface WidgetConfig {
|
|
|
73
77
|
disableTelemetry?: boolean;
|
|
74
78
|
disabledUI?: DisabledUIType[];
|
|
75
79
|
hiddenUI?: HiddenUIType[];
|
|
80
|
+
requiredUI?: RequiredUIType[];
|
|
76
81
|
useRecommendedRoute?: boolean;
|
|
77
82
|
walletManagement?: WidgetWalletManagement;
|
|
78
83
|
sdkConfig?: SDKConfig;
|
package/types/widget.js
CHANGED
package/utils/format.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param amount amount to format.
|
|
4
4
|
* @returns formatted amount.
|
|
5
5
|
*/
|
|
6
|
-
export declare const formatTokenAmount: (amount?: string, decimals?: number) => string;
|
|
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
8
|
export declare const formatAmount: (amount?: string, returnInitial?: boolean) => string;
|
|
9
9
|
export declare const formatTokenPrice: (amount?: string, price?: string) => number;
|
package/utils/format.js
CHANGED
|
@@ -8,7 +8,7 @@ Big.NE = -42;
|
|
|
8
8
|
* @param amount amount to format.
|
|
9
9
|
* @returns formatted amount.
|
|
10
10
|
*/
|
|
11
|
-
export const formatTokenAmount = (amount = '0', decimals = 0) => {
|
|
11
|
+
export const formatTokenAmount = (amount = '0', decimals = 0, decimalPlaces = 3) => {
|
|
12
12
|
let shiftedAmount = amount;
|
|
13
13
|
if (decimals) {
|
|
14
14
|
shiftedAmount = (Number(amount) / Math.pow(10, decimals)).toString();
|
|
@@ -17,7 +17,6 @@ export const formatTokenAmount = (amount = '0', decimals = 0) => {
|
|
|
17
17
|
if (parsedAmount === 0 || isNaN(Number(shiftedAmount))) {
|
|
18
18
|
return '0';
|
|
19
19
|
}
|
|
20
|
-
let decimalPlaces = 3;
|
|
21
20
|
const absAmount = Math.abs(parsedAmount);
|
|
22
21
|
while (absAmount < 1 / Math.pow(10, decimalPlaces)) {
|
|
23
22
|
decimalPlaces++;
|