@tonconnect/sdk 0.0.18 → 0.0.20
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 +1 -1
- package/lib/errors/dapp/dapp-metadata.error.d.ts +4 -0
- package/lib/errors/dapp/dapp-metadata.error.js +19 -0
- package/lib/provider/bridge/bridge-provider.d.ts +0 -1
- package/lib/provider/bridge/bridge-provider.js +0 -1
- package/lib/provider/provider.d.ts +1 -2
- package/lib/ton-connect.js +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ const walletConnectionSource = {
|
|
|
59
59
|
bridgeURL: 'https://bridge.mycooltonwallet.com,'
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const
|
|
62
|
+
const universalLink = connector.connect(walletConnectionSource);
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
Then you have to show this link to user as QR code, or use it as a deeplink. You will receive an update in `connector.onStatusChange` when user approves connection in the wallet
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DappMetadataError = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var ton_connect_error_1 = require("../ton-connect.error");
|
|
6
|
+
var DappMetadataError = /** @class */ (function (_super) {
|
|
7
|
+
tslib_1.__extends(DappMetadataError, _super);
|
|
8
|
+
function DappMetadataError() {
|
|
9
|
+
var args = [];
|
|
10
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
|
+
args[_i] = arguments[_i];
|
|
12
|
+
}
|
|
13
|
+
var _this = _super.apply(this, args) || this;
|
|
14
|
+
Object.setPrototypeOf(_this, DappMetadataError.prototype);
|
|
15
|
+
return _this;
|
|
16
|
+
}
|
|
17
|
+
return DappMetadataError;
|
|
18
|
+
}(ton_connect_error_1.TonConnectError));
|
|
19
|
+
exports.DappMetadataError = DappMetadataError;
|
|
@@ -8,7 +8,6 @@ export declare class BridgeProvider implements HTTPProvider {
|
|
|
8
8
|
private readonly walletConnectionSource;
|
|
9
9
|
static fromStorage(storage: IStorage): Promise<BridgeProvider>;
|
|
10
10
|
readonly type = "http";
|
|
11
|
-
private readonly universalLinkPath;
|
|
12
11
|
private readonly connectionStorage;
|
|
13
12
|
private readonly pendingRequests;
|
|
14
13
|
private nextRequestId;
|
|
@@ -12,7 +12,6 @@ var BridgeProvider = /** @class */ (function () {
|
|
|
12
12
|
this.storage = storage;
|
|
13
13
|
this.walletConnectionSource = walletConnectionSource;
|
|
14
14
|
this.type = 'http';
|
|
15
|
-
this.universalLinkPath = 'ton-connect';
|
|
16
15
|
this.pendingRequests = new Map();
|
|
17
16
|
this.nextRequestId = 0;
|
|
18
17
|
this.session = null;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AppRequest, ConnectRequest, RpcMethod, WalletEvent, WalletResponse } from '@tonconnect/protocol';
|
|
2
|
-
import { InjectedProvider } from "./injected/injected-provider";
|
|
3
2
|
import { WithoutId } from "../utils/types";
|
|
4
|
-
export declare type Provider =
|
|
3
|
+
export declare type Provider = InternalProvider | HTTPProvider;
|
|
5
4
|
export interface InternalProvider extends BaseProvider {
|
|
6
5
|
type: 'injected';
|
|
7
6
|
connect(message: ConnectRequest): void;
|
package/lib/ton-connect.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TonConnect = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
var dapp_metadata_error_1 = require("./errors/dapp/dapp-metadata.error");
|
|
5
6
|
var ton_connect_error_1 = require("./errors/ton-connect.error");
|
|
6
7
|
var wallet_already_connected_error_1 = require("./errors/wallet/wallet-already-connected.error");
|
|
7
8
|
var wallet_not_connected_error_1 = require("./errors/wallet/wallet-not-connected.error");
|
|
@@ -26,6 +27,9 @@ var TonConnect = /** @class */ (function () {
|
|
|
26
27
|
metadata: (0, options_1.mergeOptions)(options === null || options === void 0 ? void 0 : options.dappMetedata, (0, web_api_1.getWebPageMetadata)()),
|
|
27
28
|
storage: (options === null || options === void 0 ? void 0 : options.storage) || new default_storage_1.DefaultStorage()
|
|
28
29
|
};
|
|
30
|
+
if (this.dappSettings.metadata.url) {
|
|
31
|
+
throw new dapp_metadata_error_1.DappMetadataError('Dapp url must be specified if window.location.origin is undefined.');
|
|
32
|
+
}
|
|
29
33
|
this.bridgeConnectionStorage = new bridge_connection_storage_1.BridgeConnectionStorage(this.dappSettings.storage);
|
|
30
34
|
}
|
|
31
35
|
Object.defineProperty(TonConnect.prototype, "connected", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonconnect/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npx rimraf lib && ttsc",
|
|
6
6
|
"build:production": "npx rimraf lib && ttsc --sourceMap false"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"deepmerge": "^4.2.2",
|
|
28
28
|
"tweetnacl": "^1.0.3",
|
|
29
|
-
"@tonconnect/protocol": "^0.0.
|
|
29
|
+
"@tonconnect/protocol": "^0.0.10"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"lib"
|