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