@rash2x/bridge-widget 0.6.25 → 0.6.26

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.
@@ -2737,7 +2737,8 @@ const EditIcon = (props) => {
2737
2737
  const prefixIcons = {
2738
2738
  tronlink: /* @__PURE__ */ jsx(TronLinkIcon, { className: "w-5 h-5" }),
2739
2739
  metamask: /* @__PURE__ */ jsx(MetaMaskIcon, { className: "w-5 h-5" }),
2740
- ton: /* @__PURE__ */ jsx(TonConnectIcon, { className: "w-5 h-5" })
2740
+ ton: /* @__PURE__ */ jsx(TonConnectIcon, { className: "w-5 h-5" }),
2741
+ walletconnect: /* @__PURE__ */ jsx(WalletConnectIcon, { className: "w-5 h-5" })
2741
2742
  };
2742
2743
  const mapWalletToType = (wallet) => {
2743
2744
  switch (wallet) {
@@ -2754,6 +2755,7 @@ const WalletInlineButton = ({
2754
2755
  addressType
2755
2756
  }) => {
2756
2757
  const { t: t2 } = useBridgeTranslation();
2758
+ const { connector: connectedEvmConnector } = useAccount();
2757
2759
  const { onOpen } = useWalletSelectModal();
2758
2760
  const { chainRegistry } = useChainStrategies();
2759
2761
  const isCustomAddressEnabled = useCustomAddressStore(
@@ -2766,6 +2768,23 @@ const WalletInlineButton = ({
2766
2768
  const isConnecting = connection?.isConnecting();
2767
2769
  const isInitialized = connection?.isInitialized() ?? true;
2768
2770
  const error = connection?.getError();
2771
+ const availableConnections = useMemo(
2772
+ () => connection?.getAvailableConnections() ?? [],
2773
+ [connection]
2774
+ );
2775
+ const evmConnectorId = connectedEvmConnector?.id;
2776
+ const activeTronConnection = useMemo(() => {
2777
+ if (walletType !== "tron") return null;
2778
+ const tronWalletConnect = availableConnections.find(
2779
+ (conn) => conn.provider === "walletconnect" && conn.connected && !!conn.address
2780
+ );
2781
+ if (tronWalletConnect) return tronWalletConnect;
2782
+ const tronLink = availableConnections.find(
2783
+ (conn) => conn.provider === "tronlink" && conn.connected && !!conn.address
2784
+ );
2785
+ if (tronLink) return tronLink;
2786
+ return null;
2787
+ }, [availableConnections, walletType]);
2769
2788
  const handleClick = useCallback(() => {
2770
2789
  onOpen(addressType);
2771
2790
  }, [onOpen, addressType]);
@@ -2778,6 +2797,22 @@ const WalletInlineButton = ({
2778
2797
  if (wallet === "tronlink") return t2("wallets.addTronWallet");
2779
2798
  return t2("wallets.addEvmWallet");
2780
2799
  }, [wallet, isInitialized, isConnecting, isConnected, account, t2]);
2800
+ const connectedIcon = useMemo(() => {
2801
+ if (!isConnected) return null;
2802
+ if (walletType === "tron" && activeTronConnection) {
2803
+ return activeTronConnection.provider === "walletconnect" ? prefixIcons.walletconnect : prefixIcons.tronlink;
2804
+ }
2805
+ if (walletType === "evm") {
2806
+ if (evmConnectorId) {
2807
+ if (evmConnectorId === "metaMaskSDK") return prefixIcons.metamask;
2808
+ if (evmConnectorId === "walletConnect")
2809
+ return prefixIcons.walletconnect;
2810
+ return prefixIcons.walletconnect;
2811
+ }
2812
+ return prefixIcons.metamask;
2813
+ }
2814
+ return prefixIcons[wallet];
2815
+ }, [activeTronConnection, evmConnectorId, isConnected, wallet, walletType]);
2781
2816
  const isButtonDisabled = (wallet === "metamask" || wallet === "tronlink") && !isInitialized || isConnecting || addressType === "dst" && isCustomAddressEnabled;
2782
2817
  return /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-col items-start gap-1", children: [
2783
2818
  /* @__PURE__ */ jsxs(
@@ -2791,9 +2826,12 @@ const WalletInlineButton = ({
2791
2826
  disabled: isButtonDisabled,
2792
2827
  variant: "ghost",
2793
2828
  size: "sm",
2794
- className: "flex gap-1 cursor-pointer hover:opacity-60 hover:bg-transparent !px-0 pr-1 h-5",
2829
+ className: cn$2(
2830
+ "flex gap-1 cursor-pointer hover:opacity-60 hover:bg-transparent !px-0 pr-1 h-5",
2831
+ isButtonDisabled && "opacity-50 bg-transparent"
2832
+ ),
2795
2833
  children: [
2796
- /* @__PURE__ */ jsx("span", { children: isConnected ? prefixIcons[wallet] : null }),
2834
+ /* @__PURE__ */ jsx("span", { children: connectedIcon }),
2797
2835
  /* @__PURE__ */ jsx("span", { className: "leading-3 text-sm border-b border-dotted border-bridge-link text-bridge-link", children: buttonText }),
2798
2836
  isConnected && /* @__PURE__ */ jsx(EditIcon, { className: "text-bridge-link -ml-0.5" })
2799
2837
  ]
@@ -25996,7 +26034,7 @@ class WalletConnectModal {
25996
26034
  }
25997
26035
  async initUi() {
25998
26036
  if (typeof window !== "undefined") {
25999
- await import("./index-ByappRml.js");
26037
+ await import("./index-CNrU6f88.js");
26000
26038
  const modal = document.createElement("wcm-modal");
26001
26039
  document.body.insertAdjacentElement("beforeend", modal);
26002
26040
  OptionsCtrl.setIsUiLoaded(true);
@@ -26747,4 +26785,4 @@ export {
26747
26785
  getQuoteFees as y,
26748
26786
  calculateMinReceived as z
26749
26787
  };
26750
- //# sourceMappingURL=index-H1giqtvx.js.map
26788
+ //# sourceMappingURL=index-BBQ7KZI-.js.map