@blazium/ton-connect-mobile 1.2.4 → 1.2.5
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/README.md
CHANGED
|
@@ -144,7 +144,6 @@ Access the TonConnectUI instance with all methods and features.
|
|
|
144
144
|
```typescript
|
|
145
145
|
const tonConnectUI = useTonConnectUI();
|
|
146
146
|
|
|
147
|
-
<<<<<<< HEAD
|
|
148
147
|
// Connection methods:
|
|
149
148
|
await tonConnectUI.connectWallet();
|
|
150
149
|
await tonConnectUI.disconnect();
|
|
@@ -241,7 +240,6 @@ new TonConnectMobile(config: TonConnectMobileConfig)
|
|
|
241
240
|
- `manifestUrl` (required): URL to your TonConnect manifest file
|
|
242
241
|
- `scheme` (required): Your app's deep link scheme
|
|
243
242
|
- `storageKeyPrefix` (optional): Prefix for storage keys (default: `'tonconnect_'`)
|
|
244
|
-
<<<<<<< HEAD
|
|
245
243
|
- `connectionTimeout` (optional): Connection timeout in ms (default: `300000` = 5 minutes)
|
|
246
244
|
- `transactionTimeout` (optional): Transaction timeout in ms (default: `300000` = 5 minutes)
|
|
247
245
|
- `skipCanOpenURLCheck` (optional): Skip canOpenURL check (default: `true` for Android compatibility)
|
|
@@ -325,7 +323,6 @@ const unsubscribe = ton.onStatusChange((status) => {
|
|
|
325
323
|
});
|
|
326
324
|
```
|
|
327
325
|
|
|
328
|
-
<<<<<<< HEAD
|
|
329
326
|
##### `getNetwork(): Network`
|
|
330
327
|
|
|
331
328
|
Get current network (mainnet or testnet).
|
|
@@ -445,20 +442,6 @@ ton.removeAllListeners(); // Remove all listeners
|
|
|
445
442
|
- iOS device or simulator
|
|
446
443
|
- Web browsers (for wallets with web support like Tonkeeper Web)
|
|
447
444
|
|
|
448
|
-
## Platform Support
|
|
449
|
-
|
|
450
|
-
- ✅ **Android**: Full support via Expo or React Native CLI
|
|
451
|
-
- ✅ **iOS**: Full support via Expo or React Native CLI
|
|
452
|
-
- ⚠️ **Web**: Deep links are not supported. The SDK will throw a clear error message if you try to use it in a web browser.
|
|
453
|
-
|
|
454
|
-
**Why?** The `tonconnect://` protocol is a custom URI scheme that requires a mobile app handler. Web browsers cannot handle these custom protocols.
|
|
455
|
-
|
|
456
|
-
**Testing**: To test wallet connections, use:
|
|
457
|
-
- Android device or emulator
|
|
458
|
-
- iOS device or simulator
|
|
459
|
-
- Not web browsers
|
|
460
|
-
>>>>>>> af0bd46f78c13fb8e9799027e48d4fa228a49e3c
|
|
461
|
-
|
|
462
445
|
## Configuration
|
|
463
446
|
|
|
464
447
|
### Expo Setup
|
|
@@ -526,13 +509,13 @@ The manifest URL must be accessible via HTTPS.
|
|
|
526
509
|
|
|
527
510
|
## Supported Wallets
|
|
528
511
|
|
|
529
|
-
<<<<<<< HEAD
|
|
530
512
|
- **Tonkeeper** - Full support (iOS, Android, Web)
|
|
531
513
|
- **MyTonWallet** - Full support (iOS, Android, Web)
|
|
532
514
|
- **Tonhub** - Full support (iOS, Android)
|
|
533
515
|
- **Wallet in Telegram** - Full support (iOS, Android)
|
|
534
516
|
|
|
535
517
|
**Note**: Wallet icons are automatically loaded from official sources. If an icon fails to load, a placeholder with the wallet's initial is shown.
|
|
518
|
+
|
|
536
519
|
## Migration from @tonconnect/ui-react
|
|
537
520
|
|
|
538
521
|
This SDK is a drop-in replacement for `@tonconnect/ui-react` in React Native/Expo environments.
|
|
@@ -613,7 +596,6 @@ MIT
|
|
|
613
596
|
For issues and questions:
|
|
614
597
|
- GitHub Issues: [https://github.com/blaziumdev/ton-connect-mobile/issues](https://github.com/blaziumdev/ton-connect-mobile/issues)
|
|
615
598
|
|
|
616
|
-
<<<<<<< HEAD
|
|
617
599
|
## New Features in v1.2.3
|
|
618
600
|
|
|
619
601
|
### 🌐 Network Switching
|
|
@@ -847,6 +829,11 @@ try {
|
|
|
847
829
|
|
|
848
830
|
## Changelog
|
|
849
831
|
|
|
832
|
+
### v1.2.5
|
|
833
|
+
- ✅ **FIXED**: Connection response validation - `appName` and `version` fields are now optional, improving compatibility with wallets that don't send these fields
|
|
834
|
+
- ✅ **FIXED**: ReactNativeAdapter URL listener error handling - Added try-catch block to prevent app crashes if URL listeners throw errors
|
|
835
|
+
- ✅ **IMPROVED**: Enhanced error handling robustness across the SDK
|
|
836
|
+
|
|
850
837
|
### v1.2.3
|
|
851
838
|
- ✅ **NEW**: Network switching - Switch between mainnet and testnet dynamically
|
|
852
839
|
- ✅ **NEW**: Event emitters - Listen to connect, disconnect, transaction, and error events
|
|
@@ -863,6 +850,7 @@ try {
|
|
|
863
850
|
- ✅ **IMPROVED**: Chain ID automatically updates when network changes
|
|
864
851
|
- ✅ **FIXED**: Tonkeeper now correctly shows as available on web
|
|
865
852
|
|
|
853
|
+
|
|
866
854
|
### v1.2.0
|
|
867
855
|
- ✅ **NEW**: Beautiful wallet selection modal component
|
|
868
856
|
- ✅ **NEW**: Transaction builder utilities (`buildTransferTransaction`, `tonToNano`, etc.)
|
|
@@ -873,7 +861,6 @@ try {
|
|
|
873
861
|
- ✅ Enhanced logging and debugging
|
|
874
862
|
- ✅ Better TypeScript types
|
|
875
863
|
|
|
876
|
-
|
|
877
864
|
### v1.1.5
|
|
878
865
|
- ✅ Full `@tonconnect/ui-react` compatibility
|
|
879
866
|
- ✅ React integration layer with hooks and components
|
|
@@ -34,7 +34,14 @@ class ReactNativeAdapter {
|
|
|
34
34
|
}
|
|
35
35
|
// Listen for deep links when app is already open
|
|
36
36
|
this.subscription = Linking.addEventListener('url', (event) => {
|
|
37
|
-
this.urlListeners.forEach((listener) =>
|
|
37
|
+
this.urlListeners.forEach((listener) => {
|
|
38
|
+
try {
|
|
39
|
+
listener(event.url);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('[ReactNativeAdapter] Error in URL listener:', error);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
38
45
|
});
|
|
39
46
|
}
|
|
40
47
|
async openURL(url, skipCanOpenURLCheck = true) {
|
package/dist/core/protocol.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export declare function parseCallbackURL(url: string, scheme: string): {
|
|
|
40
40
|
export declare function extractWalletInfo(response: ConnectionResponsePayload): WalletInfo;
|
|
41
41
|
/**
|
|
42
42
|
* Validate connection response
|
|
43
|
+
* CRITICAL FIX: Only validate truly required fields (session, address, publicKey, name)
|
|
44
|
+
* appName and version are optional - extractWalletInfo has fallbacks for them
|
|
43
45
|
*/
|
|
44
46
|
export declare function validateConnectionResponse(response: ConnectionResponsePayload): boolean;
|
|
45
47
|
/**
|
package/dist/core/protocol.js
CHANGED
|
@@ -269,14 +269,17 @@ function extractWalletInfo(response) {
|
|
|
269
269
|
}
|
|
270
270
|
/**
|
|
271
271
|
* Validate connection response
|
|
272
|
+
* CRITICAL FIX: Only validate truly required fields (session, address, publicKey, name)
|
|
273
|
+
* appName and version are optional - extractWalletInfo has fallbacks for them
|
|
272
274
|
*/
|
|
273
275
|
function validateConnectionResponse(response) {
|
|
274
276
|
return !!(response.session &&
|
|
275
277
|
response.address &&
|
|
276
278
|
response.publicKey &&
|
|
277
|
-
response.name
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
response.name
|
|
280
|
+
// Note: appName and version are optional - extractWalletInfo handles fallbacks
|
|
281
|
+
// Some wallets may not send these fields, and that's OK
|
|
282
|
+
);
|
|
280
283
|
}
|
|
281
284
|
/**
|
|
282
285
|
* Validate transaction response
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazium/ton-connect-mobile",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
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",
|
|
@@ -42,7 +42,13 @@ export class ReactNativeAdapter implements PlatformAdapter {
|
|
|
42
42
|
}
|
|
43
43
|
// Listen for deep links when app is already open
|
|
44
44
|
this.subscription = Linking.addEventListener('url', (event: { url: string }) => {
|
|
45
|
-
this.urlListeners.forEach((listener) =>
|
|
45
|
+
this.urlListeners.forEach((listener) => {
|
|
46
|
+
try {
|
|
47
|
+
listener(event.url);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('[ReactNativeAdapter] Error in URL listener:', error);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
46
52
|
});
|
|
47
53
|
}
|
|
48
54
|
|
package/src/core/protocol.ts
CHANGED
|
@@ -338,6 +338,8 @@ export function extractWalletInfo(
|
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
340
|
* Validate connection response
|
|
341
|
+
* CRITICAL FIX: Only validate truly required fields (session, address, publicKey, name)
|
|
342
|
+
* appName and version are optional - extractWalletInfo has fallbacks for them
|
|
341
343
|
*/
|
|
342
344
|
export function validateConnectionResponse(
|
|
343
345
|
response: ConnectionResponsePayload
|
|
@@ -346,9 +348,9 @@ export function validateConnectionResponse(
|
|
|
346
348
|
response.session &&
|
|
347
349
|
response.address &&
|
|
348
350
|
response.publicKey &&
|
|
349
|
-
response.name
|
|
350
|
-
|
|
351
|
-
|
|
351
|
+
response.name
|
|
352
|
+
// Note: appName and version are optional - extractWalletInfo handles fallbacks
|
|
353
|
+
// Some wallets may not send these fields, and that's OK
|
|
352
354
|
);
|
|
353
355
|
}
|
|
354
356
|
|