@tonconnect/sdk 2.0.0 → 2.0.2
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 +5 -0
- package/dist/tonconnect-sdk.min.js +1 -1
- package/dist/tonconnect-sdk.min.js.map +1 -1
- package/lib/cjs/errors/address/wrong-address.error.js +5 -2
- package/lib/cjs/errors/binary/index.js +1 -3
- package/lib/cjs/errors/binary/parse-hex.error.js +5 -2
- package/lib/cjs/provider/bridge/bridge-provider.js +2 -0
- package/lib/cjs/ton-connect.js +13 -6
- package/lib/esm/errors/address/wrong-address.error.js +4 -1
- package/lib/esm/errors/binary/index.js +0 -1
- package/lib/esm/errors/binary/parse-hex.error.js +4 -1
- package/lib/esm/provider/bridge/bridge-provider.js +2 -0
- package/lib/esm/ton-connect.js +13 -6
- package/lib/types/errors/address/wrong-address.error.d.ts +5 -2
- package/lib/types/errors/binary/index.d.ts +0 -1
- package/lib/types/errors/binary/parse-hex.error.d.ts +5 -2
- package/lib/types/ton-connect.d.ts +5 -0
- package/package.json +1 -1
- package/lib/cjs/errors/binary/base64-encode.error.js +0 -11
- package/lib/esm/errors/binary/base64-encode.error.js +0 -7
- package/lib/types/errors/binary/base64-encode.error.d.ts +0 -4
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WrongAddressError = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
/**
|
|
6
|
+
* Thrown when passed address is in incorrect format.
|
|
7
|
+
*/
|
|
8
|
+
class WrongAddressError extends ton_connect_error_1.TonConnectError {
|
|
6
9
|
constructor(...args) {
|
|
7
10
|
super(...args);
|
|
8
11
|
Object.setPrototypeOf(this, WrongAddressError.prototype);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParseHexError =
|
|
4
|
-
var base64_encode_error_1 = require("./base64-encode.error");
|
|
5
|
-
Object.defineProperty(exports, "Base64EncodeError", { enumerable: true, get: function () { return base64_encode_error_1.Base64EncodeError; } });
|
|
3
|
+
exports.ParseHexError = void 0;
|
|
6
4
|
var parse_hex_error_1 = require("./parse-hex.error");
|
|
7
5
|
Object.defineProperty(exports, "ParseHexError", { enumerable: true, get: function () { return parse_hex_error_1.ParseHexError; } });
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ParseHexError = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
/**
|
|
6
|
+
* Thrown when passed hex is in incorrect format.
|
|
7
|
+
*/
|
|
8
|
+
class ParseHexError extends ton_connect_error_1.TonConnectError {
|
|
6
9
|
constructor(...args) {
|
|
7
10
|
super(...args);
|
|
8
11
|
Object.setPrototypeOf(this, ParseHexError.prototype);
|
package/lib/cjs/ton-connect.js
CHANGED
|
@@ -19,6 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
}
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
+
var _a;
|
|
22
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
24
|
exports.TonConnect = void 0;
|
|
24
25
|
const dapp_metadata_error_1 = require("./errors/dapp/dapp-metadata.error");
|
|
@@ -63,8 +64,8 @@ class TonConnect {
|
|
|
63
64
|
* Current connected account or null if no account is connected.
|
|
64
65
|
*/
|
|
65
66
|
get account() {
|
|
66
|
-
var
|
|
67
|
-
return ((
|
|
67
|
+
var _b;
|
|
68
|
+
return ((_b = this._wallet) === null || _b === void 0 ? void 0 : _b.account) || null;
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
71
|
* Current connected wallet or null if no account is connected.
|
|
@@ -101,11 +102,11 @@ class TonConnect {
|
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
connect(wallet, request) {
|
|
104
|
-
var
|
|
105
|
+
var _b;
|
|
105
106
|
if (this.connected) {
|
|
106
107
|
throw new wallet_already_connected_error_1.WalletAlreadyConnectedError();
|
|
107
108
|
}
|
|
108
|
-
(
|
|
109
|
+
(_b = this.provider) === null || _b === void 0 ? void 0 : _b.closeConnection();
|
|
109
110
|
this.provider = this.createProvider(wallet);
|
|
110
111
|
return this.provider.connect(this.createConnectRequest(request));
|
|
111
112
|
}
|
|
@@ -230,8 +231,8 @@ class TonConnect {
|
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
checkFeatureSupport(feature) {
|
|
233
|
-
var
|
|
234
|
-
if (!((
|
|
234
|
+
var _b;
|
|
235
|
+
if (!((_b = this.wallet) === null || _b === void 0 ? void 0 : _b.device.features.includes(feature))) {
|
|
235
236
|
throw new wallet_not_support_feature_error_1.WalletNotSupportFeatureError();
|
|
236
237
|
}
|
|
237
238
|
}
|
|
@@ -254,3 +255,9 @@ class TonConnect {
|
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
257
|
exports.TonConnect = TonConnect;
|
|
258
|
+
_a = TonConnect;
|
|
259
|
+
TonConnect.walletsList = new wallets_list_manager_1.WalletsListManager();
|
|
260
|
+
/**
|
|
261
|
+
* Returns available wallets list.
|
|
262
|
+
*/
|
|
263
|
+
TonConnect.getWallets = _a.walletsList.getWallets();
|
package/lib/esm/ton-connect.js
CHANGED
|
@@ -18,6 +18,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
+
var _a;
|
|
21
22
|
import { DappMetadataError } from "./errors/dapp/dapp-metadata.error";
|
|
22
23
|
import { ManifestContentErrorError } from "./errors/protocol/events/connect/manifest-content-error.error";
|
|
23
24
|
import { ManifestNotFoundError } from "./errors/protocol/events/connect/manifest-not-found.error";
|
|
@@ -60,8 +61,8 @@ export class TonConnect {
|
|
|
60
61
|
* Current connected account or null if no account is connected.
|
|
61
62
|
*/
|
|
62
63
|
get account() {
|
|
63
|
-
var
|
|
64
|
-
return ((
|
|
64
|
+
var _b;
|
|
65
|
+
return ((_b = this._wallet) === null || _b === void 0 ? void 0 : _b.account) || null;
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* Current connected wallet or null if no account is connected.
|
|
@@ -98,11 +99,11 @@ export class TonConnect {
|
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
connect(wallet, request) {
|
|
101
|
-
var
|
|
102
|
+
var _b;
|
|
102
103
|
if (this.connected) {
|
|
103
104
|
throw new WalletAlreadyConnectedError();
|
|
104
105
|
}
|
|
105
|
-
(
|
|
106
|
+
(_b = this.provider) === null || _b === void 0 ? void 0 : _b.closeConnection();
|
|
106
107
|
this.provider = this.createProvider(wallet);
|
|
107
108
|
return this.provider.connect(this.createConnectRequest(request));
|
|
108
109
|
}
|
|
@@ -227,8 +228,8 @@ export class TonConnect {
|
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
checkFeatureSupport(feature) {
|
|
230
|
-
var
|
|
231
|
-
if (!((
|
|
231
|
+
var _b;
|
|
232
|
+
if (!((_b = this.wallet) === null || _b === void 0 ? void 0 : _b.device.features.includes(feature))) {
|
|
232
233
|
throw new WalletNotSupportFeatureError();
|
|
233
234
|
}
|
|
234
235
|
}
|
|
@@ -250,3 +251,9 @@ export class TonConnect {
|
|
|
250
251
|
};
|
|
251
252
|
}
|
|
252
253
|
}
|
|
254
|
+
_a = TonConnect;
|
|
255
|
+
TonConnect.walletsList = new WalletsListManager();
|
|
256
|
+
/**
|
|
257
|
+
* Returns available wallets list.
|
|
258
|
+
*/
|
|
259
|
+
TonConnect.getWallets = _a.walletsList.getWallets();
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { TonConnectError } from "
|
|
1
|
+
import { TonConnectError } from "../ton-connect.error";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when passed address is in incorrect format.
|
|
4
|
+
*/
|
|
2
5
|
export declare class WrongAddressError extends TonConnectError {
|
|
3
|
-
constructor(...args: ConstructorParameters<typeof
|
|
6
|
+
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
4
7
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { TonConnectError } from "
|
|
1
|
+
import { TonConnectError } from "../ton-connect.error";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when passed hex is in incorrect format.
|
|
4
|
+
*/
|
|
2
5
|
export declare class ParseHexError extends TonConnectError {
|
|
3
|
-
constructor(...args: ConstructorParameters<typeof
|
|
6
|
+
constructor(...args: ConstructorParameters<typeof TonConnectError>);
|
|
4
7
|
}
|
|
@@ -6,6 +6,11 @@ import { TonConnectOptions } from "./models/ton-connect-options";
|
|
|
6
6
|
import { WalletConnectionSourceJS } from "./models/wallet/wallet-connection-source";
|
|
7
7
|
import { ITonConnect } from "./ton-connect.interface";
|
|
8
8
|
export declare class TonConnect implements ITonConnect {
|
|
9
|
+
private static readonly walletsList;
|
|
10
|
+
/**
|
|
11
|
+
* Returns available wallets list.
|
|
12
|
+
*/
|
|
13
|
+
static getWallets: Promise<WalletInfo[]>;
|
|
9
14
|
private readonly walletsList;
|
|
10
15
|
private readonly dappSettings;
|
|
11
16
|
private readonly bridgeConnectionStorage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npx rimraf lib && ttsc --outDir ./lib/cjs && ttsc --module esnext --outDir ./lib/esm && npx rimraf dist && webpack --mode development",
|
|
6
6
|
"build:production": "npx rimraf lib && ttsc --project tsconfig.cjs.json --sourceMap false && ttsc --project tsconfig.esm.json --sourceMap false && npx rimraf dist && webpack --mode production"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Base64EncodeError = void 0;
|
|
4
|
-
const errors_1 = require("..");
|
|
5
|
-
class Base64EncodeError extends errors_1.TonConnectError {
|
|
6
|
-
constructor(...args) {
|
|
7
|
-
super(...args);
|
|
8
|
-
Object.setPrototypeOf(this, Base64EncodeError.prototype);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.Base64EncodeError = Base64EncodeError;
|