@blazium/ton-connect-mobile 1.1.2 → 1.1.3

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.
@@ -19,7 +19,7 @@ exports.SUPPORTED_WALLETS = [
19
19
  deepLink: 'tonkeeper://',
20
20
  platforms: ['ios', 'android'],
21
21
  preferredReturnStrategy: 'back',
22
- requiresReturnScheme: false, // Tonkeeper can infer from manifest
22
+ requiresReturnScheme: true, // CRITICAL FIX: Mobile apps need returnScheme for proper callback handling
23
23
  },
24
24
  {
25
25
  name: 'MyTonWallet',
package/dist/index.js CHANGED
@@ -349,13 +349,16 @@ class TonConnectMobile {
349
349
  const urlParts = url.split('?');
350
350
  if (urlParts.length > 1) {
351
351
  const payload = urlParts[1];
352
- const decoded = (0, protocol_1.decodeBase64URL)(payload);
352
+ // CRITICAL FIX: Handle URL encoding - payload might have additional encoding
353
+ const cleanPayload = decodeURIComponent(payload);
354
+ const decoded = (0, protocol_1.decodeBase64URL)(cleanPayload);
353
355
  console.log('[TON Connect] Connection request payload:', JSON.stringify(decoded, null, 2));
354
356
  }
355
357
  }
356
358
  catch (e) {
357
- // Ignore decode errors in logging
358
- console.log('[TON Connect] Could not decode payload for logging:', e);
359
+ // Log decode errors for debugging but don't fail
360
+ console.log('[TON Connect] Could not decode payload for logging:', e?.message || e);
361
+ // This is just for logging, the actual URL is correct
359
362
  }
360
363
  console.log('[TON Connect] Built URL:', url.substring(0, 100) + '...');
361
364
  console.log('[TON Connect] Full URL:', url);
@@ -65,8 +65,12 @@ function TonConnectButton({ text = 'Connect Wallet', connectedText = 'Disconnect
65
65
  await tonConnectUI.disconnect();
66
66
  }
67
67
  else {
68
+ // CRITICAL FIX: Only open modal, don't auto-connect
69
+ // The modal should handle wallet selection and connection
70
+ // This allows users to choose which wallet to connect
68
71
  await tonConnectUI.openModal();
69
- await tonConnectUI.connectWallet();
72
+ // Note: connectWallet() should be called by the modal/wallet selection UI
73
+ // Not automatically here, to allow wallet selection
70
74
  }
71
75
  }
72
76
  catch (error) {
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "./index.js",
3
+ "types": "./index.d.ts"
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazium/ton-connect-mobile",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
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",
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "./react": {
13
13
  "types": "./dist/react/index.d.ts",
14
- "default": "./dist/react/index.js"
14
+ "default": "./dist/react/index.js",
15
+ "react-native": "./dist/react/index.js"
15
16
  }
16
17
  },
17
18
  "repository": {
@@ -20,6 +21,7 @@
20
21
  },
21
22
  "scripts": {
22
23
  "build": "tsc",
24
+ "postbuild": "node scripts/postbuild.js",
23
25
  "prepublishOnly": "npm run build",
24
26
  "example": "cd example && npm start"
25
27
  },
@@ -33,7 +33,7 @@ export const SUPPORTED_WALLETS: WalletDefinition[] = [
33
33
  deepLink: 'tonkeeper://',
34
34
  platforms: ['ios', 'android'],
35
35
  preferredReturnStrategy: 'back',
36
- requiresReturnScheme: false, // Tonkeeper can infer from manifest
36
+ requiresReturnScheme: true, // CRITICAL FIX: Mobile apps need returnScheme for proper callback handling
37
37
  },
38
38
  {
39
39
  name: 'MyTonWallet',
package/src/index.ts CHANGED
@@ -407,12 +407,15 @@ export class TonConnectMobile {
407
407
  const urlParts = url.split('?');
408
408
  if (urlParts.length > 1) {
409
409
  const payload = urlParts[1];
410
- const decoded = decodeBase64URL<ConnectionRequestPayload>(payload);
410
+ // CRITICAL FIX: Handle URL encoding - payload might have additional encoding
411
+ const cleanPayload = decodeURIComponent(payload);
412
+ const decoded = decodeBase64URL<ConnectionRequestPayload>(cleanPayload);
411
413
  console.log('[TON Connect] Connection request payload:', JSON.stringify(decoded, null, 2));
412
414
  }
413
- } catch (e) {
414
- // Ignore decode errors in logging
415
- console.log('[TON Connect] Could not decode payload for logging:', e);
415
+ } catch (e: any) {
416
+ // Log decode errors for debugging but don't fail
417
+ console.log('[TON Connect] Could not decode payload for logging:', e?.message || e);
418
+ // This is just for logging, the actual URL is correct
416
419
  }
417
420
 
418
421
  console.log('[TON Connect] Built URL:', url.substring(0, 100) + '...');
@@ -52,8 +52,12 @@ export function TonConnectButton({
52
52
  if (isConnected) {
53
53
  await tonConnectUI.disconnect();
54
54
  } else {
55
+ // CRITICAL FIX: Only open modal, don't auto-connect
56
+ // The modal should handle wallet selection and connection
57
+ // This allows users to choose which wallet to connect
55
58
  await tonConnectUI.openModal();
56
- await tonConnectUI.connectWallet();
59
+ // Note: connectWallet() should be called by the modal/wallet selection UI
60
+ // Not automatically here, to allow wallet selection
57
61
  }
58
62
  } catch (error) {
59
63
  // CRITICAL FIX: Handle errors gracefully