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