@lifi/widget 3.24.3 → 3.25.0-beta.1
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/dist/esm/AppDefault.js +3 -3
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppDrawer.style.d.ts +1 -1
- package/dist/esm/AppProvider.js +2 -2
- package/dist/esm/AppProvider.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.js +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -1
- package/dist/esm/components/AppContainer.js +6 -13
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js.map +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -1
- package/dist/esm/components/Card/CardButton.style.js +1 -1
- package/dist/esm/components/Card/CardButton.style.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +1 -1
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +1 -1
- package/dist/esm/components/Card/CardLabel.js +1 -1
- package/dist/esm/components/Card/CardLabel.js.map +1 -1
- package/dist/esm/components/Card/CardTitle.js +1 -1
- package/dist/esm/components/Card/CardTitle.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.js +13 -2
- package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.d.ts +13 -0
- package/dist/esm/components/Chains/ChainList.js +17 -0
- package/dist/esm/components/Chains/ChainList.js.map +1 -0
- package/dist/esm/components/Chains/ChainList.style.d.ts +14 -0
- package/dist/esm/components/Chains/ChainList.style.js +38 -0
- package/dist/esm/components/Chains/ChainList.style.js.map +1 -0
- package/dist/esm/components/Chains/ChainListItem.d.ts +11 -0
- package/dist/esm/components/Chains/ChainListItem.js +11 -0
- package/dist/esm/components/Chains/ChainListItem.js.map +1 -0
- package/dist/esm/components/Chains/ChainSearchInput.d.ts +10 -0
- package/dist/esm/components/Chains/ChainSearchInput.js +19 -0
- package/dist/esm/components/Chains/ChainSearchInput.js.map +1 -0
- package/dist/esm/components/Chains/ChainsExpanded.d.ts +7 -0
- package/dist/esm/components/Chains/ChainsExpanded.js +11 -0
- package/dist/esm/components/Chains/ChainsExpanded.js.map +1 -0
- package/dist/esm/components/Chains/ChainsExpanded.style.d.ts +6 -0
- package/dist/esm/components/Chains/ChainsExpanded.style.js +16 -0
- package/dist/esm/components/Chains/ChainsExpanded.style.js.map +1 -0
- package/dist/esm/components/Chains/SelectChainContent.d.ts +9 -0
- package/dist/esm/components/Chains/SelectChainContent.js +60 -0
- package/dist/esm/components/Chains/SelectChainContent.js.map +1 -0
- package/dist/esm/components/Chains/VirtualizedChainList.d.ts +11 -0
- package/dist/esm/components/Chains/VirtualizedChainList.js +40 -0
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -0
- package/dist/esm/components/Expansion/Expansion.d.ts +1 -0
- package/dist/esm/components/Expansion/Expansion.js +41 -0
- package/dist/esm/components/Expansion/Expansion.js.map +1 -0
- package/dist/esm/components/Expansion/ExpansionTransition.d.ts +9 -0
- package/dist/esm/components/Expansion/ExpansionTransition.js +45 -0
- package/dist/esm/components/Expansion/ExpansionTransition.js.map +1 -0
- package/dist/esm/components/Header/Header.js +1 -1
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/Header.style.d.ts +1 -1
- package/dist/esm/components/Header/Header.style.js +0 -1
- package/dist/esm/components/Header/Header.style.js.map +1 -1
- package/dist/esm/components/Header/NavigationHeader.js +2 -2
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.d.ts +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js.map +1 -1
- package/dist/esm/components/ListItem/ListItem.js +1 -1
- package/dist/esm/components/ListItem/ListItem.js.map +1 -1
- package/dist/esm/components/ListItemButton.js +13 -1
- package/dist/esm/components/ListItemButton.js.map +1 -1
- package/dist/esm/components/ListItemText.js +1 -1
- package/dist/esm/components/ListItemText.js.map +1 -1
- package/dist/esm/components/ProgressToNextUpdate.js +1 -1
- package/dist/esm/components/ProgressToNextUpdate.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCard.js +4 -4
- package/dist/esm/components/RouteCard/RouteCard.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardEssentials.js +5 -5
- package/dist/esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteNotFoundCard.js +1 -0
- package/dist/esm/components/RouteCard/RouteNotFoundCard.js.map +1 -1
- package/dist/esm/components/RouteCard/getMatchingLabels.js +5 -3
- package/dist/esm/components/RouteCard/getMatchingLabels.js.map +1 -1
- package/dist/esm/components/Routes/Routes.js +1 -1
- package/dist/esm/components/Routes/Routes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.d.ts +14 -0
- package/dist/esm/components/Routes/RoutesContent.js +55 -0
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -0
- package/dist/esm/components/Routes/RoutesExpanded.d.ts +7 -2
- package/dist/esm/components/Routes/RoutesExpanded.js +12 -70
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.d.ts +1 -3
- package/dist/esm/components/Routes/RoutesExpanded.style.js +4 -16
- package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.d.ts +5 -2
- package/dist/esm/components/Search/SearchInput.js +7 -3
- package/dist/esm/components/Search/SearchInput.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.style.d.ts +4 -1
- package/dist/esm/components/Search/SearchInput.style.js +25 -3
- package/dist/esm/components/Search/SearchInput.style.js.map +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.js +2 -1
- package/dist/esm/components/Search/SearchNotFound.style.js.map +1 -1
- package/dist/esm/components/Select.js +1 -1
- package/dist/esm/components/Select.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +2 -7
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +2 -2
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js +0 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.style.js +1 -1
- package/dist/esm/components/Step/CircularProgress.style.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.js +3 -3
- package/dist/esm/components/StepActions/StepActions.style.js +1 -1
- package/dist/esm/components/StepActions/StepActions.style.js.map +1 -1
- package/dist/esm/components/TextFitter/TextFitter.js +1 -1
- package/dist/esm/components/TextFitter/TextFitter.js.map +1 -1
- package/dist/esm/components/Token/Token.js +2 -2
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/Token/Token.style.js +1 -1
- package/dist/esm/components/Token/Token.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.js +3 -3
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.style.d.ts +2 -1
- package/dist/esm/components/TokenList/TokenList.style.js +6 -1
- package/dist/esm/components/TokenList/TokenList.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js +16 -7
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +13 -7
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +3 -0
- package/dist/esm/components/TokenRate/TokenRate.js +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.js +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.js.map +1 -1
- package/dist/esm/components/TransactionDetails.js +7 -9
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/timer/time.js +1 -1
- package/dist/esm/hooks/timer/time.js.map +1 -1
- package/dist/esm/hooks/timer/useTimer.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.js +3 -2
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useChains.js +4 -4
- package/dist/esm/hooks/useChains.js.map +1 -1
- package/dist/esm/hooks/useExpansionRoutes.d.ts +2 -0
- package/dist/esm/hooks/useExpansionRoutes.js +26 -0
- package/dist/esm/hooks/useExpansionRoutes.js.map +1 -0
- package/dist/esm/hooks/useHasChainExpansion.d.ts +2 -0
- package/dist/esm/hooks/useHasChainExpansion.js +16 -0
- package/dist/esm/hooks/useHasChainExpansion.js.map +1 -0
- package/dist/esm/hooks/useIsBatchingSupported.js +4 -1
- package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
- package/dist/esm/hooks/useListHeight.js +1 -1
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.js +3 -3
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +6 -3
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressReset.js +10 -2
- package/dist/esm/hooks/useToAddressReset.js.map +1 -1
- package/dist/esm/hooks/useTokenBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js +1 -0
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +6 -4
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +5 -3
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js +5 -3
- package/dist/esm/hooks/useTools.js.map +1 -1
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useWidgetEvents.js.map +1 -1
- package/dist/esm/i18n/bn.json +2 -1
- package/dist/esm/i18n/de.json +2 -1
- package/dist/esm/i18n/en.json +2 -1
- package/dist/esm/i18n/es.json +2 -1
- package/dist/esm/i18n/fr.json +2 -1
- package/dist/esm/i18n/hi.json +1 -0
- package/dist/esm/i18n/id.json +2 -1
- package/dist/esm/i18n/it.json +2 -1
- package/dist/esm/i18n/ja.json +2 -1
- package/dist/esm/i18n/ko.json +2 -1
- package/dist/esm/i18n/pl.json +350 -0
- package/dist/esm/i18n/pt.json +2 -1
- package/dist/esm/i18n/th.json +2 -1
- package/dist/esm/i18n/tr.json +2 -1
- package/dist/esm/i18n/uk.json +14 -13
- package/dist/esm/i18n/vi.json +2 -1
- package/dist/esm/i18n/zh.json +2 -1
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +8 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js +7 -33
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +20 -11
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +2 -2
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +1 -3
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js +8 -5
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.js +2 -2
- package/dist/esm/pages/TransactionPage/RouteTracker.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +4 -4
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js +8 -4
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/QueryClientProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.js +1 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +5 -3
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/form/FormStore.js +1 -1
- package/dist/esm/stores/form/FormStore.js.map +1 -1
- package/dist/esm/stores/form/FormUpdater.js +21 -5
- package/dist/esm/stores/form/FormUpdater.js.map +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/dist/esm/stores/form/useFormRef.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
- package/dist/esm/types/widget.d.ts +25 -6
- package/dist/esm/types/widget.js +6 -0
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/deepEqual.js +2 -2
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/item.d.ts +5 -15
- package/dist/esm/utils/item.js +23 -19
- package/dist/esm/utils/item.js.map +1 -1
- package/dist/esm/utils/widgetSize.d.ts +3 -0
- package/dist/esm/utils/widgetSize.js +11 -0
- package/dist/esm/utils/widgetSize.js.map +1 -0
- package/package.json +7 -6
- package/package.json.tmp +12 -6
- package/src/AppDefault.tsx +3 -3
- package/src/AppProvider.tsx +2 -2
- package/src/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
- package/src/components/AmountInput/AmountInput.style.tsx +1 -1
- package/src/components/AppContainer.tsx +6 -14
- package/src/components/Avatar/Avatar.style.tsx +2 -2
- package/src/components/Card/CardButton.style.tsx +1 -1
- package/src/components/Card/CardHeader.tsx +1 -1
- package/src/components/Card/CardLabel.tsx +1 -1
- package/src/components/Card/CardTitle.tsx +1 -1
- package/src/components/ChainSelect/ChainSelect.tsx +1 -1
- package/src/components/ChainSelect/useChainSelect.ts +37 -23
- package/src/components/Chains/ChainList.style.tsx +59 -0
- package/src/components/Chains/ChainList.tsx +86 -0
- package/src/components/Chains/ChainListItem.tsx +52 -0
- package/src/components/Chains/ChainSearchInput.tsx +52 -0
- package/src/components/Chains/ChainsExpanded.style.tsx +21 -0
- package/src/components/Chains/ChainsExpanded.tsx +28 -0
- package/src/components/Chains/SelectChainContent.tsx +116 -0
- package/src/components/Chains/VirtualizedChainList.tsx +84 -0
- package/src/components/Expansion/Expansion.tsx +62 -0
- package/src/components/Expansion/ExpansionTransition.tsx +76 -0
- package/src/components/Header/Header.style.ts +0 -1
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/NavigationHeader.tsx +2 -2
- package/src/components/Header/SettingsButton.style.tsx +1 -1
- package/src/components/ListItem/ListItem.tsx +1 -1
- package/src/components/ListItemButton.tsx +17 -1
- package/src/components/ListItemText.tsx +1 -1
- package/src/components/ProgressToNextUpdate.tsx +1 -1
- package/src/components/RouteCard/RouteCard.tsx +4 -4
- package/src/components/RouteCard/RouteCardEssentials.tsx +5 -5
- package/src/components/RouteCard/RouteNotFoundCard.tsx +1 -0
- package/src/components/RouteCard/getMatchingLabels.ts +11 -3
- package/src/components/Routes/Routes.tsx +1 -1
- package/src/components/Routes/RoutesContent.tsx +137 -0
- package/src/components/Routes/RoutesExpanded.style.ts +4 -18
- package/src/components/Routes/RoutesExpanded.tsx +33 -158
- package/src/components/Search/SearchInput.style.tsx +36 -3
- package/src/components/Search/SearchInput.tsx +31 -5
- package/src/components/Search/SearchNotFound.style.tsx +2 -1
- package/src/components/Select.tsx +1 -1
- package/src/components/SelectTokenButton/SelectTokenButton.style.tsx +1 -1
- package/src/components/SendToWallet/SendToWalletButton.tsx +2 -3
- package/src/components/Skeleton/WidgetSkeleton.style.tsx +0 -1
- package/src/components/Step/CircularProgress.style.tsx +1 -1
- package/src/components/StepActions/StepActions.style.tsx +1 -1
- package/src/components/StepActions/StepActions.tsx +3 -3
- package/src/components/TextFitter/TextFitter.tsx +1 -1
- package/src/components/Token/Token.style.tsx +1 -1
- package/src/components/Token/Token.tsx +2 -2
- package/src/components/TokenList/TokenDetailsSheet.tsx +1 -0
- package/src/components/TokenList/TokenDetailsSheetContent.style.tsx +1 -1
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +1 -1
- package/src/components/TokenList/TokenList.style.tsx +11 -1
- package/src/components/TokenList/TokenList.tsx +6 -2
- package/src/components/TokenList/TokenListItem.tsx +53 -37
- package/src/components/TokenList/VirtualizedTokenList.tsx +17 -5
- package/src/components/TokenList/types.ts +3 -0
- package/src/components/TokenRate/TokenRate.style.ts +1 -1
- package/src/components/TokenRate/TokenRate.tsx +1 -1
- package/src/components/TransactionDetails.tsx +9 -9
- package/src/config/version.ts +1 -1
- package/src/hooks/timer/time.ts +1 -1
- package/src/hooks/timer/useTimer.ts +1 -1
- package/src/hooks/useAvailableChains.ts +8 -2
- package/src/hooks/useChains.ts +10 -4
- package/src/hooks/useExpansionRoutes.ts +29 -0
- package/src/hooks/useHasChainExpansion.ts +19 -0
- package/src/hooks/useIsBatchingSupported.ts +5 -2
- package/src/hooks/useListHeight.ts +1 -1
- package/src/hooks/useRouteExecution.ts +3 -3
- package/src/hooks/useRoutes.ts +8 -2
- package/src/hooks/useToAddressReset.ts +32 -21
- package/src/hooks/useTokenBalance.ts +1 -1
- package/src/hooks/useTokenBalances.ts +1 -0
- package/src/hooks/useTokenSearch.ts +23 -6
- package/src/hooks/useTokens.ts +16 -6
- package/src/hooks/useTools.ts +12 -4
- package/src/hooks/useTransactionDetails.ts +1 -1
- package/src/hooks/useWidgetEvents.ts +1 -0
- package/src/i18n/bn.json +2 -1
- package/src/i18n/de.json +2 -1
- package/src/i18n/en.json +2 -1
- package/src/i18n/es.json +2 -1
- package/src/i18n/fr.json +2 -1
- package/src/i18n/hi.json +1 -0
- package/src/i18n/id.json +2 -1
- package/src/i18n/it.json +2 -1
- package/src/i18n/ja.json +2 -1
- package/src/i18n/ko.json +2 -1
- package/src/i18n/pl.json +350 -0
- package/src/i18n/pt.json +2 -1
- package/src/i18n/th.json +2 -1
- package/src/i18n/tr.json +2 -1
- package/src/i18n/uk.json +14 -13
- package/src/i18n/vi.json +2 -1
- package/src/i18n/zh.json +2 -1
- package/src/index.ts +8 -8
- package/src/pages/RoutesPage/RoutesPage.tsx +1 -1
- package/src/pages/SelectChainPage/SelectChainPage.tsx +18 -71
- package/src/pages/SelectEnabledToolsPage.tsx +1 -1
- package/src/pages/SelectTokenPage/SearchTokenInput.tsx +2 -0
- package/src/pages/SelectTokenPage/SelectTokenPage.tsx +44 -22
- package/src/pages/SendToWallet/BookmarksPage.tsx +1 -1
- package/src/pages/SendToWallet/SendToWalletPage.style.tsx +3 -3
- package/src/pages/SettingsPage/SettingsCard/SettingCard.style.tsx +1 -1
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +1 -1
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +1 -1
- package/src/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +12 -7
- package/src/pages/TransactionPage/RouteTracker.tsx +2 -2
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +4 -4
- package/src/providers/I18nProvider/I18nProvider.tsx +10 -4
- package/src/providers/QueryClientProvider.tsx +1 -1
- package/src/providers/WalletProvider/SDKProviders.tsx +1 -1
- package/src/providers/WalletProvider/SuiBaseProvider.tsx +1 -1
- package/src/providers/WalletProvider/WalletProvider.tsx +1 -1
- package/src/providers/WalletProvider/useExternalWalletProvider.ts +1 -1
- package/src/stores/chains/ChainOrderStore.tsx +8 -3
- package/src/stores/form/FormStore.tsx +1 -1
- package/src/stores/form/FormUpdater.tsx +40 -6
- package/src/stores/form/URLSearchParamsBuilder.tsx +1 -1
- package/src/stores/form/useFormRef.ts +50 -54
- package/src/stores/routes/createRouteExecutionStore.ts +1 -1
- package/src/stores/settings/useSettingsStore.ts +1 -0
- package/src/types/widget.ts +29 -6
- package/src/utils/deepEqual.ts +2 -2
- package/src/utils/item.ts +46 -40
- package/src/utils/widgetSize.ts +17 -0
|
@@ -5,10 +5,10 @@ import CheckBoxOutlined from '@mui/icons-material/CheckBoxOutlined'
|
|
|
5
5
|
import IndeterminateCheckBoxOutlined from '@mui/icons-material/IndeterminateCheckBoxOutlined'
|
|
6
6
|
import {
|
|
7
7
|
Avatar,
|
|
8
|
+
debounce,
|
|
8
9
|
IconButton,
|
|
9
10
|
ListItemAvatar,
|
|
10
11
|
Tooltip,
|
|
11
|
-
debounce,
|
|
12
12
|
useTheme,
|
|
13
13
|
} from '@mui/material'
|
|
14
14
|
import type { MouseEventHandler } from 'react'
|
|
@@ -24,7 +24,9 @@ export const SearchTokenInput = () => {
|
|
|
24
24
|
placeholder={t('main.tokenSearch')}
|
|
25
25
|
onChange={(e) => onChange((e.target as HTMLInputElement).value)}
|
|
26
26
|
onBlur={onBlur}
|
|
27
|
+
onClear={() => setFieldValue('tokenSearchFilter', '')}
|
|
27
28
|
value={value as string | undefined}
|
|
29
|
+
autoFocus
|
|
28
30
|
/>
|
|
29
31
|
)
|
|
30
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Box } from '@mui/material'
|
|
2
|
-
import type { FC } from 'react'
|
|
2
|
+
import type { FC, RefObject } from 'react'
|
|
3
3
|
import { useRef } from 'react'
|
|
4
4
|
import { useTranslation } from 'react-i18next'
|
|
5
5
|
import { ChainSelect } from '../../components/ChainSelect/ChainSelect.js'
|
|
@@ -10,24 +10,22 @@ import { useListHeight } from '../../hooks/useListHeight.js'
|
|
|
10
10
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js'
|
|
11
11
|
import { useScrollableOverflowHidden } from '../../hooks/useScrollableContainer.js'
|
|
12
12
|
import { useSwapOnly } from '../../hooks/useSwapOnly.js'
|
|
13
|
+
import { useWideVariant } from '../../hooks/useWideVariant.js'
|
|
13
14
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
14
|
-
import type { FormTypeProps } from '../../stores/form/types.js'
|
|
15
|
+
import type { FormType, FormTypeProps } from '../../stores/form/types.js'
|
|
15
16
|
import { HiddenUI } from '../../types/widget.js'
|
|
16
17
|
import { SearchTokenInput } from './SearchTokenInput.js'
|
|
17
18
|
|
|
18
19
|
export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
|
|
19
20
|
useScrollableOverflowHidden()
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
const headerRef = useRef<HTMLElement>(null)
|
|
22
|
-
const listParentRef = useRef<HTMLUListElement | null>(null)
|
|
23
|
-
const { listHeight, minListHeight } = useListHeight({
|
|
24
|
-
listParentRef,
|
|
25
|
-
headerRef,
|
|
26
|
-
})
|
|
27
23
|
|
|
28
24
|
const swapOnly = useSwapOnly()
|
|
29
25
|
|
|
30
|
-
const { subvariant, hiddenUI } = useWidgetConfig()
|
|
26
|
+
const { subvariant, hiddenUI, subvariantOptions } = useWidgetConfig()
|
|
27
|
+
const wideVariant = useWideVariant()
|
|
28
|
+
|
|
31
29
|
const { t } = useTranslation()
|
|
32
30
|
const title =
|
|
33
31
|
formType === 'from'
|
|
@@ -39,7 +37,9 @@ export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
|
|
|
39
37
|
useHeader(title)
|
|
40
38
|
|
|
41
39
|
const hideChainSelect =
|
|
42
|
-
(
|
|
40
|
+
(wideVariant && (subvariantOptions?.wide?.enableChainSidebar ?? true)) ||
|
|
41
|
+
(swapOnly && formType === 'to') ||
|
|
42
|
+
hiddenUI?.includes(HiddenUI.ChainSelect)
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<FullPageContainer disableGutters>
|
|
@@ -59,18 +59,40 @@ export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
|
|
|
59
59
|
<SearchTokenInput />
|
|
60
60
|
</Box>
|
|
61
61
|
</Box>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
parentRef={listParentRef}
|
|
69
|
-
height={listHeight}
|
|
70
|
-
onClick={navigateBack}
|
|
71
|
-
formType={formType}
|
|
72
|
-
/>
|
|
73
|
-
</Box>
|
|
62
|
+
<WrappedTokenList
|
|
63
|
+
// Rerender component if variant changes (since chains tiles change height)
|
|
64
|
+
key={hideChainSelect ? 'without-offset' : 'with-offset'}
|
|
65
|
+
headerRef={headerRef}
|
|
66
|
+
formType={formType}
|
|
67
|
+
/>
|
|
74
68
|
</FullPageContainer>
|
|
75
69
|
)
|
|
76
70
|
}
|
|
71
|
+
|
|
72
|
+
type WrappedTokenListProps = {
|
|
73
|
+
headerRef: RefObject<HTMLElement | null>
|
|
74
|
+
formType: FormType
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const WrappedTokenList = ({ headerRef, formType }: WrappedTokenListProps) => {
|
|
78
|
+
const { navigateBack } = useNavigateBack()
|
|
79
|
+
const listParentRef = useRef<HTMLUListElement | null>(null)
|
|
80
|
+
const { listHeight, minListHeight } = useListHeight({
|
|
81
|
+
listParentRef,
|
|
82
|
+
headerRef,
|
|
83
|
+
})
|
|
84
|
+
return (
|
|
85
|
+
<Box
|
|
86
|
+
sx={{
|
|
87
|
+
height: minListHeight,
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<TokenList
|
|
91
|
+
parentRef={listParentRef}
|
|
92
|
+
height={listHeight}
|
|
93
|
+
onClick={navigateBack}
|
|
94
|
+
formType={formType}
|
|
95
|
+
/>
|
|
96
|
+
</Box>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -9,8 +9,8 @@ import { useTranslation } from 'react-i18next'
|
|
|
9
9
|
import { useNavigate } from 'react-router-dom'
|
|
10
10
|
import { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'
|
|
11
11
|
import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
|
|
12
|
-
import { ListItemButton } from '../../components/ListItem//ListItemButton.js'
|
|
13
12
|
import { ListItem } from '../../components/ListItem/ListItem.js'
|
|
13
|
+
import { ListItemButton } from '../../components/ListItem//ListItemButton.js'
|
|
14
14
|
import { Menu } from '../../components/Menu.js'
|
|
15
15
|
import { useExplorer } from '../../hooks/useExplorer.js'
|
|
16
16
|
import { useHeader } from '../../hooks/useHeader.js'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Alert,
|
|
3
|
+
alertClasses,
|
|
3
4
|
Box,
|
|
4
5
|
IconButton,
|
|
5
|
-
List,
|
|
6
|
-
Typography,
|
|
7
|
-
alertClasses,
|
|
8
6
|
inputBaseClasses,
|
|
7
|
+
List,
|
|
9
8
|
styled,
|
|
9
|
+
Typography,
|
|
10
10
|
} from '@mui/material'
|
|
11
11
|
import { ButtonTertiary } from '../../components/ButtonTertiary.js'
|
|
12
12
|
import { InputCard } from '../../components/Card/InputCard.js'
|
|
@@ -37,9 +37,9 @@ export const SettingCardExpandable: React.FC<
|
|
|
37
37
|
</CardTitleContainer>
|
|
38
38
|
{!expanded && value}
|
|
39
39
|
</CardRowButton>
|
|
40
|
+
{/** biome-ignore lint/a11y/useSemanticElements: allowed in react */}
|
|
40
41
|
<Collapse
|
|
41
42
|
id={collapseId}
|
|
42
|
-
// biome-ignore lint/a11y/useSemanticElements:
|
|
43
43
|
role="region"
|
|
44
44
|
aria-labelledby={buttonId}
|
|
45
45
|
in={expanded}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Percent from '@mui/icons-material/Percent'
|
|
2
2
|
import WarningRounded from '@mui/icons-material/WarningRounded'
|
|
3
|
-
import { Box,
|
|
3
|
+
import { Box, debounce, Typography } from '@mui/material'
|
|
4
4
|
import type { ChangeEventHandler, FocusEventHandler } from 'react'
|
|
5
5
|
import { useCallback, useMemo, useRef, useState } from 'react'
|
|
6
6
|
import { useTranslation } from 'react-i18next'
|
|
@@ -2,17 +2,16 @@ import type { FullStatusData } from '@lifi/sdk'
|
|
|
2
2
|
import { Box, List } from '@mui/material'
|
|
3
3
|
import { useVirtualizer } from '@tanstack/react-virtual'
|
|
4
4
|
import type React from 'react'
|
|
5
|
-
import { useRef } from 'react'
|
|
5
|
+
import { useCallback, useRef } from 'react'
|
|
6
6
|
import { useTranslation } from 'react-i18next'
|
|
7
7
|
import { PageContainer } from '../../components/PageContainer.js'
|
|
8
8
|
import { useHeader } from '../../hooks/useHeader.js'
|
|
9
|
-
import { useTransactionHistory } from '../../hooks/useTransactionHistory.js'
|
|
10
|
-
|
|
11
9
|
import { useListHeight } from '../../hooks/useListHeight.js'
|
|
10
|
+
import { useTransactionHistory } from '../../hooks/useTransactionHistory.js'
|
|
11
|
+
import { minTransactionListHeight } from './constants.js'
|
|
12
12
|
import { TransactionHistoryEmpty } from './TransactionHistoryEmpty.js'
|
|
13
13
|
import { TransactionHistoryItem } from './TransactionHistoryItem.js'
|
|
14
14
|
import { TransactionHistoryItemSkeleton } from './TransactionHistorySkeleton.js'
|
|
15
|
-
import { minTransactionListHeight } from './constants.js'
|
|
16
15
|
|
|
17
16
|
export const TransactionHistoryPage: React.FC = () => {
|
|
18
17
|
// Parent ref and useVirtualizer should be in one file to avoid blank page (0 virtual items) issue
|
|
@@ -26,14 +25,20 @@ export const TransactionHistoryPage: React.FC = () => {
|
|
|
26
25
|
listParentRef: parentRef,
|
|
27
26
|
})
|
|
28
27
|
|
|
28
|
+
const getItemKey = useCallback(
|
|
29
|
+
(index: number) => {
|
|
30
|
+
return `${(transactions[index] as FullStatusData).transactionId}-${index}`
|
|
31
|
+
},
|
|
32
|
+
[transactions]
|
|
33
|
+
)
|
|
34
|
+
|
|
29
35
|
const { getVirtualItems, getTotalSize } = useVirtualizer({
|
|
30
36
|
count: transactions.length,
|
|
31
|
-
overscan:
|
|
37
|
+
overscan: 3,
|
|
32
38
|
paddingEnd: 12,
|
|
33
39
|
getScrollElement: () => parentRef.current,
|
|
34
40
|
estimateSize: () => 186,
|
|
35
|
-
getItemKey
|
|
36
|
-
`${(transactions[index] as FullStatusData).transactionId}-${index}`,
|
|
41
|
+
getItemKey,
|
|
37
42
|
})
|
|
38
43
|
|
|
39
44
|
if (!transactions.length && !isLoading) {
|
|
@@ -33,7 +33,7 @@ export const RouteTracker = ({
|
|
|
33
33
|
* This allows us to query the route using the same tool each time we refresh.
|
|
34
34
|
* The observable and reviewable routes can be the same when we first enter the review page.
|
|
35
35
|
*/
|
|
36
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
36
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: run only when currentRoute changes
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
if (
|
|
39
39
|
observableRouteIdRef.current &&
|
|
@@ -57,7 +57,7 @@ export const RouteTracker = ({
|
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
59
|
<ProgressToNextUpdate
|
|
60
|
-
updatedAt={dataUpdatedAt ||
|
|
60
|
+
updatedAt={dataUpdatedAt || Date.now()}
|
|
61
61
|
timeToUpdate={refetchTime}
|
|
62
62
|
isLoading={isFetching}
|
|
63
63
|
onClick={handleRefetch}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Route } from '@lifi/sdk'
|
|
2
|
-
import {
|
|
2
|
+
import { isRelayerStep } from '@lifi/sdk'
|
|
3
3
|
import WarningRounded from '@mui/icons-material/WarningRounded'
|
|
4
4
|
import { Box, Button, Typography } from '@mui/material'
|
|
5
5
|
import type { RefObject } from 'react'
|
|
@@ -51,7 +51,7 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
|
|
|
51
51
|
getAccumulatedFeeCostsBreakdown(route)
|
|
52
52
|
const fromAmountUSD = Number.parseFloat(route.fromAmountUSD)
|
|
53
53
|
const toAmountUSD = Number.parseFloat(route.toAmountUSD)
|
|
54
|
-
const
|
|
54
|
+
const hasRelayerSupport = route.steps.every(isRelayerStep)
|
|
55
55
|
return (
|
|
56
56
|
<Box
|
|
57
57
|
ref={ref}
|
|
@@ -106,14 +106,14 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
|
|
|
106
106
|
<Typography>{t('main.fees.network')}</Typography>
|
|
107
107
|
<FeeBreakdownTooltip
|
|
108
108
|
gasCosts={gasCosts}
|
|
109
|
-
relayerSupport={
|
|
109
|
+
relayerSupport={hasRelayerSupport}
|
|
110
110
|
>
|
|
111
111
|
<Typography
|
|
112
112
|
sx={{
|
|
113
113
|
fontWeight: 600,
|
|
114
114
|
}}
|
|
115
115
|
>
|
|
116
|
-
{
|
|
116
|
+
{hasRelayerSupport
|
|
117
117
|
? t('main.fees.free')
|
|
118
118
|
: t('format.currency', { value: gasCostUSD })}
|
|
119
119
|
</Typography>
|
|
@@ -7,7 +7,7 @@ import { useSettings } from '../../stores/settings/useSettings.js'
|
|
|
7
7
|
import { compactNumberFormatter } from '../../utils/compactNumberFormatter.js'
|
|
8
8
|
import { currencyExtendedFormatter } from '../../utils/currencyExtendedFormatter.js'
|
|
9
9
|
import { deepMerge } from '../../utils/deepMerge.js'
|
|
10
|
-
import {
|
|
10
|
+
import { getConfigItemSets, isItemAllowedForSets } from '../../utils/item.js'
|
|
11
11
|
import { percentFormatter } from '../../utils/percentFormatter.js'
|
|
12
12
|
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
13
13
|
import type { LanguageKey, LanguageTranslationResources } from './types.js'
|
|
@@ -19,16 +19,22 @@ export const I18nProvider: React.FC<React.PropsWithChildren> = ({
|
|
|
19
19
|
const { language } = useSettings(['language'])
|
|
20
20
|
|
|
21
21
|
const i18n = useMemo(() => {
|
|
22
|
+
const languagesConfigSets = getConfigItemSets(
|
|
23
|
+
languages,
|
|
24
|
+
(languages) => new Set(languages)
|
|
25
|
+
)
|
|
22
26
|
let resources = (Object.keys(supportedLanguages) as LanguageKey[])
|
|
23
|
-
.filter((lng) =>
|
|
27
|
+
.filter((lng) => isItemAllowedForSets(lng, languagesConfigSets))
|
|
24
28
|
.reduce((resources, lng) => {
|
|
25
29
|
resources[lng] = {
|
|
26
30
|
translation: languageResources?.[lng]
|
|
27
31
|
? (deepMerge(
|
|
32
|
+
// biome-ignore lint/performance/noDynamicNamespaceImportAccess: TODO: make it dynamic
|
|
28
33
|
supportedLanguages[lng],
|
|
29
34
|
languageResources[lng]
|
|
30
|
-
) as
|
|
31
|
-
:
|
|
35
|
+
) as LanguageTranslationResources)
|
|
36
|
+
: // biome-ignore lint/performance/noDynamicNamespaceImportAccess: TODO: make it dynamic
|
|
37
|
+
supportedLanguages[lng],
|
|
32
38
|
}
|
|
33
39
|
return resources
|
|
34
40
|
}, {} as LanguageTranslationResources)
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
QueryClientContext as TanstackQueryClientContext,
|
|
3
3
|
QueryClientProvider as TanstackQueryClientProvider,
|
|
4
4
|
} from '@tanstack/react-query'
|
|
5
|
-
import { useContext } from 'react'
|
|
6
5
|
import type { PropsWithChildren } from 'react'
|
|
6
|
+
import { useContext } from 'react'
|
|
7
7
|
import { queryClient } from '../config/queryClient'
|
|
8
8
|
|
|
9
9
|
export const QueryClientProvider: React.FC<PropsWithChildren> = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getConnectorClient as getBigmiConnectorClient } from '@bigmi/client'
|
|
2
2
|
import { useConfig as useBigmiConfig } from '@bigmi/react'
|
|
3
3
|
import type { SDKProvider } from '@lifi/sdk'
|
|
4
|
-
import { ChainType, EVM, Solana, Sui, UTXO
|
|
4
|
+
import { ChainType, config, EVM, Solana, Sui, UTXO } from '@lifi/sdk'
|
|
5
5
|
import { useCurrentWallet } from '@mysten/dapp-kit'
|
|
6
6
|
import type { SignerWalletAdapter } from '@solana/wallet-adapter-base'
|
|
7
7
|
import { useWallet } from '@solana/wallet-adapter-react'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChainId } from '@lifi/sdk'
|
|
2
2
|
import {
|
|
3
|
+
createNetworkConfig,
|
|
3
4
|
SuiClientProvider,
|
|
4
5
|
WalletProvider,
|
|
5
|
-
createNetworkConfig,
|
|
6
6
|
} from '@mysten/dapp-kit'
|
|
7
7
|
import { getFullnodeUrl } from '@mysten/sui/client'
|
|
8
8
|
import { type FC, type PropsWithChildren, useMemo } from 'react'
|
|
@@ -5,8 +5,8 @@ import { useTranslation } from 'react-i18next'
|
|
|
5
5
|
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
6
6
|
import { EVMProvider } from './EVMProvider.js'
|
|
7
7
|
import { SDKProviders } from './SDKProviders.js'
|
|
8
|
-
import { SVMProvider } from './SVMProvider.js'
|
|
9
8
|
import { SuiProvider } from './SuiProvider.js'
|
|
9
|
+
import { SVMProvider } from './SVMProvider.js'
|
|
10
10
|
import { UTXOProvider } from './UTXOProvider.js'
|
|
11
11
|
import { useExternalWalletProvider } from './useExternalWalletProvider.js'
|
|
12
12
|
|
|
@@ -2,8 +2,8 @@ import { ChainType } from '@lifi/sdk'
|
|
|
2
2
|
import { useContext, useMemo } from 'react'
|
|
3
3
|
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
4
4
|
import { EVMExternalContext } from './EVMExternalContext.js'
|
|
5
|
-
import { SVMExternalContext } from './SVMExternalContext.js'
|
|
6
5
|
import { SuiExternalContext } from './SuiExternalContext.js'
|
|
6
|
+
import { SVMExternalContext } from './SVMExternalContext.js'
|
|
7
7
|
import { UTXOExternalContext } from './UTXOExternalContext.js'
|
|
8
8
|
|
|
9
9
|
interface ExternalWalletProvider {
|
|
@@ -4,7 +4,7 @@ import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
|
|
|
4
4
|
import { useChains } from '../../hooks/useChains.js'
|
|
5
5
|
import { useExternalWalletProvider } from '../../providers/WalletProvider/useExternalWalletProvider.js'
|
|
6
6
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
7
|
-
import {
|
|
7
|
+
import { getConfigItemSets, isItemAllowedForSets } from '../../utils/item.js'
|
|
8
8
|
import type { FormType } from '../form/types.js'
|
|
9
9
|
import { useFieldActions } from '../form/useFieldActions.js'
|
|
10
10
|
import type { PersistStoreProviderProps } from '../types.js'
|
|
@@ -40,9 +40,14 @@ export function ChainOrderStoreProvider({
|
|
|
40
40
|
const configChainIds = chainsConfig?.[key]
|
|
41
41
|
const isFromKey = key === 'from'
|
|
42
42
|
|
|
43
|
+
// Convert configChainIds to Sets for O(1) lookup
|
|
44
|
+
const configChainIdsSet = getConfigItemSets(
|
|
45
|
+
configChainIds,
|
|
46
|
+
(chainIds) => new Set(chainIds)
|
|
47
|
+
)
|
|
43
48
|
const filteredChains = chains.filter((chain) => {
|
|
44
|
-
const passesChainsConfigFilter =
|
|
45
|
-
?
|
|
49
|
+
const passesChainsConfigFilter = configChainIdsSet
|
|
50
|
+
? isItemAllowedForSets(chain.id, configChainIdsSet)
|
|
46
51
|
: true
|
|
47
52
|
// If the integrator uses external wallet management and has not opted in for partial wallet management,
|
|
48
53
|
// restrict the displayed chains to those compatible with external wallet management.
|
|
@@ -2,9 +2,9 @@ import type { PropsWithChildren } from 'react'
|
|
|
2
2
|
import { useMemo, useRef } from 'react'
|
|
3
3
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
4
4
|
import type { FormRef, ToAddress } from '../../types/widget.js'
|
|
5
|
+
import { createFormStore, formDefaultValues } from './createFormStore.js'
|
|
5
6
|
import { FormStoreContext } from './FormStoreContext.js'
|
|
6
7
|
import { FormUpdater } from './FormUpdater.js'
|
|
7
|
-
import { createFormStore, formDefaultValues } from './createFormStore.js'
|
|
8
8
|
import type { DefaultValues, FormStoreStore } from './types.js'
|
|
9
9
|
import { useFormRef } from './useFormRef.js'
|
|
10
10
|
|
|
@@ -5,13 +5,19 @@ import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.j
|
|
|
5
5
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'
|
|
6
6
|
import { formDefaultValues } from '../../stores/form/createFormStore.js'
|
|
7
7
|
import { useSendToWalletActions } from '../../stores/settings/useSendToWalletStore.js'
|
|
8
|
+
import { isItemAllowed } from '../../utils/item.js'
|
|
8
9
|
import type { DefaultValues } from './types.js'
|
|
9
10
|
import { useFieldActions } from './useFieldActions.js'
|
|
10
11
|
|
|
11
12
|
export const FormUpdater: React.FC<{
|
|
12
13
|
reactiveFormValues: Partial<DefaultValues>
|
|
13
14
|
}> = ({ reactiveFormValues }) => {
|
|
14
|
-
const {
|
|
15
|
+
const {
|
|
16
|
+
fromChain,
|
|
17
|
+
toChain,
|
|
18
|
+
toAddress,
|
|
19
|
+
chains: configChains,
|
|
20
|
+
} = useWidgetConfig()
|
|
15
21
|
const { account } = useAccount()
|
|
16
22
|
const { chains } = useChains()
|
|
17
23
|
const { setSendToWallet } = useSendToWalletActions()
|
|
@@ -21,21 +27,47 @@ export const FormUpdater: React.FC<{
|
|
|
21
27
|
|
|
22
28
|
// Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
|
|
23
29
|
useEffect(() => {
|
|
24
|
-
const
|
|
25
|
-
account.chainId &&
|
|
30
|
+
const fromChainAllowed =
|
|
31
|
+
account.chainId &&
|
|
32
|
+
chains?.some(
|
|
33
|
+
(chain) =>
|
|
34
|
+
chain.id === account.chainId &&
|
|
35
|
+
isItemAllowed(chain.id, configChains?.from)
|
|
36
|
+
)
|
|
37
|
+
const toChainAllowed =
|
|
38
|
+
account.chainId &&
|
|
39
|
+
chains?.some(
|
|
40
|
+
(chain) =>
|
|
41
|
+
chain.id === account.chainId &&
|
|
42
|
+
isItemAllowed(chain.id, configChains?.to)
|
|
43
|
+
)
|
|
26
44
|
|
|
27
|
-
if (
|
|
45
|
+
if (
|
|
46
|
+
!account.isConnected ||
|
|
47
|
+
!account.chainId ||
|
|
48
|
+
(!fromChainAllowed && !toChainAllowed)
|
|
49
|
+
) {
|
|
28
50
|
return
|
|
29
51
|
}
|
|
30
52
|
|
|
31
|
-
if (
|
|
53
|
+
if (
|
|
54
|
+
!fromChain &&
|
|
55
|
+
!isTouched('fromChain') &&
|
|
56
|
+
!isTouched('fromToken') &&
|
|
57
|
+
fromChainAllowed
|
|
58
|
+
) {
|
|
32
59
|
resetField('fromChain', { defaultValue: account.chainId })
|
|
33
60
|
setFieldValue('fromToken', '')
|
|
34
61
|
if (isTouched('fromAmount')) {
|
|
35
62
|
setFieldValue('fromAmount', '')
|
|
36
63
|
}
|
|
37
64
|
}
|
|
38
|
-
if (
|
|
65
|
+
if (
|
|
66
|
+
!toChain &&
|
|
67
|
+
!isTouched('toChain') &&
|
|
68
|
+
!isTouched('toToken') &&
|
|
69
|
+
toChainAllowed
|
|
70
|
+
) {
|
|
39
71
|
resetField('toChain', { defaultValue: account.chainId })
|
|
40
72
|
setFieldValue('toToken', '')
|
|
41
73
|
}
|
|
@@ -48,6 +80,8 @@ export const FormUpdater: React.FC<{
|
|
|
48
80
|
isTouched,
|
|
49
81
|
resetField,
|
|
50
82
|
setFieldValue,
|
|
83
|
+
configChains?.from,
|
|
84
|
+
configChains?.to,
|
|
51
85
|
])
|
|
52
86
|
|
|
53
87
|
// Makes widget config options reactive to changes
|
|
@@ -104,7 +104,7 @@ export const URLSearchParamsBuilder = () => {
|
|
|
104
104
|
addRecentWallet,
|
|
105
105
|
])
|
|
106
106
|
|
|
107
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
107
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: run only when pathname changes
|
|
108
108
|
useEffect(() => {
|
|
109
109
|
// set the values on the querysting
|
|
110
110
|
const url = new URL(window.location as any)
|
|
@@ -9,58 +9,54 @@ export const useFormRef = (formStore: FormStoreStore, formRef?: FormRef) => {
|
|
|
9
9
|
const { setSendToWallet } = useSendToWalletActions()
|
|
10
10
|
const { setSelectedBookmark } = useBookmarkActions()
|
|
11
11
|
|
|
12
|
-
useImperativeHandle(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
fromAmount
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
toAmount
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
[formStore, setSendToWallet, setSelectedBookmark]
|
|
65
|
-
)
|
|
12
|
+
useImperativeHandle(formRef, () => {
|
|
13
|
+
const sanitizeValue: {
|
|
14
|
+
[key: string]: (value: any) => GenericFormValue
|
|
15
|
+
} = {
|
|
16
|
+
fromAmount: (value) =>
|
|
17
|
+
(typeof value === 'number' ? value?.toPrecision() : value) ||
|
|
18
|
+
formDefaultValues.fromAmount,
|
|
19
|
+
toAmount: (value) =>
|
|
20
|
+
(typeof value === 'number' ? value?.toPrecision() : value) ||
|
|
21
|
+
formDefaultValues.toAmount,
|
|
22
|
+
toAddress: (value) => {
|
|
23
|
+
const isToAddressObj = typeof value !== 'string'
|
|
24
|
+
|
|
25
|
+
const address =
|
|
26
|
+
(isToAddressObj ? value?.address : value) ||
|
|
27
|
+
formDefaultValues.toAddress
|
|
28
|
+
|
|
29
|
+
// sets the send to wallet button state to be open
|
|
30
|
+
// if there is an address to display
|
|
31
|
+
if (address) {
|
|
32
|
+
setSendToWallet(address)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// we can assume that the toAddress has been passed as ToAddress object
|
|
36
|
+
// and display it accordingly - this ensures that if a name is included
|
|
37
|
+
// that it is displayed in the Send To Wallet form field correctly
|
|
38
|
+
if (isToAddressObj) {
|
|
39
|
+
setSelectedBookmark(value)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return address
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
setFieldValue: (fieldName, value, options) => {
|
|
48
|
+
const sanitizedValue = (
|
|
49
|
+
sanitizeValue[fieldName] ? sanitizeValue[fieldName](value) : value
|
|
50
|
+
) as GenericFormValue
|
|
51
|
+
|
|
52
|
+
const fieldValueOptions = options?.setUrlSearchParam
|
|
53
|
+
? { isTouched: options?.setUrlSearchParam }
|
|
54
|
+
: undefined
|
|
55
|
+
|
|
56
|
+
formStore
|
|
57
|
+
.getState()
|
|
58
|
+
.setFieldValue(fieldName, sanitizedValue, fieldValueOptions)
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
}, [formStore, setSendToWallet, setSelectedBookmark])
|
|
66
62
|
}
|
|
@@ -140,7 +140,7 @@ export const createRouteExecutionStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
140
140
|
} as RouteExecutionState
|
|
141
141
|
try {
|
|
142
142
|
// Remove failed transactions from history after 1 day
|
|
143
|
-
const currentTime =
|
|
143
|
+
const currentTime = Date.now()
|
|
144
144
|
const oneDay = 1000 * 60 * 60 * 24
|
|
145
145
|
Object.values(state.routes).forEach((routeExecution) => {
|
|
146
146
|
const startedAt =
|