@rash2x/bridge-widget 0.6.50 → 0.6.51

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": "Рекомендуемый" } };
@@ -3483,6 +3483,12 @@ const useTransactionStore = create((set2, get2) => ({
3483
3483
  const next = { ...cur, dstTxHash: hash, updatedAt: Date.now() };
3484
3484
  set2({ current: next });
3485
3485
  },
3486
+ setTonTransactionHash: (hash) => {
3487
+ const cur = get2().current;
3488
+ if (!cur) return;
3489
+ const next = { ...cur, tonTransactionHash: hash, updatedAt: Date.now() };
3490
+ set2({ current: next });
3491
+ },
3486
3492
  setError: (errorCode, errorParams) => {
3487
3493
  const cur = get2().current;
3488
3494
  if (!cur) return;
@@ -3509,6 +3515,21 @@ const useTransactionStore = create((set2, get2) => ({
3509
3515
  };
3510
3516
  set2({ current: next });
3511
3517
  },
3518
+ updateLayerZeroTotalFee: (feeValue, feeSymbol, feeUsd) => {
3519
+ const cur = get2().current;
3520
+ if (!cur) return;
3521
+ const next = {
3522
+ ...cur,
3523
+ metadata: {
3524
+ ...cur.metadata,
3525
+ layerZeroTotalFeeValue: feeValue,
3526
+ layerZeroTotalFeeSymbol: feeSymbol,
3527
+ layerZeroTotalFeeUsd: feeUsd
3528
+ },
3529
+ updatedAt: Date.now()
3530
+ };
3531
+ set2({ current: next });
3532
+ },
3512
3533
  reset: () => {
3513
3534
  set2({ current: void 0 });
3514
3535
  }
@@ -3678,11 +3699,29 @@ function toChainStrategyError(error, chainKey, context) {
3678
3699
  }
3679
3700
  return new ChainStrategyError(String(error), "UNKNOWN_ERROR", chainKey);
3680
3701
  }
3702
+ async function getLayerZeroMessageByTx(txHash) {
3703
+ try {
3704
+ const res = await fetch(
3705
+ `https://scan.layerzero-api.com/v1/messages/tx/${txHash}`
3706
+ );
3707
+ if (!res.ok) return null;
3708
+ const payload = await res.json();
3709
+ const messages = Array.isArray(payload?.data) ? payload?.data : [];
3710
+ if (!messages.length) return null;
3711
+ const lower2 = txHash.toLowerCase();
3712
+ return messages.find(
3713
+ (msg) => msg?.source?.tx?.txHash?.toLowerCase() === lower2
3714
+ ) ?? messages[0] ?? null;
3715
+ } catch (error) {
3716
+ console.warn("LayerZero message fetch failed:", error);
3717
+ return null;
3718
+ }
3719
+ }
3681
3720
  function useBridgeTransaction() {
3682
3721
  const { quote } = useBridgeQuoteStore();
3683
3722
  const { chainRegistry } = useChainStrategies();
3684
3723
  const { srcAddress, dstAddress } = useAddresses();
3685
- const { assetMatrix, selectedAssetSymbol } = useTokensStore();
3724
+ const { assetMatrix, selectedAssetSymbol, allTokens } = useTokensStore();
3686
3725
  const { chains } = useChainsStore();
3687
3726
  const txStore = useTransactionStore();
3688
3727
  const [isProcessing, setIsProcessing] = useState(false);
@@ -3753,6 +3792,9 @@ function useBridgeTransaction() {
3753
3792
  txStore.setSrcHash(hash);
3754
3793
  txStore.updateStatus("processing");
3755
3794
  });
3795
+ if (txResult?.tonTransactionHash) {
3796
+ txStore.setTonTransactionHash(txResult.tonTransactionHash);
3797
+ }
3756
3798
  if (txResult?.hash) {
3757
3799
  strategy.waitForCompletion(txResult.hash, context).then((result) => {
3758
3800
  if (result.completed) {
@@ -3774,6 +3816,30 @@ function useBridgeTransaction() {
3774
3816
  }
3775
3817
  txStore.updateStatus("completed");
3776
3818
  console.log("Transaction completed successfully");
3819
+ if (txResult.hash && strategy.getSourceCost) {
3820
+ const srcChain2 = chains?.find(
3821
+ (c2) => c2.chainKey === quote.srcChainKey
3822
+ );
3823
+ const feeSymbol = srcChain2?.nativeCurrency?.symbol || "";
3824
+ const { priceUsd } = findNativeMeta(allTokens, srcChain2);
3825
+ const srcHash = txResult.hash;
3826
+ const getSourceCost = strategy.getSourceCost;
3827
+ getLayerZeroMessageByTx(srcHash).then((message) => {
3828
+ if (quote.srcChainKey === "ton") return srcHash;
3829
+ return message?.source?.tx?.txHash ?? srcHash;
3830
+ }).then((sourceTxHash) => getSourceCost(sourceTxHash)).then((sourceCost) => {
3831
+ if (sourceCost?.totalNative !== void 0 && isFinite(sourceCost.totalNative)) {
3832
+ const feeUsd = priceUsd && priceUsd > 0 ? sourceCost.totalNative * priceUsd : void 0;
3833
+ txStore.updateLayerZeroTotalFee(
3834
+ sourceCost.totalNative,
3835
+ feeSymbol,
3836
+ feeUsd
3837
+ );
3838
+ }
3839
+ }).catch((error) => {
3840
+ console.warn("Failed to compute LayerZero total fee:", error);
3841
+ });
3842
+ }
3777
3843
  } else {
3778
3844
  txStore.setError("TRANSACTION_FAILED_TO_COMPLETE");
3779
3845
  console.error("Transaction completion failed:", result.error);
@@ -4527,7 +4593,7 @@ const EXPLORER_CONFIGS = {
4527
4593
  }
4528
4594
  };
4529
4595
  function getExplorerTxUrl(chainKey, txHash) {
4530
- if (!chainKey || !txHash) {
4596
+ if (!txHash) {
4531
4597
  return null;
4532
4598
  }
4533
4599
  const normalizedChainKey = chainKey.toLowerCase();
@@ -4554,8 +4620,12 @@ const SuccessStep = ({
4554
4620
  const { chains } = useChainsStore();
4555
4621
  const metadata = current?.metadata;
4556
4622
  const srcTxHash = current?.srcTxHash;
4623
+ const tonTransactionHash = current?.tonTransactionHash;
4557
4624
  const srcChainKey = current?.quote?.srcChainKey;
4558
4625
  const quote = current?.quote;
4626
+ const layerZeroTotalFeeValue = metadata?.layerZeroTotalFeeValue;
4627
+ const layerZeroTotalFeeSymbol = metadata?.layerZeroTotalFeeSymbol;
4628
+ const layerZeroTotalFeeUsd = metadata?.layerZeroTotalFeeUsd;
4559
4629
  const estimatedFee = useMemo(() => {
4560
4630
  if (!quote?.fees || !srcChainKey || !chains) return null;
4561
4631
  const srcChain = chains.find((c2) => c2.chainKey === srcChainKey);
@@ -4582,9 +4652,50 @@ const SuccessStep = ({
4582
4652
  }
4583
4653
  return estimatedFee;
4584
4654
  }, [metadata?.actualFeeValue, metadata?.actualFeeSymbol, estimatedFee]);
4655
+ const totalFee = useMemo(() => {
4656
+ if (layerZeroTotalFeeUsd !== void 0 && isFinite(layerZeroTotalFeeUsd) && layerZeroTotalFeeUsd > 0) {
4657
+ return {
4658
+ label: t2("transaction.totalFee"),
4659
+ display: formatUsd(layerZeroTotalFeeUsd)
4660
+ };
4661
+ }
4662
+ if (layerZeroTotalFeeValue !== void 0 && layerZeroTotalFeeSymbol) {
4663
+ return {
4664
+ label: t2("transaction.totalFee"),
4665
+ display: `${formatBalance(layerZeroTotalFeeValue, 6)} ${layerZeroTotalFeeSymbol}`
4666
+ };
4667
+ }
4668
+ if (!finalFee) return null;
4669
+ return {
4670
+ label: t2("transaction.finalFee"),
4671
+ display: `${formatBalance(finalFee.value, 6)} ${finalFee.symbol}`
4672
+ };
4673
+ }, [
4674
+ layerZeroTotalFeeUsd,
4675
+ layerZeroTotalFeeValue,
4676
+ layerZeroTotalFeeSymbol,
4677
+ finalFee,
4678
+ t2
4679
+ ]);
4585
4680
  const handleOpenExplorer = () => {
4586
- if (srcTxHash && srcChainKey) {
4587
- openTransactionInExplorer(srcChainKey, srcTxHash);
4681
+ if (srcChainKey === "ton") {
4682
+ if (tonTransactionHash) {
4683
+ window.open(
4684
+ `https://layerzeroscan.com/tx/${tonTransactionHash}`,
4685
+ "_blank",
4686
+ "noopener,noreferrer"
4687
+ );
4688
+ } else if (srcTxHash) {
4689
+ openTransactionInExplorer("ton", srcTxHash);
4690
+ }
4691
+ return;
4692
+ }
4693
+ if (srcTxHash) {
4694
+ window.open(
4695
+ `https://layerzeroscan.com/tx/${srcTxHash}`,
4696
+ "_blank",
4697
+ "noopener,noreferrer"
4698
+ );
4588
4699
  }
4589
4700
  };
4590
4701
  return /* @__PURE__ */ jsxs(
@@ -4635,7 +4746,7 @@ const SuccessStep = ({
4635
4746
  ] })
4636
4747
  ] }),
4637
4748
  srcTxHash && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
4638
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t2("transaction.hash") }),
4749
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: srcChainKey !== "ton" || tonTransactionHash ? t2("transaction.layerzeroScan") : t2("transaction.hash") }),
4639
4750
  /* @__PURE__ */ jsx(
4640
4751
  "button",
4641
4752
  {
@@ -4645,13 +4756,9 @@ const SuccessStep = ({
4645
4756
  }
4646
4757
  )
4647
4758
  ] }),
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
- ] })
4759
+ totalFee && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
4760
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: totalFee.label }),
4761
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: totalFee.display })
4655
4762
  ] })
4656
4763
  ] })
4657
4764
  ] }),
@@ -5200,6 +5307,35 @@ class EvmChainStrategy {
5200
5307
  throw new InvalidStepsError("evm", "Missing transaction data in steps");
5201
5308
  }
5202
5309
  }
5310
+ async getSourceCost(txHash) {
5311
+ if (!this.publicClient) {
5312
+ console.warn("No publicClient available for source cost query");
5313
+ return null;
5314
+ }
5315
+ try {
5316
+ const hash = txHash.startsWith("0x") ? txHash : `0x${txHash}`;
5317
+ const [receipt, tx] = await Promise.all([
5318
+ this.publicClient.getTransactionReceipt({ hash }),
5319
+ this.publicClient.getTransaction({ hash })
5320
+ ]);
5321
+ if (!receipt || !tx) return null;
5322
+ const gasUsed = receipt.gasUsed ?? 0n;
5323
+ const gasPrice = receipt.effectiveGasPrice ?? tx.gasPrice ?? 0n;
5324
+ const gasFeeWei = gasUsed * gasPrice;
5325
+ const txValueWei = tx.value ?? 0n;
5326
+ const totalWei = gasFeeWei + txValueWei;
5327
+ return {
5328
+ totalNative: Number(formatUnits(totalWei, 18)),
5329
+ breakdown: {
5330
+ gasFee: Number(formatUnits(gasFeeWei, 18)),
5331
+ layerZeroFee: Number(formatUnits(txValueWei, 18))
5332
+ }
5333
+ };
5334
+ } catch (error) {
5335
+ console.warn("Failed to compute EVM source cost:", error);
5336
+ return null;
5337
+ }
5338
+ }
5203
5339
  async executeSteps(steps, _context, onFirstHash) {
5204
5340
  if (!this.isConnected() || !this.walletClient) {
5205
5341
  throw new WalletNotConnectedError("evm");
@@ -5519,6 +5655,66 @@ class EvmChainStrategy {
5519
5655
  }
5520
5656
  }
5521
5657
  }
5658
+ function getNormalizedExtMessageHash(message) {
5659
+ if (message.info.type !== "external-in") {
5660
+ throw new Error(`Expected external-in message, got ${message.info.type}`);
5661
+ }
5662
+ const normalizedInfo = {
5663
+ ...message.info,
5664
+ src: void 0,
5665
+ importFee: 0n
5666
+ };
5667
+ const normalizedMessage = {
5668
+ ...message,
5669
+ info: normalizedInfo,
5670
+ init: null
5671
+ };
5672
+ return beginCell$1().store(storeMessage(normalizedMessage, { forceRef: true })).endCell().hash();
5673
+ }
5674
+ async function getTonTransactionHash(messageHash, userAddress, searchLimit = 20, options) {
5675
+ try {
5676
+ const client = options?.client ?? new TonClient({
5677
+ endpoint: "https://toncenter.com/api/v2/jsonRPC",
5678
+ apiKey: process.env.TONCENTER_API_KEY
5679
+ // Optional: for rate limit increase
5680
+ });
5681
+ const messageHasher = options?.messageHasher ?? getNormalizedExtMessageHash;
5682
+ const address = Address.parse(userAddress);
5683
+ const transactions = await client.getTransactions(address, {
5684
+ limit: searchLimit
5685
+ });
5686
+ for (const tx of transactions) {
5687
+ const inMsg = tx.inMessage;
5688
+ if (!inMsg) continue;
5689
+ try {
5690
+ const inMsgHash = messageHasher(inMsg).toString("hex");
5691
+ if (inMsgHash === messageHash.replace("0x", "")) {
5692
+ const txHash = tx.hash().toString("hex");
5693
+ return {
5694
+ transactionHash: `0x${txHash}`,
5695
+ messageHash,
5696
+ found: true
5697
+ };
5698
+ }
5699
+ } catch {
5700
+ continue;
5701
+ }
5702
+ }
5703
+ console.warn(`TON transaction not found for message hash: ${messageHash}`);
5704
+ return {
5705
+ transactionHash: null,
5706
+ messageHash,
5707
+ found: false
5708
+ };
5709
+ } catch (error) {
5710
+ console.error("Failed to get TON transaction hash:", error);
5711
+ return {
5712
+ transactionHash: null,
5713
+ messageHash,
5714
+ found: false
5715
+ };
5716
+ }
5717
+ }
5522
5718
  class TonChainStrategy {
5523
5719
  constructor(config) {
5524
5720
  __publicField(this, "config");
@@ -5640,9 +5836,31 @@ class TonChainStrategy {
5640
5836
  const messageHash = this.getNormalizedExtMessageHash(inMessage);
5641
5837
  const hexHash = messageHash.toString("hex");
5642
5838
  onFirstHash?.(hexHash);
5839
+ let tonTransactionHash;
5840
+ if (this.config.tonAddress) {
5841
+ try {
5842
+ const tonTxResult = await getTonTransactionHash(
5843
+ hexHash,
5844
+ this.config.tonAddress,
5845
+ 20
5846
+ );
5847
+ if (tonTxResult.found && tonTxResult.transactionHash) {
5848
+ tonTransactionHash = tonTxResult.transactionHash;
5849
+ } else {
5850
+ console.warn(
5851
+ `TON transaction hash not found for message hash: ${hexHash}`
5852
+ );
5853
+ }
5854
+ } catch (error) {
5855
+ console.error("Failed to convert TON message hash:", error);
5856
+ }
5857
+ }
5643
5858
  return {
5644
5859
  chainKey: "ton",
5645
- hash: hexHash
5860
+ hash: hexHash,
5861
+ // Message hash for TONScan
5862
+ tonTransactionHash
5863
+ // Transaction hash for LayerZero (if found)
5646
5864
  };
5647
5865
  } catch (error) {
5648
5866
  console.error("Error parsing BOC to hex hash:", error);
@@ -5706,6 +5924,63 @@ class TonChainStrategy {
5706
5924
  };
5707
5925
  return beginCell$1().store(storeMessage(normalizedMessage, { forceRef: true })).endCell().hash();
5708
5926
  }
5927
+ toBigInt(value) {
5928
+ if (typeof value === "bigint") return value;
5929
+ if (typeof value === "number" && Number.isFinite(value)) {
5930
+ return BigInt(Math.trunc(value));
5931
+ }
5932
+ if (typeof value === "string" && value.trim() !== "") {
5933
+ try {
5934
+ return BigInt(value);
5935
+ } catch {
5936
+ return null;
5937
+ }
5938
+ }
5939
+ return null;
5940
+ }
5941
+ getOutMessages(tx) {
5942
+ const candidate = tx.outMessages;
5943
+ if (!candidate) return [];
5944
+ if (Array.isArray(candidate)) return candidate;
5945
+ if (candidate instanceof Map) return Array.from(candidate.values());
5946
+ if (typeof candidate === "object" && candidate !== null && "values" in candidate && typeof candidate.values === "function") {
5947
+ return Array.from(
5948
+ candidate.values()
5949
+ );
5950
+ }
5951
+ return [];
5952
+ }
5953
+ getMessageValue(message) {
5954
+ const info = message.info;
5955
+ const value = info?.value;
5956
+ if (!value) return null;
5957
+ if (typeof value === "object" && value !== null && "coins" in value) {
5958
+ return this.toBigInt(value.coins);
5959
+ }
5960
+ return this.toBigInt(value);
5961
+ }
5962
+ getFirstOutMessageValue(tx) {
5963
+ const outMessages = this.getOutMessages(tx);
5964
+ if (!outMessages.length) return 0n;
5965
+ const value = this.getMessageValue(outMessages[0]);
5966
+ return value ?? 0n;
5967
+ }
5968
+ async getSourceCost(txHash) {
5969
+ const timeoutMs = Math.min(TON_CONFIG.timeout, 12e4);
5970
+ const result = await this.checkTonTransaction(txHash, timeoutMs);
5971
+ if (!result.confirmed) return null;
5972
+ const totalFees = result.totalFees ?? 0n;
5973
+ const outValue = result.outValue ?? 0n;
5974
+ const totalNanotons = totalFees + outValue;
5975
+ const toTon = (value) => Number(value) / 1e9;
5976
+ return {
5977
+ totalNative: toTon(totalNanotons),
5978
+ breakdown: {
5979
+ gasFee: toTon(totalFees),
5980
+ layerZeroFee: toTon(outValue)
5981
+ }
5982
+ };
5983
+ }
5709
5984
  async checkTonTransaction(hashOrBoc, timeoutMs = 36e4) {
5710
5985
  const deadline = Date.now() + timeoutMs;
5711
5986
  const client = getTonClient(this.config.tonClient, this.config.tonApiKey);
@@ -5754,12 +6029,17 @@ class TonChainStrategy {
5754
6029
  );
5755
6030
  if (txInMessageHash.equals(targetMessageHash)) {
5756
6031
  console.debug("Transaction found by in-message hash");
5757
- const totalFees = tx.totalFees;
6032
+ const totalFees = this.toBigInt(
6033
+ tx.totalFees
6034
+ ) ?? 0n;
6035
+ const outValue = this.getFirstOutMessageValue(tx);
5758
6036
  const feeInTon = Number(totalFees) / 1e9;
5759
6037
  console.log(`TON transaction fee: ${feeInTon} TON`);
5760
6038
  return {
5761
6039
  confirmed: true,
5762
- fee: feeInTon.toString()
6040
+ fee: feeInTon.toString(),
6041
+ totalFees,
6042
+ outValue
5763
6043
  };
5764
6044
  }
5765
6045
  }
@@ -5934,6 +6214,36 @@ class TronChainStrategy {
5934
6214
  throw new InvalidTransactionDataError("tron", "Missing transaction data");
5935
6215
  }
5936
6216
  }
6217
+ async getSourceCost(txHash) {
6218
+ const tronWeb = this.getClient();
6219
+ if (!tronWeb) {
6220
+ console.warn("No TronWeb client available for source cost query");
6221
+ return null;
6222
+ }
6223
+ try {
6224
+ const [info, tx] = await Promise.all([
6225
+ tronWeb.trx.getTransactionInfo(txHash),
6226
+ tronWeb.trx.getTransaction(txHash)
6227
+ ]);
6228
+ const feeSun = info?.fee ?? 0;
6229
+ const paramValue = tx?.raw_data?.contract?.[0]?.parameter?.value ?? {};
6230
+ const callValueRaw = paramValue["call_value"] ?? paramValue["callValue"] ?? paramValue["amount"] ?? 0;
6231
+ const callValueSun = typeof callValueRaw === "string" ? Number(callValueRaw) : typeof callValueRaw === "number" ? callValueRaw : 0;
6232
+ const feeTrx = feeSun / 1e6;
6233
+ const lzFeeTrx = callValueSun / 1e6;
6234
+ const totalTrx = (feeSun + callValueSun) / 1e6;
6235
+ return {
6236
+ totalNative: totalTrx,
6237
+ breakdown: {
6238
+ gasFee: feeTrx,
6239
+ layerZeroFee: lzFeeTrx
6240
+ }
6241
+ };
6242
+ } catch (error) {
6243
+ console.warn("Failed to compute TRON source cost:", error);
6244
+ return null;
6245
+ }
6246
+ }
5937
6247
  async executeSteps(steps, _context, onFirstHash) {
5938
6248
  const tronWeb = this.getClient();
5939
6249
  if (!tronWeb) {
@@ -7733,20 +8043,6 @@ function requireEvents() {
7733
8043
  var eventsExports = requireEvents();
7734
8044
  const xe$3 = /* @__PURE__ */ getDefaultExportFromCjs(eventsExports);
7735
8045
  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
8046
  var extendStatics = function(d3, b2) {
7751
8047
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b3) {
7752
8048
  d4.__proto__ = b3;
@@ -7897,8 +8193,8 @@ function __createBinding(o3, m3, k2, k22) {
7897
8193
  if (k22 === void 0) k22 = k2;
7898
8194
  o3[k22] = m3[k2];
7899
8195
  }
7900
- function __exportStar(m3, exports) {
7901
- for (var p2 in m3) if (p2 !== "default" && !exports.hasOwnProperty(p2)) exports[p2] = m3[p2];
8196
+ function __exportStar(m3, exports$1) {
8197
+ for (var p2 in m3) if (p2 !== "default" && !exports$1.hasOwnProperty(p2)) exports$1[p2] = m3[p2];
7902
8198
  }
7903
8199
  function __values(o3) {
7904
8200
  var s2 = typeof Symbol === "function" && Symbol.iterator, m3 = s2 && o3[s2], i3 = 0;
@@ -8106,34 +8402,34 @@ var hasRequiredTime;
8106
8402
  function requireTime() {
8107
8403
  if (hasRequiredTime) return time;
8108
8404
  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;
8405
+ (function(exports$1) {
8406
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8407
+ 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;
8408
+ exports$1.ONE_SECOND = 1;
8409
+ exports$1.FIVE_SECONDS = 5;
8410
+ exports$1.TEN_SECONDS = 10;
8411
+ exports$1.THIRTY_SECONDS = 30;
8412
+ exports$1.SIXTY_SECONDS = 60;
8413
+ exports$1.ONE_MINUTE = exports$1.SIXTY_SECONDS;
8414
+ exports$1.FIVE_MINUTES = exports$1.ONE_MINUTE * 5;
8415
+ exports$1.TEN_MINUTES = exports$1.ONE_MINUTE * 10;
8416
+ exports$1.THIRTY_MINUTES = exports$1.ONE_MINUTE * 30;
8417
+ exports$1.SIXTY_MINUTES = exports$1.ONE_MINUTE * 60;
8418
+ exports$1.ONE_HOUR = exports$1.SIXTY_MINUTES;
8419
+ exports$1.THREE_HOURS = exports$1.ONE_HOUR * 3;
8420
+ exports$1.SIX_HOURS = exports$1.ONE_HOUR * 6;
8421
+ exports$1.TWELVE_HOURS = exports$1.ONE_HOUR * 12;
8422
+ exports$1.TWENTY_FOUR_HOURS = exports$1.ONE_HOUR * 24;
8423
+ exports$1.ONE_DAY = exports$1.TWENTY_FOUR_HOURS;
8424
+ exports$1.THREE_DAYS = exports$1.ONE_DAY * 3;
8425
+ exports$1.FIVE_DAYS = exports$1.ONE_DAY * 5;
8426
+ exports$1.SEVEN_DAYS = exports$1.ONE_DAY * 7;
8427
+ exports$1.THIRTY_DAYS = exports$1.ONE_DAY * 30;
8428
+ exports$1.ONE_WEEK = exports$1.SEVEN_DAYS;
8429
+ exports$1.TWO_WEEKS = exports$1.ONE_WEEK * 2;
8430
+ exports$1.THREE_WEEKS = exports$1.ONE_WEEK * 3;
8431
+ exports$1.FOUR_WEEKS = exports$1.ONE_WEEK * 4;
8432
+ exports$1.ONE_YEAR = exports$1.ONE_DAY * 365;
8137
8433
  })(time);
8138
8434
  return time;
8139
8435
  }
@@ -8141,11 +8437,11 @@ var hasRequiredConstants;
8141
8437
  function requireConstants() {
8142
8438
  if (hasRequiredConstants) return constants;
8143
8439
  hasRequiredConstants = 1;
8144
- (function(exports) {
8145
- Object.defineProperty(exports, "__esModule", { value: true });
8440
+ (function(exports$1) {
8441
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8146
8442
  const tslib_1 = require$$0;
8147
- tslib_1.__exportStar(requireMisc(), exports);
8148
- tslib_1.__exportStar(requireTime(), exports);
8443
+ tslib_1.__exportStar(requireMisc(), exports$1);
8444
+ tslib_1.__exportStar(requireTime(), exports$1);
8149
8445
  })(constants);
8150
8446
  return constants;
8151
8447
  }
@@ -8170,11 +8466,11 @@ var hasRequiredUtils;
8170
8466
  function requireUtils() {
8171
8467
  if (hasRequiredUtils) return utils;
8172
8468
  hasRequiredUtils = 1;
8173
- (function(exports) {
8174
- Object.defineProperty(exports, "__esModule", { value: true });
8469
+ (function(exports$1) {
8470
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8175
8471
  const tslib_1 = require$$0;
8176
- tslib_1.__exportStar(requireDelay(), exports);
8177
- tslib_1.__exportStar(requireConvert(), exports);
8472
+ tslib_1.__exportStar(requireDelay(), exports$1);
8473
+ tslib_1.__exportStar(requireConvert(), exports$1);
8178
8474
  })(utils);
8179
8475
  return utils;
8180
8476
  }
@@ -8237,10 +8533,10 @@ var hasRequiredTypes;
8237
8533
  function requireTypes() {
8238
8534
  if (hasRequiredTypes) return types;
8239
8535
  hasRequiredTypes = 1;
8240
- (function(exports) {
8241
- Object.defineProperty(exports, "__esModule", { value: true });
8536
+ (function(exports$1) {
8537
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8242
8538
  const tslib_1 = require$$0;
8243
- tslib_1.__exportStar(requireWatch(), exports);
8539
+ tslib_1.__exportStar(requireWatch(), exports$1);
8244
8540
  })(types);
8245
8541
  return types;
8246
8542
  }
@@ -8248,13 +8544,13 @@ var hasRequiredCjs$3;
8248
8544
  function requireCjs$3() {
8249
8545
  if (hasRequiredCjs$3) return cjs$3;
8250
8546
  hasRequiredCjs$3 = 1;
8251
- (function(exports) {
8252
- Object.defineProperty(exports, "__esModule", { value: true });
8547
+ (function(exports$1) {
8548
+ Object.defineProperty(exports$1, "__esModule", { value: true });
8253
8549
  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);
8550
+ tslib_1.__exportStar(requireUtils(), exports$1);
8551
+ tslib_1.__exportStar(requireWatch$1(), exports$1);
8552
+ tslib_1.__exportStar(requireTypes(), exports$1);
8553
+ tslib_1.__exportStar(requireConstants(), exports$1);
8258
8554
  })(cjs$3);
8259
8555
  return cjs$3;
8260
8556
  }
@@ -9213,7 +9509,7 @@ const j$4 = we$4().console || {}, le$2 = { mapHttpRequest: C$3, mapHttpResponse:
9213
9509
  function m$2(e2, t2) {
9214
9510
  return e2 === "silent" ? 1 / 0 : t2.levels.values[e2];
9215
9511
  }
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" };
9512
+ 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
9513
  function R$2(e2, t2) {
9218
9514
  const r2 = { logger: t2, parent: e2[P$4] };
9219
9515
  t2[P$4] = r2;
@@ -9652,7 +9948,6 @@ function gn$2(t2, e2) {
9652
9948
  if (t2.length < n3) throw new Error("digestInto() expects output buffer of length at least " + n3);
9653
9949
  }
9654
9950
  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
9951
  const _t$3 = (t2) => new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
9657
9952
  function yn$2(t2) {
9658
9953
  if (typeof t2 != "string") throw new Error("utf8ToBytes expected string, got " + typeof t2);
@@ -9777,7 +10072,6 @@ let Jn$2 = class Jn extends An$2 {
9777
10072
  }
9778
10073
  };
9779
10074
  const Kn$2 = Bn$2(() => new Jn$2());
9780
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
9781
10075
  const vt$3 = BigInt(0), be$3 = BigInt(1), Wn$2 = BigInt(2);
9782
10076
  function It$4(t2) {
9783
10077
  return t2 instanceof Uint8Array || ArrayBuffer.isView(t2) && t2.constructor.name === "Uint8Array";
@@ -11061,7 +11355,6 @@ function walk(err, fn2) {
11061
11355
  return fn2 ? null : err;
11062
11356
  }
11063
11357
  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
11358
  function isBytes$2(a2) {
11066
11359
  return a2 instanceof Uint8Array || ArrayBuffer.isView(a2) && a2.constructor.name === "Uint8Array";
11067
11360
  }
@@ -11620,7 +11913,6 @@ class SHA256 extends HashMD {
11620
11913
  }
11621
11914
  }
11622
11915
  const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
11623
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
11624
11916
  const _0n$4 = /* @__PURE__ */ BigInt(0);
11625
11917
  const _1n$4 = /* @__PURE__ */ BigInt(1);
11626
11918
  function isBytes$1(a2) {
@@ -12527,7 +12819,6 @@ class HMAC extends Hash {
12527
12819
  }
12528
12820
  const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
12529
12821
  hmac.create = (hash, key) => new HMAC(hash, key);
12530
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
12531
12822
  const _0n$3 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = /* @__PURE__ */ BigInt(2), _3n$1 = /* @__PURE__ */ BigInt(3);
12532
12823
  const _4n$1 = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8);
12533
12824
  function mod(a2, b2) {
@@ -12794,7 +13085,6 @@ function mapHashToField(key, fieldOrder, isLE2 = false) {
12794
13085
  const reduced = mod(num, fieldOrder - _1n$3) + _1n$3;
12795
13086
  return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
12796
13087
  }
12797
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
12798
13088
  const _0n$2 = BigInt(0);
12799
13089
  const _1n$2 = BigInt(1);
12800
13090
  function constTimeNegate(condition, item) {
@@ -13027,7 +13317,6 @@ function validateBasic(curve) {
13027
13317
  ...{ p: curve.Fp.ORDER }
13028
13318
  });
13029
13319
  }
13030
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13031
13320
  function validateSigVerOpts(opts) {
13032
13321
  if (opts.lowS !== void 0)
13033
13322
  abool("lowS", opts.lowS);
@@ -13910,7 +14199,6 @@ function weierstrass(curveDef) {
13910
14199
  utils: utils2
13911
14200
  };
13912
14201
  }
13913
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13914
14202
  function getHash(hash) {
13915
14203
  return {
13916
14204
  hash,
@@ -13922,7 +14210,6 @@ function createCurve(curveDef, defHash) {
13922
14210
  const create2 = (hash) => weierstrass({ ...curveDef, ...getHash(hash) });
13923
14211
  return { ...create2(defHash), create: create2 };
13924
14212
  }
13925
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13926
14213
  const secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
13927
14214
  const secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
13928
14215
  const _0n = BigInt(0);
@@ -14062,7 +14349,6 @@ class InvalidVError extends BaseError {
14062
14349
  });
14063
14350
  }
14064
14351
  }
14065
- /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
14066
14352
  function isBytes(a2) {
14067
14353
  return a2 instanceof Uint8Array || ArrayBuffer.isView(a2) && a2.constructor.name === "Uint8Array";
14068
14354
  }
@@ -18172,7 +18458,6 @@ function je2(t2) {
18172
18458
  const e2 = t2?.[t2.length - 1];
18173
18459
  return mn$1(e2) ? e2 : void 0;
18174
18460
  }
18175
- /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
18176
18461
  function po$1(t2) {
18177
18462
  return t2 instanceof Uint8Array || ArrayBuffer.isView(t2) && t2.constructor.name === "Uint8Array";
18178
18463
  }
@@ -20174,11 +20459,11 @@ var hasRequiredCjs;
20174
20459
  function requireCjs() {
20175
20460
  if (hasRequiredCjs) return cjs;
20176
20461
  hasRequiredCjs = 1;
20177
- (function(exports) {
20178
- Object.defineProperty(exports, "__esModule", { value: true });
20462
+ (function(exports$1) {
20463
+ Object.defineProperty(exports$1, "__esModule", { value: true });
20179
20464
  const tslib_1 = require$$0;
20180
- tslib_1.__exportStar(requireCrypto(), exports);
20181
- tslib_1.__exportStar(requireEnv(), exports);
20465
+ tslib_1.__exportStar(requireCrypto(), exports$1);
20466
+ tslib_1.__exportStar(requireEnv(), exports$1);
20182
20467
  })(cjs);
20183
20468
  return cjs;
20184
20469
  }
@@ -23724,7 +24009,7 @@ var hasRequiredBrowserPonyfill;
23724
24009
  function requireBrowserPonyfill() {
23725
24010
  if (hasRequiredBrowserPonyfill) return browserPonyfill.exports;
23726
24011
  hasRequiredBrowserPonyfill = 1;
23727
- (function(module, exports) {
24012
+ (function(module, exports$1) {
23728
24013
  var __global__ = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof commonjsGlobal !== "undefined" && commonjsGlobal;
23729
24014
  var __globalThis__ = (function() {
23730
24015
  function F2() {
@@ -23735,7 +24020,7 @@ function requireBrowserPonyfill() {
23735
24020
  return new F2();
23736
24021
  })();
23737
24022
  (function(globalThis2) {
23738
- (function(exports2) {
24023
+ (function(exports$12) {
23739
24024
  var g2 = typeof globalThis2 !== "undefined" && globalThis2 || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
23740
24025
  typeof commonjsGlobal !== "undefined" && commonjsGlobal || {};
23741
24026
  var support = {
@@ -24149,24 +24434,24 @@ function requireBrowserPonyfill() {
24149
24434
  }
24150
24435
  return new Response(null, { status, headers: { location: url } });
24151
24436
  };
24152
- exports2.DOMException = g2.DOMException;
24437
+ exports$12.DOMException = g2.DOMException;
24153
24438
  try {
24154
- new exports2.DOMException();
24439
+ new exports$12.DOMException();
24155
24440
  } catch (err) {
24156
- exports2.DOMException = function(message, name) {
24441
+ exports$12.DOMException = function(message, name) {
24157
24442
  this.message = message;
24158
24443
  this.name = name;
24159
24444
  var error = Error(message);
24160
24445
  this.stack = error.stack;
24161
24446
  };
24162
- exports2.DOMException.prototype = Object.create(Error.prototype);
24163
- exports2.DOMException.prototype.constructor = exports2.DOMException;
24447
+ exports$12.DOMException.prototype = Object.create(Error.prototype);
24448
+ exports$12.DOMException.prototype.constructor = exports$12.DOMException;
24164
24449
  }
24165
24450
  function fetch2(input, init) {
24166
24451
  return new Promise(function(resolve, reject) {
24167
24452
  var request = new Request(input, init);
24168
24453
  if (request.signal && request.signal.aborted) {
24169
- return reject(new exports2.DOMException("Aborted", "AbortError"));
24454
+ return reject(new exports$12.DOMException("Aborted", "AbortError"));
24170
24455
  }
24171
24456
  var xhr = new XMLHttpRequest();
24172
24457
  function abortXhr() {
@@ -24200,7 +24485,7 @@ function requireBrowserPonyfill() {
24200
24485
  };
24201
24486
  xhr.onabort = function() {
24202
24487
  setTimeout(function() {
24203
- reject(new exports2.DOMException("Aborted", "AbortError"));
24488
+ reject(new exports$12.DOMException("Aborted", "AbortError"));
24204
24489
  }, 0);
24205
24490
  };
24206
24491
  function fixUrl(url) {
@@ -24257,24 +24542,24 @@ function requireBrowserPonyfill() {
24257
24542
  g2.Request = Request;
24258
24543
  g2.Response = Response;
24259
24544
  }
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;
24545
+ exports$12.Headers = Headers;
24546
+ exports$12.Request = Request;
24547
+ exports$12.Response = Response;
24548
+ exports$12.fetch = fetch2;
24549
+ Object.defineProperty(exports$12, "__esModule", { value: true });
24550
+ return exports$12;
24266
24551
  })({});
24267
24552
  })(__globalThis__);
24268
24553
  __globalThis__.fetch.ponyfill = true;
24269
24554
  delete __globalThis__.fetch.polyfill;
24270
24555
  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;
24556
+ exports$1 = ctx.fetch;
24557
+ exports$1.default = ctx.fetch;
24558
+ exports$1.fetch = ctx.fetch;
24559
+ exports$1.Headers = ctx.Headers;
24560
+ exports$1.Request = ctx.Request;
24561
+ exports$1.Response = ctx.Response;
24562
+ module.exports = exports$1;
24278
24563
  })(browserPonyfill, browserPonyfill.exports);
24279
24564
  return browserPonyfill.exports;
24280
24565
  }
@@ -25175,7 +25460,7 @@ class N {
25175
25460
  }
25176
25461
  }
25177
25462
  }
25178
- const t = Symbol();
25463
+ const t = /* @__PURE__ */ Symbol();
25179
25464
  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
25465
  c.set(e2, t2);
25181
25466
  };
@@ -25964,7 +26249,7 @@ class WalletConnectModal {
25964
26249
  }
25965
26250
  async initUi() {
25966
26251
  if (typeof window !== "undefined") {
25967
- await import("./index-Df4e4PhC.js");
26252
+ await import("./index-Dl3Nclhp.js");
25968
26253
  const modal = document.createElement("wcm-modal");
25969
26254
  document.body.insertAdjacentElement("beforeend", modal);
25970
26255
  OptionsCtrl.setIsUiLoaded(true);
@@ -26393,6 +26678,22 @@ const EvaaBridgeWithProviders = (props) => {
26393
26678
  connect: tronConnect,
26394
26679
  disconnect: tronDisconnect
26395
26680
  } = useWallet();
26681
+ const tronSelectRef = useRef(tronSelect);
26682
+ const tronConnectRef = useRef(tronConnect);
26683
+ const tronDisconnectRef = useRef(tronDisconnect);
26684
+ useEffect(() => {
26685
+ tronSelectRef.current = tronSelect;
26686
+ tronConnectRef.current = tronConnect;
26687
+ tronDisconnectRef.current = tronDisconnect;
26688
+ }, [tronSelect, tronConnect, tronDisconnect]);
26689
+ const tronLinkActions = useMemo(
26690
+ () => ({
26691
+ select: (adapterName) => tronSelectRef.current(adapterName),
26692
+ connect: () => tronConnectRef.current(),
26693
+ disconnect: () => tronDisconnectRef.current()
26694
+ }),
26695
+ []
26696
+ );
26396
26697
  const tronWalletConnect = useTronWalletConnect(props.walletConnectProjectId);
26397
26698
  const { setTonConnected, setMetaMaskConnected, setTronConnected } = useConnectedWalletsStore();
26398
26699
  useEffect(() => {
@@ -26428,9 +26729,9 @@ const EvaaBridgeWithProviders = (props) => {
26428
26729
  tronLink: {
26429
26730
  address: tronAddress,
26430
26731
  connected: tronConnected,
26431
- select: tronSelect,
26432
- connect: tronConnect,
26433
- disconnect: tronDisconnect
26732
+ select: tronLinkActions.select,
26733
+ connect: tronLinkActions.connect,
26734
+ disconnect: tronLinkActions.disconnect
26434
26735
  },
26435
26736
  walletConnect: props.walletConnectProjectId ? {
26436
26737
  address: tronWalletConnect.address,
@@ -26723,4 +27024,4 @@ export {
26723
27024
  getQuoteFees as y,
26724
27025
  calculateMinReceived as z
26725
27026
  };
26726
- //# sourceMappingURL=index-FFOqc2DU.js.map
27027
+ //# sourceMappingURL=index-CvJ9R4nQ.js.map