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