@rash2x/bridge-widget 0.6.17 → 0.6.20

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.
@@ -25,14 +25,14 @@ const accordion = require("@/components/ui/accordion");
25
25
  const tooltip = require("@/components/ui/tooltip");
26
26
  const alert = require("@/components/ui/alert");
27
27
  const sonner = require("sonner");
28
+ const badge = require("@/components/ui/badge");
28
29
  const reactDialog = require("@radix-ui/react-dialog");
29
30
  const viem = require("viem");
30
31
  const tronwalletAdapters = require("@tronweb3/tronwallet-adapters");
31
32
  const tronweb = require("tronweb");
32
33
  const card = require("@/components/ui/card");
33
- const badge = require("@/components/ui/badge");
34
34
  const common$1 = { "connecting": "Connecting…", "initializing": "Initializing...", "loading": "Loading...", "paste": "paste", "close": "Close", "zeroPlaceholder": "0", "nativeToken": "Native Token" };
35
- 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", "walletConnect": "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" };
35
+ 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", "walletConnect": "WalletConnect", "tronLink": "TronLink", "addTronWallet": "Add Tron wallet", "comingSoon": "Coming Soon", "connected": "CONNECTED", "connectedStatus": "Connected", "disconnect": "Disconnect", "chooseWallet": "Connect wallet", "oneWalletPerEnv": "You can only connect one wallet per environment.", "connect": "Connect", "connectTronWallet": "Connect Tron wallet", "connectWallet": "Connect wallet" };
36
36
  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" };
37
37
  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" };
38
38
  const telegram$1 = { "openWebVersion": "Open EVAA Web to Bridge", "restrictionMessage": "You can bridge between the chosen networks on EVAA web version" };
@@ -50,7 +50,7 @@ const en$3 = {
50
50
  errors: errors$1
51
51
  };
52
52
  const common = { "connecting": "Подключение…", "initializing": "Инициализация...", "loading": "Загрузка...", "paste": "вставить", "close": "Закрыть", "zeroPlaceholder": "0", "nativeToken": "Нативный токен" };
53
- 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", "walletConnect": "WalletConnect", "tronLink": "TronLink", "addTronWallet": "Добавить Tron кошелёк", "comingSoon": "Скоро", "connected": "ПОДКЛЮЧЕНО", "disconnect": "Отключить", "chooseWallet": "Выберите кошелёк", "oneWalletPerEnv": "Можно подключить только один кошелёк на окружение.", "connect": "Подключить", "connectTronWallet": "Подключить Tron кошелёк", "connectWallet": "Подключить кошелёк" };
53
+ 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", "walletConnect": "WalletConnect", "tronLink": "TronLink", "addTronWallet": "Добавить Tron кошелёк", "comingSoon": "Скоро", "connected": "ПОДКЛЮЧЕНО", "connectedStatus": "Подключён", "disconnect": "Отключить", "chooseWallet": "Подключите кошелек", "oneWalletPerEnv": "Можно подключить только один кошелёк на окружение.", "connect": "Подключить", "connectTronWallet": "Подключить Tron кошелёк", "connectWallet": "Подключить кошелёк" };
54
54
  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": "Проверьте корректность перед переводом" };
55
55
  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": "Ошибка котировки" };
56
56
  const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
@@ -2379,6 +2379,7 @@ const TokenInput = react.forwardRef(
2379
2379
  className,
2380
2380
  max,
2381
2381
  readOnly,
2382
+ error,
2382
2383
  ...rest
2383
2384
  }, ref) => {
2384
2385
  const [inputVal, setInputVal] = react.useState(value ?? "");
@@ -2396,10 +2397,15 @@ const TokenInput = react.forwardRef(
2396
2397
  [max, onAmountChange]
2397
2398
  );
2398
2399
  if (showSkeleton && readOnly) {
2399
- return /* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: utils$1.cn("h-8 my-2 w-1/3 bg-secondary rounded-md", className) });
2400
+ return /* @__PURE__ */ jsxRuntime.jsx(
2401
+ skeleton.Skeleton,
2402
+ {
2403
+ className: utils$1.cn("h-8 my-2 w-1/3 bg-secondary rounded-md", className)
2404
+ }
2405
+ );
2400
2406
  }
2401
2407
  const { onBlur: restOnBlur, ...restWithoutOnBlur } = rest;
2402
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
2408
+ return /* @__PURE__ */ jsxRuntime.jsx(
2403
2409
  input.Input,
2404
2410
  {
2405
2411
  ref,
@@ -2412,6 +2418,7 @@ const TokenInput = react.forwardRef(
2412
2418
  readOnly,
2413
2419
  className: utils$1.cn(
2414
2420
  "text-4xl h-12 font-medium leading-9 rounded-none text-end bg-transparent dark:bg-transparent text-foreground shadow-none border-none outline-none ring-0 focus:outline-none focus-visible:ring-0 focus-visible:outline-0 focus-visible:ring-offset-0",
2421
+ error ? "text-destructive placeholder:text-destructive/70" : "",
2415
2422
  className
2416
2423
  ),
2417
2424
  max,
@@ -2421,7 +2428,7 @@ const TokenInput = react.forwardRef(
2421
2428
  onAmountBlur?.();
2422
2429
  }
2423
2430
  }
2424
- ) });
2431
+ );
2425
2432
  }
2426
2433
  );
2427
2434
  TokenInput.displayName = "TokenInput";
@@ -2795,6 +2802,7 @@ const SwapSection = ({
2795
2802
  const { isOpen, onClose, onOpen } = useModal();
2796
2803
  const { assetMatrix, selectedAssetSymbol } = useTokensStore();
2797
2804
  const { status } = useBridgeQuoteStore();
2805
+ const { t: t2 } = useBridgeTranslation();
2798
2806
  const [isFocused, setIsFocused] = react.useState(false);
2799
2807
  const tokenOnThisChain = react.useMemo(
2800
2808
  () => resolveTokenOnChainFromMatrix(
@@ -2811,6 +2819,7 @@ const SwapSection = ({
2811
2819
  return formatUsd(amt * priceUsd);
2812
2820
  }, [amount, priceUsd]);
2813
2821
  const isUsdLoading = Boolean(amount && parseFloat(amount) > 0 && !priceUsd);
2822
+ const isInsufficientBalance = !!(amount && balance.balance && parseFloat(amount) > balance.balance);
2814
2823
  const onChangeChain = react.useCallback(
2815
2824
  (c2) => {
2816
2825
  onSelect?.(c2);
@@ -2866,7 +2875,8 @@ const SwapSection = ({
2866
2875
  showSkeleton: status === "loading",
2867
2876
  className: "p-0",
2868
2877
  onFocus: () => setIsFocused(true),
2869
- onBlur: () => setIsFocused(false)
2878
+ onBlur: () => setIsFocused(false),
2879
+ error: isInsufficientBalance
2870
2880
  }
2871
2881
  )
2872
2882
  ] }),
@@ -2878,7 +2888,7 @@ const SwapSection = ({
2878
2888
  addressType: isSource ? "src" : "dst"
2879
2889
  }
2880
2890
  ),
2881
- isUsdLoading ? /* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-4 w-12 rounded-md" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-5 text-sm font-medium text-muted-foreground", children: computedFiat })
2891
+ amount && balance.balance && parseFloat(amount) > balance.balance ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-5 text-sm font-medium text-destructive", children: t2("transaction.insufficientBalance") }) : isUsdLoading ? /* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-4 w-12 rounded-md" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-5 text-sm font-medium text-muted-foreground", children: computedFiat })
2882
2892
  ] })
2883
2893
  ]
2884
2894
  }
@@ -4017,12 +4027,12 @@ const WalletModalButton = (props) => {
4017
4027
  const [isConnecting, setIsConnecting] = react.useState(false);
4018
4028
  if (props.variant === "connected") {
4019
4029
  const { address, onDisconnect } = props;
4020
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mx-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
4030
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4021
4031
  "div",
4022
4032
  {
4023
4033
  className: utils$1.cn(
4024
4034
  button.buttonVariants({ variant: "ghost", size: "default" }),
4025
- "rounded-xs w-full !hover:scale-100 !px-3 !gap-3"
4035
+ "rounded-xs w-full !hover:scale-100 !px-3 !gap-3 flex items-center justify-start"
4026
4036
  ),
4027
4037
  children: [
4028
4038
  /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "min-w-8 min-h-8" }),
@@ -4030,20 +4040,24 @@ const WalletModalButton = (props) => {
4030
4040
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-foreground text-sm leading-4 truncate", children: formatAddress(address) }),
4031
4041
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs leading-3 font-medium text-muted-foreground", children: name })
4032
4042
  ] }),
4033
- /* @__PURE__ */ jsxRuntime.jsx(
4034
- "div",
4035
- {
4036
- onClick: () => {
4037
- onDisconnect();
4038
- onClose?.();
4039
- },
4040
- className: "text-sm ml-auto font-medium text-muted-foreground cursor-pointer hover:text-foreground transition-colors",
4041
- children: /* @__PURE__ */ jsxRuntime.jsx(ExitIcon, { className: "w-6 h-6" })
4042
- }
4043
- )
4043
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 ml-auto", children: [
4044
+ /* @__PURE__ */ jsxRuntime.jsx(badge.Badge, { variant: "default", className: "bg-success/10 text-success h-7 px-2", children: t2("wallets.connectedStatus") }),
4045
+ /* @__PURE__ */ jsxRuntime.jsx(
4046
+ "button",
4047
+ {
4048
+ type: "button",
4049
+ onClick: () => {
4050
+ onDisconnect();
4051
+ onClose?.();
4052
+ },
4053
+ className: "text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
4054
+ children: /* @__PURE__ */ jsxRuntime.jsx(ExitIcon, { className: "w-6 h-6" })
4055
+ }
4056
+ )
4057
+ ] })
4044
4058
  ]
4045
4059
  }
4046
- ) });
4060
+ );
4047
4061
  }
4048
4062
  const { walletId, connector } = props;
4049
4063
  const handleConnect = async () => {
@@ -4103,42 +4117,37 @@ const WalletSelectModal = () => {
4103
4117
  const tronWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.TRON);
4104
4118
  const tronConnections = tronWallet?.getAvailableConnections() ?? [];
4105
4119
  const isTronConnected = tronWallet?.isConnected() ?? false;
4106
- const walletConfigs = [
4107
- {
4108
- strategy: tonWallet,
4109
- walletId: "ton",
4120
+ const tonConnectedWallets = [];
4121
+ const tonAccount = tonWallet?.getAccount();
4122
+ if (tonWallet?.isConnected() && tonAccount) {
4123
+ tonConnectedWallets.push({
4124
+ id: "ton",
4110
4125
  name: t2("wallets.tonconnect"),
4111
- icon: TonConnectIcon
4112
- },
4113
- {
4114
- strategy: metaMaskWallet,
4115
- walletId: "metamask",
4116
- name: t2("wallets.metaMask"),
4117
- icon: MetaMaskIcon
4118
- }
4119
- ];
4120
- const connectedWallets = walletConfigs.reduce((acc, { strategy, walletId, name, icon }) => {
4121
- if (walletId === "metamask" && evmAddress && connectedConnector) {
4122
- return acc;
4123
- }
4124
- const account = strategy?.getAccount();
4125
- if (strategy?.isConnected() && account) {
4126
- acc.push({
4127
- id: walletId,
4128
- name,
4129
- icon,
4130
- address: account,
4131
- onDisconnect: () => strategy.disconnect()
4126
+ icon: TonConnectIcon,
4127
+ address: tonAccount,
4128
+ onDisconnect: () => tonWallet?.disconnect()
4129
+ });
4130
+ }
4131
+ const evmConnectedWallets = [];
4132
+ const hasWagmiEvmConnection = !!evmAddress && !!connectedConnector;
4133
+ if (!hasWagmiEvmConnection) {
4134
+ const evmAccount = metaMaskWallet?.getAccount();
4135
+ if (metaMaskWallet?.isConnected() && evmAccount) {
4136
+ evmConnectedWallets.push({
4137
+ id: "metamask",
4138
+ name: t2("wallets.metaMask"),
4139
+ icon: MetaMaskIcon,
4140
+ address: evmAccount,
4141
+ onDisconnect: () => metaMaskWallet?.disconnect()
4132
4142
  });
4133
4143
  }
4134
- return acc;
4135
- }, []);
4144
+ }
4136
4145
  if (evmAddress && connectedConnector) {
4137
4146
  const iconMap = {
4138
4147
  metaMaskSDK: MetaMaskIcon,
4139
4148
  walletConnect: WalletConnectIcon
4140
4149
  };
4141
- connectedWallets.push({
4150
+ evmConnectedWallets.push({
4142
4151
  id: connectedConnector.id,
4143
4152
  name: connectedConnector.name,
4144
4153
  icon: iconMap[connectedConnector.id] || WalletConnectIcon,
@@ -4146,10 +4155,11 @@ const WalletSelectModal = () => {
4146
4155
  onDisconnect: () => metaMaskWallet?.disconnect()
4147
4156
  });
4148
4157
  }
4158
+ const tronConnectedWallets = [];
4149
4159
  tronConnections.forEach((connection) => {
4150
4160
  if (!connection.connected || !connection.address) return;
4151
4161
  const isWalletConnect = connection.provider === "walletconnect";
4152
- connectedWallets.push({
4162
+ tronConnectedWallets.push({
4153
4163
  id: isWalletConnect ? "tronwc" : "tronlink",
4154
4164
  name: isWalletConnect ? t2("wallets.walletConnect") : t2("wallets.tronLink"),
4155
4165
  icon: isWalletConnect ? WalletConnectIcon : TronLinkIcon,
@@ -4157,19 +4167,7 @@ const WalletSelectModal = () => {
4157
4167
  onDisconnect: () => tronWallet?.disconnect({ provider: connection.provider })
4158
4168
  });
4159
4169
  });
4160
- const isWalletConnected = (walletId) => {
4161
- const isEvmConnector = connectors.some((c2) => c2.id === walletId);
4162
- if (isEvmConnector && metaMaskWallet?.isConnected()) {
4163
- return true;
4164
- }
4165
- if ((walletId === "tronwc" || walletId === "tronlink") && tronConnections.some(
4166
- (conn) => conn.connected && (walletId === "tronwc" ? conn.provider === "walletconnect" : conn.provider !== "walletconnect")
4167
- )) {
4168
- return true;
4169
- }
4170
- return connectedWallets.some((w2) => w2.id === walletId);
4171
- };
4172
- const tonWallets = [
4170
+ const tonWallets = tonConnectedWallets.length ? [] : [
4173
4171
  {
4174
4172
  id: "ton",
4175
4173
  name: t2("wallets.tonconnect"),
@@ -4177,7 +4175,7 @@ const WalletSelectModal = () => {
4177
4175
  enabled: true
4178
4176
  }
4179
4177
  ];
4180
- const evmWallets = connectors.filter(
4178
+ const evmWallets = evmConnectedWallets.length > 0 ? [] : connectors.filter(
4181
4179
  (connector) => connector.id === "walletConnect" || connector.id === "metaMaskSDK"
4182
4180
  ).map((connector) => ({
4183
4181
  id: connector.id,
@@ -4185,7 +4183,7 @@ const WalletSelectModal = () => {
4185
4183
  icon: connector.id === "metaMaskSDK" ? MetaMaskIcon : WalletConnectIcon,
4186
4184
  enabled: true
4187
4185
  }));
4188
- const tronWallets = isTronConnected ? [] : [
4186
+ const tronWallets = tronConnectedWallets.length > 0 || isTronConnected ? [] : [
4189
4187
  {
4190
4188
  id: "tronlink",
4191
4189
  name: t2("wallets.tronLink"),
@@ -4199,30 +4197,44 @@ const WalletSelectModal = () => {
4199
4197
  enabled: true
4200
4198
  }
4201
4199
  ];
4202
- const notConnected = (w2) => !isWalletConnected(w2.id);
4203
4200
  const categories = [
4204
4201
  {
4205
4202
  title: t2("wallets.tonWallets"),
4206
- wallets: tonWallets.filter(notConnected)
4203
+ connectedWallets: tonConnectedWallets,
4204
+ wallets: tonWallets,
4205
+ order: 0
4207
4206
  },
4208
4207
  {
4209
4208
  title: t2("wallets.evmWallets"),
4210
- wallets: evmWallets.filter(notConnected)
4209
+ connectedWallets: evmConnectedWallets,
4210
+ wallets: evmWallets,
4211
+ order: 1
4211
4212
  },
4212
4213
  {
4213
4214
  title: t2("wallets.tronWallets"),
4214
- wallets: tronWallets.filter(notConnected)
4215
- }
4216
- ].filter((category) => category.wallets.length > 0);
4215
+ connectedWallets: tronConnectedWallets,
4216
+ wallets: tronWallets,
4217
+ order: 2
4218
+ }
4219
+ ].filter(
4220
+ (category) => category.wallets.length > 0 || category.connectedWallets.length > 0
4221
+ ).sort((a2, b2) => {
4222
+ const aHasConnected = a2.connectedWallets.length > 0;
4223
+ const bHasConnected = b2.connectedWallets.length > 0;
4224
+ if (aHasConnected !== bHasConnected) {
4225
+ return Number(bHasConnected) - Number(aHasConnected);
4226
+ }
4227
+ return a2.order - b2.order;
4228
+ });
4217
4229
  return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "p-10 pt-7", children: [
4218
4230
  /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogHeader, { className: "text-left", children: [
4219
4231
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t2("wallets.chooseWallet") }),
4220
4232
  /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogDescription, { children: t2("wallets.oneWalletPerEnv") })
4221
4233
  ] }),
4222
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
4223
- connectedWallets.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4224
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 text-muted-foreground uppercase", children: t2("wallets.connected") }),
4225
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: connectedWallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsx(
4234
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4235
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 text-muted-foreground uppercase", children: category.title }),
4236
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "-mx-3 space-y-2", children: [
4237
+ category.connectedWallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsx(
4226
4238
  WalletModalButton,
4227
4239
  {
4228
4240
  variant: "connected",
@@ -4233,11 +4245,8 @@ const WalletSelectModal = () => {
4233
4245
  onClose
4234
4246
  },
4235
4247
  wallet.id
4236
- )) })
4237
- ] }),
4238
- categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4239
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-1 text-muted-foreground uppercase", children: category.title }),
4240
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mx-3", children: category.wallets.map((wallet) => {
4248
+ )),
4249
+ category.wallets.map((wallet) => {
4241
4250
  const isEvmConnector = category.title === t2("wallets.evmWallets");
4242
4251
  const connector = isEvmConnector ? connectors.find((c2) => c2.id === wallet.id) : void 0;
4243
4252
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4252,9 +4261,9 @@ const WalletSelectModal = () => {
4252
4261
  },
4253
4262
  wallet.id
4254
4263
  );
4255
- }) })
4256
- ] }, category.title))
4257
- ] })
4264
+ })
4265
+ ] })
4266
+ ] }, category.title)) })
4258
4267
  ] }) });
4259
4268
  };
4260
4269
  const ProgressStep = ({
@@ -4486,10 +4495,10 @@ const StatusStepsDialog = ({
4486
4495
  step = /* @__PURE__ */ jsxRuntime.jsx(ProgressStep, { icon: icons?.progress });
4487
4496
  }
4488
4497
  if (status === "completed") {
4489
- step = /* @__PURE__ */ jsxRuntime.jsx(FailedStep, { icon: icons?.failed });
4498
+ step = /* @__PURE__ */ jsxRuntime.jsx(SuccessStep, { icon: icons?.success });
4490
4499
  }
4491
4500
  if (status === "failed") {
4492
- step = /* @__PURE__ */ jsxRuntime.jsx(SuccessStep, { icon: icons?.success });
4501
+ step = /* @__PURE__ */ jsxRuntime.jsx(FailedStep, { icon: icons?.failed });
4493
4502
  }
4494
4503
  return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: true, onOpenChange: () => reset(), children: step });
4495
4504
  };
@@ -25938,7 +25947,7 @@ class WalletConnectModal {
25938
25947
  }
25939
25948
  async initUi() {
25940
25949
  if (typeof window !== "undefined") {
25941
- await Promise.resolve().then(() => require("./index-C8tcwNkl.cjs"));
25950
+ await Promise.resolve().then(() => require("./index-DNxIJDgZ.cjs"));
25942
25951
  const modal = document.createElement("wcm-modal");
25943
25952
  document.body.insertAdjacentElement("beforeend", modal);
25944
25953
  OptionsCtrl.setIsUiLoaded(true);
@@ -26687,4 +26696,4 @@ exports.useSettingsStore = useSettingsStore;
26687
26696
  exports.useSwapModel = useSwapModel;
26688
26697
  exports.useTokensStore = useTokensStore;
26689
26698
  exports.useTransactionStore = useTransactionStore;
26690
- //# sourceMappingURL=index-CODQ78Ad.cjs.map
26699
+ //# sourceMappingURL=index-DjNExA0K.cjs.map