@lifi/widget 3.7.0-beta.7 → 3.7.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/AppProvider.tsx +6 -4
- package/AppRoutes.tsx +14 -2
- package/CHANGELOG.md +22 -0
- package/_esm/AppProvider.js +3 -2
- package/_esm/AppProvider.js.map +1 -1
- package/_esm/AppRoutes.js +9 -2
- package/_esm/AppRoutes.js.map +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.style.js +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
- package/_esm/components/AmountInput/AmountInputEndAdornment.js +3 -1
- package/_esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/_esm/components/AppContainer.js +10 -5
- package/_esm/components/AppContainer.js.map +1 -1
- package/_esm/components/Avatar/AccountAvatar.d.ts +1 -1
- package/_esm/components/Avatar/AccountAvatar.js +1 -1
- package/_esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/_esm/components/Avatar/Avatar.d.ts +0 -1
- package/_esm/components/Avatar/Avatar.js +4 -7
- package/_esm/components/Avatar/Avatar.js.map +1 -1
- package/_esm/components/Avatar/Avatar.style.d.ts +3 -6
- package/_esm/components/Avatar/Avatar.style.js +6 -19
- package/_esm/components/Avatar/Avatar.style.js.map +1 -1
- package/_esm/components/Avatar/TokenAvatar.js +1 -1
- package/_esm/components/Avatar/TokenAvatar.js.map +1 -1
- package/_esm/components/BaseTransactionButton/BaseTransactionButton.js +5 -3
- package/_esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/_esm/components/ChainSelect/useChainSelect.js +1 -5
- package/_esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/_esm/components/FeeBreakdownTooltip.js +1 -4
- package/_esm/components/FeeBreakdownTooltip.js.map +1 -1
- package/_esm/components/FullPageContainer.d.ts +2 -0
- package/_esm/components/FullPageContainer.js +9 -0
- package/_esm/components/FullPageContainer.js.map +1 -0
- package/_esm/components/Header/EVMDisconnectIconButton.d.ts +4 -0
- package/_esm/components/Header/EVMDisconnectIconButton.js +12 -0
- package/_esm/components/Header/EVMDisconnectIconButton.js.map +1 -0
- package/_esm/components/Header/Header.js +23 -3
- package/_esm/components/Header/Header.js.map +1 -1
- package/_esm/components/Header/NavigationHeader.js +1 -1
- package/_esm/components/Header/NavigationHeader.js.map +1 -1
- package/_esm/components/Header/SVMDisconnectIconButton.d.ts +1 -0
- package/_esm/components/Header/SVMDisconnectIconButton.js +12 -0
- package/_esm/components/Header/SVMDisconnectIconButton.js.map +1 -0
- package/_esm/components/Header/WalletHeader.js +9 -5
- package/_esm/components/Header/WalletHeader.js.map +1 -1
- package/_esm/components/Header/WalletMenu.js +18 -10
- package/_esm/components/Header/WalletMenu.js.map +1 -1
- package/_esm/components/Header/WalletMenu.style.js +1 -5
- package/_esm/components/Header/WalletMenu.style.js.map +1 -1
- package/_esm/components/PageContainer.d.ts +2 -1
- package/_esm/components/PageContainer.js.map +1 -1
- package/_esm/components/PageEntered.d.ts +1 -0
- package/_esm/components/PageEntered.js +13 -0
- package/_esm/components/PageEntered.js.map +1 -0
- package/_esm/components/Routes/RoutesExpanded.js +1 -1
- package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/_esm/components/Search/SearchInput.d.ts +11 -0
- package/_esm/components/Search/SearchInput.js +21 -0
- package/_esm/components/Search/SearchInput.js.map +1 -0
- package/_esm/components/Search/SearchInput.style.d.ts +12 -0
- package/_esm/components/Search/SearchInput.style.js +38 -0
- package/_esm/components/Search/SearchInput.style.js.map +1 -0
- package/_esm/components/Search/SearchNotFound.d.ts +6 -0
- package/_esm/components/Search/SearchNotFound.js +5 -0
- package/_esm/components/Search/SearchNotFound.js.map +1 -0
- package/_esm/components/Search/SearchNotFound.style.d.ts +14 -0
- package/_esm/components/Search/SearchNotFound.style.js +29 -0
- package/_esm/components/Search/SearchNotFound.style.js.map +1 -0
- package/_esm/components/SendToWallet/SendToWalletButton.js +1 -1
- package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/_esm/components/Skeleton/WidgetSkeleton.js +3 -4
- package/_esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
- package/_esm/components/Skeleton/WidgetSkeleton.style.d.ts +3 -0
- package/_esm/components/Skeleton/WidgetSkeleton.style.js +20 -1
- package/_esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
- package/_esm/components/SmallAvatar.d.ts +10 -0
- package/_esm/components/SmallAvatar.js +19 -0
- package/_esm/components/SmallAvatar.js.map +1 -0
- package/_esm/components/StepActions/StepActions.js +1 -1
- package/_esm/components/StepActions/StepActions.js.map +1 -1
- package/_esm/components/Tabs/Tabs.style.d.ts +1 -1
- package/_esm/components/Token/Token.js +1 -1
- package/_esm/components/Token/Token.js.map +1 -1
- package/_esm/components/TokenList/TokenList.js +2 -5
- package/_esm/components/TokenList/TokenList.js.map +1 -1
- package/_esm/components/TokenList/TokenListItem.js +5 -11
- package/_esm/components/TokenList/TokenListItem.js.map +1 -1
- package/_esm/components/TokenList/TokenNotFound.js +5 -13
- package/_esm/components/TokenList/TokenNotFound.js.map +1 -1
- package/_esm/components/TokenList/VirtualizedTokenList.js +1 -1
- package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/_esm/components/TokenList/types.d.ts +3 -3
- package/_esm/components/TokenRate/TokenRate.js +2 -2
- package/_esm/components/TokenRate/TokenRate.js.map +1 -1
- package/_esm/config/version.d.ts +1 -1
- package/_esm/config/version.js +1 -1
- package/_esm/config/version.js.map +1 -1
- package/_esm/hooks/useAccount.d.ts +45 -0
- package/_esm/hooks/useAccount.js +56 -0
- package/_esm/hooks/useAccount.js.map +1 -0
- package/_esm/hooks/useAvailableChains.d.ts +1 -2
- package/_esm/hooks/useAvailableChains.js +8 -9
- package/_esm/hooks/useAvailableChains.js.map +1 -1
- package/_esm/hooks/useChains.d.ts +3 -4
- package/_esm/hooks/useChains.js +3 -5
- package/_esm/hooks/useChains.js.map +1 -1
- package/_esm/hooks/useFromTokenSufficiency.js +1 -1
- package/_esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/_esm/hooks/useGasSufficiency.js +3 -3
- package/_esm/hooks/useGasSufficiency.js.map +1 -1
- package/_esm/hooks/useProcessMessage.js +0 -4
- package/_esm/hooks/useProcessMessage.js.map +1 -1
- package/_esm/hooks/useRouteExecution.js +1 -1
- package/_esm/hooks/useRouteExecution.js.map +1 -1
- package/_esm/hooks/useRoutes.js +3 -2
- package/_esm/hooks/useRoutes.js.map +1 -1
- package/_esm/hooks/useScrollableContainer.d.ts +0 -1
- package/_esm/hooks/useScrollableContainer.js +1 -2
- package/_esm/hooks/useScrollableContainer.js.map +1 -1
- package/_esm/hooks/useSetContentHeight.js +9 -6
- package/_esm/hooks/useSetContentHeight.js.map +1 -1
- package/_esm/hooks/useTokenBalance.js +1 -1
- package/_esm/hooks/useTokenBalance.js.map +1 -1
- package/_esm/hooks/useTokenBalances.js +1 -1
- package/_esm/hooks/useTokenBalances.js.map +1 -1
- package/_esm/hooks/useTokens.js +1 -1
- package/_esm/hooks/useTokens.js.map +1 -1
- package/_esm/hooks/useTransactionDetails.js +1 -1
- package/_esm/hooks/useTransactionDetails.js.map +1 -1
- package/_esm/hooks/useTransactionHistory.js +1 -1
- package/_esm/hooks/useTransactionHistory.js.map +1 -1
- package/_esm/hooks/useWallets.d.ts +6 -0
- package/_esm/hooks/useWallets.js +80 -0
- package/_esm/hooks/useWallets.js.map +1 -0
- package/_esm/i18n/en.json +11 -4
- package/_esm/index.d.ts +2 -0
- package/_esm/index.js +2 -0
- package/_esm/index.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/_esm/pages/SelectChainPage/SelectChainPage.js +27 -8
- package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/_esm/pages/SelectEnabledToolsPage.js +38 -16
- package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/_esm/pages/SelectTokenPage/SearchTokenInput.js +2 -12
- package/_esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/_esm/pages/SelectTokenPage/useTokenListHeight.js +8 -14
- package/_esm/pages/SelectTokenPage/useTokenListHeight.js.map +1 -1
- package/_esm/pages/SelectWalletPage/EVMListItemButton.d.ts +9 -0
- package/_esm/pages/SelectWalletPage/EVMListItemButton.js +39 -0
- package/_esm/pages/SelectWalletPage/EVMListItemButton.js.map +1 -0
- package/_esm/pages/SelectWalletPage/SVMListItemButton.d.ts +6 -0
- package/_esm/pages/SelectWalletPage/SVMListItemButton.js +32 -0
- package/_esm/pages/SelectWalletPage/SVMListItemButton.js.map +1 -0
- package/_esm/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js +41 -0
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -0
- package/_esm/pages/SendToWallet/ConnectedWalletsPage.js +1 -1
- package/_esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/_esm/pages/TransactionPage/StatusBottomSheet.js +5 -5
- package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/_esm/providers/I18nProvider/types.d.ts +2 -2
- package/_esm/providers/WalletProvider/SDKProviders.js +7 -15
- package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
- package/_esm/providers/WalletProvider/WalletProvider.d.ts +0 -1
- package/_esm/providers/WalletProvider/WalletProvider.js +1 -14
- package/_esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.d.ts +1 -1
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js +3 -8
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -1
- package/_esm/providers/WidgetProvider/WidgetProvider.js +1 -2
- package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/_esm/providers/WidgetProvider/types.d.ts +2 -0
- package/_esm/stores/form/FormUpdater.js +1 -1
- package/_esm/stores/form/FormUpdater.js.map +1 -1
- package/_esm/stores/form/types.d.ts +4 -4
- package/_esm/stores/header/types.d.ts +2 -0
- package/_esm/stores/header/useHeaderStore.d.ts +7 -1
- package/_esm/stores/header/useHeaderStore.js +26 -2
- package/_esm/stores/header/useHeaderStore.js.map +1 -1
- package/_esm/stores/routes/useExecutingRoutesIds.js +1 -1
- package/_esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
- package/_esm/stores/settings/types.d.ts +1 -1
- package/_esm/stores/settings/useSettingsStore.js +22 -9
- package/_esm/stores/settings/useSettingsStore.js.map +1 -1
- package/_esm/themes/createTheme.js +1 -2
- package/_esm/themes/createTheme.js.map +1 -1
- package/_esm/types/events.d.ts +6 -6
- package/_esm/types/events.js +3 -2
- package/_esm/types/events.js.map +1 -1
- package/_esm/utils/chainType.js +3 -2
- package/_esm/utils/chainType.js.map +1 -1
- package/_esm/utils/converters.js +2 -1
- package/_esm/utils/converters.js.map +1 -1
- package/_esm/utils/elements.d.ts +5 -2
- package/_esm/utils/elements.js +6 -1
- package/_esm/utils/elements.js.map +1 -1
- package/_esm/utils/fees.js +5 -9
- package/_esm/utils/fees.js.map +1 -1
- package/_esm/utils/format.js +1 -1
- package/_esm/utils/format.js.map +1 -1
- package/_esm/utils/navigationRoutes.d.ts +3 -1
- package/_esm/utils/navigationRoutes.js +3 -0
- package/_esm/utils/navigationRoutes.js.map +1 -1
- package/_esm/utils/svm.d.ts +1 -0
- package/_esm/utils/svm.js +11 -0
- package/_esm/utils/svm.js.map +1 -0
- package/_esm/utils/wallet.js +1 -1
- package/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
- package/components/AmountInput/AmountInputEndAdornment.tsx +5 -1
- package/components/AppContainer.tsx +15 -10
- package/components/Avatar/AccountAvatar.tsx +2 -2
- package/components/Avatar/Avatar.style.tsx +7 -20
- package/components/Avatar/Avatar.tsx +4 -12
- package/components/Avatar/TokenAvatar.tsx +1 -1
- package/components/BaseTransactionButton/BaseTransactionButton.tsx +5 -3
- package/components/ChainSelect/useChainSelect.ts +1 -10
- package/components/FeeBreakdownTooltip.tsx +1 -4
- package/components/FullPageContainer.tsx +14 -0
- package/components/Header/EVMDisconnectIconButton.tsx +24 -0
- package/components/Header/Header.tsx +28 -3
- package/components/Header/NavigationHeader.tsx +1 -1
- package/components/Header/SVMDisconnectIconButton.tsx +19 -0
- package/components/Header/WalletHeader.tsx +12 -11
- package/components/Header/WalletMenu.style.tsx +1 -5
- package/components/Header/WalletMenu.tsx +32 -22
- package/components/PageContainer.ts +2 -1
- package/components/PageEntered.ts +14 -0
- package/components/Routes/RoutesExpanded.tsx +2 -1
- package/components/Search/SearchInput.style.tsx +46 -0
- package/components/Search/SearchInput.tsx +57 -0
- package/components/Search/SearchNotFound.style.tsx +36 -0
- package/components/Search/SearchNotFound.tsx +23 -0
- package/components/SendToWallet/SendToWalletButton.tsx +1 -1
- package/components/Skeleton/WidgetSkeleton.style.tsx +21 -1
- package/components/Skeleton/WidgetSkeleton.tsx +10 -9
- package/components/SmallAvatar.tsx +25 -0
- package/components/StepActions/StepActions.tsx +1 -1
- package/components/Token/Token.tsx +1 -1
- package/components/TokenList/TokenList.tsx +2 -9
- package/components/TokenList/TokenListItem.tsx +7 -15
- package/components/TokenList/TokenNotFound.tsx +7 -27
- package/components/TokenList/VirtualizedTokenList.tsx +1 -1
- package/components/TokenList/types.ts +3 -3
- package/components/TokenRate/TokenRate.tsx +2 -2
- package/config/version.ts +1 -1
- package/hooks/useAccount.ts +109 -0
- package/hooks/useAvailableChains.ts +10 -9
- package/hooks/useChains.ts +3 -6
- package/hooks/useFromTokenSufficiency.ts +1 -1
- package/hooks/useGasSufficiency.ts +3 -5
- package/hooks/useProcessMessage.ts +0 -4
- package/hooks/useRouteExecution.ts +1 -1
- package/hooks/useRoutes.ts +3 -2
- package/hooks/useScrollableContainer.ts +1 -6
- package/hooks/useSetContentHeight.ts +10 -6
- package/hooks/useTokenBalance.ts +1 -1
- package/hooks/useTokenBalances.ts +1 -1
- package/hooks/useTokens.ts +1 -2
- package/hooks/useTransactionDetails.ts +1 -1
- package/hooks/useTransactionHistory.ts +1 -1
- package/hooks/useWallets.ts +147 -0
- package/i18n/en.json +11 -4
- package/index.ts +2 -0
- package/package.json +4 -3
- package/pages/RoutesPage/RoutesPage.tsx +1 -1
- package/pages/SelectChainPage/SelectChainPage.tsx +62 -23
- package/pages/SelectEnabledToolsPage.tsx +94 -37
- package/pages/SelectTokenPage/SearchTokenInput.tsx +8 -26
- package/pages/SelectTokenPage/SelectTokenPage.tsx +3 -3
- package/pages/SelectTokenPage/useTokenListHeight.ts +14 -21
- package/pages/SelectWalletPage/EVMListItemButton.tsx +74 -0
- package/pages/SelectWalletPage/SVMListItemButton.tsx +47 -0
- package/pages/SelectWalletPage/SelectWalletPage.tsx +90 -0
- package/pages/SendToWallet/ConnectedWalletsPage.tsx +2 -2
- package/pages/SendToWallet/SendToWalletPage.tsx +1 -1
- package/pages/TransactionPage/StatusBottomSheet.tsx +6 -8
- package/providers/I18nProvider/types.ts +2 -2
- package/providers/WalletProvider/SDKProviders.tsx +7 -25
- package/providers/WalletProvider/WalletProvider.tsx +3 -24
- package/providers/WalletProvider/useHasExternalWalletProvider.ts +5 -11
- package/providers/WidgetProvider/WidgetProvider.tsx +1 -2
- package/providers/WidgetProvider/types.ts +2 -0
- package/stores/form/FormUpdater.tsx +1 -1
- package/stores/form/types.ts +4 -4
- package/stores/header/types.ts +2 -0
- package/stores/header/useHeaderStore.tsx +40 -2
- package/stores/routes/useExecutingRoutesIds.ts +1 -1
- package/stores/settings/types.ts +1 -1
- package/stores/settings/useSettingsStore.ts +30 -9
- package/themes/createTheme.ts +1 -3
- package/types/events.ts +5 -5
- package/utils/chainType.ts +3 -2
- package/utils/converters.ts +2 -1
- package/utils/elements.ts +21 -1
- package/utils/fees.ts +13 -15
- package/utils/format.ts +1 -1
- package/utils/navigationRoutes.ts +7 -1
- package/utils/svm.ts +10 -0
- package/utils/wallet.ts +1 -1
- package/_esm/components/Avatar/SmallAvatar.d.ts +0 -4
- package/_esm/components/Avatar/SmallAvatar.js +0 -12
- package/_esm/components/Avatar/SmallAvatar.js.map +0 -1
- package/_esm/components/Header/DisconnectIconButton.d.ts +0 -4
- package/_esm/components/Header/DisconnectIconButton.js +0 -12
- package/_esm/components/Header/DisconnectIconButton.js.map +0 -1
- package/_esm/hooks/useHeaderHeight.d.ts +0 -6
- package/_esm/hooks/useHeaderHeight.js +0 -23
- package/_esm/hooks/useHeaderHeight.js.map +0 -1
- package/_esm/providers/WalletProvider/UTXOBaseProvider.d.ts +0 -2
- package/_esm/providers/WalletProvider/UTXOBaseProvider.js +0 -17
- package/_esm/providers/WalletProvider/UTXOBaseProvider.js.map +0 -1
- package/_esm/providers/WalletProvider/UTXOExternalContext.d.ts +0 -1
- package/_esm/providers/WalletProvider/UTXOExternalContext.js +0 -3
- package/_esm/providers/WalletProvider/UTXOExternalContext.js.map +0 -1
- package/_esm/providers/WalletProvider/UTXOProvider.d.ts +0 -3
- package/_esm/providers/WalletProvider/UTXOProvider.js +0 -18
- package/_esm/providers/WalletProvider/UTXOProvider.js.map +0 -1
- package/components/Avatar/SmallAvatar.tsx +0 -16
- package/components/Header/DisconnectIconButton.tsx +0 -18
- package/hooks/useHeaderHeight.ts +0 -27
- package/providers/WalletProvider/UTXOBaseProvider.tsx +0 -28
- package/providers/WalletProvider/UTXOExternalContext.ts +0 -3
- package/providers/WalletProvider/UTXOProvider.tsx +0 -26
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { Search } from '@mui/icons-material';
|
|
2
|
-
import { FormControl, InputAdornment } from '@mui/material';
|
|
3
1
|
import { useEffect } from 'react';
|
|
4
2
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import {
|
|
3
|
+
import { SearchInput } from '../../components/Search/SearchInput.js';
|
|
6
4
|
import { useFieldActions } from '../../stores/form/useFieldActions.js';
|
|
7
5
|
import { useFieldController } from '../../stores/form/useFieldController.js';
|
|
8
|
-
import { Input } from './SearchTokenInput.style.js';
|
|
9
6
|
|
|
10
7
|
export const SearchTokenInput = () => {
|
|
11
8
|
const { t } = useTranslation();
|
|
@@ -22,27 +19,12 @@ export const SearchTokenInput = () => {
|
|
|
22
19
|
);
|
|
23
20
|
|
|
24
21
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<Search />
|
|
33
|
-
</InputAdornment>
|
|
34
|
-
}
|
|
35
|
-
inputProps={{
|
|
36
|
-
inputMode: 'search',
|
|
37
|
-
onChange: (e) => onChange((e.target as HTMLInputElement).value),
|
|
38
|
-
onBlur,
|
|
39
|
-
name,
|
|
40
|
-
value,
|
|
41
|
-
maxLength: 128,
|
|
42
|
-
}}
|
|
43
|
-
autoComplete="off"
|
|
44
|
-
/>
|
|
45
|
-
</FormControl>
|
|
46
|
-
</InputCard>
|
|
22
|
+
<SearchInput
|
|
23
|
+
name={name}
|
|
24
|
+
placeholder={t(`main.tokenSearch`)}
|
|
25
|
+
onChange={(e) => onChange((e.target as HTMLInputElement).value)}
|
|
26
|
+
onBlur={onBlur}
|
|
27
|
+
value={value as string | undefined}
|
|
28
|
+
/>
|
|
47
29
|
);
|
|
48
30
|
};
|
|
@@ -3,7 +3,7 @@ import type { FC } from 'react';
|
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { ChainSelect } from '../../components/ChainSelect/ChainSelect.js';
|
|
6
|
-
import {
|
|
6
|
+
import { FullPageContainer } from '../../components/FullPageContainer.js';
|
|
7
7
|
import { TokenList } from '../../components/TokenList/TokenList.js';
|
|
8
8
|
import { useHeader } from '../../hooks/useHeader.js';
|
|
9
9
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
|
|
@@ -40,7 +40,7 @@ export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
|
|
|
40
40
|
const hideChainSelect = swapOnly && formType === 'to';
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<
|
|
43
|
+
<FullPageContainer disableGutters>
|
|
44
44
|
<Box pb={2} px={3} ref={headerRef}>
|
|
45
45
|
{!hideChainSelect ? <ChainSelect formType={formType} /> : null}
|
|
46
46
|
<Box mt={!hideChainSelect ? 2 : 0}>
|
|
@@ -55,6 +55,6 @@ export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
|
|
|
55
55
|
formType={formType}
|
|
56
56
|
/>
|
|
57
57
|
</Box>
|
|
58
|
-
</
|
|
58
|
+
</FullPageContainer>
|
|
59
59
|
);
|
|
60
60
|
};
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
import { useTheme } from '@mui/material';
|
|
1
|
+
import { debounce, useTheme } from '@mui/material';
|
|
2
2
|
import type { MutableRefObject } from 'react';
|
|
3
3
|
import { useLayoutEffect, useState } from 'react';
|
|
4
4
|
import { useDefaultElementId } from '../../hooks/useDefaultElementId.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
timer = setTimeout(() => {
|
|
12
|
-
func.apply(this, args);
|
|
13
|
-
}, timeout);
|
|
14
|
-
};
|
|
15
|
-
};
|
|
5
|
+
import {
|
|
6
|
+
ElementId,
|
|
7
|
+
getAppContainer,
|
|
8
|
+
getHeaderElement,
|
|
9
|
+
getScrollableContainer,
|
|
10
|
+
} from '../../utils/elements.js';
|
|
16
11
|
|
|
17
12
|
const getContentHeight = (
|
|
18
13
|
elementId: string,
|
|
19
14
|
listParentRef: MutableRefObject<HTMLUListElement | null>,
|
|
20
15
|
) => {
|
|
21
|
-
const containerElement =
|
|
22
|
-
createElementId(ElementId.ScrollableContainer, elementId),
|
|
23
|
-
);
|
|
16
|
+
const containerElement = getScrollableContainer(elementId);
|
|
24
17
|
|
|
25
|
-
const headerElement =
|
|
26
|
-
createElementId(ElementId.Header, elementId),
|
|
27
|
-
);
|
|
18
|
+
const headerElement = getHeaderElement(elementId);
|
|
28
19
|
|
|
29
20
|
const listParentElement = listParentRef?.current;
|
|
30
21
|
|
|
@@ -63,6 +54,10 @@ interface UseContentHeightProps {
|
|
|
63
54
|
export const minTokenListHeight = 360;
|
|
64
55
|
export const minMobileTokenListHeight = 160;
|
|
65
56
|
|
|
57
|
+
// NOTE: this hook is implicitly tied to the widget height functionality in the
|
|
58
|
+
// AppExpandedContainer, RelativeContainer and CssBaselineContainer components as defined in AppContainer.ts
|
|
59
|
+
// CSS changes in those components can have implications for the functionality in this hook
|
|
60
|
+
|
|
66
61
|
export const useTokenListHeight = ({
|
|
67
62
|
listParentRef,
|
|
68
63
|
headerRef,
|
|
@@ -81,9 +76,7 @@ export const useTokenListHeight = ({
|
|
|
81
76
|
// calling this on initial mount prevents the lists resizing appearing glitchy
|
|
82
77
|
handleResize();
|
|
83
78
|
|
|
84
|
-
const appContainer =
|
|
85
|
-
createElementId(ElementId.AppExpandedContainer, elementId),
|
|
86
|
-
);
|
|
79
|
+
const appContainer = getAppContainer(elementId);
|
|
87
80
|
|
|
88
81
|
let resizeObserver: ResizeObserver;
|
|
89
82
|
if (appContainer) {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ChainType } from '@lifi/sdk';
|
|
2
|
+
import type { CreateConnectorFnExtended } from '@lifi/wallet-management';
|
|
3
|
+
import {
|
|
4
|
+
getConnectorIcon,
|
|
5
|
+
isWalletInstalledAsync,
|
|
6
|
+
} from '@lifi/wallet-management';
|
|
7
|
+
import { Avatar, ListItemAvatar } from '@mui/material';
|
|
8
|
+
import type { Connector } from 'wagmi';
|
|
9
|
+
import { useConnect, useDisconnect } from 'wagmi';
|
|
10
|
+
import { ListItemButton } from '../../components/ListItemButton.js';
|
|
11
|
+
import { ListItemText } from '../../components/ListItemText.js';
|
|
12
|
+
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
|
|
13
|
+
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js';
|
|
14
|
+
import { WidgetEvent } from '../../types/events.js';
|
|
15
|
+
|
|
16
|
+
interface EVMListItemButtonProps {
|
|
17
|
+
connectedConnector?: Connector;
|
|
18
|
+
connector: CreateConnectorFnExtended | Connector;
|
|
19
|
+
onNotInstalled(connector: Connector): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const EVMListItemButton = ({
|
|
23
|
+
connectedConnector,
|
|
24
|
+
connector,
|
|
25
|
+
onNotInstalled,
|
|
26
|
+
}: EVMListItemButtonProps) => {
|
|
27
|
+
const { navigateBack } = useNavigateBack();
|
|
28
|
+
const emitter = useWidgetEvents();
|
|
29
|
+
const { connectAsync } = useConnect();
|
|
30
|
+
const { disconnectAsync } = useDisconnect();
|
|
31
|
+
|
|
32
|
+
const handleEVMConnect = async () => {
|
|
33
|
+
const identityCheckPassed = await isWalletInstalledAsync(
|
|
34
|
+
(connector as Connector).id,
|
|
35
|
+
);
|
|
36
|
+
if (!identityCheckPassed) {
|
|
37
|
+
onNotInstalled(connector as Connector);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (connectedConnector) {
|
|
41
|
+
await disconnectAsync({ connector: connectedConnector });
|
|
42
|
+
}
|
|
43
|
+
await connectAsync(
|
|
44
|
+
{ connector },
|
|
45
|
+
{
|
|
46
|
+
onSuccess(data) {
|
|
47
|
+
emitter.emit(WidgetEvent.WalletConnected, {
|
|
48
|
+
address: data.accounts[0],
|
|
49
|
+
chainId: data.chainId,
|
|
50
|
+
chainType: ChainType.EVM,
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
navigateBack();
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const connectorName: string =
|
|
59
|
+
(connector as CreateConnectorFnExtended).displayName || connector.name;
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<ListItemButton key={connector.id} onClick={handleEVMConnect}>
|
|
63
|
+
<ListItemAvatar>
|
|
64
|
+
<Avatar
|
|
65
|
+
src={getConnectorIcon(connector as Connector)}
|
|
66
|
+
alt={connectorName}
|
|
67
|
+
>
|
|
68
|
+
{connectorName?.[0]}
|
|
69
|
+
</Avatar>
|
|
70
|
+
</ListItemAvatar>
|
|
71
|
+
<ListItemText primary={connectorName} />
|
|
72
|
+
</ListItemButton>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ChainId, ChainType } from '@lifi/sdk';
|
|
2
|
+
import { Avatar, ListItemAvatar } from '@mui/material';
|
|
3
|
+
import type { Wallet } from '@solana/wallet-adapter-react';
|
|
4
|
+
import { useWallet } from '@solana/wallet-adapter-react';
|
|
5
|
+
import { ListItemButton } from '../../components/ListItemButton.js';
|
|
6
|
+
import { ListItemText } from '../../components/ListItemText.js';
|
|
7
|
+
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
|
|
8
|
+
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js';
|
|
9
|
+
import { WidgetEvent } from '../../types/events.js';
|
|
10
|
+
|
|
11
|
+
interface SVMListItemButtonProps {
|
|
12
|
+
wallet: Wallet;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SVMListItemButton = ({ wallet }: SVMListItemButtonProps) => {
|
|
16
|
+
const { navigateBack } = useNavigateBack();
|
|
17
|
+
const emitter = useWidgetEvents();
|
|
18
|
+
const { select, disconnect, connected } = useWallet();
|
|
19
|
+
|
|
20
|
+
const connect = async () => {
|
|
21
|
+
if (connected) {
|
|
22
|
+
await disconnect();
|
|
23
|
+
}
|
|
24
|
+
select(wallet.adapter.name);
|
|
25
|
+
// We use autoConnect on wallet selection
|
|
26
|
+
// await solanaConnect();
|
|
27
|
+
wallet.adapter.once('connect', (publicKey) => {
|
|
28
|
+
emitter.emit(WidgetEvent.WalletConnected, {
|
|
29
|
+
address: publicKey?.toString(),
|
|
30
|
+
chainId: ChainId.SOL,
|
|
31
|
+
chainType: ChainType.SVM,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
navigateBack();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<ListItemButton key={wallet.adapter.name} onClick={connect}>
|
|
39
|
+
<ListItemAvatar>
|
|
40
|
+
<Avatar src={wallet.adapter.icon} alt={wallet.adapter.name}>
|
|
41
|
+
{wallet.adapter.name[0]}
|
|
42
|
+
</Avatar>
|
|
43
|
+
</ListItemAvatar>
|
|
44
|
+
<ListItemText primary={`${wallet.adapter.name} (Solana)`} />
|
|
45
|
+
</ListItemButton>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
DialogActions,
|
|
4
|
+
DialogContent,
|
|
5
|
+
DialogContentText,
|
|
6
|
+
List,
|
|
7
|
+
} from '@mui/material';
|
|
8
|
+
import type { Wallet } from '@solana/wallet-adapter-react';
|
|
9
|
+
import { useCallback, useState } from 'react';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import type { Connector } from 'wagmi';
|
|
12
|
+
import { useAccount as useWagmiAccount } from 'wagmi';
|
|
13
|
+
import { Dialog } from '../../components/Dialog.js';
|
|
14
|
+
import { PageContainer } from '../../components/PageContainer.js';
|
|
15
|
+
import { useHeader } from '../../hooks/useHeader.js';
|
|
16
|
+
import { useWallets } from '../../hooks/useWallets.js';
|
|
17
|
+
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
18
|
+
import { EVMListItemButton } from './EVMListItemButton.js';
|
|
19
|
+
import { SVMListItemButton } from './SVMListItemButton.js';
|
|
20
|
+
|
|
21
|
+
export const SelectWalletPage = () => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const { chains, walletConfig } = useWidgetConfig();
|
|
24
|
+
const account = useWagmiAccount();
|
|
25
|
+
const [walletIdentity, setWalletIdentity] = useState<{
|
|
26
|
+
show: boolean;
|
|
27
|
+
connector?: Connector;
|
|
28
|
+
}>({ show: false });
|
|
29
|
+
|
|
30
|
+
useHeader(t(`header.selectWallet`));
|
|
31
|
+
|
|
32
|
+
const closeDialog = () => {
|
|
33
|
+
setWalletIdentity((state) => ({
|
|
34
|
+
...state,
|
|
35
|
+
show: false,
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const handleNotInstalled = useCallback(async (connector: Connector) => {
|
|
40
|
+
setWalletIdentity({
|
|
41
|
+
show: true,
|
|
42
|
+
connector,
|
|
43
|
+
});
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const wallets = useWallets(walletConfig, chains);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<PageContainer disableGutters>
|
|
50
|
+
<List
|
|
51
|
+
sx={{
|
|
52
|
+
paddingTop: 0,
|
|
53
|
+
paddingLeft: 1.5,
|
|
54
|
+
paddingRight: 1.5,
|
|
55
|
+
paddingBottom: 1.5,
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{wallets?.map((connector) =>
|
|
59
|
+
(connector as Connector).id ? (
|
|
60
|
+
<EVMListItemButton
|
|
61
|
+
key={(connector as Connector).id}
|
|
62
|
+
connector={connector as Connector}
|
|
63
|
+
connectedConnector={account.connector}
|
|
64
|
+
onNotInstalled={handleNotInstalled}
|
|
65
|
+
/>
|
|
66
|
+
) : (
|
|
67
|
+
<SVMListItemButton
|
|
68
|
+
key={(connector as Wallet).adapter.name}
|
|
69
|
+
wallet={connector as Wallet}
|
|
70
|
+
/>
|
|
71
|
+
),
|
|
72
|
+
)}
|
|
73
|
+
</List>
|
|
74
|
+
<Dialog open={walletIdentity.show} onClose={closeDialog}>
|
|
75
|
+
<DialogContent>
|
|
76
|
+
<DialogContentText>
|
|
77
|
+
{t('wallet.extensionNotFound', {
|
|
78
|
+
name: walletIdentity.connector?.name,
|
|
79
|
+
})}
|
|
80
|
+
</DialogContentText>
|
|
81
|
+
</DialogContent>
|
|
82
|
+
<DialogActions>
|
|
83
|
+
<Button variant="contained" onClick={closeDialog} autoFocus>
|
|
84
|
+
{t('button.ok')}
|
|
85
|
+
</Button>
|
|
86
|
+
</DialogActions>
|
|
87
|
+
</Dialog>
|
|
88
|
+
</PageContainer>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Account } from '@lifi/wallet-management';
|
|
2
|
-
import { useAccount } from '@lifi/wallet-management';
|
|
3
1
|
import {
|
|
4
2
|
ContentCopyRounded,
|
|
5
3
|
MoreHoriz,
|
|
@@ -14,6 +12,8 @@ import { AccountAvatar } from '../../components/Avatar/AccountAvatar.js';
|
|
|
14
12
|
import { ListItem } from '../../components/ListItem/ListItem.js';
|
|
15
13
|
import { ListItemButton } from '../../components/ListItem/ListItemButton.js';
|
|
16
14
|
import { Menu } from '../../components/Menu.js';
|
|
15
|
+
import type { Account } from '../../hooks/useAccount.js';
|
|
16
|
+
import { useAccount } from '../../hooks/useAccount.js';
|
|
17
17
|
import { useExplorer } from '../../hooks/useExplorer.js';
|
|
18
18
|
import { useHeader } from '../../hooks/useHeader.js';
|
|
19
19
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useAccount } from '@lifi/wallet-management';
|
|
2
1
|
import { Error, History, TurnedIn, Wallet } from '@mui/icons-material';
|
|
3
2
|
import { Box, Tooltip, Typography } from '@mui/material';
|
|
4
3
|
import type { ChangeEvent } from 'react';
|
|
@@ -8,6 +7,7 @@ import { useNavigate } from 'react-router-dom';
|
|
|
8
7
|
import type { BottomSheetBase } from '../../components/BottomSheet/types.js';
|
|
9
8
|
import { ButtonTertiary } from '../../components/ButtonTertiary.js';
|
|
10
9
|
import { CardButton } from '../../components/Card/CardButton.js';
|
|
10
|
+
import { useAccount } from '../../hooks/useAccount.js';
|
|
11
11
|
import {
|
|
12
12
|
AddressType,
|
|
13
13
|
useAddressValidation,
|
|
@@ -301,7 +301,12 @@ export const StatusBottomSheetContent: React.FC<
|
|
|
301
301
|
<Typography py={1}>{secondaryMessage}</Typography>
|
|
302
302
|
) : null}
|
|
303
303
|
{VcComponent ? <VcComponent route={route} /> : null}
|
|
304
|
-
<Box
|
|
304
|
+
<Box sx={{ display: 'flex', marginTop: 2, gap: 1.5 }}>
|
|
305
|
+
{hasEnumFlag(status, RouteExecutionStatus.Done) ? (
|
|
306
|
+
<Button variant="text" onClick={handleSeeDetails} fullWidth>
|
|
307
|
+
{t('button.seeDetails')}
|
|
308
|
+
</Button>
|
|
309
|
+
) : null}
|
|
305
310
|
<Button variant="contained" fullWidth onClick={handlePrimaryButton}>
|
|
306
311
|
{status === RouteExecutionStatus.Idle ? t('button.ok') : null}
|
|
307
312
|
{hasEnumFlag(status, RouteExecutionStatus.Done)
|
|
@@ -312,13 +317,6 @@ export const StatusBottomSheetContent: React.FC<
|
|
|
312
317
|
: null}
|
|
313
318
|
</Button>
|
|
314
319
|
</Box>
|
|
315
|
-
{hasEnumFlag(status, RouteExecutionStatus.Done) ? (
|
|
316
|
-
<Box mt={2}>
|
|
317
|
-
<Button variant="text" onClick={handleSeeDetails} fullWidth>
|
|
318
|
-
{t('button.seeDetails')}
|
|
319
|
-
</Button>
|
|
320
|
-
</Box>
|
|
321
|
-
) : null}
|
|
322
320
|
</Box>
|
|
323
321
|
);
|
|
324
322
|
};
|
|
@@ -12,14 +12,14 @@ export type LanguageResource = typeof languages.en;
|
|
|
12
12
|
|
|
13
13
|
export type LanguageResources =
|
|
14
14
|
| {
|
|
15
|
-
[
|
|
15
|
+
[language in LanguageKey]?: PartialResource<LanguageResource>;
|
|
16
16
|
}
|
|
17
17
|
| {
|
|
18
18
|
[language: string]: PartialResource<LanguageResource>;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export type LanguageTranslationResource = {
|
|
22
|
-
[
|
|
22
|
+
[namespace in 'translation']: PartialResource<LanguageResource>;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export type LanguageTranslationResources = {
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
import type { SDKProvider } from '@lifi/sdk';
|
|
2
|
-
import { ChainType, EVM, Solana,
|
|
3
|
-
import {
|
|
4
|
-
getConnectorClient as getBigmiConnectorClient,
|
|
5
|
-
useConfig as useBigmiConfig,
|
|
6
|
-
} from '@lifi/wallet-management';
|
|
2
|
+
import { ChainType, EVM, Solana, config } from '@lifi/sdk';
|
|
7
3
|
import type { SignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
8
4
|
import { useWallet } from '@solana/wallet-adapter-react';
|
|
9
|
-
import {
|
|
10
|
-
getConnectorClient as getWagmiConnectorClient,
|
|
11
|
-
switchChain,
|
|
12
|
-
} from '@wagmi/core';
|
|
5
|
+
import { getWalletClient, switchChain } from '@wagmi/core';
|
|
13
6
|
import { useEffect } from 'react';
|
|
14
|
-
import { useConfig
|
|
7
|
+
import { useConfig } from 'wagmi';
|
|
15
8
|
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
|
|
16
9
|
|
|
17
10
|
export const SDKProviders = () => {
|
|
18
11
|
const { sdkConfig } = useWidgetConfig();
|
|
19
12
|
const { wallet } = useWallet();
|
|
20
|
-
const wagmiConfig =
|
|
21
|
-
const bigmiConfig = useBigmiConfig();
|
|
13
|
+
const wagmiConfig = useConfig();
|
|
22
14
|
|
|
23
15
|
useEffect(() => {
|
|
24
16
|
// Configure SDK Providers
|
|
@@ -29,16 +21,13 @@ export const SDKProviders = () => {
|
|
|
29
21
|
const hasConfiguredSVMProvider = sdkConfig?.providers?.some(
|
|
30
22
|
(provider) => provider.type === ChainType.SVM,
|
|
31
23
|
);
|
|
32
|
-
const hasConfiguredUTXOProvider = sdkConfig?.providers?.some(
|
|
33
|
-
(provider) => provider.type === ChainType.UTXO,
|
|
34
|
-
);
|
|
35
24
|
if (!hasConfiguredEVMProvider) {
|
|
36
25
|
providers.push(
|
|
37
26
|
EVM({
|
|
38
|
-
getWalletClient: () =>
|
|
27
|
+
getWalletClient: () => getWalletClient(wagmiConfig),
|
|
39
28
|
switchChain: async (chainId: number) => {
|
|
40
29
|
const chain = await switchChain(wagmiConfig, { chainId });
|
|
41
|
-
return
|
|
30
|
+
return getWalletClient(wagmiConfig, { chainId: chain.id });
|
|
42
31
|
},
|
|
43
32
|
}),
|
|
44
33
|
);
|
|
@@ -52,18 +41,11 @@ export const SDKProviders = () => {
|
|
|
52
41
|
}),
|
|
53
42
|
);
|
|
54
43
|
}
|
|
55
|
-
if (!hasConfiguredUTXOProvider) {
|
|
56
|
-
providers.push(
|
|
57
|
-
UTXO({
|
|
58
|
-
getWalletClient: () => getBigmiConnectorClient(bigmiConfig),
|
|
59
|
-
}),
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
44
|
if (sdkConfig?.providers?.length) {
|
|
63
45
|
providers.push(...sdkConfig?.providers);
|
|
64
46
|
}
|
|
65
47
|
config.setProviders(providers);
|
|
66
|
-
}, [
|
|
48
|
+
}, [sdkConfig?.providers, wagmiConfig, wallet?.adapter]);
|
|
67
49
|
|
|
68
50
|
return null;
|
|
69
51
|
};
|
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { WalletManagementProvider } from '@lifi/wallet-management';
|
|
3
|
-
import { useMemo, type FC, type PropsWithChildren } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
|
|
1
|
+
import { type FC, type PropsWithChildren } from 'react';
|
|
6
2
|
import { EVMProvider } from './EVMProvider.js';
|
|
7
3
|
import { SDKProviders } from './SDKProviders.js';
|
|
8
4
|
import { SVMProvider } from './SVMProvider.js';
|
|
9
|
-
import { UTXOProvider } from './UTXOProvider.js';
|
|
10
5
|
|
|
11
6
|
export const WalletProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
12
7
|
return (
|
|
13
8
|
<EVMProvider>
|
|
14
9
|
<SVMProvider>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
<WalletMenuProvider>{children}</WalletMenuProvider>
|
|
18
|
-
</UTXOProvider>
|
|
10
|
+
<SDKProviders />
|
|
11
|
+
{children}
|
|
19
12
|
</SVMProvider>
|
|
20
13
|
</EVMProvider>
|
|
21
14
|
);
|
|
22
15
|
};
|
|
23
|
-
|
|
24
|
-
export const WalletMenuProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
25
|
-
const { walletConfig } = useWidgetConfig();
|
|
26
|
-
const { i18n } = useTranslation();
|
|
27
|
-
|
|
28
|
-
const config: WalletManagementConfig = useMemo(() => {
|
|
29
|
-
return { locale: i18n.resolvedLanguage as never, ...walletConfig };
|
|
30
|
-
}, [i18n.resolvedLanguage, walletConfig]);
|
|
31
|
-
return (
|
|
32
|
-
<WalletManagementProvider config={config}>
|
|
33
|
-
{children}
|
|
34
|
-
</WalletManagementProvider>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -2,35 +2,29 @@ import { ChainType } from '@lifi/sdk';
|
|
|
2
2
|
import { useContext, useMemo } from 'react';
|
|
3
3
|
import { EVMExternalContext } from './EVMExternalContext.js';
|
|
4
4
|
import { SVMExternalContext } from './SVMExternalContext.js';
|
|
5
|
-
import { UTXOExternalContext } from './UTXOExternalContext.js';
|
|
6
5
|
|
|
7
6
|
interface ExternalWalletProvider {
|
|
8
7
|
hasExternalProvider: boolean;
|
|
9
|
-
|
|
8
|
+
providers: ChainType[];
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export function useHasExternalWalletProvider(): ExternalWalletProvider {
|
|
13
12
|
const hasExternalEVMContext = useContext(EVMExternalContext);
|
|
14
13
|
const hasExternalSVMContext = useContext(SVMExternalContext);
|
|
15
|
-
const hasExternalUTXOContext = useContext(UTXOExternalContext);
|
|
16
14
|
|
|
17
15
|
const providers = useMemo(() => {
|
|
18
|
-
const providers
|
|
16
|
+
const providers = [];
|
|
19
17
|
if (hasExternalEVMContext) {
|
|
20
18
|
providers.push(ChainType.EVM);
|
|
21
19
|
}
|
|
22
20
|
if (hasExternalSVMContext) {
|
|
23
21
|
providers.push(ChainType.SVM);
|
|
24
22
|
}
|
|
25
|
-
if (hasExternalUTXOContext) {
|
|
26
|
-
providers.push(ChainType.UTXO);
|
|
27
|
-
}
|
|
28
23
|
return providers;
|
|
29
|
-
}, [hasExternalEVMContext, hasExternalSVMContext
|
|
24
|
+
}, [hasExternalEVMContext, hasExternalSVMContext]);
|
|
30
25
|
|
|
31
26
|
return {
|
|
32
|
-
hasExternalProvider:
|
|
33
|
-
|
|
34
|
-
availableChainTypes: providers,
|
|
27
|
+
hasExternalProvider: hasExternalEVMContext || hasExternalSVMContext,
|
|
28
|
+
providers,
|
|
35
29
|
};
|
|
36
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import { useAccount } from '@lifi/wallet-management';
|
|
3
2
|
import { useEffect } from 'react';
|
|
3
|
+
import { useAccount } from '../../hooks/useAccount.js';
|
|
4
4
|
import { useChains } from '../../hooks/useChains.js';
|
|
5
5
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
6
6
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js';
|
package/stores/form/types.ts
CHANGED
|
@@ -35,17 +35,17 @@ export type FormFieldArray<T extends FormFieldNames[]> = {
|
|
|
35
35
|
[K in keyof T]: ExtractValueType<FormValues[T[K]]>;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export type TouchedFields = { [
|
|
38
|
+
export type TouchedFields = { [key in FormFieldNames]?: boolean };
|
|
39
39
|
|
|
40
40
|
type ValidationFn = (value: any) => Promise<boolean | string>;
|
|
41
41
|
export interface ValidationProps {
|
|
42
42
|
isValid: boolean;
|
|
43
43
|
isValidating: boolean;
|
|
44
44
|
errors: {
|
|
45
|
-
[
|
|
45
|
+
[key in FormFieldNames]?: string;
|
|
46
46
|
};
|
|
47
47
|
validation: {
|
|
48
|
-
[
|
|
48
|
+
[key in FormFieldNames]?: ValidationFn;
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -61,7 +61,7 @@ export interface ValidationActions {
|
|
|
61
61
|
export interface FormProps {
|
|
62
62
|
defaultValues: FormValues;
|
|
63
63
|
userValues: FormValues;
|
|
64
|
-
touchedFields: { [
|
|
64
|
+
touchedFields: { [key in FormFieldNames]?: boolean };
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
interface ResetOptions {
|
package/stores/header/types.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type HeaderStore = UseBoundStoreWithEqualityFn<StoreApi<HeaderState>>;
|
|
|
6
6
|
export interface HeaderStateBase {
|
|
7
7
|
element?: React.ReactNode | null;
|
|
8
8
|
title?: string;
|
|
9
|
+
headerHeight: number;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface HeaderState extends HeaderStateBase {
|
|
@@ -13,4 +14,5 @@ export interface HeaderState extends HeaderStateBase {
|
|
|
13
14
|
setTitle(title?: string): () => void;
|
|
14
15
|
removeAction(): void;
|
|
15
16
|
removeTitle(): void;
|
|
17
|
+
setHeaderHeight(headerHeight: number): void;
|
|
16
18
|
}
|