@tonconnect/sdk 0.0.38 → 0.0.40
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/errors/wallet/wallet-not-support-feature.error.d.ts +7 -0
- package/lib/errors/wallet/wallet-not-support-feature.error.js +14 -0
- package/lib/provider/bridge/bridge-provider.js +1 -1
- package/lib/ton-connect.d.ts +1 -0
- package/lib/ton-connect.js +10 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TonConnectError } from "../ton-connect.error";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when wallet doesn't support requested feature method.
|
|
4
|
+
*/
|
|
5
|
+
export declare class WalletNotSupportFeatureError extends TonConnectError {
|
|
6
|
+
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WalletNotSupportFeatureError = void 0;
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
/**
|
|
6
|
+
* Thrown when wallet doesn't support requested feature method.
|
|
7
|
+
*/
|
|
8
|
+
class WalletNotSupportFeatureError extends ton_connect_error_1.TonConnectError {
|
|
9
|
+
constructor(...args) {
|
|
10
|
+
super(...args);
|
|
11
|
+
Object.setPrototypeOf(this, WalletNotSupportFeatureError.prototype);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.WalletNotSupportFeatureError = WalletNotSupportFeatureError;
|
|
@@ -159,7 +159,7 @@ class BridgeProvider {
|
|
|
159
159
|
generateUniversalLink(message) {
|
|
160
160
|
const url = new URL(this.walletConnectionSource.universalLink);
|
|
161
161
|
url.searchParams.append('v', protocol.version.toString());
|
|
162
|
-
url.searchParams.append('
|
|
162
|
+
url.searchParams.append('r', JSON.stringify(message));
|
|
163
163
|
url.searchParams.append('r', protocol_1.Base64.encode(JSON.stringify(message), true));
|
|
164
164
|
return url.toString();
|
|
165
165
|
}
|
package/lib/ton-connect.d.ts
CHANGED
package/lib/ton-connect.js
CHANGED
|
@@ -27,6 +27,7 @@ const manifest_not_found_error_1 = require("./errors/protocol/events/connect/man
|
|
|
27
27
|
const ton_connect_error_1 = require("./errors/ton-connect.error");
|
|
28
28
|
const wallet_already_connected_error_1 = require("./errors/wallet/wallet-already-connected.error");
|
|
29
29
|
const wallet_not_connected_error_1 = require("./errors/wallet/wallet-not-connected.error");
|
|
30
|
+
const wallet_not_support_feature_error_1 = require("./errors/wallet/wallet-not-support-feature.error");
|
|
30
31
|
const wallet_connection_source_1 = require("./models/wallet/wallet-connection-source");
|
|
31
32
|
const connect_errors_parser_1 = require("./parsers/connect-errors-parser");
|
|
32
33
|
const send_transaction_parser_1 = require("./parsers/send-transaction-parser");
|
|
@@ -144,8 +145,9 @@ class TonConnect {
|
|
|
144
145
|
*/
|
|
145
146
|
sendTransaction(transaction) {
|
|
146
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const { validUntil } = transaction, tx = __rest(transaction, ["validUntil"]);
|
|
148
148
|
this.checkConnection();
|
|
149
|
+
this.checkFeatureSupport('SendTransaction');
|
|
150
|
+
const { validUntil } = transaction, tx = __rest(transaction, ["validUntil"]);
|
|
149
151
|
const response = yield this.provider.sendRequest(send_transaction_parser_1.sendTransactionParser.convertToRpcRequest(Object.assign(Object.assign({}, tx), { valid_until: validUntil })));
|
|
150
152
|
if (send_transaction_parser_1.sendTransactionParser.isError(response)) {
|
|
151
153
|
return send_transaction_parser_1.sendTransactionParser.parseAndThrowError(response);
|
|
@@ -213,6 +215,7 @@ class TonConnect {
|
|
|
213
215
|
onWalletConnectError(connectEventError) {
|
|
214
216
|
const error = connect_errors_parser_1.connectErrorsParser.parseError(connectEventError);
|
|
215
217
|
this.statusChangeErrorSubscriptions.forEach(errorsHandler => errorsHandler(error));
|
|
218
|
+
console.debug(error);
|
|
216
219
|
if (error instanceof manifest_not_found_error_1.ManifestNotFoundError || error instanceof manifest_content_error_error_1.ManifestContentErrorError) {
|
|
217
220
|
console.error(error);
|
|
218
221
|
throw error;
|
|
@@ -226,6 +229,12 @@ class TonConnect {
|
|
|
226
229
|
throw new wallet_not_connected_error_1.WalletNotConnectedError();
|
|
227
230
|
}
|
|
228
231
|
}
|
|
232
|
+
checkFeatureSupport(feature) {
|
|
233
|
+
var _a;
|
|
234
|
+
if (!((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.device.features.includes(feature))) {
|
|
235
|
+
throw new wallet_not_support_feature_error_1.WalletNotSupportFeatureError();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
229
238
|
createConnectRequest(request) {
|
|
230
239
|
const items = [
|
|
231
240
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npx rimraf lib && ttsc && npx rimraf dist && webpack --mode development",
|
|
6
6
|
"build:production": "npx rimraf lib && ttsc --sourceMap false && npx rimraf dist && webpack --mode production"
|