@layerswap/widget 1.1.5 → 1.2.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.
Files changed (95) hide show
  1. package/dist/esm/components/Input/Amount/ReceiveAmount.js +5 -1
  2. package/dist/esm/components/Input/Amount/index.js +1 -1
  3. package/dist/esm/components/Input/DestinationPicker.js +1 -1
  4. package/dist/esm/components/Input/NumericInput.js +11 -6
  5. package/dist/esm/components/Input/SourcePicker.js +1 -1
  6. package/dist/esm/components/Pages/Swap/Form/FeeDetails/DepositMethod/index.js +1 -1
  7. package/dist/esm/components/Pages/Swap/Form/FormWrapper.js +1 -1
  8. package/dist/esm/components/Pages/Swap/Withdraw/Wallet/index.js +0 -1
  9. package/dist/esm/components/Wallet/WalletModal/ConnectorsList.js +3 -5
  10. package/dist/esm/components/Wallet/WalletModal/InstalledExtensionNotFound.js +8 -3
  11. package/dist/esm/components/Wallet/WalletModal/LoadingConnect.js +0 -3
  12. package/dist/esm/components/shadcn/tooltip.js +1 -1
  13. package/dist/esm/hooks/useConnectors.js +12 -3
  14. package/dist/esm/lib/apiClients/layerSwapApiClient.js +3 -0
  15. package/dist/index.css +1 -1
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/dist/types/Models/Network.d.ts +1 -0
  18. package/dist/types/Models/Network.d.ts.map +1 -1
  19. package/dist/types/components/Common/ClickTooltip.d.ts +1 -0
  20. package/dist/types/components/Common/ClickTooltip.d.ts.map +1 -1
  21. package/dist/types/components/Common/MessageComponent.d.ts +1 -0
  22. package/dist/types/components/Common/MessageComponent.d.ts.map +1 -1
  23. package/dist/types/components/Common/WarningMessage.d.ts +1 -0
  24. package/dist/types/components/Common/WarningMessage.d.ts.map +1 -1
  25. package/dist/types/components/Common/backgroundField.d.ts +1 -0
  26. package/dist/types/components/Common/backgroundField.d.ts.map +1 -1
  27. package/dist/types/components/Input/Address/AddressPicker/AddressButton.d.ts +1 -0
  28. package/dist/types/components/Input/Address/AddressPicker/AddressButton.d.ts.map +1 -1
  29. package/dist/types/components/Input/Address/AddressPicker/index.d.ts +1 -0
  30. package/dist/types/components/Input/Address/AddressPicker/index.d.ts.map +1 -1
  31. package/dist/types/components/Input/Address/index.d.ts +1 -0
  32. package/dist/types/components/Input/Address/index.d.ts.map +1 -1
  33. package/dist/types/components/Input/Amount/ReceiveAmount.d.ts.map +1 -1
  34. package/dist/types/components/Input/Amount/index.d.ts.map +1 -1
  35. package/dist/types/components/Input/NumericInput.d.ts +2 -0
  36. package/dist/types/components/Input/NumericInput.d.ts.map +1 -1
  37. package/dist/types/components/Input/RoutePicker/Rows/CollapsibleRow.d.ts +1 -1
  38. package/dist/types/components/Input/RoutePicker/Rows/CollapsibleRow.d.ts.map +1 -1
  39. package/dist/types/components/Input/RoutePicker/Rows/StickyHeader.d.ts +2 -2
  40. package/dist/types/components/Input/RoutePicker/Rows/StickyHeader.d.ts.map +1 -1
  41. package/dist/types/components/Input/RoutePicker/Rows/index.d.ts +1 -1
  42. package/dist/types/components/Input/RoutePicker/Rows/index.d.ts.map +1 -1
  43. package/dist/types/components/Menu/Menu.d.ts +1 -0
  44. package/dist/types/components/Menu/Menu.d.ts.map +1 -1
  45. package/dist/types/components/Modal/leaflet.d.ts +1 -0
  46. package/dist/types/components/Modal/leaflet.d.ts.map +1 -1
  47. package/dist/types/components/Modal/modal.d.ts +1 -0
  48. package/dist/types/components/Modal/modal.d.ts.map +1 -1
  49. package/dist/types/components/Modal/modalWithoutAnimation.d.ts +1 -0
  50. package/dist/types/components/Modal/modalWithoutAnimation.d.ts.map +1 -1
  51. package/dist/types/components/Modal/vaul/context.d.ts +2 -2
  52. package/dist/types/components/Modal/vaul/context.d.ts.map +1 -1
  53. package/dist/types/components/Modal/vaul/use-snap-points.d.ts +2 -2
  54. package/dist/types/components/Modal/vaul/use-snap-points.d.ts.map +1 -1
  55. package/dist/types/components/Pages/Swap/Form/NetworkExchangeTabs.d.ts +1 -0
  56. package/dist/types/components/Pages/Swap/Form/NetworkExchangeTabs.d.ts.map +1 -1
  57. package/dist/types/components/Pages/Swap/Withdraw/Processing/types.d.ts +1 -0
  58. package/dist/types/components/Pages/Swap/Withdraw/Processing/types.d.ts.map +1 -1
  59. package/dist/types/components/Pages/Swap/Withdraw/SwapDetails.d.ts.map +1 -1
  60. package/dist/types/components/Pages/Swap/Withdraw/WalletTransferButton.d.ts +1 -0
  61. package/dist/types/components/Pages/Swap/Withdraw/WalletTransferButton.d.ts.map +1 -1
  62. package/dist/types/components/Pages/Swap/Withdraw/Withdraw.d.ts.map +1 -1
  63. package/dist/types/components/Select/Selector/Index.d.ts +1 -0
  64. package/dist/types/components/Select/Selector/Index.d.ts.map +1 -1
  65. package/dist/types/components/Select/Selector/SelectItem.d.ts +1 -0
  66. package/dist/types/components/Select/Selector/SelectItem.d.ts.map +1 -1
  67. package/dist/types/components/Select/Shared/Props/selectMenuItem.d.ts +1 -0
  68. package/dist/types/components/Select/Shared/Props/selectMenuItem.d.ts.map +1 -1
  69. package/dist/types/components/Wallet/WalletModal/ConnectorsList.d.ts.map +1 -1
  70. package/dist/types/components/Wallet/WalletModal/InstalledExtensionNotFound.d.ts +1 -1
  71. package/dist/types/components/Wallet/WalletModal/InstalledExtensionNotFound.d.ts.map +1 -1
  72. package/dist/types/components/Wallet/WalletModal/LoadingConnect.d.ts.map +1 -1
  73. package/dist/types/components/Widget/Content.d.ts +1 -0
  74. package/dist/types/components/Widget/Content.d.ts.map +1 -1
  75. package/dist/types/components/Widget/Index.d.ts +1 -0
  76. package/dist/types/components/Widget/Index.d.ts.map +1 -1
  77. package/dist/types/components/Wizard/Wizard.d.ts +1 -0
  78. package/dist/types/components/Wizard/Wizard.d.ts.map +1 -1
  79. package/dist/types/components/Wizard/WizardItem.d.ts +1 -0
  80. package/dist/types/components/Wizard/WizardItem.d.ts.map +1 -1
  81. package/dist/types/components/themeWrapper.d.ts +1 -0
  82. package/dist/types/components/themeWrapper.d.ts.map +1 -1
  83. package/dist/types/context/formWizardProvider.d.ts +1 -0
  84. package/dist/types/context/formWizardProvider.d.ts.map +1 -1
  85. package/dist/types/hooks/useClickOutside.d.ts +1 -1
  86. package/dist/types/hooks/useClickOutside.d.ts.map +1 -1
  87. package/dist/types/hooks/useConnectors.d.ts.map +1 -1
  88. package/dist/types/lib/apiClients/layerSwapApiClient.d.ts +1 -0
  89. package/dist/types/lib/apiClients/layerSwapApiClient.d.ts.map +1 -1
  90. package/dist/types/types/wallet.d.ts +2 -0
  91. package/dist/types/types/wallet.d.ts.map +1 -1
  92. package/package.json +5 -5
  93. package/dist/esm/lib/wallets/imtblX/utils/ImxIcon.js +0 -5
  94. package/dist/types/lib/wallets/imtblX/utils/ImxIcon.d.ts +0 -3
  95. package/dist/types/lib/wallets/imtblX/utils/ImxIcon.d.ts.map +0 -1
@@ -2,9 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import NumberFlow from "@number-flow/react";
3
3
  import clsx from "clsx";
4
4
  import { PriceImpact } from "./PriceImpact";
5
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/shadcn/tooltip";
5
6
  export const ReceiveAmount = ({ destination_token, fee, isFeeLoading }) => {
6
7
  const receive_amount = fee?.quote.receive_amount;
7
8
  const receiveAmountInUsd = receive_amount && destination_token && fee.quote?.destination_token?.price_in_usd ? (receive_amount * fee.quote.destination_token.price_in_usd).toFixed(2) : undefined;
8
9
  const quote = fee?.quote;
9
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "flex-col w-full flex min-w-0 font-normal border-0 text-[28px] leading-7 text-primary-text relative truncate", children: [_jsx("div", { className: "w-full flex items-center justify-start relative", children: _jsx("div", { className: clsx("w-full flex items-center pt-2 pr-3", { "animate-pulse-stronger": isFeeLoading }, { "text-secondary-text": !receive_amount }), children: _jsx(NumberFlow, { value: receive_amount || 0, trend: 0, format: { maximumFractionDigits: fee?.quote.destination_token?.decimals || 2 } }) }) }), _jsxs("div", { className: "flex items-baseline space-x-2 h-5", children: [_jsx("span", { className: "text-base leading-5 font-medium text-secondary-text h-5", children: _jsx(NumberFlow, { className: "p-0", value: Number(receiveAmountInUsd || 0), prefix: "$", format: { maximumFractionDigits: receiveAmountInUsd ? 2 : 0 }, trend: 0 }) }), _jsx(PriceImpact, { className: "h-5 text-base leading-5", quote: quote, refuel: fee?.refuel })] })] }) }));
10
+ const fullAmountText = receive_amount && destination_token
11
+ ? `${receive_amount} ${destination_token.symbol}`
12
+ : undefined;
13
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "flex-col w-full flex min-w-0 font-normal border-0 text-[28px] leading-7 text-primary-text relative truncate", children: [_jsx("div", { className: "w-full flex items-center justify-start relative", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("div", { className: clsx("w-full flex items-center py-[3px]", { "animate-pulse-stronger": isFeeLoading }, { "text-secondary-text": !receive_amount }), children: _jsx(NumberFlow, { value: receive_amount || 0, trend: 0, format: { maximumFractionDigits: fee?.quote.destination_token?.decimals || 2 } }) }) }), fullAmountText && (_jsx(TooltipContent, { className: "bg-secondary-300! border-secondary-300! text-primary-text!", children: _jsx("p", { children: fullAmountText }) }))] }) }), _jsxs("div", { className: "flex items-baseline space-x-2 h-5", children: [_jsx("span", { className: "text-base leading-5 font-medium text-secondary-text h-5", children: _jsx(NumberFlow, { className: "p-0", value: Number(receiveAmountInUsd || 0), prefix: "$", format: { maximumFractionDigits: receiveAmountInUsd ? 2 : 0 }, trend: 0 }) }), _jsx(PriceImpact, { className: "h-5 text-base leading-5", quote: quote, refuel: fee?.refuel })] })] }) }));
10
14
  };
@@ -38,7 +38,7 @@ const AmountField = forwardRef(function AmountField({ usdPosition = "bottom", ac
38
38
  const disabled = Boolean(fromExchange && !toCurrency);
39
39
  return (_jsx(_Fragment, { children: _jsxs("div", { className: clsx("flex flex-col bg-secondary-500 space-y-0.5 relative w-full group", className, {
40
40
  'focus-within:[&_.usd-suffix]:invisible': usdPosition === "right"
41
- }), children: [_jsx(NumericInput, { disabled: disabled, placeholder: placeholder, step: isNaN(step) ? 0.01 : step, name: name, ref: amountRef, precision: fromCurrency?.precision, tempValue: actionValue, className: "w-full text-[28px] leading-[34px] rounded-xl text-primary-text focus:outline-none focus:border-none focus:ring-0 duration-300 ease-in-out !bg-secondary-500 !font-normal group-[.exchange-amount-field]:px-2.5 group-[.exchange-amount-field]:pb-2 group-[.exchange-amount-field]:pr-2 group-[.exchange-amount-field]:bg-secondary-300! group-[.exchange-amount-field]:pt-2! pl-0", onChange: e => {
41
+ }), children: [_jsx(NumericInput, { disabled: disabled, placeholder: placeholder, step: isNaN(step) ? 0.01 : step, name: name, ref: amountRef, precision: fromCurrency?.precision, tempValue: actionValue, tokenSymbol: fromCurrency?.symbol, className: "w-full text-[28px] leading-[34px] rounded-xl text-primary-text focus:outline-none focus:border-none focus:ring-0 duration-300 ease-in-out bg-secondary-500! font-normal! group-[.exchange-amount-field]:text-xl group-[.exchange-amount-field]:px-2.5 group-[.exchange-amount-field]:pb-2 group-[.exchange-amount-field]:pr-2 group-[.exchange-amount-field]:bg-secondary-300! px-0 truncate", onChange: e => {
42
42
  /^[0-9]*[.,]?[0-9]*$/.test(e.target.value) && handleChange(e);
43
43
  } }), _jsx("div", { className: clsx("usd-suffix text-base group-[.exchange-amount-field]:text-sm leading-5 font-medium text-secondary-text pointer-events-none", {
44
44
  "absolute bottom-[11px]": usdPosition === "right",
@@ -16,7 +16,7 @@ const DestinationPicker = (props) => {
16
16
  const { swapId } = useSwapDataState();
17
17
  const quoteRefreshInterval = !!swapId ? 0 : undefined;
18
18
  const { quote, isQuoteLoading } = useQuoteData(quoteArgs, quoteRefreshInterval);
19
- return _jsxs("div", { className: "flex flex-col w-full bg-secondary-500 rounded-2xl p-4 pb-[15px] space-y-[27px]", children: [_jsxs("div", { className: "grid grid-cols-9 gap-2 items-center h-7", children: [_jsx("label", { htmlFor: "To", className: "block col-span-4 font-normal text-secondary-text text-base leading-5 w-30", children: "Receive at" }), _jsx("div", { className: "col-span-5 justify-self-end", children: _jsx(Address, { partner: partner, children: ({ destination, addressItem, connectedWallet, partner }) => _jsx(DestinationWalletPicker, { destination: destination, addressItem: addressItem, connectedWallet: connectedWallet, partner: partner }) }) })] }), _jsx("div", { className: "items-center space-y-2", children: _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-2 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(ReceiveAmount, { destination_token: toCurrency, fee: quote, isFeeLoading: isQuoteLoading }) }), _jsx("div", { className: "justify-self-end self-start", children: _jsx(RoutePicker, { direction: "to" }) })] }) })] });
19
+ return _jsxs("div", { className: "flex flex-col w-full bg-secondary-500 rounded-2xl p-4 pb-[15px] space-y-[27px]", children: [_jsxs("div", { className: "grid grid-cols-9 gap-2 items-center h-7", children: [_jsx("label", { htmlFor: "To", className: "block col-span-4 font-normal text-secondary-text text-base leading-5 w-30", children: "Receive at" }), _jsx("div", { className: "col-span-5 justify-self-end", children: _jsx(Address, { partner: partner, children: ({ destination, addressItem, connectedWallet, partner }) => _jsx(DestinationWalletPicker, { destination: destination, addressItem: addressItem, connectedWallet: connectedWallet, partner: partner }) }) })] }), _jsx("div", { className: "items-center space-y-2", children: _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-1 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(ReceiveAmount, { destination_token: toCurrency, fee: quote, isFeeLoading: isQuoteLoading }) }), _jsx("div", { className: "justify-self-end self-start", children: _jsx(RoutePicker, { direction: "to" }) })] }) })] });
20
20
  };
21
21
  export const SecondDestinationWalletPicker = () => {
22
22
  return _jsxs("div", { className: " justify-center w-full pl-3 pr-2 py-2 bg-secondary-400 items-center flex font-light space-x-2 mx-auto rounded-lg focus-peer:ring-primary focus-peer:border-secondary-400 focus-peer:border focus-peer:ring-1 focus:outline-none disabled:cursor-not-allowed relative grow h-12 ", children: [_jsx(PlusIcon, { className: "stroke-1" }), " ", _jsx("span", { children: "Destination Address" })] });
@@ -3,8 +3,9 @@ import { useField, useFormikContext } from "formik";
3
3
  import { forwardRef } from "react";
4
4
  import { classNames } from '../utils/classNames';
5
5
  import { isScientific } from "../utils/RoundDecimals";
6
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../../components/shadcn/tooltip";
6
7
  // Use with Formik
7
- const NumericInput = forwardRef(function NumericInput({ label, disabled, tempValue, placeholder, minLength, maxLength, precision, step, name, className, children, onChange, onFocus, onBlur }, ref) {
8
+ const NumericInput = forwardRef(function NumericInput({ label, disabled, tempValue, placeholder, minLength, maxLength, precision, step, name, className, children, onChange, onFocus, onBlur, tokenSymbol }, ref) {
8
9
  const { handleChange } = useFormikContext();
9
10
  const [field] = useField(name);
10
11
  const formattedTempValue = Number(tempValue) >= 0 ? isScientific(tempValue)
@@ -13,12 +14,16 @@ const NumericInput = forwardRef(function NumericInput({ label, disabled, tempVal
13
14
  : '')
14
15
  : tempValue?.toString()
15
16
  : '';
17
+ const displayValue = !isNaN(Number(tempValue)) ? formattedTempValue : field.value;
18
+ const fullTooltipText = displayValue && Number(displayValue) > 0
19
+ ? `${displayValue}${tokenSymbol ? ` ${tokenSymbol}` : ''}`
20
+ : undefined;
16
21
  return _jsxs("div", { children: [label &&
17
- _jsx("label", { htmlFor: name, className: "block font-semibold text-secondary-text text-sm mb-1.5 w-full", children: label }), _jsxs("div", { className: "flex relative w-full", children: [!isNaN(Number(tempValue)) &&
18
- _jsx("span", { className: classNames('py-2 flex text-secondary-text/45 items-center h-12 leading-4 bg-secondary-700 min-w-0 rounded-lg font-semibold border-0 ', className), ref: ref, children: _jsx("span", { children: formattedTempValue }) }), isNaN(Number(tempValue)) &&
19
- _jsx("input", { ...field, inputMode: "decimal", autoComplete: "off", disabled: disabled, placeholder: placeholder, autoCorrect: "off", minLength: minLength, maxLength: maxLength, onInput: (event) => { replaceComma(event); limitDecimalPlaces(event, precision); }, onFocus: onFocus, onBlur: onBlur, type: "text", step: step, name: name, id: name, ref: ref, className: classNames('disabled:cursor-not-allowed h-12 leading-4 border-secondary-500 placeholder:text-secondary-text bg-secondary-700 focus:ring-primary focus:border-primary block min-w-0 rounded-lg font-semibold border-0', className), onChange: onChange ? onChange : e => {
20
- /^[0-9]*[.,]?[0-9]*$/.test(e.target.value) && handleChange(e);
21
- } }), _jsx(_Fragment, { children: children })] })] });
22
+ _jsx("label", { htmlFor: name, className: "block font-semibold text-secondary-text text-sm mb-1.5 w-full", children: label }), _jsxs(Tooltip, { disableHoverableContent: true, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: "flex relative w-full", children: [!isNaN(Number(tempValue)) &&
23
+ _jsx("span", { className: classNames('py-2 flex text-secondary-text/45 items-center h-12 leading-4 bg-secondary-700 min-w-0 rounded-lg font-semibold border-0 ', className), ref: ref, children: _jsx("span", { children: formattedTempValue }) }), isNaN(Number(tempValue)) &&
24
+ _jsx("input", { ...field, inputMode: "decimal", autoComplete: "off", disabled: disabled, placeholder: placeholder, autoCorrect: "off", minLength: minLength, maxLength: maxLength, onInput: (event) => { replaceComma(event); limitDecimalPlaces(event, precision); }, onFocus: onFocus, onBlur: onBlur, type: "text", step: step, name: name, id: name, ref: ref, className: classNames('disabled:cursor-not-allowed h-12 leading-4 border-secondary-500 placeholder:text-secondary-text bg-secondary-700 focus:ring-primary focus:border-primary block min-w-0 rounded-lg font-semibold border-0', className), onChange: onChange ? onChange : e => {
25
+ /^[0-9]*[.,]?[0-9]*$/.test(e.target.value) && handleChange(e);
26
+ } }), _jsx(_Fragment, { children: children })] }) }), _jsx(TooltipContent, { className: "bg-secondary-300! border-secondary-300! text-primary-text!", children: _jsx("p", { children: fullTooltipText }) })] })] });
22
27
  });
23
28
  function limitDecimalPlaces(e, count) {
24
29
  if (e.target.value.indexOf('.') == -1) {
@@ -19,6 +19,6 @@ const SourcePicker = ({ minAllowedAmount, maxAllowedAmount: maxAmountFromApi, fe
19
19
  _jsx("div", { className: clsx("absolute z-10 -top-[26px] left-0", {
20
20
  "hidden": !showQuickActions,
21
21
  "block": showQuickActions
22
- }, "group-hover:block"), children: _jsx(MinMax, { from: from, fromCurrency: fromCurrency, limitsMinAmount: minAllowedAmount, limitsMaxAmount: maxAmountFromApi, onActionHover: handleActionHover, depositMethod: depositMethod }) }), _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-2 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(AmountField, { fee: fee, actionValue: actiontempValue }) }), _jsx("div", { className: "justify-self-end self-start", children: _jsx(RoutePicker, { direction: "from" }) })] })] })] });
22
+ }, "group-hover:block"), children: _jsx(MinMax, { from: from, fromCurrency: fromCurrency, limitsMinAmount: minAllowedAmount, limitsMaxAmount: maxAmountFromApi, onActionHover: handleActionHover, depositMethod: depositMethod }) }), _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-1 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(AmountField, { fee: fee, actionValue: actiontempValue }) }), _jsx("div", { className: "justify-self-end self-start", children: _jsx(RoutePicker, { direction: "from" }) })] })] })] });
23
23
  };
24
24
  export default SourcePicker;
@@ -21,7 +21,7 @@ const DepositMethodComponent = () => {
21
21
  const name = 'depositMethod';
22
22
  const menuItems = from && GenerateDepositMethodMenuItems(from, depositMethods, provider);
23
23
  const defaultMethod = menuItems?.find(i => i.id === defaultDepositMethod);
24
- const menuItemsRef = useRef();
24
+ const menuItemsRef = useRef(undefined);
25
25
  menuItemsRef.current = menuItems;
26
26
  useEffect(() => {
27
27
  const first = menuItemsRef.current?.[0]?.id;
@@ -125,7 +125,7 @@ export default function FormWrapper({ children, type, partner }) {
125
125
  setWalletWihdrawDone(true);
126
126
  }, []);
127
127
  return _jsx(_Fragment, { children: _jsx(Formik, { innerRef: formikRef, initialValues: initialValues, validateOnMount: true, onSubmit: handleSubmit, children: _jsxs(_Fragment, { children: [_jsx(VaulDrawer, { show: showConnectNetworkModal, setShow: setShowConnectNetworkModal, header: `${networkToConnect?.DisplayName} connect`, modalId: "showNetwork", children: _jsx(VaulDrawer.Snap, { id: "item-1", children: networkToConnect &&
128
- _jsx(ConnectNetwork, { NetworkDisplayName: networkToConnect?.DisplayName, AppURL: networkToConnect?.AppURL }) }) }), _jsx(VaulDrawer, { show: swapModalOpen, setShow: handleShowSwapModal, header: `Complete the swap`, modalId: "showSwap", className: !swapBasicData?.use_deposit_address ? "expandContainerHeight" : "", children: _jsx(VaulDrawer.Snap, { id: "item-1", children: _jsx(SwapDetails, { type: "contained", onWalletWithdrawalSuccess: handleWalletWithdrawalSuccess, partner: partner, onCancelWithdrawal: () => handleShowSwapModal(false) }) }) }), children] }) }) });
128
+ _jsx(ConnectNetwork, { NetworkDisplayName: networkToConnect?.DisplayName, AppURL: networkToConnect?.AppURL }) }) }), _jsx(VaulDrawer, { show: swapModalOpen, setShow: handleShowSwapModal, header: 'Complete the swap', modalId: "showSwap", className: "expandContainerHeight", children: _jsx(VaulDrawer.Snap, { id: "item-1", children: _jsx(SwapDetails, { type: "contained", onWalletWithdrawalSuccess: handleWalletWithdrawalSuccess, partner: partner, onCancelWithdrawal: () => handleShowSwapModal(false) }) }) }), children] }) }) });
129
129
  }
130
130
  const handleCreateSwap = async ({ query, values, partner, setShowSwapModal, createSwap, setNetworkToConnect, setShowConnectNetworkModal, setSwapId, setSubmitedFormValues }) => {
131
131
  setSubmitedFormValues(values);
@@ -82,7 +82,6 @@ const TransferTokenButton = ({ savedTransactionHash, chainId, swapData, refuel }
82
82
  const wallet = wallets.find(w => w.id === selectedSourceAccount?.id);
83
83
  const { executeTransfer } = useTransfer();
84
84
  const rpcHealth = useRpcHealth(swapData.source_network);
85
- console.log("rpcHealth", rpcHealth);
86
85
  const clickHandler = useCallback(async ({ amount, callData, depositAddress, swapId }) => {
87
86
  setButtonClicked(true);
88
87
  setError(undefined);
@@ -52,11 +52,9 @@ const ConnectorsList = ({ onFinish }) => {
52
52
  return;
53
53
  }
54
54
  setSelectedConnector(connector);
55
- if (connector?.hasBrowserExtension && !connector?.showQrCode && connector.type == 'walletConnect' && !isMobilePlatfrom)
55
+ if (connector?.hasBrowserExtension !== false && connector.extensionNotFound && !connector?.showQrCode && !isMobilePlatfrom)
56
56
  return;
57
- if (connector.installUrl)
58
- return;
59
- if (provider.ready === false) {
57
+ if (!provider.ready) {
60
58
  setConnectionError("Wallet provider is still initializing. Please wait a moment and try again.");
61
59
  return;
62
60
  }
@@ -135,7 +133,7 @@ const ConnectorsList = ({ onFinish }) => {
135
133
  observer.observe(loadMoreTriggerRef.current);
136
134
  return () => observer.disconnect();
137
135
  }, [hasMoreToLoad, isLoadingMore, loadMore, selectedConnector, selectedMultiChainConnector]);
138
- if (selectedConnector?.hasBrowserExtension && !selectedConnector?.showQrCode && selectedConnector.type == 'walletConnect' && !isMobilePlatfrom) {
136
+ if (selectedConnector?.hasBrowserExtension !== false && selectedConnector?.extensionNotFound && !selectedConnector?.showQrCode && !isMobilePlatfrom) {
139
137
  const provider = featuredProviders.find(p => p.name === selectedConnector?.providerName);
140
138
  return _jsx(InstalledExtensionNotFound, { selectedConnector: selectedConnector, onConnect: (connector) => { connect(connector, provider); } });
141
139
  }
@@ -6,11 +6,16 @@ import { AppSettings } from "../../../exports/internal";
6
6
  import clsx from "clsx";
7
7
  import useWindowDimensions from "../../../hooks/useWindowDimensions";
8
8
  export const InstalledExtensionNotFound = ({ selectedConnector, onConnect }) => {
9
- const ConnectorIcon = resolveWalletConnectorIcon({ connector: selectedConnector, iconUrl: selectedConnector.icon });
9
+ const ConnectorIcon = resolveWalletConnectorIcon({ connector: selectedConnector, iconUrl: selectedConnector?.icon });
10
10
  const { isMobile: isMobileSize } = useWindowDimensions();
11
- return _jsxs("div", { className: clsx('w-full flex flex-col justify-center items-center font-semibold relative', {
11
+ return _jsxs("div", { className: clsx('w-full flex flex-col justify-center items-center font-semibold', {
12
12
  'h-[60vh]': isMobileSize && AppSettings.ThemeData?.enablePortal,
13
13
  'h-full': !isMobileSize || !AppSettings.ThemeData?.enablePortal,
14
14
  'h-[300px]!': isMobileSize && !AppSettings.ThemeData?.enablePortal,
15
- }), children: [_jsx("div", { className: "flex grow items-center justify-center", children: _jsxs("div", { className: "flex-col flex items-center gap-1", children: [_jsx(ConnectorIcon, { className: "w-11 h-auto p-0.5 rounded-md bg-secondary-800" }), _jsxs("div", { className: "py-1 text-center text-base font-medium", children: [_jsx("p", { children: "Wallet not found on your browser," }), _jsx("p", { children: "make sure you have the wallet installed" })] })] }) }), _jsx(SubmitButton, { onClick: () => { onConnect({ ...selectedConnector, showQrCode: true }); }, buttonStyle: "secondary", className: "w-full", children: _jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx(ScanLine, { className: "w-5 h-5" }), _jsx("span", { children: "Connect with your phone" })] }) })] });
15
+ }), children: [_jsx("div", { className: "flex grow items-center justify-center", children: _jsxs("div", { className: "flex-col flex items-center gap-1", children: [_jsx(ConnectorIcon, { className: "w-11 h-auto p-0.5 rounded-md bg-secondary-800" }), selectedConnector?.hasBrowserExtension ? (_jsxs("div", { className: "py-1 text-center text-base font-medium", children: [_jsx("p", { children: "Wallet not found on your browser," }), _jsx("p", { children: "make sure you have the wallet installed" })] })) : (_jsxs("p", { className: 'text-base font-semibold', children: [_jsx("span", { children: selectedConnector?.name }), " ", _jsx("span", { children: "is not installed" })] }))] }) }), _jsxs("div", { className: "flex flex-col gap-2 w-full", children: [_jsx(SubmitButton, { onClick: () => {
16
+ if (!selectedConnector?.installUrl)
17
+ return;
18
+ window.open(selectedConnector.installUrl, '_blank', 'noopener,noreferrer');
19
+ }, buttonStyle: "secondary", className: "w-full", children: _jsx("span", { className: "flex items-center justify-center gap-2", children: _jsx("span", { children: "Install" }) }) }), (selectedConnector && selectedConnector.hasBrowserExtension) ? _jsx(SubmitButton, { onClick: () => { onConnect({ ...selectedConnector, showQrCode: true }); }, buttonStyle: "secondary", className: "w-full", children: _jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsx(ScanLine, { className: "w-5 h-5" }), _jsx("span", { children: "Connect with your phone" })] }) })
20
+ : null] })] });
16
21
  };
@@ -10,9 +10,6 @@ export const LoadingConnect = ({ onRetry, selectedConnector, connectionError })
10
10
  const ConnectorIcon = resolveWalletConnectorIcon({ connector: selectedConnector, iconUrl: selectedConnector.icon });
11
11
  const { isMobile: isMobileSize } = useWindowDimensions();
12
12
  const isMobilePlatform = isMobile();
13
- if (selectedConnector.installUrl) {
14
- return _jsx("div", { className: 'w-full h-[60vh] sm:h-full flex flex-col justify-center items-center font-semibold relative', children: _jsx("div", { className: "flex grow items-center", children: _jsxs("div", { className: "flex flex-col gap-4 items-center justify-end row-start-2 row-span-1", children: [_jsxs("div", { className: "flex-col flex items-center gap-1", children: [_jsx(ConnectorIcon, { className: "w-11 h-auto p-0.5 rounded-md bg-secondary-800" }), _jsxs("p", { className: 'text-base font-semibold', children: [_jsx("span", { children: selectedConnector?.name }), " ", _jsx("span", { children: "is not installed" })] })] }), _jsx("button", { onClick: () => window.open(selectedConnector.installUrl, '_blank'), type: "button", className: "px-3 py-1 rounded-full bg-secondary-600 text-primary-500 font-semibold text-base hover:brightness-125 transition-all duration-200", children: "INSTALL" })] }) }) });
15
- }
16
13
  return (_jsxs("div", { className: clsx('w-full flex flex-col justify-center items-center font-semibold relative', {
17
14
  'h-[60vh]': isMobileSize && AppSettings.ThemeData?.enablePortal,
18
15
  'h-full': !isMobileSize || !AppSettings.ThemeData?.enablePortal,
@@ -42,7 +42,7 @@ function TooltipTrigger({ className, onClick, ...props }) {
42
42
  return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", className: clsx("cursor-pointer", className), onClick: handleClick, ...props });
43
43
  }
44
44
  function TooltipContent({ className, sideOffset = 0, children, arrowClasses, ...props }) {
45
- const container = document.getElementById('widget');
45
+ const container = typeof document !== 'undefined' ? document.getElementById('widget') : null;
46
46
  return (_jsx(TooltipPrimitive.Portal, { container: container, children: _jsx(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: clsx("z-50 rounded-md border border-secondary-600 bg-secondary-800 px-3 py-1.5 text-xs text-secondary-text animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props, children: children }) }));
47
47
  }
48
48
  function TooltipArrow({ className, ...props }) {
@@ -34,10 +34,18 @@ const featuredWalletsIds = [
34
34
  ];
35
35
  function removeDuplicatesWithKey(arr, key) {
36
36
  const countMap = {};
37
- // First pass: Count occurrences of each unique key.
37
+ const providerMap = {};
38
+ // First pass: Count occurrences of each unique key and track unique providers.
38
39
  arr.forEach(item => {
39
40
  const identifier = item[key];
40
41
  countMap[identifier] = (countMap[identifier] || 0) + 1;
42
+ // Track unique provider names for this connector
43
+ if (!providerMap[identifier]) {
44
+ providerMap[identifier] = new Set();
45
+ }
46
+ if (item.providerName) {
47
+ providerMap[identifier].add(item.providerName);
48
+ }
41
49
  });
42
50
  // Second pass: Create a new array with one instance of each object.
43
51
  const unique = [];
@@ -46,10 +54,11 @@ function removeDuplicatesWithKey(arr, key) {
46
54
  const identifier = item[key];
47
55
  if (!seen.has(identifier)) {
48
56
  seen.add(identifier);
49
- // Add a property 'duplicateCount' to indicate extra duplicates found.
57
+ // Only mark as multichain if there are duplicates across different providers
58
+ const uniqueProviders = providerMap[identifier]?.size || 0;
50
59
  unique.push({
51
60
  ...item,
52
- isMultiChain: countMap[identifier] > 1
61
+ isMultiChain: countMap[identifier] > 1 && uniqueProviders > 1
53
62
  });
54
63
  }
55
64
  });
@@ -29,6 +29,9 @@ class LayerSwapApiClient {
29
29
  async SwapCatchup(swapId, tx_id) {
30
30
  return await this.AuthenticatedRequest("POST", `/swaps/${swapId}/deposit_speedup`, { transaction_id: tx_id });
31
31
  }
32
+ async GetSwapAsync(swapId) {
33
+ return await this.AuthenticatedRequest("GET", `/swaps/${swapId}`);
34
+ }
32
35
  async AuthenticatedRequest(method, endpoint, data, header) {
33
36
  let uri = LayerSwapApiClient.apiBaseEndpoint + "/api/v2" + endpoint;
34
37
  return await this._authInterceptor(uri, { method: method, data: data, headers: { 'Access-Control-Allow-Origin': '*', ...(header ? header : {}) } })