coinley-test 0.0.62 → 0.0.64

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.
package/dist/index.esm.js CHANGED
@@ -2082,48 +2082,56 @@ class UniversalWalletManager {
2082
2082
  console.log("❌ Rabby not detected through any method");
2083
2083
  return false;
2084
2084
  }
2085
- // NEW: VERY INCLUSIVE Zerion detection
2085
+ // NEW: VERY STRICT Zerion detection - must distinguish from MetaMask
2086
2086
  isZerionAvailable() {
2087
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2087
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2088
2088
  if (!window.ethereum && !window.zerion) {
2089
2089
  console.log("❌ Zerion check: No window.ethereum or window.zerion");
2090
2090
  return false;
2091
2091
  }
2092
- if (((_a = window.ethereum) == null ? void 0 : _a.isZerion) === true) {
2093
- console.log("✅ Zerion detected: Direct isZerion property");
2094
- return true;
2095
- }
2096
- if (((_b = window.ethereum) == null ? void 0 : _b.providers) && Array.isArray(window.ethereum.providers)) {
2092
+ if (((_a = window.ethereum) == null ? void 0 : _a.providers) && Array.isArray(window.ethereum.providers)) {
2097
2093
  console.log("🔍 Zerion check: Searching in providers array...");
2098
2094
  for (let i = 0; i < window.ethereum.providers.length; i++) {
2099
2095
  const provider = window.ethereum.providers[i];
2100
2096
  console.log(`Provider ${i} Zerion check:`, {
2101
2097
  isZerion: provider.isZerion,
2102
- constructor: (_c = provider.constructor) == null ? void 0 : _c.name
2098
+ isZerionWallet: provider.isZerionWallet,
2099
+ isMetaMask: provider.isMetaMask,
2100
+ constructor: (_b = provider.constructor) == null ? void 0 : _b.name,
2101
+ zerion: !!provider.zerion
2103
2102
  });
2104
- if (provider.isZerion === true) {
2105
- console.log("✅ Zerion found in providers array");
2103
+ if ((provider.isZerion === true || provider.isZerionWallet === true || provider.zerion) && provider.isMetaMask !== true) {
2104
+ console.log("✅ Zerion found in providers array (not MetaMask)");
2106
2105
  return true;
2107
2106
  }
2108
2107
  }
2109
2108
  }
2109
+ if (window.ethereum) {
2110
+ if ((window.ethereum.isZerion === true || window.ethereum.isZerionWallet === true) && window.ethereum.isMetaMask !== true) {
2111
+ console.log("✅ Zerion detected: Direct isZerion property (not MetaMask)");
2112
+ return true;
2113
+ }
2114
+ }
2110
2115
  if (window.zerion) {
2111
2116
  console.log("✅ Zerion detected: Global window.zerion object found");
2112
2117
  return true;
2113
2118
  }
2114
- if ((_d = window.ethereum) == null ? void 0 : _d.isZerion) {
2115
- console.log("✅ Zerion detected: isZerion property found");
2119
+ if (((_e = (_d = (_c = window.ethereum) == null ? void 0 : _c.constructor) == null ? void 0 : _d.name) == null ? void 0 : _e.toLowerCase().includes("zerion")) && !((_g = (_f = window.ethereum.constructor) == null ? void 0 : _f.name) == null ? void 0 : _g.toLowerCase().includes("metamask"))) {
2120
+ console.log("✅ Zerion detected: Constructor name contains Zerion (not MetaMask)");
2116
2121
  return true;
2117
2122
  }
2118
- if ((_g = (_f = (_e = window.ethereum) == null ? void 0 : _e.constructor) == null ? void 0 : _f.name) == null ? void 0 : _g.includes("Zerion")) {
2119
- console.log("✅ Zerion detected: Constructor name contains Zerion");
2123
+ if (typeof window !== "undefined" && ((_i = (_h = window.navigator) == null ? void 0 : _h.userAgent) == null ? void 0 : _i.includes("Zerion")) && !((_k = (_j = window.navigator) == null ? void 0 : _j.userAgent) == null ? void 0 : _k.includes("MetaMask"))) {
2124
+ console.log("✅ Zerion detected: User agent contains Zerion (not MetaMask)");
2120
2125
  return true;
2121
2126
  }
2122
- if (typeof window !== "undefined" && ((_i = (_h = window.navigator) == null ? void 0 : _h.userAgent) == null ? void 0 : _i.includes("Zerion"))) {
2123
- console.log(" Zerion detected: User agent contains Zerion");
2124
- return true;
2127
+ if (typeof document !== "undefined") {
2128
+ const zerionMeta = document.querySelector('meta[name="zerion"]') || document.querySelector('meta[content*="zerion"]');
2129
+ if (zerionMeta && !document.querySelector('meta[content*="metamask"]')) {
2130
+ console.log("✅ Zerion detected: DOM meta tags (not MetaMask)");
2131
+ return true;
2132
+ }
2125
2133
  }
2126
- console.log("❌ Zerion not detected through any method");
2134
+ console.log("❌ Zerion not detected through any method (or conflicts with MetaMask)");
2127
2135
  return false;
2128
2136
  }
2129
2137
  // Get the correct provider for a specific wallet - VERY AGGRESSIVE approach
@@ -2690,97 +2698,74 @@ const WalletSelector = ({
2690
2698
  connectedWallet,
2691
2699
  loading
2692
2700
  }) => {
2693
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2701
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2694
2702
  const [selectedWalletType, setSelectedWalletType] = useState(null);
2695
2703
  const walletManager = useRef(new UniversalWalletManager());
2696
2704
  const getAvailableWallets = () => {
2705
+ var _a2, _b2, _c2, _d2, _e2;
2697
2706
  if (!selectedNetwork) return [];
2698
2707
  if (["ethereum", "bsc", "polygon", "arbitrum", "optimism", "avalanche", "solana"].includes(selectedNetwork.shortName)) {
2699
2708
  const detectedWallets = walletManager.current.getAvailableWallets();
2700
- if (detectedWallets.length === 0 && window.ethereum) {
2701
- console.log("🚨 EMERGENCY OVERRIDE: No wallets detected but ethereum exists, forcing all three wallets to show");
2702
- return [
2703
- {
2704
- type: "metamask",
2705
- name: "MetaMask",
2706
- icon: "🦊",
2707
- description: "Connect using MetaMask wallet",
2708
- color: "orange",
2709
- isInstalled: true
2710
- },
2711
- {
2712
- type: "rabby",
2713
- name: "Rabby",
2714
- icon: "🐰",
2715
- description: "Connect using Rabby wallet",
2716
- color: "blue",
2717
- isInstalled: true
2718
- },
2719
- {
2720
- type: "zerion",
2721
- name: "Zerion",
2722
- icon: "🔷",
2723
- description: "Connect using Zerion wallet",
2724
- color: "purple",
2725
- isInstalled: true
2726
- }
2727
- ];
2709
+ console.log("🔍 SMART DETECTION: Actually detected wallets:", detectedWallets.map((w) => w.name));
2710
+ const smartWallets = [...detectedWallets];
2711
+ if (((_a2 = window.ethereum) == null ? void 0 : _a2.isMetaMask) && !smartWallets.find((w) => w.type === "metamask")) {
2712
+ console.log("🦊 Adding MetaMask (confirmed installed)");
2713
+ smartWallets.push({
2714
+ type: "metamask",
2715
+ name: "MetaMask",
2716
+ icon: "🦊",
2717
+ description: "Connect using MetaMask wallet",
2718
+ color: "orange",
2719
+ isInstalled: true
2720
+ });
2728
2721
  }
2729
- if (detectedWallets.length < 3 && window.ethereum) {
2730
- console.log("🚨 SAFETY CHECK: Adding missing wallets");
2731
- const allWallets = [
2732
- {
2733
- type: "metamask",
2734
- name: "MetaMask",
2735
- icon: "🦊",
2736
- description: "Connect using MetaMask wallet",
2737
- color: "orange",
2738
- isInstalled: true
2739
- },
2740
- {
2741
- type: "rabby",
2742
- name: "Rabby",
2743
- icon: "🐰",
2744
- description: "Connect using Rabby wallet",
2745
- color: "blue",
2746
- isInstalled: true
2747
- },
2748
- {
2749
- type: "zerion",
2750
- name: "Zerion",
2751
- icon: "🔷",
2752
- description: "Connect using Zerion wallet",
2753
- color: "purple",
2754
- isInstalled: true
2755
- }
2756
- ];
2757
- const combinedWallets = [];
2758
- const addedTypes = /* @__PURE__ */ new Set();
2759
- detectedWallets.forEach((wallet) => {
2760
- if (!addedTypes.has(wallet.type)) {
2761
- combinedWallets.push(wallet);
2762
- addedTypes.add(wallet.type);
2763
- }
2722
+ if (window.rabby && !smartWallets.find((w) => w.type === "rabby")) {
2723
+ console.log("🐰 Adding Rabby (confirmed installed)");
2724
+ smartWallets.push({
2725
+ type: "rabby",
2726
+ name: "Rabby",
2727
+ icon: "🐰",
2728
+ description: "Connect using Rabby wallet",
2729
+ color: "blue",
2730
+ isInstalled: true
2764
2731
  });
2765
- allWallets.forEach((wallet) => {
2766
- if (!addedTypes.has(wallet.type)) {
2767
- combinedWallets.push(wallet);
2768
- addedTypes.add(wallet.type);
2769
- }
2732
+ }
2733
+ const hasRealZerion = window.zerion || ((_b2 = window.ethereum) == null ? void 0 : _b2.isZerion) === true || ((_c2 = window.ethereum) == null ? void 0 : _c2.isZerionWallet) === true || ((_d2 = navigator.userAgent) == null ? void 0 : _d2.includes("Zerion")) || ((_e2 = window.ethereum) == null ? void 0 : _e2.providers) && window.ethereum.providers.some(
2734
+ (p2) => p2.isZerion === true || p2.isZerionWallet === true
2735
+ );
2736
+ if (hasRealZerion && !smartWallets.find((w) => w.type === "zerion")) {
2737
+ console.log("🔷 Adding Zerion (confirmed installed)");
2738
+ smartWallets.push({
2739
+ type: "zerion",
2740
+ name: "Zerion",
2741
+ icon: "🔷",
2742
+ description: "Connect using Zerion wallet",
2743
+ color: "purple",
2744
+ isInstalled: true
2745
+ });
2746
+ } else if (!hasRealZerion) {
2747
+ console.log("❌ Zerion NOT actually installed - not showing");
2748
+ smartWallets.push({
2749
+ type: "zerion",
2750
+ name: "Zerion",
2751
+ icon: "🔷",
2752
+ description: "Install Zerion wallet to use",
2753
+ color: "purple",
2754
+ isInstalled: false
2770
2755
  });
2771
- return combinedWallets;
2772
2756
  }
2773
- return detectedWallets;
2757
+ return smartWallets;
2774
2758
  }
2775
2759
  return [];
2776
2760
  };
2777
2761
  const availableWallets = getAvailableWallets();
2778
- console.log("💡 WALLET SELECTOR: Showing wallets:", availableWallets.map((w) => w.name));
2779
- console.log("💡 WALLET SELECTOR: window.ethereum exists:", !!window.ethereum);
2780
- console.log("💡 WALLET SELECTOR: window.ethereum.isMetaMask:", (_a = window.ethereum) == null ? void 0 : _a.isMetaMask);
2781
- console.log("💡 WALLET SELECTOR: window.ethereum.isRabby:", (_b = window.ethereum) == null ? void 0 : _b.isRabby);
2782
- console.log("💡 WALLET SELECTOR: window.ethereum.isZerion:", (_c = window.ethereum) == null ? void 0 : _c.isZerion);
2762
+ console.log("💡 SMART WALLET SELECTOR: Showing wallets:", availableWallets.map((w) => `${w.name} (${w.isInstalled ? "installed" : "not installed"})`));
2783
2763
  const handleWalletClick = async (walletType) => {
2764
+ const wallet = availableWallets.find((w) => w.type === walletType);
2765
+ if (!(wallet == null ? void 0 : wallet.isInstalled)) {
2766
+ alert(`${(wallet == null ? void 0 : wallet.name) || "This wallet"} is not installed. Please install it first and refresh the page.`);
2767
+ return;
2768
+ }
2784
2769
  setSelectedWalletType(walletType);
2785
2770
  onWalletSelect(walletType);
2786
2771
  await onConnect(walletType);
@@ -2821,65 +2806,81 @@ const WalletSelector = ({
2821
2806
  ] }),
2822
2807
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-gray-500 mb-2", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2823
2808
  "Debug: Found ",
2824
- availableWallets.length,
2825
- " wallet(s) - ",
2826
- availableWallets.map((w) => w.name).join(", ")
2809
+ availableWallets.filter((w) => w.isInstalled).length,
2810
+ " installed wallet(s) - ",
2811
+ availableWallets.filter((w) => w.isInstalled).map((w) => w.name).join(", ")
2827
2812
  ] }),
2828
2813
  availableWallets.map((wallet) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2829
2814
  "button",
2830
2815
  {
2831
2816
  onClick: () => handleWalletClick(wallet.type),
2832
- disabled: loading,
2833
- className: `w-full p-4 border-2 rounded-xl text-left transition-all duration-200 ${(connectedWallet == null ? void 0 : connectedWallet.walletType) === wallet.type ? "border-green-500 bg-green-50" : "border-gray-200 hover:border-[#7042D2]/50 hover:bg-[#7042D2]/5"}`,
2817
+ disabled: loading || !wallet.isInstalled,
2818
+ className: `w-full p-4 border-2 rounded-xl text-left transition-all duration-200 ${!wallet.isInstalled ? "border-gray-300 bg-gray-50 opacity-60 cursor-not-allowed" : (connectedWallet == null ? void 0 : connectedWallet.walletType) === wallet.type ? "border-green-500 bg-green-50" : "border-gray-200 hover:border-[#7042D2]/50 hover:bg-[#7042D2]/5"}`,
2834
2819
  style: { fontFamily: "Bricolage Grotesque, sans-serif" },
2835
2820
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-3", children: [
2836
2821
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-2xl", children: wallet.icon }),
2837
2822
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
2838
2823
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-semibold text-gray-800 flex items-center", children: [
2839
2824
  wallet.name,
2840
- wallet.type === "rabby" && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full", children: "NEW" }),
2841
- wallet.type === "zerion" && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 px-2 py-1 bg-purple-100 text-purple-700 text-xs rounded-full", children: "HOT" })
2825
+ wallet.type === "rabby" && wallet.isInstalled && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full", children: "NEW" }),
2826
+ wallet.type === "zerion" && wallet.isInstalled && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 px-2 py-1 bg-purple-100 text-purple-700 text-xs rounded-full", children: "HOT" }),
2827
+ !wallet.isInstalled && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 px-2 py-1 bg-red-100 text-red-700 text-xs rounded-full", children: "NOT INSTALLED" })
2842
2828
  ] }),
2843
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: (connectedWallet == null ? void 0 : connectedWallet.walletType) === wallet.type ? "✅ Connected" : wallet.description })
2829
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: !wallet.isInstalled ? `Click to install ${wallet.name}` : (connectedWallet == null ? void 0 : connectedWallet.walletType) === wallet.type ? "✅ Connected" : wallet.description })
2844
2830
  ] }),
2845
2831
  loading && selectedWalletType === wallet.type && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-[#7042D2]" })
2846
2832
  ] })
2847
2833
  },
2848
2834
  wallet.type
2849
2835
  )),
2836
+ availableWallets.some((w) => !w.isInstalled) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 p-3 bg-blue-50 rounded-lg border border-blue-200", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-blue-800", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2837
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: "📲 Quick Install Links:" }),
2838
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 text-xs", children: availableWallets.filter((w) => !w.isInstalled).map((wallet) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2839
+ "• ",
2840
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
2841
+ "a",
2842
+ {
2843
+ href: wallet.type === "metamask" ? "https://metamask.io" : wallet.type === "rabby" ? "https://rabby.io" : "https://zerion.io",
2844
+ target: "_blank",
2845
+ rel: "noopener noreferrer",
2846
+ className: "text-blue-700 underline hover:text-blue-900",
2847
+ children: [
2848
+ "Install ",
2849
+ wallet.name
2850
+ ]
2851
+ }
2852
+ ),
2853
+ " - Then refresh this page"
2854
+ ] }, wallet.type)) })
2855
+ ] }) }),
2850
2856
  connectedWallet && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 p-3 bg-green-50 rounded-lg border border-green-200", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-green-800 text-center", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2851
2857
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: "✅ Wallet Connected" }),
2852
2858
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs mt-1", children: [
2853
- (_d = connectedWallet.account) == null ? void 0 : _d.slice(0, 6),
2859
+ (_a = connectedWallet.account) == null ? void 0 : _a.slice(0, 6),
2854
2860
  "...",
2855
- (_e = connectedWallet.account) == null ? void 0 : _e.slice(-4),
2861
+ (_b = connectedWallet.account) == null ? void 0 : _b.slice(-4),
2856
2862
  " (",
2857
2863
  connectedWallet.walletType,
2858
2864
  ")"
2859
2865
  ] })
2860
2866
  ] }) }),
2861
2867
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 p-2 bg-yellow-50 rounded-lg border border-yellow-200", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-yellow-800", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
2862
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-1", children: "🔧 Wallet Debug Info:" }),
2868
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-1", children: "🔧 Enhanced Wallet Debug:" }),
2863
2869
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2864
2870
  "• window.ethereum exists: ",
2865
2871
  window.ethereum ? "✅" : "❌"
2866
2872
  ] }),
2867
2873
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2868
2874
  "• window.ethereum.isMetaMask: ",
2869
- ((_f = window.ethereum) == null ? void 0 : _f.isMetaMask) ? "✅" : "❌"
2875
+ ((_c = window.ethereum) == null ? void 0 : _c.isMetaMask) ? "✅" : "❌"
2870
2876
  ] }),
2871
2877
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2872
2878
  "• window.ethereum.isRabby: ",
2873
- ((_g = window.ethereum) == null ? void 0 : _g.isRabby) ? "✅" : "❌"
2879
+ ((_d = window.ethereum) == null ? void 0 : _d.isRabby) ? "✅" : "❌"
2874
2880
  ] }),
2875
2881
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2876
2882
  "• window.ethereum.isZerion: ",
2877
- ((_h = window.ethereum) == null ? void 0 : _h.isZerion) ? "✅" : "❌"
2878
- ] }),
2879
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2880
- "• window.ethereum.providers: ",
2881
- ((_j = (_i = window.ethereum) == null ? void 0 : _i.providers) == null ? void 0 : _j.length) || 0,
2882
- " provider(s)"
2883
+ ((_e = window.ethereum) == null ? void 0 : _e.isZerion) ? "✅" : "❌"
2883
2884
  ] }),
2884
2885
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2885
2886
  "• window.rabby exists: ",
@@ -2890,9 +2891,12 @@ const WalletSelector = ({
2890
2891
  window.zerion ? "✅" : "❌"
2891
2892
  ] }),
2892
2893
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2893
- "• Showing ",
2894
- availableWallets.length,
2895
- " wallet options"
2894
+ "• User agent Zerion: ",
2895
+ ((_f = navigator.userAgent) == null ? void 0 : _f.includes("Zerion")) ? "✅" : "❌"
2896
+ ] }),
2897
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2898
+ "• Providers: ",
2899
+ ((_h = (_g = window.ethereum) == null ? void 0 : _g.providers) == null ? void 0 : _h.length) || 0
2896
2900
  ] })
2897
2901
  ] }) })
2898
2902
  ] });