@rango-dev/widget-embedded 0.31.1-next.3 → 0.32.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/CHANGELOG.md +9 -0
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +4 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.types.d.ts +1 -0
- package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -1
- package/dist/components/BlockchainSelectorButton/BlockchainSelectorButton.d.ts +4 -0
- package/dist/components/BlockchainSelectorButton/BlockchainSelectorButton.d.ts.map +1 -0
- package/dist/components/BlockchainSelectorButton/BlockchainSelectorButton.styles.d.ts +483 -0
- package/dist/components/BlockchainSelectorButton/BlockchainSelectorButton.styles.d.ts.map +1 -0
- package/dist/components/BlockchainSelectorButton/BlockchainSelectorButton.types.d.ts +12 -0
- package/dist/components/BlockchainSelectorButton/BlockchainSelectorButton.types.d.ts.map +1 -0
- package/dist/components/BlockchainSelectorButton/index.d.ts +2 -0
- package/dist/components/BlockchainSelectorButton/index.d.ts.map +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +11 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +3 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +4 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -1
- package/dist/components/CustomDestination/CustomDestination.d.ts.map +1 -1
- package/dist/components/CustomDestination/CustomDestination.styles.d.ts +5 -2
- package/dist/components/CustomDestination/CustomDestination.styles.d.ts.map +1 -1
- package/dist/components/CustomTokenModal/CustomTokenModal.d.ts +4 -0
- package/dist/components/CustomTokenModal/CustomTokenModal.d.ts.map +1 -0
- package/dist/components/CustomTokenModal/CustomTokenModal.helpers.d.ts +3 -0
- package/dist/components/CustomTokenModal/CustomTokenModal.helpers.d.ts.map +1 -0
- package/dist/components/CustomTokenModal/CustomTokenModal.styles.d.ts +323 -0
- package/dist/components/CustomTokenModal/CustomTokenModal.styles.d.ts.map +1 -0
- package/dist/components/CustomTokenModal/CustomTokenModal.types.d.ts +9 -0
- package/dist/components/CustomTokenModal/CustomTokenModal.types.d.ts.map +1 -0
- package/dist/components/CustomTokenModal/index.d.ts +2 -0
- package/dist/components/CustomTokenModal/index.d.ts.map +1 -0
- package/dist/components/FilterSelector/FilterSelector.style.d.ts +6 -0
- package/dist/components/FilterSelector/FilterSelector.style.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +8 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts +6 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts +4 -0
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/PageContainer.d.ts +1 -0
- package/dist/components/Layout/PageContainer.d.ts.map +1 -1
- package/dist/components/Layout/ScrollableArea.d.ts +1 -0
- package/dist/components/Layout/ScrollableArea.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +14 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.styles.d.ts +4 -0
- package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +22 -1
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts +5 -0
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +2 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +10 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +5 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/Quotes/Quotes.styles.d.ts +3 -0
- package/dist/components/Quotes/Quotes.styles.d.ts.map +1 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +2 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +1 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +3 -0
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +5 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +15 -0
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +3 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +2 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwitchFromAndTo/SwitchFromAndTo.styles.d.ts +2 -0
- package/dist/components/SwitchFromAndTo/SwitchFromAndTo.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +18 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +5 -2
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.d.ts +4 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.d.ts.map +1 -0
- package/dist/components/{WalletStatefulConnect/DerivationPath.styles.d.ts → WalletDerivationPathModal/WalletDerivationPathModal.styles.d.ts} +3 -1
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.styles.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.types.d.ts +10 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.types.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/index.d.ts +2 -0
- package/dist/components/WalletDerivationPathModal/index.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.d.ts +4 -0
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
- package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
- package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
- package/dist/components/{WalletStatefulConnect/ConnectStatus.styles.d.ts → WalletModal/WalletModalContent.styles.d.ts} +5 -1
- package/dist/components/{WalletStatefulConnect/ConnectStatus.styles.d.ts.map → WalletModal/WalletModalContent.styles.d.ts.map} +1 -1
- package/dist/components/WalletModal/index.d.ts +2 -0
- package/dist/components/WalletModal/index.d.ts.map +1 -0
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.d.ts +4 -0
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.d.ts.map +1 -0
- package/dist/components/{WalletStatefulConnect/Namespaces.styles.d.ts → WalletNamespacesModal/WalletNamespacesModal.styles.d.ts} +2 -1
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.styles.d.ts.map +1 -0
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts +10 -0
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts.map +1 -0
- package/dist/components/WalletNamespacesModal/index.d.ts +2 -0
- package/dist/components/WalletNamespacesModal/index.d.ts.map +1 -0
- package/dist/constants/customTokens.d.ts +2 -0
- package/dist/constants/customTokens.d.ts.map +1 -0
- package/dist/constants/navigationRoutes.d.ts +2 -0
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +1 -0
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts +1 -0
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts +2 -0
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
- package/dist/containers/Inputs/Inputs.styles.d.ts +2 -0
- package/dist/containers/Inputs/Inputs.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +3 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/Settings/Lists.d.ts.map +1 -1
- package/dist/hooks/useFetchCustomToken.d.ts +16 -0
- package/dist/hooks/useFetchCustomToken.d.ts.map +1 -0
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts +1 -0
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +14 -11
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/AddCustomTokenPage.d.ts +3 -0
- package/dist/pages/AddCustomTokenPage.d.ts.map +1 -0
- package/dist/pages/CustomTokensPage.d.ts +3 -0
- package/dist/pages/CustomTokensPage.d.ts.map +1 -0
- package/dist/pages/SelectBlockchainPage.d.ts +2 -1
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +2 -0
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/AppStore.d.ts +2 -0
- package/dist/store/AppStore.d.ts.map +1 -1
- package/dist/store/app.d.ts +2 -0
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +4 -3
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts +7 -2
- package/dist/store/slices/settings.d.ts.map +1 -1
- package/dist/store/utils/data.d.ts +4 -1
- package/dist/store/utils/data.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/quote.d.ts +1 -0
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +3 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +5 -5
- package/src/components/AppRoutes.tsx +30 -0
- package/src/components/BlockchainList/BlockchainList.styles.ts +3 -1
- package/src/components/BlockchainList/BlockchainList.tsx +26 -17
- package/src/components/BlockchainList/BlockchainList.types.ts +1 -0
- package/src/components/BlockchainSelectorButton/BlockchainSelectorButton.styles.ts +49 -0
- package/src/components/BlockchainSelectorButton/BlockchainSelectorButton.tsx +47 -0
- package/src/components/BlockchainSelectorButton/BlockchainSelectorButton.types.ts +11 -0
- package/src/components/BlockchainSelectorButton/index.ts +1 -0
- package/src/components/ConfirmWalletsModal/WalletList.tsx +243 -52
- package/src/components/CustomDestination/CustomDestination.tsx +5 -3
- package/src/components/CustomTokenModal/CustomTokenModal.helpers.ts +19 -0
- package/src/components/CustomTokenModal/CustomTokenModal.styles.ts +57 -0
- package/src/components/CustomTokenModal/CustomTokenModal.tsx +92 -0
- package/src/components/CustomTokenModal/CustomTokenModal.types.ts +9 -0
- package/src/components/CustomTokenModal/index.ts +1 -0
- package/src/components/HeaderButtons/WalletButton.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +113 -23
- package/src/components/TokenList/TokenList.styles.ts +1 -0
- package/src/components/TokenList/TokenList.tsx +76 -51
- package/src/components/TokenList/TokenList.types.ts +5 -2
- package/src/components/{WalletStatefulConnect/DerivationPath.tsx → WalletDerivationPathModal/WalletDerivationPathModal.tsx} +36 -18
- package/src/components/WalletDerivationPathModal/WalletDerivationPathModal.types.tsx +10 -0
- package/src/components/WalletDerivationPathModal/index.ts +1 -0
- package/src/components/WalletModal/WalletModal.tsx +25 -0
- package/src/components/WalletModal/WalletModal.types.ts +11 -0
- package/src/components/{WalletStatefulConnect/ConnectStatus.tsx → WalletModal/WalletModalContent.tsx} +5 -13
- package/src/components/WalletModal/index.ts +1 -0
- package/src/components/{WalletStatefulConnect/Namespaces.tsx → WalletNamespacesModal/WalletNamespacesModal.tsx} +27 -9
- package/src/components/{WalletStatefulConnect/Namespaces.types.tsx → WalletNamespacesModal/WalletNamespacesModal.types.tsx} +5 -2
- package/src/components/WalletNamespacesModal/index.ts +1 -0
- package/src/constants/customTokens.ts +6 -0
- package/src/constants/navigationRoutes.ts +2 -0
- package/src/constants/searchParams.ts +3 -0
- package/src/containers/Settings/Lists.tsx +25 -1
- package/src/hooks/useFetchCustomToken.ts +114 -0
- package/src/hooks/useSwapInput.ts +8 -3
- package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +6 -1
- package/src/hooks/useTheme.ts +5 -1
- package/src/hooks/useWalletList.ts +53 -22
- package/src/pages/AddCustomTokenPage.tsx +210 -0
- package/src/pages/CustomTokensPage.tsx +184 -0
- package/src/pages/HistoryPage.tsx +2 -2
- package/src/pages/LiquiditySourcePage.tsx +2 -2
- package/src/pages/SelectBlockchainPage.tsx +15 -8
- package/src/pages/SelectSwapItemsPage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +162 -10
- package/src/store/app.ts +1 -0
- package/src/store/quote.ts +12 -2
- package/src/store/slices/data.ts +61 -8
- package/src/store/slices/settings.ts +35 -2
- package/src/store/utils/data.ts +26 -1
- package/src/store/wallets.ts +1 -1
- package/src/types/config.ts +4 -1
- package/src/utils/meta.ts +12 -1
- package/src/utils/quote.ts +16 -3
- package/src/utils/settings.ts +13 -1
- package/src/utils/swap.ts +7 -7
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +0 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +0 -1
- package/dist/components/StatefulConnectModal/StatefulConnectModal.d.ts +0 -11
- package/dist/components/StatefulConnectModal/StatefulConnectModal.d.ts.map +0 -1
- package/dist/components/StatefulConnectModal/helpers.d.ts +0 -10
- package/dist/components/StatefulConnectModal/helpers.d.ts.map +0 -1
- package/dist/components/StatefulConnectModal/index.d.ts +0 -2
- package/dist/components/StatefulConnectModal/index.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ConnectStatus.d.ts +0 -4
- package/dist/components/WalletStatefulConnect/ConnectStatus.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ConnectStatus.types.d.ts +0 -8
- package/dist/components/WalletStatefulConnect/ConnectStatus.types.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.d.ts +0 -4
- package/dist/components/WalletStatefulConnect/DerivationPath.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts +0 -4
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.styles.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.types.d.ts +0 -6
- package/dist/components/WalletStatefulConnect/DerivationPath.types.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts +0 -8
- package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts +0 -4
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts +0 -8
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts +0 -6
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/Namespaces.d.ts +0 -4
- package/dist/components/WalletStatefulConnect/Namespaces.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/Namespaces.helpers.d.ts +0 -3
- package/dist/components/WalletStatefulConnect/Namespaces.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/Namespaces.styles.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts +0 -7
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/index.d.ts +0 -5
- package/dist/components/WalletStatefulConnect/index.d.ts.map +0 -1
- package/dist/hooks/useStatefulConnect/index.d.ts +0 -5
- package/dist/hooks/useStatefulConnect/index.d.ts.map +0 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts +0 -25
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts.map +0 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.helpers.d.ts +0 -8
- package/dist/hooks/useStatefulConnect/useStatefulConnect.helpers.d.ts.map +0 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.state.d.ts +0 -9
- package/dist/hooks/useStatefulConnect/useStatefulConnect.state.d.ts.map +0 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts +0 -43
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts.map +0 -1
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +0 -10
- package/src/components/StatefulConnectModal/StatefulConnectModal.tsx +0 -168
- package/src/components/StatefulConnectModal/helpers.ts +0 -23
- package/src/components/StatefulConnectModal/index.ts +0 -1
- package/src/components/WalletStatefulConnect/ConnectStatus.types.ts +0 -11
- package/src/components/WalletStatefulConnect/DerivationPath.helpers.ts +0 -23
- package/src/components/WalletStatefulConnect/DerivationPath.types.ts +0 -6
- package/src/components/WalletStatefulConnect/ExperimentalChain.tsx +0 -36
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.ts +0 -53
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.tsx +0 -35
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.types.ts +0 -5
- package/src/components/WalletStatefulConnect/Namespaces.helpers.ts +0 -9
- package/src/components/WalletStatefulConnect/index.ts +0 -4
- package/src/hooks/useStatefulConnect/index.ts +0 -9
- package/src/hooks/useStatefulConnect/useStatefulConnect.helpers.ts +0 -13
- package/src/hooks/useStatefulConnect/useStatefulConnect.state.ts +0 -45
- package/src/hooks/useStatefulConnect/useStatefulConnect.ts +0 -232
- package/src/hooks/useStatefulConnect/useStatefulConnect.types.ts +0 -56
- /package/src/components/{WalletStatefulConnect/DerivationPath.styles.ts → WalletDerivationPathModal/WalletDerivationPathModal.styles.ts} +0 -0
- /package/src/components/{WalletStatefulConnect/ConnectStatus.styles.ts → WalletModal/WalletModalContent.styles.ts} +0 -0
- /package/src/components/{WalletStatefulConnect/Namespaces.styles.ts → WalletNamespacesModal/WalletNamespacesModal.styles.ts} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BlockchainMeta } from 'rango-types';
|
|
2
|
+
|
|
3
|
+
export function generateExplorerLink(
|
|
4
|
+
address: string | null,
|
|
5
|
+
blockchain: BlockchainMeta
|
|
6
|
+
): string {
|
|
7
|
+
// We don't have Cosmos explorer url in API.
|
|
8
|
+
if (blockchain.type === 'COSMOS') {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const explorerLinkPattern = blockchain.info?.addressUrl;
|
|
13
|
+
|
|
14
|
+
if (!explorerLinkPattern || !address) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return explorerLinkPattern.replace('{wallet}', address);
|
|
19
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
export const StyledLink = styled('a', {
|
|
4
|
+
textDecoration: 'none',
|
|
5
|
+
color: '$colors$neutral700',
|
|
6
|
+
[`.${darkTheme} &`]: {
|
|
7
|
+
color: '$colors$neutral900',
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
'& svg': {
|
|
11
|
+
marginLeft: '$4',
|
|
12
|
+
color: '$colors$neutral700',
|
|
13
|
+
[`.${darkTheme} &`]: {
|
|
14
|
+
color: '$colors$neutral900',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
variants: {
|
|
19
|
+
hasHover: {
|
|
20
|
+
true: {
|
|
21
|
+
'&:hover': {
|
|
22
|
+
color: '$colors$secondary550',
|
|
23
|
+
[`.${darkTheme} &`]: {
|
|
24
|
+
color: '$colors$secondary500',
|
|
25
|
+
},
|
|
26
|
+
'& svg': {
|
|
27
|
+
color: '$colors$secondary550',
|
|
28
|
+
[`.${darkTheme} &`]: {
|
|
29
|
+
color: '$colors$secondary500',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
false: {},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const Container = styled('div', {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
textAlign: 'center',
|
|
45
|
+
'& ._blockchain-name, & ._coin-source': {
|
|
46
|
+
color: '$colors$neutral600',
|
|
47
|
+
[`.${darkTheme} &`]: {
|
|
48
|
+
color: '$colors$neutral800',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
'& ._coin-source-name, & ._custom-token-description': {
|
|
52
|
+
color: '$colors$neutral700',
|
|
53
|
+
[`.${darkTheme} &`]: {
|
|
54
|
+
color: '$colors$neutral900',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { PropTypes } from './CustomTokenModal.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
Divider,
|
|
7
|
+
ExternalLinkIcon,
|
|
8
|
+
Image,
|
|
9
|
+
Typography,
|
|
10
|
+
} from '@rango-dev/ui';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
import { getContainer } from '../../utils/common';
|
|
14
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
15
|
+
|
|
16
|
+
import { generateExplorerLink } from './CustomTokenModal.helpers';
|
|
17
|
+
import { Container, StyledLink } from './CustomTokenModal.styles';
|
|
18
|
+
|
|
19
|
+
export function CustomTokenModal(props: PropTypes) {
|
|
20
|
+
const { open, onClose, token, onSubmitClick, blockchain } = props;
|
|
21
|
+
|
|
22
|
+
const explorerLink = generateExplorerLink(token.address, blockchain);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<WatermarkedModal
|
|
26
|
+
open={open}
|
|
27
|
+
dismissible
|
|
28
|
+
onClose={onClose}
|
|
29
|
+
container={getContainer()}>
|
|
30
|
+
<Container>
|
|
31
|
+
<Image src={token.image} size={45} type="circular" />
|
|
32
|
+
<Typography variant="title" size="medium">
|
|
33
|
+
{token.name}
|
|
34
|
+
</Typography>
|
|
35
|
+
<Typography variant="body" size="small" className="_blockchain-name">
|
|
36
|
+
{blockchain.displayName}
|
|
37
|
+
</Typography>
|
|
38
|
+
<Divider size={4} />
|
|
39
|
+
|
|
40
|
+
<Typography variant="body" size="medium">
|
|
41
|
+
{!!explorerLink ? (
|
|
42
|
+
<StyledLink
|
|
43
|
+
hasHover
|
|
44
|
+
href={explorerLink}
|
|
45
|
+
target="_blank"
|
|
46
|
+
rel="nofollow noreferrer">
|
|
47
|
+
{token.address}
|
|
48
|
+
<ExternalLinkIcon size={12} color="gray" />
|
|
49
|
+
</StyledLink>
|
|
50
|
+
) : (
|
|
51
|
+
<StyledLink>{token.address}</StyledLink>
|
|
52
|
+
)}
|
|
53
|
+
</Typography>
|
|
54
|
+
|
|
55
|
+
<Divider size={4} />
|
|
56
|
+
|
|
57
|
+
{token.coinSource && (
|
|
58
|
+
<Typography className="_coin-source" variant="body" size="xsmall">
|
|
59
|
+
{i18n.t('via')}{' '}
|
|
60
|
+
<Typography
|
|
61
|
+
className="_coin-source-name"
|
|
62
|
+
variant="body"
|
|
63
|
+
size="xsmall">
|
|
64
|
+
{token.coinSource}
|
|
65
|
+
</Typography>
|
|
66
|
+
</Typography>
|
|
67
|
+
)}
|
|
68
|
+
<Divider size={'32'} />
|
|
69
|
+
|
|
70
|
+
<Typography
|
|
71
|
+
size="medium"
|
|
72
|
+
variant="body"
|
|
73
|
+
className="_custom-token-description">
|
|
74
|
+
{i18n.t(
|
|
75
|
+
`This token doesn't appear on the active token list(s). Make sure this is the token that you want to trade.`
|
|
76
|
+
)}
|
|
77
|
+
</Typography>
|
|
78
|
+
</Container>
|
|
79
|
+
<Divider size={40} />
|
|
80
|
+
<Divider size={10} />
|
|
81
|
+
|
|
82
|
+
<Button
|
|
83
|
+
variant="contained"
|
|
84
|
+
size="large"
|
|
85
|
+
type="primary"
|
|
86
|
+
fullWidth
|
|
87
|
+
onClick={onSubmitClick}>
|
|
88
|
+
{i18n.t('Import')}
|
|
89
|
+
</Button>
|
|
90
|
+
</WatermarkedModal>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CustomTokenModal } from './CustomTokenModal';
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import type { WalletStateContentProps } from './SwapDetailsModal.types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Namespace } from '@rango-dev/wallets-shared';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { debug } from '@rango-dev/logging-core';
|
|
5
5
|
import { MessageBox, Wallet } from '@rango-dev/ui';
|
|
6
6
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
7
7
|
import React, { useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { useWalletList } from '../../hooks/useWalletList';
|
|
10
9
|
import { getContainer } from '../../utils/common';
|
|
11
10
|
import { mapStatusToWalletState } from '../../utils/wallets';
|
|
12
|
-
import {
|
|
11
|
+
import { WalletDerivationPathModal } from '../WalletDerivationPathModal';
|
|
12
|
+
import { WalletNamespacesModal } from '../WalletNamespacesModal';
|
|
13
13
|
|
|
14
14
|
import { WalletContainer } from './SwapDetailsModal.styles';
|
|
15
15
|
|
|
16
|
+
interface NamespacesModalState {
|
|
17
|
+
open: boolean;
|
|
18
|
+
providerType: string;
|
|
19
|
+
providerImage: string;
|
|
20
|
+
availableNamespaces?: Namespace[];
|
|
21
|
+
singleNamespace?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface DerivationPathModalState {
|
|
25
|
+
open: boolean;
|
|
26
|
+
providerType: string;
|
|
27
|
+
providerImage: string;
|
|
28
|
+
namespace: Namespace;
|
|
29
|
+
}
|
|
30
|
+
|
|
16
31
|
export const WalletStateContent = (props: WalletStateContentProps) => {
|
|
17
32
|
const {
|
|
18
33
|
type,
|
|
@@ -22,9 +37,11 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
|
|
|
22
37
|
showWalletButton,
|
|
23
38
|
walletButtonDisabled,
|
|
24
39
|
} = props;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
const { connect, getWalletInfo, state } = useWallets();
|
|
41
|
+
const [namespacesModalState, setNamespacesModalState] =
|
|
42
|
+
useState<NamespacesModalState | null>(null);
|
|
43
|
+
const [derivationPathModalState, setDerivationPathModalState] =
|
|
44
|
+
useState<DerivationPathModalState | null>(null);
|
|
28
45
|
const walletType = currentStepWallet?.walletType;
|
|
29
46
|
const walletState = walletType
|
|
30
47
|
? mapStatusToWalletState(state(walletType))
|
|
@@ -32,24 +49,87 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
|
|
|
32
49
|
const walletInfo = walletType ? getWalletInfo(walletType) : null;
|
|
33
50
|
const shouldShowWallet =
|
|
34
51
|
showWalletButton && !!walletType && !!walletState && !!walletInfo;
|
|
35
|
-
const { list } = useWalletList();
|
|
36
52
|
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
|
|
53
|
+
const handleCloseNamespaceModal = () => {
|
|
54
|
+
if (namespacesModalState) {
|
|
55
|
+
setNamespacesModalState({
|
|
56
|
+
...namespacesModalState,
|
|
57
|
+
open: false,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
const handleCloseDerivationPathModal = () => {
|
|
63
|
+
if (derivationPathModalState) {
|
|
64
|
+
setDerivationPathModalState({
|
|
65
|
+
...derivationPathModalState,
|
|
66
|
+
open: false,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const handleWalletItemClick = () => {
|
|
72
|
+
if (!!walletType && !!walletInfo) {
|
|
73
|
+
if (!!walletInfo.namespaces?.length) {
|
|
74
|
+
if (walletInfo.namespaces.length > 1) {
|
|
75
|
+
setNamespacesModalState({
|
|
76
|
+
open: true,
|
|
77
|
+
providerType: walletType,
|
|
78
|
+
providerImage: walletInfo.img,
|
|
79
|
+
availableNamespaces: walletInfo.namespaces,
|
|
80
|
+
singleNamespace: walletInfo.singleNamespace,
|
|
81
|
+
});
|
|
82
|
+
} else if (walletInfo.needsDerivationPath) {
|
|
83
|
+
setDerivationPathModalState({
|
|
84
|
+
open: true,
|
|
85
|
+
providerType: walletType,
|
|
86
|
+
providerImage: walletInfo.img,
|
|
87
|
+
namespace: walletInfo.namespaces[0],
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
connect(walletType).catch((error) => debug(error));
|
|
91
|
+
}
|
|
43
92
|
} else {
|
|
44
|
-
|
|
45
|
-
new Error(
|
|
46
|
-
`It seems requested wallet to be connected is not available in the list. requested wallet: ${wallet}`
|
|
47
|
-
)
|
|
48
|
-
);
|
|
93
|
+
connect(walletType).catch((error) => debug(error));
|
|
49
94
|
}
|
|
50
95
|
}
|
|
51
96
|
};
|
|
52
97
|
|
|
98
|
+
const handleConfirmNamespaces = (selectedNamespaces: Namespace[]) => {
|
|
99
|
+
if (
|
|
100
|
+
!!walletInfo?.needsDerivationPath &&
|
|
101
|
+
walletInfo?.singleNamespace &&
|
|
102
|
+
selectedNamespaces[0] &&
|
|
103
|
+
walletType
|
|
104
|
+
) {
|
|
105
|
+
setDerivationPathModalState({
|
|
106
|
+
open: true,
|
|
107
|
+
providerType: walletType,
|
|
108
|
+
providerImage: walletInfo.img,
|
|
109
|
+
namespace: selectedNamespaces[0],
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
connect(
|
|
113
|
+
namespacesModalState?.providerType as string,
|
|
114
|
+
undefined,
|
|
115
|
+
selectedNamespaces.map((namespace) => ({
|
|
116
|
+
namespace,
|
|
117
|
+
}))
|
|
118
|
+
).catch((error) => debug(error));
|
|
119
|
+
}
|
|
120
|
+
handleCloseNamespaceModal();
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const handleDerivationPathConfirm = (derivationPath: string) => {
|
|
124
|
+
if (derivationPath && derivationPathModalState?.namespace) {
|
|
125
|
+
connect(derivationPathModalState?.providerType, undefined, [
|
|
126
|
+
{ namespace: derivationPathModalState.namespace, derivationPath },
|
|
127
|
+
]).catch((error) => debug(error));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
handleCloseDerivationPathModal();
|
|
131
|
+
};
|
|
132
|
+
|
|
53
133
|
return (
|
|
54
134
|
<>
|
|
55
135
|
<MessageBox type={type} title={title} description={message} />
|
|
@@ -68,11 +148,21 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
|
|
|
68
148
|
/>
|
|
69
149
|
</WalletContainer>
|
|
70
150
|
)}
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
onClose={
|
|
74
|
-
|
|
75
|
-
}
|
|
151
|
+
<WalletNamespacesModal
|
|
152
|
+
open={!!namespacesModalState?.open}
|
|
153
|
+
onClose={handleCloseNamespaceModal}
|
|
154
|
+
onConfirm={handleConfirmNamespaces}
|
|
155
|
+
image={namespacesModalState?.providerImage}
|
|
156
|
+
availableNamespaces={namespacesModalState?.availableNamespaces}
|
|
157
|
+
singleNamespace={namespacesModalState?.singleNamespace}
|
|
158
|
+
/>
|
|
159
|
+
<WalletDerivationPathModal
|
|
160
|
+
open={!!derivationPathModalState?.open}
|
|
161
|
+
selectedNamespace={derivationPathModalState?.namespace}
|
|
162
|
+
type={derivationPathModalState?.providerType}
|
|
163
|
+
image={derivationPathModalState?.providerImage}
|
|
164
|
+
onClose={handleCloseDerivationPathModal}
|
|
165
|
+
onConfirm={handleDerivationPathConfirm}
|
|
76
166
|
/>
|
|
77
167
|
</>
|
|
78
168
|
);
|
|
@@ -92,7 +92,14 @@ const renderDesc = (props: RenderDescProps) => {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
export function TokenList(props: PropTypes) {
|
|
95
|
-
const {
|
|
95
|
+
const {
|
|
96
|
+
list,
|
|
97
|
+
searchedFor = '',
|
|
98
|
+
onChange,
|
|
99
|
+
selectedBlockchain,
|
|
100
|
+
showTitle = true,
|
|
101
|
+
action,
|
|
102
|
+
} = props;
|
|
96
103
|
|
|
97
104
|
const [tokens, setTokens] = useState<Token[]>(list);
|
|
98
105
|
const fetchStatus = useAppStore().fetchStatus;
|
|
@@ -118,24 +125,48 @@ export function TokenList(props: PropTypes) {
|
|
|
118
125
|
setTokens(list.slice(0, PAGE_SIZE));
|
|
119
126
|
}, [list.length, selectedBlockchain, balanceKey]);
|
|
120
127
|
|
|
121
|
-
const
|
|
122
|
-
|
|
128
|
+
const endRenderer = (token: Token) => {
|
|
129
|
+
const tokenBalance = formatBalance(getBalanceFor(token));
|
|
130
|
+
|
|
131
|
+
if (action) {
|
|
132
|
+
return action(token);
|
|
133
|
+
}
|
|
134
|
+
if (loadingWallet) {
|
|
123
135
|
return (
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/>
|
|
130
|
-
</>
|
|
136
|
+
<End>
|
|
137
|
+
<Skeleton variant="text" size="large" width={70} />
|
|
138
|
+
<Divider size={4} />
|
|
139
|
+
<Skeleton variant="text" size="medium" width={50} />
|
|
140
|
+
</End>
|
|
131
141
|
);
|
|
132
142
|
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
tokenBalance && (
|
|
146
|
+
<BalanceContainer>
|
|
147
|
+
<TokenBalance variant="title" size="small">
|
|
148
|
+
{tokenBalance.amount}
|
|
149
|
+
</TokenBalance>
|
|
150
|
+
<div />
|
|
151
|
+
{tokenBalance.usdValue && (
|
|
152
|
+
<Typography
|
|
153
|
+
variant="body"
|
|
154
|
+
className={usdValueStyles()}
|
|
155
|
+
size="xsmall">
|
|
156
|
+
{`$${tokenBalance.usdValue}`}
|
|
157
|
+
</Typography>
|
|
158
|
+
)}
|
|
159
|
+
</BalanceContainer>
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const renderList = () => {
|
|
133
165
|
return (
|
|
134
166
|
<VirtualizedList
|
|
135
167
|
endReached={hasNextPage ? loadNextPage : undefined}
|
|
136
168
|
itemContent={(index) => {
|
|
137
169
|
const token = tokens[index];
|
|
138
|
-
const tokenBalance = formatBalance(getBalanceFor(token));
|
|
139
170
|
const address = token.address || '';
|
|
140
171
|
const blockchain = blockchains.find(
|
|
141
172
|
(blockchain) => blockchain.name === token.blockchain
|
|
@@ -172,15 +203,16 @@ export function TokenList(props: PropTypes) {
|
|
|
172
203
|
key={`${token.symbol}${token.address}`}
|
|
173
204
|
id={`${token.symbol}${token.address}`}
|
|
174
205
|
hasDivider
|
|
175
|
-
onClick={() => onChange(tokens[index])}
|
|
206
|
+
onClick={() => onChange && onChange(tokens[index])}
|
|
176
207
|
start={
|
|
177
208
|
<ImageSection>
|
|
178
209
|
<Image src={token.image} size={30} />
|
|
179
|
-
{
|
|
180
|
-
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
|
|
210
|
+
{props.type !== 'custom-token' &&
|
|
211
|
+
isTokenPinned(token, props.type) && (
|
|
212
|
+
<Pin>
|
|
213
|
+
<PinIcon size={12} color="gray" />
|
|
214
|
+
</Pin>
|
|
215
|
+
)}
|
|
184
216
|
</ImageSection>
|
|
185
217
|
}
|
|
186
218
|
title={
|
|
@@ -219,32 +251,7 @@ export function TokenList(props: PropTypes) {
|
|
|
219
251
|
})
|
|
220
252
|
: token.name || undefined
|
|
221
253
|
}
|
|
222
|
-
end={
|
|
223
|
-
loadingWallet ? (
|
|
224
|
-
<End>
|
|
225
|
-
<Skeleton variant="text" size="large" width={70} />
|
|
226
|
-
<Divider size={4} />
|
|
227
|
-
<Skeleton variant="text" size="medium" width={50} />
|
|
228
|
-
</End>
|
|
229
|
-
) : (
|
|
230
|
-
tokenBalance && (
|
|
231
|
-
<BalanceContainer>
|
|
232
|
-
<TokenBalance variant="title" size="small">
|
|
233
|
-
{tokenBalance.amount}
|
|
234
|
-
</TokenBalance>
|
|
235
|
-
<div />
|
|
236
|
-
{tokenBalance.usdValue && (
|
|
237
|
-
<Typography
|
|
238
|
-
variant="body"
|
|
239
|
-
className={usdValueStyles()}
|
|
240
|
-
size="xsmall">
|
|
241
|
-
{`$${tokenBalance.usdValue}`}
|
|
242
|
-
</Typography>
|
|
243
|
-
)}
|
|
244
|
-
</BalanceContainer>
|
|
245
|
-
)
|
|
246
|
-
)
|
|
247
|
-
}
|
|
254
|
+
end={endRenderer(token)}
|
|
248
255
|
/>
|
|
249
256
|
</div>
|
|
250
257
|
);
|
|
@@ -256,13 +263,31 @@ export function TokenList(props: PropTypes) {
|
|
|
256
263
|
};
|
|
257
264
|
|
|
258
265
|
return (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
266
|
+
<>
|
|
267
|
+
{showTitle && (
|
|
268
|
+
<>
|
|
269
|
+
<Typography variant="label" size="large">
|
|
270
|
+
{i18n.t('Select Token')}
|
|
271
|
+
</Typography>
|
|
272
|
+
<Divider size={4} />
|
|
273
|
+
</>
|
|
274
|
+
)}
|
|
275
|
+
|
|
276
|
+
<Container>
|
|
277
|
+
<Divider size={4} />
|
|
278
|
+
{fetchStatus === 'loading' && <LoadingTokenList size={PAGE_SIZE} />}
|
|
279
|
+
{fetchStatus === 'success' &&
|
|
280
|
+
(tokens.length ? (
|
|
281
|
+
<List as="ul">{renderList()}</List>
|
|
282
|
+
) : (
|
|
283
|
+
!!searchedFor && (
|
|
284
|
+
<NotFound
|
|
285
|
+
title={i18n.t('No results found')}
|
|
286
|
+
description={i18n.t('Try using different keywords')}
|
|
287
|
+
/>
|
|
288
|
+
)
|
|
289
|
+
))}
|
|
290
|
+
</Container>
|
|
291
|
+
</>
|
|
267
292
|
);
|
|
268
293
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Token } from 'rango-sdk';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
2
3
|
|
|
3
4
|
export interface PropTypes {
|
|
4
5
|
list: Token[];
|
|
5
6
|
searchedFor?: string;
|
|
6
|
-
onChange
|
|
7
|
+
onChange?: (token: Token) => void;
|
|
7
8
|
selectedBlockchain?: string;
|
|
8
|
-
type: 'source' | 'destination';
|
|
9
|
+
type: 'source' | 'destination' | 'custom-token';
|
|
10
|
+
action?: (token: Token) => ReactElement;
|
|
11
|
+
showTitle?: boolean;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export interface LoadingTokenListProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PropTypes } from './
|
|
2
|
-
import type { DerivationPath } from '@rango-dev/wallets-shared';
|
|
1
|
+
import type { PropTypes } from './WalletDerivationPathModal.types';
|
|
2
|
+
import type { DerivationPath, Namespace } from '@rango-dev/wallets-shared';
|
|
3
3
|
|
|
4
4
|
import { i18n } from '@lingui/core';
|
|
5
5
|
import {
|
|
@@ -10,30 +10,43 @@ import {
|
|
|
10
10
|
Select,
|
|
11
11
|
TextField,
|
|
12
12
|
} from '@rango-dev/ui';
|
|
13
|
+
import { namespaces } from '@rango-dev/wallets-shared';
|
|
13
14
|
import React, { useEffect, useState } from 'react';
|
|
14
15
|
|
|
16
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
17
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
15
18
|
import {
|
|
16
19
|
LogoContainer,
|
|
17
20
|
Spinner,
|
|
18
21
|
WalletImageContainer,
|
|
19
|
-
} from '
|
|
20
|
-
|
|
21
|
-
CUSTOM_DERIVATION_PATH,
|
|
22
|
-
getDerivationPaths,
|
|
23
|
-
} from './DerivationPath.helpers';
|
|
22
|
+
} from '../WalletModal/WalletModalContent.styles';
|
|
23
|
+
|
|
24
24
|
import {
|
|
25
25
|
derivationPathInputStyles,
|
|
26
26
|
InputLabel,
|
|
27
27
|
InputsContainer,
|
|
28
|
-
} from './
|
|
28
|
+
} from './WalletDerivationPathModal.styles';
|
|
29
|
+
|
|
30
|
+
const customDerivationPath: DerivationPath = {
|
|
31
|
+
id: 'custom',
|
|
32
|
+
label: 'Custom',
|
|
33
|
+
generateDerivationPath: (index: string) => index,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function getDerivationPaths(selectedNamespace?: Namespace) {
|
|
37
|
+
const selectedNamespaceDerivationPaths = selectedNamespace
|
|
38
|
+
? namespaces[selectedNamespace].derivationPaths
|
|
39
|
+
: null;
|
|
40
|
+
|
|
41
|
+
const derivationPaths: DerivationPath[] = !!selectedNamespaceDerivationPaths
|
|
42
|
+
? [...selectedNamespaceDerivationPaths, customDerivationPath]
|
|
43
|
+
: [];
|
|
44
|
+
|
|
45
|
+
return derivationPaths;
|
|
46
|
+
}
|
|
29
47
|
|
|
30
|
-
export function
|
|
31
|
-
const { onConfirm } = props;
|
|
32
|
-
const {
|
|
33
|
-
namespace: selectedNamespace,
|
|
34
|
-
providerImage: image,
|
|
35
|
-
providerType: type,
|
|
36
|
-
} = props.value;
|
|
48
|
+
export function WalletDerivationPathModal(props: PropTypes) {
|
|
49
|
+
const { onClose, onConfirm, selectedNamespace, image, type, open } = props;
|
|
37
50
|
|
|
38
51
|
const [selectedDerivationPathId, setSelectedDerivationPathId] = useState<
|
|
39
52
|
string | null
|
|
@@ -41,7 +54,7 @@ export function DerivationPath(props: PropTypes) {
|
|
|
41
54
|
const [derivationPathIndex, setDerivationPathIndex] = useState('0');
|
|
42
55
|
|
|
43
56
|
const isCustomOptionSelected =
|
|
44
|
-
selectedDerivationPathId ===
|
|
57
|
+
selectedDerivationPathId === customDerivationPath.id;
|
|
45
58
|
|
|
46
59
|
const derivationPaths = getDerivationPaths(selectedNamespace);
|
|
47
60
|
|
|
@@ -76,7 +89,12 @@ export function DerivationPath(props: PropTypes) {
|
|
|
76
89
|
}, [selectedNamespace]);
|
|
77
90
|
|
|
78
91
|
return (
|
|
79
|
-
|
|
92
|
+
<WatermarkedModal
|
|
93
|
+
open={open}
|
|
94
|
+
onClose={onClose}
|
|
95
|
+
container={
|
|
96
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
|
|
97
|
+
}>
|
|
80
98
|
<Divider size={20} />
|
|
81
99
|
<MessageBox
|
|
82
100
|
type="info"
|
|
@@ -131,6 +149,6 @@ export function DerivationPath(props: PropTypes) {
|
|
|
131
149
|
}>
|
|
132
150
|
{i18n.t('Confirm')}
|
|
133
151
|
</Button>
|
|
134
|
-
|
|
152
|
+
</WatermarkedModal>
|
|
135
153
|
);
|
|
136
154
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WalletDerivationPathModal } from './WalletDerivationPathModal';
|