@blazium/ton-connect-mobile 1.0.3 → 1.0.4

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.
@@ -44,25 +44,21 @@ class ExpoAdapter {
44
44
  throw new Error('expo-linking is not available');
45
45
  }
46
46
  try {
47
- console.log('[ExpoAdapter] Checking if URL can be opened:', url);
48
- const canOpen = await Linking.canOpenURL(url);
49
- console.log('[ExpoAdapter] canOpenURL result:', canOpen);
50
- if (!canOpen) {
51
- console.error('[ExpoAdapter] Cannot open URL - no app found that handles tonconnect:// protocol');
52
- throw new Error(`Cannot open URL: ${url}. Make sure a wallet app is installed that supports tonconnect:// protocol.`);
53
- }
54
- console.log('[ExpoAdapter] Opening URL...');
47
+ console.log('[ExpoAdapter] Opening URL:', url);
48
+ // CRITICAL FIX: Android'de canOpenURL() tonconnect:// protokolünü tanımayabilir
49
+ // Bu yüzden direkt openURL() çağırıyoruz. Eğer açılamazsa hata fırlatır.
55
50
  await Linking.openURL(url);
56
51
  console.log('[ExpoAdapter] URL opened successfully');
57
52
  return true;
58
53
  }
59
54
  catch (error) {
60
55
  console.error('[ExpoAdapter] Error in openURL:', error);
61
- // Re-throw with more context
62
- if (error.message && error.message.includes('Cannot open URL')) {
63
- throw error;
56
+ // Android'de tonconnect:// protokolü tanınmıyorsa veya cüzdan yüklü değilse hata verir
57
+ const errorMessage = error?.message || String(error);
58
+ if (errorMessage.includes('No Activity found') || errorMessage.includes('No app found')) {
59
+ throw new Error('No TON wallet app found. Please install Tonkeeper or another TON Connect compatible wallet from Google Play Store.');
64
60
  }
65
- throw new Error(`Failed to open URL: ${url}. ${error?.message || String(error)}`);
61
+ throw new Error(`Failed to open wallet app: ${errorMessage}`);
66
62
  }
67
63
  }
68
64
  async getInitialURL() {
@@ -42,25 +42,21 @@ class ReactNativeAdapter {
42
42
  throw new Error('react-native Linking is not available');
43
43
  }
44
44
  try {
45
- console.log('[ReactNativeAdapter] Checking if URL can be opened:', url);
46
- const canOpen = await Linking.canOpenURL(url);
47
- console.log('[ReactNativeAdapter] canOpenURL result:', canOpen);
48
- if (!canOpen) {
49
- console.error('[ReactNativeAdapter] Cannot open URL - no app found that handles tonconnect:// protocol');
50
- throw new Error(`Cannot open URL: ${url}. Make sure a wallet app is installed that supports tonconnect:// protocol.`);
51
- }
52
- console.log('[ReactNativeAdapter] Opening URL...');
45
+ console.log('[ReactNativeAdapter] Opening URL:', url);
46
+ // CRITICAL FIX: Android'de canOpenURL() tonconnect:// protokolünü tanımayabilir
47
+ // Bu yüzden direkt openURL() çağırıyoruz. Eğer açılamazsa hata fırlatır.
53
48
  await Linking.openURL(url);
54
49
  console.log('[ReactNativeAdapter] URL opened successfully');
55
50
  return true;
56
51
  }
57
52
  catch (error) {
58
53
  console.error('[ReactNativeAdapter] Error in openURL:', error);
59
- // Re-throw with more context
60
- if (error.message && error.message.includes('Cannot open URL')) {
61
- throw error;
54
+ // Android'de tonconnect:// protokolü tanınmıyorsa veya cüzdan yüklü değilse hata verir
55
+ const errorMessage = error?.message || String(error);
56
+ if (errorMessage.includes('No Activity found') || errorMessage.includes('No app found')) {
57
+ throw new Error('No TON wallet app found. Please install Tonkeeper or another TON Connect compatible wallet from Google Play Store.');
62
58
  }
63
- throw new Error(`Failed to open URL: ${url}. ${error?.message || String(error)}`);
59
+ throw new Error(`Failed to open wallet app: ${errorMessage}`);
64
60
  }
65
61
  }
66
62
  async getInitialURL() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazium/ton-connect-mobile",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Production-ready TON Connect Mobile SDK for React Native and Expo. Implements the real TonConnect protocol for mobile applications using deep links and callbacks.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,24 +53,22 @@ export class ExpoAdapter implements PlatformAdapter {
53
53
  throw new Error('expo-linking is not available');
54
54
  }
55
55
  try {
56
- console.log('[ExpoAdapter] Checking if URL can be opened:', url);
57
- const canOpen = await Linking.canOpenURL(url);
58
- console.log('[ExpoAdapter] canOpenURL result:', canOpen);
59
- if (!canOpen) {
60
- console.error('[ExpoAdapter] Cannot open URL - no app found that handles tonconnect:// protocol');
61
- throw new Error(`Cannot open URL: ${url}. Make sure a wallet app is installed that supports tonconnect:// protocol.`);
62
- }
63
- console.log('[ExpoAdapter] Opening URL...');
56
+ console.log('[ExpoAdapter] Opening URL:', url);
57
+ // CRITICAL FIX: Android'de canOpenURL() tonconnect:// protokolünü tanımayabilir
58
+ // Bu yüzden direkt openURL() çağırıyoruz. Eğer açılamazsa hata fırlatır.
64
59
  await Linking.openURL(url);
65
60
  console.log('[ExpoAdapter] URL opened successfully');
66
61
  return true;
67
62
  } catch (error: any) {
68
63
  console.error('[ExpoAdapter] Error in openURL:', error);
69
- // Re-throw with more context
70
- if (error.message && error.message.includes('Cannot open URL')) {
71
- throw error;
64
+ // Android'de tonconnect:// protokolü tanınmıyorsa veya cüzdan yüklü değilse hata verir
65
+ const errorMessage = error?.message || String(error);
66
+ if (errorMessage.includes('No Activity found') || errorMessage.includes('No app found')) {
67
+ throw new Error(
68
+ 'No TON wallet app found. Please install Tonkeeper or another TON Connect compatible wallet from Google Play Store.'
69
+ );
72
70
  }
73
- throw new Error(`Failed to open URL: ${url}. ${error?.message || String(error)}`);
71
+ throw new Error(`Failed to open wallet app: ${errorMessage}`);
74
72
  }
75
73
  }
76
74
 
@@ -51,24 +51,22 @@ export class ReactNativeAdapter implements PlatformAdapter {
51
51
  throw new Error('react-native Linking is not available');
52
52
  }
53
53
  try {
54
- console.log('[ReactNativeAdapter] Checking if URL can be opened:', url);
55
- const canOpen = await Linking.canOpenURL(url);
56
- console.log('[ReactNativeAdapter] canOpenURL result:', canOpen);
57
- if (!canOpen) {
58
- console.error('[ReactNativeAdapter] Cannot open URL - no app found that handles tonconnect:// protocol');
59
- throw new Error(`Cannot open URL: ${url}. Make sure a wallet app is installed that supports tonconnect:// protocol.`);
60
- }
61
- console.log('[ReactNativeAdapter] Opening URL...');
54
+ console.log('[ReactNativeAdapter] Opening URL:', url);
55
+ // CRITICAL FIX: Android'de canOpenURL() tonconnect:// protokolünü tanımayabilir
56
+ // Bu yüzden direkt openURL() çağırıyoruz. Eğer açılamazsa hata fırlatır.
62
57
  await Linking.openURL(url);
63
58
  console.log('[ReactNativeAdapter] URL opened successfully');
64
59
  return true;
65
60
  } catch (error: any) {
66
61
  console.error('[ReactNativeAdapter] Error in openURL:', error);
67
- // Re-throw with more context
68
- if (error.message && error.message.includes('Cannot open URL')) {
69
- throw error;
62
+ // Android'de tonconnect:// protokolü tanınmıyorsa veya cüzdan yüklü değilse hata verir
63
+ const errorMessage = error?.message || String(error);
64
+ if (errorMessage.includes('No Activity found') || errorMessage.includes('No app found')) {
65
+ throw new Error(
66
+ 'No TON wallet app found. Please install Tonkeeper or another TON Connect compatible wallet from Google Play Store.'
67
+ );
70
68
  }
71
- throw new Error(`Failed to open URL: ${url}. ${error?.message || String(error)}`);
69
+ throw new Error(`Failed to open wallet app: ${errorMessage}`);
72
70
  }
73
71
  }
74
72