coinley-test 0.0.64 → 0.0.66

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
@@ -1919,7 +1919,7 @@ class UniversalWalletManager {
1919
1919
  this.connectedWallet = null;
1920
1920
  this.walletType = null;
1921
1921
  }
1922
- // Detect all available wallets - VERY INCLUSIVE approach
1922
+ // Detect all available wallets - VERY INCLUSIVE approach + FIXED providers detection
1923
1923
  getAvailableWallets() {
1924
1924
  var _a;
1925
1925
  const wallets = [];
@@ -1935,8 +1935,19 @@ class UniversalWalletManager {
1935
1935
  providersLength: (_a = window.ethereum.providers) == null ? void 0 : _a.length,
1936
1936
  hasMetaMaskProperty: !!window.ethereum._metamask,
1937
1937
  hasRabbyGlobal: !!window.rabby,
1938
- hasZerionGlobal: !!window.zerion
1938
+ hasZerionGlobal: !!window.zerion,
1939
+ // CRITICAL: Actually check if providers array exists
1940
+ providersArray: window.ethereum.providers ? "EXISTS" : "MISSING"
1939
1941
  });
1942
+ if (!window.ethereum.providers && window.ethereum.request) {
1943
+ console.log("🔧 CRITICAL FIX: Providers array missing, attempting to create it...");
1944
+ try {
1945
+ window.ethereum.request({ method: "eth_accounts" }).catch(() => {
1946
+ });
1947
+ } catch (e) {
1948
+ console.log("Provider detection trigger failed safely");
1949
+ }
1950
+ }
1940
1951
  if (this.isMetaMaskAvailable()) {
1941
1952
  wallets.push({
1942
1953
  type: "metamask",
@@ -2082,56 +2093,117 @@ class UniversalWalletManager {
2082
2093
  console.log("❌ Rabby not detected through any method");
2083
2094
  return false;
2084
2095
  }
2085
- // NEW: VERY STRICT Zerion detection - must distinguish from MetaMask
2096
+ // NEW: COMPREHENSIVE Zerion detection - FIXED providers array detection
2086
2097
  isZerionAvailable() {
2087
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2098
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
2099
+ console.log("🔷 COMPREHENSIVE Zerion Detection Starting...");
2088
2100
  if (!window.ethereum && !window.zerion) {
2089
2101
  console.log("❌ Zerion check: No window.ethereum or window.zerion");
2090
2102
  return false;
2091
2103
  }
2092
- if (((_a = window.ethereum) == null ? void 0 : _a.providers) && Array.isArray(window.ethereum.providers)) {
2104
+ if (((_a = window.ethereum) == null ? void 0 : _a.providers) && Array.isArray(window.ethereum.providers) && window.ethereum.providers.length > 0) {
2093
2105
  console.log("🔍 Zerion check: Searching in providers array...");
2094
2106
  for (let i = 0; i < window.ethereum.providers.length; i++) {
2095
2107
  const provider = window.ethereum.providers[i];
2096
- console.log(`Provider ${i} Zerion check:`, {
2108
+ console.log(`Provider ${i} FULL details:`, {
2097
2109
  isZerion: provider.isZerion,
2098
2110
  isZerionWallet: provider.isZerionWallet,
2099
2111
  isMetaMask: provider.isMetaMask,
2112
+ isRabby: provider.isRabby,
2100
2113
  constructor: (_b = provider.constructor) == null ? void 0 : _b.name,
2101
- zerion: !!provider.zerion
2114
+ zerion: !!provider.zerion,
2115
+ _zerion: !!provider._zerion,
2116
+ // Check for more Zerion properties
2117
+ selectedAddress: provider.selectedAddress,
2118
+ networkVersion: provider.networkVersion,
2119
+ // Look for Zerion-specific methods
2120
+ hasZerionMethods: !!(provider.wallet_addEthereumChain || provider.wallet_switchEthereumChain),
2121
+ // Check all properties safely
2122
+ allKeys: Object.keys(provider).filter((key) => key.toLowerCase().includes("zerion"))
2102
2123
  });
2103
- if ((provider.isZerion === true || provider.isZerionWallet === true || provider.zerion) && provider.isMetaMask !== true) {
2104
- console.log("✅ Zerion found in providers array (not MetaMask)");
2124
+ if (provider.isZerion === true || provider.isZerionWallet === true || provider.zerion || provider._zerion || ((_d = (_c = provider.constructor) == null ? void 0 : _c.name) == null ? void 0 : _d.toLowerCase().includes("zerion")) || Object.keys(provider).some((key) => key.toLowerCase().includes("zerion"))) {
2125
+ console.log("✅ Zerion found in providers array via comprehensive check");
2105
2126
  return true;
2106
2127
  }
2107
2128
  }
2129
+ } else {
2130
+ console.log("⚠️ No providers array found or empty - this might be why Zerion isn't detected");
2108
2131
  }
2109
2132
  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)");
2133
+ console.log("🔍 Checking main ethereum object for Zerion...", {
2134
+ isZerion: window.ethereum.isZerion,
2135
+ isZerionWallet: window.ethereum.isZerionWallet,
2136
+ zerion: !!window.ethereum.zerion,
2137
+ _zerion: !!window.ethereum._zerion,
2138
+ constructor: (_e = window.ethereum.constructor) == null ? void 0 : _e.name,
2139
+ allKeys: Object.keys(window.ethereum).filter((key) => key.toLowerCase().includes("zerion"))
2140
+ });
2141
+ if (window.ethereum.isZerion === true || window.ethereum.isZerionWallet === true || window.ethereum.zerion || window.ethereum._zerion || ((_g = (_f = window.ethereum.constructor) == null ? void 0 : _f.name) == null ? void 0 : _g.toLowerCase().includes("zerion")) || Object.keys(window.ethereum).some((key) => key.toLowerCase().includes("zerion"))) {
2142
+ console.log("✅ Zerion detected: Main ethereum object comprehensive check");
2112
2143
  return true;
2113
2144
  }
2114
2145
  }
2115
2146
  if (window.zerion) {
2116
- console.log("✅ Zerion detected: Global window.zerion object found");
2117
- return true;
2118
- }
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)");
2147
+ console.log("✅ Zerion detected: Global window.zerion object found", window.zerion);
2121
2148
  return true;
2122
2149
  }
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)");
2125
- return true;
2150
+ if (typeof window !== "undefined") {
2151
+ const userAgent = ((_h = window.navigator) == null ? void 0 : _h.userAgent) || "";
2152
+ console.log("🔍 Checking user agent for Zerion:", userAgent);
2153
+ if (userAgent.includes("Zerion") || userAgent.includes("zerion")) {
2154
+ console.log("✅ Zerion detected: User agent contains Zerion");
2155
+ return true;
2156
+ }
2126
2157
  }
2127
2158
  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)");
2159
+ console.log("🔍 Checking DOM for Zerion indicators...");
2160
+ const zerionMeta = document.querySelector('meta[name*="zerion" i]') || document.querySelector('meta[content*="zerion" i]') || document.querySelector('script[src*="zerion" i]') || document.querySelector('link[href*="zerion" i]');
2161
+ if (zerionMeta) {
2162
+ console.log("✅ Zerion detected: DOM elements found", zerionMeta);
2163
+ return true;
2164
+ }
2165
+ }
2166
+ if (typeof window !== "undefined") {
2167
+ console.log("🔍 Checking for Zerion in-app browser...");
2168
+ const isZerionApp = ((_j = (_i = window.location) == null ? void 0 : _i.href) == null ? void 0 : _j.includes("zerion")) || ((_k = window.origin) == null ? void 0 : _k.includes("zerion")) || ((_l = document.title) == null ? void 0 : _l.includes("Zerion")) || ((_m = document.title) == null ? void 0 : _m.includes("zerion"));
2169
+ if (isZerionApp) {
2170
+ console.log("✅ Zerion detected: Running in Zerion app/browser");
2131
2171
  return true;
2132
2172
  }
2133
2173
  }
2134
- console.log("❌ Zerion not detected through any method (or conflicts with MetaMask)");
2174
+ if (window.ethereum) {
2175
+ console.log("🔍 EXPERIMENTAL: Checking for Zerion-specific behavior...");
2176
+ try {
2177
+ const hasZerionPattern = window.ethereum.request && typeof window.ethereum.request === "function" && // Check if ethereum object has properties that might indicate Zerion
2178
+ (((_n = window.ethereum.isConnected) == null ? void 0 : _n.toString().includes("zerion")) || ((_o = window.ethereum.enable) == null ? void 0 : _o.toString().includes("zerion")));
2179
+ if (hasZerionPattern) {
2180
+ console.log("✅ Zerion detected: Experimental method pattern");
2181
+ return true;
2182
+ }
2183
+ } catch (e) {
2184
+ console.log("🔍 Experimental detection failed safely:", e.message);
2185
+ }
2186
+ }
2187
+ if (typeof window !== "undefined") {
2188
+ console.log("🔍 LAST RESORT: Checking all window properties for Zerion...");
2189
+ const windowKeys = Object.keys(window);
2190
+ const zerionRelated = windowKeys.filter((key) => {
2191
+ try {
2192
+ return key.toLowerCase().includes("zerion") || typeof window[key] === "object" && window[key] && window[key].constructor && window[key].constructor.name && window[key].constructor.name.toLowerCase().includes("zerion");
2193
+ } catch (e) {
2194
+ return false;
2195
+ }
2196
+ });
2197
+ console.log("🔍 Zerion-related window properties:", zerionRelated);
2198
+ if (zerionRelated.length > 0) {
2199
+ console.log("✅ Zerion detected: Found Zerion-related window properties", zerionRelated);
2200
+ return true;
2201
+ }
2202
+ }
2203
+ console.log("❌ Zerion not detected through ANY method");
2204
+ console.log("🔍 FULL DEBUG - Window ethereum object keys:", window.ethereum ? Object.keys(window.ethereum) : "No ethereum");
2205
+ console.log("🔍 FULL DEBUG - Window has providers array:", !!((_p = window.ethereum) == null ? void 0 : _p.providers));
2206
+ console.log("🔍 FULL DEBUG - Providers array length:", ((_r = (_q = window.ethereum) == null ? void 0 : _q.providers) == null ? void 0 : _r.length) || 0);
2135
2207
  return false;
2136
2208
  }
2137
2209
  // Get the correct provider for a specific wallet - VERY AGGRESSIVE approach
@@ -2702,7 +2774,7 @@ const WalletSelector = ({
2702
2774
  const [selectedWalletType, setSelectedWalletType] = useState(null);
2703
2775
  const walletManager = useRef(new UniversalWalletManager());
2704
2776
  const getAvailableWallets = () => {
2705
- var _a2, _b2, _c2, _d2, _e2;
2777
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j, _k, _l, _m, _n, _o;
2706
2778
  if (!selectedNetwork) return [];
2707
2779
  if (["ethereum", "bsc", "polygon", "arbitrum", "optimism", "avalanche", "solana"].includes(selectedNetwork.shortName)) {
2708
2780
  const detectedWallets = walletManager.current.getAvailableWallets();
@@ -2730,11 +2802,18 @@ const WalletSelector = ({
2730
2802
  isInstalled: true
2731
2803
  });
2732
2804
  }
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
- );
2805
+ 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 = navigator.userAgent) == null ? void 0 : _e2.includes("zerion")) || // Check providers array
2806
+ ((_f2 = window.ethereum) == null ? void 0 : _f2.providers) && window.ethereum.providers.some(
2807
+ (p2) => {
2808
+ var _a3, _b3;
2809
+ return p2.isZerion === true || p2.isZerionWallet === true || p2.zerion || p2._zerion || ((_b3 = (_a3 = p2.constructor) == null ? void 0 : _a3.name) == null ? void 0 : _b3.toLowerCase().includes("zerion")) || Object.keys(p2).some((key) => key.toLowerCase().includes("zerion"));
2810
+ }
2811
+ ) || // Check main ethereum object
2812
+ window.ethereum && (window.ethereum.zerion || window.ethereum._zerion || ((_h2 = (_g2 = window.ethereum.constructor) == null ? void 0 : _g2.name) == null ? void 0 : _h2.toLowerCase().includes("zerion")) || Object.keys(window.ethereum).some((key) => key.toLowerCase().includes("zerion"))) || // Check global window for any Zerion properties
2813
+ Object.keys(window).some((key) => key.toLowerCase().includes("zerion")) || // Check if running in Zerion app
2814
+ ((_j = (_i = window.location) == null ? void 0 : _i.href) == null ? void 0 : _j.includes("zerion")) || ((_k = document.title) == null ? void 0 : _k.toLowerCase().includes("zerion"));
2736
2815
  if (hasRealZerion && !smartWallets.find((w) => w.type === "zerion")) {
2737
- console.log("🔷 Adding Zerion (confirmed installed)");
2816
+ console.log("🔷 Adding Zerion (confirmed installed via comprehensive detection)");
2738
2817
  smartWallets.push({
2739
2818
  type: "zerion",
2740
2819
  name: "Zerion",
@@ -2743,8 +2822,21 @@ const WalletSelector = ({
2743
2822
  color: "purple",
2744
2823
  isInstalled: true
2745
2824
  });
2746
- } else if (!hasRealZerion) {
2747
- console.log("❌ Zerion NOT actually installed - not showing");
2825
+ } else {
2826
+ console.log("❌ Zerion comprehensive detection result:", {
2827
+ hasRealZerion,
2828
+ windowZerion: !!window.zerion,
2829
+ ethereumIsZerion: (_l = window.ethereum) == null ? void 0 : _l.isZerion,
2830
+ userAgentZerion: (_m = navigator.userAgent) == null ? void 0 : _m.includes("Zerion"),
2831
+ providersWithZerion: (_o = (_n = window.ethereum) == null ? void 0 : _n.providers) == null ? void 0 : _o.filter(
2832
+ (p2) => {
2833
+ var _a3, _b3;
2834
+ return p2.isZerion || p2.isZerionWallet || p2.zerion || p2._zerion || ((_b3 = (_a3 = p2.constructor) == null ? void 0 : _a3.name) == null ? void 0 : _b3.toLowerCase().includes("zerion"));
2835
+ }
2836
+ ),
2837
+ ethereumKeys: window.ethereum ? Object.keys(window.ethereum).filter((k2) => k2.toLowerCase().includes("zerion")) : [],
2838
+ windowKeys: Object.keys(window).filter((k2) => k2.toLowerCase().includes("zerion"))
2839
+ });
2748
2840
  smartWallets.push({
2749
2841
  type: "zerion",
2750
2842
  name: "Zerion",