@lifi/widget 3.0.0-alpha.12 → 3.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.tsx +30 -14
- package/AppDrawer.tsx +82 -91
- package/AppDrawerContext.ts +9 -0
- package/_cjs/App.js +16 -3
- package/_cjs/App.js.map +1 -1
- package/_cjs/AppDrawer.d.ts +4 -2
- package/_cjs/AppDrawer.js +20 -18
- package/_cjs/AppDrawer.js.map +1 -1
- package/_cjs/AppDrawerContext.d.ts +6 -0
- package/_cjs/AppDrawerContext.js +8 -0
- package/_cjs/AppDrawerContext.js.map +1 -0
- package/_cjs/components/ActiveTransactions/ActiveTransactions.js +1 -3
- package/_cjs/components/ActiveTransactions/ActiveTransactions.js.map +1 -1
- package/_cjs/components/BaseTransactionButton/BaseTransactionButton.js +6 -6
- package/_cjs/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/_cjs/components/ChainSelect/ChainSelect.js +7 -5
- package/_cjs/components/ChainSelect/ChainSelect.js.map +1 -1
- package/_cjs/components/ChainSelect/useChainSelect.d.ts +1 -1
- package/_cjs/components/ChainSelect/useChainSelect.js +3 -3
- package/_cjs/components/ChainSelect/useChainSelect.js.map +1 -1
- package/_cjs/components/Header/CloseDrawerButton.d.ts +1 -0
- package/_cjs/components/Header/CloseDrawerButton.js +16 -0
- package/_cjs/components/Header/CloseDrawerButton.js.map +1 -0
- package/_cjs/components/Header/EVMDisconnectIconButton.d.ts +4 -0
- package/_cjs/components/Header/EVMDisconnectIconButton.js +16 -0
- package/_cjs/components/Header/EVMDisconnectIconButton.js.map +1 -0
- package/_cjs/components/Header/Header.js +1 -6
- package/_cjs/components/Header/Header.js.map +1 -1
- package/_cjs/components/Header/Header.style.js +10 -4
- package/_cjs/components/Header/Header.style.js.map +1 -1
- package/_cjs/components/Header/NavigationHeader.d.ts +0 -1
- package/_cjs/components/Header/NavigationHeader.js +7 -11
- package/_cjs/components/Header/NavigationHeader.js.map +1 -1
- package/_cjs/components/Header/SVMDisconnectIconButton.d.ts +1 -0
- package/_cjs/components/Header/SVMDisconnectIconButton.js +16 -0
- package/_cjs/components/Header/SVMDisconnectIconButton.js.map +1 -0
- package/_cjs/components/Header/SettingsButton.style.js +18 -21
- package/_cjs/components/Header/SettingsButton.style.js.map +1 -1
- package/_cjs/components/Header/TransactionHistoryButton.d.ts +1 -0
- package/_cjs/components/Header/TransactionHistoryButton.js +17 -0
- package/_cjs/components/Header/TransactionHistoryButton.js.map +1 -0
- package/_cjs/components/Header/WalletHeader.d.ts +1 -0
- package/_cjs/components/Header/WalletHeader.js +21 -7
- package/_cjs/components/Header/WalletHeader.js.map +1 -1
- package/_cjs/components/Header/WalletMenu.js +5 -21
- package/_cjs/components/Header/WalletMenu.js.map +1 -1
- package/_cjs/components/SelectTokenButton/SelectTokenButton.js +7 -1
- package/_cjs/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
- package/_cjs/components/SelectTokenButton/SelectTokenButton.style.js +4 -4
- package/_cjs/components/StepActions/StepFeeBreakdown.js +2 -2
- package/_cjs/components/StepActions/StepFeeBreakdown.js.map +1 -1
- package/_cjs/components/TokenList/TokenList.js +3 -4
- package/_cjs/components/TokenList/TokenList.js.map +1 -1
- package/_cjs/components/TokenList/VirtualizedTokenList.js +4 -2
- package/_cjs/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/_cjs/components/TokenList/types.d.ts +1 -2
- package/_cjs/components/TokenList/useTokenSelect.js +6 -4
- package/_cjs/components/TokenList/useTokenSelect.js.map +1 -1
- package/_cjs/config/queryClient.js +0 -1
- package/_cjs/config/queryClient.js.map +1 -1
- package/_cjs/config/version.d.ts +1 -1
- package/_cjs/config/version.js +1 -1
- package/_cjs/config/walletConnect.d.ts +1 -0
- package/_cjs/config/walletConnect.js +5 -0
- package/_cjs/config/walletConnect.js.map +1 -0
- package/_cjs/hooks/useAccount.d.ts +4 -1
- package/_cjs/hooks/useAccount.js +5 -16
- package/_cjs/hooks/useAccount.js.map +1 -1
- package/_cjs/hooks/useAvailableChains.js +12 -6
- package/_cjs/hooks/useAvailableChains.js.map +1 -1
- package/_cjs/hooks/useChains.d.ts +2 -1
- package/_cjs/hooks/useChains.js +7 -3
- package/_cjs/hooks/useChains.js.map +1 -1
- package/_cjs/hooks/useDebouncedWatch.d.ts +1 -2
- package/_cjs/hooks/useDebouncedWatch.js +1 -1
- package/_cjs/hooks/useDebouncedWatch.js.map +1 -1
- package/_cjs/hooks/useFromTokenSufficiency.js +8 -7
- package/_cjs/hooks/useFromTokenSufficiency.js.map +1 -1
- package/_cjs/hooks/useGasRecommendation.d.ts +1 -1
- package/_cjs/hooks/useGasRecommendation.js.map +1 -1
- package/_cjs/hooks/useGasRefuel.js +2 -2
- package/_cjs/hooks/useGasRefuel.js.map +1 -1
- package/_cjs/hooks/useGasSufficiency.js +7 -6
- package/_cjs/hooks/useGasSufficiency.js.map +1 -1
- package/_cjs/hooks/useRouteExecution.js +5 -5
- package/_cjs/hooks/useRouteExecution.js.map +1 -1
- package/_cjs/hooks/useRoutes.d.ts +1 -1
- package/_cjs/hooks/useRoutes.js +22 -15
- package/_cjs/hooks/useRoutes.js.map +1 -1
- package/_cjs/hooks/useTokenAddressBalance.d.ts +2 -1
- package/_cjs/hooks/useTokenAddressBalance.js +2 -1
- package/_cjs/hooks/useTokenAddressBalance.js.map +1 -1
- package/_cjs/hooks/useTokenBalance.d.ts +1 -1
- package/_cjs/hooks/useTokenBalance.js +8 -19
- package/_cjs/hooks/useTokenBalance.js.map +1 -1
- package/_cjs/hooks/useTokenBalances.d.ts +2 -1
- package/_cjs/hooks/useTokenBalances.js +1 -0
- package/_cjs/hooks/useTokenBalances.js.map +1 -1
- package/_cjs/hooks/useTools.js +3 -2
- package/_cjs/hooks/useTools.js.map +1 -1
- package/_cjs/hooks/useTransactionHistory.d.ts +2 -2
- package/_cjs/hooks/useTransactionHistory.js +32 -23
- package/_cjs/hooks/useTransactionHistory.js.map +1 -1
- package/_cjs/i18n/en.json +4 -3
- package/_cjs/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +1 -3
- package/_cjs/pages/ActiveTransactionsPage/ActiveTransactionsPage.js.map +1 -1
- package/_cjs/pages/RoutesPage/RoutesPage.js +1 -1
- package/_cjs/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/_cjs/pages/SettingsPage/SettingsCard/SettingCard.js +1 -1
- package/_cjs/pages/SettingsPage/SettingsCard/SettingCard.style.js +6 -5
- package/_cjs/pages/SettingsPage/SettingsCard/SettingCard.style.js.map +1 -1
- package/_cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.js +6 -7
- package/_cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/_cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +1 -1
- package/_cjs/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js.map +1 -1
- package/_cjs/pages/TransactionPage/StatusBottomSheet.js +13 -9
- package/_cjs/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/_cjs/providers/I18nProvider/I18nProvider.js +2 -1
- package/_cjs/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/_cjs/providers/WalletProvider/EVMBaseProvider.d.ts +2 -0
- package/_cjs/providers/WalletProvider/EVMBaseProvider.js +91 -0
- package/_cjs/providers/WalletProvider/EVMBaseProvider.js.map +1 -0
- package/_cjs/providers/WalletProvider/EVMExternalContext.d.ts +2 -0
- package/_cjs/providers/WalletProvider/EVMExternalContext.js +6 -0
- package/_cjs/providers/WalletProvider/EVMExternalContext.js.map +1 -0
- package/_cjs/providers/WalletProvider/EVMProvider.d.ts +1 -1
- package/_cjs/providers/WalletProvider/EVMProvider.js +13 -70
- package/_cjs/providers/WalletProvider/EVMProvider.js.map +1 -1
- package/_cjs/providers/WalletProvider/SDKProviders.js +13 -5
- package/_cjs/providers/WalletProvider/SDKProviders.js.map +1 -1
- package/_cjs/providers/WalletProvider/SVMBaseProvider.d.ts +2 -0
- package/_cjs/providers/WalletProvider/{SolanaProvider.js → SVMBaseProvider.js} +4 -14
- package/_cjs/providers/WalletProvider/SVMBaseProvider.js.map +1 -0
- package/_cjs/providers/WalletProvider/SVMExternalContext.d.ts +2 -0
- package/_cjs/providers/WalletProvider/SVMExternalContext.js +6 -0
- package/_cjs/providers/WalletProvider/SVMExternalContext.js.map +1 -0
- package/_cjs/providers/WalletProvider/SVMProvider.d.ts +3 -0
- package/_cjs/providers/WalletProvider/SVMProvider.js +23 -0
- package/_cjs/providers/WalletProvider/SVMProvider.js.map +1 -0
- package/_cjs/providers/WalletProvider/WalletProvider.js +2 -2
- package/_cjs/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/_cjs/providers/WalletProvider/index.d.ts +1 -0
- package/_cjs/providers/WalletProvider/index.js +1 -0
- package/_cjs/providers/WalletProvider/index.js.map +1 -1
- package/_cjs/providers/WalletProvider/useHasExternalWalletProvider.d.ts +7 -0
- package/_cjs/providers/WalletProvider/useHasExternalWalletProvider.js +27 -0
- package/_cjs/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -0
- package/_cjs/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/_cjs/providers/WidgetProvider/index.d.ts +1 -2
- package/_cjs/providers/WidgetProvider/index.js +1 -2
- package/_cjs/providers/WidgetProvider/index.js.map +1 -1
- package/_cjs/stores/StoreProvider.js +3 -3
- package/_cjs/stores/StoreProvider.js.map +1 -1
- package/_cjs/stores/chains/ChainOrderStore.js +19 -16
- package/_cjs/stores/chains/ChainOrderStore.js.map +1 -1
- package/_cjs/stores/chains/createChainOrderStore.js +34 -15
- package/_cjs/stores/chains/createChainOrderStore.js.map +1 -1
- package/_cjs/stores/chains/types.d.ts +11 -4
- package/_cjs/stores/chains/useChainOrder.d.ts +2 -1
- package/_cjs/stores/chains/useChainOrder.js +2 -2
- package/_cjs/stores/chains/useChainOrder.js.map +1 -1
- package/_cjs/stores/form/FormStore.d.ts +1 -1
- package/_cjs/stores/form/FormStore.js +4 -4
- package/_cjs/stores/form/FormStore.js.map +1 -1
- package/_cjs/stores/form/FormUpdater.d.ts +3 -3
- package/_cjs/stores/form/FormUpdater.js +4 -4
- package/_cjs/stores/form/FormUpdater.js.map +1 -1
- package/_cjs/stores/form/URLSearchParamsBuilder.js +3 -2
- package/_cjs/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/_cjs/stores/form/createFormStore.js.map +1 -1
- package/_cjs/stores/form/types.d.ts +20 -20
- package/_cjs/stores/form/types.js.map +1 -1
- package/_cjs/stores/form/useFieldActions.js +9 -10
- package/_cjs/stores/form/useFieldActions.js.map +1 -1
- package/_cjs/stores/form/useFieldController.d.ts +1 -1
- package/_cjs/stores/form/useFieldValues.d.ts +2 -2
- package/_cjs/stores/form/useFieldValues.js +3 -2
- package/_cjs/stores/form/useFieldValues.js.map +1 -1
- package/_cjs/stores/form/useTouchedFields.d.ts +14 -1
- package/_cjs/stores/form/useValidationActions.js +7 -11
- package/_cjs/stores/form/useValidationActions.js.map +1 -1
- package/_cjs/stores/routes/useExecutingRoutesIds.d.ts +1 -1
- package/_cjs/stores/routes/useExecutingRoutesIds.js +5 -2
- package/_cjs/stores/routes/useExecutingRoutesIds.js.map +1 -1
- package/_cjs/stores/settings/useSettingsStore.d.ts +1 -0
- package/_cjs/stores/settings/useSettingsStore.js +3 -2
- package/_cjs/stores/settings/useSettingsStore.js.map +1 -1
- package/_cjs/types/widget.d.ts +26 -23
- package/_cjs/types/widget.js +1 -0
- package/_cjs/types/widget.js.map +1 -1
- package/_cjs/utils/index.d.ts +1 -0
- package/_cjs/utils/index.js +1 -0
- package/_cjs/utils/index.js.map +1 -1
- package/_cjs/utils/item.d.ts +2 -0
- package/_cjs/{providers/WidgetProvider/utils.js → utils/item.js} +1 -1
- package/_cjs/utils/item.js.map +1 -0
- package/_esm/App.js +16 -3
- package/_esm/App.js.map +1 -1
- package/_esm/AppDrawer.d.ts +4 -2
- package/_esm/AppDrawer.js +21 -19
- package/_esm/AppDrawer.js.map +1 -1
- package/_esm/AppDrawerContext.d.ts +6 -0
- package/_esm/AppDrawerContext.js +4 -0
- package/_esm/AppDrawerContext.js.map +1 -0
- package/_esm/components/ActiveTransactions/ActiveTransactions.js +1 -3
- package/_esm/components/ActiveTransactions/ActiveTransactions.js.map +1 -1
- package/_esm/components/BaseTransactionButton/BaseTransactionButton.js +6 -6
- package/_esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/_esm/components/ChainSelect/ChainSelect.js +8 -6
- package/_esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/_esm/components/ChainSelect/useChainSelect.d.ts +1 -1
- package/_esm/components/ChainSelect/useChainSelect.js +4 -4
- package/_esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/_esm/components/Header/CloseDrawerButton.d.ts +1 -0
- package/_esm/components/Header/CloseDrawerButton.js +12 -0
- package/_esm/components/Header/CloseDrawerButton.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 +1 -6
- package/_esm/components/Header/Header.js.map +1 -1
- package/_esm/components/Header/Header.style.js +10 -4
- package/_esm/components/Header/Header.style.js.map +1 -1
- package/_esm/components/Header/NavigationHeader.d.ts +0 -1
- package/_esm/components/Header/NavigationHeader.js +8 -11
- 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/SettingsButton.style.js +18 -21
- package/_esm/components/Header/SettingsButton.style.js.map +1 -1
- package/_esm/components/Header/TransactionHistoryButton.d.ts +1 -0
- package/_esm/components/Header/TransactionHistoryButton.js +13 -0
- package/_esm/components/Header/TransactionHistoryButton.js.map +1 -0
- package/_esm/components/Header/WalletHeader.d.ts +1 -0
- package/_esm/components/Header/WalletHeader.js +20 -7
- package/_esm/components/Header/WalletHeader.js.map +1 -1
- package/_esm/components/Header/WalletMenu.js +4 -20
- package/_esm/components/Header/WalletMenu.js.map +1 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.js +7 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.style.js +4 -4
- package/_esm/components/StepActions/StepFeeBreakdown.js +2 -2
- package/_esm/components/StepActions/StepFeeBreakdown.js.map +1 -1
- package/_esm/components/TokenList/TokenList.js +4 -5
- package/_esm/components/TokenList/TokenList.js.map +1 -1
- package/_esm/components/TokenList/VirtualizedTokenList.js +4 -2
- package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/_esm/components/TokenList/types.d.ts +1 -2
- package/_esm/components/TokenList/useTokenSelect.js +7 -5
- package/_esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/_esm/config/queryClient.js +0 -1
- package/_esm/config/queryClient.js.map +1 -1
- package/_esm/config/version.d.ts +1 -1
- package/_esm/config/version.js +1 -1
- package/_esm/config/walletConnect.d.ts +1 -0
- package/_esm/config/walletConnect.js +2 -0
- package/_esm/config/walletConnect.js.map +1 -0
- package/_esm/hooks/useAccount.d.ts +4 -1
- package/_esm/hooks/useAccount.js +5 -15
- package/_esm/hooks/useAccount.js.map +1 -1
- package/_esm/hooks/useAvailableChains.js +12 -6
- package/_esm/hooks/useAvailableChains.js.map +1 -1
- package/_esm/hooks/useChains.d.ts +2 -1
- package/_esm/hooks/useChains.js +8 -4
- package/_esm/hooks/useChains.js.map +1 -1
- package/_esm/hooks/useDebouncedWatch.d.ts +1 -2
- package/_esm/hooks/useDebouncedWatch.js +1 -1
- package/_esm/hooks/useDebouncedWatch.js.map +1 -1
- package/_esm/hooks/useFromTokenSufficiency.js +8 -7
- package/_esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/_esm/hooks/useGasRecommendation.d.ts +1 -1
- package/_esm/hooks/useGasRecommendation.js.map +1 -1
- package/_esm/hooks/useGasRefuel.js +2 -2
- package/_esm/hooks/useGasRefuel.js.map +1 -1
- package/_esm/hooks/useGasSufficiency.js +7 -6
- package/_esm/hooks/useGasSufficiency.js.map +1 -1
- package/_esm/hooks/useRouteExecution.js +5 -5
- package/_esm/hooks/useRouteExecution.js.map +1 -1
- package/_esm/hooks/useRoutes.d.ts +1 -1
- package/_esm/hooks/useRoutes.js +23 -16
- package/_esm/hooks/useRoutes.js.map +1 -1
- package/_esm/hooks/useTokenAddressBalance.d.ts +2 -1
- package/_esm/hooks/useTokenAddressBalance.js +2 -1
- package/_esm/hooks/useTokenAddressBalance.js.map +1 -1
- package/_esm/hooks/useTokenBalance.d.ts +1 -1
- package/_esm/hooks/useTokenBalance.js +8 -19
- package/_esm/hooks/useTokenBalance.js.map +1 -1
- package/_esm/hooks/useTokenBalances.d.ts +2 -1
- package/_esm/hooks/useTokenBalances.js +1 -0
- package/_esm/hooks/useTokenBalances.js.map +1 -1
- package/_esm/hooks/useTools.js +2 -1
- package/_esm/hooks/useTools.js.map +1 -1
- package/_esm/hooks/useTransactionHistory.d.ts +2 -2
- package/_esm/hooks/useTransactionHistory.js +33 -24
- package/_esm/hooks/useTransactionHistory.js.map +1 -1
- package/_esm/i18n/en.json +4 -3
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +1 -3
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/_esm/pages/SettingsPage/SettingsCard/SettingCard.js +1 -1
- package/_esm/pages/SettingsPage/SettingsCard/SettingCard.style.js +6 -5
- package/_esm/pages/SettingsPage/SettingsCard/SettingCard.style.js.map +1 -1
- package/_esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +7 -8
- package/_esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/_esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +1 -1
- package/_esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js.map +1 -1
- package/_esm/pages/TransactionPage/StatusBottomSheet.js +13 -9
- package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/_esm/providers/I18nProvider/I18nProvider.js +3 -2
- package/_esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/_esm/providers/WalletProvider/EVMBaseProvider.d.ts +2 -0
- package/_esm/providers/WalletProvider/EVMBaseProvider.js +87 -0
- package/_esm/providers/WalletProvider/EVMBaseProvider.js.map +1 -0
- package/_esm/providers/WalletProvider/EVMExternalContext.d.ts +2 -0
- package/_esm/providers/WalletProvider/EVMExternalContext.js +3 -0
- package/_esm/providers/WalletProvider/EVMExternalContext.js.map +1 -0
- package/_esm/providers/WalletProvider/EVMProvider.d.ts +1 -1
- package/_esm/providers/WalletProvider/EVMProvider.js +13 -70
- package/_esm/providers/WalletProvider/EVMProvider.js.map +1 -1
- package/_esm/providers/WalletProvider/SDKProviders.js +13 -5
- package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
- package/_esm/providers/WalletProvider/SVMBaseProvider.d.ts +2 -0
- package/_esm/providers/WalletProvider/{SolanaProvider.js → SVMBaseProvider.js} +3 -12
- package/_esm/providers/WalletProvider/SVMBaseProvider.js.map +1 -0
- package/_esm/providers/WalletProvider/SVMExternalContext.d.ts +2 -0
- package/_esm/providers/WalletProvider/SVMExternalContext.js +3 -0
- package/_esm/providers/WalletProvider/SVMExternalContext.js.map +1 -0
- package/_esm/providers/WalletProvider/SVMProvider.d.ts +3 -0
- package/_esm/providers/WalletProvider/SVMProvider.js +18 -0
- package/_esm/providers/WalletProvider/SVMProvider.js.map +1 -0
- package/_esm/providers/WalletProvider/WalletProvider.js +2 -2
- package/_esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/_esm/providers/WalletProvider/index.d.ts +1 -0
- package/_esm/providers/WalletProvider/index.js +1 -0
- package/_esm/providers/WalletProvider/index.js.map +1 -1
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.d.ts +7 -0
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js +23 -0
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -0
- package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/_esm/providers/WidgetProvider/index.d.ts +1 -2
- package/_esm/providers/WidgetProvider/index.js +1 -2
- package/_esm/providers/WidgetProvider/index.js.map +1 -1
- package/_esm/stores/StoreProvider.js +3 -3
- package/_esm/stores/StoreProvider.js.map +1 -1
- package/_esm/stores/chains/ChainOrderStore.js +18 -15
- package/_esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/_esm/stores/chains/createChainOrderStore.js +34 -15
- package/_esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/_esm/stores/chains/types.d.ts +11 -4
- package/_esm/stores/chains/useChainOrder.d.ts +2 -1
- package/_esm/stores/chains/useChainOrder.js +2 -2
- package/_esm/stores/chains/useChainOrder.js.map +1 -1
- package/_esm/stores/form/FormStore.d.ts +1 -1
- package/_esm/stores/form/FormStore.js +5 -5
- package/_esm/stores/form/FormStore.js.map +1 -1
- package/_esm/stores/form/FormUpdater.d.ts +3 -3
- package/_esm/stores/form/FormUpdater.js +4 -4
- package/_esm/stores/form/FormUpdater.js.map +1 -1
- package/_esm/stores/form/URLSearchParamsBuilder.js +3 -2
- package/_esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/_esm/stores/form/createFormStore.js.map +1 -1
- package/_esm/stores/form/types.d.ts +20 -20
- package/_esm/stores/form/types.js.map +1 -1
- package/_esm/stores/form/useFieldActions.js +9 -10
- package/_esm/stores/form/useFieldActions.js.map +1 -1
- package/_esm/stores/form/useFieldController.d.ts +1 -1
- package/_esm/stores/form/useFieldValues.d.ts +2 -2
- package/_esm/stores/form/useFieldValues.js +3 -2
- package/_esm/stores/form/useFieldValues.js.map +1 -1
- package/_esm/stores/form/useTouchedFields.d.ts +14 -1
- package/_esm/stores/form/useValidationActions.js +7 -11
- package/_esm/stores/form/useValidationActions.js.map +1 -1
- package/_esm/stores/routes/useExecutingRoutesIds.d.ts +1 -1
- package/_esm/stores/routes/useExecutingRoutesIds.js +5 -2
- package/_esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
- package/_esm/stores/settings/useSettingsStore.d.ts +1 -0
- package/_esm/stores/settings/useSettingsStore.js +2 -1
- package/_esm/stores/settings/useSettingsStore.js.map +1 -1
- package/_esm/types/widget.d.ts +26 -23
- package/_esm/types/widget.js +1 -0
- package/_esm/types/widget.js.map +1 -1
- package/_esm/utils/index.d.ts +1 -0
- package/_esm/utils/index.js +1 -0
- package/_esm/utils/index.js.map +1 -1
- package/_esm/utils/item.d.ts +2 -0
- package/_esm/{providers/WidgetProvider/utils.js → utils/item.js} +1 -1
- package/_esm/utils/item.js.map +1 -0
- package/components/ActiveTransactions/ActiveTransactions.tsx +1 -3
- package/components/BaseTransactionButton/BaseTransactionButton.tsx +6 -6
- package/components/ChainSelect/ChainSelect.tsx +8 -6
- package/components/ChainSelect/useChainSelect.ts +5 -5
- package/components/Header/CloseDrawerButton.tsx +18 -0
- package/components/Header/EVMDisconnectIconButton.tsx +24 -0
- package/components/Header/Header.style.ts +10 -4
- package/components/Header/Header.tsx +1 -8
- package/components/Header/NavigationHeader.tsx +13 -30
- package/components/Header/SVMDisconnectIconButton.tsx +19 -0
- package/components/Header/SettingsButton.style.tsx +18 -22
- package/components/Header/TransactionHistoryButton.tsx +23 -0
- package/components/Header/WalletHeader.tsx +25 -6
- package/components/Header/WalletMenu.tsx +66 -100
- package/components/SelectTokenButton/SelectTokenButton.style.tsx +4 -4
- package/components/SelectTokenButton/SelectTokenButton.tsx +10 -2
- package/components/StepActions/StepFeeBreakdown.tsx +2 -2
- package/components/TokenList/TokenList.tsx +2 -5
- package/components/TokenList/VirtualizedTokenList.tsx +3 -2
- package/components/TokenList/types.ts +1 -2
- package/components/TokenList/useTokenSelect.ts +8 -6
- package/config/queryClient.ts +0 -1
- package/config/version.ts +1 -1
- package/config/walletConnect.ts +1 -0
- package/hooks/useAccount.ts +9 -17
- package/hooks/useAvailableChains.ts +13 -6
- package/hooks/useChains.ts +12 -6
- package/hooks/useDebouncedWatch.ts +6 -5
- package/hooks/useFromTokenSufficiency.ts +18 -9
- package/hooks/useGasRecommendation.ts +1 -1
- package/hooks/useGasRefuel.ts +2 -2
- package/hooks/useGasSufficiency.ts +11 -6
- package/hooks/useRouteExecution.ts +5 -5
- package/hooks/useRoutes.ts +31 -24
- package/hooks/useTokenAddressBalance.ts +2 -1
- package/hooks/useTokenBalance.ts +12 -22
- package/hooks/useTokenBalances.ts +1 -0
- package/hooks/useTools.ts +2 -1
- package/hooks/useTransactionHistory.ts +39 -29
- package/i18n/en.json +4 -3
- package/package.json +13 -13
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.tsx +1 -3
- package/pages/RoutesPage/RoutesPage.tsx +0 -1
- package/pages/SettingsPage/SettingsCard/SettingCard.style.tsx +6 -5
- package/pages/SettingsPage/SettingsCard/SettingCard.tsx +1 -1
- package/pages/SettingsPage/SlippageSettings/SlippageSettings.style.tsx +3 -2
- package/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +12 -10
- package/pages/TransactionPage/StatusBottomSheet.tsx +14 -9
- package/providers/I18nProvider/I18nProvider.tsx +3 -2
- package/providers/WalletProvider/EVMBaseProvider.tsx +130 -0
- package/providers/WalletProvider/EVMExternalContext.ts +3 -0
- package/providers/WalletProvider/EVMProvider.tsx +17 -110
- package/providers/WalletProvider/SDKProviders.tsx +19 -9
- package/providers/WalletProvider/{SolanaProvider.tsx → SVMBaseProvider.tsx} +2 -17
- package/providers/WalletProvider/SVMExternalContext.ts +3 -0
- package/providers/WalletProvider/SVMProvider.tsx +27 -0
- package/providers/WalletProvider/WalletProvider.tsx +5 -5
- package/providers/WalletProvider/index.ts +1 -0
- package/providers/WalletProvider/useHasExternalWalletProvider.ts +30 -0
- package/providers/WidgetProvider/WidgetProvider.tsx +2 -2
- package/providers/WidgetProvider/index.ts +1 -2
- package/stores/StoreProvider.tsx +12 -12
- package/stores/chains/ChainOrderStore.tsx +21 -17
- package/stores/chains/createChainOrderStore.ts +34 -15
- package/stores/chains/types.ts +12 -4
- package/stores/chains/useChainOrder.ts +5 -2
- package/stores/form/FormStore.tsx +7 -8
- package/stores/form/FormUpdater.tsx +10 -5
- package/stores/form/URLSearchParamsBuilder.tsx +3 -2
- package/stores/form/createFormStore.ts +3 -2
- package/stores/form/types.ts +24 -23
- package/stores/form/useFieldActions.ts +11 -20
- package/stores/form/useFieldValues.ts +6 -4
- package/stores/form/useValidationActions.ts +9 -17
- package/stores/routes/useExecutingRoutesIds.ts +5 -2
- package/stores/settings/useSettingsStore.ts +3 -1
- package/types/widget.ts +32 -24
- package/utils/index.ts +1 -0
- package/{providers/WidgetProvider/utils.ts → utils/item.ts} +3 -7
- package/_cjs/providers/WalletProvider/SolanaProvider.d.ts +0 -3
- package/_cjs/providers/WalletProvider/SolanaProvider.js.map +0 -1
- package/_cjs/providers/WidgetProvider/utils.d.ts +0 -4
- package/_cjs/providers/WidgetProvider/utils.js.map +0 -1
- package/_esm/providers/WalletProvider/SolanaProvider.d.ts +0 -3
- package/_esm/providers/WalletProvider/SolanaProvider.js.map +0 -1
- package/_esm/providers/WidgetProvider/utils.d.ts +0 -4
- package/_esm/providers/WidgetProvider/utils.js.map +0 -1
|
@@ -9,8 +9,11 @@ import type { Connector } from 'wagmi';
|
|
|
9
9
|
import type { Account } from '../../hooks';
|
|
10
10
|
import { useAccount, useChain } from '../../hooks';
|
|
11
11
|
import { useWidgetConfig } from '../../providers';
|
|
12
|
+
import { useHasExternalWalletProvider } from '../../providers/WalletProvider';
|
|
13
|
+
import { HiddenUI } from '../../types';
|
|
12
14
|
import { navigationRoutes, shortenAddress } from '../../utils';
|
|
13
15
|
import { SmallAvatar } from '../SmallAvatar';
|
|
16
|
+
import { CloseDrawerButton } from './CloseDrawerButton';
|
|
14
17
|
import {
|
|
15
18
|
DrawerWalletContainer,
|
|
16
19
|
HeaderAppBar,
|
|
@@ -20,16 +23,28 @@ import { WalletMenu } from './WalletMenu';
|
|
|
20
23
|
import { WalletMenuContainer } from './WalletMenu.style';
|
|
21
24
|
|
|
22
25
|
export const WalletHeader: React.FC = () => {
|
|
23
|
-
|
|
26
|
+
const { subvariant, hiddenUI } = useWidgetConfig();
|
|
27
|
+
const { hasExternalProvider } = useHasExternalWalletProvider();
|
|
28
|
+
return !hasExternalProvider &&
|
|
29
|
+
subvariant !== 'split' &&
|
|
30
|
+
!hiddenUI?.includes(HiddenUI.WalletMenu) ? (
|
|
24
31
|
<HeaderAppBar elevation={0} sx={{ justifyContent: 'flex-end' }}>
|
|
25
32
|
<WalletMenuButton />
|
|
26
33
|
</HeaderAppBar>
|
|
27
|
-
);
|
|
34
|
+
) : null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const SplitWalletMenuButton: React.FC = () => {
|
|
38
|
+
const { hiddenUI } = useWidgetConfig();
|
|
39
|
+
const { hasExternalProvider } = useHasExternalWalletProvider();
|
|
40
|
+
return !hasExternalProvider && !hiddenUI?.includes(HiddenUI.WalletMenu) ? (
|
|
41
|
+
<WalletMenuButton />
|
|
42
|
+
) : null;
|
|
28
43
|
};
|
|
29
44
|
|
|
30
45
|
export const WalletMenuButton: React.FC = () => {
|
|
31
46
|
const { account } = useAccount();
|
|
32
|
-
const { variant } = useWidgetConfig();
|
|
47
|
+
const { variant, subvariant, hiddenUI } = useWidgetConfig();
|
|
33
48
|
|
|
34
49
|
if (variant === 'drawer') {
|
|
35
50
|
return (
|
|
@@ -39,6 +54,10 @@ export const WalletMenuButton: React.FC = () => {
|
|
|
39
54
|
) : (
|
|
40
55
|
<ConnectButton />
|
|
41
56
|
)}
|
|
57
|
+
{subvariant !== 'split' &&
|
|
58
|
+
!hiddenUI?.includes(HiddenUI.DrawerCloseButton) ? (
|
|
59
|
+
<CloseDrawerButton />
|
|
60
|
+
) : null}
|
|
42
61
|
</DrawerWalletContainer>
|
|
43
62
|
);
|
|
44
63
|
}
|
|
@@ -52,11 +71,11 @@ export const WalletMenuButton: React.FC = () => {
|
|
|
52
71
|
const ConnectButton = () => {
|
|
53
72
|
const { t } = useTranslation();
|
|
54
73
|
const { pathname } = useLocation();
|
|
55
|
-
const {
|
|
74
|
+
const { walletConfig, subvariant, variant } = useWidgetConfig();
|
|
56
75
|
const navigate = useNavigate();
|
|
57
76
|
const connect = async () => {
|
|
58
|
-
if (
|
|
59
|
-
|
|
77
|
+
if (walletConfig?.onConnect) {
|
|
78
|
+
walletConfig.onConnect();
|
|
60
79
|
return;
|
|
61
80
|
}
|
|
62
81
|
navigate(navigationRoutes.selectWallet);
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
IconButton,
|
|
12
12
|
MenuItem,
|
|
13
13
|
} from '@mui/material';
|
|
14
|
-
import { useWallet } from '@solana/wallet-adapter-react';
|
|
15
14
|
import { useTranslation } from 'react-i18next';
|
|
16
15
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
17
16
|
import type { Connector } from 'wagmi';
|
|
18
|
-
import { useDisconnect } from 'wagmi';
|
|
19
17
|
import { useAccount, useAvailableChains } from '../../hooks';
|
|
20
18
|
import { navigationRoutes, shortenAddress } from '../../utils';
|
|
21
19
|
import { SmallAvatar } from '../SmallAvatar';
|
|
20
|
+
import { EVMDisconnectIconButton } from './EVMDisconnectIconButton.js';
|
|
21
|
+
import { SVMDisconnectIconButton } from './SVMDisconnectIconButton.js';
|
|
22
22
|
|
|
23
23
|
export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
24
24
|
const { t } = useTranslation();
|
|
@@ -34,72 +34,70 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
|
34
34
|
return (
|
|
35
35
|
<Box>
|
|
36
36
|
<Box display="flex" flexDirection="column">
|
|
37
|
-
{accounts
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
sx={{ marginRight: 1.5 }}
|
|
73
|
-
>
|
|
74
|
-
{avatar}
|
|
75
|
-
</Badge>
|
|
76
|
-
) : (
|
|
77
|
-
avatar
|
|
78
|
-
)}
|
|
79
|
-
{walletAddress}
|
|
80
|
-
</Box>
|
|
81
|
-
<Box ml={1}>
|
|
82
|
-
<IconButton size="medium" onClick={handleCopyAddress}>
|
|
83
|
-
<ContentCopyIcon />
|
|
84
|
-
</IconButton>
|
|
85
|
-
<IconButton
|
|
86
|
-
size="medium"
|
|
87
|
-
component="a"
|
|
88
|
-
onClick={onClose}
|
|
89
|
-
href={`${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`}
|
|
90
|
-
target="_blank"
|
|
37
|
+
{accounts.map((account) => {
|
|
38
|
+
const chain = getChainById(account.chainId);
|
|
39
|
+
const walletAddress = shortenAddress(account.address);
|
|
40
|
+
const handleCopyAddress = async () => {
|
|
41
|
+
await navigator.clipboard.writeText(account.address ?? '');
|
|
42
|
+
onClose();
|
|
43
|
+
};
|
|
44
|
+
const avatar = (
|
|
45
|
+
<Avatar
|
|
46
|
+
src={
|
|
47
|
+
account.connector?.icon ||
|
|
48
|
+
getWalletIcon((account.connector as Connector)?.id)
|
|
49
|
+
}
|
|
50
|
+
alt={account.connector?.name}
|
|
51
|
+
sx={{
|
|
52
|
+
marginRight: chain?.logoURI ? 0 : 1.5,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{account.connector?.name[0]}
|
|
56
|
+
</Avatar>
|
|
57
|
+
);
|
|
58
|
+
return (
|
|
59
|
+
<MenuItem key={account.address}>
|
|
60
|
+
<Box flex={1} display="flex" alignItems="center">
|
|
61
|
+
{chain?.logoURI ? (
|
|
62
|
+
<Badge
|
|
63
|
+
overlap="circular"
|
|
64
|
+
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
|
|
65
|
+
badgeContent={
|
|
66
|
+
<SmallAvatar src={chain?.logoURI} alt={chain?.name}>
|
|
67
|
+
{chain?.name[0]}
|
|
68
|
+
</SmallAvatar>
|
|
69
|
+
}
|
|
70
|
+
sx={{ marginRight: 1.5 }}
|
|
91
71
|
>
|
|
92
|
-
|
|
93
|
-
</
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
72
|
+
{avatar}
|
|
73
|
+
</Badge>
|
|
74
|
+
) : (
|
|
75
|
+
avatar
|
|
76
|
+
)}
|
|
77
|
+
{walletAddress}
|
|
78
|
+
</Box>
|
|
79
|
+
<Box ml={1}>
|
|
80
|
+
<IconButton size="medium" onClick={handleCopyAddress}>
|
|
81
|
+
<ContentCopyIcon />
|
|
82
|
+
</IconButton>
|
|
83
|
+
<IconButton
|
|
84
|
+
size="medium"
|
|
85
|
+
component="a"
|
|
86
|
+
onClick={onClose}
|
|
87
|
+
href={`${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`}
|
|
88
|
+
target="_blank"
|
|
89
|
+
>
|
|
90
|
+
<OpenInNewIcon />
|
|
91
|
+
</IconButton>
|
|
92
|
+
{account.chainType === ChainType.EVM ? (
|
|
93
|
+
<EVMDisconnectIconButton connector={account.connector} />
|
|
94
|
+
) : account.chainType === ChainType.SVM ? (
|
|
95
|
+
<SVMDisconnectIconButton />
|
|
96
|
+
) : null}
|
|
97
|
+
</Box>
|
|
98
|
+
</MenuItem>
|
|
99
|
+
);
|
|
100
|
+
})}
|
|
103
101
|
</Box>
|
|
104
102
|
{!pathname.includes(navigationRoutes.selectWallet) ? (
|
|
105
103
|
<Button
|
|
@@ -110,7 +108,7 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
|
110
108
|
marginTop: 1,
|
|
111
109
|
}}
|
|
112
110
|
>
|
|
113
|
-
{accounts.
|
|
111
|
+
{accounts.length > 1
|
|
114
112
|
? t(`button.changeWallet`)
|
|
115
113
|
: t(`button.connectWallet`)}
|
|
116
114
|
</Button>
|
|
@@ -118,35 +116,3 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
|
118
116
|
</Box>
|
|
119
117
|
);
|
|
120
118
|
};
|
|
121
|
-
|
|
122
|
-
const EVMDisconnectIconButton = ({ connector }: { connector?: Connector }) => {
|
|
123
|
-
const { disconnect } = useDisconnect();
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<IconButton
|
|
127
|
-
size="medium"
|
|
128
|
-
onClick={(e) => {
|
|
129
|
-
e.stopPropagation();
|
|
130
|
-
disconnect({ connector });
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
<PowerSettingsNewIcon />
|
|
134
|
-
</IconButton>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const SVMDisconnectIconButton = () => {
|
|
139
|
-
const { disconnect } = useWallet();
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<IconButton
|
|
143
|
-
size="medium"
|
|
144
|
-
onClick={(e) => {
|
|
145
|
-
e.stopPropagation();
|
|
146
|
-
disconnect();
|
|
147
|
-
}}
|
|
148
|
-
>
|
|
149
|
-
<PowerSettingsNewIcon />
|
|
150
|
-
</IconButton>
|
|
151
|
-
);
|
|
152
|
-
};
|
|
@@ -15,19 +15,19 @@ export const SelectTokenCardHeader = styled(CardHeader, {
|
|
|
15
15
|
textOverflow: 'ellipsis',
|
|
16
16
|
whiteSpace: 'nowrap',
|
|
17
17
|
overflow: 'hidden',
|
|
18
|
-
width: compact ?
|
|
18
|
+
width: compact ? 88 : 256,
|
|
19
19
|
fontSize: compact && !selected ? 16 : 18,
|
|
20
20
|
[theme.breakpoints.down(392)]: {
|
|
21
|
-
width: compact ?
|
|
21
|
+
width: compact ? 88 : 224,
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
[`.${cardHeaderClasses.subheader}`]: {
|
|
25
25
|
textOverflow: 'ellipsis',
|
|
26
26
|
whiteSpace: 'nowrap',
|
|
27
27
|
overflow: 'hidden',
|
|
28
|
-
width: compact ?
|
|
28
|
+
width: compact ? 88 : 256,
|
|
29
29
|
[theme.breakpoints.down(392)]: {
|
|
30
|
-
width: compact ?
|
|
30
|
+
width: compact ? 88 : 224,
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
}),
|
|
@@ -73,8 +73,16 @@ export const SelectTokenButton: React.FC<
|
|
|
73
73
|
)
|
|
74
74
|
}
|
|
75
75
|
title={isSelected ? token.symbol : defaultPlaceholder}
|
|
76
|
-
|
|
77
|
-
isSelected ?
|
|
76
|
+
titleTypographyProps={{
|
|
77
|
+
title: isSelected ? token.symbol : defaultPlaceholder,
|
|
78
|
+
}}
|
|
79
|
+
subheader={isSelected ? chain.name : null}
|
|
80
|
+
subheaderTypographyProps={
|
|
81
|
+
isSelected
|
|
82
|
+
? {
|
|
83
|
+
title: chain.name,
|
|
84
|
+
}
|
|
85
|
+
: undefined
|
|
78
86
|
}
|
|
79
87
|
selected={isSelected}
|
|
80
88
|
compact={compact}
|
|
@@ -25,7 +25,7 @@ export const StepFeeBreakdown: React.FC<{
|
|
|
25
25
|
: 0;
|
|
26
26
|
fees += amountUSD;
|
|
27
27
|
feeComponents.push(
|
|
28
|
-
<Box
|
|
28
|
+
<Box ml={7} key="network">
|
|
29
29
|
<Typography
|
|
30
30
|
fontSize={12}
|
|
31
31
|
lineHeight={2}
|
|
@@ -59,7 +59,7 @@ export const StepFeeBreakdown: React.FC<{
|
|
|
59
59
|
: 0;
|
|
60
60
|
fees += amountUSD;
|
|
61
61
|
feeComponents.push(
|
|
62
|
-
<Box mt={0.5} ml={7} key="bridge">
|
|
62
|
+
<Box mt={feeComponents.length ? 0.5 : 0} ml={7} key="bridge">
|
|
63
63
|
<Typography
|
|
64
64
|
fontSize={12}
|
|
65
65
|
lineHeight={2}
|
|
@@ -2,18 +2,17 @@ import { Box } from '@mui/material';
|
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import {
|
|
5
|
-
useAccount,
|
|
6
5
|
useChain,
|
|
7
6
|
useDebouncedWatch,
|
|
8
7
|
useTokenBalances,
|
|
9
8
|
useTokenSearch,
|
|
10
9
|
} from '../../hooks';
|
|
10
|
+
import { FormKeyHelper, useFieldValues } from '../../stores';
|
|
11
11
|
import type { TokenAmount } from '../../types';
|
|
12
12
|
import { TokenNotFound } from './TokenNotFound';
|
|
13
13
|
import { VirtualizedTokenList } from './VirtualizedTokenList';
|
|
14
14
|
import type { TokenListProps } from './types';
|
|
15
15
|
import { useTokenSelect } from './useTokenSelect';
|
|
16
|
-
import { useFieldValues, FormKeyHelper } from '../../stores';
|
|
17
16
|
|
|
18
17
|
export const TokenList: FC<TokenListProps> = ({
|
|
19
18
|
formType,
|
|
@@ -21,11 +20,10 @@ export const TokenList: FC<TokenListProps> = ({
|
|
|
21
20
|
onClick,
|
|
22
21
|
}) => {
|
|
23
22
|
const parentRef = useRef<HTMLUListElement | null>(null);
|
|
24
|
-
const { account } = useAccount();
|
|
25
23
|
const [selectedChainId] = useFieldValues(FormKeyHelper.getChainKey(formType));
|
|
26
24
|
const [tokenSearchFilter]: string[] = useDebouncedWatch(
|
|
27
|
-
['tokenSearchFilter'],
|
|
28
25
|
320,
|
|
26
|
+
'tokenSearchFilter',
|
|
29
27
|
);
|
|
30
28
|
|
|
31
29
|
const { chain, isLoading: isChainLoading } = useChain(selectedChainId);
|
|
@@ -86,7 +84,6 @@ export const TokenList: FC<TokenListProps> = ({
|
|
|
86
84
|
chain={chain}
|
|
87
85
|
isLoading={isLoading}
|
|
88
86
|
isBalanceLoading={isBalanceLoading}
|
|
89
|
-
showBalance={account.isConnected}
|
|
90
87
|
showFeatured={!tokenSearchFilter}
|
|
91
88
|
onClick={handleTokenClick}
|
|
92
89
|
/>
|
|
@@ -3,6 +3,7 @@ import { useVirtualizer } from '@tanstack/react-virtual';
|
|
|
3
3
|
import type { FC } from 'react';
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useAccount } from '../../hooks';
|
|
6
7
|
import { TokenListItem, TokenListItemSkeleton } from './TokenListItem';
|
|
7
8
|
import type { VirtualizedTokenListProps } from './types';
|
|
8
9
|
|
|
@@ -14,10 +15,10 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
14
15
|
chain,
|
|
15
16
|
isLoading,
|
|
16
17
|
isBalanceLoading,
|
|
17
|
-
showBalance,
|
|
18
18
|
showFeatured,
|
|
19
19
|
onClick,
|
|
20
20
|
}) => {
|
|
21
|
+
const { isConnected } = useAccount();
|
|
21
22
|
const { t } = useTranslation();
|
|
22
23
|
|
|
23
24
|
const hasFeaturedTokens = !!featuredTokensLength && showFeatured;
|
|
@@ -83,7 +84,7 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
83
84
|
token={token}
|
|
84
85
|
chain={chain}
|
|
85
86
|
isBalanceLoading={isBalanceLoading}
|
|
86
|
-
showBalance={
|
|
87
|
+
showBalance={isConnected}
|
|
87
88
|
startAdornment={
|
|
88
89
|
hasFeaturedTokens && token.featured && item.index === 0 ? (
|
|
89
90
|
<Typography
|
|
@@ -15,9 +15,8 @@ export interface VirtualizedTokenListProps {
|
|
|
15
15
|
scrollElementRef: MutableRefObject<HTMLElement | null>;
|
|
16
16
|
isLoading: boolean;
|
|
17
17
|
isBalanceLoading: boolean;
|
|
18
|
-
chainId
|
|
18
|
+
chainId?: number;
|
|
19
19
|
chain?: ExtendedChain;
|
|
20
|
-
showBalance?: boolean;
|
|
21
20
|
showFeatured?: boolean;
|
|
22
21
|
onClick(tokenAddress: string): void;
|
|
23
22
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { WidgetEvent, useWidgetEvents } from '@lifi/widget';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
-
import type { FormType } from '../../stores';
|
|
4
3
|
import { useWidgetConfig } from '../../providers';
|
|
4
|
+
import type { FormType } from '../../stores';
|
|
5
5
|
import {
|
|
6
|
+
FormKeyHelper,
|
|
6
7
|
useFieldActions,
|
|
7
8
|
useFieldController,
|
|
8
|
-
FormKeyHelper,
|
|
9
9
|
} from '../../stores';
|
|
10
10
|
|
|
11
11
|
export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
@@ -48,10 +48,12 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
|
48
48
|
? WidgetEvent.SourceChainTokenSelected
|
|
49
49
|
: WidgetEvent.DestinationChainTokenSelected;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (selectedChainId) {
|
|
52
|
+
emitter.emit(eventToEmit, {
|
|
53
|
+
chainId: selectedChainId,
|
|
54
|
+
tokenAddress,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
55
57
|
|
|
56
58
|
onClick?.();
|
|
57
59
|
},
|
package/config/queryClient.ts
CHANGED
package/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '3.0.0-alpha.
|
|
2
|
+
export const version = '3.0.0-alpha.13';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const defaultWalletConnectProjectId = '5432e3507d41270bee46b7b85bbc2ef8';
|
package/hooks/useAccount.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { useWallet } from '@solana/wallet-adapter-react';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import type { Chain } from 'viem';
|
|
6
6
|
import type { Connector } from 'wagmi';
|
|
7
|
-
import {
|
|
7
|
+
import { useAccount as useWagmiAccount } from 'wagmi';
|
|
8
8
|
|
|
9
9
|
export interface AccountBase {
|
|
10
10
|
address?: string;
|
|
@@ -33,7 +33,11 @@ export type Account = EVMAccount | SVMAccount;
|
|
|
33
33
|
|
|
34
34
|
export interface AccountResult {
|
|
35
35
|
account: Account;
|
|
36
|
+
/**
|
|
37
|
+
* Connected accounts
|
|
38
|
+
*/
|
|
36
39
|
accounts: Account[];
|
|
40
|
+
isConnected: boolean;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
export const useAccount = (): AccountResult => {
|
|
@@ -63,24 +67,12 @@ export const useAccount = (): AccountResult => {
|
|
|
63
67
|
};
|
|
64
68
|
const evm: Account = { ...account, chainType: ChainType.EVM };
|
|
65
69
|
|
|
70
|
+
const accounts = [evm, svm].filter((account) => account.isConnected);
|
|
66
71
|
return {
|
|
67
72
|
account: account.isConnected ? evm : svm,
|
|
68
|
-
|
|
73
|
+
// We need to return only connected account list
|
|
74
|
+
accounts,
|
|
75
|
+
isConnected: accounts.length > 0,
|
|
69
76
|
};
|
|
70
77
|
}, [account, wallet]);
|
|
71
78
|
};
|
|
72
|
-
|
|
73
|
-
export const useAccountDisconnect = () => {
|
|
74
|
-
const account = useWagmiAccount();
|
|
75
|
-
const { disconnect: wagmiDisconnect } = useDisconnect();
|
|
76
|
-
const { wallet, disconnect } = useWallet();
|
|
77
|
-
|
|
78
|
-
return () => {
|
|
79
|
-
if (account.isConnected) {
|
|
80
|
-
wagmiDisconnect();
|
|
81
|
-
}
|
|
82
|
-
if (wallet) {
|
|
83
|
-
disconnect();
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
};
|
|
@@ -2,16 +2,23 @@ import type { ExtendedChain } from '@lifi/sdk';
|
|
|
2
2
|
import { ChainType, config, getChains } from '@lifi/sdk';
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
+
import { useHasExternalWalletProvider, useWidgetConfig } from '../providers';
|
|
6
|
+
import { isItemAllowed } from '../utils';
|
|
5
7
|
|
|
6
8
|
export const useAvailableChains = () => {
|
|
9
|
+
const { chains } = useWidgetConfig();
|
|
10
|
+
const { providers } = useHasExternalWalletProvider();
|
|
7
11
|
const { data, isLoading } = useQuery({
|
|
8
|
-
queryKey: ['chains'],
|
|
9
|
-
queryFn: async () => {
|
|
10
|
-
const
|
|
11
|
-
chainTypes:
|
|
12
|
+
queryKey: ['chains', providers, chains?.types] as const,
|
|
13
|
+
queryFn: async ({ queryKey: [, providers, chainTypes] }) => {
|
|
14
|
+
const availableChains = await getChains({
|
|
15
|
+
chainTypes: (providers.length > 0
|
|
16
|
+
? providers
|
|
17
|
+
: Object.values(ChainType)
|
|
18
|
+
).filter((chainType) => isItemAllowed(chainType, chainTypes)),
|
|
12
19
|
});
|
|
13
|
-
config.setChains(
|
|
14
|
-
return
|
|
20
|
+
config.setChains(availableChains);
|
|
21
|
+
return availableChains;
|
|
15
22
|
},
|
|
16
23
|
refetchInterval: 300000,
|
|
17
24
|
staleTime: 300000,
|
package/hooks/useChains.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useWidgetConfig } from '../providers';
|
|
3
|
+
import type { FormType } from '../stores';
|
|
4
|
+
import { isItemAllowed } from '../utils';
|
|
3
5
|
import { useAvailableChains } from './useAvailableChains';
|
|
4
6
|
|
|
5
|
-
export const useChains = () => {
|
|
7
|
+
export const useChains = (type?: FormType) => {
|
|
6
8
|
const { chains } = useWidgetConfig();
|
|
7
9
|
const {
|
|
8
10
|
chains: availableChains,
|
|
@@ -11,11 +13,15 @@ export const useChains = () => {
|
|
|
11
13
|
} = useAvailableChains();
|
|
12
14
|
|
|
13
15
|
const filteredChains = useMemo(() => {
|
|
14
|
-
const filteredChains =
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const filteredChains = type
|
|
17
|
+
? availableChains?.filter(
|
|
18
|
+
(chain) =>
|
|
19
|
+
isItemAllowed(chain.id, chains) &&
|
|
20
|
+
isItemAllowed(chain.id, chains?.[type]),
|
|
21
|
+
)
|
|
22
|
+
: availableChains?.filter((chain) => isItemAllowed(chain.id, chains));
|
|
17
23
|
return filteredChains;
|
|
18
|
-
}, [availableChains, chains]);
|
|
24
|
+
}, [availableChains, chains, type]);
|
|
19
25
|
|
|
20
26
|
return {
|
|
21
27
|
chains: filteredChains,
|
|
@@ -2,17 +2,18 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import type { FormFieldNames } from '../stores';
|
|
3
3
|
import { useFieldValues } from '../stores';
|
|
4
4
|
|
|
5
|
-
export const useDebouncedWatch =
|
|
5
|
+
export const useDebouncedWatch = <T extends FormFieldNames[]>(
|
|
6
|
+
delay: number,
|
|
7
|
+
...name: T
|
|
8
|
+
) => {
|
|
6
9
|
const watchedValue = useFieldValues(...name);
|
|
7
10
|
const [debouncedValue, setDebouncedValue] = useState(watchedValue);
|
|
8
|
-
const debouncedValueRef = useRef<
|
|
11
|
+
const debouncedValueRef = useRef<typeof watchedValue>();
|
|
9
12
|
const isMounted = useRef(false);
|
|
10
13
|
|
|
11
14
|
useEffect(() => {
|
|
12
15
|
if (isMounted.current) {
|
|
13
|
-
const hasWatchedValue = watchedValue.some(
|
|
14
|
-
(value: FormFieldNames) => value,
|
|
15
|
-
);
|
|
16
|
+
const hasWatchedValue = watchedValue.some((value) => value);
|
|
16
17
|
if (hasWatchedValue) {
|
|
17
18
|
const handler = setTimeout(() => {
|
|
18
19
|
setDebouncedValue(watchedValue);
|
|
@@ -9,7 +9,7 @@ import { getTokenBalancesWithRetry } from './useTokenBalance';
|
|
|
9
9
|
const refetchInterval = 30_000;
|
|
10
10
|
|
|
11
11
|
export const useFromTokenSufficiency = (route?: RouteExtended) => {
|
|
12
|
-
const {
|
|
12
|
+
const { accounts } = useAccount();
|
|
13
13
|
const [fromChainId, fromTokenAddress, fromAmount] = useFieldValues(
|
|
14
14
|
'fromChain',
|
|
15
15
|
'fromToken',
|
|
@@ -23,19 +23,26 @@ export const useFromTokenSufficiency = (route?: RouteExtended) => {
|
|
|
23
23
|
tokenAddress = route.fromToken.address;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const {
|
|
27
|
-
|
|
26
|
+
const {
|
|
27
|
+
token,
|
|
28
|
+
chain,
|
|
29
|
+
isLoading: isTokenAddressBalanceLoading,
|
|
30
|
+
} = useTokenAddressBalance(chainId, tokenAddress);
|
|
31
|
+
|
|
32
|
+
const account = accounts.find(
|
|
33
|
+
(account) => account.chainType === chain?.chainType,
|
|
34
|
+
);
|
|
28
35
|
|
|
29
36
|
const { data: insufficientFromToken, isLoading } = useQuery({
|
|
30
37
|
queryKey: [
|
|
31
38
|
'from-token-sufficiency-check',
|
|
32
|
-
account
|
|
39
|
+
account?.address,
|
|
33
40
|
chainId,
|
|
34
41
|
tokenAddress,
|
|
35
42
|
route?.id ?? fromAmount,
|
|
36
|
-
],
|
|
37
|
-
queryFn: async () => {
|
|
38
|
-
if (!
|
|
43
|
+
] as const,
|
|
44
|
+
queryFn: async ({ queryKey: [, accountAddress] }) => {
|
|
45
|
+
if (!accountAddress || !token) {
|
|
39
46
|
return;
|
|
40
47
|
}
|
|
41
48
|
const parsedFromAmount = parseUnits(fromAmount, token.decimals);
|
|
@@ -60,7 +67,7 @@ export const useFromTokenSufficiency = (route?: RouteExtended) => {
|
|
|
60
67
|
return insufficientFunds;
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
const tokenBalances = await getTokenBalancesWithRetry(
|
|
70
|
+
const tokenBalances = await getTokenBalancesWithRetry(accountAddress, [
|
|
64
71
|
currentAction.fromToken,
|
|
65
72
|
]);
|
|
66
73
|
|
|
@@ -70,7 +77,9 @@ export const useFromTokenSufficiency = (route?: RouteExtended) => {
|
|
|
70
77
|
return insufficientFunds;
|
|
71
78
|
},
|
|
72
79
|
|
|
73
|
-
enabled: Boolean(
|
|
80
|
+
enabled: Boolean(
|
|
81
|
+
account?.address && token && !isTokenAddressBalanceLoading,
|
|
82
|
+
),
|
|
74
83
|
refetchInterval,
|
|
75
84
|
staleTime: refetchInterval,
|
|
76
85
|
placeholderData: keepPreviousData,
|