@layerswap/widget 1.1.0 → 1.1.2
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/components/ErrorFallback.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 -2
- 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/ContractAddressNote.js +17 -0
- package/dist/esm/components/Input/Address/UrlAddressNote.js +10 -0
- package/dist/esm/components/Input/Amount/ExchangeReceiveAmount.js +1 -1
- package/dist/esm/components/Input/Amount/PriceImpact.js +3 -5
- package/dist/esm/components/Input/Amount/ReceiveAmount.js +1 -1
- package/dist/esm/components/Input/RoutePicker/Content.js +17 -1
- package/dist/esm/components/Input/RoutePicker/RouteTokenSwitch.js +4 -4
- package/dist/esm/components/Input/RoutePicker/Routes.js +12 -11
- package/dist/esm/components/Input/RoutePicker/TokenTitleDetails.js +10 -0
- package/dist/esm/components/Input/RoutePicker/index.js +1 -1
- package/dist/esm/components/Input/Search.js +2 -1
- 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 +7 -3
- package/dist/esm/components/Pages/Campaigns/Details/index.js +1 -1
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/Rate.js +3 -2
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/Refuel.js +6 -1
- package/dist/esm/components/Pages/Swap/Form/FeeDetails/index.js +2 -2
- package/dist/esm/components/Pages/Swap/Form/FormWrapper.js +29 -2
- package/dist/esm/components/Pages/Swap/Form/NetworkForm.js +4 -3
- package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/FormButton.js +1 -1
- package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/validationError/ContractAddressValidationCache.js +19 -0
- package/dist/esm/components/Pages/Swap/Withdraw/Processing/Processing.js +9 -5
- package/dist/esm/components/Pages/Swap/Withdraw/Summary/Summary.js +2 -3
- package/dist/esm/components/Pages/Swap/Withdraw/Wallet/Common/buttons.js +13 -6
- package/dist/esm/components/Pages/Swap/Withdraw/WalletTransferButton.js +1 -1
- package/dist/esm/components/Pages/Swap/Withdraw/messages/Message.js +4 -4
- package/dist/esm/components/Pages/SwapHistory/History.js +1 -1
- package/dist/esm/components/Pages/SwapHistory/HistorySummary.js +1 -1
- 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/WalletModal/ConnectorsList.js +74 -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 +1 -1
- package/dist/esm/components/Wallet/WalletProviders/index.js +1 -1
- package/dist/esm/components/Widget/Footer.js +20 -20
- package/dist/esm/components/Widget/Index.js +1 -1
- package/dist/esm/components/WidgetLoading.js +1 -1
- package/dist/esm/components/shadcn/checkbox.js +1 -1
- package/dist/esm/components/themeWrapper.js +1 -1
- package/dist/esm/context/callbackProvider.js +6 -0
- package/dist/esm/context/resolverContext.js +5 -1
- package/dist/esm/hooks/useAllWithdrawalBalances.js +5 -0
- package/dist/esm/hooks/useConnectors.js +72 -0
- package/dist/esm/lib/address/contractAddressResolver.js +12 -0
- package/dist/esm/lib/apiClients/layerSwapApiClient.js +8 -1
- package/dist/esm/lib/balances/balanceResolver.js +52 -2
- package/dist/esm/lib/balances/errorUtils.js +13 -0
- package/dist/esm/lib/balances/nodeErrorClassifier.js +22 -0
- package/dist/esm/lib/fees.js +2 -2
- 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 +10 -1
- package/dist/esm/stores/balanceStore.js +39 -17
- package/dist/esm/stores/contractAddressStore.js +178 -0
- package/dist/esm/types/balance.js +15 -2
- package/dist/esm/types/contract.js +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/index.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Models/Balance.d.ts +13 -1
- package/dist/types/Models/Balance.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 -2
- package/dist/types/components/Icons/Wallets/index.d.ts.map +1 -1
- package/dist/types/components/Input/Address/AddressNote.d.ts +3 -3
- package/dist/types/components/Input/Address/AddressNote.d.ts.map +1 -1
- package/dist/types/components/Input/Address/AddressPicker/AddressWithIcon.d.ts +1 -0
- package/dist/types/components/Input/Address/AddressPicker/AddressWithIcon.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/Amount/PriceImpact.d.ts +2 -1
- package/dist/types/components/Input/Amount/PriceImpact.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Content.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/RouterPickerWalletConnect.d.ts.map +1 -1
- package/dist/types/components/Input/RoutePicker/Routes.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/Search.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/Swap/Form/FeeDetails/Rate.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/Refuel.d.ts +0 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/Refuel.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Form/FeeDetails/index.d.ts.map +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.map +1 -1
- package/dist/types/components/Pages/Swap/Form/SecondaryComponents/FormButton.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/Withdraw/Processing/Processing.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Summary/Summary.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/buttons.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/WalletTransferButton.d.ts.map +1 -1
- package/dist/types/components/Pages/Swap/Withdraw/messages/Message.d.ts.map +1 -1
- package/dist/types/components/Pages/SwapHistory/HistorySummary.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/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 +1 -0
- package/dist/types/components/Wallet/WalletModal/index.d.ts.map +1 -1
- package/dist/types/components/Widget/Footer.d.ts.map +1 -1
- package/dist/types/context/callbackProvider.d.ts +1 -0
- package/dist/types/context/callbackProvider.d.ts.map +1 -1
- package/dist/types/context/resolverContext.d.ts.map +1 -1
- package/dist/types/context/swapAccounts.d.ts.map +1 -1
- package/dist/types/context/walletProviders.d.ts.map +1 -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/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.map +1 -1
- 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/nodeErrorClassifier.d.ts +4 -0
- package/dist/types/lib/balances/nodeErrorClassifier.d.ts.map +1 -0
- package/dist/types/lib/fees.d.ts +2 -2
- package/dist/types/lib/fees.d.ts.map +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/resolvers/resolverService.d.ts +5 -2
- package/dist/types/lib/resolvers/resolverService.d.ts.map +1 -1
- 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/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/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/logEvents.d.ts +19 -1
- package/dist/types/types/logEvents.d.ts.map +1 -1
- package/dist/types/types/wallet.d.ts +6 -3
- package/dist/types/types/wallet.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/esm/components/Icons/Wallets/Keplr.js +0 -3
- package/dist/esm/components/Icons/Wallets/Xverse.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/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/Icons/Wallets/Xverse.d.ts +0 -4
- package/dist/types/components/Icons/Wallets/Xverse.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/lib/sorting.d.ts +0 -22
- package/dist/types/lib/sorting.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { BookOpen, Gift, Map, ScrollText, LibraryIcon, Shield, Users, MessageSquarePlus } from "lucide-react";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useIntercom } from "react-use-intercom";
|
|
@@ -7,64 +7,56 @@ import DiscordLogo from "../Icons/DiscordLogo";
|
|
|
7
7
|
import GitHubLogo from "../Icons/GitHubLogo";
|
|
8
8
|
import SubstackLogo from "../Icons/SubstackLogo";
|
|
9
9
|
import TwitterLogo from "../Icons/TwitterLogo";
|
|
10
|
-
import Popover from "../Modal/popover";
|
|
11
10
|
import SendFeedback from "./Feedback";
|
|
12
11
|
import YoutubeLogo from "../Icons/YoutubeLogo";
|
|
13
12
|
import Menu from "./Menu";
|
|
14
13
|
import { MenuStep } from "../../Models/Wizard";
|
|
15
14
|
import { WalletsMenu } from "../Wallet/WalletComponents/ConnectedWallets";
|
|
15
|
+
import VaulDrawer from "../Modal/vaulModal";
|
|
16
16
|
const MenuList = ({ goToStep }) => {
|
|
17
17
|
const { boot, show, update } = useIntercom();
|
|
18
18
|
const [openFeedbackModal, setOpenFeedbackModal] = useState(false);
|
|
19
19
|
const handleCloseFeedback = () => {
|
|
20
20
|
setOpenFeedbackModal(false);
|
|
21
21
|
};
|
|
22
|
-
return _jsx("div", { className: "text-sm font-medium focus:outline-hidden h-full", children: _jsxs(Menu, { children: [_jsx(WalletsMenu, {}),
|
|
23
|
-
_jsx(Menu.Item, { onClick: () => goToStep(MenuStep.Transactions, "/transactions"), icon: _jsx(ScrollText, { className: "h-5 w-5" }), children: "Transactions" }), window.location.pathname != '/campaigns' &&
|
|
24
|
-
_jsx(Menu.Item, { onClick: () => goToStep(MenuStep.Campaigns, '/campaigns'), icon: _jsx(Gift, { className: "h-5 w-5" }), children: "Campaigns" })] }) }), _jsxs(Menu.Group, { children: [_jsx(Menu.Item, { onClick: () => {
|
|
22
|
+
return _jsx("div", { className: "text-sm font-medium focus:outline-hidden h-full", children: _jsxs(Menu, { children: [_jsx(WalletsMenu, {}), _jsxs(Menu.Group, { children: [_jsx(Menu.Item, { onClick: () => goToStep(MenuStep.Transactions, "/transactions"), icon: _jsx(ScrollText, { className: "h-5 w-5" }), children: "Transactions" }), _jsx(Menu.Item, { onClick: () => goToStep(MenuStep.Campaigns, '/campaigns'), icon: _jsx(Gift, { className: "h-5 w-5" }), children: "Campaigns" })] }), _jsxs(Menu.Group, { children: [_jsx(Menu.Item, { onClick: () => {
|
|
25
23
|
boot();
|
|
26
24
|
show();
|
|
27
25
|
update();
|
|
28
|
-
}, target: "_blank", icon: _jsx(ChatIcon, { strokeWidth: 2, className: "h-5 w-5" }), children: "Help" }), _jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/', target: "_blank", icon: _jsx(BookOpen, { className: "h-5 w-5" }), children: "Docs for Users" }), _jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/user-docs/partners-and-integrations/', target: "_blank", icon: _jsx(Users, { className: "h-5 w-5" }), children: "Docs for Partners" })] }), _jsxs(Menu.Group, { children: [_jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/user-docs/more-information/privacy-policy/', target: "_blank", icon: _jsx(Shield, { className: "h-5 w-5" }), children: "Privacy Policy" }), _jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/user-docs/more-information/terms-of-services/', target: "_blank", icon: _jsx(LibraryIcon, { className: "h-5 w-5" }), children: "Terms of Service" })] }),
|
|
26
|
+
}, target: "_blank", icon: _jsx(ChatIcon, { strokeWidth: 2, className: "h-5 w-5" }), children: "Help" }), _jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/', target: "_blank", icon: _jsx(BookOpen, { className: "h-5 w-5" }), children: "Docs for Users" }), _jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/user-docs/partners-and-integrations/', target: "_blank", icon: _jsx(Users, { className: "h-5 w-5" }), children: "Docs for Partners" })] }), _jsxs(Menu.Group, { children: [_jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/user-docs/more-information/privacy-policy/', target: "_blank", icon: _jsx(Shield, { className: "h-5 w-5" }), children: "Privacy Policy" }), _jsx(Menu.Item, { pathname: 'https://learn.layerswap.io/user-docs/more-information/terms-of-services/', target: "_blank", icon: _jsx(LibraryIcon, { className: "h-5 w-5" }), children: "Terms of Service" })] }), _jsxs(Menu.Group, { children: [_jsx(Menu.Item, { onClick: () => setOpenFeedbackModal(true), target: "_blank", icon: _jsx(MessageSquarePlus, { className: "h-5 w-5" }), children: "Suggest a Feature" }), _jsx(VaulDrawer, { show: openFeedbackModal, header: "Suggest a Feature", setShow: setOpenFeedbackModal, modalId: "suggestFeature", children: _jsx(VaulDrawer.Snap, { id: "item-1", children: _jsx("div", { className: "p-0 md:max-w-md", children: _jsx(SendFeedback, { onSend: handleCloseFeedback }) }) }) })] }), _jsxs("div", { className: "space-y-3 w-full", children: [_jsx("hr", { className: "border-secondary-500" }), _jsx("p", { className: "text-primary-text-tertiary flex justify-center my-3", children: "Media links & suggestions:" })] }), _jsx("div", { className: "grid grid-cols-2 gap-2 justify-center", children: navigation.social.map((item, index) => (_jsx("a", { target: "_blank", href: item.href, className: "flex relative bg-secondary-500 hover:bg-secondary-400 rounded-xl cursor-pointer select-none items-center outline-hidden text-primary-text", rel: "noopener noreferrer", children: _jsxs("div", { className: "p-2 w-full flex justify-center gap-1", children: [_jsx(item.icon, { className: "h-5 w-5", "aria-hidden": "true" }), _jsx("p", { children: item.name })] }) }, index))) })] }) });
|
|
29
27
|
};
|
|
30
28
|
const navigation = {
|
|
31
29
|
social: [
|
|
32
30
|
{
|
|
33
31
|
name: 'Twitter',
|
|
34
32
|
href: 'https://twitter.com/layerswap/',
|
|
35
|
-
icon: (props) => TwitterLogo(props)
|
|
36
|
-
className: 'plausible-event-name=Twitter'
|
|
33
|
+
icon: (props) => TwitterLogo(props)
|
|
37
34
|
},
|
|
38
35
|
{
|
|
39
36
|
name: 'GitHub',
|
|
40
37
|
href: 'https://github.com/layerswap/layerswapapp/',
|
|
41
|
-
icon: (props) => GitHubLogo(props)
|
|
42
|
-
className: 'plausible-event-name=GitHub'
|
|
38
|
+
icon: (props) => GitHubLogo(props)
|
|
43
39
|
},
|
|
44
40
|
{
|
|
45
41
|
name: 'Discord',
|
|
46
42
|
href: 'https://discord.com/invite/KhwYN35sHy/',
|
|
47
|
-
icon: (props) => DiscordLogo(props)
|
|
48
|
-
className: 'plausible-event-name=Discord'
|
|
43
|
+
icon: (props) => DiscordLogo(props)
|
|
49
44
|
},
|
|
50
45
|
{
|
|
51
46
|
name: 'YouTube',
|
|
52
47
|
href: 'https://www.youtube.com/@layerswaphq/',
|
|
53
|
-
icon: (props) => YoutubeLogo(props)
|
|
54
|
-
className: 'plausible-event-name=Youtube'
|
|
48
|
+
icon: (props) => YoutubeLogo(props)
|
|
55
49
|
},
|
|
56
50
|
{
|
|
57
51
|
name: 'Substack',
|
|
58
52
|
href: 'https://layerswap.substack.com/',
|
|
59
|
-
icon: (props) => SubstackLogo(props)
|
|
60
|
-
className: 'plausible-event-name=Substack'
|
|
53
|
+
icon: (props) => SubstackLogo(props)
|
|
61
54
|
},
|
|
62
55
|
{
|
|
63
56
|
name: 'Roadmap',
|
|
64
57
|
href: 'https://layerswap.ducalis.io/roadmap/summary/',
|
|
65
|
-
icon: (props) => _jsx(Map, { ...props })
|
|
66
|
-
|
|
67
|
-
},
|
|
58
|
+
icon: (props) => _jsx(Map, { ...props })
|
|
59
|
+
}
|
|
68
60
|
]
|
|
69
61
|
};
|
|
70
62
|
export default MenuList;
|
|
@@ -10,24 +10,33 @@ import WizardItem from "../Wizard/WizardItem";
|
|
|
10
10
|
import HistoryList from "../Pages/SwapHistory/History";
|
|
11
11
|
import { CampaignsComponent } from "../Pages/Campaigns";
|
|
12
12
|
import { CampaignDetailsComponent } from "../Pages/Campaigns/Details";
|
|
13
|
-
import
|
|
13
|
+
import { Modal, ModalContent } from "../Modal/modalWithoutAnimation";
|
|
14
|
+
import { useCallbacks } from "../../context/callbackProvider";
|
|
14
15
|
const Comp = () => {
|
|
15
16
|
const { goBack, currentStepName } = useFormWizardState();
|
|
16
17
|
const { goToStep } = useFormWizardaUpdate();
|
|
17
|
-
const
|
|
18
|
+
const { onMenuNavigationChange } = useCallbacks();
|
|
19
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
18
20
|
const [selectedCampaign, setSelectedCampaign] = useState(undefined);
|
|
19
21
|
const handleModalOpenStateChange = (value) => {
|
|
20
|
-
|
|
22
|
+
setIsOpen(value);
|
|
21
23
|
if (value === false) {
|
|
22
24
|
goToStep(MenuStep.Menu);
|
|
25
|
+
onMenuNavigationChange("/");
|
|
23
26
|
}
|
|
24
27
|
};
|
|
25
|
-
const goBackToMenuStep = () => {
|
|
26
|
-
|
|
28
|
+
const goBackToMenuStep = () => {
|
|
29
|
+
goToStep(MenuStep.Menu, "back");
|
|
30
|
+
onMenuNavigationChange("/");
|
|
31
|
+
};
|
|
32
|
+
const handleGoToStep = (step, path) => {
|
|
27
33
|
goToStep(step);
|
|
34
|
+
if (path) {
|
|
35
|
+
onMenuNavigationChange(path);
|
|
36
|
+
}
|
|
28
37
|
};
|
|
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: () =>
|
|
30
|
-
|
|
38
|
+
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: () => setIsOpen(true), icon: _jsx(MenuIcon, { strokeWidth: "2" }) }) }), _jsx(Modal, { isOpen: isOpen, setIsOpen: handleModalOpenStateChange, children: _jsx(ModalContent, { className: "pb-4", header: _jsxs("div", { className: "inline-flex items-center w-full", children: [goBack &&
|
|
39
|
+
_jsx("div", { className: "-ml-2", children: _jsx(IconButton, { className: "inline-flex", onClick: goBack, icon: _jsx(ChevronLeft, { strokeWidth: "2" }) }) }), _jsx("h2", { className: "flex-1", children: currentStepName })] }), children: ({ closeModal }) => (_jsx("div", { className: "openpicker h-full", id: "virtualListContainer", 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: closeModal }) }), _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"); onMenuNavigationChange("/campaigns"); }, className: "h-full", inModal: true, children: _jsx(CampaignDetailsComponent, { campaignName: selectedCampaign }) })] }) })) }) })] }) });
|
|
31
40
|
};
|
|
32
41
|
const LayerswapMenu = () => {
|
|
33
42
|
return (_jsx(FormWizardProvider, { noToolBar: true, hideMenu: true, initialStep: MenuStep.Menu, children: _jsx(Comp, {}) }));
|
|
@@ -5,11 +5,12 @@ import useWindowDimensions from "../../hooks/useWindowDimensions";
|
|
|
5
5
|
import IconButton from "../../components/Buttons/iconButton";
|
|
6
6
|
import { X } from 'lucide-react';
|
|
7
7
|
import clsx from "clsx";
|
|
8
|
+
import AppSettings from "../../lib/AppSettings";
|
|
8
9
|
const ModalContext = createContext({ isOpen: false, setIsOpen: () => { }, shouldFocus: false, setShouldFocus: () => { } });
|
|
9
|
-
export const Modal = ({ children }) => {
|
|
10
|
+
export const Modal = ({ children, isOpen: _isOpen, setIsOpen: _setIsOpen }) => {
|
|
10
11
|
const [isOpen, setIsOpen] = useState(false);
|
|
11
12
|
const [shouldFocus, setShouldFocus] = useState(false);
|
|
12
|
-
return (_jsx(ModalContext.Provider, { value: { isOpen, setIsOpen, shouldFocus, setShouldFocus }, children: children }));
|
|
13
|
+
return (_jsx(ModalContext.Provider, { value: { isOpen: _isOpen || isOpen, setIsOpen: _setIsOpen || setIsOpen, shouldFocus, setShouldFocus }, children: children }));
|
|
13
14
|
};
|
|
14
15
|
export const useModalState = () => {
|
|
15
16
|
const context = useContext(ModalContext);
|
|
@@ -35,7 +36,10 @@ export const ModalContent = (props) => {
|
|
|
35
36
|
}, [isOpen]);
|
|
36
37
|
if (!isOpen)
|
|
37
38
|
return null;
|
|
38
|
-
const modalElement = (_jsxs("div", { className: clsx("
|
|
39
|
+
const modalElement = (_jsxs("div", { className: clsx("inset-0 z-50 bg-secondary-700 rounded-t-3xl sm:rounded-3xl flex flex-col overscroll-none", className, {
|
|
40
|
+
'fixed sm:absolute': AppSettings.ThemeData?.enablePortal == true,
|
|
41
|
+
'absolute': AppSettings.ThemeData?.enablePortal == false
|
|
42
|
+
}), children: [(header || showCloseButton) && (_jsx("div", { className: "w-full relative", children: _jsxs("div", { className: "flex items-center w-full text-left justify-between px-4 pt-2 pb-2 gap-x-2 sm:gap-x-1", children: [_jsx("div", { className: "flex-1 text-lg text-secondary-text font-semibold w-full flex justify-end", children: header }), showCloseButton && (_jsx(IconButton, { onClick: closeModal, className: "active:animate-press-down", icon: _jsx(X, { strokeWidth: 2 }) }))] }) })), _jsx("div", { className: "flex flex-col w-full h-full max-h-[90dvh] px-4 styled-scroll overflow-x-hidden overflow-y-auto relative pb-3", children: typeof children === 'function' ? children({ closeModal, shouldFocus }) : children })] }));
|
|
39
43
|
const widgetElement = document.getElementById('widget');
|
|
40
44
|
if (!widgetElement) {
|
|
41
45
|
console.warn('Widget element not found, modal will not render');
|
|
@@ -32,7 +32,7 @@ export const CampaignDetailsComponent = ({ campaignName }) => {
|
|
|
32
32
|
if (!campaign) {
|
|
33
33
|
return _jsx(NotFound, {});
|
|
34
34
|
}
|
|
35
|
-
return (_jsxs(
|
|
35
|
+
return (_jsxs("div", { className: "h-full flex flex-col justify-between gap-3", children: [_jsx(Widget.Content, { fitContent: true, children: _jsxs("div", { className: "space-y-5", children: [_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("div", { className: "h-7 w-7 relative", children: (campaign.logo_url || network?.logo) && _jsx(ImageWithFallback, { src: (campaign.logo_url || network?.logo), alt: "Project Logo", height: "40", width: "40", loading: "eager", className: "rounded-md object-contain" }) }), _jsx("p", { className: "font-bold text-xl text-left flex items-center text-primary-text", children: campaign.display_name })] }), isConnected ?
|
|
36
36
|
_jsx(Rewards, { campaign: campaign })
|
|
37
37
|
:
|
|
38
38
|
_jsx(BriefInformation, { campaign: campaign }), _jsx(Leaderboard, { campaign: campaign })] }) }), _jsx(_Fragment, { children: !isConnected &&
|
|
@@ -8,8 +8,9 @@ export const RateElement = ({ fromAsset, toAsset, requestAmount, receiveAmount,
|
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
const totalFee = totalFeeInUsd ? totalFeeInUsd / toAsset.price_in_usd : 0;
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const totalAmount = receiveAmount + totalFee;
|
|
12
|
+
const fromRate = totalAmount / requestAmount;
|
|
13
|
+
const toRate = requestAmount / totalAmount;
|
|
13
14
|
const fromRateTruncated = truncateDecimals(fromRate, fromAsset?.precision || 6);
|
|
14
15
|
const toRateTruncated = truncateDecimals(toRate, toAsset?.precision || 6);
|
|
15
16
|
return (_jsx("div", { className: "flex text-sm ml-1 font-small items-center cursor-pointer", onClick: () => setFlipped(!flipped), children: !flipped ? (_jsxs(_Fragment, { children: [_jsxs("p", { children: [_jsx("span", { children: "1" }), " ", _jsx("span", { children: fromAsset?.symbol })] }), _jsx(ArrowRight, { className: "w-3 h-3 mx-1" }), _jsxs("span", { children: [fromRateTruncated, " ", toAsset?.symbol] })] })) : (_jsxs(_Fragment, { children: [_jsxs("p", { children: [_jsx("span", { children: "1" }), " ", _jsx("span", { children: toAsset?.symbol })] }), _jsx(ArrowRight, { className: "w-3 h-3 mx-1" }), _jsxs("span", { children: [toRateTruncated, " ", fromAsset?.symbol] })] })) }));
|
|
@@ -8,7 +8,7 @@ import { isValidAddress } from "../../../../../lib/address/validator";
|
|
|
8
8
|
import ToggleButton from "../../../../../components/Buttons/toggleButton";
|
|
9
9
|
import { useValidationContext } from "../../../../../context/validationContext";
|
|
10
10
|
import { FORM_VALIDATION_ERROR_CODES } from "../../../../../hooks/useFormValidation";
|
|
11
|
-
const RefuelToggle = ({ onButtonClick, quote
|
|
11
|
+
const RefuelToggle = ({ onButtonClick, quote }) => {
|
|
12
12
|
const { values, setFieldValue } = useFormikContext();
|
|
13
13
|
const { toAsset: toCurrency, to, destination_address, refuel, amount } = values;
|
|
14
14
|
const { balances } = useBalance(destination_address, to);
|
|
@@ -22,6 +22,11 @@ const RefuelToggle = ({ onButtonClick, quote, minAllowedAmount }) => {
|
|
|
22
22
|
}
|
|
23
23
|
previouslySelectedDestination.current = to;
|
|
24
24
|
}, [to, destination_address, toCurrency]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!needRefuel && refuel) {
|
|
27
|
+
setFieldValue('refuel', false);
|
|
28
|
+
}
|
|
29
|
+
}, [needRefuel, refuel, setFieldValue]);
|
|
25
30
|
const handleConfirmToggleChange = (value) => {
|
|
26
31
|
setFieldValue('refuel', value);
|
|
27
32
|
};
|
|
@@ -44,8 +44,8 @@ export const DetailsButton = ({ quote, reward, isQuoteLoading, swapValues: value
|
|
|
44
44
|
const { balance: nftBalance, isLoading, error } = useSWRNftBalance(destinationAddress || '', destination, reward?.nft_contract_address || '');
|
|
45
45
|
return (_jsxs("div", { className: 'flex items-center gap-1 space-x-3', children: [gasFeeInUsd ?
|
|
46
46
|
_jsxs(_Fragment, { children: [_jsxs("div", { className: clsx("inline-flex items-center gap-1", { "animate-pulse-strong": isQuoteLoading }), children: [_jsx("div", { className: 'p-0.5', children: !values.fromExchange ?
|
|
47
|
-
_jsx(GasIcon, { className: 'h-4 w-4 text-secondary-text' }) : _jsx(ExchangeGasIcon, { className: 'h-5 w-5 text-secondary-text' }) }), _jsx(NumberFlow, { className: "text-primary-text text-sm leading-6", value: gasFeeInUsd < 0.01 ? '0.01' : gasFeeInUsd,
|
|
47
|
+
_jsx(GasIcon, { className: 'h-4 w-4 text-secondary-text' }) : _jsx(ExchangeGasIcon, { className: 'h-5 w-5 text-secondary-text' }) }), _jsx(NumberFlow, { className: "text-primary-text text-sm leading-6", value: gasFeeInUsd < 0.01 ? '0.01' : gasFeeInUsd, prefix: gasFeeInUsd < 0.01 ? '<$' : '$' })] }), _jsx("div", { className: "w-px h-3 bg-primary-text-tertiary rounded-2xl" })] }) : null, averageCompletionTime ?
|
|
48
48
|
_jsx(_Fragment, { children: _jsxs("div", { className: clsx("text-right inline-flex items-center gap-1 text-sm", { "animate-pulse-strong": isQuoteLoading }), children: [_jsx("div", { className: 'p-0.5', children: _jsx(Clock, { className: 'h-4 w-4 text-secondary-text' }) }), _jsx(AverageCompletionTime, { className: "text-primary-text", avgCompletionTime: quote.avg_completion_time })] }) }) : null, (reward &&
|
|
49
49
|
(!shouldCheckNFT || (!isLoading && !error && nftBalance !== undefined && nftBalance > 0))) ?
|
|
50
|
-
_jsxs(_Fragment, { children: [_jsx("div", { className: "w-px h-3 bg-primary-text-tertiary rounded-2xl" }), _jsxs("div", { className: 'text-right text-primary-text inline-flex items-center gap-1', children: [_jsx(CupIcon, { alt: "Reward", width: 16, height: 16 }), _jsx(NumberFlow, { value: reward?.amount_in_usd < 0.01 ? '0.01' : reward?.amount_in_usd,
|
|
50
|
+
_jsxs(_Fragment, { children: [_jsx("div", { className: "w-px h-3 bg-primary-text-tertiary rounded-2xl" }), _jsxs("div", { className: 'text-right text-primary-text inline-flex items-center gap-1', children: [_jsx(CupIcon, { alt: "Reward", width: 16, height: 16 }), _jsx(NumberFlow, { value: reward?.amount_in_usd < 0.01 ? '0.01' : reward?.amount_in_usd, prefix: reward?.amount_in_usd < 0.01 ? '<$' : '$' })] })] }) : null] }));
|
|
51
51
|
};
|
|
@@ -12,15 +12,18 @@ import useWallet from "../../../../hooks/useWallet";
|
|
|
12
12
|
import { useAsyncModal } from "../../../../context/asyncModal";
|
|
13
13
|
import VaulDrawer from "../../../../components/Modal/vaulModal";
|
|
14
14
|
import { addressFormat } from "../../../../lib/address/formatter";
|
|
15
|
-
import AddressNote from "../../../../components/Input/Address/AddressNote";
|
|
16
15
|
import { useBalance } from "../../../../lib/balances/useBalance";
|
|
17
16
|
import { useSelectedAccount } from "../../../../context/swapAccounts";
|
|
18
17
|
import SwapDetails from "../Withdraw/SwapDetails";
|
|
19
18
|
import { useCallbacks } from "../../../../context/callbackProvider";
|
|
19
|
+
import ContractAddressNote from "../../../../components/Input/Address/ContractAddressNote";
|
|
20
|
+
import { useContractAddressStore } from "../../../../stores/contractAddressStore";
|
|
21
|
+
import UrlAddressNote from "../../../../components/Input/Address/UrlAddressNote";
|
|
20
22
|
export default function FormWrapper({ children, type, partner }) {
|
|
21
23
|
const formikRef = useRef(null);
|
|
22
24
|
const [showConnectNetworkModal, setShowConnectNetworkModal] = useState(false);
|
|
23
25
|
const [isAddressFromQueryConfirmed, setIsAddressFromQueryConfirmed] = useState(false);
|
|
26
|
+
const dontShowContractWarningRef = useRef(false);
|
|
24
27
|
const [networkToConnect, setNetworkToConnect] = useState();
|
|
25
28
|
const settings = useSettingsState();
|
|
26
29
|
const { swapBasicData, swapDetails, swapModalOpen } = useSwapDataState();
|
|
@@ -35,6 +38,7 @@ export default function FormWrapper({ children, type, partner }) {
|
|
|
35
38
|
const { destination_address: destinationAddressFromQuery } = initialSettings;
|
|
36
39
|
const { createSwap, setSwapId, setSubmitedFormValues, setSwapModalOpen } = useSwapDataUpdate();
|
|
37
40
|
const { setSwapError } = useSwapDataState();
|
|
41
|
+
const { setConfirmed, isConfirmed, checkContractStatus } = useContractAddressStore();
|
|
38
42
|
const handleSubmit = useCallback(async (values) => {
|
|
39
43
|
setSwapError && setSwapError('');
|
|
40
44
|
const { destination_address, to } = values;
|
|
@@ -50,7 +54,7 @@ export default function FormWrapper({ children, type, partner }) {
|
|
|
50
54
|
const provider = to && getProvider(to, 'autofill');
|
|
51
55
|
const isDestAddressConnected = destination_address && provider?.connectedWallets?.some((wallet) => addressFormat(wallet.address, to) === addressFormat(destination_address, to));
|
|
52
56
|
const confirmed = !isDestAddressConnected ? await getConfirmation({
|
|
53
|
-
content: _jsx(
|
|
57
|
+
content: _jsx(UrlAddressNote, { partner: partner, values: values }),
|
|
54
58
|
submitText: 'Confirm address',
|
|
55
59
|
dismissText: 'Cancel address'
|
|
56
60
|
}) : true;
|
|
@@ -61,6 +65,29 @@ export default function FormWrapper({ children, type, partner }) {
|
|
|
61
65
|
return;
|
|
62
66
|
}
|
|
63
67
|
}
|
|
68
|
+
if (destination_address && values.from && values.to && values.to.type === 'evm') {
|
|
69
|
+
const alreadyConfirmed = isConfirmed(destination_address, values.to.name);
|
|
70
|
+
if (!alreadyConfirmed) {
|
|
71
|
+
const { isContractInAnyNetwork, destinationIsContract } = await checkContractStatus(destination_address, values.from, values.to);
|
|
72
|
+
if (isContractInAnyNetwork && !destinationIsContract) {
|
|
73
|
+
dontShowContractWarningRef.current = false;
|
|
74
|
+
const handleDontShowAgainChange = (checked) => {
|
|
75
|
+
dontShowContractWarningRef.current = checked;
|
|
76
|
+
};
|
|
77
|
+
const confirmed = await getConfirmation({
|
|
78
|
+
content: _jsx(ContractAddressNote, { values: values, onDontShowAgainChange: handleDontShowAgainChange }),
|
|
79
|
+
submitText: 'Confirm',
|
|
80
|
+
dismissText: 'Cancel'
|
|
81
|
+
});
|
|
82
|
+
if (confirmed && dontShowContractWarningRef.current) {
|
|
83
|
+
setConfirmed(destination_address, values.to.name);
|
|
84
|
+
}
|
|
85
|
+
else if (!confirmed) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
64
91
|
try {
|
|
65
92
|
await handleCreateSwap({
|
|
66
93
|
setSwapId,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { Form, useFormikContext } from "formik";
|
|
4
|
-
import ValidationError from "
|
|
4
|
+
import ValidationError from "./SecondaryComponents/validationError";
|
|
5
|
+
import ContractAddressValidationCache from "./SecondaryComponents/validationError/ContractAddressValidationCache";
|
|
5
6
|
import useWallet from "../../../../hooks/useWallet";
|
|
6
7
|
import SourcePicker from "../../../../components/Input/SourcePicker";
|
|
7
8
|
import DestinationPicker from "../../../../components/Input/DestinationPicker";
|
|
@@ -57,9 +58,9 @@ const NetworkForm = ({ partner }) => {
|
|
|
57
58
|
return (_jsxs(_Fragment, { children: [_jsx(DepositMethodComponent, {}), _jsxs(Form, { className: "h-full grow flex flex-col flex-1 justify-between w-full gap-3", children: [_jsx(Widget.Content, { children: _jsxs("div", { className: "w-full flex flex-col justify-between flex-1", children: [_jsxs("div", { className: 'flex-col relative flex justify-between gap-2 w-full leading-4', children: [!(initialSettings?.hideFrom && values?.from) && _jsx(SourcePicker, { minAllowedAmount: minAllowedAmount, maxAllowedAmount: maxAllowedAmount, fee: quote }), !initialSettings?.hideFrom && !initialSettings?.hideTo &&
|
|
58
59
|
_jsx(ValueSwapperButton, { values: values, setValues: setValues, providers: providers, query: initialSettings }), !(initialSettings?.hideTo && values?.to) && _jsx(DestinationPicker, { isFeeLoading: isQuoteLoading, fee: quote, partner: partner })] }), _jsxs("div", { children: [Number(values.amount) > 0 &&
|
|
59
60
|
_jsx(ReserveGasNote, { maxAllowedAmount: maxAllowedAmount, minAllowedAmount: minAllowedAmount, onSubmit: handleReserveGas }), values.toAsset?.refuel && !initialSettings.hideRefuel &&
|
|
60
|
-
_jsx(RefuelToggle, { quote: quote, onButtonClick: () => setOpenRefuelModal(true)
|
|
61
|
+
_jsx(RefuelToggle, { quote: quote, onButtonClick: () => setOpenRefuelModal(true) }), routeValidation.message
|
|
61
62
|
? _jsx("div", { className: "mt-3", children: _jsx(ValidationError, {}) })
|
|
62
|
-
: null, _jsx(QuoteDetails, { swapValues: values, quote: quote?.quote, reward: quote?.reward, isQuoteLoading: isQuoteLoading })] })] }) }), _jsx(Widget.Footer, { showPoweredBy: true, children: _jsx(FormButton, { shouldConnectWallet: shouldConnectWallet, values: values, disabled: !isValid || isSubmitting || !quote || isQuoteLoading, error: error, isSubmitting: isSubmitting, partner: partner }) }), _jsx(RefuelModal, { openModal: openRefuelModal, setOpenModal: setOpenRefuelModal, fee: quote })] })] }));
|
|
63
|
+
: null, _jsx(QuoteDetails, { swapValues: values, quote: quote?.quote, reward: quote?.reward, isQuoteLoading: isQuoteLoading })] })] }) }), _jsx(Widget.Footer, { showPoweredBy: true, children: _jsx(FormButton, { shouldConnectWallet: shouldConnectWallet, values: values, disabled: !isValid || isSubmitting || !quote || isQuoteLoading, error: error, isSubmitting: isSubmitting, partner: partner }) }), _jsx(RefuelModal, { openModal: openRefuelModal, setOpenModal: setOpenRefuelModal, fee: quote }), _jsx(ContractAddressValidationCache, { source_network: source, destination_network: destination, destination_address: values.destination_address })] })] }));
|
|
63
64
|
};
|
|
64
65
|
const ValueSwapperButton = ({ values, setValues, providers, query }) => {
|
|
65
66
|
const [animate, cycle] = useCycle({ rotateX: 0 }, { rotateX: 180 });
|
|
@@ -12,6 +12,6 @@ const FormButton = ({ shouldConnectWallet, values, disabled, error, isSubmitting
|
|
|
12
12
|
if (values?.to && !values?.destination_address && !error) {
|
|
13
13
|
return (_jsx(Address, { partner: partner, children: () => (_jsx(SubmitButton, { type: "button", className: "w-full", children: _jsx("span", { className: "grow text-center", children: "Enter destination address" }) })) }));
|
|
14
14
|
}
|
|
15
|
-
return (_jsx(SubmitButton, {
|
|
15
|
+
return (_jsx(SubmitButton, { type: "submit", isDisabled: disabled, isSubmitting: isSubmitting, children: actionDisplayName }));
|
|
16
16
|
};
|
|
17
17
|
export default FormButton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useContractAddressStore } from '../../../../../../stores/contractAddressStore';
|
|
3
|
+
const ContractAddressValidationCache = ({ source_network, destination_network, destination_address }) => {
|
|
4
|
+
const { isContractInNetwork, } = useContractAddressStore();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
//perform check for source network
|
|
7
|
+
if (destination_address && source_network && source_network.type === 'evm') {
|
|
8
|
+
isContractInNetwork(destination_address, source_network.name);
|
|
9
|
+
}
|
|
10
|
+
}, [destination_address, source_network?.name, isContractInNetwork]);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
//perform check for destination network
|
|
13
|
+
if (destination_address && destination_network && destination_network.type === 'evm') {
|
|
14
|
+
isContractInNetwork(destination_address, destination_network.name);
|
|
15
|
+
}
|
|
16
|
+
}, [destination_address, destination_network?.name, isContractInNetwork]);
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
19
|
+
export default ContractAddressValidationCache;
|
|
@@ -76,7 +76,11 @@ const Processing = ({ swapBasicData, swapDetails, quote, refuel }) => {
|
|
|
76
76
|
message: error.message,
|
|
77
77
|
name: error.name,
|
|
78
78
|
stack: error.stack,
|
|
79
|
-
cause: error.cause
|
|
79
|
+
cause: error.cause,
|
|
80
|
+
swapId: swapDetails?.id,
|
|
81
|
+
transactionHash: transactionHash,
|
|
82
|
+
fromAddress: swapInputTransaction?.from,
|
|
83
|
+
toAddress: swapBasicData?.destination_address
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
86
|
}, [inputTxStatus, transactionHash, swapDetails?.id]);
|
|
@@ -105,7 +109,7 @@ const Processing = ({ swapBasicData, swapDetails, quote, refuel }) => {
|
|
|
105
109
|
},
|
|
106
110
|
current: {
|
|
107
111
|
name: 'Processing your deposit',
|
|
108
|
-
description: _jsxs("div", { className: 'flex space-x-1', children: [_jsx("div", { className: 'flex items-center space-x-1', children: _jsx(LinkWithIcon, { name: 'View in explorer', url: input_tx_explorer?.replace("{0}", transactionHash) }) }), _jsx("div", { children: _jsx("span", { children: swapInputTransaction && swapInputTransaction?.confirmations && (_jsxs("div", { children: [_jsx("span", { className: 'whitespace-nowrap', children: "| Confirmations" }), _jsxs("span", { className: "text-primary-text ml-1", children: [_jsx("span", { children: swapInputTransaction?.confirmations >= swapInputTransaction?.max_confirmations
|
|
112
|
+
description: _jsxs("div", { className: 'flex space-x-1', children: [_jsx("div", { className: 'flex items-center space-x-1', children: _jsx(LinkWithIcon, { name: 'View in explorer', url: input_tx_explorer?.replace("{0}", transactionHash) }) }), _jsx("div", { children: _jsx("span", { children: swapInputTransaction && swapInputTransaction?.confirmations > 0 && (_jsxs("div", { children: [_jsx("span", { className: 'whitespace-nowrap', children: "| Confirmations " }), _jsxs("span", { className: "text-primary-text ml-1", children: [_jsx("span", { children: swapInputTransaction?.confirmations >= swapInputTransaction?.max_confirmations
|
|
109
113
|
? swapInputTransaction?.max_confirmations
|
|
110
114
|
: swapInputTransaction?.confirmations }), _jsx("span", { children: "/" }), swapInputTransaction?.max_confirmations] })] })) }) })] })
|
|
111
115
|
},
|
|
@@ -142,7 +146,7 @@ const Processing = ({ swapBasicData, swapDetails, quote, refuel }) => {
|
|
|
142
146
|
},
|
|
143
147
|
complete: {
|
|
144
148
|
name: `${swapOutputTransaction?.amount && truncateDecimals(swapOutputTransaction?.amount, destination_token.decimals)} ${destination_token.symbol} was sent to your address`,
|
|
145
|
-
description: swapOutputTransaction ? _jsx("div", { className: "flex flex-col", children: _jsxs("div", { className: 'flex items-center space-x-1', children: [_jsx("span", { children: "Transaction: " }), _jsx(LinkWithIcon, { name: 'View in explorer', url: output_tx_explorer?.replace("{0}", swapOutputTransaction.transaction_hash) })] }) }) : null,
|
|
149
|
+
description: swapOutputTransaction?.amount ? _jsx("div", { className: "flex flex-col", children: _jsxs("div", { className: 'flex items-center space-x-1', children: [_jsx("span", { children: "Transaction: " }), _jsx(LinkWithIcon, { name: 'View in explorer', url: output_tx_explorer?.replace("{0}", swapOutputTransaction.transaction_hash) })] }) }) : null,
|
|
146
150
|
},
|
|
147
151
|
failed: {
|
|
148
152
|
name: (swapDetails.status === SwapStatus.PendingRefund || swapDetails.status === SwapStatus.Refunded)
|
|
@@ -264,8 +268,8 @@ const getProgressStatuses = (swapDetails, refuel, inputTxStatusFromApi) => {
|
|
|
264
268
|
subtitle = null;
|
|
265
269
|
}
|
|
266
270
|
let input_transfer = transactionStatusToProgressStatus(swapInputTxStatus) || '';
|
|
267
|
-
let output_transfer = swapOutputTransaction?.transaction_hash ? ProgressStatus.Complete : inputIsCompleted ? ProgressStatus.Current : ProgressStatus.Upcoming;
|
|
268
|
-
let refuel_transfer = swapRefuelTransaction?.transaction_hash ? ProgressStatus.Complete : !!refuel ? ProgressStatus.Upcoming : ProgressStatus.Removed;
|
|
271
|
+
let output_transfer = (swapOutputTransaction?.transaction_hash && swapOutputTransaction?.amount) ? ProgressStatus.Complete : inputIsCompleted ? ProgressStatus.Current : ProgressStatus.Upcoming;
|
|
272
|
+
let refuel_transfer = (swapRefuelTransaction?.transaction_hash && swapRefuelTransaction?.amount) ? ProgressStatus.Complete : !!refuel ? ProgressStatus.Upcoming : ProgressStatus.Removed;
|
|
269
273
|
let refund_status = ProgressStatus.Removed;
|
|
270
274
|
if (swapStatus === SwapStatus.PendingRefund || swapStatus === SwapStatus.Refunded) {
|
|
271
275
|
// For refund cases: 1) Deposit Confirmed 2) Processing Failed 3) Refund Pending/Completed
|
|
@@ -7,7 +7,6 @@ import useSWR from 'swr';
|
|
|
7
7
|
import { useInitialSettings } from "../../../../../context/settings";
|
|
8
8
|
import { ImageWithFallback } from "../../../../../components/Common/ImageWithFallback";
|
|
9
9
|
import NumberFlow from "@number-flow/react";
|
|
10
|
-
import clsx from "clsx";
|
|
11
10
|
import { PriceImpact } from "../../../../../components/Input/Amount/PriceImpact";
|
|
12
11
|
const Summary = (props) => {
|
|
13
12
|
const { swap, quote, receiveAmount } = props;
|
|
@@ -26,12 +25,12 @@ const Summary = (props) => {
|
|
|
26
25
|
truncateDecimals(refuel.amount, nativeCurrency?.precision) : null;
|
|
27
26
|
const refuelAmountInUsd = nativeCurrency && ((nativeCurrency?.price_in_usd || 1) * (Number(truncatedRefuelAmount) || 0)).toFixed(2);
|
|
28
27
|
return (_jsx("div", { className: "bg-secondary-500 rounded-2xl px-3 py-4 w-full relative z-10 space-y-4", children: _jsxs("div", { className: "font-normal flex flex-col w-full relative z-10 space-y-3", children: [_jsxs("div", { className: "w-full grid grid-cols-10", children: [_jsx(RouteTokenPair, { route: sourceExchange || source, token: sourceCurrency }), _jsxs("div", { className: "flex flex-col col-start-7 col-span-4 items-end", children: [requestedAmount &&
|
|
29
|
-
_jsxs("p", { className: "text-primary-text text-
|
|
28
|
+
_jsxs("p", { className: "text-primary-text text-xl leading-6 font-normal whitespace-nowrap", children: [truncateDecimals(Number(requestedAmount), sourceCurrency.precision), " ", sourceCurrency.symbol] }), _jsx("p", { className: "text-secondary-text text-sm leading-5 flex font-medium justify-end", children: _jsx(NumberFlow, { value: Number(requestedAmountInUsd || 0), prefix: "$", trend: 0 }) })] })] }), _jsxs("div", { className: "relative text-secondary-text", children: [_jsx("hr", { className: "border border-secondary-400 w-full rounded-full" }), _jsx(ArrowDown, { className: "absolute left-1/2 -translate-x-1/2 top-[-10px] h-6 w-6 p-1 bg-secondary-400 rounded-md text-secondary-text" })] }), _jsxs("div", { className: "w-full grid grid-cols-10", children: [_jsx(RouteTokenPair, { route: destination, token: destinationCurrency }), receiveAmount && (_jsxs("div", { className: "flex flex-col justify-end items-end w-full col-start-7 col-span-4 h-[44px]", children: [_jsx("p", { className: "text-primary-text text-xl font-normal text-end", children: _jsx(NumberFlow, { value: receiveAmount, suffix: ` ${destinationCurrency.symbol}`, trend: 0, format: { maximumFractionDigits: quote.quote.destination_token?.decimals || 2 } }) }), _jsxs("p", { className: "text-secondary-text text-sm flex items-center gap-1 font-medium", children: [_jsx(PriceImpact, { className: "text-sm", quote: swapQuote, refuel: refuel }), _jsx(NumberFlow, { value: Number(receiveAmountInUsd || 0), prefix: "$", trend: 0 })] })] }))] }), (!!refuel != undefined && nativeCurrency) ?
|
|
30
29
|
_jsxs("div", { className: "flex items-center justify-between w-full ", children: [_jsxs("div", { className: 'flex items-center gap-3 text-sm', children: [_jsx("span", { className: "relative z-10 flex h-8 w-8 items-center justify-center rounded-lg p-2 bg-primary/20", children: _jsx(Fuel, { className: "h-5 w-5 text-primary", "aria-hidden": "true" }) }), _jsx("p", { children: "Refuel" })] }), _jsxs("div", { className: "flex flex-col items-end", children: [_jsxs("p", { className: "text-primary-text text-sm", children: [truncatedRefuelAmount, " ", nativeCurrency?.symbol] }), _jsxs("p", { className: "text-secondary-text text-sm flex justify-end", children: ["$", refuelAmountInUsd] })] })] })
|
|
31
30
|
:
|
|
32
31
|
_jsx(_Fragment, {})] }) }));
|
|
33
32
|
};
|
|
34
33
|
const RouteTokenPair = ({ route, token }) => {
|
|
35
|
-
return (_jsxs("div", { className: "flex grow gap-4 text-left items-center md:text-base relative col-span-6 align-center", children: [_jsxs("div", { className: "inline-flex items-center relative shrink-0
|
|
34
|
+
return (_jsxs("div", { className: "flex grow gap-4 text-left items-center md:text-base relative col-span-6 align-center", children: [_jsxs("div", { className: "inline-flex items-center relative shrink-0 h-8 w-8", children: [_jsx(ImageWithFallback, { src: token.logo, alt: "Token Logo", height: "28", width: "28", loading: "eager", fetchPriority: "high", className: "rounded-full object-contain" }), _jsx("div", { className: "absolute -right-0.5 -bottom-0.5 rounded border border-secondary-500 bg-secondary-400 overflow-hidden", children: _jsx(ImageWithFallback, { src: route.logo, alt: "Route Logo", height: "16", width: "16", loading: "eager", fetchPriority: "high", className: "object-contain" }) })] }), _jsxs("div", { className: "text-primary-text overflow-hidden", children: [_jsx("p", { className: "text-xl leading-6 font-normal", children: token.symbol }), _jsx("p", { className: "text-secondary-text text-sm truncate whitespace-nowrap font-medium leading-5", children: route.display_name })] })] }));
|
|
36
35
|
};
|
|
37
36
|
export default Summary;
|
|
@@ -88,7 +88,7 @@ export const ButtonWrapper = ({ ...props }) => {
|
|
|
88
88
|
return _jsx(SubmitButton, { text_align: 'center', buttonStyle: 'filled', size: "medium", type: "button", className: "text-primary-text text-base", ...props, children: props.children });
|
|
89
89
|
};
|
|
90
90
|
export const SendTransactionButton = ({ error, clearError, onClick, swapData: swapBasicData, refuel, ...props }) => {
|
|
91
|
-
const { quote, quoteIsLoading, quoteError, swapId, swapDetails, depositActionsResponse } = useSwapDataState();
|
|
91
|
+
const { quote, quoteIsLoading, quoteError, swapId, swapDetails, depositActionsResponse, refuel: refuelData } = useSwapDataState();
|
|
92
92
|
const { onWalletWithdrawalSuccess: onWalletWithdrawalSuccess, onCancelWithdrawal } = useWalletWithdrawalState();
|
|
93
93
|
const { createSwap, setSwapId, setQuoteLoading } = useSwapDataUpdate();
|
|
94
94
|
const { setSwapTransaction } = useSwapTransactionStore();
|
|
@@ -102,7 +102,7 @@ export const SendTransactionButton = ({ error, clearError, onClick, swapData: sw
|
|
|
102
102
|
const [actionStateText, setActionStateText] = useState();
|
|
103
103
|
const [loading, setLoading] = useState(false);
|
|
104
104
|
const [showCriticalMarketPriceImpactButtons, setShowCriticalMarketPriceImpactButtons] = useState(false);
|
|
105
|
-
const priceImpactValues = useMemo(() => quote ? resolvePriceImpactValues(quote) : undefined, [quote]);
|
|
105
|
+
const priceImpactValues = useMemo(() => quote ? resolvePriceImpactValues(quote, refuel ? refuelData : undefined) : undefined, [quote, refuel]);
|
|
106
106
|
const criticalMarketPriceImpact = useMemo(() => priceImpactValues?.criticalMarketPriceImpact, [priceImpactValues]);
|
|
107
107
|
const handleClick = async () => {
|
|
108
108
|
try {
|
|
@@ -136,7 +136,7 @@ export const SendTransactionButton = ({ error, clearError, onClick, swapData: sw
|
|
|
136
136
|
throw new Error('Swap ID is undefined');
|
|
137
137
|
}
|
|
138
138
|
setSwapId(newSwapId);
|
|
139
|
-
const priceImpactValues = newSwapData.quote ? resolvePriceImpactValues(newSwapData.quote) : undefined;
|
|
139
|
+
const priceImpactValues = newSwapData.quote ? resolvePriceImpactValues(newSwapData.quote, newSwapData.refuel) : undefined;
|
|
140
140
|
if (priceImpactValues?.criticalMarketPriceImpact) {
|
|
141
141
|
setShowCriticalMarketPriceImpactButtons(true);
|
|
142
142
|
return;
|
|
@@ -176,6 +176,10 @@ export const SendTransactionButton = ({ error, clearError, onClick, swapData: sw
|
|
|
176
176
|
name: swapWithdrawalError.name,
|
|
177
177
|
stack: swapWithdrawalError.stack,
|
|
178
178
|
cause: swapWithdrawalError.cause,
|
|
179
|
+
swapId: swapData.id,
|
|
180
|
+
transactionHash: hash,
|
|
181
|
+
fromAddress: selectedSourceAccount?.address,
|
|
182
|
+
toAddress: swapBasicData?.destination_address
|
|
179
183
|
});
|
|
180
184
|
}
|
|
181
185
|
}
|
|
@@ -188,7 +192,10 @@ export const SendTransactionButton = ({ error, clearError, onClick, swapData: sw
|
|
|
188
192
|
message: error.message,
|
|
189
193
|
name: error.name,
|
|
190
194
|
stack: error.stack,
|
|
191
|
-
cause: error.cause
|
|
195
|
+
cause: error.cause,
|
|
196
|
+
swapId: swapId,
|
|
197
|
+
fromAddress: selectedSourceAccount?.address,
|
|
198
|
+
toAddress: swapBasicData?.destination_address
|
|
192
199
|
});
|
|
193
200
|
}
|
|
194
201
|
finally {
|
|
@@ -198,9 +205,9 @@ export const SendTransactionButton = ({ error, clearError, onClick, swapData: sw
|
|
|
198
205
|
if (quoteIsLoading || loading)
|
|
199
206
|
return (_jsx(ButtonWrapper, { ...props, isSubmitting: true, isDisabled: true, children: actionStateText || "Preparing" }));
|
|
200
207
|
if (showCriticalMarketPriceImpactButtons) {
|
|
201
|
-
return (_jsxs(_Fragment, { children: [quote && priceImpactValues && _jsx("div", { className: "py-1", children: _jsxs("div", { className: "flex items-start gap-2.5", children: [_jsx("span", { className: "shrink-0", children: _jsx(InfoIcon, { className: "w-5 h-5 text-warning-foreground" }) }), _jsxs("div", { className: "flex flex-col gap-1.5 pr-4", children: [_jsx("p", { className: "text-
|
|
208
|
+
return (_jsxs(_Fragment, { children: [quote && priceImpactValues && _jsx("div", { className: "py-1", children: _jsxs("div", { className: "flex items-start gap-2.5", children: [_jsx("span", { className: "shrink-0", children: _jsx(InfoIcon, { className: "w-5 h-5 text-warning-foreground" }) }), _jsxs("div", { className: "flex flex-col gap-1.5 pr-4", children: [_jsx("p", { className: "text-primary-text font-semibold leading-4 text-base mt-0.5", children: "Critical receiving amount" }), _jsxs("p", { className: "text-priamry-text text-base font-normal leading-[18px]", children: [_jsx("span", { children: "By continuing, you agree to receive as low as " }), _jsxs("span", { className: "text-warning-foreground text-nowrap", children: [quote.min_receive_amount, " ", quote.destination_token?.symbol, " ($ ", priceImpactValues.minReceiveAmountUSD, ")"] })] })] })] }) }), _jsx(ButtonWrapper, { ...props, onClick: handleClick, buttonStyle: "secondary", size: "small", isSubmitting: false, isDisabled: false, children: "Continue anyway" }), _jsx(ButtonWrapper, { ...props, size: "small", onClick: () => onCancelWithdrawal?.(), isSubmitting: false, isDisabled: false, children: "Cancel & try another route" })] }));
|
|
202
209
|
}
|
|
203
|
-
return (_jsxs(_Fragment, { children: [!!(!swapId && criticalMarketPriceImpact && quote?.destination_token && priceImpactValues && !error) && _jsx("div", { className: "py-1", children: _jsxs("div", { className: "flex items-start gap-2.5", children: [_jsx("span", { className: "shrink-0", children: _jsx(InfoIcon, { className: "w-5 h-5 text-warning-foreground" }) }), _jsxs("div", { className: "flex flex-col gap-1.5 pr-4", children: [_jsx("p", { className: "text-
|
|
210
|
+
return (_jsxs(_Fragment, { children: [!!(!swapId && criticalMarketPriceImpact && quote?.destination_token && priceImpactValues && !error) && _jsx("div", { className: "py-1", children: _jsxs("div", { className: "flex items-start gap-2.5", children: [_jsx("span", { className: "shrink-0", children: _jsx(InfoIcon, { className: "w-5 h-5 text-warning-foreground" }) }), _jsxs("div", { className: "flex flex-col gap-1.5 pr-4", children: [_jsx("p", { className: "text-primary-text font-medium leading-4 text-base mt-0.5", children: "Critical receiving amount" }), _jsxs("p", { className: "text-secondary-text text-sm leading-[18px]", children: [_jsx("span", { children: "The \u201Creceive at least\u201D amount is affected by high price impact. You will receive at least " }), _jsxs("span", { children: [quote.min_receive_amount, " ", quote.destination_token?.symbol, " ($ ", priceImpactValues.minReceiveAmountUSD, ") "] })] })] })] }) }), _jsx(ButtonWrapper, { ...props, isSubmitting: props.isSubmitting || loading || quoteIsLoading, onClick: handleClick, isDisabled: quoteIsLoading || !!quoteError, children: error ? 'Try again' : 'Swap now' })] }));
|
|
204
211
|
};
|
|
205
212
|
const resolveTransactionData = (swapDetails, swapBasicData, deposit_actions, balances, selectedWallet) => {
|
|
206
213
|
const depositAction = deposit_actions?.find(action => action.type === 'transfer'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { WalletTransferAction } from './Wallet';
|
|
3
3
|
const WalletTransferButton = ({ swapBasicData: swapData, swapId, refuel, balanceWarning, onWalletWithdrawalSuccess, onCancelWithdrawal }) => {
|
|
4
|
-
return _jsx(_Fragment, { children:
|
|
4
|
+
return _jsx(_Fragment, { children: _jsxs("div", { className: 'space-y-2.5', children: [balanceWarning, _jsx(WalletTransferAction, { swapData: swapData, swapId: swapId, refuel: refuel, onWalletWithdrawalSuccess: onWalletWithdrawalSuccess, onCancelWithdrawal: onCancelWithdrawal })] }) });
|
|
5
5
|
};
|
|
6
6
|
export default WalletTransferButton;
|
|
@@ -3,9 +3,9 @@ import { ChevronDown } from "lucide-react";
|
|
|
3
3
|
import FailIcon from "../../../../Icons/FailIcon";
|
|
4
4
|
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../../../../../components/shadcn/accordion";
|
|
5
5
|
const WalletMessage = ({ header, details, status, showInModal }) => {
|
|
6
|
-
return _jsxs("div", { className: "flex
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
return _jsx(_Fragment, { children: _jsx("div", { className: "px-2 py-3 rounded-2xl bg-secondary-400", children: _jsxs("div", { className: "flex items-start gap-2 relative", children: [_jsx("span", { className: "shrink-0 p-0.5", children: status === "error" ?
|
|
7
|
+
_jsx(FailIcon, { className: "relative top-0 left-0 h-5 w-5" })
|
|
8
|
+
:
|
|
9
|
+
_jsxs(_Fragment, { children: [_jsx("div", { className: 'absolute top-1.5 left-1.5 w-4 h-4 md:w-5 md:h-5 opacity-40 bg bg-primary rounded-full animate-ping' }), _jsx("div", { className: 'absolute top-2.5 left-2.5 w-2 h-2 md:w-3 md:h-3 opacity-40 bg bg-primary rounded-full animate-ping' }), _jsx("div", { className: 'relative top-0 left-0 w-6 h-6 md:w-7 md:h-7 scale-50 bg bg-primary rounded-full ' })] }) }), showInModal ? (_jsx("div", { className: "text-left space-y-1 w-full max-w-2xl", children: _jsx(Accordion, { type: "single", collapsible: true, children: _jsxs(AccordionItem, { value: "wallet-message", children: [_jsxs(AccordionTrigger, { className: "flex justify-between w-full items-center mt-0.5", children: [_jsx("p", { className: "text-primary-text font-medium leading-4 text-base mt-0.5", children: header }), _jsx(ChevronDown, { className: "h-4 w-4 shrink-0 text-primary-text transition-transform duration-200 data-[state=open]:rotate-180" })] }), _jsx(AccordionContent, { children: _jsx("div", { className: "text-left space-y-1", children: _jsx("p", { className: "text-sm text-secondary-text wrap-anywhere whitespace-pre-wrap", children: details }) }) })] }) }) })) : (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("p", { className: "text-primary-text font-medium leading-4 text-base mt-0.5", children: header }), details ? _jsx("p", { className: "text-secondary-text text-sm leading-[18px]", children: details }) : null] }))] }) }) });
|
|
10
10
|
};
|
|
11
11
|
export default WalletMessage;
|
|
@@ -46,7 +46,7 @@ const HistoryList = ({ onNewTransferClick }) => {
|
|
|
46
46
|
], [showAll, pendingSwaps, flattenedSwaps]);
|
|
47
47
|
const rowVirtualizer = useVirtualizer({
|
|
48
48
|
count: (list?.length || 0),
|
|
49
|
-
getScrollElement: () =>
|
|
49
|
+
getScrollElement: () => parentRef.current,
|
|
50
50
|
estimateSize: () => 35,
|
|
51
51
|
});
|
|
52
52
|
const items = rowVirtualizer.getVirtualItems();
|
|
@@ -34,7 +34,7 @@ const HistorySummary = ({ swapResponse, wallets, className }) => {
|
|
|
34
34
|
sourceAccountAddress = shortenEmail(exchange_account_name, 10);
|
|
35
35
|
}
|
|
36
36
|
const destAddress = (hideAddress && hideTo && account) ? account : destination_address;
|
|
37
|
-
return (source_token && _jsxs(_Fragment, { children: [_jsx("div", { className: `${className || ""} bg-secondary-500 relative z-10 w-full rounded-xl overflow-hidden hover:bg-secondary-400`, children: _jsxs("div", { className: "grid grid-cols-12 items-center gap-2 relative z-50", children: [_jsxs("div", { className: "col-span-6 flex items-center gap-2 p-3", children: [_jsxs("div", { className: "w-8 h-8 relative", children: [_jsx(ImageWithFallback, { src: source_token.logo, alt: `${source_token.symbol} logo`, width: 30, height: 30, className: "rounded-full" }), source?.logo && (_jsx(ImageWithFallback, { src: source.logo, alt: `${source.display_name} badge`, width: 18, height: 18, className: "
|
|
37
|
+
return (source_token && _jsxs(_Fragment, { children: [_jsx("div", { className: `${className || ""} bg-secondary-500 relative z-10 w-full rounded-xl overflow-hidden hover:bg-secondary-400`, children: _jsxs("div", { className: "grid grid-cols-12 items-center gap-2 relative z-50", children: [_jsxs("div", { className: "col-span-6 flex items-center gap-2 p-3", children: [_jsxs("div", { className: "w-8 h-8 relative", children: [_jsx("div", { className: "h-[30px] w-[30px] rounded-full overflow-hidden", children: _jsx(ImageWithFallback, { src: source_token.logo, alt: `${source_token.symbol} logo`, width: 30, height: 30, className: "rounded-full" }) }), source?.logo && (_jsx("div", { className: "absolute -bottom-0.5 -right-1 h-[18px] w-[18px] rounded-md overflow-hidden border border-secondary-500", children: _jsx(ImageWithFallback, { src: source.logo, alt: `${source.display_name} badge`, width: 18, height: 18, className: "" }) }))] }), _jsxs("div", { className: "flex min-w-0 flex-col items-start space-y-0.5 overflow-hidden", children: [_jsxs("div", { className: "text-primary-text text-sm sm:text-lg leading-5 flex items-center min-w-0 gap-1 w-full", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: "truncate block shrink", children: requested_amount.toLocaleString('en-US', { maximumFractionDigits: 20 }) }) }), _jsx(TooltipContent, { children: requested_amount })] }), _jsx("span", { className: "shrink-0", children: source_token.symbol })] }), _jsx("span", { className: "text-secondary-text text-sm text-left leading-3.5", children: source?.display_name || "" })] })] }), _jsx("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none -z-10", children: _jsx("div", { className: "h-7 w-6 rounded-md bg-secondary-400 flex items-center justify-center", children: _jsx(ChevronRightIcon, { className: "h-5 w-5 text-primary-text" }) }) }), _jsxs("div", { className: "col-span-6 flex items-center justify-end gap-2 bg-secondary-400 p-3 rounded-xl", children: [_jsxs("div", { className: "flex min-w-0 flex-col items-end space-y-0.5 overflow-hidden", children: [_jsxs("div", { className: "text-primary-text text-sm sm:text-lg leading-5 flex items-center min-w-0 gap-1 w-full justify-end", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: "truncate block shrink", children: calculatedReceiveAmount.toLocaleString('en-US', { maximumFractionDigits: 20 }) }) }), _jsx(TooltipContent, { children: calculatedReceiveAmount })] }), _jsx("span", { className: "shrink-0", children: destination_token.symbol })] }), _jsx("span", { className: "text-secondary-text text-sm text-right leading-3.5", children: destination?.display_name || "" })] }), _jsxs("div", { className: "relative w-8 h-8", children: [_jsx("div", { className: "h-[30px] w-[30px] rounded-full overflow-hidden", children: _jsx(ImageWithFallback, { src: destination_token.logo, alt: `${destination_token.symbol} logo`, width: 30, height: 30, className: "rounded-full" }) }), destination?.logo && (_jsx("div", { className: "absolute -bottom-0.5 -right-1 h-[18px] w-[18px] rounded-md overflow-hidden border border-secondary-500", children: _jsx(ImageWithFallback, { src: destination.logo, alt: `${destination.display_name} badge`, width: 18, height: 18, className: "" }) }))] })] })] }) }), swap.status !== SwapStatus.Completed &&
|
|
38
38
|
_jsx("div", { className: "-mt-2 z-0 relative", children: _jsx(StatusIcon, { swap: swap, withBg: true }) })] }));
|
|
39
39
|
};
|
|
40
40
|
export default HistorySummary;
|