@layerswap/widget 1.0.6 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/Models/LayerSwapSettings.js +0 -1
- package/dist/esm/Models/Theme.js +39 -0
- package/dist/esm/components/Buttons/submitButton.js +2 -1
- package/dist/esm/components/Common/ConnectWalletButton.js +9 -3
- package/dist/esm/components/Common/CountDownTimer.js +0 -1
- package/dist/esm/components/Common/WarningMessage.js +4 -2
- package/dist/esm/components/Common/guideLink.js +4 -6
- package/dist/esm/components/ErrorFallback.js +12 -12
- package/dist/esm/components/HeaderWithMenu.js +1 -1
- package/dist/esm/components/Icons/CircularLoader.js +5 -0
- package/dist/esm/components/Icons/FailIcon.js +2 -2
- package/dist/esm/components/Icons/GlobeIcon.js +3 -0
- package/dist/esm/components/Icons/MenuIcon.js +5 -0
- package/dist/esm/components/Icons/TokenIcon.js +1 -1
- package/dist/esm/components/Icons/Wallets/index.js +0 -1
- package/dist/esm/components/Input/Address/AddressNote.js +2 -2
- package/dist/esm/components/Input/Address/AddressPicker/AddressWithIcon.js +5 -2
- package/dist/esm/components/Input/Address/AddressPicker/index.js +15 -12
- package/dist/esm/components/Input/Address/ContractAddressNote.js +17 -0
- package/dist/esm/components/Input/Address/UrlAddressNote.js +10 -0
- package/dist/esm/components/Input/Amount/Balance.js +1 -1
- package/dist/esm/components/Input/Amount/ExchangeReceiveAmount.js +8 -0
- package/dist/esm/components/Input/Amount/MinMax.js +1 -1
- package/dist/esm/components/Input/Amount/PriceImpact.js +5 -40
- package/dist/esm/components/Input/Amount/ReceiveAmount.js +2 -2
- package/dist/esm/components/Input/Amount/index.js +3 -3
- package/dist/esm/components/Input/DestinationPicker.js +2 -2
- package/dist/esm/components/Input/RoutePicker/Content.js +19 -3
- package/dist/esm/components/Input/RoutePicker/RouteTokenSwitch.js +4 -4
- package/dist/esm/components/Input/RoutePicker/RouterPickerWalletConnect.js +5 -5
- package/dist/esm/components/Input/RoutePicker/Routes.js +27 -26
- package/dist/esm/components/Input/RoutePicker/Rows/CollapsableHeader.js +2 -2
- package/dist/esm/components/Input/RoutePicker/Rows/CollapsibleRow.js +3 -3
- package/dist/esm/components/Input/RoutePicker/Rows/StickyHeader.js +2 -2
- package/dist/esm/components/Input/RoutePicker/Rows/SuggestionsHeader.js +55 -0
- package/dist/esm/components/Input/RoutePicker/Rows/TitleRow.js +11 -0
- package/dist/esm/components/Input/RoutePicker/Rows/index.js +5 -6
- package/dist/esm/components/Input/RoutePicker/TokenTitleDetails.js +10 -0
- package/dist/esm/components/Input/RoutePicker/index.js +2 -2
- package/dist/esm/components/Input/SourceWalletPicker.js +6 -4
- package/dist/esm/components/Menu/MenuList.js +11 -19
- package/dist/esm/components/Menu/index.js +16 -7
- package/dist/esm/components/Modal/modalWithoutAnimation.js +3 -3
- package/dist/esm/components/Pages/Campaigns/Details/Leaderboard.js +2 -2
- package/dist/esm/components/Pages/Campaigns/Details/Rewards.js +2 -2
- package/dist/esm/components/Pages/Campaigns/Details/index.js +3 -4
- package/dist/esm/components/Pages/Campaigns/index.js +3 -4
- package/dist/esm/components/Pages/Swap/Form/ExchangeForm.js +21 -19
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/Rate.js +6 -4
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/Refuel.js +8 -3
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/DetailedEstimates.js +51 -14
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/SummaryRow.js +1 -1
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/index.js +3 -3
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/index.js +10 -11
- package/dist/esm/components/Pages/Swap/Form/Form.js +27 -3
- package/dist/esm/components/Pages/Swap/Form/FormWrapper.js +35 -10
- package/dist/esm/components/Pages/Swap/Form/NetworkForm.js +13 -22
- package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/FormButton.js +1 -1
- package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/ReserveGasNote.js +8 -6
- package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/validationError/ContractAddressValidationCache.js +19 -0
- package/dist/esm/components/Pages/Swap/Withdraw/Failed.js +12 -8
- package/dist/esm/components/Pages/Swap/Withdraw/ManualWithdraw.js +28 -9
- package/dist/esm/components/Pages/Swap/Withdraw/NotFound.js +15 -4
- package/dist/esm/components/Pages/Swap/Withdraw/Processing/Processing.js +44 -45
- package/dist/esm/components/Pages/Swap/Withdraw/Summary/Summary.js +2 -3
- package/dist/esm/components/Pages/Swap/Withdraw/Summary/index.js +2 -2
- package/dist/esm/components/Pages/Swap/Withdraw/SwapDetails.js +9 -7
- package/dist/esm/components/Pages/Swap/Withdraw/Wallet/Common/actionMessage.js +43 -0
- package/dist/esm/components/Pages/Swap/Withdraw/Wallet/Common/buttons.js +125 -71
- package/dist/esm/components/Pages/Swap/Withdraw/Wallet/index.js +56 -65
- package/dist/esm/components/Pages/Swap/Withdraw/WalletTransferButton.js +2 -2
- package/dist/esm/components/Pages/Swap/Withdraw/WalletTransferContent.js +2 -2
- package/dist/esm/components/Pages/Swap/Withdraw/Withdraw.js +3 -3
- package/dist/esm/components/Pages/Swap/Withdraw/index.js +5 -4
- package/dist/esm/components/Pages/Swap/Withdraw/messages/Message.js +4 -4
- package/dist/esm/components/Pages/Swap/Withdraw/messages/TransactionMessages.js +14 -15
- package/dist/esm/components/Pages/SwapHistory/History.js +2 -2
- package/dist/esm/components/Pages/SwapHistory/HistorySummary.js +1 -1
- package/dist/esm/components/Pages/SwapHistory/index.js +4 -4
- package/dist/esm/components/Select/Selector/SelectItem.js +1 -1
- package/dist/esm/components/Wallet/WalletComponents/ConnectedWallets.js +4 -4
- package/dist/esm/components/Wallet/WalletComponents/WalletsList.js +1 -1
- package/dist/esm/components/Wallet/WalletModal/Connector.js +2 -2
- package/dist/esm/components/Wallet/WalletModal/ConnectorsList.js +78 -125
- package/dist/esm/components/Wallet/WalletModal/InstalledExtensionNotFound.js +16 -0
- package/dist/esm/components/Wallet/WalletModal/LoadingConnect.js +27 -0
- package/dist/esm/components/Wallet/WalletModal/MultichainConnectorPicker.js +23 -0
- package/dist/esm/components/Wallet/WalletModal/ProviderPicker.js +26 -0
- package/dist/esm/components/Wallet/WalletModal/WalletQrCode.js +18 -0
- package/dist/esm/components/Wallet/WalletModal/index.js +4 -2
- package/dist/esm/components/Wallet/WalletProviders/index.js +4 -2
- package/dist/esm/components/Widget/Content.js +2 -2
- package/dist/esm/components/Widget/Footer.js +21 -21
- package/dist/esm/components/Widget/Index.js +2 -2
- package/dist/esm/components/WidgetLoading.js +9 -2
- package/dist/esm/components/shadcn/checkbox.js +1 -1
- package/dist/esm/context/ErrorProvider.js +14 -0
- package/dist/esm/context/LayerswapProvider.js +6 -5
- package/dist/esm/context/callbackProvider.js +60 -52
- package/dist/esm/context/resolverContext.js +11 -2
- package/dist/esm/context/swap.js +10 -13
- package/dist/esm/context/{balanceAccounts.js → swapAccounts.js} +17 -17
- package/dist/esm/context/validationContext.js +1 -1
- package/dist/esm/context/walletProviders.js +7 -1
- package/dist/esm/context/withdrawalContext.js +2 -2
- package/dist/esm/exports/internal.js +4 -3
- package/dist/esm/helpers/filterSourceNetworks.js +23 -0
- package/dist/esm/helpers/getSettings/getSettings.js +18 -13
- package/dist/esm/helpers/routes.js +4 -1
- package/dist/esm/hooks/useAllWithdrawalBalances.js +11 -5
- package/dist/esm/hooks/useConnectors.js +72 -0
- package/dist/esm/hooks/useFormRoutes.js +16 -8
- package/dist/esm/hooks/useFormValidation.js +5 -4
- package/dist/esm/hooks/useRouteValidation.js +1 -1
- package/dist/esm/hooks/useSwrSwaps.js +1 -1
- package/dist/esm/hooks/useTransfer.js +9 -0
- package/dist/esm/hooks/useWallet.js +7 -7
- package/dist/esm/lib/AppSettings.js +27 -16
- package/dist/esm/lib/ErrorHandler.js +6 -0
- package/dist/esm/lib/address/contractAddressResolver.js +12 -0
- package/dist/esm/lib/apiClients/layerSwapApiClient.js +19 -35
- package/dist/esm/lib/balances/balanceResolver.js +57 -11
- package/dist/esm/lib/balances/errorUtils.js +13 -0
- package/dist/esm/lib/balances/nodeErrorClassifier.js +22 -0
- package/dist/esm/lib/fees.js +50 -0
- package/dist/esm/lib/generateSwapInitialValues.js +2 -2
- package/dist/esm/lib/isNewListed.js +8 -0
- package/dist/esm/lib/knownIds.js +1 -0
- package/dist/esm/lib/resolvers/resolverService.js +19 -1
- package/dist/esm/lib/transfers/index.js +1 -0
- package/dist/esm/lib/transfers/transferResolver.js +14 -0
- package/dist/esm/stores/balanceStore.js +39 -18
- package/dist/esm/stores/contractAddressStore.js +178 -0
- package/dist/esm/stores/logStore.js +11 -0
- package/dist/esm/types/balance.js +23 -11
- package/dist/esm/types/contract.js +1 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/logEvents.js +1 -0
- package/dist/index.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Models/Balance.d.ts +14 -2
- package/dist/types/Models/Balance.d.ts.map +1 -1
- package/dist/types/Models/LayerSwapSettings.d.ts +7 -0
- package/dist/types/Models/LayerSwapSettings.d.ts.map +1 -1
- package/dist/types/Models/Theme.d.ts.map +1 -1
- package/dist/types/components/Buttons/submitButton.d.ts +1 -1
- package/dist/types/components/Buttons/submitButton.d.ts.map +1 -1
- package/dist/types/components/Common/ConnectWalletButton.d.ts +1 -1
- package/dist/types/components/Common/ConnectWalletButton.d.ts.map +1 -1
- package/dist/types/components/Common/CountDownTimer.d.ts.map +1 -1
- package/dist/types/components/Common/WarningMessage.d.ts.map +1 -1
- package/dist/types/components/Common/guideLink.d.ts.map +1 -1
- package/dist/types/components/ErrorFallback.d.ts.map +1 -1
- package/dist/types/components/HeaderWithMenu.d.ts.map +1 -1
- package/dist/types/components/Icons/CircularLoader.d.ts +4 -0
- package/dist/types/components/Icons/CircularLoader.d.ts.map +1 -0
- package/dist/types/components/Icons/FailIcon.d.ts.map +1 -1
- package/dist/types/components/Icons/GasIcon.d.ts.map +1 -1
- package/dist/types/components/Icons/GlobeIcon.d.ts +4 -0
- package/dist/types/components/Icons/GlobeIcon.d.ts.map +1 -0
- package/dist/types/components/Icons/MenuIcon.d.ts +4 -0
- package/dist/types/components/Icons/MenuIcon.d.ts.map +1 -0
- package/dist/types/components/Icons/TokenIcon.d.ts.map +1 -1
- package/dist/types/components/Icons/Wallets/index.d.ts +0 -1
- package/dist/types/components/Icons/Wallets/index.d.ts.map +1 -1
- package/dist/types/components/Input/Address/AddressNote.d.ts +5 -5
- package/dist/types/components/Input/Address/AddressNote.d.ts.map +1 -1
- package/dist/types/components/Input/Address/AddressPicker/AddressBook.d.ts +3 -3
- package/dist/types/components/Input/Address/AddressPicker/AddressButton.d.ts +3 -3
- package/dist/types/components/Input/Address/AddressPicker/AddressWithIcon.d.ts +3 -2
- package/dist/types/components/Input/Address/AddressPicker/AddressWithIcon.d.ts.map +1 -1
- package/dist/types/components/Input/Address/AddressPicker/ConnectedWallets.d.ts +2 -2
- package/dist/types/components/Input/Address/AddressPicker/ManualAddressInput.d.ts +4 -4
- package/dist/types/components/Input/Address/AddressPicker/index.d.ts +4 -4
- package/dist/types/components/Input/Address/AddressPicker/index.d.ts.map +1 -1
- package/dist/types/components/Input/Address/ContractAddressNote.d.ts +9 -0
- package/dist/types/components/Input/Address/ContractAddressNote.d.ts.map +1 -0
- package/dist/types/components/Input/Address/UrlAddressNote.d.ts +10 -0
- package/dist/types/components/Input/Address/UrlAddressNote.d.ts.map +1 -0
- package/dist/types/components/Input/Address/index.d.ts +1 -1
- package/dist/types/components/Input/Amount/Balance.d.ts +1 -1
- package/dist/types/components/Input/Amount/Balance.d.ts.map +1 -1
- package/dist/types/components/Input/Amount/ExchangeReceiveAmount.d.ts +11 -0
- package/dist/types/components/Input/Amount/ExchangeReceiveAmount.d.ts.map +1 -0
- package/dist/types/components/Input/Amount/MinMax.d.ts +1 -1
- package/dist/types/components/Input/Amount/PriceImpact.d.ts +3 -6
- package/dist/types/components/Input/Amount/PriceImpact.d.ts.map +1 -1
- package/dist/types/components/Input/Amount/ReceiveAmount.d.ts +2 -3
- package/dist/types/components/Input/Amount/ReceiveAmount.d.ts.map +1 -1
- package/dist/types/components/Input/Amount/helpers.d.ts +2 -2
- package/dist/types/components/Input/Amount/index.d.ts +1 -1
- package/dist/types/components/Input/CexPicker.d.ts +1 -1
- package/dist/types/components/Input/DestinationPicker.d.ts +1 -1
- package/dist/types/components/Input/DestinationPicker.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Content.d.ts +5 -5
- package/dist/types/components/Input/RoutePicker/Content.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/RouterPickerWalletConnect.d.ts +1 -1
- package/dist/types/components/Input/RoutePicker/RouterPickerWalletConnect.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Routes.d.ts +4 -8
- package/dist/types/components/Input/RoutePicker/Routes.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Rows/CollapsableHeader.d.ts +3 -4
- package/dist/types/components/Input/RoutePicker/Rows/CollapsableHeader.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Rows/CollapsibleRow.d.ts +6 -5
- package/dist/types/components/Input/RoutePicker/Rows/CollapsibleRow.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Rows/StickyHeader.d.ts +3 -4
- package/dist/types/components/Input/RoutePicker/Rows/StickyHeader.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Rows/SuggestionsHeader.d.ts +7 -0
- package/dist/types/components/Input/RoutePicker/Rows/SuggestionsHeader.d.ts.map +1 -0
- package/dist/types/components/Input/RoutePicker/Rows/TitleRow.d.ts +7 -0
- package/dist/types/components/Input/RoutePicker/Rows/TitleRow.d.ts.map +1 -0
- package/dist/types/components/Input/RoutePicker/Rows/index.d.ts +5 -5
- package/dist/types/components/Input/RoutePicker/Rows/index.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/TokenTitleDetails.d.ts +18 -0
- package/dist/types/components/Input/RoutePicker/TokenTitleDetails.d.ts.map +1 -0
- package/dist/types/components/Input/RoutePicker/index.d.ts +1 -1
- package/dist/types/components/Input/RoutePicker/index.d.ts.map +1 -1
- package/dist/types/components/Input/SourcePicker.d.ts +1 -1
- package/dist/types/components/Input/SourceWalletPicker.d.ts.map +1 -1
- package/dist/types/components/Menu/MenuList.d.ts.map +1 -1
- package/dist/types/components/Menu/index.d.ts.map +1 -1
- package/dist/types/components/Modal/modalWithoutAnimation.d.ts +4 -2
- package/dist/types/components/Modal/modalWithoutAnimation.d.ts.map +1 -1
- package/dist/types/components/Pages/Campaigns/Details/Leaderboard.d.ts +1 -1
- package/dist/types/components/Pages/Campaigns/Details/Rewards.d.ts +1 -1
- package/dist/types/components/Pages/Campaigns/Details/index.d.ts +1 -2
- package/dist/types/components/Pages/Campaigns/Details/index.d.ts.map +1 -1
- package/dist/types/components/Pages/Campaigns/index.d.ts +2 -3
- package/dist/types/components/Pages/Campaigns/index.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/ExchangeForm.d.ts +3 -1
- package/dist/types/components/Pages/Swap/Form/ExchangeForm.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/Rate.d.ts +7 -6
- package/dist/types/components/Pages/Swap/Form/FeeDetails/Rate.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/ReceiveAmounts.d.ts +2 -2
- package/dist/types/components/Pages/Swap/Form/FeeDetails/Refuel.d.ts +1 -2
- package/dist/types/components/Pages/Swap/Form/FeeDetails/Refuel.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/RefuelModal.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/Slippage.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/DetailedEstimates.d.ts +3 -2
- package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/DetailedEstimates.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/SummaryRow.d.ts +4 -4
- package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/index.d.ts +4 -4
- package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/index.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/utils.d.ts +2 -2
- package/dist/types/components/Pages/Swap/Form/FeeDetails/index.d.ts +7 -4
- package/dist/types/components/Pages/Swap/Form/FeeDetails/index.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/Form.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FormWrapper.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Form/FormWrapper.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/NetworkForm.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Form/NetworkForm.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/FormButton.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/FormButton.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/ReserveGasNote.d.ts +2 -2
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/ReserveGasNote.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/validationError/ContractAddressValidationCache.d.ts +10 -0
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/validationError/ContractAddressValidationCache.d.ts.map +1 -0
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/validationError/ErrorDisplay.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Form/SwapFormValues.d.ts +2 -2
- package/dist/types/components/Pages/Swap/Withdraw/Failed.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/ManualWithdraw.d.ts +4 -3
- package/dist/types/components/Pages/Swap/Withdraw/ManualWithdraw.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/NotFound.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Processing/Processing.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Processing/Processing.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/QuoteUpdate.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Summary/Summary.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Summary/Summary.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/SwapDetails.d.ts +2 -1
- package/dist/types/components/Pages/Swap/Withdraw/SwapDetails.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/SwapQuoteDetails.d.ts +3 -3
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/actionMessage.d.ts +6 -0
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/actionMessage.d.ts.map +1 -0
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/buttons.d.ts +4 -3
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/buttons.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/sharedTypes.d.ts +2 -1
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/sharedTypes.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/index.d.ts +2 -1
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/index.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/WalletTransferButton.d.ts +2 -1
- package/dist/types/components/Pages/Swap/Withdraw/WalletTransferButton.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/WalletTransferContent.d.ts +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Withdraw.d.ts +2 -1
- package/dist/types/components/Pages/Swap/Withdraw/Withdraw.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/index.d.ts +1 -2
- package/dist/types/components/Pages/Swap/Withdraw/index.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/messages/Message.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/messages/TransactionMessages.d.ts +3 -4
- package/dist/types/components/Pages/Swap/Withdraw/messages/TransactionMessages.d.ts.map +1 -1
- package/dist/types/components/Pages/SwapHistory/HistorySummary.d.ts +2 -2
- package/dist/types/components/Pages/SwapHistory/HistorySummary.d.ts.map +1 -1
- package/dist/types/components/Pages/SwapHistory/StatusIcons.d.ts +1 -1
- package/dist/types/components/Pages/SwapHistory/SwapDetailsComponent.d.ts +1 -1
- package/dist/types/components/Pages/SwapHistory/index.d.ts +3 -1
- package/dist/types/components/Pages/SwapHistory/index.d.ts.map +1 -1
- package/dist/types/components/Select/Command/commandSelect.d.ts.map +1 -1
- package/dist/types/components/Select/Selector/SelectItem.d.ts.map +1 -1
- package/dist/types/components/Wallet/WalletComponents/WalletsList.d.ts +3 -3
- package/dist/types/components/Wallet/WalletComponents/WalletsList.d.ts.map +1 -1
- package/dist/types/components/Wallet/WalletModal/Connector.d.ts +2 -1
- package/dist/types/components/Wallet/WalletModal/Connector.d.ts.map +1 -1
- package/dist/types/components/Wallet/WalletModal/ConnectorsList.d.ts +1 -1
- package/dist/types/components/Wallet/WalletModal/ConnectorsList.d.ts.map +1 -1
- package/dist/types/components/Wallet/WalletModal/InstalledExtensionNotFound.d.ts +7 -0
- package/dist/types/components/Wallet/WalletModal/InstalledExtensionNotFound.d.ts.map +1 -0
- package/dist/types/components/Wallet/WalletModal/LoadingConnect.d.ts +8 -0
- package/dist/types/components/Wallet/WalletModal/LoadingConnect.d.ts.map +1 -0
- package/dist/types/components/Wallet/WalletModal/MultichainConnectorPicker.d.ts +12 -0
- package/dist/types/components/Wallet/WalletModal/MultichainConnectorPicker.d.ts.map +1 -0
- package/dist/types/components/Wallet/WalletModal/ProviderPicker.d.ts +8 -0
- package/dist/types/components/Wallet/WalletModal/ProviderPicker.d.ts.map +1 -0
- package/dist/types/components/Wallet/WalletModal/WalletQrCode.d.ts +6 -0
- package/dist/types/components/Wallet/WalletModal/WalletQrCode.d.ts.map +1 -0
- package/dist/types/components/Wallet/WalletModal/index.d.ts +2 -1
- package/dist/types/components/Wallet/WalletModal/index.d.ts.map +1 -1
- package/dist/types/components/Wallet/WalletProviders/index.d.ts +3 -1
- package/dist/types/components/Wallet/WalletProviders/index.d.ts.map +1 -1
- package/dist/types/components/Widget/Content.d.ts +2 -1
- package/dist/types/components/Widget/Content.d.ts.map +1 -1
- package/dist/types/components/Widget/Footer.d.ts +2 -1
- package/dist/types/components/Widget/Footer.d.ts.map +1 -1
- package/dist/types/components/Widget/Index.d.ts +3 -2
- package/dist/types/components/Widget/Index.d.ts.map +1 -1
- package/dist/types/components/WidgetLoading.d.ts.map +1 -1
- package/dist/types/components/shadcn/command.d.ts +9 -52
- package/dist/types/components/shadcn/command.d.ts.map +1 -1
- package/dist/types/context/ErrorProvider.d.ts +3 -0
- package/dist/types/context/ErrorProvider.d.ts.map +1 -0
- package/dist/types/context/LayerswapProvider.d.ts +22 -4
- package/dist/types/context/LayerswapProvider.d.ts.map +1 -1
- package/dist/types/context/callbackProvider.d.ts +7 -10
- package/dist/types/context/callbackProvider.d.ts.map +1 -1
- package/dist/types/context/resolverContext.d.ts.map +1 -1
- package/dist/types/context/swap.d.ts +7 -7
- package/dist/types/context/swap.d.ts.map +1 -1
- package/dist/types/context/{balanceAccounts.d.ts → swapAccounts.d.ts} +9 -9
- package/dist/types/context/swapAccounts.d.ts.map +1 -0
- package/dist/types/context/walletProviders.d.ts.map +1 -1
- package/dist/types/context/withdrawalContext.d.ts +2 -0
- package/dist/types/context/withdrawalContext.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +9 -7
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/helpers/accountSelectHelper.d.ts +1 -1
- package/dist/types/helpers/balanceHelper.d.ts +2 -2
- package/dist/types/helpers/filterSourceNetworks.d.ts +4 -0
- package/dist/types/helpers/filterSourceNetworks.d.ts.map +1 -0
- package/dist/types/helpers/getSettings/getSettings.d.ts +1 -1
- package/dist/types/helpers/getSettings/getSettings.d.ts.map +1 -1
- package/dist/types/helpers/routes.d.ts +1 -1
- package/dist/types/helpers/routes.d.ts.map +1 -1
- package/dist/types/helpers/tokenHelper.d.ts +2 -2
- package/dist/types/hooks/useAllWithdrawalBalances.d.ts +2 -1
- package/dist/types/hooks/useAllWithdrawalBalances.d.ts.map +1 -1
- package/dist/types/hooks/useConnectors.d.ts +28 -0
- package/dist/types/hooks/useConnectors.d.ts.map +1 -0
- package/dist/types/hooks/useFee.d.ts +1 -1
- package/dist/types/hooks/useFormRoutes.d.ts +2 -3
- package/dist/types/hooks/useFormRoutes.d.ts.map +1 -1
- package/dist/types/hooks/useFormValidation.d.ts +2 -1
- package/dist/types/hooks/useFormValidation.d.ts.map +1 -1
- package/dist/types/hooks/useSwapHistoryData.d.ts +2 -2
- package/dist/types/hooks/useTransfer.d.ts +5 -0
- package/dist/types/hooks/useTransfer.d.ts.map +1 -0
- package/dist/types/hooks/useWallet.d.ts +3 -3
- package/dist/types/hooks/useWallet.d.ts.map +1 -1
- package/dist/types/lib/AppSettings.d.ts +25 -16
- package/dist/types/lib/AppSettings.d.ts.map +1 -1
- package/dist/types/lib/ErrorHandler.d.ts +3 -0
- package/dist/types/lib/ErrorHandler.d.ts.map +1 -0
- package/dist/types/lib/address/contractAddressResolver.d.ts +7 -0
- package/dist/types/lib/address/contractAddressResolver.d.ts.map +1 -0
- package/dist/types/lib/apiClients/layerSwapApiClient.d.ts +1 -9
- package/dist/types/lib/apiClients/layerSwapApiClient.d.ts.map +1 -1
- package/dist/types/lib/balances/balanceResolver.d.ts +3 -3
- package/dist/types/lib/balances/balanceResolver.d.ts.map +1 -1
- package/dist/types/lib/balances/errorUtils.d.ts +12 -0
- package/dist/types/lib/balances/errorUtils.d.ts.map +1 -0
- package/dist/types/lib/balances/helpers.d.ts +1 -1
- package/dist/types/lib/balances/nodeErrorClassifier.d.ts +4 -0
- package/dist/types/lib/balances/nodeErrorClassifier.d.ts.map +1 -0
- package/dist/types/lib/balances/useBalance.d.ts +1 -1
- package/dist/types/lib/fees.d.ts +16 -0
- package/dist/types/lib/fees.d.ts.map +1 -1
- package/dist/types/lib/gases/gasResolver.d.ts +2 -2
- package/dist/types/lib/gases/useSWRGas.d.ts +3 -3
- package/dist/types/lib/generateSwapInitialValues.d.ts +1 -1
- package/dist/types/lib/isNewListed.d.ts +4 -0
- package/dist/types/lib/isNewListed.d.ts.map +1 -0
- package/dist/types/lib/knownIds.d.ts +1 -0
- package/dist/types/lib/knownIds.d.ts.map +1 -1
- package/dist/types/lib/nft/nftBalanceResolver.d.ts +1 -1
- package/dist/types/lib/resolvers/resolverService.d.ts +11 -5
- package/dist/types/lib/resolvers/resolverService.d.ts.map +1 -1
- package/dist/types/lib/transfers/index.d.ts +2 -0
- package/dist/types/lib/transfers/index.d.ts.map +1 -0
- package/dist/types/lib/transfers/transferResolver.d.ts +7 -0
- package/dist/types/lib/transfers/transferResolver.d.ts.map +1 -0
- package/dist/types/stores/balanceStore.d.ts +3 -0
- package/dist/types/stores/balanceStore.d.ts.map +1 -1
- package/dist/types/stores/contractAddressStore.d.ts +43 -0
- package/dist/types/stores/contractAddressStore.d.ts.map +1 -0
- package/dist/types/stores/logStore.d.ts +8 -0
- package/dist/types/stores/logStore.d.ts.map +1 -0
- package/dist/types/stores/walletStore.d.ts +1 -1
- package/dist/types/types/balance.d.ts +2 -2
- package/dist/types/types/balance.d.ts.map +1 -1
- package/dist/types/types/contract.d.ts +6 -0
- package/dist/types/types/contract.d.ts.map +1 -0
- package/dist/types/types/gas.d.ts +2 -2
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/logEvents.d.ts +59 -0
- package/dist/types/types/logEvents.d.ts.map +1 -0
- package/dist/types/types/nft.d.ts +1 -1
- package/dist/types/types/transfer.d.ts +7 -2
- package/dist/types/types/transfer.d.ts.map +1 -1
- package/dist/types/types/wallet.d.ts +29 -8
- package/dist/types/types/wallet.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/esm/components/Icons/Wallets/Keplr.js +0 -3
- package/dist/esm/components/Modal/popover.js +0 -15
- package/dist/esm/components/Wallet/WalletModal/utils.js +0 -23
- package/dist/esm/helpers/querryHelper.js +0 -13
- package/dist/esm/lib/logError.js +0 -17
- package/dist/esm/lib/sorting.js +0 -63
- package/dist/types/components/Icons/Wallets/Keplr.d.ts +0 -4
- package/dist/types/components/Icons/Wallets/Keplr.d.ts.map +0 -1
- package/dist/types/components/Modal/popover.d.ts +0 -12
- package/dist/types/components/Modal/popover.d.ts.map +0 -1
- package/dist/types/components/Wallet/WalletModal/utils.d.ts +0 -2
- package/dist/types/components/Wallet/WalletModal/utils.d.ts.map +0 -1
- package/dist/types/context/balanceAccounts.d.ts.map +0 -1
- package/dist/types/helpers/querryHelper.d.ts +0 -3
- package/dist/types/helpers/querryHelper.d.ts.map +0 -1
- package/dist/types/lib/logError.d.ts +0 -3
- package/dist/types/lib/logError.d.ts.map +0 -1
- package/dist/types/lib/sorting.d.ts +0 -22
- package/dist/types/lib/sorting.d.ts.map +0 -1
|
@@ -38,10 +38,10 @@ const AmountField = forwardRef(function AmountField({ usdPosition = "bottom", ac
|
|
|
38
38
|
const disabled = Boolean(fromExchange && !toCurrency);
|
|
39
39
|
return (_jsx(_Fragment, { children: _jsxs("div", { className: clsx("flex flex-col bg-secondary-500 space-y-0.5 relative w-full group", className, {
|
|
40
40
|
'focus-within:[&_.usd-suffix]:invisible': usdPosition === "right"
|
|
41
|
-
}), children: [_jsx(NumericInput, { disabled: disabled, placeholder: placeholder, step: isNaN(step) ? 0.01 : step, name: name, ref: amountRef, precision: fromCurrency?.precision, tempValue: actionValue, className: "w-full text-[28px] leading-[34px]
|
|
41
|
+
}), children: [_jsx(NumericInput, { disabled: disabled, placeholder: placeholder, step: isNaN(step) ? 0.01 : step, name: name, ref: amountRef, precision: fromCurrency?.precision, tempValue: actionValue, className: "w-full text-[28px] leading-[34px] rounded-xl text-primary-text focus:outline-none focus:border-none focus:ring-0 duration-300 ease-in-out !bg-secondary-500 !font-normal group-[.exchange-amount-field]:px-2.5 group-[.exchange-amount-field]:pb-2 group-[.exchange-amount-field]:pr-2 group-[.exchange-amount-field]:bg-secondary-300! group-[.exchange-amount-field]:pt-2! pl-0", onChange: e => {
|
|
42
42
|
/^[0-9]*[.,]?[0-9]*$/.test(e.target.value) && handleChange(e);
|
|
43
|
-
} }), _jsx("div", { className: clsx("usd-suffix text-base leading-5 font-medium text-secondary-text pointer-events-none", {
|
|
44
|
-
"absolute bottom-
|
|
43
|
+
} }), _jsx("div", { className: clsx("usd-suffix text-base group-[.exchange-amount-field]:text-sm leading-5 font-medium text-secondary-text pointer-events-none", {
|
|
44
|
+
"absolute bottom-[11px]": usdPosition === "right",
|
|
45
45
|
"h-5": usdPosition !== "right",
|
|
46
46
|
"text-secondary-text/45": !!actionValueInUsd
|
|
47
47
|
}, "group-hover:block"), ref: suffixRef, children: `${actionValueInUsd ?? requestedAmountInUsd ?? '$0'}` })] }) }));
|
|
@@ -11,12 +11,12 @@ import { useSwapDataState } from "../../context/swap";
|
|
|
11
11
|
const DestinationPicker = (props) => {
|
|
12
12
|
const { partner } = props;
|
|
13
13
|
const { values } = useFormikContext();
|
|
14
|
-
const {
|
|
14
|
+
const { toAsset: toCurrency } = values;
|
|
15
15
|
const quoteArgs = useMemo(() => transformFormValuesToQuoteArgs(values, true), [values]);
|
|
16
16
|
const { swapId } = useSwapDataState();
|
|
17
17
|
const quoteRefreshInterval = !!swapId ? 0 : undefined;
|
|
18
18
|
const { quote, isQuoteLoading } = useQuoteData(quoteArgs, quoteRefreshInterval);
|
|
19
|
-
return _jsxs("div", { className: "flex flex-col w-full bg-secondary-500 rounded-2xl p-4 pb-[15px] space-y-[27px]", children: [_jsxs("div", { className: "grid grid-cols-9 gap-2 items-center h-7", children: [_jsx("label", { htmlFor: "To", className: "block col-span-4 font-normal text-secondary-text text-base leading-5 w-30", children: "Receive at" }), _jsx("div", { className: "col-span-5 justify-self-end", children: _jsx(Address, { partner: partner, children: ({ destination, addressItem, connectedWallet, partner }) => _jsx(DestinationWalletPicker, { destination: destination, addressItem: addressItem, connectedWallet: connectedWallet, partner: partner }) }) })] }), _jsx("div", { className: "items-center space-y-2", children: _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-2 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(ReceiveAmount, {
|
|
19
|
+
return _jsxs("div", { className: "flex flex-col w-full bg-secondary-500 rounded-2xl p-4 pb-[15px] space-y-[27px]", children: [_jsxs("div", { className: "grid grid-cols-9 gap-2 items-center h-7", children: [_jsx("label", { htmlFor: "To", className: "block col-span-4 font-normal text-secondary-text text-base leading-5 w-30", children: "Receive at" }), _jsx("div", { className: "col-span-5 justify-self-end", children: _jsx(Address, { partner: partner, children: ({ destination, addressItem, connectedWallet, partner }) => _jsx(DestinationWalletPicker, { destination: destination, addressItem: addressItem, connectedWallet: connectedWallet, partner: partner }) }) })] }), _jsx("div", { className: "items-center space-y-2", children: _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-2 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(ReceiveAmount, { destination_token: toCurrency, fee: quote, isFeeLoading: isQuoteLoading }) }), _jsx("div", { className: "justify-self-end self-start", children: _jsx(RoutePicker, { direction: "to" }) })] }) })] });
|
|
20
20
|
};
|
|
21
21
|
export const SecondDestinationWalletPicker = () => {
|
|
22
22
|
return _jsxs("div", { className: " justify-center w-full pl-3 pr-2 py-2 bg-secondary-400 items-center flex font-light space-x-2 mx-auto rounded-lg focus-peer:ring-primary focus-peer:border-secondary-400 focus-peer:border focus-peer:ring-1 focus:outline-none disabled:cursor-not-allowed relative grow h-12 ", children: [_jsx(PlusIcon, { className: "stroke-1" }), " ", _jsx("span", { children: "Destination Address" })] });
|
|
@@ -8,11 +8,25 @@ import { useSelectorState } from "../../../components/Select/Selector/Index";
|
|
|
8
8
|
import useWallet from "../../../hooks/useWallet";
|
|
9
9
|
import ConnectWalletButton from "../../../components/Common/ConnectWalletButton";
|
|
10
10
|
import { SearchComponent } from "../Search";
|
|
11
|
-
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
export const Content = ({ searchQuery, setSearchQuery, rowElements, selectedToken, selectedRoute, direction, onSelect, partialPublished }) => {
|
|
12
13
|
const parentRef = useRef(null);
|
|
13
14
|
const [openValues, setOpenValues] = useState(selectedRoute ? [selectedRoute] : []);
|
|
14
15
|
const { shouldFocus } = useSelectorState();
|
|
15
16
|
const { wallets } = useWallet();
|
|
17
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
18
|
+
const scrollTimeout = useRef(null);
|
|
19
|
+
const handleScroll = () => {
|
|
20
|
+
setIsScrolling(true);
|
|
21
|
+
if (scrollTimeout.current)
|
|
22
|
+
clearTimeout(scrollTimeout.current);
|
|
23
|
+
scrollTimeout.current = setTimeout(() => {
|
|
24
|
+
setIsScrolling(false);
|
|
25
|
+
}, 1000);
|
|
26
|
+
};
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
return () => clearTimeout(scrollTimeout.current);
|
|
29
|
+
}, []);
|
|
16
30
|
const toggleAccordionItem = (value) => {
|
|
17
31
|
setOpenValues((prev) => prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value]);
|
|
18
32
|
};
|
|
@@ -42,7 +56,9 @@ export const Content = ({ searchQuery, setSearchQuery, rowElements, selectedToke
|
|
|
42
56
|
useEffect(() => {
|
|
43
57
|
return () => setSearchQuery('');
|
|
44
58
|
}, []);
|
|
45
|
-
return _jsxs("div", { className: "overflow-y-auto flex flex-col h-full z-40 openpicker", children: [_jsx(SearchComponent, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, isOpen: shouldFocus
|
|
59
|
+
return _jsxs("div", { className: "overflow-y-auto overflow-x-hidden flex flex-col h-full z-40 openpicker", children: [_jsx(SearchComponent, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, isOpen: shouldFocus }), _jsx(LayoutGroup, { children: _jsxs(motion.div, { layoutScroll: true, onScroll: handleScroll, className: clsx("select-text in-has-[.hide-main-scrollbar]:overflow-y-hidden overflow-y-auto overflow-x-hidden scrollbar:w-1! scrollbar:h-1! pr-0.5 scrollbar-thumb:bg-transparent h-full", {
|
|
60
|
+
"styled-scroll!": isScrolling
|
|
61
|
+
}), ref: parentRef, children: [wallets.length === 0 && direction === 'from' && !searchQuery &&
|
|
46
62
|
_jsx(ConnectWalletButton, { descriptionText: "Connect your wallet to browse your assets and choose easier", className: "w-full my-2.5" }), _jsx("div", { className: "relative", children: _jsx(Accordion, { type: "multiple", value: openValues, children: _jsx("div", { children: _jsxs("div", { style: {
|
|
47
63
|
height: virtualizer.getTotalSize(),
|
|
48
64
|
width: '100%',
|
|
@@ -56,6 +72,6 @@ export const Content = ({ searchQuery, setSearchQuery, rowElements, selectedToke
|
|
|
56
72
|
}, children: items.map((virtualRow) => {
|
|
57
73
|
const data = rowElements?.[virtualRow.index];
|
|
58
74
|
const key = data?.route?.name || virtualRow.key;
|
|
59
|
-
return _jsx("div", { className: "py-1 box-border w-full overflow-hidden", "data-index": virtualRow.index, ref: virtualizer.measureElement, children: _jsx(Row, {
|
|
75
|
+
return _jsx("div", { className: "py-1 box-border w-full overflow-hidden select-none", "data-index": virtualRow.index, ref: virtualizer.measureElement, children: _jsx(Row, { index: virtualRow.index, scrollContainerRef: parentRef, openValues: openValues, onSelect: onSelect, direction: direction, item: data, selectedRoute: selectedRoute, selectedToken: selectedToken, searchQuery: searchQuery, toggleContent: toggleAccordionItem }) }, key);
|
|
60
76
|
}) })] }) }) }) })] }) })] });
|
|
61
77
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { motion } from "framer-motion";
|
|
3
3
|
import TokenIcon from "../../../components/Icons/TokenIcon";
|
|
4
|
-
import { Globe } from "lucide-react";
|
|
5
4
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/shadcn/tooltip";
|
|
6
5
|
import clsx from "clsx";
|
|
7
6
|
import { useRouteTokenSwitchStore } from "../../../stores/routeTokenSwitchStore";
|
|
7
|
+
import GlobeIcon from "../../../components/Icons/GlobeIcon";
|
|
8
8
|
const switchValues = [
|
|
9
|
-
{ value: false, id: 'network', label: "Group by Network", icon:
|
|
9
|
+
{ value: false, id: 'network', label: "Group by Network", icon: GlobeIcon },
|
|
10
10
|
{ value: true, id: 'token', label: "Group by Token", icon: TokenIcon },
|
|
11
11
|
];
|
|
12
12
|
const RouteTokenSwitch = () => {
|
|
13
13
|
const showTokens = useRouteTokenSwitchStore((s) => s.showTokens);
|
|
14
14
|
const setShowTokens = useRouteTokenSwitchStore((s) => s.setShowTokens);
|
|
15
15
|
const activeTab = switchValues.find(item => item.value === showTokens)?.id || switchValues[0].id;
|
|
16
|
-
return (_jsx("div", { className: "flex justify-end", children: _jsx("div", { className: "relative flex items-center bg-secondary-500 rounded-
|
|
17
|
-
"
|
|
16
|
+
return (_jsx("div", { className: "flex justify-end", children: _jsx("div", { className: "relative flex items-center bg-secondary-500 rounded-xl p-1", children: switchValues.map((item, index) => (_jsxs(Tooltip, { children: [_jsxs(TooltipTrigger, { type: "button", onClick: () => { setShowTokens(item.value); }, className: "z-10 flex items-center justify-center rounded-lg px-4 py-1 relative", children: [activeTab === item.id && (_jsx(motion.span, { layoutId: "bubble", className: "absolute inset-0 z-10 rounded-lg bg-secondary-300 mix-blend-color", transition: { type: "spring", bounce: 0.2, duration: 0.6 } })), _jsx(item.icon, { className: clsx("text-primary-text-tertiary h-5 w-5", {
|
|
17
|
+
"text-primary-text!": activeTab === item.id,
|
|
18
18
|
}) })] }), _jsx(TooltipContent, { children: _jsx("p", { children: item.label }) })] }, index))) }) }));
|
|
19
19
|
};
|
|
20
20
|
export default RouteTokenSwitch;
|
|
@@ -10,13 +10,13 @@ import ConnectButton from "../../../components/Buttons/connectButton";
|
|
|
10
10
|
import { WalletsIcons } from "../../../components/Wallet/WalletComponents/ConnectedWallets";
|
|
11
11
|
import { useFormikContext } from "formik";
|
|
12
12
|
import { isValidAddress } from "../../../lib/address/validator";
|
|
13
|
-
import {
|
|
13
|
+
import { useSwapAccounts, useSelectSwapAccount } from "../../../context/swapAccounts";
|
|
14
14
|
import { addressFormat } from "../../../lib/address/formatter";
|
|
15
15
|
const PickerWalletConnect = ({ direction }) => {
|
|
16
16
|
const [openModal, setOpenModal] = useState(false);
|
|
17
17
|
const { values, setFieldValue } = useFormikContext();
|
|
18
|
-
const
|
|
19
|
-
const
|
|
18
|
+
const swapAccounts = useSwapAccounts(direction);
|
|
19
|
+
const selectSwapAccount = useSelectSwapAccount(direction);
|
|
20
20
|
const { connect } = useConnectModal();
|
|
21
21
|
const connectWallet = async () => {
|
|
22
22
|
const result = await connect();
|
|
@@ -31,14 +31,14 @@ const PickerWalletConnect = ({ direction }) => {
|
|
|
31
31
|
const { walletId, address, providerName } = props;
|
|
32
32
|
if (direction == 'to' && isValidAddress(address, values.to))
|
|
33
33
|
setFieldValue(`destination_address`, address);
|
|
34
|
-
|
|
34
|
+
selectSwapAccount({
|
|
35
35
|
id: walletId,
|
|
36
36
|
address,
|
|
37
37
|
providerName,
|
|
38
38
|
});
|
|
39
39
|
setOpenModal(false);
|
|
40
40
|
};
|
|
41
|
-
return _jsxs(_Fragment, { children: [_jsx(AccountsPickerButton, { accounts:
|
|
41
|
+
return _jsxs(_Fragment, { children: [_jsx(AccountsPickerButton, { accounts: swapAccounts, onOpenModalClick: () => setOpenModal(true) }), _jsx(VaulDrawer, { show: openModal, setShow: setOpenModal, header: 'Select wallet', modalId: "connectedWallets", children: _jsxs(VaulDrawer.Snap, { id: "item-1", className: "space-y-1 pb-4", children: [_jsx("button", { type: 'button', onClick: connectWallet, className: "w-full flex justify-center p-2 bg-secondary-500 rounded-md hover:bg-secondary-400", children: _jsxs("div", { className: "flex items-center text-secondary-text gap-1 px-3 py-1", children: [_jsx(Plus, { className: "h-4 w-4" }), _jsx("span", { className: "text-sm", children: "Connect new wallet" })] }) }), swapAccounts.map((account, index) => {
|
|
42
42
|
return (_jsxs("div", { children: [_jsx("div", { className: "flex justify-between items-center px-4 pt-2", children: _jsx("label", { htmlFor: "From", className: "block font-medium text-secondary-text text-sm pl-1 py-1", children: account.provider.name }) }), _jsx(AccountsList, { network: direction === 'from' ? values.from : values.to, onSelect: handleSelectAccount, selectedAccount: account }, index)] }, index));
|
|
43
43
|
})] }) })] });
|
|
44
44
|
};
|
|
@@ -1,54 +1,55 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { truncateDecimals } from "../../../components/utils/RoundDecimals";
|
|
3
3
|
import { SelectItem } from "../../../components/Select/Selector/SelectItem";
|
|
4
|
-
import { ChevronDown
|
|
4
|
+
import { ChevronDown } from "lucide-react";
|
|
5
5
|
import RoutePickerIcon from "../../../components/Icons/RoutePickerPlaceholder";
|
|
6
6
|
import { useBalance } from "../../../lib/balances/useBalance";
|
|
7
7
|
import { ImageWithFallback } from "../../../components/Common/ImageWithFallback";
|
|
8
8
|
import { getKey, useBalanceStore } from "../../../stores/balanceStore";
|
|
9
|
-
import {
|
|
10
|
-
import clsx from "clsx";
|
|
9
|
+
import { useSwapAccounts } from "../../../context/swapAccounts";
|
|
11
10
|
import { formatUsd } from "../../../components/utils/formatUsdAmount";
|
|
12
|
-
import { ExtendedAddress } from "../Address/AddressPicker/AddressWithIcon";
|
|
13
11
|
import { getTotalBalanceInUSD } from "../../../helpers/balanceHelper";
|
|
14
12
|
import { useMemo } from "react";
|
|
13
|
+
import { isNewListed, NewBadge } from "../../../lib/isNewListed";
|
|
14
|
+
import { TokenInfoIcon, TokenTitleWithBalance } from "./TokenTitleDetails";
|
|
15
15
|
export const CurrencySelectItemDisplay = (props) => {
|
|
16
|
-
const { item, route, direction,
|
|
17
|
-
return _jsxs(SelectItem, { className: "group", children: [_jsx(SelectItem.Logo, { imgSrc: item.logo, altText: `${item.symbol} logo`, className: "rounded-full" }), _jsx(NetworkTokenTitle, { item: item, route: route, direction: direction,
|
|
16
|
+
const { item, route, direction, type } = props;
|
|
17
|
+
return _jsxs(SelectItem, { className: "group", children: [_jsx(SelectItem.Logo, { imgSrc: item.logo, altText: `${item.symbol} logo`, className: "rounded-full" }), _jsx(NetworkTokenTitle, { item: item, route: route, direction: direction, type: type })] });
|
|
18
18
|
};
|
|
19
19
|
export const NetworkTokenTitle = (props) => {
|
|
20
|
-
const { item, route, direction,
|
|
21
|
-
const
|
|
22
|
-
const selectedAccount =
|
|
20
|
+
const { item, route, direction, type } = props;
|
|
21
|
+
const swapAccounts = useSwapAccounts(direction);
|
|
22
|
+
const selectedAccount = swapAccounts?.find(w => (direction == 'from' ? w.provider?.withdrawalSupportedNetworks : w.provider?.autofillSupportedNetworks)?.includes(route.name));
|
|
23
23
|
const { balances } = useBalance(selectedAccount?.address, route);
|
|
24
24
|
const tokenbalance = balances?.find(b => b.token === item.symbol);
|
|
25
25
|
const formatted_balance_amount = (tokenbalance?.amount || tokenbalance?.amount === 0) ? truncateDecimals(tokenbalance?.amount, item.precision) : '';
|
|
26
26
|
const usdAmount = (tokenbalance?.amount && item?.price_in_usd) ? item?.price_in_usd * tokenbalance?.amount : undefined;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
:
|
|
30
|
-
_jsxs("p", { className: "flex items-center gap-1 text-xs text-secondary-text", children: [_jsx("span", { children: "\u2022" }), _jsx("span", { className: "truncate max-w-[80px]", children: item.display_asset || item.symbol })] }) })] }), secondaryLogoSrc: route.logo, children: (allbalancesLoaded && tokenbalance && Number(tokenbalance?.amount) > 0) ? (_jsxs("span", { className: "text-sm text-secondary-text text-right my-auto leading-4 font-medium", children: [Number(usdAmount) > 0 && (_jsx("div", { className: clsx("text-primary-text text-base", { '!text-lg !leading-[22px]': type === 'suggested_token' }), children: formatUsd(usdAmount) })), _jsx("div", { className: 'text-xs leading-4', children: formatted_balance_amount })] })) : !allbalancesLoaded ? (_jsx("span", { className: "px-0.5", children: "-" })) : (_jsx(_Fragment, {})) });
|
|
27
|
+
const isNewlyListed = isNewListed(item?.listing_date);
|
|
28
|
+
return _jsx(SelectItem.DetailedTitle, { title: _jsx(TokenTitleWithBalance, { item: item, route: route, tokenbalance: tokenbalance, usdAmount: usdAmount, isNewlyListed: isNewlyListed }), secondaryImageAlt: route.display_name, secondary: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: "truncate", children: route.display_name }), _jsx(TokenInfoIcon, { item: item, route: route, className: "xs:hidden transition-all duration-300 opacity-0 group-hover:opacity-100 group-hover:delay-400 click-delay-on-hover shrink-0" })] }), secondaryLogoSrc: route.logo, children: (tokenbalance && Number(tokenbalance?.amount) > 0) ? (_jsx("span", { className: "text-sm text-secondary-text text-right my-auto font-medium block", children: _jsx("div", { className: 'text-xs leading-4 truncate', children: formatted_balance_amount }) })) : _jsx(_Fragment, {}) });
|
|
31
29
|
};
|
|
32
30
|
export const NetworkRouteSelectItemDisplay = (props) => {
|
|
33
|
-
const { item, direction,
|
|
34
|
-
const
|
|
35
|
-
const selectedAccount =
|
|
31
|
+
const { item, direction, hideTokenImages } = props;
|
|
32
|
+
const swapAccounts = useSwapAccounts(direction);
|
|
33
|
+
const selectedAccount = swapAccounts?.find(w => (direction == 'from' ? w.provider?.withdrawalSupportedNetworks : w.provider?.autofillSupportedNetworks)?.includes(item.name));
|
|
36
34
|
const networkBalances = useBalance(selectedAccount?.address, item);
|
|
37
35
|
const totalInUSD = useMemo(() => networkBalances ? getTotalBalanceInUSD(networkBalances, item) : undefined, [networkBalances.balances, item]);
|
|
38
36
|
const tokensWithBalance = networkBalances.balances?.filter(b => b.amount && b.amount > 0)
|
|
39
37
|
?.map(b => b.token);
|
|
40
38
|
const filteredNetworkTokens = item?.tokens?.filter(token => tokensWithBalance?.includes(token.symbol));
|
|
41
|
-
const hasLoadedBalances =
|
|
39
|
+
const hasLoadedBalances = totalInUSD !== null && Number(totalInUSD) > 0;
|
|
42
40
|
const showTokenLogos = hasLoadedBalances && filteredNetworkTokens?.length;
|
|
43
|
-
|
|
41
|
+
const haveNewlyListedTokens = useMemo(() => item.tokens?.some(t => isNewListed(t.listing_date)), [item]);
|
|
42
|
+
return (_jsxs(SelectItem, { className: "bg-secondary-500 group rounded-xl hover:bg-secondary-400 group/item relative pr-7 py-2", children: [_jsx(SelectItem.Logo, { imgSrc: item.logo, altText: `${item.display_name} logo`, className: "rounded-md" }), _jsx(SelectItem.Title, { children: _jsxs(_Fragment, { children: [_jsx("span", { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { children: item.display_name }), haveNewlyListedTokens &&
|
|
43
|
+
_jsx(NewBadge, {})] }) }), hasLoadedBalances ? (_jsxs("div", { className: `${showTokenLogos ? "flex flex-col space-y-0.5" : ""} ${hideTokenImages ? "hidden" : ""}`, children: [_jsx("span", { className: "text-secondary-text text-sm leading-4 font-medium", children: formatUsd(totalInUSD) }), showTokenLogos ? (_jsxs("div", { className: "flex justify-end items-center -space-x-2 relative h-4", children: [filteredNetworkTokens.slice(0, 3).map((t, index) => (_jsx(ImageWithFallback, { src: t.logo, alt: `${t.symbol} logo`, height: "16", width: "16", loading: "eager", fetchPriority: 'high', className: "rounded-full object-contain" }, `${t.symbol}-${index}`))), filteredNetworkTokens.length > 3 && (_jsx("div", { className: "w-4 h-4 bg-secondary-600 text-primary-text text-[8px] rounded-full flex items-center justify-center border-2 border-background", children: _jsxs("span", { children: ["+", filteredNetworkTokens.length - 3] }) }))] })) : _jsx(_Fragment, {})] })) : _jsx(_Fragment, {}), _jsx(ChevronDown, { className: "!w-3.5 !h-3.5 absolute right-2 top-1/2 -translate-y-1/2 text-secondary-text transition-opacity duration-200 opacity-0 group-hover/item:opacity-100", "aria-hidden": "true" })] }) })] }));
|
|
44
44
|
};
|
|
45
|
-
export const GroupedTokenHeader = ({ item, direction,
|
|
46
|
-
const
|
|
45
|
+
export const GroupedTokenHeader = ({ item, direction, hideTokenImages }) => {
|
|
46
|
+
const swapAccounts = useSwapAccounts(direction);
|
|
47
47
|
const tokens = item.items;
|
|
48
|
+
const haveNewlyListedTokens = useMemo(() => tokens.some(t => isNewListed(t.route.token.listing_date)), [tokens]);
|
|
48
49
|
const balances = useBalanceStore(s => s.balances);
|
|
49
50
|
const networksWithBalance = Array.from(new Map(tokens
|
|
50
51
|
.map(({ route }) => {
|
|
51
|
-
const address =
|
|
52
|
+
const address = swapAccounts.find(w => (direction == 'from' ? w.provider?.withdrawalSupportedNetworks : w.provider?.autofillSupportedNetworks)?.includes(route.route.name))?.address;
|
|
52
53
|
const key = address && route.route ? getKey(address, route.route) : 'unknown';
|
|
53
54
|
const tokenSymbol = route.token.symbol;
|
|
54
55
|
const networkRoute = route.route;
|
|
@@ -58,10 +59,9 @@ export const GroupedTokenHeader = ({ item, direction, allbalancesLoaded, hideTok
|
|
|
58
59
|
})
|
|
59
60
|
.filter((entry) => !!entry)).values());
|
|
60
61
|
const tokenBalances = tokens.reduce((acc, { route }) => {
|
|
61
|
-
const address =
|
|
62
|
+
const address = swapAccounts.find(w => (direction == 'from' ? w.provider?.withdrawalSupportedNetworks : w.provider?.autofillSupportedNetworks)?.includes(route.route.name))?.address;
|
|
62
63
|
const key = address && route.route ? getKey(address, route.route) : 'unknown';
|
|
63
64
|
const tokenSymbol = route.token.symbol;
|
|
64
|
-
const networkName = route.route.name;
|
|
65
65
|
const price = route.token.price_in_usd;
|
|
66
66
|
const networkBalances = balances?.[key];
|
|
67
67
|
const balanceEntry = networkBalances?.data?.balances?.find((b) => b.token === tokenSymbol);
|
|
@@ -70,9 +70,10 @@ export const GroupedTokenHeader = ({ item, direction, allbalancesLoaded, hideTok
|
|
|
70
70
|
return { sum: acc.sum + balanceEntry.amount * price, hasVale: true };
|
|
71
71
|
}, { sum: 0, hasVale: false });
|
|
72
72
|
const mainToken = tokens[0]?.route.token;
|
|
73
|
-
const hasLoadedBalances =
|
|
73
|
+
const hasLoadedBalances = tokenBalances.hasVale && Number(tokenBalances.sum) >= 0;
|
|
74
74
|
const showNetworkIcons = hasLoadedBalances && networksWithBalance.length > 0;
|
|
75
|
-
return (_jsxs(SelectItem, { className: "bg-secondary-500 group rounded-xl hover:bg-secondary-400 group/item relative pr-7 py-2", children: [_jsx(SelectItem.Logo, { imgSrc: mainToken.logo, altText: `${mainToken.symbol} logo`, className: "rounded-full" }), _jsx(SelectItem.Title, { children: _jsxs(_Fragment, { children: [_jsx("span", { children:
|
|
75
|
+
return (_jsxs(SelectItem, { className: "bg-secondary-500 group rounded-xl hover:bg-secondary-400 group/item relative pr-7 py-2", children: [_jsx(SelectItem.Logo, { imgSrc: mainToken.logo, altText: `${mainToken.symbol} logo`, className: "rounded-full" }), _jsx(SelectItem.Title, { children: _jsxs(_Fragment, { children: [_jsx("span", { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { children: mainToken.symbol }), haveNewlyListedTokens &&
|
|
76
|
+
_jsx(NewBadge, {})] }) }), hasLoadedBalances ? (_jsxs("div", { className: `${showNetworkIcons ? "flex flex-col space-y-0.5" : ""} ${hideTokenImages ? "invisible" : "visible"}`, children: [_jsx("span", { className: "text-secondary-text text-sm leading-4 font-medium", children: formatUsd(tokenBalances.sum) }), showNetworkIcons && (_jsxs("div", { className: "flex justify-end items-center -space-x-1.5 relative h-4", children: [networksWithBalance.slice(0, 3).map((network, index) => (_jsx(ImageWithFallback, { src: network.logo, alt: `${network.display_name} logo`, height: "16", width: "16", loading: "eager", fetchPriority: "high", className: "rounded-full object-contain" }, `${network.display_name}-${index}`))), networksWithBalance.length > 3 && (_jsx("div", { className: "w-4 h-4 bg-secondary-600 text-primary-text text-[8px] rounded-full flex items-center justify-center border-2 border-background", children: _jsxs("span", { children: ["+", networksWithBalance.length - 3] }) }))] }))] })) : _jsx(_Fragment, {}), _jsx(ChevronDown, { className: "!w-3.5 !h-3.5 absolute right-2 top-1/2 -translate-y-1/2 text-secondary-text transition-opacity duration-200 opacity-0 group-hover/item:opacity-100", "aria-hidden": "true" })] }) })] }));
|
|
76
77
|
};
|
|
77
78
|
export const SelectedCurrencyDisplay = (props) => {
|
|
78
79
|
const { value, placeholder } = props;
|
|
@@ -83,6 +84,6 @@ export const SelectedCurrencyDisplay = (props) => {
|
|
|
83
84
|
};
|
|
84
85
|
export const SelectedRouteDisplay = ({ route, token, placeholder }) => {
|
|
85
86
|
const showContent = token && route;
|
|
86
|
-
return (_jsxs("span", { className: "flex grow text-left items-center text-xs md:text-base relative", children: [showContent ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "inline-flex items-center relative shrink-0", children: [_jsx(ImageWithFallback, { src: token.logo, alt: "Token Logo", height: "24", width: "24", loading: "eager", fetchPriority: "high", className: "rounded-full object-contain" }), _jsx(ImageWithFallback, { src: route.logo, alt: "Network Logo", height: "
|
|
87
|
+
return (_jsxs("span", { className: "flex grow text-left items-center text-xs md:text-base relative", children: [showContent ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "inline-flex items-center relative shrink-0 h-7 w-7", children: [_jsx("div", { className: "h-6 w-6", children: _jsx(ImageWithFallback, { src: token.logo, alt: "Token Logo", height: "24", width: "24", loading: "eager", fetchPriority: "high", className: "rounded-full object-contain" }) }), _jsx("div", { className: "absolute left-[13px] top-3.5 h-4 w-4 rounded border border-secondary-500 bg-secondary-400 overflow-hidden", children: _jsx(ImageWithFallback, { src: route.logo, alt: "Network Logo", height: "14", width: "14", loading: "eager", fetchPriority: "high", className: "object-contain" }) })] }), _jsxs("div", { className: "ml-2 flex flex-col grow text-primary-text overflow-hidden min-w-0 max-w-3/4 group-[.exchange-picker]:max-w-full xs:max-w-[60px]", children: [_jsx("p", { className: "text-base leading-5 font-medium", children: token.symbol }), _jsx("p", { className: "text-secondary-text grow text-sm font-normal leading-4 truncate whitespace-nowrap", children: route.display_name })] })] })) : (_jsx(SelectedRoutePlaceholder, { placeholder: placeholder })), _jsx("span", { className: "px-2 pointer-events-none text-primary-text", children: _jsx(ChevronDown, { className: "h-4 w-4 text-secondary-text", "aria-hidden": "true" }) })] }));
|
|
87
88
|
};
|
|
88
89
|
export const SelectedRoutePlaceholder = ({ placeholder }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: "inline-flex items-center relative py-1", children: _jsx(RoutePickerIcon, { className: "w-7 h-7" }) }), _jsx("span", { className: "flex text-secondary-text text-base font-normal leading-5 flex-auto items-center max-w-3/4 group-[.exchange-picker]:max-w-full", children: _jsx("span", { className: "ml-2 text-sm sm:text-base sm:leading-5 whitespace-nowrap", children: placeholder }) })] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { GroupedTokenHeader, NetworkRouteSelectItemDisplay } from "../Routes";
|
|
3
|
-
export const CollapsableHeader = ({ item, direction,
|
|
3
|
+
export const CollapsableHeader = ({ item, direction, hideTokenImages, }) => {
|
|
4
4
|
const groupedByToken = item.type === "grouped_token";
|
|
5
|
-
return groupedByToken ? (_jsx(GroupedTokenHeader, { item: item, direction: direction,
|
|
5
|
+
return groupedByToken ? (_jsx(GroupedTokenHeader, { item: item, direction: direction, hideTokenImages: hideTokenImages })) : (_jsx(NetworkRouteSelectItemDisplay, { item: item.route, selected: false, direction: direction, hideTokenImages: hideTokenImages }));
|
|
6
6
|
};
|
|
@@ -6,7 +6,7 @@ import { motion } from "framer-motion";
|
|
|
6
6
|
import { CurrencySelectItemDisplay } from "../Routes";
|
|
7
7
|
import { CollapsableHeader } from "./CollapsableHeader";
|
|
8
8
|
import { StickyHeader } from "./StickyHeader";
|
|
9
|
-
export const CollapsibleRow = ({ item, toggleContent, direction, onSelect, selectedRoute, selectedToken, searchQuery, openValues, scrollContainerRef
|
|
9
|
+
export const CollapsibleRow = ({ item, index, toggleContent, direction, onSelect, selectedRoute, selectedToken, searchQuery, openValues, scrollContainerRef }) => {
|
|
10
10
|
const groupName = item.type === "grouped_token" ? item.symbol : item.route.name;
|
|
11
11
|
const headerId = `${groupName}-header`;
|
|
12
12
|
const childrenList = useMemo(() => {
|
|
@@ -34,8 +34,8 @@ export const CollapsibleRow = ({ item, toggleContent, direction, onSelect, selec
|
|
|
34
34
|
headerRef.current?.scrollIntoView({ block: "start", inline: "start" });
|
|
35
35
|
};
|
|
36
36
|
return (_createElement(motion.div, { ...(!searchQuery && { layout: "position" }), key: searchQuery ? "search" : "default" },
|
|
37
|
-
_jsxs(AccordionItem, { value: groupName, children: [_jsx("div", { ref: headerRef, id: headerId, onClick: () => toggleContent(groupName), className: `cursor-pointer bg-secondary-700 rounded-lg hover:bg-secondary-600 relative ${isSticky ? "opacity-0" : ""}`, children: _jsx(AccordionTrigger, { children: _jsx(CollapsableHeader, { item: item, direction: direction,
|
|
37
|
+
_jsxs(AccordionItem, { value: groupName, children: [_jsx("div", { ref: headerRef, id: headerId, onClick: () => toggleContent(groupName), className: `cursor-pointer bg-secondary-700 rounded-lg hover:bg-secondary-600 relative ${isSticky ? "opacity-0" : ""}`, children: _jsx(AccordionTrigger, { children: _jsx(CollapsableHeader, { item: item, direction: direction, hideTokenImages: isOpen }) }) }), _jsx(StickyHeader, { item: item, direction: direction, scrollContainer: scrollContainerRef.current, open: isOpen, headerRef: headerRef, contentRef: contentRef, childrenCount: childrenList?.length, onClick: stickyToggle, isSticky: isSticky, setSticky: setSticky }), _jsx(AccordionContent, { className: "AccordionContent", ref: contentRef, itemsCount: childrenList?.length, children: _jsx("div", { className: "has-[.token-item]:mt-1 bg-secondary-500 rounded-xl overflow-hidden", children: _jsx("div", { className: "overflow-y-auto styled-scroll p-2", children: childrenList?.map(({ token, route }, index) => {
|
|
38
38
|
const isSelected = selectedRoute === route.name && selectedToken === token.symbol;
|
|
39
|
-
return (_jsx("div", { className: "token-item pl-2 pr-3 cursor-pointer hover:bg-secondary-400 rounded-xl outline-none disabled:cursor-not-allowed", onClick: () => onSelect(route, token), children: _jsx(CurrencySelectItemDisplay, {
|
|
39
|
+
return (_jsx("div", { className: "token-item pl-2 pr-3 cursor-pointer hover:bg-secondary-400 rounded-xl outline-none disabled:cursor-not-allowed", onClick: () => onSelect(route, token), children: _jsx(CurrencySelectItemDisplay, { item: token, selected: isSelected, route: route, direction: direction }) }, `${groupName}-${index}`));
|
|
40
40
|
}) }) }) })] })));
|
|
41
41
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import ReactPortal from "../../../../components/Common/ReactPortal";
|
|
4
4
|
import { CollapsableHeader } from "./CollapsableHeader";
|
|
5
|
-
export function StickyHeader({ item, direction, scrollContainer, open, headerRef, contentRef,
|
|
5
|
+
export function StickyHeader({ item, direction, scrollContainer, open, headerRef, contentRef, childrenCount, onClick, isSticky, setSticky, }) {
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
if (!open) {
|
|
8
8
|
setSticky(false);
|
|
@@ -24,5 +24,5 @@ export function StickyHeader({ item, direction, scrollContainer, open, headerRef
|
|
|
24
24
|
}, [scrollContainer, open, headerRef, contentRef, childrenCount]);
|
|
25
25
|
if (!isSticky)
|
|
26
26
|
return null;
|
|
27
|
-
return (_jsx(ReactPortal, { wrapperId: "sticky_accordion_header", children: _jsx("div", { onClick: onClick, className: "cursor-pointer bg-secondary-700 hover:bg-secondary-600 relative pb-1", children: _jsx(CollapsableHeader, { item: item, direction: direction,
|
|
27
|
+
return (_jsx(ReactPortal, { wrapperId: "sticky_accordion_header", children: _jsx("div", { onClick: onClick, className: "cursor-pointer bg-secondary-700 hover:bg-secondary-600 relative pb-1", children: _jsx(CollapsableHeader, { item: item, direction: direction, hideTokenImages: open }) }) }));
|
|
28
28
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useBalanceStore } from "../../../../stores/balanceStore";
|
|
3
|
+
import { motion, useInView } from "framer-motion";
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
const randomWords = [
|
|
6
|
+
'Marinading',
|
|
7
|
+
"Fermenting",
|
|
8
|
+
"Steeping",
|
|
9
|
+
"Infusing",
|
|
10
|
+
"Polishing",
|
|
11
|
+
"Spicing",
|
|
12
|
+
"Compiling",
|
|
13
|
+
"Brewing",
|
|
14
|
+
"Spinning",
|
|
15
|
+
"Booting",
|
|
16
|
+
"Rendering",
|
|
17
|
+
"Synthesizing",
|
|
18
|
+
"Inferring",
|
|
19
|
+
"Neuralizing",
|
|
20
|
+
"Augmenting",
|
|
21
|
+
"Finalizing",
|
|
22
|
+
"Cooking"
|
|
23
|
+
];
|
|
24
|
+
const SuggestionsHeader = () => {
|
|
25
|
+
const isLoading = useBalanceStore(s => s.sortingDataIsLoading);
|
|
26
|
+
const partialPublished = useBalanceStore(s => s.partialPublished);
|
|
27
|
+
const suggestionsTitle = useMemo(() => isLoading ? `${randomWords[Math.floor(Math.random() * randomWords.length)]}` : '', [isLoading, partialPublished]);
|
|
28
|
+
const [typingComplete, setTypingComplete] = useState(!isLoading);
|
|
29
|
+
const [textToType, setTextToType] = useState(suggestionsTitle);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (isLoading) {
|
|
32
|
+
setTypingComplete(false);
|
|
33
|
+
setTextToType(suggestionsTitle);
|
|
34
|
+
}
|
|
35
|
+
}, [isLoading, suggestionsTitle]);
|
|
36
|
+
if (!isLoading && typingComplete) {
|
|
37
|
+
return _jsx("div", { className: "text-primary-text-tertiary text-base font-normal leading-5 pl-1 sticky top-0 z-50 flex items-baseline", children: "Suggestions" });
|
|
38
|
+
}
|
|
39
|
+
return _jsx(TypingEffect, { text: `${textToType} Suggestions`, onComplete: () => setTypingComplete(true) });
|
|
40
|
+
};
|
|
41
|
+
export function TypingEffect({ text = 'Typing Effect', onComplete }) {
|
|
42
|
+
const ref = useRef(null);
|
|
43
|
+
const isInView = useInView(ref, { once: true });
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (isInView && onComplete) {
|
|
46
|
+
const totalDuration = (text.length - 1) * 0.1 + 0.05;
|
|
47
|
+
const timeout = setTimeout(() => {
|
|
48
|
+
onComplete();
|
|
49
|
+
}, totalDuration * 1000);
|
|
50
|
+
return () => clearTimeout(timeout);
|
|
51
|
+
}
|
|
52
|
+
}, [isInView, text.length, onComplete]);
|
|
53
|
+
return (_jsx("div", { ref: ref, className: "text-transparent text-base font-normal leading-5 pl-1 top-0 z-50 items-baseline bg-[linear-gradient(120deg,var(--color-primary-text-tertiary)_40%,var(--color-primary-text),var(--color-primary-text-tertiary)_60%)]\n bg-[length:200%_100%]\n bg-clip-text\n animate-shine", children: text.split('').map((letter, index) => (_jsx(motion.span, { initial: { opacity: 0 }, animate: isInView ? { opacity: 1 } : {}, transition: { duration: 0.01, delay: index * 0.08 }, children: letter }, index))) }, text));
|
|
54
|
+
}
|
|
55
|
+
export default SuggestionsHeader;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import SuggestionsHeader from "./SuggestionsHeader";
|
|
3
|
+
import RouteTokenSwitch from "../RouteTokenSwitch";
|
|
4
|
+
const TitleRow = ({ item }) => {
|
|
5
|
+
if (item.text.toLowerCase().includes("suggestions")) {
|
|
6
|
+
return _jsx(SuggestionsHeader, {});
|
|
7
|
+
}
|
|
8
|
+
return (_jsxs("div", { className: "text-primary-text-tertiary text-base font-normal leading-5 pl-1 sticky top-0 z-50 flex items-baseline", children: [_jsx("p", { children: item.text }), item.text.toLowerCase().includes("all") &&
|
|
9
|
+
_jsx("div", { className: "relative ml-auto", children: _jsx(RouteTokenSwitch, {}) })] }));
|
|
10
|
+
};
|
|
11
|
+
export default TitleRow;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CurrencySelectItemDisplay } from "../Routes";
|
|
3
3
|
import { CollapsibleRow } from "./CollapsibleRow";
|
|
4
|
-
import RouteTokenSwitch from "../RouteTokenSwitch";
|
|
5
4
|
import clsx from "clsx";
|
|
6
5
|
import { SelectItem } from "../../../../components/Select/Selector/SelectItem";
|
|
7
|
-
|
|
6
|
+
import TitleRow from "./TitleRow";
|
|
7
|
+
export default function Row({ item, direction, selectedRoute, selectedToken, searchQuery, toggleContent, onSelect, openValues, scrollContainerRef, index, }) {
|
|
8
8
|
switch (item.type) {
|
|
9
9
|
case "network":
|
|
10
10
|
case "grouped_token":
|
|
11
|
-
return (_jsx(CollapsibleRow, { item: item, direction: direction, selectedRoute: selectedRoute, selectedToken: selectedToken, searchQuery: searchQuery, toggleContent: toggleContent, onSelect: onSelect, openValues: openValues, scrollContainerRef: scrollContainerRef
|
|
11
|
+
return (_jsx(CollapsibleRow, { index: index, item: item, direction: direction, selectedRoute: selectedRoute, selectedToken: selectedToken, searchQuery: searchQuery, toggleContent: toggleContent, onSelect: onSelect, openValues: openValues, scrollContainerRef: scrollContainerRef }));
|
|
12
12
|
case "network_token":
|
|
13
13
|
case "suggested_token": {
|
|
14
14
|
const token = item.route.token;
|
|
15
15
|
const route = item.route.route;
|
|
16
16
|
const isSelected = selectedRoute === route.name && selectedToken === token.symbol;
|
|
17
|
-
return (_jsx("div", { className: clsx("cursor-pointer hover:bg-secondary-500 outline-none disabled:cursor-not-allowed rounded-xl"), onClick: () => onSelect(route, token), children: _jsx(CurrencySelectItemDisplay, {
|
|
17
|
+
return (_jsx("div", { className: clsx("cursor-pointer hover:bg-secondary-500 outline-none disabled:cursor-not-allowed rounded-xl"), onClick: () => onSelect(route, token), children: _jsx(CurrencySelectItemDisplay, { item: token, selected: isSelected, route: route, direction: direction, type: item.type }) }));
|
|
18
18
|
}
|
|
19
19
|
case "group_title":
|
|
20
|
-
return
|
|
21
|
-
_jsx("div", { className: "relative ml-auto", children: _jsx(RouteTokenSwitch, {}) })] }));
|
|
20
|
+
return _jsx(TitleRow, { item: item });
|
|
22
21
|
case "sceleton_token":
|
|
23
22
|
return (_jsxs(SelectItem, { className: "animate-pulse", children: [_jsx(SelectItem.Logo, { altText: `sceleton logo `, className: "rounded-full bg-secondary-500" }), _jsxs(SelectItem.Title, { className: "py-0.5", children: [_jsxs("div", { className: "grid gap-0 leading-5 align-middle space-y-0.5 font-medium", children: [_jsx("span", { className: "align-middle h-3.5 my-1 w-12 bg-secondary-500 rounded-sm" }), _jsxs("div", { className: "flex items-center space-x-1 align-middle", children: [_jsx("div", { className: "w-2 h-2 my-1 bg-secondary-500 rounded-sm" }), _jsx("span", { className: "bg-secondary-500 text-xs whitespace-nowrap h-2 my-1 w-20 rounded-sm" })] })] }), _jsxs("span", { className: "text-sm text-secondary-text text-right my-auto leading-4 font-medium", children: [_jsx("div", { className: "text-primary-text text-lg leading-[22px] bg-secondary-500 h-3 my-1 w-16 ml-auto rounded-sm" }), _jsx("div", { className: "text-xs leading-4 bg-secondary-500 h-2 my-1 w-10 ml-auto rounded-sm" })] })] })] }));
|
|
24
23
|
default:
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Info } from "lucide-react";
|
|
3
|
+
import { ExtendedAddress } from "../Address/AddressPicker/AddressWithIcon";
|
|
4
|
+
import { formatUsd } from "../../../components/utils/formatUsdAmount";
|
|
5
|
+
import { NewBadge } from "../../../lib/isNewListed";
|
|
6
|
+
export const TokenInfoIcon = ({ item, route, className, iconOnly = false }) => (_jsx("div", { className: className, children: _jsx(ExtendedAddress, { network: item.contract ? route : undefined, isForCurrency: true, showDetails: true, address: item.contract || `${route.display_name} native coin`, logo: item.logo, title: item.symbol, description: item.display_asset, isNativeToken: !item.contract, children: _jsxs("div", { className: `flex items-center gap-1 text-secondary-text cursor-pointer hover:text-primary-text ${iconOnly ? '' : 'text-xs'}`, children: [!iconOnly && (_jsxs("p", { className: "max-w-[90px] truncate", children: [_jsx("span", { children: "\u2022" }), " ", _jsx("span", { children: item.display_asset || item.symbol })] })), _jsx(Info, { className: iconOnly ? "h-4 w-4" : "h-3 w-3" })] }) }) }));
|
|
7
|
+
export const TokenTitleWithBalance = ({ item, route, tokenbalance, usdAmount, isNewlyListed }) => {
|
|
8
|
+
return (_jsxs("div", { className: "flex items-center gap-2 justify-between w-full", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { children: item.symbol }), isNewlyListed &&
|
|
9
|
+
_jsx(NewBadge, {}), _jsx(TokenInfoIcon, { item: item, route: route, iconOnly: true, className: "hidden xs:block transition-all duration-300 opacity-0 group-hover:opacity-100 group-hover:delay-400 click-delay-on-hover" })] }), (tokenbalance && Number(tokenbalance?.amount) > 0 && Number(usdAmount) > 0) && (_jsx("div", { className: "text-primary-text text-lg leading-[22px] font-medium", children: formatUsd(usdAmount) }))] }));
|
|
10
|
+
};
|
|
@@ -13,7 +13,7 @@ import clsx from "clsx";
|
|
|
13
13
|
const RoutePicker = ({ direction, isExchange = false, className }) => {
|
|
14
14
|
const { values, setFieldValue, } = useFormikContext();
|
|
15
15
|
const [searchQuery, setSearchQuery] = useState("");
|
|
16
|
-
const { allRoutes, isLoading, routeElements, selectedRoute, selectedToken
|
|
16
|
+
const { allRoutes, isLoading, routeElements, selectedRoute, selectedToken } = useFormRoutes({ direction, values }, searchQuery);
|
|
17
17
|
const currencyFieldName = direction === 'from' ? 'fromAsset' : 'toAsset';
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
const updateValues = async () => {
|
|
@@ -50,7 +50,7 @@ const RoutePicker = ({ direction, isExchange = false, className }) => {
|
|
|
50
50
|
});
|
|
51
51
|
}, [currencyFieldName, direction, setFieldValue]);
|
|
52
52
|
const showbalance = !isExchange && (direction === 'to' || values.depositMethod === 'wallet');
|
|
53
|
-
return (_jsxs("div", { className: clsx("flex flex-col self-end relative items-center", className), children: [_jsxs(Selector, { children: [_jsx(SelectorTrigger, { disabled: false, className: "group-[.exchange-picker]:bg-secondary-500 py-
|
|
53
|
+
return (_jsxs("div", { className: clsx("flex flex-col self-end relative items-center", className), children: [_jsxs(Selector, { children: [_jsx(SelectorTrigger, { disabled: false, className: "group-[.exchange-picker]:bg-secondary-500 py-1.5 px-2 group-[.exchange-picker]:py-2! group-[.exchange-picker]:px-3! active:animate-press-down group-[.exchange-picker]:active:animate-none", children: _jsx(SelectedRouteDisplay, { route: selectedRoute, token: selectedToken, placeholder: "Select token" }) }), _jsx(SelectorContent, { isLoading: isLoading, searchHint: "Search", header: _jsx(PickerWalletConnect, { direction: direction }), children: ({ closeModal }) => (_jsx(Content, { onSelect: (r, t) => { handleSelect(r, t); closeModal(); }, searchQuery: searchQuery, setSearchQuery: setSearchQuery, rowElements: routeElements, direction: direction, selectedRoute: selectedRoute?.name, selectedToken: selectedToken?.symbol })) })] }), showbalance &&
|
|
54
54
|
_jsx(Balance, { values: values, direction: direction })] }));
|
|
55
55
|
};
|
|
56
56
|
export default RoutePicker;
|
|
@@ -12,12 +12,12 @@ import WalletsList from "../../components/Wallet/WalletComponents/WalletsList";
|
|
|
12
12
|
import { Popover, PopoverContent, PopoverTrigger } from "../../components/shadcn/popover";
|
|
13
13
|
import FilledCheck from "../../components/Icons/FilledCheck";
|
|
14
14
|
import clsx from "clsx";
|
|
15
|
-
import { useSelectedAccount,
|
|
15
|
+
import { useSelectedAccount, useSelectSwapAccount } from "../../context/swapAccounts";
|
|
16
16
|
const SourceWalletPicker = () => {
|
|
17
17
|
const [openModal, setOpenModal] = useState(false);
|
|
18
18
|
const { values, setFieldValue } = useFormikContext();
|
|
19
19
|
const source_token = values.fromAsset;
|
|
20
|
-
const selectSourceAccount =
|
|
20
|
+
const selectSourceAccount = useSelectSwapAccount("from");
|
|
21
21
|
const { provider } = useWallet(values.from, "withdrawal");
|
|
22
22
|
const selectedSourceAccount = useSelectedAccount("from", values.from?.name);
|
|
23
23
|
const { selectedConnector } = useConnectModal();
|
|
@@ -61,7 +61,7 @@ export const FormSourceWalletButton = () => {
|
|
|
61
61
|
const walletNetwork = values.fromExchange ? undefined : values.from;
|
|
62
62
|
const { provider } = useWallet(walletNetwork, 'withdrawal');
|
|
63
63
|
const { isWalletModalOpen, cancel, selectedConnector, connect } = useConnectModal();
|
|
64
|
-
const selectSourceAccount =
|
|
64
|
+
const selectSourceAccount = useSelectSwapAccount("from");
|
|
65
65
|
const handleWalletChange = () => {
|
|
66
66
|
setOpenModal(true);
|
|
67
67
|
};
|
|
@@ -106,12 +106,14 @@ export const FormSourceWalletButton = () => {
|
|
|
106
106
|
};
|
|
107
107
|
const Connect = ({ connectFn, setMountWalletPortal }) => {
|
|
108
108
|
const { connect } = useConnectModal();
|
|
109
|
+
const { providers } = useWallet();
|
|
110
|
+
const isProvidersReady = providers.every(p => typeof p.ready === 'boolean' ? p.ready : true);
|
|
109
111
|
const connectWallet = async () => {
|
|
110
112
|
setMountWalletPortal && setMountWalletPortal(true);
|
|
111
113
|
await connect();
|
|
112
114
|
setMountWalletPortal && setMountWalletPortal(false);
|
|
113
115
|
};
|
|
114
|
-
return _jsx(SubmitButton, { onClick: () => connectFn ? connectFn() : connectWallet(), type: "button", icon: _jsx(WalletIcon, { className: "h-6 w-6", strokeWidth: 2 }), children: "Connect a wallet" });
|
|
116
|
+
return _jsx(SubmitButton, { onClick: () => connectFn ? connectFn() : connectWallet(), type: "button", icon: _jsx(WalletIcon, { className: "h-6 w-6", strokeWidth: 2 }), isDisabled: !isProvidersReady, children: "Connect a wallet" });
|
|
115
117
|
};
|
|
116
118
|
const ContinueWithoutWallet = ({ onClick }) => {
|
|
117
119
|
//TODO: bg-secondary-700 is a hotfix, should refactor and fix sticky footer for VaulDrawer
|