coinley-checkout 0.3.7 → 0.3.9
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.
@@ -182,10 +182,81 @@ const detectWallets = () => {
|
|
182
182
|
return wallets;
|
183
183
|
}
|
184
184
|
try {
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
185
|
+
console.log("=== ENHANCED WALLET DETECTION DEBUG ===");
|
186
|
+
if (window.ethereum) {
|
187
|
+
if (window.ethereum.isMetaMask) {
|
188
|
+
wallets[WALLET_TYPES.METAMASK] = true;
|
189
|
+
console.log("✅ MetaMask detected via direct isMetaMask");
|
190
|
+
}
|
191
|
+
if (window.ethereum.providers && Array.isArray(window.ethereum.providers)) {
|
192
|
+
const metamaskProvider = window.ethereum.providers.find((p2) => p2.isMetaMask);
|
193
|
+
if (metamaskProvider) {
|
194
|
+
wallets[WALLET_TYPES.METAMASK] = true;
|
195
|
+
console.log("✅ MetaMask detected via providers array");
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
if (window.ethereum) {
|
200
|
+
if (window.ethereum.isTrust || window.ethereum.isTrustWallet) {
|
201
|
+
wallets[WALLET_TYPES.TRUST_WALLET] = true;
|
202
|
+
console.log("✅ Trust Wallet detected via direct property");
|
203
|
+
}
|
204
|
+
if (window.ethereum.providers && Array.isArray(window.ethereum.providers)) {
|
205
|
+
const trustProvider = window.ethereum.providers.find(
|
206
|
+
(p2) => p2.isTrust || p2.isTrustWallet || p2.constructor && p2.constructor.name === "TrustWallet"
|
207
|
+
);
|
208
|
+
if (trustProvider) {
|
209
|
+
wallets[WALLET_TYPES.TRUST_WALLET] = true;
|
210
|
+
console.log("✅ Trust Wallet detected via providers array");
|
211
|
+
}
|
212
|
+
}
|
213
|
+
if (navigator.userAgent && navigator.userAgent.includes("Trust")) {
|
214
|
+
wallets[WALLET_TYPES.TRUST_WALLET] = true;
|
215
|
+
console.log("✅ Trust Wallet detected via user agent");
|
216
|
+
}
|
217
|
+
if (window.ethereum.isTrustWallet || window.trustwallet) {
|
218
|
+
wallets[WALLET_TYPES.TRUST_WALLET] = true;
|
219
|
+
console.log("✅ Trust Wallet detected via specific methods");
|
220
|
+
}
|
221
|
+
}
|
222
|
+
if (window.tronWeb && window.tronWeb.defaultAddress) {
|
223
|
+
wallets[WALLET_TYPES.TRONLINK] = true;
|
224
|
+
console.log("✅ TronLink detected via tronWeb");
|
225
|
+
}
|
226
|
+
if (window.tronLink) {
|
227
|
+
wallets[WALLET_TYPES.TRONLINK] = true;
|
228
|
+
console.log("✅ TronLink detected via tronLink object");
|
229
|
+
}
|
230
|
+
if (window.tron) {
|
231
|
+
wallets[WALLET_TYPES.TRONLINK] = true;
|
232
|
+
console.log("✅ TronLink detected via tron object");
|
233
|
+
}
|
234
|
+
if (window.tronWeb && (window.tronWeb.ready || window.tronWeb.installed)) {
|
235
|
+
wallets[WALLET_TYPES.TRONLINK] = true;
|
236
|
+
console.log("✅ TronLink detected via ready/installed properties");
|
237
|
+
}
|
238
|
+
if (window.algorand) {
|
239
|
+
if (window.algorand.isLute) {
|
240
|
+
wallets[WALLET_TYPES.LUTE] = true;
|
241
|
+
console.log("✅ Lute Wallet detected via algorand.isLute");
|
242
|
+
} else {
|
243
|
+
wallets[WALLET_TYPES.LUTE] = true;
|
244
|
+
console.log("✅ Algorand wallet detected (assuming Lute)");
|
245
|
+
}
|
246
|
+
}
|
247
|
+
if (window.navigator && window.navigator.userAgent) {
|
248
|
+
const userAgent = window.navigator.userAgent.toLowerCase();
|
249
|
+
if (userAgent.includes("trustwallet")) {
|
250
|
+
wallets[WALLET_TYPES.TRUST_WALLET] = true;
|
251
|
+
console.log("✅ Trust Wallet detected via mobile user agent");
|
252
|
+
}
|
253
|
+
if (userAgent.includes("tronlink")) {
|
254
|
+
wallets[WALLET_TYPES.TRONLINK] = true;
|
255
|
+
console.log("✅ TronLink detected via mobile user agent");
|
256
|
+
}
|
257
|
+
}
|
258
|
+
console.log("Final wallet detection results:", wallets);
|
259
|
+
console.log("=== END ENHANCED WALLET DETECTION DEBUG ===");
|
189
260
|
} catch (error) {
|
190
261
|
console.warn("Error detecting wallets:", error);
|
191
262
|
}
|