@layerswap/widget 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/Models/LayerSwapSettings.js +0 -1
- package/dist/esm/Models/Theme.js +39 -8
- package/dist/esm/components/Buttons/copyButton.js +5 -3
- package/dist/esm/components/Buttons/submitButton.js +2 -1
- package/dist/esm/components/ColorSchema.js +3 -10
- package/dist/esm/components/Common/ConnectWalletButton.js +9 -3
- package/dist/esm/components/Common/CountDownTimer.js +0 -15
- package/dist/esm/components/Common/WarningMessage.js +4 -2
- package/dist/esm/components/Common/guideLink.js +4 -6
- package/dist/esm/components/ErrorFallback.js +11 -11
- package/dist/esm/components/HeaderWithMenu.js +1 -1
- package/dist/esm/components/Icons/Wallets/Xverse.js +3 -0
- package/dist/esm/components/Icons/Wallets/index.js +1 -0
- package/dist/esm/components/Input/Address/AddressPicker/index.js +15 -12
- package/dist/esm/components/Input/Amount/Balance.js +8 -2
- 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 -38
- 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/NumericInput.js +7 -4
- package/dist/esm/components/Input/RoutePicker/Content.js +19 -3
- package/dist/esm/components/Input/RoutePicker/RouterPickerWalletConnect.js +5 -5
- package/dist/esm/components/Input/RoutePicker/Routes.js +18 -18
- 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 +6 -7
- package/dist/esm/components/Input/RoutePicker/index.js +2 -2
- package/dist/esm/components/Input/SourceWalletPicker.js +7 -5
- package/dist/esm/components/Menu/index.js +2 -2
- package/dist/esm/components/Modal/vaulModal.js +11 -16
- 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 +2 -3
- 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 +5 -4
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/Refuel.js +8 -6
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/Slippage.js +6 -1
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/DetailedEstimates.js +51 -14
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/SummaryRow.js +2 -2
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/index.js +4 -4
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/index.js +8 -9
- package/dist/esm/components/Pages/Swap/Form/Form.js +27 -3
- package/dist/esm/components/Pages/Swap/Form/FormWrapper.js +8 -14
- package/dist/esm/components/Pages/Swap/Form/NetworkForm.js +11 -13
- package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/ReserveGasNote.js +8 -6
- package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/validationError/ErrorDisplay.js +1 -1
- package/dist/esm/components/Pages/Swap/Withdraw/Failed.js +12 -8
- package/dist/esm/components/Pages/Swap/Withdraw/ManualWithdraw.js +29 -10
- package/dist/esm/components/Pages/Swap/Withdraw/NotFound.js +15 -4
- package/dist/esm/components/Pages/Swap/Withdraw/Processing/Processing.js +36 -41
- package/dist/esm/components/Pages/Swap/Withdraw/Summary/Summary.js +3 -3
- package/dist/esm/components/Pages/Swap/Withdraw/Summary/index.js +3 -3
- 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 +118 -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/TransactionMessages.js +14 -15
- package/dist/esm/components/Pages/SwapHistory/History.js +2 -2
- package/dist/esm/components/Pages/SwapHistory/SwapDetailsComponent.js +4 -1
- package/dist/esm/components/Pages/SwapHistory/index.js +6 -6
- package/dist/esm/components/Wallet/WalletComponents/ConnectedWallets.js +1 -1
- package/dist/esm/components/Wallet/WalletComponents/WalletsList.js +4 -3
- package/dist/esm/components/Wallet/WalletModal/Connector.js +2 -2
- package/dist/esm/components/Wallet/WalletModal/ConnectorsList.js +49 -24
- package/dist/esm/components/Wallet/WalletModal/index.js +3 -1
- 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 +1 -1
- package/dist/esm/components/Widget/Index.js +2 -3
- package/dist/esm/components/WidgetLoading.js +9 -2
- package/dist/esm/components/utils/RoundDecimals.js +4 -2
- package/dist/esm/context/ErrorProvider.js +14 -0
- package/dist/esm/context/LayerswapProvider.js +6 -5
- package/dist/esm/context/asyncModal.js +1 -1
- package/dist/esm/context/callbackProvider.js +54 -60
- package/dist/esm/context/resolverContext.js +7 -2
- package/dist/esm/context/swap.js +13 -18
- 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 +6 -5
- package/dist/esm/hooks/useFormRoutes.js +16 -8
- package/dist/esm/hooks/useFormValidation.js +11 -6
- 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 +28 -17
- package/dist/esm/lib/ErrorHandler.js +6 -0
- package/dist/esm/lib/NetworkSettings.js +0 -16
- package/dist/esm/lib/apiClients/layerSwapApiClient.js +12 -35
- package/dist/esm/lib/axiosInterceptor.js +2 -2
- package/dist/esm/lib/balances/balanceResolver.js +9 -13
- package/dist/esm/lib/fees.js +50 -0
- package/dist/esm/lib/resolvers/resolverService.js +10 -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 +1 -2
- package/dist/esm/stores/logStore.js +11 -0
- package/dist/esm/types/balance.js +8 -9
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/logEvents.js +1 -0
- package/dist/index.css +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Models/Balance.d.ts +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 +0 -3
- package/dist/types/Models/Theme.d.ts.map +1 -1
- package/dist/types/components/Buttons/copyButton.d.ts +3 -1
- package/dist/types/components/Buttons/copyButton.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/ColorSchema.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/Wallets/Xverse.d.ts +4 -0
- package/dist/types/components/Icons/Wallets/Xverse.d.ts.map +1 -0
- package/dist/types/components/Icons/Wallets/index.d.ts +1 -0
- package/dist/types/components/Icons/Wallets/index.d.ts.map +1 -1
- package/dist/types/components/Input/Address/AddressNote.d.ts +2 -2
- 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 +2 -2
- 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/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 +2 -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/NumericInput.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/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/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/Modal/vaulModal.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 -1
- 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/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/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/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/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/StatusIcons.d.ts +1 -1
- package/dist/types/components/Pages/SwapHistory/SwapDetailsComponent.d.ts +1 -1
- package/dist/types/components/Pages/SwapHistory/SwapDetailsComponent.d.ts.map +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/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/index.d.ts +1 -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/components/utils/RoundDecimals.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 +6 -12
- 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/validationContext.d.ts +1 -0
- package/dist/types/context/validationContext.d.ts.map +1 -1
- 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/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 +10 -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/NetworkSettings.d.ts +0 -1
- package/dist/types/lib/NetworkSettings.d.ts.map +1 -1
- package/dist/types/lib/apiClients/layerSwapApiClient.d.ts +2 -10
- 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/helpers.d.ts +1 -1
- 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/nft/nftBalanceResolver.d.ts +1 -1
- package/dist/types/lib/resolvers/resolverService.d.ts +8 -5
- package/dist/types/lib/resolvers/resolverService.d.ts.map +1 -1
- package/dist/types/lib/sorting.d.ts +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.map +1 -1
- 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/gas.d.ts +2 -2
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/logEvents.d.ts +41 -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 +25 -6
- package/dist/types/types/wallet.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/esm/helpers/querryHelper.js +0 -13
- package/dist/esm/lib/logError.js +0 -17
- 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
|
@@ -8,7 +8,7 @@ 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
|
-
export const Content = ({ searchQuery, setSearchQuery, rowElements, selectedToken, selectedRoute, direction, onSelect,
|
|
11
|
+
export const Content = ({ searchQuery, setSearchQuery, rowElements, selectedToken, selectedRoute, direction, onSelect, partialPublished }) => {
|
|
12
12
|
const parentRef = useRef(null);
|
|
13
13
|
const [openValues, setOpenValues] = useState(selectedRoute ? [selectedRoute] : []);
|
|
14
14
|
const { shouldFocus } = useSelectorState();
|
|
@@ -18,10 +18,26 @@ export const Content = ({ searchQuery, setSearchQuery, rowElements, selectedToke
|
|
|
18
18
|
};
|
|
19
19
|
const virtualizer = useVirtualizer({
|
|
20
20
|
count: rowElements.length,
|
|
21
|
-
estimateSize: () =>
|
|
21
|
+
estimateSize: (index) => {
|
|
22
|
+
const item = rowElements[index];
|
|
23
|
+
const key = item?.route?.name || item?.symbol;
|
|
24
|
+
const isOpen = openValues.includes(key);
|
|
25
|
+
// Better size estimation based on open state
|
|
26
|
+
if (isOpen && (item.type === 'network' || item.type === 'grouped_token')) {
|
|
27
|
+
const tokenCount = item.type === 'network'
|
|
28
|
+
? item.route.tokens.length
|
|
29
|
+
: item.items.length;
|
|
30
|
+
// Base header (52) + tokens (each ~52px) + padding
|
|
31
|
+
return 52 + (tokenCount * 52) + 20;
|
|
32
|
+
}
|
|
33
|
+
return 52;
|
|
34
|
+
},
|
|
22
35
|
getScrollElement: () => parentRef.current,
|
|
23
36
|
overscan: 15
|
|
24
37
|
});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
virtualizer.measure();
|
|
40
|
+
}, [openValues]);
|
|
25
41
|
const items = virtualizer.getVirtualItems();
|
|
26
42
|
useEffect(() => {
|
|
27
43
|
return () => setSearchQuery('');
|
|
@@ -40,6 +56,6 @@ export const Content = ({ searchQuery, setSearchQuery, rowElements, selectedToke
|
|
|
40
56
|
}, children: items.map((virtualRow) => {
|
|
41
57
|
const data = rowElements?.[virtualRow.index];
|
|
42
58
|
const key = data?.route?.name || virtualRow.key;
|
|
43
|
-
return _jsx("div", { className: "py-1 box-border w-full overflow-hidden", "data-index": virtualRow.index, ref: virtualizer.measureElement, children: _jsx(Row, {
|
|
59
|
+
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);
|
|
44
60
|
}) })] }) }) }) })] }) })] });
|
|
45
61
|
};
|
|
@@ -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
|
};
|
|
@@ -6,20 +6,20 @@ 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 {
|
|
9
|
+
import { useSwapAccounts } from "../../../context/swapAccounts";
|
|
10
10
|
import clsx from "clsx";
|
|
11
11
|
import { formatUsd } from "../../../components/utils/formatUsdAmount";
|
|
12
12
|
import { ExtendedAddress } from "../Address/AddressPicker/AddressWithIcon";
|
|
13
13
|
import { getTotalBalanceInUSD } from "../../../helpers/balanceHelper";
|
|
14
14
|
import { useMemo } from "react";
|
|
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) : '';
|
|
@@ -27,28 +27,28 @@ export const NetworkTokenTitle = (props) => {
|
|
|
27
27
|
return _jsx(SelectItem.DetailedTitle, { title: item.symbol, secondaryImageAlt: route.display_name, secondary: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { children: route.display_name }), _jsx("div", { className: "transition-all duration-300 opacity-0 group-hover:opacity-100 group-hover:delay-400 click-delay-on-hover", children: item.contract ?
|
|
28
28
|
_jsx(ExtendedAddress, { network: route, isForCurrency: true, showDetails: true, address: item.contract, logo: item.logo, title: item.symbol, description: item.display_asset, children: _jsxs("div", { className: "flex items-center gap-1 text-secondary-text text-xs cursor-pointer hover:text-primary-text", children: [_jsxs("p", { className: "max-w-[90px] truncate", children: [_jsx("span", { children: "\u2022" }), " ", _jsx("span", { children: item.display_asset || item.symbol })] }), _jsx(Info, { className: "h-3 w-3" })] }) })
|
|
29
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: (
|
|
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: (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 })] })) : _jsx(_Fragment, {}) });
|
|
31
31
|
};
|
|
32
32
|
export const NetworkRouteSelectItemDisplay = (props) => {
|
|
33
|
-
const { item, direction,
|
|
34
|
-
const
|
|
35
|
-
const selectedAccount =
|
|
33
|
+
const { item, direction, hideTokenImages } = props;
|
|
34
|
+
const swapAccounts = useSwapAccounts(direction);
|
|
35
|
+
const selectedAccount = swapAccounts?.find(w => (direction == 'from' ? w.provider?.withdrawalSupportedNetworks : w.provider?.autofillSupportedNetworks)?.includes(item.name));
|
|
36
36
|
const networkBalances = useBalance(selectedAccount?.address, item);
|
|
37
37
|
const totalInUSD = useMemo(() => networkBalances ? getTotalBalanceInUSD(networkBalances, item) : undefined, [networkBalances.balances, item]);
|
|
38
38
|
const tokensWithBalance = networkBalances.balances?.filter(b => b.amount && b.amount > 0)
|
|
39
39
|
?.map(b => b.token);
|
|
40
40
|
const filteredNetworkTokens = item?.tokens?.filter(token => tokensWithBalance?.includes(token.symbol));
|
|
41
|
-
const hasLoadedBalances =
|
|
41
|
+
const hasLoadedBalances = totalInUSD !== null && Number(totalInUSD) > 0;
|
|
42
42
|
const showTokenLogos = hasLoadedBalances && filteredNetworkTokens?.length;
|
|
43
|
-
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: item.display_name }), 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, {})] })) :
|
|
43
|
+
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: item.display_name }), 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
48
|
const balances = useBalanceStore(s => s.balances);
|
|
49
49
|
const networksWithBalance = Array.from(new Map(tokens
|
|
50
50
|
.map(({ route }) => {
|
|
51
|
-
const address =
|
|
51
|
+
const address = swapAccounts.find(w => (direction == 'from' ? w.provider?.withdrawalSupportedNetworks : w.provider?.autofillSupportedNetworks)?.includes(route.route.name))?.address;
|
|
52
52
|
const key = address && route.route ? getKey(address, route.route) : 'unknown';
|
|
53
53
|
const tokenSymbol = route.token.symbol;
|
|
54
54
|
const networkRoute = route.route;
|
|
@@ -58,7 +58,7 @@ export const GroupedTokenHeader = ({ item, direction, allbalancesLoaded, hideTok
|
|
|
58
58
|
})
|
|
59
59
|
.filter((entry) => !!entry)).values());
|
|
60
60
|
const tokenBalances = tokens.reduce((acc, { route }) => {
|
|
61
|
-
const address =
|
|
61
|
+
const address = swapAccounts.find(w => (direction == 'from' ? w.provider?.withdrawalSupportedNetworks : w.provider?.autofillSupportedNetworks)?.includes(route.route.name))?.address;
|
|
62
62
|
const key = address && route.route ? getKey(address, route.route) : 'unknown';
|
|
63
63
|
const tokenSymbol = route.token.symbol;
|
|
64
64
|
const networkName = route.route.name;
|
|
@@ -70,9 +70,9 @@ 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: mainToken.symbol }), 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] }) }))] }))] })) :
|
|
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: mainToken.symbol }), 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
76
|
};
|
|
77
77
|
export const SelectedCurrencyDisplay = (props) => {
|
|
78
78
|
const { value, placeholder } = props;
|
|
@@ -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,26 +1,25 @@
|
|
|
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
|
-
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-
|
|
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:
|
|
25
24
|
return null;
|
|
26
25
|
}
|
|
@@ -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-[6px] 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, {
|
|
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-[6px] 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,15 +106,17 @@ 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
|
|
118
|
-
return (_jsxs("div", { className: "inline-flex items-center gap-1.5 justify-center w-full pt-2 bg-secondary-700", children: [_jsx("button", { type: "button", onClick: onClick, className: "underline hover:no-underline text-base text-center text-secondary-text cursor-pointer ", children: "Continue without a wallet" }), _jsxs(Popover, { children: [_jsx(PopoverTrigger, { children: _jsx("div", { className: "text-xs text-secondary-text hover:text-primary-text rounded-full transition-colors duration-200 ", children: _jsx(CircleHelp, { className: "h-5 w-5" }) }) }), _jsx(PopoverContent, { side: "top", className: "max-w-[250px] text-xs", children: _jsx("p", { children: "Get a deposit address, send your crypto from any external wallet or exchange, and we'll handle the rest." }) })] })] }));
|
|
120
|
+
return (_jsxs("div", { className: "inline-flex items-center max-sm:pb-2 gap-1.5 justify-center w-full pt-2 bg-secondary-700", children: [_jsx("button", { type: "button", onClick: onClick, className: "underline hover:no-underline text-base text-center text-secondary-text cursor-pointer ", children: "Continue without a wallet" }), _jsxs(Popover, { children: [_jsx(PopoverTrigger, { children: _jsx("div", { className: "text-xs text-secondary-text hover:text-primary-text rounded-full transition-colors duration-200 ", children: _jsx(CircleHelp, { className: "h-5 w-5" }) }) }), _jsx(PopoverContent, { side: "top", className: "max-w-[250px] text-xs", children: _jsx("p", { children: "Get a deposit address, send your crypto from any external wallet or exchange, and we'll handle the rest." }) })] })] }));
|
|
119
121
|
};
|
|
120
122
|
export default SourceWalletPicker;
|
|
@@ -26,8 +26,8 @@ const Comp = () => {
|
|
|
26
26
|
const handleGoToStep = (step) => {
|
|
27
27
|
goToStep(step);
|
|
28
28
|
};
|
|
29
|
-
return _jsx(_Fragment, { children: _jsxs("div", { className: "text-secondary-text cursor-pointer relative", children: [_jsx("div", { className: "sm:-mr-2
|
|
30
|
-
_jsx(IconButton, { className: "inline-flex", onClick: goBack, icon: _jsx(ChevronLeft, { strokeWidth: "2" }) }), _jsx("h2", { children: currentStepName })] }), children: _jsx(VaulDrawer.Snap, { openFullHeight: true, id: "item-1", children: _jsxs(Wizard, { wizardId: 'menuWizard', children: [_jsx(WizardItem, { StepName: MenuStep.Menu, inModal: true, children: _jsx(MenuList, { goToStep: handleGoToStep }) }), _jsx(WizardItem, { StepName: MenuStep.Transactions, GoBack: goBackToMenuStep, className: "h-full", inModal: true, children: _jsx(HistoryList, { onNewTransferClick: () => handleModalOpenStateChange(false) }) }), _jsx(WizardItem, { StepName: MenuStep.Campaigns, GoBack: goBackToMenuStep, className: "h-full", inModal: true, children: _jsx(CampaignsComponent, { onCampaignSelect: (campaign) => { handleGoToStep(MenuStep.CampaignDetails); setSelectedCampaign(campaign.name); } }) }), _jsx(WizardItem, { StepName: MenuStep.CampaignDetails, GoBack: () => goToStep(MenuStep.Campaigns, "back"), className: "h-full", inModal: true, children: _jsx(CampaignDetailsComponent, { campaignName: selectedCampaign }) })] }) }) })] }) });
|
|
29
|
+
return _jsx(_Fragment, { children: _jsxs("div", { className: "text-secondary-text cursor-pointer relative", children: [_jsx("div", { className: "sm:-mr-2 mr-0", children: _jsx(IconButton, { className: "inline-flex active:animate-press-down", onClick: () => setOpenTopModal(true), icon: _jsx(MenuIcon, { strokeWidth: "2" }) }) }), _jsx(VaulDrawer, { modalId: "menuModal", show: openTopModal, setShow: handleModalOpenStateChange, header: _jsxs("div", { className: "inline-flex items-center", children: [goBack &&
|
|
30
|
+
_jsx(IconButton, { className: "inline-flex", onClick: goBack, icon: _jsx(ChevronLeft, { strokeWidth: "2" }) }), _jsx("h2", { children: currentStepName })] }), children: _jsx(VaulDrawer.Snap, { openFullHeight: true, className: "h-full pb-0!", id: "item-1", children: _jsxs(Wizard, { wizardId: 'menuWizard', children: [_jsx(WizardItem, { StepName: MenuStep.Menu, inModal: true, children: _jsx(MenuList, { goToStep: handleGoToStep }) }), _jsx(WizardItem, { StepName: MenuStep.Transactions, GoBack: goBackToMenuStep, className: "h-full", inModal: true, children: _jsx(HistoryList, { onNewTransferClick: () => handleModalOpenStateChange(false) }) }), _jsx(WizardItem, { StepName: MenuStep.Campaigns, GoBack: goBackToMenuStep, className: "h-full", inModal: true, children: _jsx(CampaignsComponent, { onCampaignSelect: (campaign) => { handleGoToStep(MenuStep.CampaignDetails); setSelectedCampaign(campaign.name); } }) }), _jsx(WizardItem, { StepName: MenuStep.CampaignDetails, GoBack: () => goToStep(MenuStep.Campaigns, "back"), className: "h-full", inModal: true, children: _jsx(CampaignDetailsComponent, { campaignName: selectedCampaign }) })] }) }) })] }) });
|
|
31
31
|
};
|
|
32
32
|
const LayerswapMenu = () => {
|
|
33
33
|
return (_jsx(FormWizardProvider, { noToolBar: true, hideMenu: true, initialStep: MenuStep.Menu, children: _jsx(Comp, {}) }));
|
|
@@ -10,7 +10,7 @@ import { SnapPointsProvider, useSnapPoints } from '../../context/snapPointsConte
|
|
|
10
10
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
11
11
|
import { Drawer } from './vaul';
|
|
12
12
|
import AppSettings from '../../lib/AppSettings';
|
|
13
|
-
const Comp = ({ children, show, setShow, header, description, onClose, onAnimationEnd, className }) => {
|
|
13
|
+
const Comp = ({ children, show, setShow, header, description, onClose, onAnimationEnd, className, modalId }) => {
|
|
14
14
|
const { isMobileWithPortal: isMobile, isMobile: isMobileWithoutPortal } = useWindowDimensions();
|
|
15
15
|
let [headerRef, { height }] = useMeasure();
|
|
16
16
|
const { setHeaderHeight } = useSnapPoints();
|
|
@@ -81,18 +81,13 @@ const Comp = ({ children, show, setShow, header, description, onClose, onAnimati
|
|
|
81
81
|
return (_jsx(Drawer.Root, { open: show, onOpenChange: handleOpenChange, container: container, snapPoints: snapPointsHeight, activeSnapPoint: snap, setActiveSnapPoint: setSnap, fadeFromIndex: 0, onDrag: (e) => {
|
|
82
82
|
if (e.movementY < 0 && !expandRef.current?.classList.contains('hidden'))
|
|
83
83
|
expandRef.current?.classList.add('hidden');
|
|
84
|
-
}, modal: isMobile ? true : false, repositionInputs: false, onAnimationEnd: (e) => { onAnimationEnd && onAnimationEnd(e); }, handleOnly: isMobileWithoutPortal, children: _jsxs(Drawer.Portal, { children: [_jsx(Drawer.Close, { asChild: true, children:
|
|
85
|
-
? _jsx(Drawer.Overlay, { className: 'fixed inset-0 z-50 bg-black/50 block' })
|
|
86
|
-
: _jsx(motion.div, { className: 'absolute inset-0 z-50 bg-black/50 block', initial: { opacity: 0.5 }, animate: { opacity: 1 }, exit: { opacity: 0 } }, "backdrop") }), _jsxs(Drawer.Content, { "data-testid": "content", className: clsx('absolute flex flex-col bg-secondary-700 rounded-t-3xl bottom-0 left-0 right-0 h-full z-50 pb-4 text-primary-text ring-0! outline-hidden! ', className, {
|
|
84
|
+
}, modal: isMobile ? true : false, repositionInputs: false, onAnimationEnd: (e) => { onAnimationEnd && onAnimationEnd(e); }, handleOnly: isMobileWithoutPortal, children: _jsxs(Drawer.Portal, { children: [isMobile ? (_jsx(Drawer.Close, { asChild: true, children: _jsx(Drawer.Overlay, { className: 'fixed inset-0 z-50 bg-black/50 block' }) })) : (_jsx(AnimatePresence, { children: show && (_jsx(Drawer.Close, { asChild: true, children: _jsx(motion.div, { className: 'absolute inset-0 z-50 bg-black/50 block pointer-events-auto', initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3 } }) }, `backdrop-${modalId}`)) })), _jsxs(Drawer.Content, { "data-testid": "content", className: clsx('absolute flex flex-col bg-secondary-700 rounded-t-3xl bottom-0 left-0 right-0 h-full z-50 pb-4 text-primary-text ring-0! outline-hidden! ', className, {
|
|
87
85
|
'border-none! rounded-none!': snap === 1,
|
|
88
|
-
'!
|
|
86
|
+
'fixed! sm:absolute!': AppSettings.ThemeData?.enablePortal == true,
|
|
89
87
|
}), children: [_jsxs("div", { ref: headerRef, className: 'w-full relative', children: [isMobileWithoutPortal &&
|
|
90
88
|
_jsx("div", { className: "flex justify-center w-full mt-2 mb-[6px]", children: _jsx(Drawer.Handle, { className: '!w-12 !bg-primary-text-tertiary' }) }), _jsxs("div", { className: 'flex items-center w-full text-left justify-between px-4 sm:pt-2 pb-2', children: [_jsx(Drawer.Title, { className: "text-lg text-secondary-text font-semibold w-full", children: header }), _jsx(Drawer.Close, { asChild: true, children: _jsx("div", { children: _jsx(IconButton, { className: 'inline-flex active:animate-press-down', icon: _jsx(X, { strokeWidth: 2 }) }) }) })] }), description &&
|
|
91
|
-
_jsx(Drawer.Description, { className: "text-sm mt-2 text-secondary-text px-4", children: description })] }), _jsxs("div", { className:
|
|
92
|
-
|
|
93
|
-
'overflow-hidden': snap !== 1,
|
|
94
|
-
}), id: "virtualListContainer", children: [children, _jsx(AnimatePresence, { children: !isLastSnap && snapElement &&
|
|
95
|
-
_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, ref: expandRef, style: { top: `${Number(snapElement.height?.toString().replace('px', '')) - 88}px` }, className: 'w-full fixed left-0 z-50', children: _jsxs("button", { type: 'button', onClick: goToNextSnap, className: "w-full px-4 pt-10 pb-4 justify-center from-secondary-700 bg-gradient-to-t items-center gap-2 inline-flex text-secondary-text", children: [_jsx(ChevronUp, { className: "w-6 h-6 relative" }), _jsx("div", { className: "text-sm font-medium", children: "Expand" })] }) }) }), _jsx(VaulFooter, { snapElement: snapElement })] })] })] }) }));
|
|
89
|
+
_jsx(Drawer.Description, { className: "text-sm mt-2 text-secondary-text px-4", children: description })] }), _jsxs("div", { className: 'flex flex-col w-full h-full max-h-[90dvh] px-4 styled-scroll overflow-x-hidden relative', id: "virtualListContainer", children: [children, _jsx(AnimatePresence, { children: !isLastSnap && snapElement &&
|
|
90
|
+
_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, ref: expandRef, style: { top: `${Number(snapElement.height?.toString().replace('px', '')) - 88}px` }, className: 'w-full fixed left-0 z-50', children: _jsxs("button", { type: 'button', onClick: goToNextSnap, className: "w-full px-4 pt-10 pb-4 justify-center from-secondary-700 bg-gradient-to-t items-center gap-2 inline-flex text-secondary-text", children: [_jsx(ChevronUp, { className: "w-6 h-6 relative" }), _jsx("div", { className: "text-sm font-medium", children: "Expand" })] }) }) }), isMobile && _jsx(VaulFooter, { snapElement: snapElement })] }), !isMobile && _jsx(VaulFooter, { snapElement: snapElement })] })] }) }));
|
|
96
91
|
};
|
|
97
92
|
const VaulFooter = ({ snapElement }) => {
|
|
98
93
|
let [ref, { height }] = useMeasure();
|
|
@@ -100,10 +95,10 @@ const VaulFooter = ({ snapElement }) => {
|
|
|
100
95
|
useEffect(() => {
|
|
101
96
|
setFooterHeight(height || 0);
|
|
102
97
|
}, [height]);
|
|
103
|
-
return
|
|
98
|
+
return _jsx("div", { ref: ref, id: 'walletModalFooter', style: {
|
|
104
99
|
top: snapElement?.height !== 1 ? `${Number(snapElement?.height?.toString().replace('px', '')) - 50}px` : undefined,
|
|
105
100
|
bottom: snapElement?.height === 1 ? '12px' : undefined
|
|
106
|
-
}, className: 'w-full
|
|
101
|
+
}, className: 'w-full left-0 z-50 max-sm:absolute' });
|
|
107
102
|
};
|
|
108
103
|
const VaulDrawerSnap = (props) => {
|
|
109
104
|
const { openFullHeight, ...domProps } = props;
|
|
@@ -141,8 +136,8 @@ const vaulStyles = `
|
|
|
141
136
|
[data-vaul-drawer] {
|
|
142
137
|
touch-action: none;
|
|
143
138
|
will-change: transform;
|
|
144
|
-
transition: transform 0.
|
|
145
|
-
animation-duration: 0.
|
|
139
|
+
transition: transform 0.1s cubic-bezier(0.32, 0.72, 0, 1);
|
|
140
|
+
animation-duration: 0.1s;
|
|
146
141
|
animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
|
|
147
142
|
}
|
|
148
143
|
[data-vaul-drawer][data-vaul-snap-points='false'][data-vaul-drawer-direction='bottom'][data-state='open'] {
|
|
@@ -158,7 +153,7 @@ const vaulStyles = `
|
|
|
158
153
|
transform: translate3d(0, var(--snap-point-height, 0), 0);
|
|
159
154
|
}
|
|
160
155
|
[data-vaul-overlay][data-vaul-snap-points='false'] {
|
|
161
|
-
animation-duration: 0.
|
|
156
|
+
animation-duration: 0.1s;
|
|
162
157
|
animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
|
|
163
158
|
}
|
|
164
159
|
[data-vaul-overlay][data-vaul-snap-points='false'][data-state='open'] {
|
|
@@ -169,7 +164,7 @@ const vaulStyles = `
|
|
|
169
164
|
}
|
|
170
165
|
[data-vaul-overlay][data-vaul-snap-points='true'] {
|
|
171
166
|
opacity: 0;
|
|
172
|
-
transition: opacity 0.
|
|
167
|
+
transition: opacity 0.1s cubic-bezier(0.32, 0.72, 0, 1);
|
|
173
168
|
}
|
|
174
169
|
[data-vaul-overlay][data-vaul-snap-points='true'] {
|
|
175
170
|
opacity: 1;
|
|
@@ -9,13 +9,13 @@ import shortenAddress from "../../../../components/utils/ShortenAddress";
|
|
|
9
9
|
import { truncateDecimals } from "../../../../components/utils/RoundDecimals";
|
|
10
10
|
import AddressIcon from "../../../../components/Common/AddressIcon";
|
|
11
11
|
import { ImageWithFallback } from "../../../../components/Common/ImageWithFallback";
|
|
12
|
-
import { useSelectedAccount } from "../../../../context/
|
|
12
|
+
import { useSelectedAccount } from "../../../../context/swapAccounts";
|
|
13
13
|
import { useWallet } from "../../../../exports";
|
|
14
14
|
import VaulDrawer from "../../../../components/Modal/vaulModal";
|
|
15
15
|
const Component = ({ campaign }) => {
|
|
16
16
|
const [openTopModal, setOpenTopModal] = useState(false);
|
|
17
17
|
const selectedSourceAccount = useSelectedAccount("from", campaign.network?.name);
|
|
18
|
-
const { wallets } = useWallet(campaign.network, '
|
|
18
|
+
const { wallets } = useWallet(campaign.network, 'autofill');
|
|
19
19
|
const wallet = wallets.find(w => w.id === selectedSourceAccount?.id);
|
|
20
20
|
const address = wallet?.address;
|
|
21
21
|
const handleOpenTopModal = () => {
|
|
@@ -12,7 +12,7 @@ import useWallet from "../../../../hooks/useWallet";
|
|
|
12
12
|
import { ImageWithFallback } from "../../../../components/Common/ImageWithFallback";
|
|
13
13
|
const Rewards = ({ campaign }) => {
|
|
14
14
|
const network = campaign?.network;
|
|
15
|
-
const { provider } = useWallet(network, '
|
|
15
|
+
const { provider } = useWallet(network, 'autofill');
|
|
16
16
|
const wallet = provider?.activeWallet;
|
|
17
17
|
const address = wallet?.address;
|
|
18
18
|
const apiClient = new LayerSwapApiClient();
|
|
@@ -42,7 +42,7 @@ const Rewards = ({ campaign }) => {
|
|
|
42
42
|
const ProgressComponent = ({ campaign, rewardsData }) => {
|
|
43
43
|
if (campaign.max_payout_amount) {
|
|
44
44
|
const weeklyEarned = rewardsData?.user_reward.period_pending_amount || 0;
|
|
45
|
-
return _jsx("div", { className: "bg-secondary-700 rounded-lg shadow-lg border border-secondary-700 hover:border-secondary-500 transition duration-200", children: _jsx(BackgroundField, { header: _jsx("p", { children: "Weekly reward earned" }), withoutBorder: true, children: _jsxs("div", { className: "flex flex-col w-full gap-2", children: [_jsx(Progress, { value: weeklyEarned === Infinity ? 0 : weeklyEarned }), _jsxs("div", { className: "flex justify-between w-full font-semibold text-sm ", children: [_jsxs("div", { className: "text-primary", children: [_jsx("span", { className: "text-primary-text", children: weeklyEarned.toFixed(0) }), " ", _jsx("span", { children: "/" }), " ", campaign.max_payout_amount, " ", campaign.token.symbol] }),
|
|
45
|
+
return _jsx("div", { className: "bg-secondary-700 rounded-lg shadow-lg border border-secondary-700 hover:border-secondary-500 transition duration-200", children: _jsx(BackgroundField, { header: _jsx("p", { children: "Weekly reward earned" }), withoutBorder: true, children: _jsxs("div", { className: "flex flex-col w-full gap-2", children: [_jsx(Progress, { value: weeklyEarned === Infinity ? 0 : weeklyEarned }), _jsxs("div", { className: "flex justify-between w-full font-semibold text-sm ", children: [_jsxs("div", { className: "text-primary", children: [_jsx("span", { className: "text-primary-text", children: weeklyEarned.toFixed(0) }), " ", _jsx("span", { children: "/" }), " ", campaign.max_payout_amount, " ", campaign.token.symbol] }), _jsxs("div", { children: [_jsx("span", { children: "Refreshes every " }), " ", _jsx("span", { className: "font-semibold", children: campaign.reward_limit_period }), " ", _jsx("span", { children: " days" })] })] })] }) }) });
|
|
46
46
|
}
|
|
47
47
|
const DistributedAmount = ((campaign.distributed_amount / campaign.total_budget) * 100);
|
|
48
48
|
const totalBudget = campaign.total_budget;
|
|
@@ -14,13 +14,12 @@ import SpinIcon from "../../../../components/Icons/spinIcon";
|
|
|
14
14
|
import useWallet from "../../../../hooks/useWallet";
|
|
15
15
|
import { useConnectModal } from "../../../../components/Wallet/WalletModal";
|
|
16
16
|
import { ImageWithFallback } from "../../../../components/Common/ImageWithFallback";
|
|
17
|
-
import { LayerswapProvider } from "../../../../context/LayerswapProvider";
|
|
18
17
|
export const CampaignDetailsComponent = ({ campaignName }) => {
|
|
19
18
|
const apiClient = new LayerSwapApiClient();
|
|
20
19
|
const { data: campaignsData, isLoading } = useSWR('/campaigns', apiClient.fetcher);
|
|
21
20
|
const campaign = campaignsData?.data?.find(c => c.name === campaignName);
|
|
22
21
|
const network = campaign?.network;
|
|
23
|
-
const { provider } = useWallet(network, '
|
|
22
|
+
const { provider } = useWallet(network, 'autofill');
|
|
24
23
|
const { connect } = useConnectModal();
|
|
25
24
|
const handleConnect = useCallback(async () => {
|
|
26
25
|
await connect(provider);
|
|
@@ -46,5 +45,5 @@ const BriefInformation = ({ campaign }) => _jsx("p", { className: "text-secondar
|
|
|
46
45
|
const Loading = () => _jsx(Widget, { children: _jsx(Widget.Content, { children: _jsx("div", { className: "absolute top-[calc(50%-5px)] left-[calc(50%-5px)]", children: _jsx(SpinIcon, { className: "animate-spin h-5 w-5" }) }) }) });
|
|
47
46
|
const NotFound = () => _jsx(Widget, { children: _jsx(Widget.Content, { children: _jsxs("div", { className: "h-[364px] flex flex-col items-center justify-center space-y-4", children: [_jsx(Gift, { className: "h-20 w-20 text-primary" }), _jsx("p", { className: "font-bold text-center", children: "Campaign not found" }), _jsx(LinkWrapper, { className: "text-xs underline hover:no-underline", href: '/campaigns', children: "See all campaigns" })] }) }) });
|
|
48
47
|
export const CampaignDetails = (props) => {
|
|
49
|
-
return (_jsx(
|
|
48
|
+
return (_jsx(Widget, { goBack: props.goBack, children: _jsx(CampaignDetailsComponent, { campaignName: props.campaignName }) }));
|
|
50
49
|
};
|