@blazium/ton-connect-mobile 1.2.1 → 1.2.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.
- package/README.md +329 -14
- package/dist/core/wallets.js +5 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +274 -4
- package/dist/react/TonConnectUIProvider.d.ts +21 -2
- package/dist/react/TonConnectUIProvider.js +72 -3
- package/dist/react/WalletSelectionModal.d.ts +1 -0
- package/dist/react/WalletSelectionModal.js +143 -80
- package/dist/react/index.d.ts +1 -0
- package/dist/types/index.d.ts +46 -0
- package/package.json +1 -1
- package/src/core/wallets.ts +5 -1
- package/src/index.ts +337 -6
- package/src/react/TonConnectUIProvider.tsx +109 -4
- package/src/react/WalletSelectionModal.tsx +178 -91
- package/src/react/index.ts +1 -0
- package/src/types/index.ts +52 -0
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ Production-ready TON Connect Mobile SDK for React Native and Expo. Implements th
|
|
|
9
9
|
- ✅ **Full `@tonconnect/ui-react` Compatibility** - Drop-in replacement
|
|
10
10
|
- ✅ **React Native & Expo Support** - Works with both Expo and React Native CLI
|
|
11
11
|
- ✅ **Android & iOS Support** - Full deep linking support
|
|
12
|
-
- ✅ **Multiple Wallet Support** - Tonkeeper, Tonhub, MyTonWallet, Telegram Wallet
|
|
13
|
-
- ✅ **Beautiful Wallet Selection Modal** -
|
|
12
|
+
- ✅ **Multiple Wallet Support** - Tonkeeper (including Web), Tonhub, MyTonWallet, Telegram Wallet
|
|
13
|
+
- ✅ **Beautiful Wallet Selection Modal** - Grid layout matching @tonconnect/ui-react design
|
|
14
14
|
- ✅ **Transaction Signing** - Send transactions with wallet approval
|
|
15
15
|
- ✅ **Data Signing** - Sign arbitrary data for authentication
|
|
16
16
|
- ✅ **Transaction Builder Utilities** - Helper functions for building transactions
|
|
@@ -18,6 +18,10 @@ Production-ready TON Connect Mobile SDK for React Native and Expo. Implements th
|
|
|
18
18
|
- ✅ **Enhanced Error Messages** - Clear error messages with recovery suggestions
|
|
19
19
|
- ✅ **Wallet Availability Checking** - Check if wallets are available
|
|
20
20
|
- ✅ **Session Persistence** - Maintains connection across app restarts
|
|
21
|
+
- ✅ **Network Switching** - Switch between mainnet and testnet dynamically
|
|
22
|
+
- ✅ **Event Emitters** - Listen to connect, disconnect, transaction, and error events
|
|
23
|
+
- ✅ **Wallet Balance Checking** - Get wallet balance via TON Center API
|
|
24
|
+
- ✅ **Transaction Status Tracking** - Track transaction status with polling
|
|
21
25
|
- ✅ **TypeScript** - Full type safety
|
|
22
26
|
- ✅ **Production Ready** - Battle-tested implementation
|
|
23
27
|
|
|
@@ -135,18 +139,51 @@ Pre-built button component for connecting/disconnecting wallets.
|
|
|
135
139
|
|
|
136
140
|
#### `useTonConnectUI()`
|
|
137
141
|
|
|
138
|
-
Access the TonConnectUI instance with all methods.
|
|
142
|
+
Access the TonConnectUI instance with all methods and features.
|
|
139
143
|
|
|
140
144
|
```typescript
|
|
141
145
|
const tonConnectUI = useTonConnectUI();
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
<<<<<<< HEAD
|
|
148
|
+
// Connection methods:
|
|
144
149
|
await tonConnectUI.connectWallet();
|
|
145
150
|
await tonConnectUI.disconnect();
|
|
151
|
+
await tonConnectUI.restoreConnection(); // Restore from stored session
|
|
152
|
+
|
|
153
|
+
// Transaction methods:
|
|
146
154
|
await tonConnectUI.sendTransaction({ ... });
|
|
147
155
|
await tonConnectUI.signData({ data: '...', version: '1.0' });
|
|
156
|
+
|
|
157
|
+
// Modal methods:
|
|
148
158
|
await tonConnectUI.openModal();
|
|
149
159
|
tonConnectUI.closeModal();
|
|
160
|
+
|
|
161
|
+
// Wallet customization:
|
|
162
|
+
tonConnectUI.setWalletList([...]); // Customize available wallets
|
|
163
|
+
|
|
164
|
+
// Network management:
|
|
165
|
+
const network = tonConnectUI.getNetwork(); // Get current network
|
|
166
|
+
tonConnectUI.setNetwork('testnet'); // Switch to testnet
|
|
167
|
+
|
|
168
|
+
// Balance checking:
|
|
169
|
+
const balance = await tonConnectUI.getBalance(); // Get connected wallet balance
|
|
170
|
+
const balance2 = await tonConnectUI.getBalance(address); // Get specific address balance
|
|
171
|
+
|
|
172
|
+
// Transaction status:
|
|
173
|
+
const status = await tonConnectUI.getTransactionStatusByHash(txHash, address);
|
|
174
|
+
|
|
175
|
+
// Event listeners:
|
|
176
|
+
const unsubscribe = tonConnectUI.on('connect', (wallet) => {
|
|
177
|
+
console.log('Connected:', wallet);
|
|
178
|
+
});
|
|
179
|
+
tonConnectUI.on('disconnect', () => console.log('Disconnected'));
|
|
180
|
+
tonConnectUI.on('transaction', (tx) => console.log('Transaction:', tx));
|
|
181
|
+
tonConnectUI.on('error', (error) => console.error('Error:', error));
|
|
182
|
+
|
|
183
|
+
// State access:
|
|
184
|
+
tonConnectUI.wallet; // Current wallet state
|
|
185
|
+
tonConnectUI.modalState.open; // Modal open state
|
|
186
|
+
tonConnectUI.uiVersion; // UI kit version
|
|
150
187
|
```
|
|
151
188
|
|
|
152
189
|
#### `useTonWallet()`
|
|
@@ -204,10 +241,13 @@ new TonConnectMobile(config: TonConnectMobileConfig)
|
|
|
204
241
|
- `manifestUrl` (required): URL to your TonConnect manifest file
|
|
205
242
|
- `scheme` (required): Your app's deep link scheme
|
|
206
243
|
- `storageKeyPrefix` (optional): Prefix for storage keys (default: `'tonconnect_'`)
|
|
207
|
-
|
|
208
|
-
- `
|
|
244
|
+
<<<<<<< HEAD
|
|
245
|
+
- `connectionTimeout` (optional): Connection timeout in ms (default: `300000` = 5 minutes)
|
|
246
|
+
- `transactionTimeout` (optional): Transaction timeout in ms (default: `300000` = 5 minutes)
|
|
209
247
|
- `skipCanOpenURLCheck` (optional): Skip canOpenURL check (default: `true` for Android compatibility)
|
|
210
248
|
- `preferredWallet` (optional): Default wallet name
|
|
249
|
+
- `network` (optional): Network to use - `'mainnet'` or `'testnet'` (default: `'mainnet'`)
|
|
250
|
+
- `tonApiEndpoint` (optional): Custom TON API endpoint (default: auto-selected based on network)
|
|
211
251
|
|
|
212
252
|
#### Methods
|
|
213
253
|
|
|
@@ -246,7 +286,6 @@ const signed = await ton.signData('Hello, TON!', '1.0');
|
|
|
246
286
|
##### `disconnect(): Promise<void>`
|
|
247
287
|
|
|
248
288
|
Disconnect from wallet.
|
|
249
|
-
|
|
250
289
|
```typescript
|
|
251
290
|
await ton.disconnect();
|
|
252
291
|
```
|
|
@@ -286,9 +325,127 @@ const unsubscribe = ton.onStatusChange((status) => {
|
|
|
286
325
|
});
|
|
287
326
|
```
|
|
288
327
|
|
|
328
|
+
<<<<<<< HEAD
|
|
329
|
+
##### `getNetwork(): Network`
|
|
330
|
+
|
|
331
|
+
Get current network (mainnet or testnet).
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
const network = ton.getNetwork(); // 'mainnet' or 'testnet'
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
##### `setNetwork(network: Network): void`
|
|
338
|
+
|
|
339
|
+
Switch between mainnet and testnet.
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
ton.setNetwork('testnet'); // Switch to testnet
|
|
343
|
+
// Note: Warning is logged if switching while wallet is connected
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
##### `getBalance(address?: string): Promise<BalanceResponse>`
|
|
347
|
+
|
|
348
|
+
Get wallet balance from TON Center API.
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
// Get balance of connected wallet
|
|
352
|
+
const balance = await ton.getBalance();
|
|
353
|
+
|
|
354
|
+
// Get balance of specific address
|
|
355
|
+
const balance = await ton.getBalance('EQD0vdSA_NedR9uvbgN9EikRX-suesDxGeFg69XQMavfLqIo');
|
|
356
|
+
|
|
357
|
+
// Response:
|
|
358
|
+
// {
|
|
359
|
+
// balance: "1000000000", // in nanotons
|
|
360
|
+
// balanceTon: "1.0", // formatted TON
|
|
361
|
+
// network: "mainnet"
|
|
362
|
+
// }
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
##### `getTransactionStatusByHash(txHash: string, address: string): Promise<TransactionStatusResponse>`
|
|
366
|
+
|
|
367
|
+
Get transaction status by hash (recommended method).
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
const status = await ton.getTransactionStatusByHash(txHash, address);
|
|
371
|
+
|
|
372
|
+
// Response:
|
|
373
|
+
// {
|
|
374
|
+
// status: "confirmed" | "pending" | "failed" | "unknown",
|
|
375
|
+
// hash?: string,
|
|
376
|
+
// blockNumber?: number,
|
|
377
|
+
// error?: string
|
|
378
|
+
// }
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
##### `getTransactionStatus(boc: string, maxAttempts?: number, intervalMs?: number): Promise<TransactionStatusResponse>`
|
|
382
|
+
|
|
383
|
+
Get transaction status from BOC (requires BOC parsing library).
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
// Note: This method requires BOC parsing. Use getTransactionStatusByHash() instead.
|
|
387
|
+
const status = await ton.getTransactionStatus(boc, 10, 2000);
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
##### `on<T>(event: TonConnectEventType, listener: TonConnectEventListener<T>): () => void`
|
|
391
|
+
|
|
392
|
+
Add event listener.
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
// Listen to connection events
|
|
396
|
+
const unsubscribe = ton.on('connect', (wallet) => {
|
|
397
|
+
console.log('Connected to:', wallet.name);
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
// Listen to transaction events
|
|
401
|
+
ton.on('transaction', (tx) => {
|
|
402
|
+
console.log('Transaction sent:', tx.boc);
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
// Listen to errors
|
|
406
|
+
ton.on('error', (error) => {
|
|
407
|
+
console.error('SDK error:', error);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// Cleanup
|
|
411
|
+
unsubscribe();
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
##### `off<T>(event: TonConnectEventType, listener: TonConnectEventListener<T>): void`
|
|
415
|
+
|
|
416
|
+
Remove event listener.
|
|
417
|
+
|
|
418
|
+
```typescript
|
|
419
|
+
ton.off('connect', listener);
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
##### `removeAllListeners(event?: TonConnectEventType): void`
|
|
423
|
+
|
|
424
|
+
Remove all listeners for an event, or all events.
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
ton.removeAllListeners('connect'); // Remove all connect listeners
|
|
428
|
+
ton.removeAllListeners(); // Remove all listeners
|
|
429
|
+
```
|
|
430
|
+
|
|
289
431
|
## Platform Support
|
|
290
432
|
|
|
291
|
-
|
|
433
|
+
- ✅ **Android**: Full support via Expo or React Native CLI
|
|
434
|
+
- ✅ **iOS**: Full support via Expo or React Native CLI
|
|
435
|
+
- ✅ **Web**: Universal links supported (opens wallet in new tab/window)
|
|
436
|
+
|
|
437
|
+
**Web Platform Notes:**
|
|
438
|
+
- On web, wallets with universal links (like Tonkeeper Web, MyTonWallet) can be opened in a new browser tab
|
|
439
|
+
- The SDK automatically detects web platform and shows all available wallets
|
|
440
|
+
- Wallet availability is checked based on universal link support
|
|
441
|
+
- Deep links (`tonconnect://`) are not supported in web browsers, but universal links work perfectly
|
|
442
|
+
|
|
443
|
+
**Testing**:
|
|
444
|
+
- Android device or emulator
|
|
445
|
+
- iOS device or simulator
|
|
446
|
+
- Web browsers (for wallets with web support like Tonkeeper Web)
|
|
447
|
+
|
|
448
|
+
## Platform Support
|
|
292
449
|
|
|
293
450
|
- ✅ **Android**: Full support via Expo or React Native CLI
|
|
294
451
|
- ✅ **iOS**: Full support via Expo or React Native CLI
|
|
@@ -300,6 +457,7 @@ const unsubscribe = ton.onStatusChange((status) => {
|
|
|
300
457
|
- Android device or emulator
|
|
301
458
|
- iOS device or simulator
|
|
302
459
|
- Not web browsers
|
|
460
|
+
>>>>>>> af0bd46f78c13fb8e9799027e48d4fa228a49e3c
|
|
303
461
|
|
|
304
462
|
## Configuration
|
|
305
463
|
|
|
@@ -368,11 +526,13 @@ The manifest URL must be accessible via HTTPS.
|
|
|
368
526
|
|
|
369
527
|
## Supported Wallets
|
|
370
528
|
|
|
371
|
-
|
|
372
|
-
- **
|
|
373
|
-
- **MyTonWallet** - Full support
|
|
374
|
-
- **
|
|
529
|
+
<<<<<<< HEAD
|
|
530
|
+
- **Tonkeeper** - Full support (iOS, Android, Web)
|
|
531
|
+
- **MyTonWallet** - Full support (iOS, Android, Web)
|
|
532
|
+
- **Tonhub** - Full support (iOS, Android)
|
|
533
|
+
- **Wallet in Telegram** - Full support (iOS, Android)
|
|
375
534
|
|
|
535
|
+
**Note**: Wallet icons are automatically loaded from official sources. If an icon fails to load, a placeholder with the wallet's initial is shown.
|
|
376
536
|
## Migration from @tonconnect/ui-react
|
|
377
537
|
|
|
378
538
|
This SDK is a drop-in replacement for `@tonconnect/ui-react` in React Native/Expo environments.
|
|
@@ -453,10 +613,134 @@ MIT
|
|
|
453
613
|
For issues and questions:
|
|
454
614
|
- GitHub Issues: [https://github.com/blaziumdev/ton-connect-mobile/issues](https://github.com/blaziumdev/ton-connect-mobile/issues)
|
|
455
615
|
|
|
456
|
-
|
|
616
|
+
<<<<<<< HEAD
|
|
617
|
+
## New Features in v1.2.3
|
|
618
|
+
|
|
619
|
+
### 🌐 Network Switching
|
|
620
|
+
Switch between mainnet and testnet dynamically:
|
|
621
|
+
|
|
622
|
+
```typescript
|
|
623
|
+
// Initialize with network
|
|
624
|
+
const ton = new TonConnectMobile({
|
|
625
|
+
network: 'testnet', // or 'mainnet' (default)
|
|
626
|
+
// ... other config
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
// Or switch at runtime
|
|
630
|
+
ton.setNetwork('testnet');
|
|
631
|
+
tonConnectUI.setNetwork('testnet');
|
|
632
|
+
|
|
633
|
+
// Get current network
|
|
634
|
+
const network = ton.getNetwork(); // 'mainnet' or 'testnet'
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
**Features:**
|
|
638
|
+
- Chain ID automatically updates (-239 for mainnet, -3 for testnet)
|
|
639
|
+
- TON API endpoint automatically switches based on network
|
|
640
|
+
- Warning logged if switching network while wallet is connected
|
|
641
|
+
- React components automatically update chain ID
|
|
642
|
+
|
|
643
|
+
### 📡 Event Emitters
|
|
644
|
+
Listen to SDK events for reactive programming:
|
|
645
|
+
|
|
646
|
+
```typescript
|
|
647
|
+
// Add event listeners
|
|
648
|
+
tonConnectUI.on('connect', (wallet) => {
|
|
649
|
+
console.log('Connected to:', wallet.name);
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
tonConnectUI.on('disconnect', () => {
|
|
653
|
+
console.log('Disconnected');
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
tonConnectUI.on('transaction', (tx) => {
|
|
657
|
+
console.log('Transaction sent:', tx.boc);
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
tonConnectUI.on('error', (error) => {
|
|
661
|
+
console.error('SDK error:', error);
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
// Remove listener
|
|
665
|
+
const unsubscribe = tonConnectUI.on('connect', listener);
|
|
666
|
+
unsubscribe(); // or
|
|
667
|
+
tonConnectUI.off('connect', listener);
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
**Available Events:**
|
|
671
|
+
- `connect` - Fired when wallet connects
|
|
672
|
+
- `disconnect` - Fired when wallet disconnects
|
|
673
|
+
- `transaction` - Fired when transaction is sent
|
|
674
|
+
- `error` - Fired when an error occurs
|
|
675
|
+
- `statusChange` - Fired when connection status changes
|
|
676
|
+
|
|
677
|
+
### 💰 Wallet Balance Checking
|
|
678
|
+
Get wallet balance from TON Center API:
|
|
679
|
+
|
|
680
|
+
```typescript
|
|
681
|
+
// Get balance of connected wallet
|
|
682
|
+
const balance = await tonConnectUI.getBalance();
|
|
683
|
+
|
|
684
|
+
// Get balance of specific address
|
|
685
|
+
const balance = await tonConnectUI.getBalance('EQD0vdSA_NedR9uvbgN9EikRX-suesDxGeFg69XQMavfLqIo');
|
|
686
|
+
|
|
687
|
+
// Response:
|
|
688
|
+
// {
|
|
689
|
+
// balance: "1000000000", // in nanotons
|
|
690
|
+
// balanceTon: "1.0", // formatted TON
|
|
691
|
+
// network: "mainnet"
|
|
692
|
+
// }
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
**Features:**
|
|
696
|
+
- Automatically uses correct API endpoint based on network
|
|
697
|
+
- Returns balance in both nanotons and formatted TON
|
|
698
|
+
- Validates address format before API call
|
|
699
|
+
- Handles API errors gracefully
|
|
700
|
+
|
|
701
|
+
### 📊 Transaction Status Tracking
|
|
702
|
+
Track transaction status after sending:
|
|
703
|
+
|
|
704
|
+
```typescript
|
|
705
|
+
// Using transaction hash (recommended)
|
|
706
|
+
const status = await tonConnectUI.getTransactionStatusByHash(txHash, address);
|
|
707
|
+
|
|
708
|
+
// Response:
|
|
709
|
+
// {
|
|
710
|
+
// status: "confirmed" | "pending" | "failed" | "unknown",
|
|
711
|
+
// hash: "transaction_hash",
|
|
712
|
+
// blockNumber: 12345,
|
|
713
|
+
// error?: "error message"
|
|
714
|
+
// }
|
|
715
|
+
|
|
716
|
+
// Using BOC (requires BOC parsing library)
|
|
717
|
+
const status = await tonConnectUI.getTransactionStatus(boc, maxAttempts, intervalMs);
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
**Features:**
|
|
721
|
+
- Polling mechanism with configurable attempts and intervals
|
|
722
|
+
- Network-specific API endpoint selection
|
|
723
|
+
- Returns detailed status information
|
|
724
|
+
- Handles API errors gracefully
|
|
725
|
+
|
|
726
|
+
### 🎯 Complete TonConnectUI API
|
|
727
|
+
All features from `@tonconnect/ui-react` are now available:
|
|
728
|
+
|
|
729
|
+
```typescript
|
|
730
|
+
const tonConnectUI = useTonConnectUI();
|
|
731
|
+
|
|
732
|
+
// Restore connection from stored session
|
|
733
|
+
await tonConnectUI.restoreConnection();
|
|
734
|
+
|
|
735
|
+
// Customize available wallets
|
|
736
|
+
tonConnectUI.setWalletList([
|
|
737
|
+
{ name: 'Tonkeeper', universalLink: '...', platforms: ['ios', 'android', 'web'] },
|
|
738
|
+
{ name: 'MyTonWallet', universalLink: '...', platforms: ['ios', 'android', 'web'] },
|
|
739
|
+
]);
|
|
740
|
+
```
|
|
457
741
|
|
|
458
742
|
### 🎨 Wallet Selection Modal
|
|
459
|
-
Beautiful, built-in wallet selection modal
|
|
743
|
+
Beautiful, built-in wallet selection modal with grid layout matching @tonconnect/ui-react design. Automatically appears when you call `openModal()`:
|
|
460
744
|
|
|
461
745
|
```typescript
|
|
462
746
|
import { WalletSelectionModal } from '@blazium/ton-connect-mobile/react';
|
|
@@ -469,6 +753,14 @@ import { WalletSelectionModal } from '@blazium/ton-connect-mobile/react';
|
|
|
469
753
|
/>
|
|
470
754
|
```
|
|
471
755
|
|
|
756
|
+
**Features:**
|
|
757
|
+
- Grid layout (4 columns) matching @tonconnect/ui-react design
|
|
758
|
+
- Real wallet icons loaded from official sources
|
|
759
|
+
- Availability status for each wallet
|
|
760
|
+
- Automatic wallet filtering by platform
|
|
761
|
+
- Smooth animations and loading states
|
|
762
|
+
- Custom wallet list support via `setWalletList()`
|
|
763
|
+
|
|
472
764
|
### 🛠️ Transaction Builder Utilities
|
|
473
765
|
Helper functions for building transactions easily:
|
|
474
766
|
|
|
@@ -533,6 +825,12 @@ if (isAvailable) {
|
|
|
533
825
|
}
|
|
534
826
|
```
|
|
535
827
|
|
|
828
|
+
**Platform Detection:**
|
|
829
|
+
- On web: Checks if wallet has universal link support (can open in new tab)
|
|
830
|
+
- On mobile: Checks if wallet supports the current platform (iOS/Android)
|
|
831
|
+
- Uses adapter type for reliable platform detection
|
|
832
|
+
- All wallets with universal links are considered available on web
|
|
833
|
+
|
|
536
834
|
### 💬 Enhanced Error Messages
|
|
537
835
|
All errors now include helpful recovery suggestions:
|
|
538
836
|
|
|
@@ -549,6 +847,22 @@ try {
|
|
|
549
847
|
|
|
550
848
|
## Changelog
|
|
551
849
|
|
|
850
|
+
### v1.2.3
|
|
851
|
+
- ✅ **NEW**: Network switching - Switch between mainnet and testnet dynamically
|
|
852
|
+
- ✅ **NEW**: Event emitters - Listen to connect, disconnect, transaction, and error events
|
|
853
|
+
- ✅ **NEW**: Wallet balance checking - Get wallet balance via TON Center API integration
|
|
854
|
+
- ✅ **NEW**: Transaction status tracking - Track transaction status with polling mechanism
|
|
855
|
+
- ✅ **NEW**: Complete TonConnectUI API implementation - all features from @tonconnect/ui-react
|
|
856
|
+
- ✅ **NEW**: `restoreConnection()` method - restore connection from stored session
|
|
857
|
+
- ✅ **NEW**: `setWalletList()` method - customize available wallets in modal
|
|
858
|
+
- ✅ **NEW**: Wallet selection modal with grid layout matching @tonconnect/ui-react design
|
|
859
|
+
- ✅ **NEW**: Real wallet icons loaded from official sources
|
|
860
|
+
- ✅ **NEW**: Improved web platform support (Tonkeeper Web, MyTonWallet Web)
|
|
861
|
+
- ✅ **IMPROVED**: Wallet availability detection using adapter type (more reliable)
|
|
862
|
+
- ✅ **IMPROVED**: All wallets shown on web platform (with availability status)
|
|
863
|
+
- ✅ **IMPROVED**: Chain ID automatically updates when network changes
|
|
864
|
+
- ✅ **FIXED**: Tonkeeper now correctly shows as available on web
|
|
865
|
+
|
|
552
866
|
### v1.2.0
|
|
553
867
|
- ✅ **NEW**: Beautiful wallet selection modal component
|
|
554
868
|
- ✅ **NEW**: Transaction builder utilities (`buildTransferTransaction`, `tonToNano`, etc.)
|
|
@@ -559,6 +873,7 @@ try {
|
|
|
559
873
|
- ✅ Enhanced logging and debugging
|
|
560
874
|
- ✅ Better TypeScript types
|
|
561
875
|
|
|
876
|
+
|
|
562
877
|
### v1.1.5
|
|
563
878
|
- ✅ Full `@tonconnect/ui-react` compatibility
|
|
564
879
|
- ✅ React integration layer with hooks and components
|
package/dist/core/wallets.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.SUPPORTED_WALLETS = [
|
|
|
17
17
|
appName: 'Tonkeeper',
|
|
18
18
|
universalLink: 'https://app.tonkeeper.com/ton-connect',
|
|
19
19
|
deepLink: 'tonkeeper://',
|
|
20
|
+
iconUrl: 'https://tonkeeper.com/assets/tonconnect-icon.png',
|
|
20
21
|
platforms: ['ios', 'android', 'web'], // CRITICAL FIX: Tonkeeper Web is supported
|
|
21
22
|
preferredReturnStrategy: 'post_redirect', // CRITICAL FIX: 'back' strategy may not send callback properly, use 'post_redirect'
|
|
22
23
|
requiresReturnScheme: true, // CRITICAL FIX: Mobile apps need returnScheme for proper callback handling
|
|
@@ -26,6 +27,7 @@ exports.SUPPORTED_WALLETS = [
|
|
|
26
27
|
appName: 'MyTonWallet',
|
|
27
28
|
universalLink: 'https://connect.mytonwallet.org',
|
|
28
29
|
deepLink: 'mytonwallet://',
|
|
30
|
+
iconUrl: 'https://static.mytonwallet.io/icon-256.png',
|
|
29
31
|
platforms: ['ios', 'android', 'web'],
|
|
30
32
|
preferredReturnStrategy: 'post_redirect',
|
|
31
33
|
requiresReturnScheme: true, // MyTonWallet requires explicit returnScheme
|
|
@@ -33,8 +35,9 @@ exports.SUPPORTED_WALLETS = [
|
|
|
33
35
|
{
|
|
34
36
|
name: 'Wallet in Telegram',
|
|
35
37
|
appName: 'Wallet',
|
|
36
|
-
universalLink: 'https://wallet.
|
|
38
|
+
universalLink: 'https://wallet.tg/ton-connect',
|
|
37
39
|
deepLink: 'tg://',
|
|
40
|
+
iconUrl: 'https://wallet.tg/images/logo-288.png',
|
|
38
41
|
platforms: ['ios', 'android'],
|
|
39
42
|
preferredReturnStrategy: 'post_redirect',
|
|
40
43
|
requiresReturnScheme: true, // Telegram Wallet requires explicit returnScheme
|
|
@@ -44,6 +47,7 @@ exports.SUPPORTED_WALLETS = [
|
|
|
44
47
|
appName: 'Tonhub',
|
|
45
48
|
universalLink: 'https://tonhub.com/ton-connect',
|
|
46
49
|
deepLink: 'tonhub://',
|
|
50
|
+
iconUrl: 'https://tonhub.com/tonconnect_logo.png',
|
|
47
51
|
platforms: ['ios', 'android'],
|
|
48
52
|
preferredReturnStrategy: 'post_redirect',
|
|
49
53
|
requiresReturnScheme: true, // Tonhub requires explicit returnScheme for proper callback
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* TON Connect Mobile SDK
|
|
3
3
|
* Production-ready implementation for React Native and Expo
|
|
4
4
|
*/
|
|
5
|
-
import { TonConnectMobileConfig, ConnectionStatus, WalletInfo, SendTransactionRequest, StatusChangeCallback } from './types';
|
|
5
|
+
import { TonConnectMobileConfig, ConnectionStatus, WalletInfo, SendTransactionRequest, StatusChangeCallback, Network, TonConnectEventType, TonConnectEventListener, TransactionStatusResponse, BalanceResponse } from './types';
|
|
6
6
|
import { type WalletDefinition } from './core/wallets';
|
|
7
7
|
/**
|
|
8
8
|
* Custom error classes
|
|
@@ -34,6 +34,7 @@ export declare class TonConnectMobile {
|
|
|
34
34
|
private adapter;
|
|
35
35
|
private config;
|
|
36
36
|
private statusChangeCallbacks;
|
|
37
|
+
private eventListeners;
|
|
37
38
|
private currentStatus;
|
|
38
39
|
private urlUnsubscribe;
|
|
39
40
|
private currentWallet;
|
|
@@ -119,6 +120,22 @@ export declare class TonConnectMobile {
|
|
|
119
120
|
* Notify all status change callbacks
|
|
120
121
|
*/
|
|
121
122
|
private notifyStatusChange;
|
|
123
|
+
/**
|
|
124
|
+
* Emit event to all listeners
|
|
125
|
+
*/
|
|
126
|
+
private emit;
|
|
127
|
+
/**
|
|
128
|
+
* Add event listener
|
|
129
|
+
*/
|
|
130
|
+
on<T = any>(event: TonConnectEventType, listener: TonConnectEventListener<T>): () => void;
|
|
131
|
+
/**
|
|
132
|
+
* Remove event listener
|
|
133
|
+
*/
|
|
134
|
+
off<T = any>(event: TonConnectEventType, listener: TonConnectEventListener<T>): void;
|
|
135
|
+
/**
|
|
136
|
+
* Remove all listeners for an event
|
|
137
|
+
*/
|
|
138
|
+
removeAllListeners(event?: TonConnectEventType): void;
|
|
122
139
|
/**
|
|
123
140
|
* Validate session ID format
|
|
124
141
|
*/
|
|
@@ -139,6 +156,26 @@ export declare class TonConnectMobile {
|
|
|
139
156
|
* Cleanup resources
|
|
140
157
|
*/
|
|
141
158
|
destroy(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Get current network
|
|
161
|
+
*/
|
|
162
|
+
getNetwork(): Network;
|
|
163
|
+
/**
|
|
164
|
+
* Set network (mainnet/testnet)
|
|
165
|
+
*/
|
|
166
|
+
setNetwork(network: Network): void;
|
|
167
|
+
/**
|
|
168
|
+
* Get wallet balance
|
|
169
|
+
*/
|
|
170
|
+
getBalance(address?: string): Promise<BalanceResponse>;
|
|
171
|
+
/**
|
|
172
|
+
* Get transaction status
|
|
173
|
+
*/
|
|
174
|
+
getTransactionStatus(boc: string, maxAttempts?: number, intervalMs?: number): Promise<TransactionStatusResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Get transaction status by hash (more reliable than BOC)
|
|
177
|
+
*/
|
|
178
|
+
getTransactionStatusByHash(txHash: string, address: string): Promise<TransactionStatusResponse>;
|
|
142
179
|
}
|
|
143
180
|
export * from './types';
|
|
144
181
|
export type { WalletDefinition } from './core/wallets';
|