@rash2x/bridge-widget 0.3.2 → 0.3.3

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.
@@ -54,7 +54,7 @@ const card = require("@/components/ui/card");
54
54
  const badge = require("@/components/ui/badge");
55
55
  const common$1 = { "connecting": "Connecting…", "initializing": "Initializing...", "loading": "Loading...", "paste": "paste", "close": "Close", "zeroPlaceholder": "0", "nativeToken": "Native Token" };
56
56
  const wallets$1 = { "addTonWallet": "Add TON wallet", "addEvmWallet": "Add EVM wallet", "connectTonWallet": "Connect TON wallet", "connectEvmWallet": "Connect EVM wallet", "initializingMetamask": "Initializing MetaMask SDK...", "initializingTronlink": "Initializing TronLink...", "failedToConnectTon": "Failed to connect to TON wallet", "failedToDisconnect": "Failed to disconnect", "metamaskConnectionError": "MetaMask connection error", "failedToConnectMetamask": "Failed to connect to MetaMask", "failedToDisconnectMetamask": "Failed to disconnect from MetaMask", "selectWallet": "Select Wallet", "tonWallets": "TON", "evmWallets": "EVM", "tronWallets": "TRON", "tonconnect": "TonConnect", "metaMask": "WalletConnect", "tronLink": "TronLink", "addTronWallet": "Add Tron wallet", "comingSoon": "Coming Soon", "connected": "CONNECTED", "disconnect": "Disconnect", "chooseWallet": "Choose wallet", "oneWalletPerEnv": "You can only connect one wallet per environment.", "connect": "Connect", "connectTronWallet": "Connect Tron wallet", "connectWallet": "Connect wallet" };
57
- const bridge$1 = { "max": "Max", "sourceNetwork": "Source network", "destinationNetwork": "Destination network", "selectToken": "Select token", "selectNetwork": "Select network", "searchToken": "Search token", "searchDestinationChain": "Search destination chain", "myTokens": "My tokens", "allTokens": "All tokens", "willChangeSourceChain": "Will change source network", "willChangeSourceNetworkAndToken": "Will change source token", "noBalancesFound": "No balances found.", "noResults": "No results", "sendToAnotherAddress": "Send to another address", "youWillReceive": "You will receive", "anotherAddressPlaceholder": "Address", "addressDoesntMatch": "Address doesn't match the {{network}} network", "checkBeforeTransfer": "Check correctness before transfer" };
57
+ const bridge$1 = { "max": "Max", "sourceNetwork": "Source network", "destinationNetwork": "Destination network", "selectToken": "Select token", "selectNetwork": "Select network", "selectSourceNetwork": "Select source network", "selectDestinationNetwork": "Select destination network", "searchToken": "Search token", "myTokens": "My tokens", "allTokens": "All tokens", "search": "Search", "select": "Select", "willChangeSourceChain": "Will change source network", "willChangeSourceNetworkAndToken": "Will change source token", "noBalancesFound": "No balances found.", "noResults": "No results", "tokenNotFound": "We couldn't find a token with that name or symbol. Please try again.", "chainNotFound": "We couldn't find a chain with that name. Please try again.", "sendToAnotherAddress": "Send to another address", "youWillReceive": "You will receive", "anotherAddressPlaceholder": "Address", "addressDoesntMatch": "Address doesn't match the {{network}} network", "checkBeforeTransfer": "Check correctness before transfer" };
58
58
  const transaction$1 = { "enterAmount": "Enter amount", "transfer": "Transfer", "getQuote": "Get quote", "failed": "Transaction Failed", "confirm": "Confirm transaction", "signTransaction": "Sign in transaction in wallet", "quoting": "Quoting...", "inProgress": "Processing...", "checkingBalance": "Checking balance...", "insufficientBalance": "Insufficient balance", "amountTooSmall": "Min {{min}}", "amountTooLarge": "Max {{max}}", "success": "Success", "successTitle": "Success", "done": "Done", "hashCopied": "Hash copied to clipboard", "bridged": "Bridged", "transferTitle": "Transfer", "hash": "Hash", "finalFee": "Final Fee", "route": "Route", "estTime": "Est. Time", "slippage": "Slippage", "minimumReceived": "Minimum received", "totalFee": "Total Fee", "noRouteFound": "No route found", "notEnoughGas": "Not enough gas", "noRouteFoundForSettings": "No route found for current settings.", "tryAdjustSettings": "Try disabling Gas on Destination, or adjust amount/networks.", "quoteError": "Quote error" };
59
59
  const app$1 = { "stargateWidgetName": "Stargate Bridge Widget", "liveWidget": "Live Widget", "getStarted": "Get Started" };
60
60
  const settings$1 = { "title": "Settings", "gasOnDestination": "Gas on destination", "slippageTolerance": "Slippage tolerance", "routePriority": "Route Priority", "highSlippageWarning": "High slippage warning", "gasPresets": { "auto": "Auto", "none": "None", "medium": "Medium", "max": "Max" }, "routePresets": { "fastest": "Fastest", "cheapest": "Cheapest", "recommended": "Recommended" } };
@@ -70,7 +70,7 @@ const en = {
70
70
  };
71
71
  const common = { "connecting": "Подключение…", "initializing": "Инициализация...", "loading": "Загрузка...", "paste": "вставить", "close": "Закрыть", "zeroPlaceholder": "0", "nativeToken": "Нативный токен" };
72
72
  const wallets = { "addTonWallet": "Добавить TON кошелёк", "addEvmWallet": "Добавить EVM кошелёк", "connectTonWallet": "Подключить TON кошелёк", "connectEvmWallet": "Подключить EVM кошелёк", "initializingMetamask": "Инициализация MetaMask SDK...", "initializingTronlink": "Инициализация TronLink...", "failedToConnectTon": "Не удалось подключиться к TON кошельку", "failedToDisconnect": "Не удалось отключиться", "metamaskConnectionError": "Ошибка подключения MetaMask", "failedToConnectMetamask": "Не удалось подключиться к MetaMask", "failedToDisconnectMetamask": "Не удалось отключиться от MetaMask", "selectWallet": "Выберите кошелёк", "tonWallets": "TON", "evmWallets": "EVM", "tronWallets": "TRON", "tonconnect": "TonConnect", "metaMask": "WalletConnect", "tronLink": "TronLink", "addTronWallet": "Добавить Tron кошелёк", "comingSoon": "Скоро", "connected": "ПОДКЛЮЧЕНО", "disconnect": "Отключить", "chooseWallet": "Выберите кошелёк", "oneWalletPerEnv": "Можно подключить только один кошелёк на окружение.", "connect": "Подключить", "connectTronWallet": "Подключить Tron кошелёк", "connectWallet": "Подключить кошелёк" };
73
- const bridge = { "max": "Макс", "sourceNetwork": "Исходная сеть", "destinationNetwork": "Целевая сеть", "selectToken": "Выбрать токен", "selectNetwork": "Выбрать сеть", "searchToken": "Поиск токена", "searchDestinationChain": "Поиск целевой сети", "myTokens": "Мои токены", "allTokens": "Все токены", "willChangeSourceChain": "Сменит исходную сеть", "willChangeSourceNetworkAndToken": "Сменит исходный токен", "noBalancesFound": "Балансы не найдены.", "noResults": "Нет результатов", "sendToAnotherAddress": "Отправить на другой адрес", "youWillReceive": "Вы получите", "anotherAddressPlaceholder": "Адрес", "addressDoesntMatch": "Адрес не соответствует сети {{network}}", "checkBeforeTransfer": "Проверьте корректность перед переводом" };
73
+ const bridge = { "max": "Макс", "sourceNetwork": "Исходная сеть", "destinationNetwork": "Целевая сеть", "selectToken": "Выбрать токен", "selectNetwork": "Выбрать сеть", "selectSourceNetwork": "Выбрать исходную сеть", "selectDestinationNetwork": "Выбрать целевую сеть", "searchToken": "Поиск токена", "myTokens": "Мои токены", "allTokens": "Все токены", "search": "Поиск", "select": "Выбрать", "willChangeSourceChain": "Сменит исходную сеть", "willChangeSourceNetworkAndToken": "Сменит исходный токен", "noBalancesFound": "Балансы не найдены.", "noResults": "Нет результатов", "tokenNotFound": "Мы не смогли найти токен с таким названием или символом. Пожалуйста, попробуйте снова.", "chainNotFound": "Мы не смогли найти сеть с таким названием. Пожалуйста, попробуйте снова.", "sendToAnotherAddress": "Отправить на другой адрес", "youWillReceive": "Вы получите", "anotherAddressPlaceholder": "Адрес", "addressDoesntMatch": "Адрес не соответствует сети {{network}}", "checkBeforeTransfer": "Проверьте корректность перед переводом" };
74
74
  const transaction = { "enterAmount": "Введите сумму", "transfer": "Перевести", "getQuote": "Получить котировку", "quoting": "Расчет котировки...", "failed": "Ошибка транзакции", "confirm": "Подтвердите транзакцию", "signTransaction": "Подпишите транзакцию в кошельке", "inProgress": "Выполнение...", "checkingBalance": "Проверка баланса...", "insufficientBalance": "Недостаточно средств", "amountTooSmall": "Минимум {{min}}", "amountTooLarge": "Максимум {{max}}", "success": "Успех", "successTitle": "Успех", "done": "Готово", "hashCopied": "Хэш скопирован в буфер обмена", "bridged": "Переведено", "transferTitle": "Перевод", "hash": "Хэш", "finalFee": "Итоговая комиссия", "route": "Маршрут", "estTime": "Время", "slippage": "Проскальзывание", "minimumReceived": "Минимум к получению", "totalFee": "Общая комиссия", "noRouteFound": "Маршрут не найден", "notEnoughGas": "Недостаточно газа", "noRouteFoundForSettings": "Маршрут не найден для текущих настроек.", "tryAdjustSettings": "Попробуйте отключить Gas on Destination или измените сумму/сети.", "quoteError": "Ошибка котировки" };
75
75
  const app = { "stargateWidgetName": "Виджет Stargate Bridge", "liveWidget": "Живой виджет", "getStarted": "Начало работы" };
76
76
  const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "slippageTolerance": "Толерантность к проскальзыванию", "routePriority": "Приоритет маршрута", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрейший", "cheapest": "Дешевейший", "recommended": "Рекомендуемый" } };
@@ -2285,7 +2285,7 @@ const SwapButton = () => {
2285
2285
  variant: "secondary",
2286
2286
  size: "sm",
2287
2287
  className: utils.cn(
2288
- "backdrop-blur-md h-9 w-9",
2288
+ "backdrop-blur-md h-9 w-9 p-0",
2289
2289
  "absolute top-1/2 -translate-y-1/2 left-1/2 -translate-x-1/2",
2290
2290
  !canSwap || isSwapping ? "opacity-50 cursor-not-allowed" : "hover:scale-110"
2291
2291
  ),
@@ -2454,7 +2454,7 @@ const SearchInput = ({
2454
2454
  {
2455
2455
  placeholder,
2456
2456
  className: utils.cn(
2457
- "w-full outline-none px-5 py-4 relative z-10 pl-16 bg-input border-none rounded-xs ring-0 leading-0 h-13 text-base focus-visible:border focus-visible:border-ring",
2457
+ "w-full outline-none px-5 py-4 relative z-10 pl-16 bg-input border transition-all border-transparent rounded-xs ring-0 leading-0 h-13 text-base focus-visible:border focus-visible:border-ring",
2458
2458
  className
2459
2459
  ),
2460
2460
  value,
@@ -2592,7 +2592,7 @@ const ChainSelectModal = ({
2592
2592
  onClick: () => onChainPick(chain, willChangeSrc, willChangeTokenAndSrc),
2593
2593
  className: utils.cn(
2594
2594
  "w-full cursor-pointer flex shadow-none rounded-xs items-center justify-between gap-3 px-5 py-4 h-13 font-semibold capitalize bg-transparent hover:scale-100 hover:bg-accent",
2595
- isSelected ? "bg-accent" : "",
2595
+ isSelected ? "border border-ring" : "",
2596
2596
  willChangeSrc || willChangeTokenAndSrc ? "opacity-50 hover:opacity-100" : ""
2597
2597
  ),
2598
2598
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
@@ -2610,12 +2610,15 @@ const ChainSelectModal = ({
2610
2610
  chain.chainKey
2611
2611
  );
2612
2612
  };
2613
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col p-10", children: [
2614
- /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "text-left", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t("bridge.selectNetwork") }) }),
2613
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col", children: [
2614
+ /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "text-left pb-0", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-xl leading-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0", children: [
2615
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: t("bridge.select") }),
2616
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: t(isSource ? "bridge.sourceNetwork" : "bridge.destinationNetwork") })
2617
+ ] }) }) }),
2615
2618
  /* @__PURE__ */ jsxRuntime.jsx(
2616
2619
  SearchInput,
2617
2620
  {
2618
- placeholder: t("bridge.searchDestinationChain"),
2621
+ placeholder: t("bridge.search"),
2619
2622
  value: query,
2620
2623
  onChange: setQuery,
2621
2624
  className: "text-foreground placeholder:text-muted-foreground"
@@ -2647,7 +2650,7 @@ const ChainSelectModal = ({
2647
2650
  (c) => renderChainItem(c, false, true)
2648
2651
  )
2649
2652
  ] }),
2650
- groupedChains.available.length === 0 && groupedChains.willChangeSrc.length === 0 && groupedChains.willChangeTokenAndSrc.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-5 py-4 text-sm text-muted-foreground", children: t("bridge.noResults") })
2653
+ groupedChains.available.length === 0 && groupedChains.willChangeSrc.length === 0 && groupedChains.willChangeTokenAndSrc.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t("bridge.chainNotFound") })
2651
2654
  ] })
2652
2655
  ] }) });
2653
2656
  };
@@ -2657,6 +2660,52 @@ const useWalletSelectModal = zustand.create((set) => ({
2657
2660
  onOpen: (addressType) => set({ isOpen: true, addressType }),
2658
2661
  onClose: () => set({ isOpen: false, addressType: void 0 })
2659
2662
  }));
2663
+ const EditIcon = (props) => {
2664
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2665
+ "svg",
2666
+ {
2667
+ width: "18",
2668
+ height: "18",
2669
+ viewBox: "0 0 18 18",
2670
+ fill: "none",
2671
+ xmlns: "http://www.w3.org/2000/svg",
2672
+ ...props,
2673
+ children: [
2674
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { "clip-path": "url(#clip0_551_3851)", children: [
2675
+ /* @__PURE__ */ jsxRuntime.jsx(
2676
+ "path",
2677
+ {
2678
+ d: "M9.76159 5.01068L4.91742 9.85489C4.72585 10.0465 4.54793 10.4023 4.50687 10.6622L4.24687 12.5096C4.15108 13.1801 4.61636 13.6454 5.28688 13.5496L7.13425 13.2896C7.39425 13.2486 7.76372 13.0707 7.94161 12.8791L12.7858 8.03491C13.6206 7.20018 14.0174 6.2286 12.7858 4.99702C11.5679 3.77913 10.5963 4.17594 9.76159 5.01068Z",
2679
+ stroke: "currentColor",
2680
+ "stroke-miterlimit": "10",
2681
+ "stroke-linecap": "round",
2682
+ "stroke-linejoin": "round"
2683
+ }
2684
+ ),
2685
+ /* @__PURE__ */ jsxRuntime.jsx(
2686
+ "path",
2687
+ {
2688
+ d: "M9.0625 5.70312C9.47303 7.18102 10.6225 8.33049 12.1004 8.74101",
2689
+ stroke: "currentColor",
2690
+ "stroke-miterlimit": "10",
2691
+ "stroke-linecap": "round",
2692
+ "stroke-linejoin": "round"
2693
+ }
2694
+ )
2695
+ ] }),
2696
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_551_3851", children: /* @__PURE__ */ jsxRuntime.jsx(
2697
+ "rect",
2698
+ {
2699
+ width: "12",
2700
+ height: "12",
2701
+ fill: "white",
2702
+ transform: "translate(3 3)"
2703
+ }
2704
+ ) }) })
2705
+ ]
2706
+ }
2707
+ );
2708
+ };
2660
2709
  const prefixIcons = {
2661
2710
  tronlink: /* @__PURE__ */ jsxRuntime.jsx(TronLinkIcon, { className: "w-5 h-5" }),
2662
2711
  metamask: /* @__PURE__ */ jsxRuntime.jsx(MetaMaskIcon, { className: "w-5 h-5" }),
@@ -2714,7 +2763,8 @@ const WalletInlineButton = ({
2714
2763
  className: "flex gap-1 cursor-pointer hover:opacity-60 hover:bg-transparent !px-0 pr-1 h-5",
2715
2764
  children: [
2716
2765
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: isConnected ? prefixIcons[wallet] : null }),
2717
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-3 text-sm border-b border-dotted border-link text-link", children: buttonText })
2766
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-3 text-sm border-b border-dotted border-link text-link", children: buttonText }),
2767
+ isConnected && /* @__PURE__ */ jsxRuntime.jsx(EditIcon, { className: "text-link -ml-0.5" })
2718
2768
  ]
2719
2769
  }
2720
2770
  ),
@@ -3130,12 +3180,12 @@ const Details = () => {
3130
3180
  );
3131
3181
  const symbol = (selectedAssetSymbol ?? dstToken?.symbol ?? "—").toUpperCase();
3132
3182
  const isLoading = status === "loading";
3133
- const receiveText = quoteDetails.outputAmount != null ? Number(quoteDetails.outputAmount).toFixed(6) : "0.00";
3183
+ const receiveText = quoteDetails.outputAmount != null ? Number(quoteDetails.outputAmount).toFixed(quote ? 6 : 2) : "0.00";
3134
3184
  const etaText = quoteDetails.etaSeconds != null ? `≈ ${Math.max(1, Math.round(quoteDetails.etaSeconds / 60))}m` : "—";
3135
- const totalFeeDisplay = gas.requiredNative > 0 ? `${gas.requiredNative.toFixed(6)} ${gas.nativeSym}` : "—";
3136
- const currentSlippageText = formatPercentage(slippageBps);
3185
+ const totalFeeDisplay = !quote ? "—" : gas.requiredNative > 0 ? `${gas.requiredNative.toFixed(6)} ${gas.nativeSym}` : "—";
3186
+ const currentSlippageText = !quote ? "—" : formatPercentage(slippageBps);
3137
3187
  const routeText = quote?.route ? getRouteDisplayName(quote.route) : t(`settings.routePresets.${routePriority}`);
3138
- return /* @__PURE__ */ jsxRuntime.jsx(accordion.Accordion, { type: "single", collapsible: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(accordion.AccordionItem, { value: "item-1", className: "bg-muted/50 rounded-sm", children: [
3188
+ return /* @__PURE__ */ jsxRuntime.jsx(accordion.Accordion, { type: "single", collapsible: true, className: "w-full border-b-0", children: /* @__PURE__ */ jsxRuntime.jsxs(accordion.AccordionItem, { value: "item-1", className: "bg-card/50 rounded-sm", children: [
3139
3189
  /* @__PURE__ */ jsxRuntime.jsx(accordion.AccordionTrigger, { className: "w-full gap-1 items-center py-6 px-5 rounded-b-sm data-[state=open]:pb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex items-center justify-between", children: [
3140
3190
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-normal text-priority leading-4", children: t("bridge.youWillReceive", { defaultValue: "You will receive" }) }),
3141
3191
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-transparent hover:bg-transparent shadow-none h-4 p-0 px-0 py-0 flex items-center gap-2", children: [
@@ -3831,7 +3881,6 @@ const SubmitButton = () => {
3831
3881
  }
3832
3882
  ) });
3833
3883
  };
3834
- const buttonBaseClasses = "w-full bg-transparent flex shadow-none items-center justify-start gap-3 px-3 py-3 h-auto rounded-md hover:bg-accent hover:scale-100";
3835
3884
  const WalletModalButton = (props) => {
3836
3885
  const { t } = reactI18next.useTranslation();
3837
3886
  const { icon: IconComponent, name, onClose } = props;
@@ -3840,24 +3889,33 @@ const WalletModalButton = (props) => {
3840
3889
  const [isConnecting, setIsConnecting] = react.useState(false);
3841
3890
  if (props.variant === "connected") {
3842
3891
  const { address, onDisconnect } = props;
3843
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mx-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: buttonBaseClasses, children: [
3844
- /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "min-w-8 min-h-8" }),
3845
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start min-w-0", children: [
3846
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-foreground text-sm leading-4 truncate", children: formatAddress(address) }),
3847
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs leading-3 font-semibold text-muted-foreground", children: name })
3848
- ] }),
3849
- /* @__PURE__ */ jsxRuntime.jsx(
3850
- "div",
3851
- {
3852
- onClick: () => {
3853
- onDisconnect();
3854
- onClose?.();
3855
- },
3856
- className: "text-sm ml-auto font-medium text-muted-foreground cursor-pointer hover:text-foreground transition-colors",
3857
- children: /* @__PURE__ */ jsxRuntime.jsx(ExitIcon, { className: "w-6 h-6" })
3858
- }
3859
- )
3860
- ] }) });
3892
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mx-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
3893
+ "div",
3894
+ {
3895
+ className: utils.cn(
3896
+ button.buttonVariants({ variant: "ghost", size: "default" }),
3897
+ "rounded-xs w-full"
3898
+ ),
3899
+ children: [
3900
+ /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "min-w-8 min-h-8" }),
3901
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start min-w-0", children: [
3902
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-foreground text-sm leading-4 truncate", children: formatAddress(address) }),
3903
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs leading-3 font-medium text-muted-foreground", children: name })
3904
+ ] }),
3905
+ /* @__PURE__ */ jsxRuntime.jsx(
3906
+ "div",
3907
+ {
3908
+ onClick: () => {
3909
+ onDisconnect();
3910
+ onClose?.();
3911
+ },
3912
+ className: "text-sm ml-auto font-medium text-muted-foreground cursor-pointer hover:text-foreground transition-colors",
3913
+ children: /* @__PURE__ */ jsxRuntime.jsx(ExitIcon, { className: "w-6 h-6" })
3914
+ }
3915
+ )
3916
+ ]
3917
+ }
3918
+ ) });
3861
3919
  }
3862
3920
  const { walletId, connector } = props;
3863
3921
  const handleConnect = async () => {
@@ -3885,14 +3943,15 @@ const WalletModalButton = (props) => {
3885
3943
  button.Button,
3886
3944
  {
3887
3945
  type: "button",
3946
+ variant: "ghost",
3888
3947
  onClick: handleConnect,
3889
3948
  disabled: isDisabled,
3890
- className: `${buttonBaseClasses} cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,
3949
+ className: `w-full rounded-xs flex justify-start gap-3`,
3891
3950
  children: [
3892
3951
  /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "min-w-8 min-h-8" }),
3893
3952
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start min-w-0", children: [
3894
3953
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-foreground text-sm leading-4 truncate", children: name }),
3895
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs leading-3 font-semibold text-muted-foreground", children: t("wallets.connect") })
3954
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs leading-3 font-medium text-muted-foreground", children: t("wallets.connect") })
3896
3955
  ] })
3897
3956
  ]
3898
3957
  }
@@ -3990,14 +4049,14 @@ const WalletSelectModal = () => {
3990
4049
  wallets: tronWallets.filter(notConnected)
3991
4050
  }
3992
4051
  ].filter((category) => category.wallets.length > 0);
3993
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "p-10", children: [
4052
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { children: [
3994
4053
  /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogHeader, { className: "text-left", children: [
3995
4054
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t("wallets.chooseWallet") }),
3996
4055
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogDescription, { children: t("wallets.oneWalletPerEnv") })
3997
4056
  ] }),
3998
4057
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
3999
4058
  connectedWallets.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4000
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 font-semibold text-muted-foreground uppercase", children: t("wallets.connected") }),
4059
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 text-muted-foreground uppercase", children: t("wallets.connected") }),
4001
4060
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: connectedWallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsx(
4002
4061
  WalletModalButton,
4003
4062
  {
@@ -4012,7 +4071,7 @@ const WalletSelectModal = () => {
4012
4071
  )) })
4013
4072
  ] }),
4014
4073
  categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4015
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 font-semibold text-muted-foreground uppercase", children: category.title }),
4074
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 text-muted-foreground uppercase", children: category.title }),
4016
4075
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mx-3", children: category.wallets.map((wallet) => {
4017
4076
  const isEvmConnector = category.title === t("wallets.evmWallets");
4018
4077
  const connector = isEvmConnector ? connectors.find((c) => c.id === wallet.id) : void 0;
@@ -6069,7 +6128,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6069
6128
  );
6070
6129
  const activeBtn = "bg-primary hover:bg-primary/80 text-primary-foreground transition-colors";
6071
6130
  const notActiveBtn = "bg-accent hover:bg-accent/80 text-accent-foreground transition-colors";
6072
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { onOpenAutoFocus: (e) => e.preventDefault(), className: "p-10", children: [
6131
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { onOpenAutoFocus: (e) => e.preventDefault(), children: [
6073
6132
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "text-left", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t("settings.title") }) }),
6074
6133
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-5", children: [
6075
6134
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
@@ -6174,7 +6233,7 @@ const TokenRow = ({
6174
6233
  button.Button,
6175
6234
  {
6176
6235
  onClick: onPick,
6177
- className: `w-full px-5 rounded-xs bg-transparent flex items-center justify-between gap-3 hover:bg-accent hover:scale-100 ${isSelected ? "bg-accent hover:bg-accent/50" : ""}`,
6236
+ className: `w-full px-5 rounded-xs bg-transparent flex items-center justify-between gap-3 hover:bg-accent hover:scale-100 ${isSelected ? "border border-ring" : ""}`,
6178
6237
  children: [
6179
6238
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
6180
6239
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -6210,6 +6269,7 @@ const TokenSelectModal = ({
6210
6269
  const { t } = useBridgeTranslation();
6211
6270
  const [query, setQuery] = react.useState("");
6212
6271
  const [tab, setTab] = react.useState("my");
6272
+ const [manualTabSwitch, setManualTabSwitch] = react.useState(false);
6213
6273
  const { srcAddress } = useAddresses();
6214
6274
  const { fromChain, setFromChain, chains } = useChainsStore();
6215
6275
  const { assetMatrix, selectedAssetSymbol } = useTokensStore();
@@ -6291,9 +6351,23 @@ const TokenSelectModal = ({
6291
6351
  () => groupedTokens.withBalance,
6292
6352
  [groupedTokens.withBalance]
6293
6353
  );
6354
+ react.useEffect(() => {
6355
+ if (query.trim() !== "" && tab === "my" && myTokens.length === 0 && !manualTabSwitch) {
6356
+ setTab("all");
6357
+ }
6358
+ }, [query, tab, myTokens.length, manualTabSwitch]);
6359
+ react.useEffect(() => {
6360
+ if (query.trim() !== "" && tab === "all" && myTokens.length > 0 && !manualTabSwitch) {
6361
+ setTab("my");
6362
+ }
6363
+ }, [query, tab, myTokens.length, manualTabSwitch]);
6364
+ react.useEffect(() => {
6365
+ setManualTabSwitch(false);
6366
+ }, [query]);
6294
6367
  const resetState = react.useCallback(() => {
6295
6368
  setQuery("");
6296
6369
  setTab("my");
6370
+ setManualTabSwitch(false);
6297
6371
  }, []);
6298
6372
  const handleClose = react.useCallback(() => {
6299
6373
  resetState();
@@ -6338,7 +6412,7 @@ const TokenSelectModal = ({
6338
6412
  [groupedTokens.willChangeSrcChain]
6339
6413
  );
6340
6414
  const hasNoResults = tokensToRender.length === 0 && willChangeSrcTokens.length === 0;
6341
- return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col p-10", children: [
6415
+ return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col", children: [
6342
6416
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "text-left", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t("bridge.selectToken") }) }),
6343
6417
  /* @__PURE__ */ jsxRuntime.jsx(
6344
6418
  SearchInput,
@@ -6353,9 +6427,15 @@ const TokenSelectModal = ({
6353
6427
  button.Button,
6354
6428
  {
6355
6429
  variant: tab === "my" ? "default" : "ghost",
6356
- onClick: () => setTab("my"),
6430
+ onClick: () => {
6431
+ setTab("my");
6432
+ setManualTabSwitch(true);
6433
+ },
6357
6434
  size: "sm",
6358
- className: utils.cn("px-4", tab !== "my" && "bg-muted hover:bg-accent"),
6435
+ className: utils.cn(
6436
+ "px-4 cursor-pointer",
6437
+ tab !== "my" && "bg-muted hover:bg-accent"
6438
+ ),
6359
6439
  children: t("bridge.myTokens")
6360
6440
  }
6361
6441
  ),
@@ -6363,17 +6443,20 @@ const TokenSelectModal = ({
6363
6443
  button.Button,
6364
6444
  {
6365
6445
  variant: tab === "all" ? "default" : "ghost",
6366
- onClick: () => setTab("all"),
6446
+ onClick: () => {
6447
+ setTab("all");
6448
+ setManualTabSwitch(true);
6449
+ },
6367
6450
  size: "sm",
6368
6451
  className: utils.cn(
6369
- "px-4",
6452
+ "px-4 cursor-pointer",
6370
6453
  tab !== "all" && "bg-muted hover:bg-accent"
6371
6454
  ),
6372
6455
  children: t("bridge.allTokens")
6373
6456
  }
6374
6457
  )
6375
6458
  ] }),
6376
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto -mx-5", children: hasNoResults ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground px-5 py-4", children: t("bridge.noResults") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6459
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto -mx-5", children: hasNoResults ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t("bridge.tokenNotFound") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6377
6460
  effectiveTab === "my" && myTokens.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "leading-4 px-5 text-base text-muted-foreground uppercase py-2", children: t("bridge.noBalancesFound") }),
6378
6461
  tokensToRender.map(({ token, willChangeSrc }) => {
6379
6462
  const bal = getBalance(token.symbol);
@@ -6590,6 +6673,45 @@ const Toolbar = () => {
6590
6673
  /* @__PURE__ */ jsxRuntime.jsx(SettingsModal, { isOpen: isOpenSettings, onClose: onCloseSettings })
6591
6674
  ] });
6592
6675
  };
6676
+ const useAutoSelectNetwork = ({
6677
+ tonAddress,
6678
+ tronConnected,
6679
+ evmIsConnected
6680
+ }) => {
6681
+ const { hasAnyWallet } = useConnectedWalletsStore();
6682
+ const { chains, setFromChain } = useChainsStore();
6683
+ const previousHadWallet = react.useRef(hasAnyWallet());
6684
+ react.useEffect(() => {
6685
+ const currentHasWallet = hasAnyWallet();
6686
+ const isFirstWalletConnection = !previousHadWallet.current && currentHasWallet;
6687
+ if (isFirstWalletConnection && chains?.length) {
6688
+ let targetChainKey = null;
6689
+ if (tonAddress) {
6690
+ targetChainKey = "ton";
6691
+ } else if (tronConnected) {
6692
+ targetChainKey = "tron";
6693
+ } else if (evmIsConnected) {
6694
+ targetChainKey = "ethereum";
6695
+ }
6696
+ if (targetChainKey) {
6697
+ const matchingChain = chains.find(
6698
+ (chain) => chain.chainKey.toLowerCase() === targetChainKey
6699
+ );
6700
+ if (matchingChain) {
6701
+ setFromChain(matchingChain);
6702
+ }
6703
+ }
6704
+ }
6705
+ previousHadWallet.current = currentHasWallet;
6706
+ }, [
6707
+ tonAddress,
6708
+ tronConnected,
6709
+ evmIsConnected,
6710
+ hasAnyWallet,
6711
+ chains,
6712
+ setFromChain
6713
+ ]);
6714
+ };
6593
6715
  const EvaaBridgeWithProviders = (props) => {
6594
6716
  const [tonConnectUI] = uiReact.useTonConnectUI();
6595
6717
  const tonAddress = uiReact.useTonAddress();
@@ -6614,6 +6736,11 @@ const EvaaBridgeWithProviders = (props) => {
6614
6736
  react.useEffect(() => {
6615
6737
  setTronConnected(!!tronConnected);
6616
6738
  }, [tronConnected, setTronConnected]);
6739
+ useAutoSelectNetwork({
6740
+ tonAddress,
6741
+ tronConnected,
6742
+ evmIsConnected
6743
+ });
6617
6744
  return /* @__PURE__ */ jsxRuntime.jsx(BridgeI18nProvider, { defaultLanguage: props.defaultLanguage, children: /* @__PURE__ */ jsxRuntime.jsx(
6618
6745
  ChainStrategyProvider,
6619
6746
  {