@rash2x/bridge-widget 0.6.12 → 0.6.15

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.
@@ -37,7 +37,7 @@ const bridge$1 = { "max": "Max", "sourceNetwork": "Source network", "destination
37
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": "Processing...", "checkingBalance": "Checking balance...", "insufficientBalance": "Insufficient balance", "amountTooSmall": "Min {{min}}", "amountTooLarge": "Max {{max}}", "success": "Success", "successTitle": "Success", "done": "Done", "hashCopied": "Hash copied to clipboard", "bridged": "Bridged", "transferTitle": "Transfer", "hash": "Hash", "finalFee": "Final Fee", "route": "Route", "estTime": "Est. Time", "slippage": "Slippage", "minimumReceived": "Minimum received", "totalFee": "Total Fee", "noRouteFound": "No route found", "notEnoughGas": "Not enough gas", "noRouteFoundForSettings": "No route found for current settings.", "tryAdjustSettings": "Try disabling Gas on Destination, or adjust amount/networks.", "quoteError": "Quote error" };
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
- const settings$1 = { "title": "Settings", "gasOnDestination": "Gas on destination", "slippageTolerance": "Slippage tolerance", "routePriority": "Route Priority", "highSlippageWarning": "High slippage warning", "gasPresets": { "auto": "Auto", "none": "None", "medium": "Medium", "max": "Max" }, "routePresets": { "fastest": "Fastest", "cheapest": "Cheapest", "recommended": "Recommended" } };
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" } };
41
41
  const errors$1 = { "WALLET_NOT_CONNECTED": "{{chainKey}} wallet not connected", "WALLET_CONNECTION_FAILED": "Failed to connect {{chainKey}} wallet", "WALLET_NOT_FOUND": "No {{chainKey}} wallet found. Please install a wallet extension.", "INVALID_ADDRESS": "Invalid {{chainKey}} address format", "INVALID_STEPS": "Invalid transaction steps for {{chainKey}}", "INVALID_TRANSACTION_DATA": "Invalid transaction data for {{chainKey}}", "TRANSACTION_REJECTED": "Transaction rejected by user", "TRANSACTION_FAILED": "Transaction failed", "TRANSACTION_TIMEOUT": "Transaction confirmation timeout", "TRANSACTION_REVERTED": "Transaction reverted on-chain", "INSUFFICIENT_GAS": "Insufficient {{chainKey}} gas", "PROVIDER_NOT_AVAILABLE": "{{chainKey}} provider not available", "NETWORK_REQUEST_FAILED": "Network request failed", "TRANSACTION_FAILED_TO_COMPLETE": "Transaction failed to complete", "COMPLETION_TRACKING_FAILED": "Completion tracking failed", "UNKNOWN_ERROR": "An unknown error occurred" };
42
42
  const en$3 = {
43
43
  common: common$1,
@@ -55,7 +55,7 @@ const bridge = { "max": "Макс", "sourceNetwork": "Исходная сеть"
55
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": "Недостаточно газа", "noRouteFoundForSettings": "Маршрут не найден для текущих настроек.", "tryAdjustSettings": "Попробуйте отключить Gas on Destination или измените сумму/сети.", "quoteError": "Ошибка котировки" };
56
56
  const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
57
57
  const app = { "stargateWidgetName": "Виджет Stargate Bridge", "liveWidget": "Живой виджет", "getStarted": "Начало работы" };
58
- const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "slippageTolerance": "Толерантность к проскальзыванию", "routePriority": "Приоритет маршрута", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрейший", "cheapest": "Дешевейший", "recommended": "Рекомендуемый" } };
58
+ const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "gasOnDestinationDescription": "Значение по умолчанию позволяет выполнить пару транзакций (например, Approve и Swap).", "slippageTolerance": "Толерантность к проскальзыванию", "slippageToleranceDescription": "Ваша транзакция будет отклонена, если получаемая сумма выйдет за пределы этой допустимой погрешности.", "routePriority": "Приоритет маршрута", "routePriorityDescription": "Выберите, как будет выполняться ваш трансфер. Recommended — выбирает оптимальный маршрут с учётом общей стоимости. Fastest — отдаёт приоритет максимальной скорости.", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрейший", "cheapest": "Дешевейший", "recommended": "Рекомендуемый" } };
59
59
  const errors = { "WALLET_NOT_CONNECTED": "{{chainKey}} кошелёк не подключен", "WALLET_CONNECTION_FAILED": "Не удалось подключить {{chainKey}} кошелёк", "WALLET_NOT_FOUND": "{{chainKey}} кошелёк не найден. Пожалуйста, установите расширение кошелька.", "INVALID_ADDRESS": "Неверный формат {{chainKey}} адреса", "INVALID_STEPS": "Недопустимые шаги транзакции для {{chainKey}}", "INVALID_TRANSACTION_DATA": "Недопустимые данные транзакции для {{chainKey}}", "TRANSACTION_REJECTED": "Транзакция отклонена пользователем", "TRANSACTION_FAILED": "Транзакция не удалась", "TRANSACTION_TIMEOUT": "Время ожидания подтверждения транзакции истекло", "TRANSACTION_REVERTED": "Транзакция отменена в блокчейне", "INSUFFICIENT_GAS": "Недостаточно {{chainKey}} газа", "PROVIDER_NOT_AVAILABLE": "{{chainKey}} провайдер недоступен", "NETWORK_REQUEST_FAILED": "Сетевой запрос не удался", "TRANSACTION_FAILED_TO_COMPLETE": "Транзакция не завершилась", "COMPLETION_TRACKING_FAILED": "Отслеживание завершения не удалось", "UNKNOWN_ERROR": "Произошла неизвестная ошибка" };
60
60
  const ru$1 = {
61
61
  common,
@@ -3045,7 +3045,7 @@ const Tip = (props) => {
3045
3045
  const { children, text } = props;
3046
3046
  return /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
3047
3047
  /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { className: "w-4 h-4 rounded-full bg-muted text-muted-foreground", children }),
3048
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: text }) })
3048
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipContent, { className: "max-w-64", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: text }) })
3049
3049
  ] });
3050
3050
  };
3051
3051
  const BASE_URL = "https://icons-ckg.pages.dev/stargate-light/tokens";
@@ -4096,14 +4096,13 @@ const WalletSelectModal = () => {
4096
4096
  const { t: t2 } = useBridgeTranslation();
4097
4097
  const { isOpen, onClose } = useWalletSelectModal();
4098
4098
  const { connectors } = wagmi.useConnect();
4099
+ const { address: evmAddress, connector: connectedConnector } = wagmi.useAccount();
4099
4100
  const { chainRegistry } = useChainStrategies();
4100
4101
  const tonWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.TON);
4101
4102
  const metaMaskWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.EVM);
4102
4103
  const tronWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.TRON);
4103
4104
  const tronConnections = tronWallet?.getAvailableConnections() ?? [];
4104
- const isTronWalletConnectConnected = tronConnections.some(
4105
- (conn) => conn.connected && conn.provider === "walletconnect"
4106
- );
4105
+ const isTronConnected = tronWallet?.isConnected() ?? false;
4107
4106
  const walletConfigs = [
4108
4107
  {
4109
4108
  strategy: tonWallet,
@@ -4119,6 +4118,9 @@ const WalletSelectModal = () => {
4119
4118
  }
4120
4119
  ];
4121
4120
  const connectedWallets = walletConfigs.reduce((acc, { strategy, walletId, name, icon }) => {
4121
+ if (walletId === "metamask" && evmAddress && connectedConnector) {
4122
+ return acc;
4123
+ }
4122
4124
  const account = strategy?.getAccount();
4123
4125
  if (strategy?.isConnected() && account) {
4124
4126
  acc.push({
@@ -4131,6 +4133,19 @@ const WalletSelectModal = () => {
4131
4133
  }
4132
4134
  return acc;
4133
4135
  }, []);
4136
+ if (evmAddress && connectedConnector) {
4137
+ const iconMap = {
4138
+ metaMaskSDK: MetaMaskIcon,
4139
+ walletConnect: WalletConnectIcon
4140
+ };
4141
+ connectedWallets.push({
4142
+ id: connectedConnector.id,
4143
+ name: connectedConnector.name,
4144
+ icon: iconMap[connectedConnector.id] || WalletConnectIcon,
4145
+ address: evmAddress,
4146
+ onDisconnect: () => metaMaskWallet?.disconnect()
4147
+ });
4148
+ }
4134
4149
  tronConnections.forEach((connection) => {
4135
4150
  if (!connection.connected || !connection.address) return;
4136
4151
  const isWalletConnect = connection.provider === "walletconnect";
@@ -4170,7 +4185,7 @@ const WalletSelectModal = () => {
4170
4185
  icon: connector.id === "metaMaskSDK" ? MetaMaskIcon : WalletConnectIcon,
4171
4186
  enabled: true
4172
4187
  }));
4173
- const tronWallets = [
4188
+ const tronWallets = isTronConnected ? [] : [
4174
4189
  {
4175
4190
  id: "tronlink",
4176
4191
  name: t2("wallets.tronLink"),
@@ -4183,12 +4198,7 @@ const WalletSelectModal = () => {
4183
4198
  icon: WalletConnectIcon,
4184
4199
  enabled: true
4185
4200
  }
4186
- ].filter((wallet) => {
4187
- if (wallet.id === "tronlink" && isTronWalletConnectConnected) {
4188
- return false;
4189
- }
4190
- return true;
4191
- });
4201
+ ];
4192
4202
  const notConnected = (w2) => !isWalletConnected(w2.id);
4193
4203
  const categories = [
4194
4204
  {
@@ -5587,8 +5597,12 @@ class TronChainStrategy {
5587
5597
  "TronLink wallet is not installed. Please install TronLink extension and try again."
5588
5598
  );
5589
5599
  }
5600
+ if (this.config.tronLink.connected && this.config.tronLink.address) {
5601
+ console.log("TronLink already connected, skipping connection");
5602
+ return;
5603
+ }
5590
5604
  this.config.tronLink.select(tronwalletAdapters.TronLinkAdapterName);
5591
- await new Promise((resolve) => setTimeout(resolve, 100));
5605
+ await new Promise((resolve) => setTimeout(resolve, 300));
5592
5606
  await this.config.tronLink.connect();
5593
5607
  }
5594
5608
  async disconnect(options) {
@@ -5684,7 +5698,6 @@ class TronChainStrategy {
5684
5698
  return isTronAddress(address);
5685
5699
  }
5686
5700
  validateSteps(steps) {
5687
- console.log("validateSteps");
5688
5701
  if (!steps?.length) {
5689
5702
  throw new InvalidStepsError("tron", "No transaction steps provided");
5690
5703
  }
@@ -5775,7 +5788,11 @@ class TronChainStrategy {
5775
5788
  "Unsupported TRON parsed tx kind"
5776
5789
  );
5777
5790
  }
5778
- const { txid } = await this.signAndBroadcast(tronWeb, unsigned, connector);
5791
+ const { txid } = await this.signAndBroadcast(
5792
+ tronWeb,
5793
+ unsigned,
5794
+ connector
5795
+ );
5779
5796
  lastTxId = txid;
5780
5797
  if (isFirstHash) {
5781
5798
  onFirstHash?.(txid);
@@ -5838,7 +5855,9 @@ class TronChainStrategy {
5838
5855
  txBlockNumber = info.blockNumber;
5839
5856
  const feeSun = info.fee || 0;
5840
5857
  actualFeeTrx = feeSun / 1e6;
5841
- console.log(`TRON transaction found in block ${txBlockNumber}, fee: ${actualFeeTrx} TRX`);
5858
+ console.log(
5859
+ `TRON transaction found in block ${txBlockNumber}, fee: ${actualFeeTrx} TRX`
5860
+ );
5842
5861
  }
5843
5862
  } catch (e2) {
5844
5863
  console.debug("TRON getTransactionInfo error:", e2);
@@ -6416,7 +6435,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6416
6435
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
6417
6436
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
6418
6437
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.gasOnDestination") }),
6419
- /* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.gasOnDestination"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6438
+ /* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.gasOnDestinationDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6420
6439
  ] }),
6421
6440
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground text-sm font-medium leading-4", children: formatUsd(gasUsdValue) })
6422
6441
  ] }),
@@ -6453,7 +6472,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6453
6472
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
6454
6473
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
6455
6474
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.slippageTolerance") }),
6456
- /* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.slippageTolerance"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6475
+ /* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.slippageToleranceDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6457
6476
  ] }),
6458
6477
  slippageBps >= 500 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs font-medium", children: t2("settings.highSlippageWarning", {
6459
6478
  defaultValue: "High slippage warning"
@@ -6482,7 +6501,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6482
6501
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
6483
6502
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
6484
6503
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.routePriority") }),
6485
- /* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.routePriority"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6504
+ /* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.routePriorityDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6486
6505
  ] }) }),
6487
6506
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end gap-2", children: routePresets.map((r2) => /* @__PURE__ */ jsxRuntime.jsx(
6488
6507
  badge.Badge,
@@ -6535,7 +6554,7 @@ const TokenRow = ({
6535
6554
  /* @__PURE__ */ jsxRuntime.jsx(skeleton.Skeleton, { className: "h-3 w-12 rounded-md" })
6536
6555
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6537
6556
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold text-foreground text-sm leading-4 truncate", children: hasAnyWallet ? formatBalance(balance) : "—" }),
6538
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs leading-3 text-muted-foreground/50", children: hasAnyWallet && balance > 0 && usdValue > 0 ? formatUsd(usdValue) : "—" })
6557
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs leading-3 text-muted-foreground", children: hasAnyWallet && balance > 0 && usdValue > 0 ? formatUsd(usdValue) : "—" })
6539
6558
  ] }) })
6540
6559
  ]
6541
6560
  }
@@ -25919,7 +25938,7 @@ class WalletConnectModal {
25919
25938
  }
25920
25939
  async initUi() {
25921
25940
  if (typeof window !== "undefined") {
25922
- await Promise.resolve().then(() => require("./index-OkGSl_M4.cjs"));
25941
+ await Promise.resolve().then(() => require("./index-vob2mbdZ.cjs"));
25923
25942
  const modal = document.createElement("wcm-modal");
25924
25943
  document.body.insertAdjacentElement("beforeend", modal);
25925
25944
  OptionsCtrl.setIsUiLoaded(true);
@@ -26668,4 +26687,4 @@ exports.useSettingsStore = useSettingsStore;
26668
26687
  exports.useSwapModel = useSwapModel;
26669
26688
  exports.useTokensStore = useTokensStore;
26670
26689
  exports.useTransactionStore = useTransactionStore;
26671
- //# sourceMappingURL=index-BaoPDmAJ.cjs.map
26690
+ //# sourceMappingURL=index-ChBJiTJF.cjs.map