@tonconnect/sdk 2.0.1 → 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.
@@ -76,6 +76,8 @@ class BridgeProvider {
76
76
  var _a;
77
77
  (_a = this.bridge) === null || _a === void 0 ? void 0 : _a.close();
78
78
  this.listeners = [];
79
+ this.session = null;
80
+ this.bridge = null;
79
81
  }
80
82
  disconnect() {
81
83
  var _a;
@@ -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 _a;
67
- return ((_a = this._wallet) === null || _a === void 0 ? void 0 : _a.account) || null;
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 _a;
105
+ var _b;
105
106
  if (this.connected) {
106
107
  throw new wallet_already_connected_error_1.WalletAlreadyConnectedError();
107
108
  }
108
- (_a = this.provider) === null || _a === void 0 ? void 0 : _a.closeConnection();
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 _a;
234
- if (!((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.device.features.includes(feature))) {
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();
@@ -73,6 +73,8 @@ export class BridgeProvider {
73
73
  var _a;
74
74
  (_a = this.bridge) === null || _a === void 0 ? void 0 : _a.close();
75
75
  this.listeners = [];
76
+ this.session = null;
77
+ this.bridge = null;
76
78
  }
77
79
  disconnect() {
78
80
  var _a;
@@ -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 _a;
64
- return ((_a = this._wallet) === null || _a === void 0 ? void 0 : _a.account) || null;
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 _a;
102
+ var _b;
102
103
  if (this.connected) {
103
104
  throw new WalletAlreadyConnectedError();
104
105
  }
105
- (_a = this.provider) === null || _a === void 0 ? void 0 : _a.closeConnection();
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 _a;
231
- if (!((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.device.features.includes(feature))) {
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();
@@ -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.1",
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"