@rash2x/bridge-widget 0.6.20 → 0.6.26
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-DNxIJDgZ.cjs → index-B4by666d.cjs} +2 -2
- package/dist/{index-DNxIJDgZ.cjs.map → index-B4by666d.cjs.map} +1 -1
- package/dist/{index-B3CfK6dl.js → index-BBQ7KZI-.js} +130 -42
- package/dist/index-BBQ7KZI-.js.map +1 -0
- package/dist/{index-C7te6Gwz.js → index-CNrU6f88.js} +2 -2
- package/dist/{index-C7te6Gwz.js.map → index-CNrU6f88.js.map} +1 -1
- package/dist/{index-DjNExA0K.cjs → index-Dv5nujkk.cjs} +130 -42
- package/dist/index-Dv5nujkk.cjs.map +1 -0
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
- package/dist/index-B3CfK6dl.js.map +0 -1
- package/dist/index-DjNExA0K.cjs.map +0 -1
|
@@ -34,7 +34,7 @@ const card = require("@/components/ui/card");
|
|
|
34
34
|
const common$1 = { "connecting": "Connecting…", "initializing": "Initializing...", "loading": "Loading...", "paste": "paste", "close": "Close", "zeroPlaceholder": "0", "nativeToken": "Native Token" };
|
|
35
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
|
-
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
|
+
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", "pasteAddressToTransfer": "Paste address to transfer", "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" };
|
|
39
39
|
const app$1 = { "stargateWidgetName": "Stargate Bridge Widget", "liveWidget": "Live Widget", "getStarted": "Get Started" };
|
|
40
40
|
const settings$1 = { "title": "Settings", "gasOnDestination": "Gas on destination", "gasOnDestinationDescription": "The default amount allows you to perform a couple of transactions (e.g. Approve and Swap).", "slippageTolerance": "Slippage tolerance", "slippageToleranceDescription": "Your transaction will revert if the amount you're receiving is outside of this tolerance", "routePriority": "Route Priority", "routePriorityDescription": "Choose how your transfer is routed. Recommended picks the best overall path for cost. Fastest prioritizes speed above all else.", "highSlippageWarning": "High slippage warning", "gasPresets": { "auto": "Auto", "none": "None", "medium": "Medium", "max": "Max" }, "routePresets": { "fastest": "Fastest", "cheapest": "Cheapest", "recommended": "Recommended" } };
|
|
@@ -52,7 +52,7 @@ const en$3 = {
|
|
|
52
52
|
const common = { "connecting": "Подключение…", "initializing": "Инициализация...", "loading": "Загрузка...", "paste": "вставить", "close": "Закрыть", "zeroPlaceholder": "0", "nativeToken": "Нативный токен" };
|
|
53
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
|
-
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
|
+
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": "Недостаточно газа", "pasteAddressToTransfer": "Укажите адрес получателя", "noRouteFoundForSettings": "Маршрут не найден для текущих настроек.", "tryAdjustSettings": "Попробуйте отключить Gas on Destination или измените сумму/сети.", "quoteError": "Ошибка котировки" };
|
|
56
56
|
const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
|
|
57
57
|
const app = { "stargateWidgetName": "Виджет Stargate Bridge", "liveWidget": "Живой виджет", "getStarted": "Начало работы" };
|
|
58
58
|
const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "gasOnDestinationDescription": "Значение по умолчанию позволяет выполнить пару транзакций (например, Approve и Swap).", "slippageTolerance": "Толерантность к проскальзыванию", "slippageToleranceDescription": "Ваша транзакция будет отклонена, если получаемая сумма выйдет за пределы этой допустимой погрешности.", "routePriority": "Приоритет маршрута", "routePriorityDescription": "Выберите, как будет выполняться ваш трансфер. Recommended — выбирает оптимальный маршрут с учётом общей стоимости. Fastest — отдаёт приоритет максимальной скорости.", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрейший", "cheapest": "Дешевейший", "recommended": "Рекомендуемый" } };
|
|
@@ -512,8 +512,28 @@ const useTronWalletConnectStore = zustand.create(
|
|
|
512
512
|
})
|
|
513
513
|
})
|
|
514
514
|
);
|
|
515
|
+
const useCustomAddressStore = zustand.create((set2) => ({
|
|
516
|
+
customDstAddress: void 0,
|
|
517
|
+
isEnabled: false,
|
|
518
|
+
setCustomDstAddress: (address) => set2(
|
|
519
|
+
(state2) => state2.customDstAddress === address ? state2 : { customDstAddress: address }
|
|
520
|
+
),
|
|
521
|
+
setEnabled: (enabled) => set2((state2) => {
|
|
522
|
+
if (state2.isEnabled === enabled) return state2;
|
|
523
|
+
return enabled ? { isEnabled: true } : { isEnabled: false, customDstAddress: void 0 };
|
|
524
|
+
}),
|
|
525
|
+
clearCustomDstAddress: () => set2(
|
|
526
|
+
(state2) => state2.customDstAddress === void 0 ? state2 : { customDstAddress: void 0 }
|
|
527
|
+
)
|
|
528
|
+
}));
|
|
515
529
|
function useAddresses() {
|
|
516
530
|
const { fromChain, toChain } = useChainsStore();
|
|
531
|
+
const customDstAddress = useCustomAddressStore(
|
|
532
|
+
(state2) => state2.customDstAddress
|
|
533
|
+
);
|
|
534
|
+
const isCustomAddressEnabled = useCustomAddressStore(
|
|
535
|
+
(state2) => state2.isEnabled
|
|
536
|
+
);
|
|
517
537
|
const { address: evmAddress } = wagmi.useAccount();
|
|
518
538
|
const tonAddress = uiReact.useTonAddress();
|
|
519
539
|
const { address: tronLinkAddress } = tronwalletAdapterReactHooks.useWallet();
|
|
@@ -534,6 +554,9 @@ function useAddresses() {
|
|
|
534
554
|
}, [fromChain?.chainKey, evmAddress, tonAddress, tronAddress]);
|
|
535
555
|
const dstAddress = react.useMemo(() => {
|
|
536
556
|
if (!toChain?.chainKey) return void 0;
|
|
557
|
+
if (isCustomAddressEnabled) {
|
|
558
|
+
return customDstAddress;
|
|
559
|
+
}
|
|
537
560
|
const chainKey = toChain.chainKey.toLowerCase();
|
|
538
561
|
if (chainKey === "ton") {
|
|
539
562
|
return tonAddress || void 0;
|
|
@@ -542,13 +565,21 @@ function useAddresses() {
|
|
|
542
565
|
return tronAddress || void 0;
|
|
543
566
|
}
|
|
544
567
|
return evmAddress || void 0;
|
|
545
|
-
}, [
|
|
568
|
+
}, [
|
|
569
|
+
toChain?.chainKey,
|
|
570
|
+
evmAddress,
|
|
571
|
+
tonAddress,
|
|
572
|
+
tronAddress,
|
|
573
|
+
customDstAddress,
|
|
574
|
+
isCustomAddressEnabled
|
|
575
|
+
]);
|
|
546
576
|
return {
|
|
547
577
|
srcAddress,
|
|
548
578
|
dstAddress,
|
|
549
579
|
evmAddress,
|
|
550
580
|
tonAddress,
|
|
551
|
-
tronAddress
|
|
581
|
+
tronAddress,
|
|
582
|
+
isCustomAddressEnabled
|
|
552
583
|
};
|
|
553
584
|
}
|
|
554
585
|
const useBridgeQuoteStore = zustand.create((set2) => ({
|
|
@@ -2707,7 +2738,8 @@ const EditIcon = (props) => {
|
|
|
2707
2738
|
const prefixIcons = {
|
|
2708
2739
|
tronlink: /* @__PURE__ */ jsxRuntime.jsx(TronLinkIcon, { className: "w-5 h-5" }),
|
|
2709
2740
|
metamask: /* @__PURE__ */ jsxRuntime.jsx(MetaMaskIcon, { className: "w-5 h-5" }),
|
|
2710
|
-
ton: /* @__PURE__ */ jsxRuntime.jsx(TonConnectIcon, { className: "w-5 h-5" })
|
|
2741
|
+
ton: /* @__PURE__ */ jsxRuntime.jsx(TonConnectIcon, { className: "w-5 h-5" }),
|
|
2742
|
+
walletconnect: /* @__PURE__ */ jsxRuntime.jsx(WalletConnectIcon, { className: "w-5 h-5" })
|
|
2711
2743
|
};
|
|
2712
2744
|
const mapWalletToType = (wallet) => {
|
|
2713
2745
|
switch (wallet) {
|
|
@@ -2724,8 +2756,12 @@ const WalletInlineButton = ({
|
|
|
2724
2756
|
addressType
|
|
2725
2757
|
}) => {
|
|
2726
2758
|
const { t: t2 } = useBridgeTranslation();
|
|
2759
|
+
const { connector: connectedEvmConnector } = wagmi.useAccount();
|
|
2727
2760
|
const { onOpen } = useWalletSelectModal();
|
|
2728
2761
|
const { chainRegistry } = useChainStrategies();
|
|
2762
|
+
const isCustomAddressEnabled = useCustomAddressStore(
|
|
2763
|
+
(state2) => state2.isEnabled
|
|
2764
|
+
);
|
|
2729
2765
|
const walletType = mapWalletToType(wallet);
|
|
2730
2766
|
const connection = chainRegistry.getStrategyByType(walletType);
|
|
2731
2767
|
const account = connection?.getAccount();
|
|
@@ -2733,6 +2769,23 @@ const WalletInlineButton = ({
|
|
|
2733
2769
|
const isConnecting = connection?.isConnecting();
|
|
2734
2770
|
const isInitialized = connection?.isInitialized() ?? true;
|
|
2735
2771
|
const error = connection?.getError();
|
|
2772
|
+
const availableConnections = react.useMemo(
|
|
2773
|
+
() => connection?.getAvailableConnections() ?? [],
|
|
2774
|
+
[connection]
|
|
2775
|
+
);
|
|
2776
|
+
const evmConnectorId = connectedEvmConnector?.id;
|
|
2777
|
+
const activeTronConnection = react.useMemo(() => {
|
|
2778
|
+
if (walletType !== "tron") return null;
|
|
2779
|
+
const tronWalletConnect = availableConnections.find(
|
|
2780
|
+
(conn) => conn.provider === "walletconnect" && conn.connected && !!conn.address
|
|
2781
|
+
);
|
|
2782
|
+
if (tronWalletConnect) return tronWalletConnect;
|
|
2783
|
+
const tronLink = availableConnections.find(
|
|
2784
|
+
(conn) => conn.provider === "tronlink" && conn.connected && !!conn.address
|
|
2785
|
+
);
|
|
2786
|
+
if (tronLink) return tronLink;
|
|
2787
|
+
return null;
|
|
2788
|
+
}, [availableConnections, walletType]);
|
|
2736
2789
|
const handleClick = react.useCallback(() => {
|
|
2737
2790
|
onOpen(addressType);
|
|
2738
2791
|
}, [onOpen, addressType]);
|
|
@@ -2745,7 +2798,23 @@ const WalletInlineButton = ({
|
|
|
2745
2798
|
if (wallet === "tronlink") return t2("wallets.addTronWallet");
|
|
2746
2799
|
return t2("wallets.addEvmWallet");
|
|
2747
2800
|
}, [wallet, isInitialized, isConnecting, isConnected, account, t2]);
|
|
2748
|
-
const
|
|
2801
|
+
const connectedIcon = react.useMemo(() => {
|
|
2802
|
+
if (!isConnected) return null;
|
|
2803
|
+
if (walletType === "tron" && activeTronConnection) {
|
|
2804
|
+
return activeTronConnection.provider === "walletconnect" ? prefixIcons.walletconnect : prefixIcons.tronlink;
|
|
2805
|
+
}
|
|
2806
|
+
if (walletType === "evm") {
|
|
2807
|
+
if (evmConnectorId) {
|
|
2808
|
+
if (evmConnectorId === "metaMaskSDK") return prefixIcons.metamask;
|
|
2809
|
+
if (evmConnectorId === "walletConnect")
|
|
2810
|
+
return prefixIcons.walletconnect;
|
|
2811
|
+
return prefixIcons.walletconnect;
|
|
2812
|
+
}
|
|
2813
|
+
return prefixIcons.metamask;
|
|
2814
|
+
}
|
|
2815
|
+
return prefixIcons[wallet];
|
|
2816
|
+
}, [activeTronConnection, evmConnectorId, isConnected, wallet, walletType]);
|
|
2817
|
+
const isButtonDisabled = (wallet === "metamask" || wallet === "tronlink") && !isInitialized || isConnecting || addressType === "dst" && isCustomAddressEnabled;
|
|
2749
2818
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex flex-col items-start gap-1", children: [
|
|
2750
2819
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2751
2820
|
button.Button,
|
|
@@ -2758,9 +2827,12 @@ const WalletInlineButton = ({
|
|
|
2758
2827
|
disabled: isButtonDisabled,
|
|
2759
2828
|
variant: "ghost",
|
|
2760
2829
|
size: "sm",
|
|
2761
|
-
className:
|
|
2830
|
+
className: utils$1.cn(
|
|
2831
|
+
"flex gap-1 cursor-pointer hover:opacity-60 hover:bg-transparent !px-0 pr-1 h-5",
|
|
2832
|
+
isButtonDisabled && "opacity-50 bg-transparent"
|
|
2833
|
+
),
|
|
2762
2834
|
children: [
|
|
2763
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
2835
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: connectedIcon }),
|
|
2764
2836
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "leading-3 text-sm border-b border-dotted border-bridge-link text-bridge-link", children: buttonText }),
|
|
2765
2837
|
isConnected && /* @__PURE__ */ jsxRuntime.jsx(EditIcon, { className: "text-bridge-link -ml-0.5" })
|
|
2766
2838
|
]
|
|
@@ -2906,11 +2978,6 @@ const SwapSection = ({
|
|
|
2906
2978
|
)
|
|
2907
2979
|
] });
|
|
2908
2980
|
};
|
|
2909
|
-
const useCustomAddressStore = zustand.create((set2) => ({
|
|
2910
|
-
customDstAddress: void 0,
|
|
2911
|
-
setCustomDstAddress: (address) => set2({ customDstAddress: address }),
|
|
2912
|
-
clearCustomDstAddress: () => set2({ customDstAddress: void 0 })
|
|
2913
|
-
}));
|
|
2914
2981
|
const useIsAddressValid = (address, chainKey) => {
|
|
2915
2982
|
const isValid = react.useMemo(() => {
|
|
2916
2983
|
return isAddressValidForChain(chainKey, address);
|
|
@@ -2918,34 +2985,48 @@ const useIsAddressValid = (address, chainKey) => {
|
|
|
2918
2985
|
return { isValid };
|
|
2919
2986
|
};
|
|
2920
2987
|
const AnotherAddress = () => {
|
|
2921
|
-
const [enabled, setEnabled] = react.useState(false);
|
|
2922
2988
|
const [isFocused, setIsFocused] = react.useState(false);
|
|
2923
2989
|
const { t: t2 } = useBridgeTranslation();
|
|
2924
2990
|
const { toChain } = useChainsStore();
|
|
2925
|
-
const
|
|
2991
|
+
const setCustomDstAddress = useCustomAddressStore(
|
|
2992
|
+
(state2) => state2.setCustomDstAddress
|
|
2993
|
+
);
|
|
2994
|
+
const setEnabled = useCustomAddressStore((state2) => state2.setEnabled);
|
|
2995
|
+
const isEnabled2 = useCustomAddressStore((state2) => state2.isEnabled);
|
|
2996
|
+
const customDstAddress = useCustomAddressStore(
|
|
2997
|
+
(state2) => state2.customDstAddress
|
|
2998
|
+
);
|
|
2926
2999
|
const [value, setValue] = react.useState("");
|
|
2927
|
-
const
|
|
2928
|
-
const
|
|
2929
|
-
const
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
3000
|
+
const trimmed = react.useMemo(() => value.trim(), [value]);
|
|
3001
|
+
const { isValid } = useIsAddressValid(trimmed, toChain?.chainKey);
|
|
3002
|
+
const invalid = trimmed && !isValid;
|
|
3003
|
+
react.useEffect(() => {
|
|
3004
|
+
if (!isEnabled2) {
|
|
3005
|
+
if (customDstAddress !== void 0) {
|
|
3006
|
+
setCustomDstAddress(void 0);
|
|
3007
|
+
}
|
|
3008
|
+
return;
|
|
3009
|
+
}
|
|
3010
|
+
if (!trimmed || !isValid) {
|
|
3011
|
+
if (customDstAddress !== void 0) {
|
|
3012
|
+
setCustomDstAddress(void 0);
|
|
3013
|
+
}
|
|
2934
3014
|
return;
|
|
2935
3015
|
}
|
|
2936
|
-
if (
|
|
2937
|
-
setCustomDstAddress(
|
|
3016
|
+
if (customDstAddress !== trimmed) {
|
|
3017
|
+
setCustomDstAddress(trimmed);
|
|
2938
3018
|
}
|
|
2939
|
-
}
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
3019
|
+
}, [
|
|
3020
|
+
isEnabled2,
|
|
3021
|
+
trimmed,
|
|
3022
|
+
isValid,
|
|
3023
|
+
setCustomDstAddress,
|
|
3024
|
+
customDstAddress
|
|
3025
|
+
]);
|
|
2944
3026
|
const onPaste = async () => {
|
|
2945
3027
|
try {
|
|
2946
3028
|
const text = await navigator.clipboard.readText?.() ?? "";
|
|
2947
3029
|
setValue(text);
|
|
2948
|
-
pushToStoreIfValid(text);
|
|
2949
3030
|
} catch {
|
|
2950
3031
|
}
|
|
2951
3032
|
};
|
|
@@ -2955,13 +3036,13 @@ const AnotherAddress = () => {
|
|
|
2955
3036
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2956
3037
|
_switch.Switch,
|
|
2957
3038
|
{
|
|
2958
|
-
"aria-pressed":
|
|
2959
|
-
checked:
|
|
2960
|
-
|
|
3039
|
+
"aria-pressed": isEnabled2,
|
|
3040
|
+
checked: isEnabled2,
|
|
3041
|
+
onCheckedChange: (checked) => setEnabled(checked)
|
|
2961
3042
|
}
|
|
2962
3043
|
)
|
|
2963
3044
|
] }),
|
|
2964
|
-
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, mode: "wait", children:
|
|
3045
|
+
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, mode: "wait", children: isEnabled2 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2965
3046
|
framerMotion.motion.div,
|
|
2966
3047
|
{
|
|
2967
3048
|
initial: { opacity: 0, height: 0, y: -6 },
|
|
@@ -2993,7 +3074,7 @@ const AnotherAddress = () => {
|
|
|
2993
3074
|
value,
|
|
2994
3075
|
onFocus: () => setIsFocused(true),
|
|
2995
3076
|
onBlur: () => setIsFocused(false),
|
|
2996
|
-
onChange: (e2) =>
|
|
3077
|
+
onChange: (e2) => setValue(e2.target.value)
|
|
2997
3078
|
}
|
|
2998
3079
|
),
|
|
2999
3080
|
value && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: invalid ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-destructive", children: t2("bridge.addressDoesntMatch", {
|
|
@@ -3902,7 +3983,7 @@ function useTelegramRestriction() {
|
|
|
3902
3983
|
const MainButton = () => {
|
|
3903
3984
|
const { t: t2 } = useBridgeTranslation();
|
|
3904
3985
|
const { chainRegistry } = useChainStrategies();
|
|
3905
|
-
const { srcAddress, dstAddress } = useAddresses();
|
|
3986
|
+
const { srcAddress, dstAddress, isCustomAddressEnabled } = useAddresses();
|
|
3906
3987
|
const { quote, status, inputAmount, noRoute } = useBridgeQuoteStore();
|
|
3907
3988
|
const { fromChain, toChain } = useChainsStore();
|
|
3908
3989
|
const { onOpen } = useWalletSelectModal();
|
|
@@ -3919,11 +4000,12 @@ const MainButton = () => {
|
|
|
3919
4000
|
const srcChainKey = quote?.srcChainKey ?? fromChain?.chainKey;
|
|
3920
4001
|
const dstChainKey = quote?.dstChainKey ?? toChain?.chainKey;
|
|
3921
4002
|
const srcConnectedOk = srcChainKey && chainRegistry.isWalletConnected(srcChainKey);
|
|
3922
|
-
const dstConnectedOk = dstChainKey && chainRegistry.isWalletConnected(dstChainKey);
|
|
4003
|
+
const dstConnectedOk = isCustomAddressEnabled ? true : !!dstChainKey && chainRegistry.isWalletConnected(dstChainKey);
|
|
3923
4004
|
const srcAddressValid = srcChainKey && chainRegistry.isAddressValid(srcChainKey, srcAddress);
|
|
3924
|
-
const dstAddressValid = dstChainKey && chainRegistry.isAddressValid(dstChainKey, dstAddress);
|
|
4005
|
+
const dstAddressValid = !!dstChainKey && chainRegistry.isAddressValid(dstChainKey, dstAddress);
|
|
3925
4006
|
const missingSrc = !srcConnectedOk || !srcAddressValid;
|
|
3926
|
-
const missingDst = !dstConnectedOk || !dstAddressValid;
|
|
4007
|
+
const missingDst = isCustomAddressEnabled ? !dstAddressValid : !dstConnectedOk || !dstAddressValid;
|
|
4008
|
+
const requiresCustomAddress = isCustomAddressEnabled && !dstAddressValid;
|
|
3927
4009
|
const isBusy = isTxProcessing;
|
|
3928
4010
|
const canTransfer = !missingSrc && !missingDst && amountNum > 0 && !!srcChainKey && !!dstChainKey;
|
|
3929
4011
|
const label = react.useMemo(() => {
|
|
@@ -3936,6 +4018,8 @@ const MainButton = () => {
|
|
|
3936
4018
|
return t2("transaction.processing");
|
|
3937
4019
|
case isBusy:
|
|
3938
4020
|
return t2("common.connecting");
|
|
4021
|
+
case requiresCustomAddress:
|
|
4022
|
+
return t2("transaction.pasteAddressToTransfer");
|
|
3939
4023
|
case missingSrc:
|
|
3940
4024
|
return srcChainKey ? chainRegistry.getConnectLabel(srcChainKey, t2) : t2("wallets.connectWallet");
|
|
3941
4025
|
case missingDst:
|
|
@@ -3969,6 +4053,7 @@ const MainButton = () => {
|
|
|
3969
4053
|
missingDst,
|
|
3970
4054
|
srcChainKey,
|
|
3971
4055
|
dstChainKey,
|
|
4056
|
+
requiresCustomAddress,
|
|
3972
4057
|
noRoute,
|
|
3973
4058
|
gas.hasEnoughGas,
|
|
3974
4059
|
amountNum,
|
|
@@ -3987,6 +4072,9 @@ const MainButton = () => {
|
|
|
3987
4072
|
window.open(targetUrl, "_blank", "noopener,noreferrer");
|
|
3988
4073
|
return;
|
|
3989
4074
|
}
|
|
4075
|
+
if (requiresCustomAddress) {
|
|
4076
|
+
return;
|
|
4077
|
+
}
|
|
3990
4078
|
if (missingSrc) {
|
|
3991
4079
|
onOpen("src");
|
|
3992
4080
|
return;
|
|
@@ -4004,7 +4092,7 @@ const MainButton = () => {
|
|
|
4004
4092
|
return;
|
|
4005
4093
|
}
|
|
4006
4094
|
};
|
|
4007
|
-
const disabled = isBusy || status === "loading" || !isTelegramRestricted && !missingSrc && !missingDst && (amountNum <= 0 || isBalanceLoading || hasInsufficientBalance || hasAmountTooLarge || !gas.hasEnoughGas || noRoute || !isValidForTransfer);
|
|
4095
|
+
const disabled = isBusy || status === "loading" || requiresCustomAddress || !isTelegramRestricted && !missingSrc && !missingDst && (amountNum <= 0 || isBalanceLoading || hasInsufficientBalance || hasAmountTooLarge || !gas.hasEnoughGas || noRoute || !isValidForTransfer);
|
|
4008
4096
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pt-4 space-y-4", children: [
|
|
4009
4097
|
isTelegramRestricted && /* @__PURE__ */ jsxRuntime.jsx(alert.Alert, { variant: "warning", className: "mt-2 text-sm font-medium text-center px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(alert.AlertDescription, { className: "leading-snug tracking-wide", children: t2("telegram.restrictionMessage") }) }),
|
|
4010
4098
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -25947,7 +26035,7 @@ class WalletConnectModal {
|
|
|
25947
26035
|
}
|
|
25948
26036
|
async initUi() {
|
|
25949
26037
|
if (typeof window !== "undefined") {
|
|
25950
|
-
await Promise.resolve().then(() => require("./index-
|
|
26038
|
+
await Promise.resolve().then(() => require("./index-B4by666d.cjs"));
|
|
25951
26039
|
const modal = document.createElement("wcm-modal");
|
|
25952
26040
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
25953
26041
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26696,4 +26784,4 @@ exports.useSettingsStore = useSettingsStore;
|
|
|
26696
26784
|
exports.useSwapModel = useSwapModel;
|
|
26697
26785
|
exports.useTokensStore = useTokensStore;
|
|
26698
26786
|
exports.useTransactionStore = useTransactionStore;
|
|
26699
|
-
//# sourceMappingURL=index-
|
|
26787
|
+
//# sourceMappingURL=index-Dv5nujkk.cjs.map
|