@lifi/widget 2.0.0-beta.1 → 2.0.0-beta.10
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/App.d.ts +4 -3
- package/AppDrawer.d.ts +1 -1
- package/AppDrawer.js +2 -1
- package/AppProvider.js +1 -1
- package/README.md +11 -12
- package/cjs/App.d.ts +4 -3
- package/cjs/AppDrawer.d.ts +1 -1
- package/cjs/AppDrawer.js +2 -1
- package/cjs/AppProvider.js +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -2
- package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
- package/cjs/components/ChainSelect/useChainSelect.js +6 -0
- package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -2
- package/cjs/components/GasMessage/GasMessage.js +1 -6
- package/cjs/components/Header/Header.js +2 -2
- package/cjs/components/Header/Header.style.d.ts +10 -3
- package/cjs/components/Header/Header.style.js +3 -0
- package/cjs/components/Header/NavigationHeader.js +23 -7
- package/cjs/components/Header/NavigationTabs.d.ts +1 -0
- package/cjs/components/Header/NavigationTabs.js +26 -0
- package/cjs/components/Header/NavigationTabs.style.d.ts +34 -0
- package/cjs/components/Header/NavigationTabs.style.js +61 -0
- package/cjs/components/Header/WalletHeader.d.ts +1 -0
- package/cjs/components/Header/WalletHeader.js +16 -9
- package/cjs/components/Header/useHeaderActionStore.js +0 -1
- package/cjs/components/Insurance/Insurance.js +2 -2
- package/cjs/components/Insurance/InsuranceCard.js +34 -12
- package/cjs/components/Insurance/InsuranceCollapsed.js +9 -11
- package/cjs/components/Insurance/index.d.ts +1 -0
- package/cjs/components/Insurance/index.js +1 -0
- package/cjs/components/Insurance/types.d.ts +12 -9
- package/cjs/components/NFT/NFT.js +2 -2
- package/cjs/components/NFT/types.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +2 -3
- package/cjs/components/SelectChainAndToken.js +8 -7
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +6 -3
- package/cjs/components/SendToWallet/SendToWallet.js +2 -2
- package/cjs/components/SmallAvatar.d.ts +1 -1
- package/cjs/components/Step/CircularProgress.d.ts +1 -2
- package/cjs/components/Step/Step.js +15 -5
- package/cjs/components/Step/StepList.d.ts +1 -2
- package/cjs/components/StepActions/StepActions.js +4 -20
- package/cjs/components/SwapButton/SwapButton.js +16 -4
- package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
- package/cjs/components/SwapInput/SwapInput.js +2 -2
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -2
- package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -3
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
- package/cjs/components/Token/Token.js +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +4 -4
- package/cjs/components/TokenList/TokenList.js +9 -4
- package/cjs/components/TokenList/TokenList.style.d.ts +5 -2
- package/cjs/components/TokenList/TokenList.style.js +20 -1
- package/cjs/components/TokenList/TokenListItem.d.ts +1 -1
- package/cjs/components/TokenList/TokenListItem.js +28 -5
- package/cjs/components/TokenList/VirtualizedTokenList.js +3 -3
- package/cjs/components/TokenList/types.d.ts +6 -3
- package/cjs/config/theme.js +15 -3
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +2 -1
- package/cjs/hooks/index.js +2 -1
- package/cjs/hooks/useContentHeight.js +3 -5
- package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
- package/cjs/hooks/useFundsSufficiency.js +2 -2
- package/cjs/hooks/useGasRefuel.d.ts +1 -1
- package/cjs/hooks/useGasRefuel.js +5 -15
- package/cjs/hooks/useGasSufficiency.js +12 -3
- package/cjs/hooks/useInitializer.js +0 -1
- package/cjs/hooks/useProcessMessage.d.ts +2 -1
- package/cjs/hooks/useProcessMessage.js +27 -9
- package/cjs/hooks/useRouteExecution.js +6 -5
- package/cjs/hooks/useSwapOnly.d.ts +1 -0
- package/cjs/hooks/useSwapOnly.js +9 -0
- package/cjs/hooks/useSwapRoutes.d.ts +1 -2
- package/cjs/hooks/useSwapRoutes.js +32 -18
- package/cjs/hooks/useToken.d.ts +1 -1
- package/cjs/hooks/useTokenAddressBalance.d.ts +2 -2
- package/cjs/hooks/useTokenBalance.js +6 -7
- package/cjs/hooks/useTokenBalances.d.ts +5 -5
- package/cjs/hooks/useTokenBalances.js +4 -19
- package/cjs/hooks/useTokenSearch.d.ts +2 -2
- package/cjs/hooks/useTokens.d.ts +2 -2
- package/cjs/i18n/bn.json +8 -0
- package/cjs/i18n/en.json +30 -5
- package/cjs/i18n/fr.json +8 -0
- package/cjs/i18n/id.json +22 -7
- package/cjs/i18n/ko.json +22 -7
- package/cjs/i18n/pt.json +32 -7
- package/cjs/i18n/th.json +21 -6
- package/cjs/i18n/uk.json +43 -18
- package/cjs/i18n/zh.json +23 -8
- package/cjs/icons/InsuraceLogo.d.ts +1 -1
- package/cjs/icons/LiFiFullLogo.d.ts +1 -1
- package/cjs/icons/LiFiLogo.d.ts +1 -1
- package/cjs/icons/LiFiToolLogo.d.ts +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -2
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +3 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -2
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -2
- package/cjs/pages/SettingsPage/LanguageSelect.js +1 -1
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -2
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -2
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +15 -9
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.style.js +2 -2
- package/cjs/pages/SwapPage/SwapPage.js +31 -10
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +7 -12
- package/cjs/pages/SwapPage/utils.d.ts +2 -0
- package/cjs/pages/SwapPage/utils.js +10 -0
- package/cjs/providers/I18nProvider/I18nProvider.js +3 -3
- package/cjs/providers/SDKProvider/SDKProvider.js +2 -0
- package/cjs/providers/SwapFormProvider/FormUpdater.js +3 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +77 -49
- package/cjs/providers/WalletProvider/types.d.ts +3 -5
- package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -1
- package/cjs/stores/StoreProvider.d.ts +2 -2
- package/cjs/stores/StoreProvider.js +3 -2
- package/cjs/stores/routes/RouteExecutionStore.d.ts +1 -1
- package/cjs/stores/routes/RouteExecutionStore.js +0 -1
- package/cjs/stores/settings/index.d.ts +1 -0
- package/cjs/stores/settings/index.js +1 -0
- package/cjs/stores/settings/types.d.ts +11 -0
- package/cjs/stores/settings/useSplitSubvariantStore.d.ts +7 -0
- package/cjs/stores/settings/useSplitSubvariantStore.js +44 -0
- package/cjs/types/events.d.ts +9 -1
- package/cjs/types/events.js +1 -0
- package/cjs/types/token.d.ts +2 -2
- package/cjs/types/widget.d.ts +13 -8
- package/cjs/types/widget.js +4 -2
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +7 -12
- package/cjs/utils/wallet.d.ts +1 -1
- package/cjs/utils/wallet.js +3 -3
- package/components/ChainSelect/ChainSelect.d.ts +1 -2
- package/components/ChainSelect/ChainSelect.style.js +1 -1
- package/components/ChainSelect/useChainSelect.js +7 -1
- package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -2
- package/components/GasMessage/GasMessage.js +2 -7
- package/components/Header/Header.js +3 -3
- package/components/Header/Header.style.d.ts +10 -3
- package/components/Header/Header.style.js +3 -0
- package/components/Header/NavigationHeader.js +23 -7
- package/components/Header/NavigationTabs.d.ts +1 -0
- package/components/Header/NavigationTabs.js +22 -0
- package/components/Header/NavigationTabs.style.d.ts +34 -0
- package/components/Header/NavigationTabs.style.js +58 -0
- package/components/Header/WalletHeader.d.ts +1 -0
- package/components/Header/WalletHeader.js +14 -8
- package/components/Header/useHeaderActionStore.js +0 -1
- package/components/Insurance/Insurance.js +2 -2
- package/components/Insurance/InsuranceCard.js +37 -15
- package/components/Insurance/InsuranceCollapsed.js +9 -11
- package/components/Insurance/index.d.ts +1 -0
- package/components/Insurance/index.js +1 -0
- package/components/Insurance/types.d.ts +12 -9
- package/components/NFT/NFT.js +2 -2
- package/components/NFT/types.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.js +2 -3
- package/components/SelectChainAndToken.js +9 -8
- package/components/SelectTokenButton/SelectTokenButton.js +7 -4
- package/components/SendToWallet/SendToWallet.js +2 -2
- package/components/SmallAvatar.d.ts +1 -1
- package/components/Step/CircularProgress.d.ts +1 -2
- package/components/Step/Step.js +16 -6
- package/components/Step/StepList.d.ts +1 -2
- package/components/StepActions/StepActions.js +4 -20
- package/components/SwapButton/SwapButton.js +16 -4
- package/components/SwapInput/FormPriceHelperText.js +2 -2
- package/components/SwapInput/SwapInput.js +3 -3
- package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -2
- package/components/SwapInput/SwapInputEndAdornment.js +2 -2
- package/components/SwapRouteCard/SwapRouteCard.js +21 -5
- package/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/components/SwapRoutes/SwapRoutes.js +1 -1
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -3
- package/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
- package/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
- package/components/Token/Token.js +1 -1
- package/components/TokenAvatar/TokenAvatar.d.ts +4 -4
- package/components/TokenList/TokenList.js +10 -5
- package/components/TokenList/TokenList.style.d.ts +5 -2
- package/components/TokenList/TokenList.style.js +21 -2
- package/components/TokenList/TokenListItem.d.ts +1 -1
- package/components/TokenList/TokenListItem.js +32 -9
- package/components/TokenList/VirtualizedTokenList.js +3 -3
- package/components/TokenList/types.d.ts +6 -3
- package/config/theme.js +15 -3
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +2 -1
- package/hooks/useContentHeight.js +4 -6
- package/hooks/useFeaturedTokens.d.ts +1 -1
- package/hooks/useFundsSufficiency.js +2 -2
- package/hooks/useGasRefuel.d.ts +1 -1
- package/hooks/useGasRefuel.js +5 -15
- package/hooks/useGasSufficiency.js +13 -4
- package/hooks/useInitializer.js +0 -1
- package/hooks/useProcessMessage.d.ts +2 -1
- package/hooks/useProcessMessage.js +27 -9
- package/hooks/useRouteExecution.js +6 -5
- package/hooks/useSwapOnly.d.ts +1 -0
- package/hooks/useSwapOnly.js +5 -0
- package/hooks/useSwapRoutes.d.ts +1 -2
- package/hooks/useSwapRoutes.js +32 -18
- package/hooks/useToken.d.ts +1 -1
- package/hooks/useTokenAddressBalance.d.ts +2 -2
- package/hooks/useTokenBalance.js +6 -7
- package/hooks/useTokenBalances.d.ts +5 -5
- package/hooks/useTokenBalances.js +4 -19
- package/hooks/useTokenSearch.d.ts +2 -2
- package/hooks/useTokens.d.ts +2 -2
- package/i18n/bn.json +8 -0
- package/i18n/en.json +30 -5
- package/i18n/fr.json +8 -0
- package/i18n/id.json +22 -7
- package/i18n/ko.json +22 -7
- package/i18n/pt.json +32 -7
- package/i18n/th.json +21 -6
- package/i18n/uk.json +43 -18
- package/i18n/zh.json +23 -8
- package/icons/InsuraceLogo.d.ts +1 -1
- package/icons/LiFiFullLogo.d.ts +1 -1
- package/icons/LiFiLogo.d.ts +1 -1
- package/icons/LiFiToolLogo.d.ts +1 -1
- package/index.d.ts +1 -1
- package/package.json +13 -13
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -2
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
- package/pages/SelectTokenPage/SelectTokenPage.js +4 -2
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -2
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -2
- package/pages/SettingsPage/LanguageSelect.js +1 -1
- package/pages/SettingsPage/SettingsPage.d.ts +1 -2
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
- package/pages/SettingsPage/SlippageInput.d.ts +1 -2
- package/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
- package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/pages/SwapPage/StatusBottomSheet.js +18 -12
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
- package/pages/SwapPage/StatusBottomSheet.style.js +1 -1
- package/pages/SwapPage/SwapPage.js +33 -12
- package/pages/SwapPage/TokenValueBottomSheet.js +8 -13
- package/pages/SwapPage/utils.d.ts +2 -0
- package/pages/SwapPage/utils.js +6 -0
- package/providers/I18nProvider/I18nProvider.js +3 -3
- package/providers/SDKProvider/SDKProvider.js +2 -0
- package/providers/SwapFormProvider/FormUpdater.js +3 -0
- package/providers/WalletProvider/WalletProvider.js +78 -50
- package/providers/WalletProvider/types.d.ts +3 -5
- package/providers/WidgetProvider/WidgetProvider.js +2 -2
- package/stores/StoreProvider.d.ts +2 -2
- package/stores/StoreProvider.js +3 -2
- package/stores/routes/RouteExecutionStore.d.ts +1 -1
- package/stores/routes/RouteExecutionStore.js +0 -1
- package/stores/settings/index.d.ts +1 -0
- package/stores/settings/index.js +1 -0
- package/stores/settings/types.d.ts +11 -0
- package/stores/settings/useSplitSubvariantStore.d.ts +7 -0
- package/stores/settings/useSplitSubvariantStore.js +37 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +9 -1
- package/types/events.js +1 -0
- package/types/token.d.ts +2 -2
- package/types/widget.d.ts +13 -8
- package/types/widget.js +4 -2
- package/utils/format.d.ts +1 -1
- package/utils/format.js +5 -10
- package/utils/wallet.d.ts +1 -1
- package/utils/wallet.js +1 -1
package/types/events.d.ts
CHANGED
|
@@ -3,13 +3,21 @@ export declare enum WidgetEvent {
|
|
|
3
3
|
RouteExecutionStarted = "routeExecutionStarted",
|
|
4
4
|
RouteExecutionUpdated = "routeExecutionUpdated",
|
|
5
5
|
RouteExecutionCompleted = "routeExecutionCompleted",
|
|
6
|
-
RouteExecutionFailed = "routeExecutionFailed"
|
|
6
|
+
RouteExecutionFailed = "routeExecutionFailed",
|
|
7
|
+
RouteHighValueLoss = "routeHighValueLoss"
|
|
8
|
+
}
|
|
9
|
+
export interface RouteHighValueLossUpdate {
|
|
10
|
+
fromAmountUsd: string;
|
|
11
|
+
gasCostUSD: string | undefined;
|
|
12
|
+
toAmountUSD: string;
|
|
13
|
+
valueLoss: string;
|
|
7
14
|
}
|
|
8
15
|
export type WidgetEvents = {
|
|
9
16
|
routeExecutionStarted: Route;
|
|
10
17
|
routeExecutionUpdated: RouteExecutionUpdate;
|
|
11
18
|
routeExecutionCompleted: Route;
|
|
12
19
|
routeExecutionFailed: RouteExecutionUpdate;
|
|
20
|
+
routeHighValueLoss: RouteHighValueLossUpdate;
|
|
13
21
|
};
|
|
14
22
|
export interface RouteExecutionUpdate {
|
|
15
23
|
route: Route;
|
package/types/events.js
CHANGED
|
@@ -4,4 +4,5 @@ export var WidgetEvent;
|
|
|
4
4
|
WidgetEvent["RouteExecutionUpdated"] = "routeExecutionUpdated";
|
|
5
5
|
WidgetEvent["RouteExecutionCompleted"] = "routeExecutionCompleted";
|
|
6
6
|
WidgetEvent["RouteExecutionFailed"] = "routeExecutionFailed";
|
|
7
|
+
WidgetEvent["RouteHighValueLoss"] = "routeHighValueLoss";
|
|
7
8
|
})(WidgetEvent || (WidgetEvent = {}));
|
package/types/token.d.ts
CHANGED
package/types/widget.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Signer } from '@ethersproject/abstract-signer';
|
|
2
|
-
import type { ChainKey, ConfigUpdate, Order, RouteOptions,
|
|
2
|
+
import type { BaseToken, ChainKey, ConfigUpdate, Order, RouteOptions, StaticToken } from '@lifi/sdk';
|
|
3
3
|
import type { Components, PaletteMode, PaletteOptions, Shape, Theme } from '@mui/material';
|
|
4
4
|
import type { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
5
5
|
import type { CSSProperties, ReactNode, RefObject } from 'react';
|
|
6
6
|
import type { LanguageKey, LanguageResources } from '../providers';
|
|
7
7
|
export type WidgetVariant = 'default' | 'expandable' | 'drawer' | 'refuel' | 'nft';
|
|
8
|
+
export type WidgetSubvariant = 'default' | 'split';
|
|
8
9
|
export declare enum DisabledUI {
|
|
9
10
|
FromAmount = "fromAmount",
|
|
10
11
|
FromToken = "fromToken",
|
|
@@ -14,9 +15,13 @@ export declare enum DisabledUI {
|
|
|
14
15
|
export type DisabledUIType = `${DisabledUI}`;
|
|
15
16
|
export declare enum HiddenUI {
|
|
16
17
|
Appearance = "appearance",
|
|
18
|
+
DrawerButton = "drawerButton",
|
|
19
|
+
History = "history",
|
|
17
20
|
Language = "language",
|
|
18
21
|
PoweredBy = "poweredBy",
|
|
19
|
-
ToAddress = "toAddress"
|
|
22
|
+
ToAddress = "toAddress",
|
|
23
|
+
ToToken = "toToken",
|
|
24
|
+
WalletMenu = "walletMenu"
|
|
20
25
|
}
|
|
21
26
|
export type HiddenUIType = `${HiddenUI}`;
|
|
22
27
|
export declare enum RequiredUI {
|
|
@@ -34,7 +39,7 @@ export interface WidgetWalletManagement {
|
|
|
34
39
|
connect(): Promise<Signer>;
|
|
35
40
|
disconnect(): Promise<void>;
|
|
36
41
|
switchChain?(chainId: number): Promise<Signer>;
|
|
37
|
-
addToken?(token:
|
|
42
|
+
addToken?(token: StaticToken, chainId: number): Promise<void>;
|
|
38
43
|
addChain?(chainId: number): Promise<boolean>;
|
|
39
44
|
signer?: Signer;
|
|
40
45
|
}
|
|
@@ -72,10 +77,10 @@ export interface WidgetConfig {
|
|
|
72
77
|
slippage?: number;
|
|
73
78
|
insurance?: boolean;
|
|
74
79
|
variant?: WidgetVariant;
|
|
80
|
+
subvariant?: WidgetSubvariant;
|
|
75
81
|
appearance?: Appearance;
|
|
76
82
|
theme?: ThemeConfig;
|
|
77
83
|
containerStyle?: CSSProperties;
|
|
78
|
-
disableTelemetry?: boolean;
|
|
79
84
|
disabledUI?: DisabledUIType[];
|
|
80
85
|
hiddenUI?: HiddenUIType[];
|
|
81
86
|
requiredUI?: RequiredUIType[];
|
|
@@ -97,9 +102,9 @@ export interface WidgetConfig {
|
|
|
97
102
|
deny?: number[];
|
|
98
103
|
};
|
|
99
104
|
tokens?: {
|
|
100
|
-
featured?:
|
|
101
|
-
allow?:
|
|
102
|
-
deny?:
|
|
105
|
+
featured?: StaticToken[];
|
|
106
|
+
allow?: BaseToken[];
|
|
107
|
+
deny?: BaseToken[];
|
|
103
108
|
};
|
|
104
109
|
languages?: {
|
|
105
110
|
default?: LanguageKey;
|
|
@@ -107,7 +112,7 @@ export interface WidgetConfig {
|
|
|
107
112
|
deny?: LanguageKey[];
|
|
108
113
|
};
|
|
109
114
|
languageResources?: LanguageResources;
|
|
110
|
-
|
|
115
|
+
disableLanguageDetector?: boolean;
|
|
111
116
|
}
|
|
112
117
|
export type WidgetDrawerProps = {
|
|
113
118
|
elementRef?: RefObject<HTMLDivElement>;
|
package/types/widget.js
CHANGED
|
@@ -8,11 +8,13 @@ export var DisabledUI;
|
|
|
8
8
|
export var HiddenUI;
|
|
9
9
|
(function (HiddenUI) {
|
|
10
10
|
HiddenUI["Appearance"] = "appearance";
|
|
11
|
-
|
|
11
|
+
HiddenUI["DrawerButton"] = "drawerButton";
|
|
12
|
+
HiddenUI["History"] = "history";
|
|
12
13
|
HiddenUI["Language"] = "language";
|
|
13
14
|
HiddenUI["PoweredBy"] = "poweredBy";
|
|
14
15
|
HiddenUI["ToAddress"] = "toAddress";
|
|
15
|
-
|
|
16
|
+
HiddenUI["ToToken"] = "toToken";
|
|
17
|
+
HiddenUI["WalletMenu"] = "walletMenu";
|
|
16
18
|
})(HiddenUI || (HiddenUI = {}));
|
|
17
19
|
export var RequiredUI;
|
|
18
20
|
(function (RequiredUI) {
|
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
|
|
8
|
+
export declare const formatInputAmount: (amount: string, returnInitial?: boolean) => string;
|
|
9
9
|
export declare const formatTokenPrice: (amount?: string, price?: string) => number;
|
package/utils/format.js
CHANGED
|
@@ -21,7 +21,7 @@ export const formatTokenAmount = (amount = '0', decimals = 0, decimalPlaces = 3)
|
|
|
21
21
|
while (absAmount < 1 / 10 ** decimalPlaces) {
|
|
22
22
|
decimalPlaces++;
|
|
23
23
|
}
|
|
24
|
-
return Big(
|
|
24
|
+
return Big(parsedAmount).toFixed(decimalPlaces + 1, 0);
|
|
25
25
|
};
|
|
26
26
|
export const formatSlippage = (slippage = '', defaultValue = '', returnInitial = false) => {
|
|
27
27
|
if (!slippage) {
|
|
@@ -45,7 +45,7 @@ export const formatSlippage = (slippage = '', defaultValue = '', returnInitial =
|
|
|
45
45
|
}
|
|
46
46
|
return parsedSlippage.toString();
|
|
47
47
|
};
|
|
48
|
-
export const
|
|
48
|
+
export const formatInputAmount = (amount, returnInitial = false) => {
|
|
49
49
|
if (!amount) {
|
|
50
50
|
return amount;
|
|
51
51
|
}
|
|
@@ -57,21 +57,16 @@ export const formatAmount = (amount = '', returnInitial = false) => {
|
|
|
57
57
|
if (isNaN(Number(formattedAmount)) && !isNaN(parsedAmount)) {
|
|
58
58
|
return parsedAmount.toString();
|
|
59
59
|
}
|
|
60
|
-
if (isNaN(parsedAmount)) {
|
|
61
|
-
return '';
|
|
62
|
-
}
|
|
63
|
-
if (parsedAmount < 0) {
|
|
64
|
-
return Math.abs(parsedAmount).toString();
|
|
65
|
-
}
|
|
66
60
|
try {
|
|
67
|
-
|
|
61
|
+
const absFormattedAmount = Big(formattedAmount).abs();
|
|
62
|
+
if (returnInitial) {
|
|
68
63
|
return formattedAmount;
|
|
69
64
|
}
|
|
65
|
+
return absFormattedAmount.toString();
|
|
70
66
|
}
|
|
71
67
|
catch {
|
|
72
68
|
return '';
|
|
73
69
|
}
|
|
74
|
-
return Big(parsedAmount).toString();
|
|
75
70
|
};
|
|
76
71
|
export const formatTokenPrice = (amount, price) => {
|
|
77
72
|
if (!amount || !price) {
|
package/utils/wallet.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const shortenAddress: (address?: string) => string | null;
|
package/utils/wallet.js
CHANGED