@tonconnect/sdk 2.0.2 → 2.0.4
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 +6 -4
- package/dist/tonconnect-sdk.min.js +1 -1
- package/dist/tonconnect-sdk.min.js.map +1 -1
- package/lib/cjs/ton-connect.js +12 -12
- package/lib/cjs/utils/address.js +4 -0
- package/lib/esm/ton-connect.js +12 -12
- package/lib/esm/utils/address.js +4 -0
- package/lib/types/ton-connect.d.ts +1 -1
- package/lib/types/utils/address.d.ts +4 -0
- package/package.json +2 -2
package/lib/cjs/ton-connect.js
CHANGED
|
@@ -19,7 +19,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
}
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
-
var _a;
|
|
23
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
23
|
exports.TonConnect = void 0;
|
|
25
24
|
const dapp_metadata_error_1 = require("./errors/dapp/dapp-metadata.error");
|
|
@@ -54,6 +53,12 @@ class TonConnect {
|
|
|
54
53
|
}
|
|
55
54
|
this.bridgeConnectionStorage = new bridge_connection_storage_1.BridgeConnectionStorage(this.dappSettings.storage);
|
|
56
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns available wallets list.
|
|
58
|
+
*/
|
|
59
|
+
static getWallets() {
|
|
60
|
+
return this.walletsList.getWallets();
|
|
61
|
+
}
|
|
57
62
|
/**
|
|
58
63
|
* Shows if the wallet is connected right now.
|
|
59
64
|
*/
|
|
@@ -64,8 +69,8 @@ class TonConnect {
|
|
|
64
69
|
* Current connected account or null if no account is connected.
|
|
65
70
|
*/
|
|
66
71
|
get account() {
|
|
67
|
-
var
|
|
68
|
-
return ((
|
|
72
|
+
var _a;
|
|
73
|
+
return ((_a = this._wallet) === null || _a === void 0 ? void 0 : _a.account) || null;
|
|
69
74
|
}
|
|
70
75
|
/**
|
|
71
76
|
* Current connected wallet or null if no account is connected.
|
|
@@ -102,11 +107,11 @@ class TonConnect {
|
|
|
102
107
|
};
|
|
103
108
|
}
|
|
104
109
|
connect(wallet, request) {
|
|
105
|
-
var
|
|
110
|
+
var _a;
|
|
106
111
|
if (this.connected) {
|
|
107
112
|
throw new wallet_already_connected_error_1.WalletAlreadyConnectedError();
|
|
108
113
|
}
|
|
109
|
-
(
|
|
114
|
+
(_a = this.provider) === null || _a === void 0 ? void 0 : _a.closeConnection();
|
|
110
115
|
this.provider = this.createProvider(wallet);
|
|
111
116
|
return this.provider.connect(this.createConnectRequest(request));
|
|
112
117
|
}
|
|
@@ -231,8 +236,8 @@ class TonConnect {
|
|
|
231
236
|
}
|
|
232
237
|
}
|
|
233
238
|
checkFeatureSupport(feature) {
|
|
234
|
-
var
|
|
235
|
-
if (!((
|
|
239
|
+
var _a;
|
|
240
|
+
if (!((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.device.features.includes(feature))) {
|
|
236
241
|
throw new wallet_not_support_feature_error_1.WalletNotSupportFeatureError();
|
|
237
242
|
}
|
|
238
243
|
}
|
|
@@ -255,9 +260,4 @@ class TonConnect {
|
|
|
255
260
|
}
|
|
256
261
|
}
|
|
257
262
|
exports.TonConnect = TonConnect;
|
|
258
|
-
_a = TonConnect;
|
|
259
263
|
TonConnect.walletsList = new wallets_list_manager_1.WalletsListManager();
|
|
260
|
-
/**
|
|
261
|
-
* Returns available wallets list.
|
|
262
|
-
*/
|
|
263
|
-
TonConnect.getWallets = _a.walletsList.getWallets();
|
package/lib/cjs/utils/address.js
CHANGED
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toUserFriendlyAddress = void 0;
|
|
4
4
|
const errors_1 = require("../errors");
|
|
5
5
|
const protocol_1 = require("@tonconnect/protocol");
|
|
6
|
+
/**
|
|
7
|
+
* Converts raw TON address to bounceable user-friendly format. [See details]{@link https://ton.org/docs/learn/overviews/addresses}
|
|
8
|
+
* @param hexAddress raw TON address formatted as "0:<hex string without 0x>".
|
|
9
|
+
*/
|
|
6
10
|
function toUserFriendlyAddress(hexAddress) {
|
|
7
11
|
const { wc, hex } = parseHexAddress(hexAddress);
|
|
8
12
|
const bounceableTag = 0x11;
|
package/lib/esm/ton-connect.js
CHANGED
|
@@ -18,7 +18,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
-
var _a;
|
|
22
21
|
import { DappMetadataError } from "./errors/dapp/dapp-metadata.error";
|
|
23
22
|
import { ManifestContentErrorError } from "./errors/protocol/events/connect/manifest-content-error.error";
|
|
24
23
|
import { ManifestNotFoundError } from "./errors/protocol/events/connect/manifest-not-found.error";
|
|
@@ -51,6 +50,12 @@ export class TonConnect {
|
|
|
51
50
|
}
|
|
52
51
|
this.bridgeConnectionStorage = new BridgeConnectionStorage(this.dappSettings.storage);
|
|
53
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns available wallets list.
|
|
55
|
+
*/
|
|
56
|
+
static getWallets() {
|
|
57
|
+
return this.walletsList.getWallets();
|
|
58
|
+
}
|
|
54
59
|
/**
|
|
55
60
|
* Shows if the wallet is connected right now.
|
|
56
61
|
*/
|
|
@@ -61,8 +66,8 @@ export class TonConnect {
|
|
|
61
66
|
* Current connected account or null if no account is connected.
|
|
62
67
|
*/
|
|
63
68
|
get account() {
|
|
64
|
-
var
|
|
65
|
-
return ((
|
|
69
|
+
var _a;
|
|
70
|
+
return ((_a = this._wallet) === null || _a === void 0 ? void 0 : _a.account) || null;
|
|
66
71
|
}
|
|
67
72
|
/**
|
|
68
73
|
* Current connected wallet or null if no account is connected.
|
|
@@ -99,11 +104,11 @@ export class TonConnect {
|
|
|
99
104
|
};
|
|
100
105
|
}
|
|
101
106
|
connect(wallet, request) {
|
|
102
|
-
var
|
|
107
|
+
var _a;
|
|
103
108
|
if (this.connected) {
|
|
104
109
|
throw new WalletAlreadyConnectedError();
|
|
105
110
|
}
|
|
106
|
-
(
|
|
111
|
+
(_a = this.provider) === null || _a === void 0 ? void 0 : _a.closeConnection();
|
|
107
112
|
this.provider = this.createProvider(wallet);
|
|
108
113
|
return this.provider.connect(this.createConnectRequest(request));
|
|
109
114
|
}
|
|
@@ -228,8 +233,8 @@ export class TonConnect {
|
|
|
228
233
|
}
|
|
229
234
|
}
|
|
230
235
|
checkFeatureSupport(feature) {
|
|
231
|
-
var
|
|
232
|
-
if (!((
|
|
236
|
+
var _a;
|
|
237
|
+
if (!((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.device.features.includes(feature))) {
|
|
233
238
|
throw new WalletNotSupportFeatureError();
|
|
234
239
|
}
|
|
235
240
|
}
|
|
@@ -251,9 +256,4 @@ export class TonConnect {
|
|
|
251
256
|
};
|
|
252
257
|
}
|
|
253
258
|
}
|
|
254
|
-
_a = TonConnect;
|
|
255
259
|
TonConnect.walletsList = new WalletsListManager();
|
|
256
|
-
/**
|
|
257
|
-
* Returns available wallets list.
|
|
258
|
-
*/
|
|
259
|
-
TonConnect.getWallets = _a.walletsList.getWallets();
|
package/lib/esm/utils/address.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { WrongAddressError, ParseHexError } from "../errors";
|
|
2
2
|
import { Base64 } from '@tonconnect/protocol';
|
|
3
|
+
/**
|
|
4
|
+
* Converts raw TON address to bounceable user-friendly format. [See details]{@link https://ton.org/docs/learn/overviews/addresses}
|
|
5
|
+
* @param hexAddress raw TON address formatted as "0:<hex string without 0x>".
|
|
6
|
+
*/
|
|
3
7
|
export function toUserFriendlyAddress(hexAddress) {
|
|
4
8
|
const { wc, hex } = parseHexAddress(hexAddress);
|
|
5
9
|
const bounceableTag = 0x11;
|
|
@@ -10,7 +10,7 @@ export declare class TonConnect implements ITonConnect {
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns available wallets list.
|
|
12
12
|
*/
|
|
13
|
-
static getWallets: Promise<WalletInfo[]>;
|
|
13
|
+
static getWallets(): Promise<WalletInfo[]>;
|
|
14
14
|
private readonly walletsList;
|
|
15
15
|
private readonly dappSettings;
|
|
16
16
|
private readonly bridgeConnectionStorage;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts raw TON address to bounceable user-friendly format. [See details]{@link https://ton.org/docs/learn/overviews/addresses}
|
|
3
|
+
* @param hexAddress raw TON address formatted as "0:<hex string without 0x>".
|
|
4
|
+
*/
|
|
1
5
|
export declare function toUserFriendlyAddress(hexAddress: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"tweetnacl": "^1.0.3",
|
|
29
29
|
"eventsource": "^2.0.2",
|
|
30
30
|
"node-fetch": "^2.6.7",
|
|
31
|
-
"@tonconnect/protocol": "^2.0.
|
|
31
|
+
"@tonconnect/protocol": "^2.0.1"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"lib",
|