@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.
@@ -36,7 +36,7 @@ const bridge$1 = { "max": "Max", "sourceNetwork": "Source network", "destination
36
36
  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" };
37
37
  const telegram$1 = { "openWebVersion": "Open EVAA Web to Bridge", "restrictionMessage": "You can bridge between the chosen networks on EVAA web version" };
38
38
  const app$1 = { "stargateWidgetName": "Stargate Bridge Widget", "liveWidget": "Live Widget", "getStarted": "Get Started" };
39
- 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" } };
39
+ 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" } };
40
40
  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" };
41
41
  const en$3 = {
42
42
  common: common$1,
@@ -54,7 +54,7 @@ const bridge = { "max": "Макс", "sourceNetwork": "Исходная сеть"
54
54
  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": "Ошибка котировки" };
55
55
  const telegram = { "openWebVersion": "Открыть EVAA веб для трансфера", "restrictionMessage": "Трансфер между выбранными сетями доступен только в веб-версии EVAA" };
56
56
  const app = { "stargateWidgetName": "Виджет Stargate Bridge", "liveWidget": "Живой виджет", "getStarted": "Начало работы" };
57
- const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "slippageTolerance": "Толерантность к проскальзыванию", "routePriority": "Приоритет маршрута", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрейший", "cheapest": "Дешевейший", "recommended": "Рекомендуемый" } };
57
+ const settings = { "title": "Настройки", "gasOnDestination": "Газ на назначении", "gasOnDestinationDescription": "Значение по умолчанию позволяет выполнить пару транзакций (например, Approve и Swap).", "slippageTolerance": "Толерантность к проскальзыванию", "slippageToleranceDescription": "Ваша транзакция будет отклонена, если получаемая сумма выйдет за пределы этой допустимой погрешности.", "routePriority": "Приоритет маршрута", "routePriorityDescription": "Выберите, как будет выполняться ваш трансфер. Recommended — выбирает оптимальный маршрут с учётом общей стоимости. Fastest — отдаёт приоритет максимальной скорости.", "highSlippageWarning": "Высокое проскальзывание", "gasPresets": { "auto": "Авто", "none": "Нет", "medium": "Средний", "max": "Макс" }, "routePresets": { "fastest": "Быстрейший", "cheapest": "Дешевейший", "recommended": "Рекомендуемый" } };
58
58
  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": "Произошла неизвестная ошибка" };
59
59
  const ru$1 = {
60
60
  common,
@@ -3044,7 +3044,7 @@ const Tip = (props) => {
3044
3044
  const { children, text } = props;
3045
3045
  return /* @__PURE__ */ jsxs(Tooltip, { children: [
3046
3046
  /* @__PURE__ */ jsx(TooltipTrigger, { className: "w-4 h-4 rounded-full bg-muted text-muted-foreground", children }),
3047
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: text }) })
3047
+ /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-64", children: /* @__PURE__ */ jsx("p", { children: text }) })
3048
3048
  ] });
3049
3049
  };
3050
3050
  const BASE_URL = "https://icons-ckg.pages.dev/stargate-light/tokens";
@@ -4095,14 +4095,13 @@ const WalletSelectModal = () => {
4095
4095
  const { t: t2 } = useBridgeTranslation();
4096
4096
  const { isOpen, onClose } = useWalletSelectModal();
4097
4097
  const { connectors } = useConnect();
4098
+ const { address: evmAddress, connector: connectedConnector } = useAccount();
4098
4099
  const { chainRegistry } = useChainStrategies();
4099
4100
  const tonWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.TON);
4100
4101
  const metaMaskWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.EVM);
4101
4102
  const tronWallet = chainRegistry.getStrategyByType(CHAIN_TYPES.TRON);
4102
4103
  const tronConnections = tronWallet?.getAvailableConnections() ?? [];
4103
- const isTronWalletConnectConnected = tronConnections.some(
4104
- (conn) => conn.connected && conn.provider === "walletconnect"
4105
- );
4104
+ const isTronConnected = tronWallet?.isConnected() ?? false;
4106
4105
  const walletConfigs = [
4107
4106
  {
4108
4107
  strategy: tonWallet,
@@ -4118,6 +4117,9 @@ const WalletSelectModal = () => {
4118
4117
  }
4119
4118
  ];
4120
4119
  const connectedWallets = walletConfigs.reduce((acc, { strategy, walletId, name, icon }) => {
4120
+ if (walletId === "metamask" && evmAddress && connectedConnector) {
4121
+ return acc;
4122
+ }
4121
4123
  const account = strategy?.getAccount();
4122
4124
  if (strategy?.isConnected() && account) {
4123
4125
  acc.push({
@@ -4130,6 +4132,19 @@ const WalletSelectModal = () => {
4130
4132
  }
4131
4133
  return acc;
4132
4134
  }, []);
4135
+ if (evmAddress && connectedConnector) {
4136
+ const iconMap = {
4137
+ metaMaskSDK: MetaMaskIcon,
4138
+ walletConnect: WalletConnectIcon
4139
+ };
4140
+ connectedWallets.push({
4141
+ id: connectedConnector.id,
4142
+ name: connectedConnector.name,
4143
+ icon: iconMap[connectedConnector.id] || WalletConnectIcon,
4144
+ address: evmAddress,
4145
+ onDisconnect: () => metaMaskWallet?.disconnect()
4146
+ });
4147
+ }
4133
4148
  tronConnections.forEach((connection) => {
4134
4149
  if (!connection.connected || !connection.address) return;
4135
4150
  const isWalletConnect = connection.provider === "walletconnect";
@@ -4169,7 +4184,7 @@ const WalletSelectModal = () => {
4169
4184
  icon: connector.id === "metaMaskSDK" ? MetaMaskIcon : WalletConnectIcon,
4170
4185
  enabled: true
4171
4186
  }));
4172
- const tronWallets = [
4187
+ const tronWallets = isTronConnected ? [] : [
4173
4188
  {
4174
4189
  id: "tronlink",
4175
4190
  name: t2("wallets.tronLink"),
@@ -4182,12 +4197,7 @@ const WalletSelectModal = () => {
4182
4197
  icon: WalletConnectIcon,
4183
4198
  enabled: true
4184
4199
  }
4185
- ].filter((wallet) => {
4186
- if (wallet.id === "tronlink" && isTronWalletConnectConnected) {
4187
- return false;
4188
- }
4189
- return true;
4190
- });
4200
+ ];
4191
4201
  const notConnected = (w2) => !isWalletConnected(w2.id);
4192
4202
  const categories = [
4193
4203
  {
@@ -5586,8 +5596,12 @@ class TronChainStrategy {
5586
5596
  "TronLink wallet is not installed. Please install TronLink extension and try again."
5587
5597
  );
5588
5598
  }
5599
+ if (this.config.tronLink.connected && this.config.tronLink.address) {
5600
+ console.log("TronLink already connected, skipping connection");
5601
+ return;
5602
+ }
5589
5603
  this.config.tronLink.select(TronLinkAdapterName);
5590
- await new Promise((resolve) => setTimeout(resolve, 100));
5604
+ await new Promise((resolve) => setTimeout(resolve, 300));
5591
5605
  await this.config.tronLink.connect();
5592
5606
  }
5593
5607
  async disconnect(options) {
@@ -5683,7 +5697,6 @@ class TronChainStrategy {
5683
5697
  return isTronAddress(address);
5684
5698
  }
5685
5699
  validateSteps(steps) {
5686
- console.log("validateSteps");
5687
5700
  if (!steps?.length) {
5688
5701
  throw new InvalidStepsError("tron", "No transaction steps provided");
5689
5702
  }
@@ -5774,7 +5787,11 @@ class TronChainStrategy {
5774
5787
  "Unsupported TRON parsed tx kind"
5775
5788
  );
5776
5789
  }
5777
- const { txid } = await this.signAndBroadcast(tronWeb, unsigned, connector);
5790
+ const { txid } = await this.signAndBroadcast(
5791
+ tronWeb,
5792
+ unsigned,
5793
+ connector
5794
+ );
5778
5795
  lastTxId = txid;
5779
5796
  if (isFirstHash) {
5780
5797
  onFirstHash?.(txid);
@@ -5837,7 +5854,9 @@ class TronChainStrategy {
5837
5854
  txBlockNumber = info.blockNumber;
5838
5855
  const feeSun = info.fee || 0;
5839
5856
  actualFeeTrx = feeSun / 1e6;
5840
- console.log(`TRON transaction found in block ${txBlockNumber}, fee: ${actualFeeTrx} TRX`);
5857
+ console.log(
5858
+ `TRON transaction found in block ${txBlockNumber}, fee: ${actualFeeTrx} TRX`
5859
+ );
5841
5860
  }
5842
5861
  } catch (e2) {
5843
5862
  console.debug("TRON getTransactionInfo error:", e2);
@@ -6415,7 +6434,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6415
6434
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
6416
6435
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6417
6436
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.gasOnDestination") }),
6418
- /* @__PURE__ */ jsx(Tip, { text: t2("settings.gasOnDestination"), children: /* @__PURE__ */ jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6437
+ /* @__PURE__ */ jsx(Tip, { text: t2("settings.gasOnDestinationDescription"), children: /* @__PURE__ */ jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6419
6438
  ] }),
6420
6439
  /* @__PURE__ */ jsx("p", { className: "text-foreground text-sm font-medium leading-4", children: formatUsd(gasUsdValue) })
6421
6440
  ] }),
@@ -6452,7 +6471,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6452
6471
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
6453
6472
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6454
6473
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.slippageTolerance") }),
6455
- /* @__PURE__ */ jsx(Tip, { text: t2("settings.slippageTolerance"), children: /* @__PURE__ */ jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6474
+ /* @__PURE__ */ jsx(Tip, { text: t2("settings.slippageToleranceDescription"), children: /* @__PURE__ */ jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6456
6475
  ] }),
6457
6476
  slippageBps >= 500 && /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs font-medium", children: t2("settings.highSlippageWarning", {
6458
6477
  defaultValue: "High slippage warning"
@@ -6481,7 +6500,7 @@ const SettingsModal = ({ isOpen, onClose }) => {
6481
6500
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
6482
6501
  /* @__PURE__ */ jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6483
6502
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.routePriority") }),
6484
- /* @__PURE__ */ jsx(Tip, { text: t2("settings.routePriority"), children: /* @__PURE__ */ jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6503
+ /* @__PURE__ */ jsx(Tip, { text: t2("settings.routePriorityDescription"), children: /* @__PURE__ */ jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
6485
6504
  ] }) }),
6486
6505
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end gap-2", children: routePresets.map((r2) => /* @__PURE__ */ jsx(
6487
6506
  Badge,
@@ -6534,7 +6553,7 @@ const TokenRow = ({
6534
6553
  /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-12 rounded-md" })
6535
6554
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
6536
6555
  /* @__PURE__ */ jsx("div", { className: "font-semibold text-foreground text-sm leading-4 truncate", children: hasAnyWallet ? formatBalance(balance) : "—" }),
6537
- /* @__PURE__ */ jsx("div", { className: "text-xs leading-3 text-muted-foreground/50", children: hasAnyWallet && balance > 0 && usdValue > 0 ? formatUsd(usdValue) : "—" })
6556
+ /* @__PURE__ */ jsx("div", { className: "text-xs leading-3 text-muted-foreground", children: hasAnyWallet && balance > 0 && usdValue > 0 ? formatUsd(usdValue) : "—" })
6538
6557
  ] }) })
6539
6558
  ]
6540
6559
  }
@@ -25918,7 +25937,7 @@ class WalletConnectModal {
25918
25937
  }
25919
25938
  async initUi() {
25920
25939
  if (typeof window !== "undefined") {
25921
- await import("./index-Cef9fWsE.js");
25940
+ await import("./index-8iyt7Qza.js");
25922
25941
  const modal = document.createElement("wcm-modal");
25923
25942
  document.body.insertAdjacentElement("beforeend", modal);
25924
25943
  OptionsCtrl.setIsUiLoaded(true);
@@ -26669,4 +26688,4 @@ export {
26669
26688
  getQuoteFees as y,
26670
26689
  calculateMinReceived as z
26671
26690
  };
26672
- //# sourceMappingURL=index-Tq5ST0yd.js.map
26691
+ //# sourceMappingURL=index-P1h97irF.js.map