@blazium/ton-connect-mobile 1.0.2 → 1.0.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.
- package/dist/index.js +18 -0
- package/package.json +1 -1
- package/src/index.ts +19 -0
package/dist/index.js
CHANGED
|
@@ -93,8 +93,13 @@ class TonConnectMobile {
|
|
|
93
93
|
transactionTimeout: 300000, // 5 minutes
|
|
94
94
|
...config,
|
|
95
95
|
};
|
|
96
|
+
console.log('[TON Connect] Initializing SDK with config:', {
|
|
97
|
+
manifestUrl: this.config.manifestUrl,
|
|
98
|
+
scheme: this.config.scheme,
|
|
99
|
+
});
|
|
96
100
|
// Initialize platform adapter
|
|
97
101
|
this.adapter = this.createAdapter();
|
|
102
|
+
console.log('[TON Connect] Adapter initialized:', this.adapter.constructor.name);
|
|
98
103
|
// Set up URL listener
|
|
99
104
|
this.setupURLListener();
|
|
100
105
|
// Load persisted session
|
|
@@ -135,21 +140,29 @@ class TonConnectMobile {
|
|
|
135
140
|
* Set up URL listener for wallet callbacks
|
|
136
141
|
*/
|
|
137
142
|
setupURLListener() {
|
|
143
|
+
console.log('[TON Connect] Setting up URL listener...');
|
|
138
144
|
this.urlUnsubscribe = this.adapter.addURLListener((url) => {
|
|
145
|
+
console.log('[TON Connect] URL callback received:', url);
|
|
139
146
|
this.handleCallback(url);
|
|
140
147
|
});
|
|
141
148
|
// Also check initial URL (when app was opened via deep link)
|
|
142
149
|
this.adapter.getInitialURL().then((url) => {
|
|
143
150
|
if (url) {
|
|
151
|
+
console.log('[TON Connect] Initial URL found:', url);
|
|
144
152
|
this.handleCallback(url);
|
|
145
153
|
}
|
|
154
|
+
else {
|
|
155
|
+
console.log('[TON Connect] No initial URL');
|
|
156
|
+
}
|
|
146
157
|
});
|
|
147
158
|
}
|
|
148
159
|
/**
|
|
149
160
|
* Handle callback from wallet
|
|
150
161
|
*/
|
|
151
162
|
handleCallback(url) {
|
|
163
|
+
console.log('[TON Connect] handleCallback called with URL:', url);
|
|
152
164
|
const parsed = (0, protocol_1.parseCallbackURL)(url, this.config.scheme);
|
|
165
|
+
console.log('[TON Connect] Parsed callback:', parsed.type, parsed.data ? 'has data' : 'no data');
|
|
153
166
|
if (parsed.type === 'connect' && parsed.data) {
|
|
154
167
|
this.handleConnectionResponse(parsed.data);
|
|
155
168
|
}
|
|
@@ -254,20 +267,25 @@ class TonConnectMobile {
|
|
|
254
267
|
* Connect to wallet
|
|
255
268
|
*/
|
|
256
269
|
async connect() {
|
|
270
|
+
console.log('[TON Connect] connect() called');
|
|
257
271
|
// If already connected, return current wallet
|
|
258
272
|
if (this.currentStatus.connected && this.currentStatus.wallet) {
|
|
273
|
+
console.log('[TON Connect] Already connected, returning existing wallet');
|
|
259
274
|
return this.currentStatus.wallet;
|
|
260
275
|
}
|
|
261
276
|
// CRITICAL FIX: Check if connection is already in progress
|
|
262
277
|
if (this.connectionPromise) {
|
|
278
|
+
console.log('[TON Connect] Connection already in progress');
|
|
263
279
|
throw new ConnectionInProgressError();
|
|
264
280
|
}
|
|
265
281
|
// Build connection request URL
|
|
282
|
+
console.log('[TON Connect] Building connection request URL...');
|
|
266
283
|
const url = (0, protocol_1.buildConnectionRequest)(this.config.manifestUrl, this.config.scheme);
|
|
267
284
|
// DEBUG: Log the URL being opened
|
|
268
285
|
console.log('[TON Connect] Opening URL:', url);
|
|
269
286
|
console.log('[TON Connect] Manifest URL:', this.config.manifestUrl);
|
|
270
287
|
console.log('[TON Connect] Return scheme:', this.config.scheme);
|
|
288
|
+
console.log('[TON Connect] Adapter type:', this.adapter.constructor.name);
|
|
271
289
|
// Create promise for connection
|
|
272
290
|
return new Promise((resolve, reject) => {
|
|
273
291
|
let timeout = null;
|
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.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",
|
package/src/index.ts
CHANGED
|
@@ -114,8 +114,14 @@ export class TonConnectMobile {
|
|
|
114
114
|
...config,
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
+
console.log('[TON Connect] Initializing SDK with config:', {
|
|
118
|
+
manifestUrl: this.config.manifestUrl,
|
|
119
|
+
scheme: this.config.scheme,
|
|
120
|
+
});
|
|
121
|
+
|
|
117
122
|
// Initialize platform adapter
|
|
118
123
|
this.adapter = this.createAdapter();
|
|
124
|
+
console.log('[TON Connect] Adapter initialized:', this.adapter.constructor.name);
|
|
119
125
|
|
|
120
126
|
// Set up URL listener
|
|
121
127
|
this.setupURLListener();
|
|
@@ -161,14 +167,19 @@ export class TonConnectMobile {
|
|
|
161
167
|
* Set up URL listener for wallet callbacks
|
|
162
168
|
*/
|
|
163
169
|
private setupURLListener(): void {
|
|
170
|
+
console.log('[TON Connect] Setting up URL listener...');
|
|
164
171
|
this.urlUnsubscribe = this.adapter.addURLListener((url) => {
|
|
172
|
+
console.log('[TON Connect] URL callback received:', url);
|
|
165
173
|
this.handleCallback(url);
|
|
166
174
|
});
|
|
167
175
|
|
|
168
176
|
// Also check initial URL (when app was opened via deep link)
|
|
169
177
|
this.adapter.getInitialURL().then((url) => {
|
|
170
178
|
if (url) {
|
|
179
|
+
console.log('[TON Connect] Initial URL found:', url);
|
|
171
180
|
this.handleCallback(url);
|
|
181
|
+
} else {
|
|
182
|
+
console.log('[TON Connect] No initial URL');
|
|
172
183
|
}
|
|
173
184
|
});
|
|
174
185
|
}
|
|
@@ -177,7 +188,9 @@ export class TonConnectMobile {
|
|
|
177
188
|
* Handle callback from wallet
|
|
178
189
|
*/
|
|
179
190
|
private handleCallback(url: string): void {
|
|
191
|
+
console.log('[TON Connect] handleCallback called with URL:', url);
|
|
180
192
|
const parsed = parseCallbackURL(url, this.config.scheme);
|
|
193
|
+
console.log('[TON Connect] Parsed callback:', parsed.type, parsed.data ? 'has data' : 'no data');
|
|
181
194
|
|
|
182
195
|
if (parsed.type === 'connect' && parsed.data) {
|
|
183
196
|
this.handleConnectionResponse(parsed.data as ConnectionResponsePayload);
|
|
@@ -292,23 +305,29 @@ export class TonConnectMobile {
|
|
|
292
305
|
* Connect to wallet
|
|
293
306
|
*/
|
|
294
307
|
async connect(): Promise<WalletInfo> {
|
|
308
|
+
console.log('[TON Connect] connect() called');
|
|
309
|
+
|
|
295
310
|
// If already connected, return current wallet
|
|
296
311
|
if (this.currentStatus.connected && this.currentStatus.wallet) {
|
|
312
|
+
console.log('[TON Connect] Already connected, returning existing wallet');
|
|
297
313
|
return this.currentStatus.wallet;
|
|
298
314
|
}
|
|
299
315
|
|
|
300
316
|
// CRITICAL FIX: Check if connection is already in progress
|
|
301
317
|
if (this.connectionPromise) {
|
|
318
|
+
console.log('[TON Connect] Connection already in progress');
|
|
302
319
|
throw new ConnectionInProgressError();
|
|
303
320
|
}
|
|
304
321
|
|
|
305
322
|
// Build connection request URL
|
|
323
|
+
console.log('[TON Connect] Building connection request URL...');
|
|
306
324
|
const url = buildConnectionRequest(this.config.manifestUrl, this.config.scheme);
|
|
307
325
|
|
|
308
326
|
// DEBUG: Log the URL being opened
|
|
309
327
|
console.log('[TON Connect] Opening URL:', url);
|
|
310
328
|
console.log('[TON Connect] Manifest URL:', this.config.manifestUrl);
|
|
311
329
|
console.log('[TON Connect] Return scheme:', this.config.scheme);
|
|
330
|
+
console.log('[TON Connect] Adapter type:', this.adapter.constructor.name);
|
|
312
331
|
|
|
313
332
|
// Create promise for connection
|
|
314
333
|
return new Promise<WalletInfo>((resolve, reject) => {
|