@rash2x/bridge-widget 0.6.50 → 0.6.53

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.
@@ -10,7 +10,7 @@ import { create } from "zustand";
10
10
  import { useAccount, usePublicClient, useConnect, useDisconnect, useWalletClient } from "wagmi";
11
11
  import { useWallet } from "@tronweb3/tronwallet-adapter-react-hooks";
12
12
  import { useTonAddress, useTonConnectUI } from "@tonconnect/ui-react";
13
- import { Address, loadMessage, Cell, beginCell as beginCell$1, storeMessage } from "@ton/core";
13
+ import { Address, beginCell as beginCell$1, storeMessage, loadMessage, Cell } from "@ton/core";
14
14
  import { TonClient, Address as Address$1, beginCell } from "@ton/ton";
15
15
  import { useQuery, useQueryClient } from "@tanstack/react-query";
16
16
  import { cn as cn$2 } from "@/lib/utils";
@@ -34,7 +34,7 @@ import { FixedSizeList } from "react-window";
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": "Transaction in progress...", "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", "steps": { "sent": "Sent", "processing": "Processing", "processingNote": "Up to 2 minutes", "completed": "Completed" } };
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": "Transaction in progress...", "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", "layerzeroScan": "LayerZero Scan", "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", "steps": { "sent": "Sent", "processing": "Processing", "processingNote": "Up to 2 minutes", "completed": "Completed" } };
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": "Недостаточно газа", "pasteAddressToTransfer": "Укажите адрес получателя", "noRouteFoundForSettings": "Маршрут не найден для текущих настроек.", "tryAdjustSettings": "Попробуйте отключить Gas on Destination или измените сумму/сети.", "quoteError": "Ошибка котировки", "steps": { "sent": "Отправлено", "processing": "Обработка", "processingNote": "До 2 минут", "completed": "Завершено" } };
55
+ const transaction = { "enterAmount": "Введите сумму", "transfer": "Перевести", "getQuote": "Получить котировку", "quoting": "Расчет котировки...", "failed": "Ошибка транзакции", "confirm": "Подтвердите транзакцию", "signTransaction": "Подпишите транзакцию в кошельке", "inProgress": "Транзакция выполняется...", "checkingBalance": "Проверка баланса...", "insufficientBalance": "Недостаточно средств", "amountTooSmall": "Минимум {{min}}", "amountTooLarge": "Максимум {{max}}", "success": "Успех", "successTitle": "Успех", "done": "Готово", "hashCopied": "Хэш скопирован в буфер обмена", "bridged": "Переведено", "transferTitle": "Перевод", "hash": "Хэш", "layerzeroScan": "LayerZero Scan", "finalFee": "Итоговая комиссия", "route": "Маршрут", "estTime": "Время", "slippage": "Проскальзывание", "minimumReceived": "Минимум к получению", "totalFee": "Общая комиссия", "noRouteFound": "Маршрут не найден", "notEnoughGas": "Недостаточно газа", "pasteAddressToTransfer": "Укажите адрес получателя", "noRouteFoundForSettings": "Маршрут не найден для текущих настроек.", "tryAdjustSettings": "Попробуйте отключить Gas on Destination или измените сумму/сети.", "quoteError": "Ошибка котировки", "steps": { "sent": "Отправлено", "processing": "Обработка", "processingNote": "До 2 минут", "completed": "Завершено" } };
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": "Рекомендуемый" } };
@@ -2770,8 +2770,6 @@ const WalletInlineButton = ({
2770
2770
  const connection = chainRegistry.getStrategyByType(walletType);
2771
2771
  const account = connection?.getAccount();
2772
2772
  const isConnected = connection?.isConnected();
2773
- const isConnecting = connection?.isConnecting();
2774
- const isInitialized = connection?.isInitialized() ?? true;
2775
2773
  const error = connection?.getError();
2776
2774
  const availableConnections = useMemo(
2777
2775
  () => connection?.getAvailableConnections() ?? [],
@@ -2794,14 +2792,11 @@ const WalletInlineButton = ({
2794
2792
  onOpen(addressType);
2795
2793
  }, [onOpen, addressType]);
2796
2794
  const buttonText = useMemo(() => {
2797
- if ((wallet === "metamask" || wallet === "tronlink") && !isInitialized)
2798
- return t2("common.initializing");
2799
- if (isConnecting) return t2("common.connecting");
2800
2795
  if (isConnected && account) return formatAddress(account);
2801
2796
  if (wallet === "ton") return t2("wallets.addTonWallet");
2802
2797
  if (wallet === "tronlink") return t2("wallets.addTronWallet");
2803
2798
  return t2("wallets.addEvmWallet");
2804
- }, [wallet, isInitialized, isConnecting, isConnected, account, t2]);
2799
+ }, [wallet, isConnected, account, t2]);
2805
2800
  const connectedIcon = useMemo(() => {
2806
2801
  if (!isConnected) return null;
2807
2802
  if (walletType === "tron" && activeTronConnection) {
@@ -2818,7 +2813,7 @@ const WalletInlineButton = ({
2818
2813
  }
2819
2814
  return prefixIcons[wallet];
2820
2815
  }, [activeTronConnection, evmConnectorId, isConnected, wallet, walletType]);
2821
- const isButtonDisabled = (wallet === "metamask" || wallet === "tronlink") && !isInitialized || isConnecting || addressType === "dst" && isCustomAddressEnabled;
2816
+ const isButtonDisabled = addressType === "dst" && isCustomAddressEnabled;
2822
2817
  return /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-col items-start gap-1", children: [
2823
2818
  /* @__PURE__ */ jsxs(
2824
2819
  Button,
@@ -3147,12 +3142,6 @@ const TokenSymbol = ({
3147
3142
  const src2 = `${BASE_URL}/${normalizedSymbol}.svg`;
3148
3143
  return /* @__PURE__ */ jsx("img", { src: src2, alt: alt ?? symbol, className });
3149
3144
  };
3150
- function getSimpleFallback(chainKey) {
3151
- const key = chainKey.toLowerCase();
3152
- if (key === "ton") return 0.15;
3153
- if (key === "tron") return 10;
3154
- return 2e-3;
3155
- }
3156
3145
  function useGasEstimate(amountNum) {
3157
3146
  const { fromChain } = useChainsStore();
3158
3147
  const { selectedAssetSymbol } = useTokensStore();
@@ -3189,7 +3178,7 @@ function useGasEstimate(amountNum) {
3189
3178
  if (quoteFees && quoteSrcChainKey === chainKey) {
3190
3179
  const fees = quoteFees;
3191
3180
  const feesInNative = fees.filter(
3192
- (f4) => f4.chainKey === chainKey && f4.token === nativeCurrencyAddress
3181
+ (f4) => f4.chainKey === chainKey && f4.token === nativeCurrencyAddress && f4.type === "network"
3193
3182
  ).reduce(
3194
3183
  (sum, f4) => sum + BigInt(f4.amount || "0"),
3195
3184
  0n
@@ -3197,8 +3186,6 @@ function useGasEstimate(amountNum) {
3197
3186
  const decimals = nativeCurrencyDecimals || 18;
3198
3187
  requiredNative = Number(feesInNative) / Math.pow(10, decimals);
3199
3188
  quoteFeesAvailable = true;
3200
- } else {
3201
- requiredNative = getSimpleFallback(chainKey);
3202
3189
  }
3203
3190
  let hasEnoughGas = true;
3204
3191
  if (isNativeSelected) {
@@ -3483,6 +3470,12 @@ const useTransactionStore = create((set2, get2) => ({
3483
3470
  const next = { ...cur, dstTxHash: hash, updatedAt: Date.now() };
3484
3471
  set2({ current: next });
3485
3472
  },
3473
+ setTonTransactionHash: (hash) => {
3474
+ const cur = get2().current;
3475
+ if (!cur) return;
3476
+ const next = { ...cur, tonTransactionHash: hash, updatedAt: Date.now() };
3477
+ set2({ current: next });
3478
+ },
3486
3479
  setError: (errorCode, errorParams) => {
3487
3480
  const cur = get2().current;
3488
3481
  if (!cur) return;
@@ -3509,6 +3502,21 @@ const useTransactionStore = create((set2, get2) => ({
3509
3502
  };
3510
3503
  set2({ current: next });
3511
3504
  },
3505
+ updateLayerZeroTotalFee: (feeValue, feeSymbol, feeUsd) => {
3506
+ const cur = get2().current;
3507
+ if (!cur) return;
3508
+ const next = {
3509
+ ...cur,
3510
+ metadata: {
3511
+ ...cur.metadata,
3512
+ layerZeroTotalFeeValue: feeValue,
3513
+ layerZeroTotalFeeSymbol: feeSymbol,
3514
+ layerZeroTotalFeeUsd: feeUsd
3515
+ },
3516
+ updatedAt: Date.now()
3517
+ };
3518
+ set2({ current: next });
3519
+ },
3512
3520
  reset: () => {
3513
3521
  set2({ current: void 0 });
3514
3522
  }
@@ -3678,11 +3686,29 @@ function toChainStrategyError(error, chainKey, context) {
3678
3686
  }
3679
3687
  return new ChainStrategyError(String(error), "UNKNOWN_ERROR", chainKey);
3680
3688
  }
3689
+ async function getLayerZeroMessageByTx(txHash) {
3690
+ try {
3691
+ const res = await fetch(
3692
+ `https://scan.layerzero-api.com/v1/messages/tx/${txHash}`
3693
+ );
3694
+ if (!res.ok) return null;
3695
+ const payload = await res.json();
3696
+ const messages = Array.isArray(payload?.data) ? payload?.data : [];
3697
+ if (!messages.length) return null;
3698
+ const lower2 = txHash.toLowerCase();
3699
+ return messages.find(
3700
+ (msg) => msg?.source?.tx?.txHash?.toLowerCase() === lower2
3701
+ ) ?? messages[0] ?? null;
3702
+ } catch (error) {
3703
+ console.warn("LayerZero message fetch failed:", error);
3704
+ return null;
3705
+ }
3706
+ }
3681
3707
  function useBridgeTransaction() {
3682
3708
  const { quote } = useBridgeQuoteStore();
3683
3709
  const { chainRegistry } = useChainStrategies();
3684
3710
  const { srcAddress, dstAddress } = useAddresses();
3685
- const { assetMatrix, selectedAssetSymbol } = useTokensStore();
3711
+ const { assetMatrix, selectedAssetSymbol, allTokens } = useTokensStore();
3686
3712
  const { chains } = useChainsStore();
3687
3713
  const txStore = useTransactionStore();
3688
3714
  const [isProcessing, setIsProcessing] = useState(false);
@@ -3753,6 +3779,9 @@ function useBridgeTransaction() {
3753
3779
  txStore.setSrcHash(hash);
3754
3780
  txStore.updateStatus("processing");
3755
3781
  });
3782
+ if (txResult?.tonTransactionHash) {
3783
+ txStore.setTonTransactionHash(txResult.tonTransactionHash);
3784
+ }
3756
3785
  if (txResult?.hash) {
3757
3786
  strategy.waitForCompletion(txResult.hash, context).then((result) => {
3758
3787
  if (result.completed) {
@@ -3774,6 +3803,30 @@ function useBridgeTransaction() {
3774
3803
  }
3775
3804
  txStore.updateStatus("completed");
3776
3805
  console.log("Transaction completed successfully");
3806
+ if (txResult.hash && strategy.getSourceCost) {
3807
+ const srcChain2 = chains?.find(
3808
+ (c2) => c2.chainKey === quote.srcChainKey
3809
+ );
3810
+ const feeSymbol = srcChain2?.nativeCurrency?.symbol || "";
3811
+ const { priceUsd } = findNativeMeta(allTokens, srcChain2);
3812
+ const srcHash = txResult.hash;
3813
+ const getSourceCost = strategy.getSourceCost;
3814
+ getLayerZeroMessageByTx(srcHash).then((message) => {
3815
+ if (quote.srcChainKey === "ton") return srcHash;
3816
+ return message?.source?.tx?.txHash ?? srcHash;
3817
+ }).then((sourceTxHash) => getSourceCost(sourceTxHash)).then((sourceCost) => {
3818
+ if (sourceCost?.totalNative !== void 0 && isFinite(sourceCost.totalNative)) {
3819
+ const feeUsd = priceUsd && priceUsd > 0 ? sourceCost.totalNative * priceUsd : void 0;
3820
+ txStore.updateLayerZeroTotalFee(
3821
+ sourceCost.totalNative,
3822
+ feeSymbol,
3823
+ feeUsd
3824
+ );
3825
+ }
3826
+ }).catch((error) => {
3827
+ console.warn("Failed to compute LayerZero total fee:", error);
3828
+ });
3829
+ }
3777
3830
  } else {
3778
3831
  txStore.setError("TRANSACTION_FAILED_TO_COMPLETE");
3779
3832
  console.error("Transaction completion failed:", result.error);
@@ -4527,7 +4580,7 @@ const EXPLORER_CONFIGS = {
4527
4580
  }
4528
4581
  };
4529
4582
  function getExplorerTxUrl(chainKey, txHash) {
4530
- if (!chainKey || !txHash) {
4583
+ if (!txHash) {
4531
4584
  return null;
4532
4585
  }
4533
4586
  const normalizedChainKey = chainKey.toLowerCase();
@@ -4554,8 +4607,12 @@ const SuccessStep = ({
4554
4607
  const { chains } = useChainsStore();
4555
4608
  const metadata = current?.metadata;
4556
4609
  const srcTxHash = current?.srcTxHash;
4610
+ const tonTransactionHash = current?.tonTransactionHash;
4557
4611
  const srcChainKey = current?.quote?.srcChainKey;
4558
4612
  const quote = current?.quote;
4613
+ const layerZeroTotalFeeValue = metadata?.layerZeroTotalFeeValue;
4614
+ const layerZeroTotalFeeSymbol = metadata?.layerZeroTotalFeeSymbol;
4615
+ const layerZeroTotalFeeUsd = metadata?.layerZeroTotalFeeUsd;
4559
4616
  const estimatedFee = useMemo(() => {
4560
4617
  if (!quote?.fees || !srcChainKey || !chains) return null;
4561
4618
  const srcChain = chains.find((c2) => c2.chainKey === srcChainKey);
@@ -4582,9 +4639,50 @@ const SuccessStep = ({
4582
4639
  }
4583
4640
  return estimatedFee;
4584
4641
  }, [metadata?.actualFeeValue, metadata?.actualFeeSymbol, estimatedFee]);
4642
+ const totalFee = useMemo(() => {
4643
+ if (layerZeroTotalFeeUsd !== void 0 && isFinite(layerZeroTotalFeeUsd) && layerZeroTotalFeeUsd > 0) {
4644
+ return {
4645
+ label: t2("transaction.totalFee"),
4646
+ display: formatUsd(layerZeroTotalFeeUsd)
4647
+ };
4648
+ }
4649
+ if (layerZeroTotalFeeValue !== void 0 && layerZeroTotalFeeSymbol) {
4650
+ return {
4651
+ label: t2("transaction.totalFee"),
4652
+ display: `${formatBalance(layerZeroTotalFeeValue, 6)} ${layerZeroTotalFeeSymbol}`
4653
+ };
4654
+ }
4655
+ if (!finalFee) return null;
4656
+ return {
4657
+ label: t2("transaction.finalFee"),
4658
+ display: `${formatBalance(finalFee.value, 6)} ${finalFee.symbol}`
4659
+ };
4660
+ }, [
4661
+ layerZeroTotalFeeUsd,
4662
+ layerZeroTotalFeeValue,
4663
+ layerZeroTotalFeeSymbol,
4664
+ finalFee,
4665
+ t2
4666
+ ]);
4585
4667
  const handleOpenExplorer = () => {
4586
- if (srcTxHash && srcChainKey) {
4587
- openTransactionInExplorer(srcChainKey, srcTxHash);
4668
+ if (srcChainKey === "ton") {
4669
+ if (tonTransactionHash) {
4670
+ window.open(
4671
+ `https://layerzeroscan.com/tx/${tonTransactionHash}`,
4672
+ "_blank",
4673
+ "noopener,noreferrer"
4674
+ );
4675
+ } else if (srcTxHash) {
4676
+ openTransactionInExplorer("ton", srcTxHash);
4677
+ }
4678
+ return;
4679
+ }
4680
+ if (srcTxHash) {
4681
+ window.open(
4682
+ `https://layerzeroscan.com/tx/${srcTxHash}`,
4683
+ "_blank",
4684
+ "noopener,noreferrer"
4685
+ );
4588
4686
  }
4589
4687
  };
4590
4688
  return /* @__PURE__ */ jsxs(
@@ -4635,7 +4733,7 @@ const SuccessStep = ({
4635
4733
  ] })
4636
4734
  ] }),
4637
4735
  srcTxHash && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
4638
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t2("transaction.hash") }),
4736
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: srcChainKey !== "ton" || tonTransactionHash ? t2("transaction.layerzeroScan") : t2("transaction.hash") }),
4639
4737
  /* @__PURE__ */ jsx(
4640
4738
  "button",
4641
4739
  {
@@ -4645,13 +4743,9 @@ const SuccessStep = ({
4645
4743
  }
4646
4744
  )
4647
4745
  ] }),
4648
- finalFee && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
4649
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t2("transaction.finalFee") }),
4650
- /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
4651
- formatBalance(finalFee.value, 6),
4652
- " ",
4653
- finalFee.symbol
4654
- ] })
4746
+ totalFee && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
4747
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: totalFee.label }),
4748
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: totalFee.display })
4655
4749
  ] })
4656
4750
  ] })
4657
4751
  ] }),
@@ -5200,6 +5294,35 @@ class EvmChainStrategy {
5200
5294
  throw new InvalidStepsError("evm", "Missing transaction data in steps");
5201
5295
  }
5202
5296
  }
5297
+ async getSourceCost(txHash) {
5298
+ if (!this.publicClient) {
5299
+ console.warn("No publicClient available for source cost query");
5300
+ return null;
5301
+ }
5302
+ try {
5303
+ const hash = txHash.startsWith("0x") ? txHash : `0x${txHash}`;
5304
+ const [receipt, tx] = await Promise.all([
5305
+ this.publicClient.getTransactionReceipt({ hash }),
5306
+ this.publicClient.getTransaction({ hash })
5307
+ ]);
5308
+ if (!receipt || !tx) return null;
5309
+ const gasUsed = receipt.gasUsed ?? 0n;
5310
+ const gasPrice = receipt.effectiveGasPrice ?? tx.gasPrice ?? 0n;
5311
+ const gasFeeWei = gasUsed * gasPrice;
5312
+ const txValueWei = tx.value ?? 0n;
5313
+ const totalWei = gasFeeWei + txValueWei;
5314
+ return {
5315
+ totalNative: Number(formatUnits(totalWei, 18)),
5316
+ breakdown: {
5317
+ gasFee: Number(formatUnits(gasFeeWei, 18)),
5318
+ layerZeroFee: Number(formatUnits(txValueWei, 18))
5319
+ }
5320
+ };
5321
+ } catch (error) {
5322
+ console.warn("Failed to compute EVM source cost:", error);
5323
+ return null;
5324
+ }
5325
+ }
5203
5326
  async executeSteps(steps, _context, onFirstHash) {
5204
5327
  if (!this.isConnected() || !this.walletClient) {
5205
5328
  throw new WalletNotConnectedError("evm");
@@ -5519,6 +5642,66 @@ class EvmChainStrategy {
5519
5642
  }
5520
5643
  }
5521
5644
  }
5645
+ function getNormalizedExtMessageHash(message) {
5646
+ if (message.info.type !== "external-in") {
5647
+ throw new Error(`Expected external-in message, got ${message.info.type}`);
5648
+ }
5649
+ const normalizedInfo = {
5650
+ ...message.info,
5651
+ src: void 0,
5652
+ importFee: 0n
5653
+ };
5654
+ const normalizedMessage = {
5655
+ ...message,
5656
+ info: normalizedInfo,
5657
+ init: null
5658
+ };
5659
+ return beginCell$1().store(storeMessage(normalizedMessage, { forceRef: true })).endCell().hash();
5660
+ }
5661
+ async function getTonTransactionHash(messageHash, userAddress, searchLimit = 20, options) {
5662
+ try {
5663
+ const client = options?.client ?? new TonClient({
5664
+ endpoint: "https://toncenter.com/api/v2/jsonRPC",
5665
+ apiKey: process.env.TONCENTER_API_KEY
5666
+ // Optional: for rate limit increase
5667
+ });
5668
+ const messageHasher = options?.messageHasher ?? getNormalizedExtMessageHash;
5669
+ const address = Address.parse(userAddress);
5670
+ const transactions = await client.getTransactions(address, {
5671
+ limit: searchLimit
5672
+ });
5673
+ for (const tx of transactions) {
5674
+ const inMsg = tx.inMessage;
5675
+ if (!inMsg) continue;
5676
+ try {
5677
+ const inMsgHash = messageHasher(inMsg).toString("hex");
5678
+ if (inMsgHash === messageHash.replace("0x", "")) {
5679
+ const txHash = tx.hash().toString("hex");
5680
+ return {
5681
+ transactionHash: `0x${txHash}`,
5682
+ messageHash,
5683
+ found: true
5684
+ };
5685
+ }
5686
+ } catch {
5687
+ continue;
5688
+ }
5689
+ }
5690
+ console.warn(`TON transaction not found for message hash: ${messageHash}`);
5691
+ return {
5692
+ transactionHash: null,
5693
+ messageHash,
5694
+ found: false
5695
+ };
5696
+ } catch (error) {
5697
+ console.error("Failed to get TON transaction hash:", error);
5698
+ return {
5699
+ transactionHash: null,
5700
+ messageHash,
5701
+ found: false
5702
+ };
5703
+ }
5704
+ }
5522
5705
  class TonChainStrategy {
5523
5706
  constructor(config) {
5524
5707
  __publicField(this, "config");
@@ -5640,9 +5823,31 @@ class TonChainStrategy {
5640
5823
  const messageHash = this.getNormalizedExtMessageHash(inMessage);
5641
5824
  const hexHash = messageHash.toString("hex");
5642
5825
  onFirstHash?.(hexHash);
5826
+ let tonTransactionHash;
5827
+ if (this.config.tonAddress) {
5828
+ try {
5829
+ const tonTxResult = await getTonTransactionHash(
5830
+ hexHash,
5831
+ this.config.tonAddress,
5832
+ 20
5833
+ );
5834
+ if (tonTxResult.found && tonTxResult.transactionHash) {
5835
+ tonTransactionHash = tonTxResult.transactionHash;
5836
+ } else {
5837
+ console.warn(
5838
+ `TON transaction hash not found for message hash: ${hexHash}`
5839
+ );
5840
+ }
5841
+ } catch (error) {
5842
+ console.error("Failed to convert TON message hash:", error);
5843
+ }
5844
+ }
5643
5845
  return {
5644
5846
  chainKey: "ton",
5645
- hash: hexHash
5847
+ hash: hexHash,
5848
+ // Message hash for TONScan
5849
+ tonTransactionHash
5850
+ // Transaction hash for LayerZero (if found)
5646
5851
  };
5647
5852
  } catch (error) {
5648
5853
  console.error("Error parsing BOC to hex hash:", error);
@@ -5706,6 +5911,63 @@ class TonChainStrategy {
5706
5911
  };
5707
5912
  return beginCell$1().store(storeMessage(normalizedMessage, { forceRef: true })).endCell().hash();
5708
5913
  }
5914
+ toBigInt(value) {
5915
+ if (typeof value === "bigint") return value;
5916
+ if (typeof value === "number" && Number.isFinite(value)) {
5917
+ return BigInt(Math.trunc(value));
5918
+ }
5919
+ if (typeof value === "string" && value.trim() !== "") {
5920
+ try {
5921
+ return BigInt(value);
5922
+ } catch {
5923
+ return null;
5924
+ }
5925
+ }
5926
+ return null;
5927
+ }
5928
+ getOutMessages(tx) {
5929
+ const candidate = tx.outMessages;
5930
+ if (!candidate) return [];
5931
+ if (Array.isArray(candidate)) return candidate;
5932
+ if (candidate instanceof Map) return Array.from(candidate.values());
5933
+ if (typeof candidate === "object" && candidate !== null && "values" in candidate && typeof candidate.values === "function") {
5934
+ return Array.from(
5935
+ candidate.values()
5936
+ );
5937
+ }
5938
+ return [];
5939
+ }
5940
+ getMessageValue(message) {
5941
+ const info = message.info;
5942
+ const value = info?.value;
5943
+ if (!value) return null;
5944
+ if (typeof value === "object" && value !== null && "coins" in value) {
5945
+ return this.toBigInt(value.coins);
5946
+ }
5947
+ return this.toBigInt(value);
5948
+ }
5949
+ getFirstOutMessageValue(tx) {
5950
+ const outMessages = this.getOutMessages(tx);
5951
+ if (!outMessages.length) return 0n;
5952
+ const value = this.getMessageValue(outMessages[0]);
5953
+ return value ?? 0n;
5954
+ }
5955
+ async getSourceCost(txHash) {
5956
+ const timeoutMs = Math.min(TON_CONFIG.timeout, 12e4);
5957
+ const result = await this.checkTonTransaction(txHash, timeoutMs);
5958
+ if (!result.confirmed) return null;
5959
+ const totalFees = result.totalFees ?? 0n;
5960
+ const outValue = result.outValue ?? 0n;
5961
+ const totalNanotons = totalFees + outValue;
5962
+ const toTon = (value) => Number(value) / 1e9;
5963
+ return {
5964
+ totalNative: toTon(totalNanotons),
5965
+ breakdown: {
5966
+ gasFee: toTon(totalFees),
5967
+ layerZeroFee: toTon(outValue)
5968
+ }
5969
+ };
5970
+ }
5709
5971
  async checkTonTransaction(hashOrBoc, timeoutMs = 36e4) {
5710
5972
  const deadline = Date.now() + timeoutMs;
5711
5973
  const client = getTonClient(this.config.tonClient, this.config.tonApiKey);
@@ -5754,12 +6016,17 @@ class TonChainStrategy {
5754
6016
  );
5755
6017
  if (txInMessageHash.equals(targetMessageHash)) {
5756
6018
  console.debug("Transaction found by in-message hash");
5757
- const totalFees = tx.totalFees;
6019
+ const totalFees = this.toBigInt(
6020
+ tx.totalFees
6021
+ ) ?? 0n;
6022
+ const outValue = this.getFirstOutMessageValue(tx);
5758
6023
  const feeInTon = Number(totalFees) / 1e9;
5759
6024
  console.log(`TON transaction fee: ${feeInTon} TON`);
5760
6025
  return {
5761
6026
  confirmed: true,
5762
- fee: feeInTon.toString()
6027
+ fee: feeInTon.toString(),
6028
+ totalFees,
6029
+ outValue
5763
6030
  };
5764
6031
  }
5765
6032
  }
@@ -5934,6 +6201,36 @@ class TronChainStrategy {
5934
6201
  throw new InvalidTransactionDataError("tron", "Missing transaction data");
5935
6202
  }
5936
6203
  }
6204
+ async getSourceCost(txHash) {
6205
+ const tronWeb = this.getClient();
6206
+ if (!tronWeb) {
6207
+ console.warn("No TronWeb client available for source cost query");
6208
+ return null;
6209
+ }
6210
+ try {
6211
+ const [info, tx] = await Promise.all([
6212
+ tronWeb.trx.getTransactionInfo(txHash),
6213
+ tronWeb.trx.getTransaction(txHash)
6214
+ ]);
6215
+ const feeSun = info?.fee ?? 0;
6216
+ const paramValue = tx?.raw_data?.contract?.[0]?.parameter?.value ?? {};
6217
+ const callValueRaw = paramValue["call_value"] ?? paramValue["callValue"] ?? paramValue["amount"] ?? 0;
6218
+ const callValueSun = typeof callValueRaw === "string" ? Number(callValueRaw) : typeof callValueRaw === "number" ? callValueRaw : 0;
6219
+ const feeTrx = feeSun / 1e6;
6220
+ const lzFeeTrx = callValueSun / 1e6;
6221
+ const totalTrx = (feeSun + callValueSun) / 1e6;
6222
+ return {
6223
+ totalNative: totalTrx,
6224
+ breakdown: {
6225
+ gasFee: feeTrx,
6226
+ layerZeroFee: lzFeeTrx
6227
+ }
6228
+ };
6229
+ } catch (error) {
6230
+ console.warn("Failed to compute TRON source cost:", error);
6231
+ return null;
6232
+ }
6233
+ }
5937
6234
  async executeSteps(steps, _context, onFirstHash) {
5938
6235
  const tronWeb = this.getClient();
5939
6236
  if (!tronWeb) {
@@ -7733,20 +8030,6 @@ function requireEvents() {
7733
8030
  var eventsExports = requireEvents();
7734
8031
  const xe$3 = /* @__PURE__ */ getDefaultExportFromCjs(eventsExports);
7735
8032
  var cjs$3 = {};
7736
- /*! *****************************************************************************
7737
- Copyright (c) Microsoft Corporation.
7738
-
7739
- Permission to use, copy, modify, and/or distribute this software for any
7740
- purpose with or without fee is hereby granted.
7741
-
7742
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7743
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7744
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7745
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7746
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7747
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7748
- PERFORMANCE OF THIS SOFTWARE.
7749
- ***************************************************************************** */
7750
8033
  var extendStatics = function(d3, b2) {
7751
8034
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b3) {
7752
8035
  d4.__proto__ = b3;
@@ -7897,8 +8180,8 @@ function __createBinding(o3, m3, k2, k22) {
7897
8180
  if (k22 === void 0) k22 = k2;
7898
8181
  o3[k22] = m3[k2];
7899
8182
  }
7900
- function __exportStar(m3, exports) {
7901
- for (var p2 in m3) if (p2 !== "default" && !exports.hasOwnProperty(p2)) exports[p2] = m3[p2];
8183
+ function __exportStar(m3, exports$1) {
8184
+ for (var p2 in m3) if (p2 !== "default" && !exports$1.hasOwnProperty(p2)) exports$1[p2] = m3[p2];
7902
8185
  }
7903
8186
  function __values(o3) {
7904
8187
  var s2 = typeof Symbol === "function" && Symbol.iterator, m3 = s2 && o3[s2], i3 = 0;
@@ -8106,34 +8389,34 @@ var hasRequiredTime;
8106
8389
  function requireTime() {
8107
8390
  if (hasRequiredTime) return time;
8108
8391
  hasRequiredTime = 1;
8109
- (function(exports) {
8110
- Object.defineProperty(exports, "__esModule", { value: true });
8111
- exports.ONE_YEAR = exports.FOUR_WEEKS = exports.THREE_WEEKS = exports.TWO_WEEKS = exports.ONE_WEEK = exports.THIRTY_DAYS = exports.SEVEN_DAYS = exports.FIVE_DAYS = exports.THREE_DAYS = exports.ONE_DAY = exports.TWENTY_FOUR_HOURS = exports.TWELVE_HOURS = exports.SIX_HOURS = exports.THREE_HOURS = exports.ONE_HOUR = exports.SIXTY_MINUTES = exports.THIRTY_MINUTES = exports.TEN_MINUTES = exports.FIVE_MINUTES = exports.ONE_MINUTE = exports.SIXTY_SECONDS = exports.THIRTY_SECONDS = exports.TEN_SECONDS = exports.FIVE_SECONDS = exports.ONE_SECOND = void 0;
8112
- exports.ONE_SECOND = 1;
8113
- exports.FIVE_SECONDS = 5;
8114
- exports.TEN_SECONDS = 10;
8115
- exports.THIRTY_SECONDS = 30;
8116
- exports.SIXTY_SECONDS = 60;
8117
- exports.ONE_MINUTE = exports.SIXTY_SECONDS;
8118
- exports.FIVE_MINUTES = exports.ONE_MINUTE * 5;
8119
- exports.TEN_MINUTES = exports.ONE_MINUTE * 10;
8120
- exports.THIRTY_MINUTES = exports.ONE_MINUTE * 30;
8121
- exports.SIXTY_MINUTES = exports.ONE_MINUTE * 60;
8122
- exports.ONE_HOUR = exports.SIXTY_MINUTES;
8123
- exports.THREE_HOURS = exports.ONE_HOUR * 3;
8124
- exports.SIX_HOURS = exports.ONE_HOUR * 6;
8125
- exports.TWELVE_HOURS = exports.ONE_HOUR * 12;
8126
- exports.TWENTY_FOUR_HOURS = exports.ONE_HOUR * 24;
8127
- exports.ONE_DAY = exports.TWENTY_FOUR_HOURS;
8128
- exports.THREE_DAYS = exports.ONE_DAY * 3;
8129
- exports.FIVE_DAYS = exports.ONE_DAY * 5;
8130
- exports.SEVEN_DAYS = exports.ONE_DAY * 7;
8131
- exports.THIRTY_DAYS = exports.ONE_DAY * 30;
8132
- exports.ONE_WEEK = exports.SEVEN_DAYS;
8133
- exports.TWO_WEEKS = exports.ONE_WEEK * 2;
8134
- exports.THREE_WEEKS = exports.ONE_WEEK * 3;
8135
- exports.FOUR_WEEKS = exports.ONE_WEEK * 4;
8136
- exports.ONE_YEAR = exports.ONE_DAY * 365;
8392
+ (function(exports$1) {
8393
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8394
+ exports$1.ONE_YEAR = exports$1.FOUR_WEEKS = exports$1.THREE_WEEKS = exports$1.TWO_WEEKS = exports$1.ONE_WEEK = exports$1.THIRTY_DAYS = exports$1.SEVEN_DAYS = exports$1.FIVE_DAYS = exports$1.THREE_DAYS = exports$1.ONE_DAY = exports$1.TWENTY_FOUR_HOURS = exports$1.TWELVE_HOURS = exports$1.SIX_HOURS = exports$1.THREE_HOURS = exports$1.ONE_HOUR = exports$1.SIXTY_MINUTES = exports$1.THIRTY_MINUTES = exports$1.TEN_MINUTES = exports$1.FIVE_MINUTES = exports$1.ONE_MINUTE = exports$1.SIXTY_SECONDS = exports$1.THIRTY_SECONDS = exports$1.TEN_SECONDS = exports$1.FIVE_SECONDS = exports$1.ONE_SECOND = void 0;
8395
+ exports$1.ONE_SECOND = 1;
8396
+ exports$1.FIVE_SECONDS = 5;
8397
+ exports$1.TEN_SECONDS = 10;
8398
+ exports$1.THIRTY_SECONDS = 30;
8399
+ exports$1.SIXTY_SECONDS = 60;
8400
+ exports$1.ONE_MINUTE = exports$1.SIXTY_SECONDS;
8401
+ exports$1.FIVE_MINUTES = exports$1.ONE_MINUTE * 5;
8402
+ exports$1.TEN_MINUTES = exports$1.ONE_MINUTE * 10;
8403
+ exports$1.THIRTY_MINUTES = exports$1.ONE_MINUTE * 30;
8404
+ exports$1.SIXTY_MINUTES = exports$1.ONE_MINUTE * 60;
8405
+ exports$1.ONE_HOUR = exports$1.SIXTY_MINUTES;
8406
+ exports$1.THREE_HOURS = exports$1.ONE_HOUR * 3;
8407
+ exports$1.SIX_HOURS = exports$1.ONE_HOUR * 6;
8408
+ exports$1.TWELVE_HOURS = exports$1.ONE_HOUR * 12;
8409
+ exports$1.TWENTY_FOUR_HOURS = exports$1.ONE_HOUR * 24;
8410
+ exports$1.ONE_DAY = exports$1.TWENTY_FOUR_HOURS;
8411
+ exports$1.THREE_DAYS = exports$1.ONE_DAY * 3;
8412
+ exports$1.FIVE_DAYS = exports$1.ONE_DAY * 5;
8413
+ exports$1.SEVEN_DAYS = exports$1.ONE_DAY * 7;
8414
+ exports$1.THIRTY_DAYS = exports$1.ONE_DAY * 30;
8415
+ exports$1.ONE_WEEK = exports$1.SEVEN_DAYS;
8416
+ exports$1.TWO_WEEKS = exports$1.ONE_WEEK * 2;
8417
+ exports$1.THREE_WEEKS = exports$1.ONE_WEEK * 3;
8418
+ exports$1.FOUR_WEEKS = exports$1.ONE_WEEK * 4;
8419
+ exports$1.ONE_YEAR = exports$1.ONE_DAY * 365;
8137
8420
  })(time);
8138
8421
  return time;
8139
8422
  }
@@ -8141,11 +8424,11 @@ var hasRequiredConstants;
8141
8424
  function requireConstants() {
8142
8425
  if (hasRequiredConstants) return constants;
8143
8426
  hasRequiredConstants = 1;
8144
- (function(exports) {
8145
- Object.defineProperty(exports, "__esModule", { value: true });
8427
+ (function(exports$1) {
8428
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8146
8429
  const tslib_1 = require$$0;
8147
- tslib_1.__exportStar(requireMisc(), exports);
8148
- tslib_1.__exportStar(requireTime(), exports);
8430
+ tslib_1.__exportStar(requireMisc(), exports$1);
8431
+ tslib_1.__exportStar(requireTime(), exports$1);
8149
8432
  })(constants);
8150
8433
  return constants;
8151
8434
  }
@@ -8170,11 +8453,11 @@ var hasRequiredUtils;
8170
8453
  function requireUtils() {
8171
8454
  if (hasRequiredUtils) return utils;
8172
8455
  hasRequiredUtils = 1;
8173
- (function(exports) {
8174
- Object.defineProperty(exports, "__esModule", { value: true });
8456
+ (function(exports$1) {
8457
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8175
8458
  const tslib_1 = require$$0;
8176
- tslib_1.__exportStar(requireDelay(), exports);
8177
- tslib_1.__exportStar(requireConvert(), exports);
8459
+ tslib_1.__exportStar(requireDelay(), exports$1);
8460
+ tslib_1.__exportStar(requireConvert(), exports$1);
8178
8461
  })(utils);
8179
8462
  return utils;
8180
8463
  }
@@ -8237,10 +8520,10 @@ var hasRequiredTypes;
8237
8520
  function requireTypes() {
8238
8521
  if (hasRequiredTypes) return types;
8239
8522
  hasRequiredTypes = 1;
8240
- (function(exports) {
8241
- Object.defineProperty(exports, "__esModule", { value: true });
8523
+ (function(exports$1) {
8524
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8242
8525
  const tslib_1 = require$$0;
8243
- tslib_1.__exportStar(requireWatch(), exports);
8526
+ tslib_1.__exportStar(requireWatch(), exports$1);
8244
8527
  })(types);
8245
8528
  return types;
8246
8529
  }
@@ -8248,13 +8531,13 @@ var hasRequiredCjs$3;
8248
8531
  function requireCjs$3() {
8249
8532
  if (hasRequiredCjs$3) return cjs$3;
8250
8533
  hasRequiredCjs$3 = 1;
8251
- (function(exports) {
8252
- Object.defineProperty(exports, "__esModule", { value: true });
8534
+ (function(exports$1) {
8535
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8253
8536
  const tslib_1 = require$$0;
8254
- tslib_1.__exportStar(requireUtils(), exports);
8255
- tslib_1.__exportStar(requireWatch$1(), exports);
8256
- tslib_1.__exportStar(requireTypes(), exports);
8257
- tslib_1.__exportStar(requireConstants(), exports);
8537
+ tslib_1.__exportStar(requireUtils(), exports$1);
8538
+ tslib_1.__exportStar(requireWatch$1(), exports$1);
8539
+ tslib_1.__exportStar(requireTypes(), exports$1);
8540
+ tslib_1.__exportStar(requireConstants(), exports$1);
8258
8541
  })(cjs$3);
8259
8542
  return cjs$3;
8260
8543
  }
@@ -9213,7 +9496,7 @@ const j$4 = we$4().console || {}, le$2 = { mapHttpRequest: C$3, mapHttpResponse:
9213
9496
  function m$2(e2, t2) {
9214
9497
  return e2 === "silent" ? 1 / 0 : t2.levels.values[e2];
9215
9498
  }
9216
- const A$2 = Symbol("pino.logFuncs"), P$4 = Symbol("pino.hierarchy"), ae$2 = { error: "log", fatal: "error", warn: "error", info: "log", debug: "log", trace: "log" };
9499
+ const A$2 = /* @__PURE__ */ Symbol("pino.logFuncs"), P$4 = /* @__PURE__ */ Symbol("pino.hierarchy"), ae$2 = { error: "log", fatal: "error", warn: "error", info: "log", debug: "log", trace: "log" };
9217
9500
  function R$2(e2, t2) {
9218
9501
  const r2 = { logger: t2, parent: e2[P$4] };
9219
9502
  t2[P$4] = r2;
@@ -9652,7 +9935,6 @@ function gn$2(t2, e2) {
9652
9935
  if (t2.length < n3) throw new Error("digestInto() expects output buffer of length at least " + n3);
9653
9936
  }
9654
9937
  const it$1 = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
9655
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
9656
9938
  const _t$3 = (t2) => new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
9657
9939
  function yn$2(t2) {
9658
9940
  if (typeof t2 != "string") throw new Error("utf8ToBytes expected string, got " + typeof t2);
@@ -9777,7 +10059,6 @@ let Jn$2 = class Jn extends An$2 {
9777
10059
  }
9778
10060
  };
9779
10061
  const Kn$2 = Bn$2(() => new Jn$2());
9780
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
9781
10062
  const vt$3 = BigInt(0), be$3 = BigInt(1), Wn$2 = BigInt(2);
9782
10063
  function It$4(t2) {
9783
10064
  return t2 instanceof Uint8Array || ArrayBuffer.isView(t2) && t2.constructor.name === "Uint8Array";
@@ -11061,7 +11342,6 @@ function walk(err, fn2) {
11061
11342
  return fn2 ? null : err;
11062
11343
  }
11063
11344
  const crypto$2 = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
11064
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
11065
11345
  function isBytes$2(a2) {
11066
11346
  return a2 instanceof Uint8Array || ArrayBuffer.isView(a2) && a2.constructor.name === "Uint8Array";
11067
11347
  }
@@ -11620,7 +11900,6 @@ class SHA256 extends HashMD {
11620
11900
  }
11621
11901
  }
11622
11902
  const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
11623
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
11624
11903
  const _0n$4 = /* @__PURE__ */ BigInt(0);
11625
11904
  const _1n$4 = /* @__PURE__ */ BigInt(1);
11626
11905
  function isBytes$1(a2) {
@@ -12527,7 +12806,6 @@ class HMAC extends Hash {
12527
12806
  }
12528
12807
  const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
12529
12808
  hmac.create = (hash, key) => new HMAC(hash, key);
12530
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
12531
12809
  const _0n$3 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = /* @__PURE__ */ BigInt(2), _3n$1 = /* @__PURE__ */ BigInt(3);
12532
12810
  const _4n$1 = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8);
12533
12811
  function mod(a2, b2) {
@@ -12794,7 +13072,6 @@ function mapHashToField(key, fieldOrder, isLE2 = false) {
12794
13072
  const reduced = mod(num, fieldOrder - _1n$3) + _1n$3;
12795
13073
  return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
12796
13074
  }
12797
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
12798
13075
  const _0n$2 = BigInt(0);
12799
13076
  const _1n$2 = BigInt(1);
12800
13077
  function constTimeNegate(condition, item) {
@@ -13027,7 +13304,6 @@ function validateBasic(curve) {
13027
13304
  ...{ p: curve.Fp.ORDER }
13028
13305
  });
13029
13306
  }
13030
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13031
13307
  function validateSigVerOpts(opts) {
13032
13308
  if (opts.lowS !== void 0)
13033
13309
  abool("lowS", opts.lowS);
@@ -13910,7 +14186,6 @@ function weierstrass(curveDef) {
13910
14186
  utils: utils2
13911
14187
  };
13912
14188
  }
13913
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13914
14189
  function getHash(hash) {
13915
14190
  return {
13916
14191
  hash,
@@ -13922,7 +14197,6 @@ function createCurve(curveDef, defHash) {
13922
14197
  const create2 = (hash) => weierstrass({ ...curveDef, ...getHash(hash) });
13923
14198
  return { ...create2(defHash), create: create2 };
13924
14199
  }
13925
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13926
14200
  const secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
13927
14201
  const secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
13928
14202
  const _0n = BigInt(0);
@@ -14062,7 +14336,6 @@ class InvalidVError extends BaseError {
14062
14336
  });
14063
14337
  }
14064
14338
  }
14065
- /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
14066
14339
  function isBytes(a2) {
14067
14340
  return a2 instanceof Uint8Array || ArrayBuffer.isView(a2) && a2.constructor.name === "Uint8Array";
14068
14341
  }
@@ -18172,7 +18445,6 @@ function je2(t2) {
18172
18445
  const e2 = t2?.[t2.length - 1];
18173
18446
  return mn$1(e2) ? e2 : void 0;
18174
18447
  }
18175
- /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
18176
18448
  function po$1(t2) {
18177
18449
  return t2 instanceof Uint8Array || ArrayBuffer.isView(t2) && t2.constructor.name === "Uint8Array";
18178
18450
  }
@@ -20174,11 +20446,11 @@ var hasRequiredCjs;
20174
20446
  function requireCjs() {
20175
20447
  if (hasRequiredCjs) return cjs;
20176
20448
  hasRequiredCjs = 1;
20177
- (function(exports) {
20178
- Object.defineProperty(exports, "__esModule", { value: true });
20449
+ (function(exports$1) {
20450
+ Object.defineProperty(exports$1, "__esModule", { value: true });
20179
20451
  const tslib_1 = require$$0;
20180
- tslib_1.__exportStar(requireCrypto(), exports);
20181
- tslib_1.__exportStar(requireEnv(), exports);
20452
+ tslib_1.__exportStar(requireCrypto(), exports$1);
20453
+ tslib_1.__exportStar(requireEnv(), exports$1);
20182
20454
  })(cjs);
20183
20455
  return cjs;
20184
20456
  }
@@ -23724,7 +23996,7 @@ var hasRequiredBrowserPonyfill;
23724
23996
  function requireBrowserPonyfill() {
23725
23997
  if (hasRequiredBrowserPonyfill) return browserPonyfill.exports;
23726
23998
  hasRequiredBrowserPonyfill = 1;
23727
- (function(module, exports) {
23999
+ (function(module, exports$1) {
23728
24000
  var __global__ = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof commonjsGlobal !== "undefined" && commonjsGlobal;
23729
24001
  var __globalThis__ = (function() {
23730
24002
  function F2() {
@@ -23735,7 +24007,7 @@ function requireBrowserPonyfill() {
23735
24007
  return new F2();
23736
24008
  })();
23737
24009
  (function(globalThis2) {
23738
- (function(exports2) {
24010
+ (function(exports$12) {
23739
24011
  var g2 = typeof globalThis2 !== "undefined" && globalThis2 || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
23740
24012
  typeof commonjsGlobal !== "undefined" && commonjsGlobal || {};
23741
24013
  var support = {
@@ -24149,24 +24421,24 @@ function requireBrowserPonyfill() {
24149
24421
  }
24150
24422
  return new Response(null, { status, headers: { location: url } });
24151
24423
  };
24152
- exports2.DOMException = g2.DOMException;
24424
+ exports$12.DOMException = g2.DOMException;
24153
24425
  try {
24154
- new exports2.DOMException();
24426
+ new exports$12.DOMException();
24155
24427
  } catch (err) {
24156
- exports2.DOMException = function(message, name) {
24428
+ exports$12.DOMException = function(message, name) {
24157
24429
  this.message = message;
24158
24430
  this.name = name;
24159
24431
  var error = Error(message);
24160
24432
  this.stack = error.stack;
24161
24433
  };
24162
- exports2.DOMException.prototype = Object.create(Error.prototype);
24163
- exports2.DOMException.prototype.constructor = exports2.DOMException;
24434
+ exports$12.DOMException.prototype = Object.create(Error.prototype);
24435
+ exports$12.DOMException.prototype.constructor = exports$12.DOMException;
24164
24436
  }
24165
24437
  function fetch2(input, init) {
24166
24438
  return new Promise(function(resolve, reject) {
24167
24439
  var request = new Request(input, init);
24168
24440
  if (request.signal && request.signal.aborted) {
24169
- return reject(new exports2.DOMException("Aborted", "AbortError"));
24441
+ return reject(new exports$12.DOMException("Aborted", "AbortError"));
24170
24442
  }
24171
24443
  var xhr = new XMLHttpRequest();
24172
24444
  function abortXhr() {
@@ -24200,7 +24472,7 @@ function requireBrowserPonyfill() {
24200
24472
  };
24201
24473
  xhr.onabort = function() {
24202
24474
  setTimeout(function() {
24203
- reject(new exports2.DOMException("Aborted", "AbortError"));
24475
+ reject(new exports$12.DOMException("Aborted", "AbortError"));
24204
24476
  }, 0);
24205
24477
  };
24206
24478
  function fixUrl(url) {
@@ -24257,24 +24529,24 @@ function requireBrowserPonyfill() {
24257
24529
  g2.Request = Request;
24258
24530
  g2.Response = Response;
24259
24531
  }
24260
- exports2.Headers = Headers;
24261
- exports2.Request = Request;
24262
- exports2.Response = Response;
24263
- exports2.fetch = fetch2;
24264
- Object.defineProperty(exports2, "__esModule", { value: true });
24265
- return exports2;
24532
+ exports$12.Headers = Headers;
24533
+ exports$12.Request = Request;
24534
+ exports$12.Response = Response;
24535
+ exports$12.fetch = fetch2;
24536
+ Object.defineProperty(exports$12, "__esModule", { value: true });
24537
+ return exports$12;
24266
24538
  })({});
24267
24539
  })(__globalThis__);
24268
24540
  __globalThis__.fetch.ponyfill = true;
24269
24541
  delete __globalThis__.fetch.polyfill;
24270
24542
  var ctx = __global__.fetch ? __global__ : __globalThis__;
24271
- exports = ctx.fetch;
24272
- exports.default = ctx.fetch;
24273
- exports.fetch = ctx.fetch;
24274
- exports.Headers = ctx.Headers;
24275
- exports.Request = ctx.Request;
24276
- exports.Response = ctx.Response;
24277
- module.exports = exports;
24543
+ exports$1 = ctx.fetch;
24544
+ exports$1.default = ctx.fetch;
24545
+ exports$1.fetch = ctx.fetch;
24546
+ exports$1.Headers = ctx.Headers;
24547
+ exports$1.Request = ctx.Request;
24548
+ exports$1.Response = ctx.Response;
24549
+ module.exports = exports$1;
24278
24550
  })(browserPonyfill, browserPonyfill.exports);
24279
24551
  return browserPonyfill.exports;
24280
24552
  }
@@ -25175,7 +25447,7 @@ class N {
25175
25447
  }
25176
25448
  }
25177
25449
  }
25178
- const t = Symbol();
25450
+ const t = /* @__PURE__ */ Symbol();
25179
25451
  const s = Object.getPrototypeOf, c = /* @__PURE__ */ new WeakMap(), l = (e2) => e2 && (c.has(e2) ? c.get(e2) : s(e2) === Object.prototype || s(e2) === Array.prototype), y2 = (e2) => l(e2) && e2[t] || null, h3 = (e2, t2 = true) => {
25180
25452
  c.set(e2, t2);
25181
25453
  };
@@ -25964,7 +26236,7 @@ class WalletConnectModal {
25964
26236
  }
25965
26237
  async initUi() {
25966
26238
  if (typeof window !== "undefined") {
25967
- await import("./index-Df4e4PhC.js");
26239
+ await import("./index-C_cDfEeV.js");
25968
26240
  const modal = document.createElement("wcm-modal");
25969
26241
  document.body.insertAdjacentElement("beforeend", modal);
25970
26242
  OptionsCtrl.setIsUiLoaded(true);
@@ -26012,7 +26284,7 @@ const TRON_MAINNET_CHAIN_ID = "tron:0x2b6653dc";
26012
26284
  const CONNECTION_TIMEOUT = 6e4;
26013
26285
  function useTronWalletConnect(projectId) {
26014
26286
  const { address, isConnected, isConnecting } = useTronWalletConnectStore();
26015
- const { setAddress, setIsConnecting, setActions, reset } = useTronWalletConnectStore();
26287
+ const { setAddress, setActions, reset } = useTronWalletConnectStore();
26016
26288
  const providerRef = useRef(null);
26017
26289
  const modalRef = useRef(null);
26018
26290
  const abortControllerRef = useRef(null);
@@ -26112,7 +26384,6 @@ function useTronWalletConnect(projectId) {
26112
26384
  }
26113
26385
  abortControllerRef.current = new AbortController();
26114
26386
  const abortController = abortControllerRef.current;
26115
- setIsConnecting(true);
26116
26387
  try {
26117
26388
  const connectionPromise = providerRef.current.connect({
26118
26389
  namespaces: {
@@ -26159,10 +26430,9 @@ function useTronWalletConnect(projectId) {
26159
26430
  }
26160
26431
  throw error;
26161
26432
  } finally {
26162
- setIsConnecting(false);
26163
26433
  abortControllerRef.current = null;
26164
26434
  }
26165
- }, [setAddress, setIsConnecting]);
26435
+ }, [setAddress]);
26166
26436
  const cancelConnection = useCallback(() => {
26167
26437
  if (abortControllerRef.current) {
26168
26438
  abortControllerRef.current.abort();
@@ -26393,6 +26663,22 @@ const EvaaBridgeWithProviders = (props) => {
26393
26663
  connect: tronConnect,
26394
26664
  disconnect: tronDisconnect
26395
26665
  } = useWallet();
26666
+ const tronSelectRef = useRef(tronSelect);
26667
+ const tronConnectRef = useRef(tronConnect);
26668
+ const tronDisconnectRef = useRef(tronDisconnect);
26669
+ useEffect(() => {
26670
+ tronSelectRef.current = tronSelect;
26671
+ tronConnectRef.current = tronConnect;
26672
+ tronDisconnectRef.current = tronDisconnect;
26673
+ }, [tronSelect, tronConnect, tronDisconnect]);
26674
+ const tronLinkActions = useMemo(
26675
+ () => ({
26676
+ select: (adapterName) => tronSelectRef.current(adapterName),
26677
+ connect: () => tronConnectRef.current(),
26678
+ disconnect: () => tronDisconnectRef.current()
26679
+ }),
26680
+ []
26681
+ );
26396
26682
  const tronWalletConnect = useTronWalletConnect(props.walletConnectProjectId);
26397
26683
  const { setTonConnected, setMetaMaskConnected, setTronConnected } = useConnectedWalletsStore();
26398
26684
  useEffect(() => {
@@ -26428,9 +26714,9 @@ const EvaaBridgeWithProviders = (props) => {
26428
26714
  tronLink: {
26429
26715
  address: tronAddress,
26430
26716
  connected: tronConnected,
26431
- select: tronSelect,
26432
- connect: tronConnect,
26433
- disconnect: tronDisconnect
26717
+ select: tronLinkActions.select,
26718
+ connect: tronLinkActions.connect,
26719
+ disconnect: tronLinkActions.disconnect
26434
26720
  },
26435
26721
  walletConnect: props.walletConnectProjectId ? {
26436
26722
  address: tronWalletConnect.address,
@@ -26723,4 +27009,4 @@ export {
26723
27009
  getQuoteFees as y,
26724
27010
  calculateMinReceived as z
26725
27011
  };
26726
- //# sourceMappingURL=index-FFOqc2DU.js.map
27012
+ //# sourceMappingURL=index-CePOaHyN.js.map