@blazium/ton-connect-mobile 1.0.6 → 1.0.7
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/dist/index.js +13 -0
- package/package.json +1 -1
- package/src/index.ts +17 -0
package/dist/index.js
CHANGED
|
@@ -181,6 +181,11 @@ class TonConnectMobile {
|
|
|
181
181
|
*/
|
|
182
182
|
handleCallback(url) {
|
|
183
183
|
console.log('[TON Connect] handleCallback called with URL:', url);
|
|
184
|
+
// CRITICAL FIX: Check if URL matches our scheme
|
|
185
|
+
if (!url || !url.startsWith(`${this.config.scheme}://`)) {
|
|
186
|
+
console.log('[TON Connect] Callback URL does not match scheme, ignoring:', url);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
184
189
|
const parsed = (0, protocol_1.parseCallbackURL)(url, this.config.scheme);
|
|
185
190
|
console.log('[TON Connect] Parsed callback:', parsed.type, parsed.data ? 'has data' : 'no data');
|
|
186
191
|
if (parsed.type === 'connect' && parsed.data) {
|
|
@@ -455,6 +460,14 @@ class TonConnectMobile {
|
|
|
455
460
|
if (!wallet) {
|
|
456
461
|
throw new TonConnectError(`Wallet "${walletName}" not found. Available wallets: ${wallets_1.SUPPORTED_WALLETS.map(w => w.name).join(', ')}`);
|
|
457
462
|
}
|
|
463
|
+
// CRITICAL FIX: Clear any pending connection when wallet changes
|
|
464
|
+
if (this.connectionPromise) {
|
|
465
|
+
console.log('[TON Connect] Clearing pending connection due to wallet change');
|
|
466
|
+
if (this.connectionPromise.timeout !== null) {
|
|
467
|
+
clearTimeout(this.connectionPromise.timeout);
|
|
468
|
+
}
|
|
469
|
+
this.connectionPromise = null;
|
|
470
|
+
}
|
|
458
471
|
this.currentWallet = wallet;
|
|
459
472
|
console.log('[TON Connect] Preferred wallet changed to:', wallet.name);
|
|
460
473
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazium/ton-connect-mobile",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -209,6 +209,13 @@ export class TonConnectMobile {
|
|
|
209
209
|
*/
|
|
210
210
|
private handleCallback(url: string): void {
|
|
211
211
|
console.log('[TON Connect] handleCallback called with URL:', url);
|
|
212
|
+
|
|
213
|
+
// CRITICAL FIX: Check if URL matches our scheme
|
|
214
|
+
if (!url || !url.startsWith(`${this.config.scheme}://`)) {
|
|
215
|
+
console.log('[TON Connect] Callback URL does not match scheme, ignoring:', url);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
212
219
|
const parsed = parseCallbackURL(url, this.config.scheme);
|
|
213
220
|
console.log('[TON Connect] Parsed callback:', parsed.type, parsed.data ? 'has data' : 'no data');
|
|
214
221
|
|
|
@@ -524,6 +531,16 @@ export class TonConnectMobile {
|
|
|
524
531
|
if (!wallet) {
|
|
525
532
|
throw new TonConnectError(`Wallet "${walletName}" not found. Available wallets: ${SUPPORTED_WALLETS.map(w => w.name).join(', ')}`);
|
|
526
533
|
}
|
|
534
|
+
|
|
535
|
+
// CRITICAL FIX: Clear any pending connection when wallet changes
|
|
536
|
+
if (this.connectionPromise) {
|
|
537
|
+
console.log('[TON Connect] Clearing pending connection due to wallet change');
|
|
538
|
+
if (this.connectionPromise.timeout !== null) {
|
|
539
|
+
clearTimeout(this.connectionPromise.timeout);
|
|
540
|
+
}
|
|
541
|
+
this.connectionPromise = null;
|
|
542
|
+
}
|
|
543
|
+
|
|
527
544
|
this.currentWallet = wallet;
|
|
528
545
|
console.log('[TON Connect] Preferred wallet changed to:', wallet.name);
|
|
529
546
|
}
|