@tonconnect/sdk 2.0.1 → 2.0.3
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/provider/bridge/bridge-provider.js +2 -0
- package/lib/cjs/ton-connect.js +13 -6
- package/lib/cjs/utils/address.js +4 -0
- package/lib/esm/provider/bridge/bridge-provider.js +2 -0
- package/lib/esm/ton-connect.js +13 -6
- package/lib/esm/utils/address.js +4 -0
- package/lib/types/ton-connect.d.ts +5 -0
- package/lib/types/utils/address.d.ts +4 -0
- package/package.json +2 -2
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/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,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();
|
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;
|
|
@@ -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;
|
|
@@ -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.3",
|
|
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",
|