@lifi/widget 3.0.0-alpha.33 → 3.0.0-alpha.35
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.tsx +6 -3
- package/AppDefault.tsx +3 -3
- package/AppDrawer.tsx +3 -5
- package/_esm/App.js +6 -3
- package/_esm/App.js.map +1 -1
- package/_esm/AppDefault.js +3 -3
- package/_esm/AppDefault.js.map +1 -1
- package/_esm/AppDrawer.js +3 -3
- package/_esm/AppDrawer.js.map +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.d.ts +2 -2
- package/_esm/components/ActiveTransactions/ActiveTransactions.js +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.js.map +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +1 -1
- package/_esm/components/AmountInput/AmountInput.d.ts +3 -3
- package/_esm/components/AmountInput/AmountInput.js +2 -2
- package/_esm/components/AmountInput/AmountInput.js.map +1 -1
- package/_esm/components/AppContainer.js +3 -2
- package/_esm/components/AppContainer.js.map +1 -1
- package/_esm/components/Avatar/AccountAvatar.d.ts +3 -1
- package/_esm/components/Avatar/AccountAvatar.js +3 -3
- package/_esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/_esm/components/Avatar/utils.d.ts +1 -1
- package/_esm/components/Avatar/utils.js +1 -1
- package/_esm/components/Avatar/utils.js.map +1 -1
- package/_esm/components/Card/Card.d.ts +7 -19
- package/_esm/components/Card/Card.js +36 -42
- package/_esm/components/Card/Card.js.map +1 -1
- package/_esm/components/Card/CardLabel.js +5 -3
- package/_esm/components/Card/CardLabel.js.map +1 -1
- package/_esm/components/Card/InputCard.d.ts +4 -0
- package/_esm/components/Card/InputCard.js +7 -0
- package/_esm/components/Card/InputCard.js.map +1 -0
- package/_esm/components/ChainSelect/ChainSelect.js +1 -1
- package/_esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/_esm/components/ChainSelect/ChainSelect.style.d.ts +2 -10
- package/_esm/components/ContractComponent/ContractComponent.d.ts +2 -2
- package/_esm/components/ContractComponent/ContractComponent.js.map +1 -1
- package/_esm/components/ContractComponent/ItemPrice.d.ts +8 -0
- package/_esm/components/ContractComponent/ItemPrice.js +23 -0
- package/_esm/components/ContractComponent/ItemPrice.js.map +1 -0
- package/_esm/components/{NFT → ContractComponent/NFT}/NFT.js +5 -11
- package/_esm/components/ContractComponent/NFT/NFT.js.map +1 -0
- package/_esm/components/ContractComponent/NFT/NFT.style.js.map +1 -0
- package/_esm/components/{NFT → ContractComponent/NFT}/NFTBase.js +1 -1
- package/_esm/components/ContractComponent/NFT/NFTBase.js.map +1 -0
- package/_esm/components/{NFT → ContractComponent/NFT}/types.d.ts +2 -3
- package/_esm/components/ContractComponent/NFT/types.js.map +1 -0
- package/_esm/components/Dialog.d.ts +2 -9
- package/_esm/components/Dialog.js +1 -0
- package/_esm/components/Dialog.js.map +1 -1
- package/_esm/components/Header/BackButton.d.ts +3 -0
- package/_esm/components/Header/BackButton.js +8 -0
- package/_esm/components/Header/BackButton.js.map +1 -0
- package/_esm/components/Header/CloseDrawerButton.d.ts +5 -1
- package/_esm/components/Header/CloseDrawerButton.js +8 -2
- package/_esm/components/Header/CloseDrawerButton.js.map +1 -1
- package/_esm/components/Header/Header.style.d.ts +4 -1
- package/_esm/components/Header/Header.style.js +24 -16
- package/_esm/components/Header/Header.style.js.map +1 -1
- package/_esm/components/Header/NavigationHeader.js +8 -9
- package/_esm/components/Header/NavigationHeader.js.map +1 -1
- package/_esm/components/Header/NavigationTabs.js +1 -1
- package/_esm/components/Header/NavigationTabs.js.map +1 -1
- package/_esm/components/Header/SettingsButton.style.d.ts +1 -1
- package/_esm/components/Header/TransactionHistoryButton.js +1 -1
- package/_esm/components/Header/TransactionHistoryButton.js.map +1 -1
- package/_esm/components/Header/WalletHeader.js +4 -11
- package/_esm/components/Header/WalletHeader.js.map +1 -1
- package/_esm/components/Header/WalletMenu.js +2 -2
- package/_esm/components/Header/WalletMenu.js.map +1 -1
- package/_esm/components/Insurance/types.d.ts +3 -3
- package/_esm/components/ListItem/ListItem.d.ts +1 -1
- package/_esm/components/PageContainer.d.ts +2 -1
- package/_esm/components/PageContainer.js +3 -3
- package/_esm/components/PageContainer.js.map +1 -1
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.js +2 -2
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +9 -3
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.js +24 -14
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.js.map +1 -1
- package/_esm/components/RouteCard/RouteCard.js +2 -2
- package/_esm/components/RouteCard/RouteCard.js.map +1 -1
- package/_esm/components/RouteCard/RouteCardSkeleton.d.ts +2 -2
- package/_esm/components/RouteCard/RouteCardSkeleton.js +1 -1
- package/_esm/components/RouteCard/RouteCardSkeleton.js.map +1 -1
- package/_esm/components/Routes/Routes.d.ts +2 -2
- package/_esm/components/Routes/Routes.js +1 -1
- package/_esm/components/Routes/Routes.js.map +1 -1
- package/_esm/components/Routes/RoutesExpanded.js +9 -3
- package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/_esm/components/Routes/RoutesExpanded.style.js +1 -0
- package/_esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/_esm/components/SelectChainAndToken.js +3 -6
- package/_esm/components/SelectChainAndToken.js.map +1 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.js +9 -10
- package/_esm/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +10 -0
- package/_esm/components/SelectTokenButton/SelectTokenButton.style.js +41 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/_esm/components/SendToWallet/SendToWalletButton.d.ts +2 -2
- package/_esm/components/SendToWallet/SendToWalletButton.js +2 -2
- package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/_esm/components/Step/Step.js +8 -8
- package/_esm/components/Step/Step.js.map +1 -1
- package/_esm/components/Step/StepList.js +1 -1
- package/_esm/components/Step/StepList.js.map +1 -1
- package/_esm/components/StepActions/StepActions.d.ts +4 -9
- package/_esm/components/StepActions/StepActions.js +13 -12
- package/_esm/components/StepActions/StepActions.js.map +1 -1
- package/_esm/components/StepActions/types.d.ts +8 -2
- package/_esm/components/TokenList/TokenList.js +4 -1
- package/_esm/components/TokenList/TokenList.js.map +1 -1
- package/_esm/components/TokenList/TokenList.style.d.ts +1 -1
- package/_esm/components/TokenList/TokenList.style.js +1 -1
- package/_esm/components/TokenList/TokenList.style.js.map +1 -1
- package/_esm/components/TokenList/VirtualizedTokenList.js +19 -18
- package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/_esm/components/TokenList/useTokenSelect.js +1 -1
- package/_esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/_esm/components/TokenList/utils.d.ts +2 -0
- package/_esm/components/TokenList/utils.js +35 -0
- package/_esm/components/TokenList/utils.js.map +1 -0
- package/_esm/config/version.d.ts +1 -1
- package/_esm/config/version.js +1 -1
- package/_esm/hooks/useAddressValidation.d.ts +1 -1
- package/_esm/hooks/useGasRecommendation.d.ts +1 -1
- package/_esm/hooks/useProcessMessage.d.ts +2 -2
- package/_esm/hooks/useProcessMessage.js +16 -12
- package/_esm/hooks/useProcessMessage.js.map +1 -1
- package/_esm/hooks/useRoutes.d.ts +2 -2
- package/_esm/hooks/useRoutes.js +11 -20
- package/_esm/hooks/useRoutes.js.map +1 -1
- package/_esm/hooks/useTokenAddressBalance.d.ts +1 -1
- package/_esm/hooks/useTokenBalance.d.ts +1 -1
- package/_esm/hooks/useTokenBalances.d.ts +1 -1
- package/_esm/hooks/useWideVariant.d.ts +1 -0
- package/_esm/hooks/{useExpandableVariant.js → useWideVariant.js} +3 -3
- package/_esm/hooks/useWideVariant.js.map +1 -0
- package/_esm/i18n/en.json +9 -5
- package/_esm/i18n/index.js +14 -14
- package/_esm/i18n/index.js.map +1 -1
- package/_esm/index.d.ts +6 -3
- package/_esm/index.js +6 -3
- package/_esm/index.js.map +1 -1
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +9 -2
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js.map +1 -1
- package/_esm/pages/LanguagesPage.js +1 -0
- package/_esm/pages/LanguagesPage.js.map +1 -1
- package/_esm/pages/MainPage/MainPage.js +4 -4
- package/_esm/pages/MainPage/MainPage.js.map +1 -1
- package/_esm/pages/MainPage/ReviewButton.js +2 -2
- package/_esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js +1 -8
- package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.style.js +1 -1
- package/_esm/pages/SelectChainPage/SelectChainPage.js +1 -0
- package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/_esm/pages/SelectEnabledToolsPage.js +4 -2
- package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/_esm/pages/SelectNativeTokenPage.js +1 -0
- package/_esm/pages/SelectNativeTokenPage.js.map +1 -1
- package/_esm/pages/SelectTokenPage/SearchTokenInput.js +2 -2
- package/_esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js +1 -1
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js +1 -0
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/BookmarkAddressSheet.js +1 -1
- package/_esm/pages/SendToWallet/BookmarkAddressSheet.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js +1 -1
- package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js +3 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.style.d.ts +2 -10
- package/_esm/pages/SendToWallet/SendToWalletPage.style.js +3 -2
- package/_esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
- package/_esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
- package/_esm/pages/SettingsPage/SettingsPage.js +1 -1
- package/_esm/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +3 -3
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js +1 -1
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js.map +1 -1
- package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js +6 -3
- package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
- package/_esm/pages/TransactionPage/StatusBottomSheet.d.ts +5 -0
- package/_esm/pages/TransactionPage/StatusBottomSheet.js +33 -21
- package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/_esm/pages/TransactionPage/TransactionPage.js +7 -7
- package/_esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/_esm/providers/ThemeProvider/ThemeProvider.js +1 -1
- package/_esm/providers/ThemeProvider/ThemeProvider.js.map +1 -1
- package/_esm/stores/StoreProvider.js +1 -1
- package/_esm/stores/StoreProvider.js.map +1 -1
- package/_esm/stores/form/createFormStore.js +1 -6
- package/_esm/stores/form/createFormStore.js.map +1 -1
- package/_esm/stores/form/types.d.ts +4 -6
- package/_esm/stores/form/types.js.map +1 -1
- package/_esm/stores/form/useFieldController.d.ts +1 -1
- package/_esm/stores/form/useFieldValues.js +1 -1
- package/_esm/stores/form/useFieldValues.js.map +1 -1
- package/_esm/stores/form/useTouchedFields.d.ts +1 -4
- package/_esm/stores/settings/types.d.ts +4 -4
- package/_esm/stores/settings/useSettings.d.ts +1 -1
- package/_esm/themes/createTheme.d.ts +3 -0
- package/_esm/themes/createTheme.js +356 -0
- package/_esm/themes/createTheme.js.map +1 -0
- package/_esm/themes/jumper.d.ts +2 -0
- package/_esm/themes/jumper.js +36 -0
- package/_esm/themes/jumper.js.map +1 -0
- package/_esm/themes/types.d.ts +49 -0
- package/_esm/themes/types.js +2 -0
- package/_esm/{components/NFT → themes}/types.js.map +1 -1
- package/_esm/themes/utils.d.ts +4 -0
- package/_esm/themes/utils.js +9 -0
- package/_esm/themes/utils.js.map +1 -0
- package/_esm/themes/windows95.d.ts +2 -0
- package/_esm/themes/windows95.js +92 -0
- package/_esm/themes/windows95.js.map +1 -0
- package/_esm/types/events.d.ts +3 -1
- package/_esm/types/events.js +1 -0
- package/_esm/types/events.js.map +1 -1
- package/_esm/types/widget.d.ts +40 -27
- package/_esm/types/widget.js.map +1 -1
- package/_esm/utils/item.d.ts +1 -1
- package/components/ActiveTransactions/ActiveTransactions.tsx +3 -3
- package/components/AmountInput/AmountInput.tsx +6 -6
- package/components/AppContainer.tsx +2 -2
- package/components/Avatar/AccountAvatar.tsx +21 -17
- package/components/Avatar/utils.ts +1 -1
- package/components/Card/Card.tsx +45 -74
- package/components/Card/CardLabel.tsx +15 -3
- package/components/Card/InputCard.tsx +7 -0
- package/components/ChainSelect/ChainSelect.tsx +6 -2
- package/components/ContractComponent/ContractComponent.tsx +2 -2
- package/components/ContractComponent/ItemPrice.tsx +33 -0
- package/components/{NFT → ContractComponent/NFT}/NFT.tsx +5 -11
- package/components/{NFT → ContractComponent/NFT}/NFTBase.tsx +1 -1
- package/components/{NFT → ContractComponent/NFT}/types.ts +2 -3
- package/components/Dialog.tsx +3 -2
- package/components/Header/BackButton.tsx +17 -0
- package/components/Header/CloseDrawerButton.tsx +16 -3
- package/components/Header/Header.style.ts +25 -16
- package/components/Header/NavigationHeader.tsx +8 -11
- package/components/Header/NavigationTabs.tsx +1 -1
- package/components/Header/TransactionHistoryButton.tsx +0 -1
- package/components/Header/WalletHeader.tsx +5 -12
- package/components/Header/WalletMenu.tsx +2 -2
- package/components/Insurance/types.ts +3 -3
- package/components/PageContainer.ts +6 -5
- package/components/ReverseTokensButton/ReverseTokensButton.style.tsx +26 -21
- package/components/ReverseTokensButton/ReverseTokensButton.tsx +10 -8
- package/components/RouteCard/RouteCard.tsx +2 -2
- package/components/RouteCard/RouteCardSkeleton.tsx +5 -6
- package/components/Routes/Routes.tsx +3 -3
- package/components/Routes/RoutesExpanded.style.ts +1 -0
- package/components/Routes/RoutesExpanded.tsx +11 -4
- package/components/SelectChainAndToken.tsx +7 -13
- package/components/SelectTokenButton/SelectTokenButton.style.tsx +51 -1
- package/components/SelectTokenButton/SelectTokenButton.tsx +43 -38
- package/components/SendToWallet/SendToWalletButton.tsx +8 -8
- package/components/Step/Step.tsx +8 -8
- package/components/Step/StepList.tsx +1 -1
- package/components/StepActions/StepActions.tsx +40 -21
- package/components/StepActions/types.ts +12 -2
- package/components/TokenList/TokenList.style.tsx +1 -1
- package/components/TokenList/TokenList.tsx +9 -6
- package/components/TokenList/VirtualizedTokenList.tsx +26 -20
- package/components/TokenList/useTokenSelect.ts +1 -1
- package/components/TokenList/utils.ts +42 -0
- package/config/version.ts +1 -1
- package/hooks/useProcessMessage.ts +38 -15
- package/hooks/useRoutes.ts +13 -30
- package/hooks/{useExpandableVariant.ts → useWideVariant.ts} +2 -2
- package/i18n/en.json +9 -5
- package/i18n/index.ts +14 -14
- package/index.ts +6 -3
- package/package.json +15 -15
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.tsx +20 -5
- package/pages/LanguagesPage.tsx +1 -0
- package/pages/MainPage/MainPage.tsx +12 -10
- package/pages/MainPage/ReviewButton.tsx +2 -2
- package/pages/RoutesPage/RoutesPage.style.ts +1 -1
- package/pages/RoutesPage/RoutesPage.tsx +1 -9
- package/pages/SelectChainPage/SelectChainPage.tsx +1 -0
- package/pages/SelectEnabledToolsPage.tsx +8 -1
- package/pages/SelectNativeTokenPage.tsx +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.tsx +3 -3
- package/pages/SelectTokenPage/SelectTokenPage.tsx +1 -1
- package/pages/SelectWalletPage/SelectWalletPage.tsx +1 -0
- package/pages/SendToWallet/BookmarkAddressSheet.tsx +2 -4
- package/pages/SendToWallet/SendToConfiguredWalletPage.tsx +1 -0
- package/pages/SendToWallet/SendToWalletPage.style.tsx +3 -2
- package/pages/SendToWallet/SendToWalletPage.tsx +7 -2
- package/pages/SettingsPage/SettingsPage.tsx +1 -1
- package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +7 -8
- package/pages/TransactionDetailsPage/TransactionDetailsSkeleton.tsx +1 -1
- package/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +19 -16
- package/pages/TransactionPage/StatusBottomSheet.tsx +101 -78
- package/pages/TransactionPage/TransactionPage.tsx +12 -16
- package/providers/ThemeProvider/ThemeProvider.tsx +1 -1
- package/stores/StoreProvider.tsx +1 -1
- package/stores/form/createFormStore.ts +1 -6
- package/stores/form/types.ts +4 -6
- package/stores/form/useFieldValues.ts +1 -1
- package/stores/settings/types.ts +4 -4
- package/themes/createTheme.ts +416 -0
- package/themes/jumper.ts +37 -0
- package/themes/types.ts +63 -0
- package/themes/utils.ts +18 -0
- package/themes/windows95.ts +98 -0
- package/types/events.ts +2 -0
- package/types/widget.ts +54 -32
- package/_esm/components/NFT/NFT.js.map +0 -1
- package/_esm/components/NFT/NFT.style.js.map +0 -1
- package/_esm/components/NFT/NFTBase.js.map +0 -1
- package/_esm/config/theme.d.ts +0 -27
- package/_esm/config/theme.js +0 -250
- package/_esm/config/theme.js.map +0 -1
- package/_esm/hooks/useExpandableVariant.d.ts +0 -1
- package/_esm/hooks/useExpandableVariant.js.map +0 -1
- package/config/theme.ts +0 -321
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.d.ts +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.style.d.ts +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.style.js +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFTBase.d.ts +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/types.js +0 -0
- /package/components/{NFT → ContractComponent/NFT}/NFT.style.ts +0 -0
|
@@ -11,9 +11,12 @@ import { useFieldValues } from '../../stores/form/useFieldValues.js';
|
|
|
11
11
|
import { navigationRoutes } from '../../utils/navigationRoutes.js';
|
|
12
12
|
import { AvatarBadgedDefault, AvatarBadgedSkeleton } from '../Avatar/Avatar.js';
|
|
13
13
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js';
|
|
14
|
-
import { Card } from '../Card/Card.js';
|
|
15
14
|
import { CardTitle } from '../Card/CardTitle.js';
|
|
16
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
CardContent,
|
|
17
|
+
SelectTokenCard,
|
|
18
|
+
SelectTokenCardHeader,
|
|
19
|
+
} from './SelectTokenButton.style.js';
|
|
17
20
|
|
|
18
21
|
export const SelectTokenButton: React.FC<
|
|
19
22
|
FormTypeProps & {
|
|
@@ -51,44 +54,46 @@ export const SelectTokenButton: React.FC<
|
|
|
51
54
|
? t('main.selectToken')
|
|
52
55
|
: t('main.selectChainAndToken');
|
|
53
56
|
const cardTitle: string =
|
|
54
|
-
formType === 'from' && subvariant === '
|
|
57
|
+
formType === 'from' && subvariant === 'custom'
|
|
55
58
|
? t(`header.payWith`)
|
|
56
59
|
: t(`main.${formType}`);
|
|
57
60
|
return (
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
61
|
+
<SelectTokenCard component="button" onClick={onClick}>
|
|
62
|
+
<CardContent formType={formType} compact={compact}>
|
|
63
|
+
<CardTitle>{cardTitle}</CardTitle>
|
|
64
|
+
{chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (
|
|
65
|
+
<SelectTokenCardHeader
|
|
66
|
+
avatar={<AvatarBadgedSkeleton />}
|
|
67
|
+
title={<Skeleton variant="text" width={64} height={24} />}
|
|
68
|
+
subheader={<Skeleton variant="text" width={72} height={16} />}
|
|
69
|
+
compact={compact}
|
|
70
|
+
/>
|
|
71
|
+
) : (
|
|
72
|
+
<SelectTokenCardHeader
|
|
73
|
+
avatar={
|
|
74
|
+
isSelected ? (
|
|
75
|
+
<TokenAvatar token={token} chain={chain} />
|
|
76
|
+
) : (
|
|
77
|
+
<AvatarBadgedDefault />
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
title={isSelected ? token.symbol : defaultPlaceholder}
|
|
81
|
+
titleTypographyProps={{
|
|
82
|
+
title: isSelected ? token.symbol : defaultPlaceholder,
|
|
83
|
+
}}
|
|
84
|
+
subheader={isSelected ? chain.name : null}
|
|
85
|
+
subheaderTypographyProps={
|
|
86
|
+
isSelected
|
|
87
|
+
? {
|
|
88
|
+
title: chain.name,
|
|
89
|
+
}
|
|
90
|
+
: undefined
|
|
91
|
+
}
|
|
92
|
+
selected={isSelected}
|
|
93
|
+
compact={compact}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
</CardContent>
|
|
97
|
+
</SelectTokenCard>
|
|
93
98
|
);
|
|
94
99
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CloseRounded } from '@mui/icons-material';
|
|
2
|
-
import type { BoxProps } from '@mui/material';
|
|
3
2
|
import { Box, Collapse } from '@mui/material';
|
|
4
3
|
import type { MouseEventHandler } from 'react';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
@@ -20,12 +19,13 @@ import {
|
|
|
20
19
|
import { navigationRoutes } from '../../utils/navigationRoutes.js';
|
|
21
20
|
import { shortenAddress } from '../../utils/wallet.js';
|
|
22
21
|
import { AccountAvatar } from '../Avatar/AccountAvatar.js';
|
|
22
|
+
import type { CardProps } from '../Card/Card.js';
|
|
23
23
|
import { Card } from '../Card/Card.js';
|
|
24
24
|
import { CardIconButton } from '../Card/CardIconButton.js';
|
|
25
25
|
import { CardTitle } from '../Card/CardTitle.js';
|
|
26
26
|
import { SendToWalletCardHeader } from './SendToWallet.style.js';
|
|
27
27
|
|
|
28
|
-
export const SendToWalletButton: React.FC<
|
|
28
|
+
export const SendToWalletButton: React.FC<CardProps> = (props) => {
|
|
29
29
|
const { t } = useTranslation();
|
|
30
30
|
const navigate = useNavigate();
|
|
31
31
|
const { disabledUI, hiddenUI, toAddress, toAddresses } = useWidgetConfig();
|
|
@@ -86,10 +86,10 @@ export const SendToWalletButton: React.FC<BoxProps> = (props) => {
|
|
|
86
86
|
const headerSubheader =
|
|
87
87
|
isConnectedAccount || bookmarkName || connectedAccountName ? address : null;
|
|
88
88
|
|
|
89
|
-
const isSelected = !!toAddressFieldValue && !(toAddress && disabledToAddress);
|
|
90
|
-
|
|
91
89
|
const disabledForChanges = Boolean(toAddress) && disabledToAddress;
|
|
92
90
|
|
|
91
|
+
const isSelected = !!toAddressFieldValue && !disabledForChanges;
|
|
92
|
+
|
|
93
93
|
const handleOnClick = () => {
|
|
94
94
|
navigate(
|
|
95
95
|
toAddresses?.length
|
|
@@ -114,8 +114,7 @@ export const SendToWalletButton: React.FC<BoxProps> = (props) => {
|
|
|
114
114
|
<Card
|
|
115
115
|
component="button"
|
|
116
116
|
onClick={disabledForChanges ? undefined : handleOnClick}
|
|
117
|
-
width
|
|
118
|
-
{...props}
|
|
117
|
+
sx={{ width: '100%', ...props.sx }}
|
|
119
118
|
>
|
|
120
119
|
<CardTitle required={requiredToAddress}>
|
|
121
120
|
{t('header.sendToWallet')}
|
|
@@ -126,14 +125,15 @@ export const SendToWalletButton: React.FC<BoxProps> = (props) => {
|
|
|
126
125
|
<AccountAvatar
|
|
127
126
|
chainId={chainId}
|
|
128
127
|
account={matchingConnectedAccount}
|
|
128
|
+
toAddress={toAddress}
|
|
129
129
|
empty={!toAddressFieldValue}
|
|
130
130
|
/>
|
|
131
131
|
}
|
|
132
132
|
title={headerTitle}
|
|
133
133
|
subheader={headerSubheader}
|
|
134
|
-
selected={isSelected}
|
|
134
|
+
selected={isSelected || disabledForChanges}
|
|
135
135
|
action={
|
|
136
|
-
isSelected
|
|
136
|
+
isSelected ? (
|
|
137
137
|
<CardIconButton onClick={clearSelectedBookmark} size="small">
|
|
138
138
|
<CloseRounded fontSize="inherit" />
|
|
139
139
|
</CardIconButton>
|
package/components/Step/Step.tsx
CHANGED
|
@@ -30,27 +30,27 @@ export const Step: React.FC<{
|
|
|
30
30
|
const getCardTitle = () => {
|
|
31
31
|
switch (step.type) {
|
|
32
32
|
case 'lifi':
|
|
33
|
-
const
|
|
33
|
+
const hasBridgeStep = step.includedSteps.some(
|
|
34
34
|
(step) => step.type === 'cross',
|
|
35
35
|
);
|
|
36
36
|
const hasSwapStep = step.includedSteps.some(
|
|
37
37
|
(step) => step.type === 'swap',
|
|
38
38
|
);
|
|
39
|
-
if (
|
|
40
|
-
return subvariant === '
|
|
39
|
+
if (hasBridgeStep && hasSwapStep) {
|
|
40
|
+
return subvariant === 'custom'
|
|
41
41
|
? t('main.stepBridgeAndBuy')
|
|
42
42
|
: t('main.stepSwapAndBridge');
|
|
43
43
|
}
|
|
44
|
-
if (
|
|
45
|
-
return subvariant === '
|
|
44
|
+
if (hasBridgeStep) {
|
|
45
|
+
return subvariant === 'custom'
|
|
46
46
|
? t('main.stepBridgeAndBuy')
|
|
47
47
|
: t('main.stepBridge');
|
|
48
48
|
}
|
|
49
|
-
return subvariant === '
|
|
49
|
+
return subvariant === 'custom'
|
|
50
50
|
? t('main.stepSwapAndBuy')
|
|
51
51
|
: t('main.stepSwap');
|
|
52
52
|
default:
|
|
53
|
-
return subvariant === '
|
|
53
|
+
return subvariant === 'custom'
|
|
54
54
|
? t('main.stepSwapAndBuy')
|
|
55
55
|
: t('main.stepSwap');
|
|
56
56
|
}
|
|
@@ -64,7 +64,7 @@ export const Step: React.FC<{
|
|
|
64
64
|
: undefined;
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
|
-
<Card
|
|
67
|
+
<Card type={stepHasError ? 'error' : 'default'}>
|
|
68
68
|
<Box
|
|
69
69
|
sx={{
|
|
70
70
|
display: 'flex',
|
|
@@ -20,7 +20,7 @@ export const getStepList = (
|
|
|
20
20
|
...(step.execution?.toToken ?? step.action?.toToken),
|
|
21
21
|
amount: step.execution?.toAmount
|
|
22
22
|
? BigInt(step.execution.toAmount)
|
|
23
|
-
: subvariant === '
|
|
23
|
+
: subvariant === 'custom'
|
|
24
24
|
? BigInt(route.toAmount)
|
|
25
25
|
: BigInt(step.estimate.toAmount),
|
|
26
26
|
}
|
|
@@ -16,7 +16,6 @@ import { formatUnits } from 'viem';
|
|
|
16
16
|
import { useAvailableChains } from '../../hooks/useAvailableChains.js';
|
|
17
17
|
import { LiFiToolLogo } from '../../icons/lifi.js';
|
|
18
18
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
19
|
-
import type { WidgetSubvariant } from '../../types/widget.js';
|
|
20
19
|
import { formatTokenAmount } from '../../utils/format.js';
|
|
21
20
|
import { CardIconButton } from '../Card/CardIconButton.js';
|
|
22
21
|
import { SmallAvatar } from '../SmallAvatar.js';
|
|
@@ -29,7 +28,11 @@ import {
|
|
|
29
28
|
} from './StepActions.style.js';
|
|
30
29
|
import { StepFeeBreakdown } from './StepFeeBreakdown.js';
|
|
31
30
|
import { StepFees } from './StepFees.js';
|
|
32
|
-
import type {
|
|
31
|
+
import type {
|
|
32
|
+
IncludedStepsProps,
|
|
33
|
+
StepActionsProps,
|
|
34
|
+
StepDetailsLabelProps,
|
|
35
|
+
} from './types.js';
|
|
33
36
|
|
|
34
37
|
export const StepActions: React.FC<StepActionsProps> = ({
|
|
35
38
|
step,
|
|
@@ -37,7 +40,7 @@ export const StepActions: React.FC<StepActionsProps> = ({
|
|
|
37
40
|
...other
|
|
38
41
|
}) => {
|
|
39
42
|
const { t } = useTranslation();
|
|
40
|
-
const { subvariant } = useWidgetConfig();
|
|
43
|
+
const { subvariant, subvariantOptions } = useWidgetConfig();
|
|
41
44
|
const [cardExpanded, setCardExpanded] = useState(false);
|
|
42
45
|
|
|
43
46
|
const handleExpand: MouseEventHandler<HTMLButtonElement> = (e) => {
|
|
@@ -47,7 +50,7 @@ export const StepActions: React.FC<StepActionsProps> = ({
|
|
|
47
50
|
|
|
48
51
|
// FIXME: step transaction request overrides step tool details, but not included step tool details
|
|
49
52
|
const toolDetails =
|
|
50
|
-
subvariant === '
|
|
53
|
+
subvariant === 'custom'
|
|
51
54
|
? step.includedSteps.find(
|
|
52
55
|
(step) => step.tool === 'custom' && step.toolDetails.key !== 'custom',
|
|
53
56
|
)?.toolDetails || step.toolDetails
|
|
@@ -70,7 +73,7 @@ export const StepActions: React.FC<StepActionsProps> = ({
|
|
|
70
73
|
</StepAvatar>
|
|
71
74
|
</Badge>
|
|
72
75
|
<Box flex={1}>
|
|
73
|
-
<Typography fontSize={18} fontWeight=
|
|
76
|
+
<Typography fontSize={18} fontWeight={600} lineHeight={1.3334} ml={2}>
|
|
74
77
|
{t(`main.stepDetails`, {
|
|
75
78
|
tool: toolDetails.name,
|
|
76
79
|
})}
|
|
@@ -92,20 +95,29 @@ export const StepActions: React.FC<StepActionsProps> = ({
|
|
|
92
95
|
</Box>
|
|
93
96
|
{dense ? (
|
|
94
97
|
<Collapse timeout={225} in={cardExpanded} mountOnEnter unmountOnExit>
|
|
95
|
-
<IncludedSteps
|
|
98
|
+
<IncludedSteps
|
|
99
|
+
step={step}
|
|
100
|
+
subvariant={subvariant}
|
|
101
|
+
subvariantOptions={subvariantOptions}
|
|
102
|
+
/>
|
|
96
103
|
<StepFeeBreakdown step={step} />
|
|
97
104
|
</Collapse>
|
|
98
105
|
) : (
|
|
99
|
-
<IncludedSteps
|
|
106
|
+
<IncludedSteps
|
|
107
|
+
step={step}
|
|
108
|
+
subvariant={subvariant}
|
|
109
|
+
subvariantOptions={subvariantOptions}
|
|
110
|
+
/>
|
|
100
111
|
)}
|
|
101
112
|
</Box>
|
|
102
113
|
);
|
|
103
114
|
};
|
|
104
115
|
|
|
105
|
-
export const IncludedSteps: React.FC<{
|
|
106
|
-
step
|
|
107
|
-
subvariant
|
|
108
|
-
|
|
116
|
+
export const IncludedSteps: React.FC<IncludedStepsProps> = ({
|
|
117
|
+
step,
|
|
118
|
+
subvariant,
|
|
119
|
+
subvariantOptions,
|
|
120
|
+
}) => {
|
|
109
121
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
110
122
|
const StepIconComponent = ({ icon }: StepIconProps) => {
|
|
111
123
|
const tool = step.includedSteps?.[Number(icon) - 1];
|
|
@@ -129,10 +141,14 @@ export const IncludedSteps: React.FC<{
|
|
|
129
141
|
{step.includedSteps.map((step, i, includedSteps) => (
|
|
130
142
|
<MuiStep key={step.id} expanded>
|
|
131
143
|
<StepLabel StepIconComponent={StepIconComponent}>
|
|
132
|
-
{step.type === 'custom' && subvariant === '
|
|
133
|
-
<CustomStepDetailsLabel
|
|
144
|
+
{step.type === 'custom' && subvariant === 'custom' ? (
|
|
145
|
+
<CustomStepDetailsLabel
|
|
146
|
+
step={step}
|
|
147
|
+
subvariant={subvariant}
|
|
148
|
+
subvariantOptions={subvariantOptions}
|
|
149
|
+
/>
|
|
134
150
|
) : step.type === 'cross' ? (
|
|
135
|
-
<
|
|
151
|
+
<BridgeStepDetailsLabel step={step} />
|
|
136
152
|
) : step.type === 'protocol' ? (
|
|
137
153
|
<ProtocolStepDetailsLabel step={step} />
|
|
138
154
|
) : (
|
|
@@ -140,7 +156,7 @@ export const IncludedSteps: React.FC<{
|
|
|
140
156
|
)}
|
|
141
157
|
</StepLabel>
|
|
142
158
|
<StepContent last={i === includedSteps.length - 1}>
|
|
143
|
-
<StepDetailsContent step={step}
|
|
159
|
+
<StepDetailsContent step={step} />
|
|
144
160
|
</StepContent>
|
|
145
161
|
</MuiStep>
|
|
146
162
|
))}
|
|
@@ -151,8 +167,7 @@ export const IncludedSteps: React.FC<{
|
|
|
151
167
|
|
|
152
168
|
export const StepDetailsContent: React.FC<{
|
|
153
169
|
step: StepExtended;
|
|
154
|
-
|
|
155
|
-
}> = ({ step, subvariant }) => {
|
|
170
|
+
}> = ({ step }) => {
|
|
156
171
|
const { t } = useTranslation();
|
|
157
172
|
|
|
158
173
|
const sameTokenProtocolStep =
|
|
@@ -228,6 +243,7 @@ export const StepDetailsContent: React.FC<{
|
|
|
228
243
|
export const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps> = ({
|
|
229
244
|
step,
|
|
230
245
|
subvariant,
|
|
246
|
+
subvariantOptions,
|
|
231
247
|
}) => {
|
|
232
248
|
const { t } = useTranslation();
|
|
233
249
|
|
|
@@ -237,30 +253,33 @@ export const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps> = ({
|
|
|
237
253
|
|
|
238
254
|
// FIXME: step transaction request overrides step tool details, but not included step tool details
|
|
239
255
|
const toolDetails =
|
|
240
|
-
subvariant === '
|
|
256
|
+
subvariant === 'custom' &&
|
|
241
257
|
(step as unknown as LiFiStep).includedSteps?.length > 0
|
|
242
258
|
? (step as unknown as LiFiStep).includedSteps.find(
|
|
243
259
|
(step) => step.tool === 'custom' && step.toolDetails.key !== 'custom',
|
|
244
260
|
)?.toolDetails || step.toolDetails
|
|
245
261
|
: step.toolDetails;
|
|
246
262
|
|
|
263
|
+
const stepDetailsKey =
|
|
264
|
+
(subvariant === 'custom' && subvariantOptions?.custom) || 'checkout';
|
|
265
|
+
|
|
247
266
|
return (
|
|
248
267
|
<StepLabelTypography>
|
|
249
|
-
{t(`main.${
|
|
268
|
+
{t(`main.${stepDetailsKey}StepDetails`, {
|
|
250
269
|
tool: toolDetails.name,
|
|
251
270
|
})}
|
|
252
271
|
</StepLabelTypography>
|
|
253
272
|
);
|
|
254
273
|
};
|
|
255
274
|
|
|
256
|
-
export const
|
|
275
|
+
export const BridgeStepDetailsLabel: React.FC<
|
|
257
276
|
Omit<StepDetailsLabelProps, 'variant'>
|
|
258
277
|
> = ({ step }) => {
|
|
259
278
|
const { t } = useTranslation();
|
|
260
279
|
const { getChainById } = useAvailableChains();
|
|
261
280
|
return (
|
|
262
281
|
<StepLabelTypography>
|
|
263
|
-
{t('main.
|
|
282
|
+
{t('main.bridgeStepDetails', {
|
|
264
283
|
from: getChainById(step.action.fromChainId)?.name,
|
|
265
284
|
to: getChainById(step.action.toChainId)?.name,
|
|
266
285
|
tool: step.toolDetails.name,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { LiFiStep, Step } from '@lifi/sdk';
|
|
2
2
|
import type { BoxProps } from '@mui/material';
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
SubvariantOptions,
|
|
5
|
+
WidgetSubvariant,
|
|
6
|
+
} from '../../types/widget.js';
|
|
4
7
|
|
|
5
8
|
export interface StepActionsProps extends BoxProps {
|
|
6
9
|
step: LiFiStep;
|
|
@@ -9,5 +12,12 @@ export interface StepActionsProps extends BoxProps {
|
|
|
9
12
|
|
|
10
13
|
export interface StepDetailsLabelProps {
|
|
11
14
|
step: Step;
|
|
12
|
-
subvariant?: Extract<WidgetSubvariant, '
|
|
15
|
+
subvariant?: Extract<WidgetSubvariant, 'custom'>;
|
|
16
|
+
subvariantOptions?: SubvariantOptions;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IncludedStepsProps {
|
|
20
|
+
step: LiFiStep;
|
|
21
|
+
subvariant?: WidgetSubvariant;
|
|
22
|
+
subvariantOptions?: SubvariantOptions;
|
|
13
23
|
}
|
|
@@ -19,7 +19,7 @@ export const IconButton = styled(MuiIconButton)<IconButtonProps & LinkProps>(
|
|
|
19
19
|
color: 'inherit',
|
|
20
20
|
backgroundColor: 'unset',
|
|
21
21
|
minWidth: 'unset',
|
|
22
|
-
borderRadius:
|
|
22
|
+
borderRadius: theme.shape.borderRadiusTertiary,
|
|
23
23
|
'&:hover': {
|
|
24
24
|
backgroundColor: getContrastAlphaColor(theme, 0.04),
|
|
25
25
|
},
|
|
@@ -13,6 +13,7 @@ import { TokenNotFound } from './TokenNotFound.js';
|
|
|
13
13
|
import { VirtualizedTokenList } from './VirtualizedTokenList.js';
|
|
14
14
|
import type { TokenListProps } from './types.js';
|
|
15
15
|
import { useTokenSelect } from './useTokenSelect.js';
|
|
16
|
+
import { filteredTokensComparator } from './utils.js';
|
|
16
17
|
|
|
17
18
|
export const TokenList: FC<TokenListProps> = ({
|
|
18
19
|
formType,
|
|
@@ -45,12 +46,14 @@ export const TokenList: FC<TokenListProps> = ({
|
|
|
45
46
|
const searchFilter = normalizedSearchFilter?.toUpperCase() ?? '';
|
|
46
47
|
|
|
47
48
|
filteredTokens = tokenSearchFilter
|
|
48
|
-
? filteredTokens
|
|
49
|
-
(
|
|
50
|
-
token
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
? filteredTokens
|
|
50
|
+
.filter(
|
|
51
|
+
(token) =>
|
|
52
|
+
token.name?.toUpperCase().includes(searchFilter) ||
|
|
53
|
+
token.symbol.toUpperCase().includes(searchFilter) ||
|
|
54
|
+
token.address.toUpperCase().includes(searchFilter),
|
|
55
|
+
)
|
|
56
|
+
.sort(filteredTokensComparator(searchFilter))
|
|
54
57
|
: filteredTokens;
|
|
55
58
|
|
|
56
59
|
const tokenSearchEnabled =
|
|
@@ -81,36 +81,42 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
81
81
|
const previousToken: TokenAmount | undefined = tokens[item.index - 1];
|
|
82
82
|
|
|
83
83
|
const isFirstFeaturedToken = currentToken.featured && item.index === 0;
|
|
84
|
+
|
|
84
85
|
const isTransitionFromFeaturedTokens =
|
|
85
86
|
previousToken?.featured && !currentToken.featured;
|
|
87
|
+
|
|
86
88
|
const isTransitionFromMyTokens =
|
|
87
89
|
previousToken?.amount && !currentToken.amount;
|
|
90
|
+
|
|
88
91
|
const isTransitionToMyTokens =
|
|
89
92
|
isTransitionFromFeaturedTokens && currentToken.amount;
|
|
93
|
+
|
|
90
94
|
const isTransitionToPopularTokens =
|
|
91
95
|
(isTransitionFromFeaturedTokens || isTransitionFromMyTokens) &&
|
|
92
96
|
currentToken.popular;
|
|
97
|
+
|
|
93
98
|
const shouldShowAllTokensCategory =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
99
|
+
isTransitionFromMyTokens ||
|
|
100
|
+
isTransitionFromFeaturedTokens ||
|
|
101
|
+
(previousToken?.popular && !currentToken.popular);
|
|
102
|
+
|
|
103
|
+
const startAdornmentLabel = showCategories
|
|
104
|
+
? (() => {
|
|
105
|
+
if (isFirstFeaturedToken) {
|
|
106
|
+
return t('main.featuredTokens');
|
|
107
|
+
}
|
|
108
|
+
if (isTransitionToMyTokens) {
|
|
109
|
+
return t('main.myTokens');
|
|
110
|
+
}
|
|
111
|
+
if (isTransitionToPopularTokens) {
|
|
112
|
+
return t('main.popularTokens');
|
|
113
|
+
}
|
|
114
|
+
if (shouldShowAllTokensCategory) {
|
|
115
|
+
return t('main.allTokens');
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
})()
|
|
119
|
+
: null;
|
|
114
120
|
|
|
115
121
|
return (
|
|
116
122
|
<TokenListItem
|
|
@@ -33,7 +33,7 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
|
33
33
|
if (
|
|
34
34
|
selectedOppositeToken === tokenAddress &&
|
|
35
35
|
selectedOppositeChainId === selectedChainId &&
|
|
36
|
-
subvariant !== '
|
|
36
|
+
subvariant !== 'custom'
|
|
37
37
|
) {
|
|
38
38
|
setFieldValue(FormKeyHelper.getTokenKey(oppositeFormType), '', {
|
|
39
39
|
isDirty: true,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TokenAmount } from '../../types/token.js';
|
|
2
|
+
|
|
3
|
+
export const filteredTokensComparator = (searchFilter: string) => {
|
|
4
|
+
const isExactMatch = (token: TokenAmount) => {
|
|
5
|
+
return (
|
|
6
|
+
token.name?.toUpperCase() === searchFilter ||
|
|
7
|
+
token.symbol.toUpperCase() === searchFilter ||
|
|
8
|
+
token.address.toUpperCase() === searchFilter
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
return (tokenA: TokenAmount, tokenB: TokenAmount) => {
|
|
12
|
+
const isExactMatchA = isExactMatch(tokenA);
|
|
13
|
+
const isExactMatchB = isExactMatch(tokenB);
|
|
14
|
+
|
|
15
|
+
// Exact match with logo
|
|
16
|
+
if (isExactMatchB && tokenB.logoURI) {
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
if (isExactMatchA && tokenA.logoURI) {
|
|
20
|
+
return -1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Any token with a logo (exact match or not)
|
|
24
|
+
if (tokenB.logoURI && !tokenA.logoURI) {
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
if (tokenA.logoURI && !tokenB.logoURI) {
|
|
28
|
+
return -1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Exact match without logo
|
|
32
|
+
if (isExactMatchB && !tokenB.logoURI) {
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
if (isExactMatchA && !tokenA.logoURI) {
|
|
36
|
+
return -1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// All other tokens are considered equal in sorting priority
|
|
40
|
+
return 0;
|
|
41
|
+
};
|
|
42
|
+
};
|
package/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '3.0.0-alpha.
|
|
2
|
+
export const version = '3.0.0-alpha.35';
|
|
@@ -11,24 +11,38 @@ import { LiFiErrorCode } from '@lifi/sdk';
|
|
|
11
11
|
import type { TFunction } from 'i18next';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
|
|
14
|
-
import type { WidgetSubvariant } from '../types/widget.js';
|
|
14
|
+
import type { SubvariantOptions, WidgetSubvariant } from '../types/widget.js';
|
|
15
15
|
import { formatTokenAmount } from '../utils/format.js';
|
|
16
16
|
import { useAvailableChains } from './useAvailableChains.js';
|
|
17
17
|
|
|
18
18
|
export const useProcessMessage = (step?: LiFiStep, process?: Process) => {
|
|
19
|
-
const { subvariant } = useWidgetConfig();
|
|
19
|
+
const { subvariant, subvariantOptions } = useWidgetConfig();
|
|
20
20
|
const { t } = useTranslation();
|
|
21
21
|
const { getChainById } = useAvailableChains();
|
|
22
22
|
if (!step || !process) {
|
|
23
23
|
return {};
|
|
24
24
|
}
|
|
25
|
-
return getProcessMessage(
|
|
25
|
+
return getProcessMessage(
|
|
26
|
+
t,
|
|
27
|
+
getChainById,
|
|
28
|
+
step,
|
|
29
|
+
process,
|
|
30
|
+
subvariant,
|
|
31
|
+
subvariantOptions,
|
|
32
|
+
);
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
const processStatusMessages: Record<
|
|
29
36
|
ProcessType,
|
|
30
37
|
Partial<
|
|
31
|
-
Record<
|
|
38
|
+
Record<
|
|
39
|
+
Status,
|
|
40
|
+
(
|
|
41
|
+
t: TFunction,
|
|
42
|
+
subvariant?: WidgetSubvariant,
|
|
43
|
+
subvariantOptions?: SubvariantOptions,
|
|
44
|
+
) => string
|
|
45
|
+
>
|
|
32
46
|
>
|
|
33
47
|
> = {
|
|
34
48
|
TOKEN_ALLOWANCE: {
|
|
@@ -45,22 +59,26 @@ const processStatusMessages: Record<
|
|
|
45
59
|
STARTED: (t) => t(`main.process.swap.started`),
|
|
46
60
|
ACTION_REQUIRED: (t) => t(`main.process.swap.actionRequired`),
|
|
47
61
|
PENDING: (t) => t(`main.process.swap.pending`),
|
|
48
|
-
DONE: (t, subvariant) =>
|
|
49
|
-
subvariant === '
|
|
50
|
-
?
|
|
62
|
+
DONE: (t, subvariant, subvariantOptions) =>
|
|
63
|
+
subvariant === 'custom'
|
|
64
|
+
? subvariantOptions?.custom
|
|
65
|
+
? t(`main.process.${subvariantOptions?.custom}.done`)
|
|
66
|
+
: t(`main.process.checkout.done`)
|
|
51
67
|
: t(`main.process.swap.done`),
|
|
52
68
|
},
|
|
53
69
|
CROSS_CHAIN: {
|
|
54
|
-
STARTED: (t) => t(`main.process.
|
|
55
|
-
ACTION_REQUIRED: (t) => t(`main.process.
|
|
56
|
-
PENDING: (t) => t(`main.process.
|
|
57
|
-
DONE: (t) => t(`main.process.
|
|
70
|
+
STARTED: (t) => t(`main.process.bridge.started`),
|
|
71
|
+
ACTION_REQUIRED: (t) => t(`main.process.bridge.actionRequired`),
|
|
72
|
+
PENDING: (t) => t(`main.process.bridge.pending`),
|
|
73
|
+
DONE: (t) => t(`main.process.bridge.done`),
|
|
58
74
|
},
|
|
59
75
|
RECEIVING_CHAIN: {
|
|
60
76
|
PENDING: (t) => t(`main.process.receivingChain.pending`),
|
|
61
|
-
DONE: (t, subvariant) =>
|
|
62
|
-
subvariant === '
|
|
63
|
-
?
|
|
77
|
+
DONE: (t, subvariant, subvariantOptions) =>
|
|
78
|
+
subvariant === 'custom'
|
|
79
|
+
? subvariantOptions?.custom
|
|
80
|
+
? t(`main.process.${subvariantOptions?.custom}.done`)
|
|
81
|
+
: t(`main.process.checkout.done`)
|
|
64
82
|
: t(`main.process.receivingChain.done`),
|
|
65
83
|
},
|
|
66
84
|
TRANSACTION: {},
|
|
@@ -102,6 +120,7 @@ export function getProcessMessage(
|
|
|
102
120
|
step: LiFiStep,
|
|
103
121
|
process: Process,
|
|
104
122
|
subvariant?: WidgetSubvariant,
|
|
123
|
+
subvariantOptions?: SubvariantOptions,
|
|
105
124
|
): {
|
|
106
125
|
title?: string;
|
|
107
126
|
message?: string;
|
|
@@ -197,6 +216,10 @@ export function getProcessMessage(
|
|
|
197
216
|
processSubstatusMessages[process.status as StatusMessage]?.[
|
|
198
217
|
process.substatus!
|
|
199
218
|
]?.(t) ??
|
|
200
|
-
processStatusMessages[process.type]?.[process.status]?.(
|
|
219
|
+
processStatusMessages[process.type]?.[process.status]?.(
|
|
220
|
+
t,
|
|
221
|
+
subvariant,
|
|
222
|
+
subvariantOptions,
|
|
223
|
+
);
|
|
201
224
|
return { title };
|
|
202
225
|
}
|