@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.
- package/dist/evaa-bridge.cjs +1 -1
- package/dist/evaa-bridge.mjs +1 -1
- package/dist/{index-Clp6WHUM.js → index-B3CfK6dl.js} +97 -88
- package/dist/index-B3CfK6dl.js.map +1 -0
- package/dist/{index-pWXibG25.js → index-C7te6Gwz.js} +2 -2
- package/dist/{index-pWXibG25.js.map → index-C7te6Gwz.js.map} +1 -1
- package/dist/{index-C8tcwNkl.cjs → index-DNxIJDgZ.cjs} +2 -2
- package/dist/{index-C8tcwNkl.cjs.map → index-DNxIJDgZ.cjs.map} +1 -1
- package/dist/{index-CODQ78Ad.cjs → index-DjNExA0K.cjs} +97 -88
- package/dist/index-DjNExA0K.cjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/index-CODQ78Ad.cjs.map +0 -1
- package/dist/index-Clp6WHUM.js.map +0 -1
package/dist/evaa-bridge.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-DjNExA0K.cjs");
|
|
4
4
|
exports.DEFAULT_SLIPPAGE_BPS = index.DEFAULT_SLIPPAGE_BPS;
|
|
5
5
|
exports.EvaaBridge = index.EvaaBridge;
|
|
6
6
|
exports.RoutePriority = index.RoutePriority;
|
package/dist/evaa-bridge.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U, d, f, e, H, B, F, X, N, z, $, G, A, D, Z, w, s, v, r, p, q, L, a2, a9, a4, a6, x, I, y, a5, J, a3, a7, a8, Y, W, P, _, a1, aa, Q, S, a0, K, V, t, o, i, u, l, m, j, n, h, k } from "./index-
|
|
1
|
+
import { U, d, f, e, H, B, F, X, N, z, $, G, A, D, Z, w, s, v, r, p, q, L, a2, a9, a4, a6, x, I, y, a5, J, a3, a7, a8, Y, W, P, _, a1, aa, Q, S, a0, K, V, t, o, i, u, l, m, j, n, h, k } from "./index-B3CfK6dl.js";
|
|
2
2
|
export {
|
|
3
3
|
U as DEFAULT_SLIPPAGE_BPS,
|
|
4
4
|
d as EvaaBridge,
|
|
@@ -24,14 +24,14 @@ import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "@/
|
|
|
24
24
|
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
|
25
25
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
26
26
|
import { toast, Toaster } from "sonner";
|
|
27
|
+
import { Badge } from "@/components/ui/badge";
|
|
27
28
|
import { DialogDescription as DialogDescription$1 } from "@radix-ui/react-dialog";
|
|
28
29
|
import { isAddress, formatUnits, parseUnits } from "viem";
|
|
29
30
|
import { TronLinkAdapterName } from "@tronweb3/tronwallet-adapters";
|
|
30
31
|
import { TronWeb } from "tronweb";
|
|
31
32
|
import { CardHeader, CardTitle, CardAction, Card, CardContent, CardFooter } from "@/components/ui/card";
|
|
32
|
-
import { Badge } from "@/components/ui/badge";
|
|
33
33
|
const common$1 = { "connecting": "Connecting…", "initializing": "Initializing...", "loading": "Loading...", "paste": "paste", "close": "Close", "zeroPlaceholder": "0", "nativeToken": "Native Token" };
|
|
34
|
-
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": "
|
|
34
|
+
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" };
|
|
35
35
|
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" };
|
|
36
36
|
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" };
|
|
37
37
|
const telegram$1 = { "openWebVersion": "Open EVAA Web to Bridge", "restrictionMessage": "You can bridge between the chosen networks on EVAA web version" };
|
|
@@ -49,7 +49,7 @@ const en$3 = {
|
|
|
49
49
|
errors: errors$1
|
|
50
50
|
};
|
|
51
51
|
const common = { "connecting": "Подключение…", "initializing": "Инициализация...", "loading": "Загрузка...", "paste": "вставить", "close": "Закрыть", "zeroPlaceholder": "0", "nativeToken": "Нативный токен" };
|
|
52
|
-
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": "
|
|
52
|
+
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": "Подключить кошелёк" };
|
|
53
53
|
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": "Проверьте корректность перед переводом" };
|
|
54
54
|
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": "Ошибка котировки" };
|
|
55
55
|
const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
|
|
@@ -2378,6 +2378,7 @@ const TokenInput = forwardRef(
|
|
|
2378
2378
|
className,
|
|
2379
2379
|
max,
|
|
2380
2380
|
readOnly,
|
|
2381
|
+
error,
|
|
2381
2382
|
...rest
|
|
2382
2383
|
}, ref) => {
|
|
2383
2384
|
const [inputVal, setInputVal] = useState(value ?? "");
|
|
@@ -2395,10 +2396,15 @@ const TokenInput = forwardRef(
|
|
|
2395
2396
|
[max, onAmountChange]
|
|
2396
2397
|
);
|
|
2397
2398
|
if (showSkeleton && readOnly) {
|
|
2398
|
-
return /* @__PURE__ */ jsx(
|
|
2399
|
+
return /* @__PURE__ */ jsx(
|
|
2400
|
+
Skeleton,
|
|
2401
|
+
{
|
|
2402
|
+
className: cn$2("h-8 my-2 w-1/3 bg-secondary rounded-md", className)
|
|
2403
|
+
}
|
|
2404
|
+
);
|
|
2399
2405
|
}
|
|
2400
2406
|
const { onBlur: restOnBlur, ...restWithoutOnBlur } = rest;
|
|
2401
|
-
return /* @__PURE__ */ jsx(
|
|
2407
|
+
return /* @__PURE__ */ jsx(
|
|
2402
2408
|
Input,
|
|
2403
2409
|
{
|
|
2404
2410
|
ref,
|
|
@@ -2411,6 +2417,7 @@ const TokenInput = forwardRef(
|
|
|
2411
2417
|
readOnly,
|
|
2412
2418
|
className: cn$2(
|
|
2413
2419
|
"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",
|
|
2420
|
+
error ? "text-destructive placeholder:text-destructive/70" : "",
|
|
2414
2421
|
className
|
|
2415
2422
|
),
|
|
2416
2423
|
max,
|
|
@@ -2420,7 +2427,7 @@ const TokenInput = forwardRef(
|
|
|
2420
2427
|
onAmountBlur?.();
|
|
2421
2428
|
}
|
|
2422
2429
|
}
|
|
2423
|
-
)
|
|
2430
|
+
);
|
|
2424
2431
|
}
|
|
2425
2432
|
);
|
|
2426
2433
|
TokenInput.displayName = "TokenInput";
|
|
@@ -2794,6 +2801,7 @@ const SwapSection = ({
|
|
|
2794
2801
|
const { isOpen, onClose, onOpen } = useModal();
|
|
2795
2802
|
const { assetMatrix, selectedAssetSymbol } = useTokensStore();
|
|
2796
2803
|
const { status } = useBridgeQuoteStore();
|
|
2804
|
+
const { t: t2 } = useBridgeTranslation();
|
|
2797
2805
|
const [isFocused, setIsFocused] = useState(false);
|
|
2798
2806
|
const tokenOnThisChain = useMemo(
|
|
2799
2807
|
() => resolveTokenOnChainFromMatrix(
|
|
@@ -2810,6 +2818,7 @@ const SwapSection = ({
|
|
|
2810
2818
|
return formatUsd(amt * priceUsd);
|
|
2811
2819
|
}, [amount, priceUsd]);
|
|
2812
2820
|
const isUsdLoading = Boolean(amount && parseFloat(amount) > 0 && !priceUsd);
|
|
2821
|
+
const isInsufficientBalance = !!(amount && balance.balance && parseFloat(amount) > balance.balance);
|
|
2813
2822
|
const onChangeChain = useCallback(
|
|
2814
2823
|
(c2) => {
|
|
2815
2824
|
onSelect?.(c2);
|
|
@@ -2865,7 +2874,8 @@ const SwapSection = ({
|
|
|
2865
2874
|
showSkeleton: status === "loading",
|
|
2866
2875
|
className: "p-0",
|
|
2867
2876
|
onFocus: () => setIsFocused(true),
|
|
2868
|
-
onBlur: () => setIsFocused(false)
|
|
2877
|
+
onBlur: () => setIsFocused(false),
|
|
2878
|
+
error: isInsufficientBalance
|
|
2869
2879
|
}
|
|
2870
2880
|
)
|
|
2871
2881
|
] }),
|
|
@@ -2877,7 +2887,7 @@ const SwapSection = ({
|
|
|
2877
2887
|
addressType: isSource ? "src" : "dst"
|
|
2878
2888
|
}
|
|
2879
2889
|
),
|
|
2880
|
-
isUsdLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 rounded-md" }) : /* @__PURE__ */ jsx("span", { className: "leading-5 text-sm font-medium text-muted-foreground", children: computedFiat })
|
|
2890
|
+
amount && balance.balance && parseFloat(amount) > balance.balance ? /* @__PURE__ */ jsx("span", { className: "leading-5 text-sm font-medium text-destructive", children: t2("transaction.insufficientBalance") }) : isUsdLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 rounded-md" }) : /* @__PURE__ */ jsx("span", { className: "leading-5 text-sm font-medium text-muted-foreground", children: computedFiat })
|
|
2881
2891
|
] })
|
|
2882
2892
|
]
|
|
2883
2893
|
}
|
|
@@ -4016,12 +4026,12 @@ const WalletModalButton = (props) => {
|
|
|
4016
4026
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
4017
4027
|
if (props.variant === "connected") {
|
|
4018
4028
|
const { address, onDisconnect } = props;
|
|
4019
|
-
return /* @__PURE__ */
|
|
4029
|
+
return /* @__PURE__ */ jsxs(
|
|
4020
4030
|
"div",
|
|
4021
4031
|
{
|
|
4022
4032
|
className: cn$2(
|
|
4023
4033
|
buttonVariants({ variant: "ghost", size: "default" }),
|
|
4024
|
-
"rounded-xs w-full !hover:scale-100 !px-3 !gap-3"
|
|
4034
|
+
"rounded-xs w-full !hover:scale-100 !px-3 !gap-3 flex items-center justify-start"
|
|
4025
4035
|
),
|
|
4026
4036
|
children: [
|
|
4027
4037
|
/* @__PURE__ */ jsx(IconComponent, { className: "min-w-8 min-h-8" }),
|
|
@@ -4029,20 +4039,24 @@ const WalletModalButton = (props) => {
|
|
|
4029
4039
|
/* @__PURE__ */ jsx("p", { className: "font-semibold text-foreground text-sm leading-4 truncate", children: formatAddress(address) }),
|
|
4030
4040
|
/* @__PURE__ */ jsx("div", { className: "text-xs leading-3 font-medium text-muted-foreground", children: name })
|
|
4031
4041
|
] }),
|
|
4032
|
-
/* @__PURE__ */
|
|
4033
|
-
"
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4042
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 ml-auto", children: [
|
|
4043
|
+
/* @__PURE__ */ jsx(Badge, { variant: "default", className: "bg-success/10 text-success h-7 px-2", children: t2("wallets.connectedStatus") }),
|
|
4044
|
+
/* @__PURE__ */ jsx(
|
|
4045
|
+
"button",
|
|
4046
|
+
{
|
|
4047
|
+
type: "button",
|
|
4048
|
+
onClick: () => {
|
|
4049
|
+
onDisconnect();
|
|
4050
|
+
onClose?.();
|
|
4051
|
+
},
|
|
4052
|
+
className: "text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4053
|
+
children: /* @__PURE__ */ jsx(ExitIcon, { className: "w-6 h-6" })
|
|
4054
|
+
}
|
|
4055
|
+
)
|
|
4056
|
+
] })
|
|
4043
4057
|
]
|
|
4044
4058
|
}
|
|
4045
|
-
)
|
|
4059
|
+
);
|
|
4046
4060
|
}
|
|
4047
4061
|
const { walletId, connector } = props;
|
|
4048
4062
|
const handleConnect = async () => {
|
|
@@ -4102,42 +4116,37 @@ const WalletSelectModal = () => {
|
|
|
4102
4116
|
const tronWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.TRON);
|
|
4103
4117
|
const tronConnections = tronWallet?.getAvailableConnections() ?? [];
|
|
4104
4118
|
const isTronConnected = tronWallet?.isConnected() ?? false;
|
|
4105
|
-
const
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4119
|
+
const tonConnectedWallets = [];
|
|
4120
|
+
const tonAccount = tonWallet?.getAccount();
|
|
4121
|
+
if (tonWallet?.isConnected() && tonAccount) {
|
|
4122
|
+
tonConnectedWallets.push({
|
|
4123
|
+
id: "ton",
|
|
4109
4124
|
name: t2("wallets.tonconnect"),
|
|
4110
|
-
icon: TonConnectIcon
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
id: walletId,
|
|
4127
|
-
name,
|
|
4128
|
-
icon,
|
|
4129
|
-
address: account,
|
|
4130
|
-
onDisconnect: () => strategy.disconnect()
|
|
4125
|
+
icon: TonConnectIcon,
|
|
4126
|
+
address: tonAccount,
|
|
4127
|
+
onDisconnect: () => tonWallet?.disconnect()
|
|
4128
|
+
});
|
|
4129
|
+
}
|
|
4130
|
+
const evmConnectedWallets = [];
|
|
4131
|
+
const hasWagmiEvmConnection = !!evmAddress && !!connectedConnector;
|
|
4132
|
+
if (!hasWagmiEvmConnection) {
|
|
4133
|
+
const evmAccount = metaMaskWallet?.getAccount();
|
|
4134
|
+
if (metaMaskWallet?.isConnected() && evmAccount) {
|
|
4135
|
+
evmConnectedWallets.push({
|
|
4136
|
+
id: "metamask",
|
|
4137
|
+
name: t2("wallets.metaMask"),
|
|
4138
|
+
icon: MetaMaskIcon,
|
|
4139
|
+
address: evmAccount,
|
|
4140
|
+
onDisconnect: () => metaMaskWallet?.disconnect()
|
|
4131
4141
|
});
|
|
4132
4142
|
}
|
|
4133
|
-
|
|
4134
|
-
}, []);
|
|
4143
|
+
}
|
|
4135
4144
|
if (evmAddress && connectedConnector) {
|
|
4136
4145
|
const iconMap = {
|
|
4137
4146
|
metaMaskSDK: MetaMaskIcon,
|
|
4138
4147
|
walletConnect: WalletConnectIcon
|
|
4139
4148
|
};
|
|
4140
|
-
|
|
4149
|
+
evmConnectedWallets.push({
|
|
4141
4150
|
id: connectedConnector.id,
|
|
4142
4151
|
name: connectedConnector.name,
|
|
4143
4152
|
icon: iconMap[connectedConnector.id] || WalletConnectIcon,
|
|
@@ -4145,10 +4154,11 @@ const WalletSelectModal = () => {
|
|
|
4145
4154
|
onDisconnect: () => metaMaskWallet?.disconnect()
|
|
4146
4155
|
});
|
|
4147
4156
|
}
|
|
4157
|
+
const tronConnectedWallets = [];
|
|
4148
4158
|
tronConnections.forEach((connection) => {
|
|
4149
4159
|
if (!connection.connected || !connection.address) return;
|
|
4150
4160
|
const isWalletConnect = connection.provider === "walletconnect";
|
|
4151
|
-
|
|
4161
|
+
tronConnectedWallets.push({
|
|
4152
4162
|
id: isWalletConnect ? "tronwc" : "tronlink",
|
|
4153
4163
|
name: isWalletConnect ? t2("wallets.walletConnect") : t2("wallets.tronLink"),
|
|
4154
4164
|
icon: isWalletConnect ? WalletConnectIcon : TronLinkIcon,
|
|
@@ -4156,19 +4166,7 @@ const WalletSelectModal = () => {
|
|
|
4156
4166
|
onDisconnect: () => tronWallet?.disconnect({ provider: connection.provider })
|
|
4157
4167
|
});
|
|
4158
4168
|
});
|
|
4159
|
-
const
|
|
4160
|
-
const isEvmConnector = connectors.some((c2) => c2.id === walletId);
|
|
4161
|
-
if (isEvmConnector && metaMaskWallet?.isConnected()) {
|
|
4162
|
-
return true;
|
|
4163
|
-
}
|
|
4164
|
-
if ((walletId === "tronwc" || walletId === "tronlink") && tronConnections.some(
|
|
4165
|
-
(conn) => conn.connected && (walletId === "tronwc" ? conn.provider === "walletconnect" : conn.provider !== "walletconnect")
|
|
4166
|
-
)) {
|
|
4167
|
-
return true;
|
|
4168
|
-
}
|
|
4169
|
-
return connectedWallets.some((w2) => w2.id === walletId);
|
|
4170
|
-
};
|
|
4171
|
-
const tonWallets = [
|
|
4169
|
+
const tonWallets = tonConnectedWallets.length ? [] : [
|
|
4172
4170
|
{
|
|
4173
4171
|
id: "ton",
|
|
4174
4172
|
name: t2("wallets.tonconnect"),
|
|
@@ -4176,7 +4174,7 @@ const WalletSelectModal = () => {
|
|
|
4176
4174
|
enabled: true
|
|
4177
4175
|
}
|
|
4178
4176
|
];
|
|
4179
|
-
const evmWallets = connectors.filter(
|
|
4177
|
+
const evmWallets = evmConnectedWallets.length > 0 ? [] : connectors.filter(
|
|
4180
4178
|
(connector) => connector.id === "walletConnect" || connector.id === "metaMaskSDK"
|
|
4181
4179
|
).map((connector) => ({
|
|
4182
4180
|
id: connector.id,
|
|
@@ -4184,7 +4182,7 @@ const WalletSelectModal = () => {
|
|
|
4184
4182
|
icon: connector.id === "metaMaskSDK" ? MetaMaskIcon : WalletConnectIcon,
|
|
4185
4183
|
enabled: true
|
|
4186
4184
|
}));
|
|
4187
|
-
const tronWallets = isTronConnected ? [] : [
|
|
4185
|
+
const tronWallets = tronConnectedWallets.length > 0 || isTronConnected ? [] : [
|
|
4188
4186
|
{
|
|
4189
4187
|
id: "tronlink",
|
|
4190
4188
|
name: t2("wallets.tronLink"),
|
|
@@ -4198,30 +4196,44 @@ const WalletSelectModal = () => {
|
|
|
4198
4196
|
enabled: true
|
|
4199
4197
|
}
|
|
4200
4198
|
];
|
|
4201
|
-
const notConnected = (w2) => !isWalletConnected(w2.id);
|
|
4202
4199
|
const categories = [
|
|
4203
4200
|
{
|
|
4204
4201
|
title: t2("wallets.tonWallets"),
|
|
4205
|
-
|
|
4202
|
+
connectedWallets: tonConnectedWallets,
|
|
4203
|
+
wallets: tonWallets,
|
|
4204
|
+
order: 0
|
|
4206
4205
|
},
|
|
4207
4206
|
{
|
|
4208
4207
|
title: t2("wallets.evmWallets"),
|
|
4209
|
-
|
|
4208
|
+
connectedWallets: evmConnectedWallets,
|
|
4209
|
+
wallets: evmWallets,
|
|
4210
|
+
order: 1
|
|
4210
4211
|
},
|
|
4211
4212
|
{
|
|
4212
4213
|
title: t2("wallets.tronWallets"),
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4214
|
+
connectedWallets: tronConnectedWallets,
|
|
4215
|
+
wallets: tronWallets,
|
|
4216
|
+
order: 2
|
|
4217
|
+
}
|
|
4218
|
+
].filter(
|
|
4219
|
+
(category) => category.wallets.length > 0 || category.connectedWallets.length > 0
|
|
4220
|
+
).sort((a2, b2) => {
|
|
4221
|
+
const aHasConnected = a2.connectedWallets.length > 0;
|
|
4222
|
+
const bHasConnected = b2.connectedWallets.length > 0;
|
|
4223
|
+
if (aHasConnected !== bHasConnected) {
|
|
4224
|
+
return Number(bHasConnected) - Number(aHasConnected);
|
|
4225
|
+
}
|
|
4226
|
+
return a2.order - b2.order;
|
|
4227
|
+
});
|
|
4216
4228
|
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-10 pt-7", children: [
|
|
4217
4229
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "text-left", children: [
|
|
4218
4230
|
/* @__PURE__ */ jsx(DialogTitle, { className: "text-2xl leading-8", children: t2("wallets.chooseWallet") }),
|
|
4219
4231
|
/* @__PURE__ */ jsx(DialogDescription, { children: t2("wallets.oneWalletPerEnv") })
|
|
4220
4232
|
] }),
|
|
4221
|
-
/* @__PURE__ */
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4233
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: categories.map((category) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4234
|
+
/* @__PURE__ */ jsx("div", { className: "py-1 text-muted-foreground uppercase", children: category.title }),
|
|
4235
|
+
/* @__PURE__ */ jsxs("div", { className: "-mx-3 space-y-2", children: [
|
|
4236
|
+
category.connectedWallets.map((wallet) => /* @__PURE__ */ jsx(
|
|
4225
4237
|
WalletModalButton,
|
|
4226
4238
|
{
|
|
4227
4239
|
variant: "connected",
|
|
@@ -4232,11 +4244,8 @@ const WalletSelectModal = () => {
|
|
|
4232
4244
|
onClose
|
|
4233
4245
|
},
|
|
4234
4246
|
wallet.id
|
|
4235
|
-
))
|
|
4236
|
-
|
|
4237
|
-
categories.map((category) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4238
|
-
/* @__PURE__ */ jsx("div", { className: "py-1 text-muted-foreground uppercase", children: category.title }),
|
|
4239
|
-
/* @__PURE__ */ jsx("div", { className: "-mx-3", children: category.wallets.map((wallet) => {
|
|
4247
|
+
)),
|
|
4248
|
+
category.wallets.map((wallet) => {
|
|
4240
4249
|
const isEvmConnector = category.title === t2("wallets.evmWallets");
|
|
4241
4250
|
const connector = isEvmConnector ? connectors.find((c2) => c2.id === wallet.id) : void 0;
|
|
4242
4251
|
return /* @__PURE__ */ jsx(
|
|
@@ -4251,9 +4260,9 @@ const WalletSelectModal = () => {
|
|
|
4251
4260
|
},
|
|
4252
4261
|
wallet.id
|
|
4253
4262
|
);
|
|
4254
|
-
})
|
|
4255
|
-
] }
|
|
4256
|
-
] })
|
|
4263
|
+
})
|
|
4264
|
+
] })
|
|
4265
|
+
] }, category.title)) })
|
|
4257
4266
|
] }) });
|
|
4258
4267
|
};
|
|
4259
4268
|
const ProgressStep = ({
|
|
@@ -4485,10 +4494,10 @@ const StatusStepsDialog = ({
|
|
|
4485
4494
|
step = /* @__PURE__ */ jsx(ProgressStep, { icon: icons?.progress });
|
|
4486
4495
|
}
|
|
4487
4496
|
if (status === "completed") {
|
|
4488
|
-
step = /* @__PURE__ */ jsx(
|
|
4497
|
+
step = /* @__PURE__ */ jsx(SuccessStep, { icon: icons?.success });
|
|
4489
4498
|
}
|
|
4490
4499
|
if (status === "failed") {
|
|
4491
|
-
step = /* @__PURE__ */ jsx(
|
|
4500
|
+
step = /* @__PURE__ */ jsx(FailedStep, { icon: icons?.failed });
|
|
4492
4501
|
}
|
|
4493
4502
|
return /* @__PURE__ */ jsx(Dialog, { open: true, onOpenChange: () => reset(), children: step });
|
|
4494
4503
|
};
|
|
@@ -25937,7 +25946,7 @@ class WalletConnectModal {
|
|
|
25937
25946
|
}
|
|
25938
25947
|
async initUi() {
|
|
25939
25948
|
if (typeof window !== "undefined") {
|
|
25940
|
-
await import("./index-
|
|
25949
|
+
await import("./index-C7te6Gwz.js");
|
|
25941
25950
|
const modal = document.createElement("wcm-modal");
|
|
25942
25951
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
25943
25952
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26688,4 +26697,4 @@ export {
|
|
|
26688
26697
|
getQuoteFees as y,
|
|
26689
26698
|
calculateMinReceived as z
|
|
26690
26699
|
};
|
|
26691
|
-
//# sourceMappingURL=index-
|
|
26700
|
+
//# sourceMappingURL=index-B3CfK6dl.js.map
|