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