@tonconnect/sdk 3.0.3-beta.0 → 3.0.3-beta.1
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/tonconnect-sdk.min.js +1 -1
- package/dist/tonconnect-sdk.min.js.map +1 -1
- package/lib/cjs/index.cjs +167 -46
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.mjs +165 -47
- package/lib/esm/index.mjs.map +1 -1
- package/lib/types/index.d.ts +164 -16
- package/package.json +2 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -501,9 +501,7 @@ function createResource(createFn, disposeFn) {
|
|
|
501
501
|
promise ? disposeFn(yield promise) : Promise.resolve()
|
|
502
502
|
]);
|
|
503
503
|
}
|
|
504
|
-
catch (e) {
|
|
505
|
-
logError('Failed to dispose the resource', e);
|
|
506
|
-
}
|
|
504
|
+
catch (e) { }
|
|
507
505
|
});
|
|
508
506
|
// recreate the current resource
|
|
509
507
|
const recreate = (delayMs) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -2009,7 +2007,35 @@ function checkSendTransactionSupport(features, options) {
|
|
|
2009
2007
|
logWarning("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet.");
|
|
2010
2008
|
}
|
|
2011
2009
|
|
|
2012
|
-
|
|
2010
|
+
/**
|
|
2011
|
+
* Create a request version event.
|
|
2012
|
+
*/
|
|
2013
|
+
function createRequestVersionEvent() {
|
|
2014
|
+
return {
|
|
2015
|
+
type: 'request-version'
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Create a response version event.
|
|
2020
|
+
* @param version
|
|
2021
|
+
*/
|
|
2022
|
+
function createResponseVersionEvent(version) {
|
|
2023
|
+
return {
|
|
2024
|
+
type: 'response-version',
|
|
2025
|
+
version: version
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
/**
|
|
2029
|
+
* Create a version info.
|
|
2030
|
+
* @param version
|
|
2031
|
+
*/
|
|
2032
|
+
function createVersionInfo(version) {
|
|
2033
|
+
return {
|
|
2034
|
+
ton_connect_sdk_lib: version.ton_connect_sdk_lib,
|
|
2035
|
+
ton_connect_ui_lib: version.ton_connect_ui_lib
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
function createConnectionInfo(version, wallet) {
|
|
2013
2039
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2014
2040
|
const isTonProof = ((_a = wallet === null || wallet === void 0 ? void 0 : wallet.connectItems) === null || _a === void 0 ? void 0 : _a.tonProof) && 'proof' in wallet.connectItems.tonProof;
|
|
2015
2041
|
const authType = isTonProof ? 'ton_proof' : 'ton_addr';
|
|
@@ -2018,62 +2044,69 @@ function createConnectionInfo(wallet) {
|
|
|
2018
2044
|
wallet_type: (_d = wallet === null || wallet === void 0 ? void 0 : wallet.device.appName) !== null && _d !== void 0 ? _d : null,
|
|
2019
2045
|
wallet_version: (_e = wallet === null || wallet === void 0 ? void 0 : wallet.device.appVersion) !== null && _e !== void 0 ? _e : null,
|
|
2020
2046
|
auth_type: authType,
|
|
2021
|
-
custom_data: {
|
|
2022
|
-
chain_id: (_g = (_f = wallet === null || wallet === void 0 ? void 0 : wallet.account) === null || _f === void 0 ? void 0 : _f.chain) !== null && _g !== void 0 ? _g : null,
|
|
2023
|
-
provider: (_h = wallet === null || wallet === void 0 ? void 0 : wallet.provider) !== null && _h !== void 0 ? _h : null
|
|
2024
|
-
}
|
|
2047
|
+
custom_data: Object.assign({ chain_id: (_g = (_f = wallet === null || wallet === void 0 ? void 0 : wallet.account) === null || _f === void 0 ? void 0 : _f.chain) !== null && _g !== void 0 ? _g : null, provider: (_h = wallet === null || wallet === void 0 ? void 0 : wallet.provider) !== null && _h !== void 0 ? _h : null }, createVersionInfo(version))
|
|
2025
2048
|
};
|
|
2026
2049
|
}
|
|
2027
2050
|
/**
|
|
2028
2051
|
* Create a connection init event.
|
|
2029
2052
|
*/
|
|
2030
|
-
function createConnectionStartedEvent() {
|
|
2053
|
+
function createConnectionStartedEvent(version) {
|
|
2031
2054
|
return {
|
|
2032
|
-
type: 'connection-started'
|
|
2055
|
+
type: 'connection-started',
|
|
2056
|
+
custom_data: createVersionInfo(version)
|
|
2033
2057
|
};
|
|
2034
2058
|
}
|
|
2035
2059
|
/**
|
|
2036
2060
|
* Create a connection completed event.
|
|
2061
|
+
* @param version
|
|
2037
2062
|
* @param wallet
|
|
2038
2063
|
*/
|
|
2039
|
-
function createConnectionCompletedEvent(wallet) {
|
|
2040
|
-
return Object.assign({ type: 'connection-completed' }, createConnectionInfo(wallet));
|
|
2064
|
+
function createConnectionCompletedEvent(version, wallet) {
|
|
2065
|
+
return Object.assign({ type: 'connection-completed', is_success: true }, createConnectionInfo(version, wallet));
|
|
2041
2066
|
}
|
|
2042
2067
|
/**
|
|
2043
2068
|
* Create a connection error event.
|
|
2069
|
+
* @param version
|
|
2044
2070
|
* @param error_message
|
|
2045
2071
|
* @param errorCode
|
|
2046
2072
|
*/
|
|
2047
|
-
function createConnectionErrorEvent(error_message, errorCode) {
|
|
2073
|
+
function createConnectionErrorEvent(version, error_message, errorCode) {
|
|
2048
2074
|
return {
|
|
2049
2075
|
type: 'connection-error',
|
|
2076
|
+
is_success: false,
|
|
2050
2077
|
error_message: error_message,
|
|
2051
|
-
error_code: errorCode !== null && errorCode !== void 0 ? errorCode : null
|
|
2078
|
+
error_code: errorCode !== null && errorCode !== void 0 ? errorCode : null,
|
|
2079
|
+
custom_data: createVersionInfo(version)
|
|
2052
2080
|
};
|
|
2053
2081
|
}
|
|
2054
2082
|
/**
|
|
2055
2083
|
* Create a connection restoring started event.
|
|
2056
2084
|
*/
|
|
2057
|
-
function createConnectionRestoringStartedEvent() {
|
|
2085
|
+
function createConnectionRestoringStartedEvent(version) {
|
|
2058
2086
|
return {
|
|
2059
|
-
type: 'connection-restoring-started'
|
|
2087
|
+
type: 'connection-restoring-started',
|
|
2088
|
+
custom_data: createVersionInfo(version)
|
|
2060
2089
|
};
|
|
2061
2090
|
}
|
|
2062
2091
|
/**
|
|
2063
2092
|
* Create a connection restoring completed event.
|
|
2093
|
+
* @param version
|
|
2064
2094
|
* @param wallet
|
|
2065
2095
|
*/
|
|
2066
|
-
function createConnectionRestoringCompletedEvent(wallet) {
|
|
2067
|
-
return Object.assign({ type: 'connection-restoring-completed' }, createConnectionInfo(wallet));
|
|
2096
|
+
function createConnectionRestoringCompletedEvent(version, wallet) {
|
|
2097
|
+
return Object.assign({ type: 'connection-restoring-completed', is_success: true }, createConnectionInfo(version, wallet));
|
|
2068
2098
|
}
|
|
2069
2099
|
/**
|
|
2070
2100
|
* Create a connection restoring error event.
|
|
2101
|
+
* @param version
|
|
2071
2102
|
* @param errorMessage
|
|
2072
2103
|
*/
|
|
2073
|
-
function createConnectionRestoringErrorEvent(errorMessage) {
|
|
2104
|
+
function createConnectionRestoringErrorEvent(version, errorMessage) {
|
|
2074
2105
|
return {
|
|
2075
2106
|
type: 'connection-restoring-error',
|
|
2076
|
-
|
|
2107
|
+
is_success: false,
|
|
2108
|
+
error_message: errorMessage,
|
|
2109
|
+
custom_data: createVersionInfo(version)
|
|
2077
2110
|
};
|
|
2078
2111
|
}
|
|
2079
2112
|
function createTransactionInfo(wallet, transaction) {
|
|
@@ -2092,39 +2125,43 @@ function createTransactionInfo(wallet, transaction) {
|
|
|
2092
2125
|
}
|
|
2093
2126
|
/**
|
|
2094
2127
|
* Create a transaction init event.
|
|
2128
|
+
* @param version
|
|
2095
2129
|
* @param wallet
|
|
2096
2130
|
* @param transaction
|
|
2097
2131
|
*/
|
|
2098
|
-
function createTransactionSentForSignatureEvent(wallet, transaction) {
|
|
2099
|
-
return Object.assign(Object.assign({ type: 'transaction-sent-for-signature' }, createConnectionInfo(wallet)), createTransactionInfo(wallet, transaction));
|
|
2132
|
+
function createTransactionSentForSignatureEvent(version, wallet, transaction) {
|
|
2133
|
+
return Object.assign(Object.assign({ type: 'transaction-sent-for-signature' }, createConnectionInfo(version, wallet)), createTransactionInfo(wallet, transaction));
|
|
2100
2134
|
}
|
|
2101
2135
|
/**
|
|
2102
2136
|
* Create a transaction signed event.
|
|
2137
|
+
* @param version
|
|
2103
2138
|
* @param wallet
|
|
2104
2139
|
* @param transaction
|
|
2105
2140
|
* @param signedTransaction
|
|
2106
2141
|
*/
|
|
2107
|
-
function createTransactionSignedEvent(wallet, transaction, signedTransaction) {
|
|
2108
|
-
return Object.assign(Object.assign({ type: 'transaction-signed', signed_transaction: signedTransaction.boc }, createConnectionInfo(wallet)), createTransactionInfo(wallet, transaction));
|
|
2142
|
+
function createTransactionSignedEvent(version, wallet, transaction, signedTransaction) {
|
|
2143
|
+
return Object.assign(Object.assign({ type: 'transaction-signed', is_success: true, signed_transaction: signedTransaction.boc }, createConnectionInfo(version, wallet)), createTransactionInfo(wallet, transaction));
|
|
2109
2144
|
}
|
|
2110
2145
|
/**
|
|
2111
2146
|
* Create a transaction error event.
|
|
2147
|
+
* @param version
|
|
2112
2148
|
* @param wallet
|
|
2113
2149
|
* @param transaction
|
|
2114
2150
|
* @param errorMessage
|
|
2115
2151
|
* @param errorCode
|
|
2116
2152
|
*/
|
|
2117
|
-
function createTransactionSigningFailedEvent(wallet, transaction, errorMessage, errorCode) {
|
|
2118
|
-
return Object.assign(Object.assign({ type: 'transaction-signing-failed', error_message: errorMessage, error_code: errorCode !== null && errorCode !== void 0 ? errorCode : null }, createConnectionInfo(wallet)), createTransactionInfo(wallet, transaction));
|
|
2153
|
+
function createTransactionSigningFailedEvent(version, wallet, transaction, errorMessage, errorCode) {
|
|
2154
|
+
return Object.assign(Object.assign({ type: 'transaction-signing-failed', is_success: false, error_message: errorMessage, error_code: errorCode !== null && errorCode !== void 0 ? errorCode : null }, createConnectionInfo(version, wallet)), createTransactionInfo(wallet, transaction));
|
|
2119
2155
|
}
|
|
2120
2156
|
/**
|
|
2121
2157
|
* Create a disconnect event.
|
|
2158
|
+
* @param version
|
|
2122
2159
|
* @param wallet
|
|
2123
2160
|
* @param scope
|
|
2124
2161
|
* @returns
|
|
2125
2162
|
*/
|
|
2126
|
-
function createDisconnectionEvent(wallet, scope) {
|
|
2127
|
-
return Object.assign({ type: 'disconnection', scope: scope }, createConnectionInfo(wallet));
|
|
2163
|
+
function createDisconnectionEvent(version, wallet, scope) {
|
|
2164
|
+
return Object.assign({ type: 'disconnection', scope: scope }, createConnectionInfo(version, wallet));
|
|
2128
2165
|
}
|
|
2129
2166
|
|
|
2130
2167
|
/**
|
|
@@ -2151,6 +2188,23 @@ class BrowserEventDispatcher {
|
|
|
2151
2188
|
(_a = this.window) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
|
|
2152
2189
|
});
|
|
2153
2190
|
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Adds an event listener to the browser window.
|
|
2193
|
+
* @param eventName - The name of the event to listen for.
|
|
2194
|
+
* @param listener - The listener to add.
|
|
2195
|
+
* @param options - The options for the listener.
|
|
2196
|
+
* @returns A function that removes the listener.
|
|
2197
|
+
*/
|
|
2198
|
+
addEventListener(eventName, listener, options) {
|
|
2199
|
+
var _a;
|
|
2200
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2201
|
+
(_a = this.window) === null || _a === void 0 ? void 0 : _a.addEventListener(eventName, listener, options);
|
|
2202
|
+
return () => {
|
|
2203
|
+
var _a;
|
|
2204
|
+
return (_a = this.window) === null || _a === void 0 ? void 0 : _a.removeEventListener(eventName, listener);
|
|
2205
|
+
};
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2154
2208
|
}
|
|
2155
2209
|
|
|
2156
2210
|
/**
|
|
@@ -2178,13 +2232,71 @@ class BrowserEventDispatcher {
|
|
|
2178
2232
|
* @internal
|
|
2179
2233
|
*/
|
|
2180
2234
|
class TonConnectTracker {
|
|
2181
|
-
constructor(
|
|
2235
|
+
constructor(options) {
|
|
2236
|
+
var _a;
|
|
2182
2237
|
/**
|
|
2183
2238
|
* Event prefix for user actions.
|
|
2184
2239
|
* @private
|
|
2185
2240
|
*/
|
|
2186
2241
|
this.eventPrefix = 'ton-connect-';
|
|
2187
|
-
|
|
2242
|
+
/**
|
|
2243
|
+
* TonConnect UI version.
|
|
2244
|
+
*/
|
|
2245
|
+
this.tonConnectUiVersion = null;
|
|
2246
|
+
this.eventDispatcher = (_a = options === null || options === void 0 ? void 0 : options.eventDispatcher) !== null && _a !== void 0 ? _a : new BrowserEventDispatcher();
|
|
2247
|
+
this.tonConnectSdkVersion = options.tonConnectSdkVersion;
|
|
2248
|
+
this.init().catch();
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Version of the library.
|
|
2252
|
+
*/
|
|
2253
|
+
get version() {
|
|
2254
|
+
return createVersionInfo({
|
|
2255
|
+
ton_connect_sdk_lib: this.tonConnectSdkVersion,
|
|
2256
|
+
ton_connect_ui_lib: this.tonConnectUiVersion
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Called once when the tracker is created and request version other libraries.
|
|
2261
|
+
*/
|
|
2262
|
+
init() {
|
|
2263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2264
|
+
try {
|
|
2265
|
+
yield this.setRequestVersionHandler();
|
|
2266
|
+
this.tonConnectUiVersion = yield this.requestTonConnectUiVersion();
|
|
2267
|
+
}
|
|
2268
|
+
catch (e) { }
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Set request version handler.
|
|
2273
|
+
* @private
|
|
2274
|
+
*/
|
|
2275
|
+
setRequestVersionHandler() {
|
|
2276
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2277
|
+
yield this.eventDispatcher.addEventListener('ton-connect-request-version', () => __awaiter(this, void 0, void 0, function* () {
|
|
2278
|
+
yield this.eventDispatcher.dispatchEvent('ton-connect-response-version', createResponseVersionEvent(this.tonConnectSdkVersion));
|
|
2279
|
+
}));
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Request TonConnect UI version.
|
|
2284
|
+
* @private
|
|
2285
|
+
*/
|
|
2286
|
+
requestTonConnectUiVersion() {
|
|
2287
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2288
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
2289
|
+
try {
|
|
2290
|
+
yield this.eventDispatcher.addEventListener('ton-connect-ui-response-version', (event) => {
|
|
2291
|
+
resolve(event.detail.version);
|
|
2292
|
+
}, { once: true });
|
|
2293
|
+
yield this.eventDispatcher.dispatchEvent('ton-connect-ui-request-version', createRequestVersionEvent());
|
|
2294
|
+
}
|
|
2295
|
+
catch (e) {
|
|
2296
|
+
reject(e);
|
|
2297
|
+
}
|
|
2298
|
+
}));
|
|
2299
|
+
});
|
|
2188
2300
|
}
|
|
2189
2301
|
/**
|
|
2190
2302
|
* Emit user action event to the window.
|
|
@@ -2193,8 +2305,9 @@ class TonConnectTracker {
|
|
|
2193
2305
|
*/
|
|
2194
2306
|
dispatchUserActionEvent(eventDetails) {
|
|
2195
2307
|
try {
|
|
2196
|
-
|
|
2197
|
-
|
|
2308
|
+
this.eventDispatcher
|
|
2309
|
+
.dispatchEvent(`${this.eventPrefix}${eventDetails.type}`, eventDetails)
|
|
2310
|
+
.catch();
|
|
2198
2311
|
}
|
|
2199
2312
|
catch (e) { }
|
|
2200
2313
|
}
|
|
@@ -2204,7 +2317,7 @@ class TonConnectTracker {
|
|
|
2204
2317
|
*/
|
|
2205
2318
|
trackConnectionStarted(...args) {
|
|
2206
2319
|
try {
|
|
2207
|
-
const event = createConnectionStartedEvent(...args);
|
|
2320
|
+
const event = createConnectionStartedEvent(this.version, ...args);
|
|
2208
2321
|
this.dispatchUserActionEvent(event);
|
|
2209
2322
|
}
|
|
2210
2323
|
catch (e) { }
|
|
@@ -2215,7 +2328,7 @@ class TonConnectTracker {
|
|
|
2215
2328
|
*/
|
|
2216
2329
|
trackConnectionCompleted(...args) {
|
|
2217
2330
|
try {
|
|
2218
|
-
const event = createConnectionCompletedEvent(...args);
|
|
2331
|
+
const event = createConnectionCompletedEvent(this.version, ...args);
|
|
2219
2332
|
this.dispatchUserActionEvent(event);
|
|
2220
2333
|
}
|
|
2221
2334
|
catch (e) { }
|
|
@@ -2226,7 +2339,7 @@ class TonConnectTracker {
|
|
|
2226
2339
|
*/
|
|
2227
2340
|
trackConnectionError(...args) {
|
|
2228
2341
|
try {
|
|
2229
|
-
const event = createConnectionErrorEvent(...args);
|
|
2342
|
+
const event = createConnectionErrorEvent(this.version, ...args);
|
|
2230
2343
|
this.dispatchUserActionEvent(event);
|
|
2231
2344
|
}
|
|
2232
2345
|
catch (e) { }
|
|
@@ -2237,7 +2350,7 @@ class TonConnectTracker {
|
|
|
2237
2350
|
*/
|
|
2238
2351
|
trackConnectionRestoringStarted(...args) {
|
|
2239
2352
|
try {
|
|
2240
|
-
const event = createConnectionRestoringStartedEvent(...args);
|
|
2353
|
+
const event = createConnectionRestoringStartedEvent(this.version, ...args);
|
|
2241
2354
|
this.dispatchUserActionEvent(event);
|
|
2242
2355
|
}
|
|
2243
2356
|
catch (e) { }
|
|
@@ -2248,7 +2361,7 @@ class TonConnectTracker {
|
|
|
2248
2361
|
*/
|
|
2249
2362
|
trackConnectionRestoringCompleted(...args) {
|
|
2250
2363
|
try {
|
|
2251
|
-
const event = createConnectionRestoringCompletedEvent(...args);
|
|
2364
|
+
const event = createConnectionRestoringCompletedEvent(this.version, ...args);
|
|
2252
2365
|
this.dispatchUserActionEvent(event);
|
|
2253
2366
|
}
|
|
2254
2367
|
catch (e) { }
|
|
@@ -2259,7 +2372,7 @@ class TonConnectTracker {
|
|
|
2259
2372
|
*/
|
|
2260
2373
|
trackConnectionRestoringError(...args) {
|
|
2261
2374
|
try {
|
|
2262
|
-
const event = createConnectionRestoringErrorEvent(...args);
|
|
2375
|
+
const event = createConnectionRestoringErrorEvent(this.version, ...args);
|
|
2263
2376
|
this.dispatchUserActionEvent(event);
|
|
2264
2377
|
}
|
|
2265
2378
|
catch (e) { }
|
|
@@ -2270,7 +2383,7 @@ class TonConnectTracker {
|
|
|
2270
2383
|
*/
|
|
2271
2384
|
trackDisconnection(...args) {
|
|
2272
2385
|
try {
|
|
2273
|
-
const event = createDisconnectionEvent(...args);
|
|
2386
|
+
const event = createDisconnectionEvent(this.version, ...args);
|
|
2274
2387
|
this.dispatchUserActionEvent(event);
|
|
2275
2388
|
}
|
|
2276
2389
|
catch (e) { }
|
|
@@ -2281,7 +2394,7 @@ class TonConnectTracker {
|
|
|
2281
2394
|
*/
|
|
2282
2395
|
trackTransactionSentForSignature(...args) {
|
|
2283
2396
|
try {
|
|
2284
|
-
const event = createTransactionSentForSignatureEvent(...args);
|
|
2397
|
+
const event = createTransactionSentForSignatureEvent(this.version, ...args);
|
|
2285
2398
|
this.dispatchUserActionEvent(event);
|
|
2286
2399
|
}
|
|
2287
2400
|
catch (e) { }
|
|
@@ -2292,7 +2405,7 @@ class TonConnectTracker {
|
|
|
2292
2405
|
*/
|
|
2293
2406
|
trackTransactionSigned(...args) {
|
|
2294
2407
|
try {
|
|
2295
|
-
const event = createTransactionSignedEvent(...args);
|
|
2408
|
+
const event = createTransactionSignedEvent(this.version, ...args);
|
|
2296
2409
|
this.dispatchUserActionEvent(event);
|
|
2297
2410
|
}
|
|
2298
2411
|
catch (e) { }
|
|
@@ -2303,13 +2416,15 @@ class TonConnectTracker {
|
|
|
2303
2416
|
*/
|
|
2304
2417
|
trackTransactionSigningFailed(...args) {
|
|
2305
2418
|
try {
|
|
2306
|
-
const event = createTransactionSigningFailedEvent(...args);
|
|
2419
|
+
const event = createTransactionSigningFailedEvent(this.version, ...args);
|
|
2307
2420
|
this.dispatchUserActionEvent(event);
|
|
2308
2421
|
}
|
|
2309
2422
|
catch (e) { }
|
|
2310
2423
|
}
|
|
2311
2424
|
}
|
|
2312
2425
|
|
|
2426
|
+
const tonConnectSdkVersion = "3.0.3-beta.1";
|
|
2427
|
+
|
|
2313
2428
|
class TonConnect {
|
|
2314
2429
|
constructor(options) {
|
|
2315
2430
|
this.walletsList = new WalletsListManager();
|
|
@@ -2325,7 +2440,10 @@ class TonConnect {
|
|
|
2325
2440
|
walletsListSource: options === null || options === void 0 ? void 0 : options.walletsListSource,
|
|
2326
2441
|
cacheTTLMs: options === null || options === void 0 ? void 0 : options.walletsListCacheTTLMs
|
|
2327
2442
|
});
|
|
2328
|
-
this.tracker = new TonConnectTracker(
|
|
2443
|
+
this.tracker = new TonConnectTracker({
|
|
2444
|
+
eventDispatcher: options === null || options === void 0 ? void 0 : options.eventDispatcher,
|
|
2445
|
+
tonConnectSdkVersion: tonConnectSdkVersion
|
|
2446
|
+
});
|
|
2329
2447
|
if (!this.dappSettings.manifestUrl) {
|
|
2330
2448
|
throw new DappMetadataError('Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest');
|
|
2331
2449
|
}
|
|
@@ -2598,7 +2716,7 @@ class TonConnect {
|
|
|
2598
2716
|
this.pauseConnection();
|
|
2599
2717
|
}
|
|
2600
2718
|
else {
|
|
2601
|
-
this.unPauseConnection().catch(
|
|
2719
|
+
this.unPauseConnection().catch();
|
|
2602
2720
|
}
|
|
2603
2721
|
});
|
|
2604
2722
|
}
|
|
@@ -2656,10 +2774,10 @@ class TonConnect {
|
|
|
2656
2774
|
onWalletConnectError(connectEventError) {
|
|
2657
2775
|
const error = connectErrorsParser.parseError(connectEventError);
|
|
2658
2776
|
this.statusChangeErrorSubscriptions.forEach(errorsHandler => errorsHandler(error));
|
|
2659
|
-
|
|
2777
|
+
logDebug(error);
|
|
2660
2778
|
this.tracker.trackConnectionError(connectEventError.message, connectEventError.code);
|
|
2661
2779
|
if (error instanceof ManifestNotFoundError || error instanceof ManifestContentErrorError) {
|
|
2662
|
-
|
|
2780
|
+
logError(error);
|
|
2663
2781
|
throw error;
|
|
2664
2782
|
}
|
|
2665
2783
|
}
|
|
@@ -2832,9 +2950,12 @@ exports.createConnectionRestoringErrorEvent = createConnectionRestoringErrorEven
|
|
|
2832
2950
|
exports.createConnectionRestoringStartedEvent = createConnectionRestoringStartedEvent;
|
|
2833
2951
|
exports.createConnectionStartedEvent = createConnectionStartedEvent;
|
|
2834
2952
|
exports.createDisconnectionEvent = createDisconnectionEvent;
|
|
2953
|
+
exports.createRequestVersionEvent = createRequestVersionEvent;
|
|
2954
|
+
exports.createResponseVersionEvent = createResponseVersionEvent;
|
|
2835
2955
|
exports.createTransactionSentForSignatureEvent = createTransactionSentForSignatureEvent;
|
|
2836
2956
|
exports.createTransactionSignedEvent = createTransactionSignedEvent;
|
|
2837
2957
|
exports.createTransactionSigningFailedEvent = createTransactionSigningFailedEvent;
|
|
2958
|
+
exports.createVersionInfo = createVersionInfo;
|
|
2838
2959
|
exports["default"] = TonConnect;
|
|
2839
2960
|
exports.encodeTelegramUrlParameters = encodeTelegramUrlParameters;
|
|
2840
2961
|
exports.isTelegramUrl = isTelegramUrl;
|