@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,4 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext, useRef } from 'react';
|
|
2
|
+
import { shallow } from 'zustand/shallow';
|
|
2
3
|
import { createWithEqualityFn } from 'zustand/traditional';
|
|
3
4
|
import type { PersistStoreProps, PersistStoreProviderProps } from '../types.js';
|
|
4
5
|
import type { HeaderState, HeaderStore } from './types.js';
|
|
@@ -30,13 +31,45 @@ export function useHeaderStoreContext() {
|
|
|
30
31
|
return useStore;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
export function useHeaderStore<T>(
|
|
34
|
+
export function useHeaderStore<T>(
|
|
35
|
+
selector: (state: HeaderState) => T,
|
|
36
|
+
equalityCheck?: (objA: T, objB: T) => boolean,
|
|
37
|
+
): T {
|
|
34
38
|
const useStore = useHeaderStoreContext();
|
|
35
|
-
return useStore(selector);
|
|
39
|
+
return useStore(selector, equalityCheck);
|
|
36
40
|
}
|
|
41
|
+
|
|
42
|
+
// We use fixed position on the header when Widget is in Full Height layout.
|
|
43
|
+
// We do this to get it to work like the sticky header does in the other layout modes.
|
|
44
|
+
// As the header is position fixed its not in the document flow anymore.
|
|
45
|
+
// To prevent the remaining page content from appearing behind the header we need to
|
|
46
|
+
// pass the headers height so that the position of the page content can be adjusted
|
|
47
|
+
export function useHeaderHeight() {
|
|
48
|
+
const [headerHeight] = useHeaderStore(
|
|
49
|
+
(state) => [state.headerHeight],
|
|
50
|
+
shallow,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
headerHeight,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function useSetHeaderHeight() {
|
|
59
|
+
const [setHeaderHeight] = useHeaderStore(
|
|
60
|
+
(state) => [state.setHeaderHeight],
|
|
61
|
+
shallow,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
setHeaderHeight,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
37
69
|
export const createHeaderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
38
70
|
createWithEqualityFn<HeaderState>(
|
|
39
71
|
(set, get) => ({
|
|
72
|
+
headerHeight: 108, // a basic default height
|
|
40
73
|
setAction: (element) => {
|
|
41
74
|
set(() => ({
|
|
42
75
|
element,
|
|
@@ -59,6 +92,11 @@ export const createHeaderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
59
92
|
title: undefined,
|
|
60
93
|
}));
|
|
61
94
|
},
|
|
95
|
+
setHeaderHeight: (headerHeight) => {
|
|
96
|
+
set(() => ({
|
|
97
|
+
headerHeight,
|
|
98
|
+
}));
|
|
99
|
+
},
|
|
62
100
|
}),
|
|
63
101
|
Object.is,
|
|
64
102
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useAccount } from '@lifi/wallet-management';
|
|
2
1
|
import { shallow } from 'zustand/shallow';
|
|
2
|
+
import { useAccount } from '../../hooks/useAccount.js';
|
|
3
3
|
import { useRouteExecutionStore } from './RouteExecutionStore.js';
|
|
4
4
|
import type { RouteExecution } from './types.js';
|
|
5
5
|
import { RouteExecutionStatus } from './types.js';
|
package/stores/settings/types.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface SettingsState extends SettingsProps {
|
|
|
40
40
|
reset?: boolean,
|
|
41
41
|
): void;
|
|
42
42
|
setToolValue(toolType: SettingsToolType, tool: string, value: boolean): void;
|
|
43
|
-
|
|
43
|
+
toggleToolKeys(toolType: SettingsToolType, toolKeys: string[]): void;
|
|
44
44
|
reset(bridges: string[], exchanges: string[]): void;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -99,17 +99,38 @@ export const useSettingsStore = createWithEqualityFn<SettingsState>(
|
|
|
99
99
|
),
|
|
100
100
|
};
|
|
101
101
|
}),
|
|
102
|
-
|
|
102
|
+
toggleToolKeys: (toolType, toolKeys) =>
|
|
103
103
|
set((state) => {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
const allKeysInCollectionEnabled = toolKeys.every(
|
|
105
|
+
(toolKey) => state[`_enabled${toolType}`][toolKey],
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// then toggle those keys to false
|
|
109
|
+
const updatedTools = toolKeys.reduce(
|
|
110
|
+
(accum, toolKey) => {
|
|
111
|
+
accum[toolKey] = !allKeysInCollectionEnabled;
|
|
112
|
+
return accum;
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
...state[`_enabled${toolType}`],
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const enableKeys: string[] = [];
|
|
120
|
+
const disabledKeys: string[] = [];
|
|
121
|
+
|
|
122
|
+
Object.entries(updatedTools).forEach(([key, value]) => {
|
|
123
|
+
if (value) {
|
|
124
|
+
enableKeys.push(key);
|
|
125
|
+
} else {
|
|
126
|
+
disabledKeys.push(key);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
109
130
|
return {
|
|
110
|
-
[`_enabled${toolType}`]:
|
|
111
|
-
[`enabled${toolType}`]:
|
|
112
|
-
[`disabled${toolType}`]:
|
|
131
|
+
[`_enabled${toolType}`]: updatedTools,
|
|
132
|
+
[`enabled${toolType}`]: enableKeys,
|
|
133
|
+
[`disabled${toolType}`]: disabledKeys,
|
|
113
134
|
};
|
|
114
135
|
}),
|
|
115
136
|
reset: (bridges, exchanges) => {
|
package/themes/createTheme.ts
CHANGED
|
@@ -63,7 +63,7 @@ export const createTheme = (
|
|
|
63
63
|
const borderRadiusSecondary =
|
|
64
64
|
widgetTheme.shape?.borderRadiusSecondary ?? shape.borderRadiusSecondary;
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
return createMuiTheme({
|
|
67
67
|
container: widgetTheme.container,
|
|
68
68
|
header: widgetTheme.header,
|
|
69
69
|
navigation: {
|
|
@@ -409,6 +409,4 @@ export const createTheme = (
|
|
|
409
409
|
},
|
|
410
410
|
},
|
|
411
411
|
});
|
|
412
|
-
|
|
413
|
-
return theme;
|
|
414
412
|
};
|
package/types/events.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChainId, ChainType, Process, Route } from '@lifi/sdk';
|
|
2
|
+
import type { NavigationRouteType } from '../utils/navigationRoutes.js';
|
|
2
3
|
|
|
3
4
|
export enum WidgetEvent {
|
|
4
5
|
RouteExecutionStarted = 'routeExecutionStarted',
|
|
@@ -11,12 +12,13 @@ export enum WidgetEvent {
|
|
|
11
12
|
SourceChainTokenSelected = 'sourceChainTokenSelected',
|
|
12
13
|
DestinationChainTokenSelected = 'destinationChainTokenSelected',
|
|
13
14
|
SendToWalletToggled = 'sendToWalletToggled',
|
|
14
|
-
ReviewTransactionPageEntered = 'reviewTransactionPageEntered',
|
|
15
15
|
/**
|
|
16
|
-
* @deprecated
|
|
16
|
+
* @deprecated Use `PageEntered` event instead.
|
|
17
17
|
*/
|
|
18
|
+
ReviewTransactionPageEntered = 'reviewTransactionPageEntered',
|
|
18
19
|
WalletConnected = 'walletConnected',
|
|
19
20
|
WidgetExpanded = 'widgetExpanded',
|
|
21
|
+
PageEntered = 'pageEntered',
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export type WidgetEvents = {
|
|
@@ -31,11 +33,9 @@ export type WidgetEvents = {
|
|
|
31
33
|
destinationChainTokenSelected: ChainTokenSelected;
|
|
32
34
|
sendToWalletToggled: boolean;
|
|
33
35
|
reviewTransactionPageEntered?: Route;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated use useWalletManagementEvents hook.
|
|
36
|
-
*/
|
|
37
36
|
walletConnected: WalletConnected;
|
|
38
37
|
widgetExpanded: boolean;
|
|
38
|
+
pageEntered: NavigationRouteType;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export interface ContactSupport {
|
package/utils/chainType.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ChainId, ChainType
|
|
1
|
+
import { ChainId, ChainType } from '@lifi/sdk';
|
|
2
2
|
import { isAddress as isEVMAddress } from 'viem';
|
|
3
|
+
import { isSVMAddress } from './svm.js';
|
|
3
4
|
|
|
4
5
|
const chainTypeAddressValidation = {
|
|
5
6
|
[ChainType.EVM]: isEVMAddress,
|
|
6
7
|
[ChainType.SVM]: isSVMAddress,
|
|
7
|
-
[ChainType.UTXO]:
|
|
8
|
+
[ChainType.UTXO]: () => false,
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export const getChainTypeFromAddress = (
|
package/utils/converters.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
TokenAmount,
|
|
9
9
|
ToolsResponse,
|
|
10
10
|
} from '@lifi/sdk';
|
|
11
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
12
|
import { formatUnits } from 'viem';
|
|
12
13
|
import type { RouteExecution } from '../stores/routes/types.js';
|
|
13
14
|
|
|
@@ -144,7 +145,7 @@ export const buildRouteFromTxHistory = (
|
|
|
144
145
|
gasCostUSD: sending.gasAmountUSD,
|
|
145
146
|
steps: [
|
|
146
147
|
{
|
|
147
|
-
id:
|
|
148
|
+
id: uuidv4(),
|
|
148
149
|
type: 'lifi',
|
|
149
150
|
tool: tx.tool,
|
|
150
151
|
toolDetails: usedTool,
|
package/utils/elements.ts
CHANGED
|
@@ -3,8 +3,28 @@ export enum ElementId {
|
|
|
3
3
|
Header = 'widget-header',
|
|
4
4
|
RelativeContainer = 'widget-relative-container',
|
|
5
5
|
ScrollableContainer = 'widget-scrollable-container',
|
|
6
|
-
TokenList = 'token-list',
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
export const createElementId = (ElementId: ElementId, elementId: string) =>
|
|
10
9
|
elementId ? `${ElementId}-${elementId}` : ElementId;
|
|
10
|
+
|
|
11
|
+
// NOTE: The getter functions here are often used with code that can be effected by css changes in the
|
|
12
|
+
// AppExpandedContainer, RelativeContainer and CssBaselineContainer components as defined in AppContainer.ts
|
|
13
|
+
|
|
14
|
+
export const getAppContainer = (elementId: string) =>
|
|
15
|
+
document.getElementById(
|
|
16
|
+
createElementId(ElementId.AppExpandedContainer, elementId),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const getRelativeContainer = (elementId: string) =>
|
|
20
|
+
document.getElementById(
|
|
21
|
+
createElementId(ElementId.RelativeContainer, elementId),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const getScrollableContainer = (elementId: string) =>
|
|
25
|
+
document.getElementById(
|
|
26
|
+
createElementId(ElementId.ScrollableContainer, elementId),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const getHeaderElement = (elementId: string) =>
|
|
30
|
+
document.getElementById(createElementId(ElementId.Header, elementId));
|
package/utils/fees.ts
CHANGED
|
@@ -104,22 +104,20 @@ export const getFeeCostsBreakdown = (
|
|
|
104
104
|
export const getStepFeeCostsBreakdown = (
|
|
105
105
|
feeCosts: FeeCost[] | GasCost[],
|
|
106
106
|
): FeesBreakdown => {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{ amount: 0n, amountUSD: 0 },
|
|
107
|
+
const token = feeCosts[0].token;
|
|
108
|
+
const amount = feeCosts.reduce(
|
|
109
|
+
(amount, feeCost) => amount + BigInt(feeCost.amount || 0),
|
|
110
|
+
0n,
|
|
111
|
+
);
|
|
112
|
+
const amountUSD = feeCosts.reduce(
|
|
113
|
+
(amount, feeCost) =>
|
|
114
|
+
amount +
|
|
115
|
+
parseFloat(feeCost.token.priceUSD || '0') *
|
|
116
|
+
parseFloat(
|
|
117
|
+
formatUnits(BigInt(feeCost.amount || 0), feeCost.token.decimals),
|
|
118
|
+
),
|
|
119
|
+
0,
|
|
121
120
|
);
|
|
122
|
-
|
|
123
121
|
return {
|
|
124
122
|
amount,
|
|
125
123
|
amountUSD,
|
package/utils/format.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function formatInputAmount(
|
|
|
60
60
|
if (!amount) {
|
|
61
61
|
return amount;
|
|
62
62
|
}
|
|
63
|
-
let formattedAmount = amount.replaceAll(',', '.');
|
|
63
|
+
let formattedAmount = amount.trim().replaceAll(',', '.');
|
|
64
64
|
if (formattedAmount.startsWith('.')) {
|
|
65
65
|
formattedAmount = '0' + formattedAmount;
|
|
66
66
|
}
|
|
@@ -7,6 +7,7 @@ export const navigationRoutes = {
|
|
|
7
7
|
fromToken: 'from-token',
|
|
8
8
|
languages: 'languages',
|
|
9
9
|
routes: 'routes',
|
|
10
|
+
selectWallet: 'select-wallet',
|
|
10
11
|
settings: 'settings',
|
|
11
12
|
toChain: 'to-chain',
|
|
12
13
|
toToken: 'to-token',
|
|
@@ -30,6 +31,7 @@ export const stickyHeaderRoutes = [
|
|
|
30
31
|
navigationRoutes.fromChain,
|
|
31
32
|
navigationRoutes.home,
|
|
32
33
|
navigationRoutes.routes,
|
|
34
|
+
navigationRoutes.selectWallet,
|
|
33
35
|
navigationRoutes.settings,
|
|
34
36
|
navigationRoutes.toChain,
|
|
35
37
|
navigationRoutes.toTokenNative,
|
|
@@ -51,6 +53,7 @@ export const backButtonRoutes = [
|
|
|
51
53
|
navigationRoutes.fromChain,
|
|
52
54
|
navigationRoutes.fromToken,
|
|
53
55
|
navigationRoutes.routes,
|
|
56
|
+
navigationRoutes.selectWallet,
|
|
54
57
|
navigationRoutes.settings,
|
|
55
58
|
navigationRoutes.toChain,
|
|
56
59
|
navigationRoutes.toToken,
|
|
@@ -65,4 +68,7 @@ export const backButtonRoutes = [
|
|
|
65
68
|
navigationRoutes.configuredWallets,
|
|
66
69
|
];
|
|
67
70
|
|
|
68
|
-
export type
|
|
71
|
+
export type NavigationRouteTypeKeys = keyof typeof navigationRoutes;
|
|
72
|
+
|
|
73
|
+
export type NavigationRouteType =
|
|
74
|
+
(typeof navigationRoutes)[NavigationRouteTypeKeys];
|
package/utils/svm.ts
ADDED
package/utils/wallet.ts
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const SmallAvatar: import("@emotion/styled").StyledComponent<import("@mui/material").AvatarOwnProps & import("@mui/material").AvatarSlotsAndSlotProps & import("@mui/material/OverridableComponent.js").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
-
}, "children" | "sx" | "style" | "className" | "sizes" | "alt" | "src" | "srcSet" | "classes" | "variant" | "imgProps" | "slots" | "slotProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
4
|
-
export declare const SmallAvatarSkeleton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Avatar, Skeleton, styled } from '@mui/material';
|
|
3
|
-
import { AvatarSkeletonContainer } from './Avatar.style.js';
|
|
4
|
-
export const SmallAvatar = styled(Avatar)(({ theme }) => ({
|
|
5
|
-
background: theme.palette.background.paper,
|
|
6
|
-
width: 16,
|
|
7
|
-
height: 16,
|
|
8
|
-
}));
|
|
9
|
-
export const SmallAvatarSkeleton = () => {
|
|
10
|
-
return (_jsx(AvatarSkeletonContainer, { children: _jsx(Skeleton, { width: 16, height: 16, variant: "circular" }) }));
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=SmallAvatar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmallAvatar.js","sourceRoot":"","sources":["../../../components/Avatar/SmallAvatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACxD,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK;IAC1C,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,CACL,KAAC,uBAAuB,cACtB,KAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAC,UAAU,GAAG,GAC9B,CAC3B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useAccountDisconnect } from '@lifi/wallet-management';
|
|
3
|
-
import { PowerSettingsNewRounded } from '@mui/icons-material';
|
|
4
|
-
import { IconButton } from '@mui/material';
|
|
5
|
-
export const DisconnectIconButton = ({ account }) => {
|
|
6
|
-
const disconnect = useAccountDisconnect();
|
|
7
|
-
return (_jsx(IconButton, { size: "medium", onClick: async (e) => {
|
|
8
|
-
e.stopPropagation();
|
|
9
|
-
await disconnect(account);
|
|
10
|
-
}, children: _jsx(PowerSettingsNewRounded, {}) }));
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=DisconnectIconButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DisconnectIconButton.js","sourceRoot":"","sources":["../../../components/Header/DisconnectIconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAgB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAAwB,EAAE,EAAE;IACxE,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAC1C,OAAO,CACL,KAAC,UAAU,IACT,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,YAED,KAAC,uBAAuB,KAAG,GAChB,CACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useHasExternalWalletProvider } from '../providers/WalletProvider/useHasExternalWalletProvider.js';
|
|
2
|
-
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
|
|
3
|
-
export const minHeaderHeight = 64;
|
|
4
|
-
export const maxHeaderHeight = 108;
|
|
5
|
-
export const maxHeaderHeightSubvariantSplit = 136;
|
|
6
|
-
// We use fixed position on the header when Widget is in Full Height layout.
|
|
7
|
-
// We do this to get it to work like the sticky header does in the other layout modes.
|
|
8
|
-
// As the header is position fixed its not in the document flow anymore.
|
|
9
|
-
// To prevent the remaining page content from appearing behind the header we need to
|
|
10
|
-
// pass the headers height so that the position of the page content can be adjusted
|
|
11
|
-
export const useHeaderHeight = () => {
|
|
12
|
-
const { hiddenUI, subvariant } = useWidgetConfig();
|
|
13
|
-
const { hasExternalProvider } = useHasExternalWalletProvider();
|
|
14
|
-
const headerHeight = subvariant === 'split'
|
|
15
|
-
? maxHeaderHeightSubvariantSplit
|
|
16
|
-
: hiddenUI?.includes('walletMenu') || hasExternalProvider
|
|
17
|
-
? minHeaderHeight
|
|
18
|
-
: maxHeaderHeight;
|
|
19
|
-
return {
|
|
20
|
-
headerHeight,
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=useHeaderHeight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderHeight.js","sourceRoot":"","sources":["../../hooks/useHeaderHeight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6DAA6D,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AACnC,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAElD,4EAA4E;AAC5E,sFAAsF;AACtF,wEAAwE;AACxE,oFAAoF;AACpF,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,CAAC;IACnD,MAAM,EAAE,mBAAmB,EAAE,GAAG,4BAA4B,EAAE,CAAC;IAE/D,MAAM,YAAY,GAChB,UAAU,KAAK,OAAO;QACpB,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,mBAAmB;YACvD,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,eAAe,CAAC;IAExB,OAAO;QACL,YAAY;KACb,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BigmiProvider, createDefaultBigmiConfig, useReconnect, } from '@lifi/wallet-management';
|
|
3
|
-
import { useRef } from 'react';
|
|
4
|
-
export const UTXOBaseProvider = ({ children }) => {
|
|
5
|
-
const bigmi = useRef();
|
|
6
|
-
if (!bigmi.current) {
|
|
7
|
-
bigmi.current = createDefaultBigmiConfig({
|
|
8
|
-
bigmiConfig: {
|
|
9
|
-
ssr: true,
|
|
10
|
-
multiInjectedProviderDiscovery: false,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
useReconnect(bigmi.current.config);
|
|
15
|
-
return (_jsx(BigmiProvider, { config: bigmi.current.config, reconnectOnMount: false, children: children }));
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=UTXOBaseProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UTXOBaseProvider.js","sourceRoot":"","sources":["../../../providers/WalletProvider/UTXOBaseProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAmC,MAAM,OAAO,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtE,MAAM,KAAK,GAAG,MAAM,EAA4B,CAAC;IAEjD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,OAAO,GAAG,wBAAwB,CAAC;YACvC,WAAW,EAAE;gBACX,GAAG,EAAE,IAAI;gBACT,8BAA8B,EAAE,KAAK;aACtC;SACF,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,CACL,KAAC,aAAa,IAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,YACjE,QAAQ,GACK,CACjB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const UTXOExternalContext: import("react").Context<boolean>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UTXOExternalContext.js","sourceRoot":"","sources":["../../../providers/WalletProvider/UTXOExternalContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAU,KAAK,CAAC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ChainType } from '@lifi/sdk';
|
|
3
|
-
import { BigmiContext } from '@lifi/wallet-management';
|
|
4
|
-
import { useContext } from 'react';
|
|
5
|
-
import { isItemAllowed } from '../../utils/item.js';
|
|
6
|
-
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
|
|
7
|
-
import { UTXOBaseProvider } from './UTXOBaseProvider.js';
|
|
8
|
-
import { UTXOExternalContext } from './UTXOExternalContext.js';
|
|
9
|
-
export function useInBigmiContext() {
|
|
10
|
-
const { chains } = useWidgetConfig();
|
|
11
|
-
const context = useContext(BigmiContext);
|
|
12
|
-
return Boolean(context) && isItemAllowed(ChainType.UTXO, chains?.types);
|
|
13
|
-
}
|
|
14
|
-
export const UTXOProvider = ({ children }) => {
|
|
15
|
-
const inBigmiContext = useInBigmiContext();
|
|
16
|
-
return inBigmiContext ? (_jsx(UTXOExternalContext.Provider, { value: inBigmiContext, children: children })) : (_jsx(UTXOBaseProvider, { children: children }));
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=UTXOProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UTXOProvider.js","sourceRoot":"","sources":["../../../providers/WalletProvider/UTXOProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAmC,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,UAAU,iBAAiB;IAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAEzC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClE,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,OAAO,cAAc,CAAC,CAAC,CAAC,CACtB,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,YAChD,QAAQ,GACoB,CAChC,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,cAAE,QAAQ,GAAoB,CAChD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Avatar, Skeleton, styled } from '@mui/material';
|
|
2
|
-
import { AvatarSkeletonContainer } from './Avatar.style.js';
|
|
3
|
-
|
|
4
|
-
export const SmallAvatar = styled(Avatar)(({ theme }) => ({
|
|
5
|
-
background: theme.palette.background.paper,
|
|
6
|
-
width: 16,
|
|
7
|
-
height: 16,
|
|
8
|
-
}));
|
|
9
|
-
|
|
10
|
-
export const SmallAvatarSkeleton = () => {
|
|
11
|
-
return (
|
|
12
|
-
<AvatarSkeletonContainer>
|
|
13
|
-
<Skeleton width={16} height={16} variant="circular" />
|
|
14
|
-
</AvatarSkeletonContainer>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useAccountDisconnect, type Account } from '@lifi/wallet-management';
|
|
2
|
-
import { PowerSettingsNewRounded } from '@mui/icons-material';
|
|
3
|
-
import { IconButton } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
export const DisconnectIconButton = ({ account }: { account: Account }) => {
|
|
6
|
-
const disconnect = useAccountDisconnect();
|
|
7
|
-
return (
|
|
8
|
-
<IconButton
|
|
9
|
-
size="medium"
|
|
10
|
-
onClick={async (e) => {
|
|
11
|
-
e.stopPropagation();
|
|
12
|
-
await disconnect(account);
|
|
13
|
-
}}
|
|
14
|
-
>
|
|
15
|
-
<PowerSettingsNewRounded />
|
|
16
|
-
</IconButton>
|
|
17
|
-
);
|
|
18
|
-
};
|
package/hooks/useHeaderHeight.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useHasExternalWalletProvider } from '../providers/WalletProvider/useHasExternalWalletProvider.js';
|
|
2
|
-
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
|
|
3
|
-
|
|
4
|
-
export const minHeaderHeight = 64;
|
|
5
|
-
export const maxHeaderHeight = 108;
|
|
6
|
-
export const maxHeaderHeightSubvariantSplit = 136;
|
|
7
|
-
|
|
8
|
-
// We use fixed position on the header when Widget is in Full Height layout.
|
|
9
|
-
// We do this to get it to work like the sticky header does in the other layout modes.
|
|
10
|
-
// As the header is position fixed its not in the document flow anymore.
|
|
11
|
-
// To prevent the remaining page content from appearing behind the header we need to
|
|
12
|
-
// pass the headers height so that the position of the page content can be adjusted
|
|
13
|
-
export const useHeaderHeight = () => {
|
|
14
|
-
const { hiddenUI, subvariant } = useWidgetConfig();
|
|
15
|
-
const { hasExternalProvider } = useHasExternalWalletProvider();
|
|
16
|
-
|
|
17
|
-
const headerHeight =
|
|
18
|
-
subvariant === 'split'
|
|
19
|
-
? maxHeaderHeightSubvariantSplit
|
|
20
|
-
: hiddenUI?.includes('walletMenu') || hasExternalProvider
|
|
21
|
-
? minHeaderHeight
|
|
22
|
-
: maxHeaderHeight;
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
headerHeight,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { DefaultWagmiConfigResult } from '@lifi/wallet-management';
|
|
2
|
-
import {
|
|
3
|
-
BigmiProvider,
|
|
4
|
-
createDefaultBigmiConfig,
|
|
5
|
-
useReconnect,
|
|
6
|
-
} from '@lifi/wallet-management';
|
|
7
|
-
import { useRef, type FC, type PropsWithChildren } from 'react';
|
|
8
|
-
|
|
9
|
-
export const UTXOBaseProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
10
|
-
const bigmi = useRef<DefaultWagmiConfigResult>();
|
|
11
|
-
|
|
12
|
-
if (!bigmi.current) {
|
|
13
|
-
bigmi.current = createDefaultBigmiConfig({
|
|
14
|
-
bigmiConfig: {
|
|
15
|
-
ssr: true,
|
|
16
|
-
multiInjectedProviderDiscovery: false,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
useReconnect(bigmi.current.config);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<BigmiProvider config={bigmi.current.config} reconnectOnMount={false}>
|
|
25
|
-
{children}
|
|
26
|
-
</BigmiProvider>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ChainType } from '@lifi/sdk';
|
|
2
|
-
import { BigmiContext } from '@lifi/wallet-management';
|
|
3
|
-
import { useContext, type FC, type PropsWithChildren } from 'react';
|
|
4
|
-
import { isItemAllowed } from '../../utils/item.js';
|
|
5
|
-
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
|
|
6
|
-
import { UTXOBaseProvider } from './UTXOBaseProvider.js';
|
|
7
|
-
import { UTXOExternalContext } from './UTXOExternalContext.js';
|
|
8
|
-
|
|
9
|
-
export function useInBigmiContext(): boolean {
|
|
10
|
-
const { chains } = useWidgetConfig();
|
|
11
|
-
const context = useContext(BigmiContext);
|
|
12
|
-
|
|
13
|
-
return Boolean(context) && isItemAllowed(ChainType.UTXO, chains?.types);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const UTXOProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
17
|
-
const inBigmiContext = useInBigmiContext();
|
|
18
|
-
|
|
19
|
-
return inBigmiContext ? (
|
|
20
|
-
<UTXOExternalContext.Provider value={inBigmiContext}>
|
|
21
|
-
{children}
|
|
22
|
-
</UTXOExternalContext.Provider>
|
|
23
|
-
) : (
|
|
24
|
-
<UTXOBaseProvider>{children}</UTXOBaseProvider>
|
|
25
|
-
);
|
|
26
|
-
};
|