@tonconnect/sdk 0.0.21 → 0.0.23
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/lib/errors/dapp/dapp-metadata.error.js +6 -14
- package/lib/errors/index.js +18 -5
- package/lib/errors/protocol/events/connect/user-rejects.error.js +6 -14
- package/lib/errors/protocol/events/index.js +15 -2
- package/lib/errors/protocol/index.js +16 -3
- package/lib/errors/protocol/responses/bad-request.error.js +6 -14
- package/lib/errors/protocol/responses/unknown-app.error.js +6 -14
- package/lib/errors/storage/localstorage-not-found.error.js +6 -14
- package/lib/errors/ton-connect.error.js +5 -13
- package/lib/errors/unknown.error.js +6 -14
- package/lib/errors/wallet/wallet-already-connected.error.js +6 -14
- package/lib/errors/wallet/wallet-not-connected.error.js +6 -14
- package/lib/errors/wallet/wallet-not-injected.error.js +6 -14
- package/lib/errors/wallets-manager/fetch-wallets.error.js +6 -14
- package/lib/index.js +17 -4
- package/lib/models/index.js +16 -3
- package/lib/models/methods/index.js +16 -3
- package/lib/parsers/connect-errors-parser.js +14 -18
- package/lib/parsers/rpc-parser.js +4 -7
- package/lib/parsers/send-transaction-parser.js +19 -26
- package/lib/provider/bridge/bridge-gateway.js +71 -79
- package/lib/provider/bridge/bridge-provider.js +118 -138
- package/lib/provider/injected/injected-provider.js +95 -90
- package/lib/storage/bridge-connection-storage.js +86 -112
- package/lib/storage/default-storage.d.ts +1 -0
- package/lib/storage/default-storage.js +28 -22
- package/lib/storage/http-bridge-gateway-storage.js +28 -32
- package/lib/ton-connect.js +123 -165
- package/lib/utils/options.js +5 -5
- package/lib/utils/web-api.d.ts +3 -0
- package/lib/utils/web-api.js +36 -13
- package/lib/wallets-list-manager.js +59 -73
- package/package.json +4 -2
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DappMetadataError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
class DappMetadataError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, DappMetadataError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.DappMetadataError = DappMetadataError;
|
package/lib/errors/index.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.UnknownError = exports.TonConnectError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
tslib_1.__exportStar(require("./wallets-manager"), exports);
|
|
18
|
+
__exportStar(require("./protocol"), exports);
|
|
19
|
+
__exportStar(require("./wallet"), exports);
|
|
20
|
+
__exportStar(require("./storage"), exports);
|
|
21
|
+
__exportStar(require("./wallets-manager"), exports);
|
|
9
22
|
var ton_connect_error_1 = require("./ton-connect.error");
|
|
10
23
|
Object.defineProperty(exports, "TonConnectError", { enumerable: true, get: function () { return ton_connect_error_1.TonConnectError; } });
|
|
11
24
|
var unknown_error_1 = require("./unknown.error");
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserRejectsError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, UserRejectsError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../../../ton-connect.error");
|
|
5
|
+
class UserRejectsError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, UserRejectsError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.UserRejectsError = UserRejectsError;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./connect"), exports);
|
|
17
|
+
__exportStar(require("./connect"), exports);
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tslib_1.__exportStar(require("./responses"), exports);
|
|
17
|
+
__exportStar(require("./events"), exports);
|
|
18
|
+
__exportStar(require("./responses"), exports);
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BadRequestError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, BadRequestError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../../ton-connect.error");
|
|
5
|
+
class BadRequestError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, BadRequestError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.BadRequestError = BadRequestError;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnknownAppError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, UnknownAppError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../../ton-connect.error");
|
|
5
|
+
class UnknownAppError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, UnknownAppError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.UnknownAppError = UnknownAppError;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalstorageNotFoundError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, LocalstorageNotFoundError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
class LocalstorageNotFoundError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, LocalstorageNotFoundError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.LocalstorageNotFoundError = LocalstorageNotFoundError;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TonConnectError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var args = [];
|
|
9
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10
|
-
args[_i] = arguments[_i];
|
|
11
|
-
}
|
|
12
|
-
var _this = _super.apply(this, args) || this;
|
|
13
|
-
Object.setPrototypeOf(_this, TonConnectError.prototype);
|
|
14
|
-
return _this;
|
|
4
|
+
class TonConnectError extends Error {
|
|
5
|
+
constructor(...args) {
|
|
6
|
+
super(...args);
|
|
7
|
+
Object.setPrototypeOf(this, TonConnectError.prototype);
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
}(Error));
|
|
9
|
+
}
|
|
18
10
|
exports.TonConnectError = TonConnectError;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnknownError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, UnknownError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("./ton-connect.error");
|
|
5
|
+
class UnknownError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, UnknownError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.UnknownError = UnknownError;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WalletAlreadyConnectedError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, WalletAlreadyConnectedError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
class WalletAlreadyConnectedError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, WalletAlreadyConnectedError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.WalletAlreadyConnectedError = WalletAlreadyConnectedError;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WalletNotConnectedError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, WalletNotConnectedError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
class WalletNotConnectedError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, WalletNotConnectedError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.WalletNotConnectedError = WalletNotConnectedError;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WalletNotInjectedError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, WalletNotInjectedError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
class WalletNotInjectedError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, WalletNotInjectedError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.WalletNotInjectedError = WalletNotInjectedError;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FetchWalletsError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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, FetchWalletsError.prototype);
|
|
15
|
-
return _this;
|
|
4
|
+
const ton_connect_error_1 = require("../ton-connect.error");
|
|
5
|
+
class FetchWalletsError extends ton_connect_error_1.TonConnectError {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
Object.setPrototypeOf(this, FetchWalletsError.prototype);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(ton_connect_error_1.TonConnectError));
|
|
10
|
+
}
|
|
19
11
|
exports.FetchWalletsError = FetchWalletsError;
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.CHAIN = exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
tslib_1.__exportStar(require("./errors"), exports);
|
|
18
|
+
__exportStar(require("./ton-connect"), exports);
|
|
19
|
+
__exportStar(require("./models"), exports);
|
|
20
|
+
__exportStar(require("./errors"), exports);
|
|
8
21
|
var ton_connect_1 = require("./ton-connect");
|
|
9
22
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return ton_connect_1.TonConnect; } });
|
|
10
23
|
var protocol_1 = require("@tonconnect/protocol");
|
package/lib/models/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tslib_1.__exportStar(require("./methods"), exports);
|
|
17
|
+
__exportStar(require("./wallet"), exports);
|
|
18
|
+
__exportStar(require("./methods"), exports);
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tslib_1.__exportStar(require("./send-transaction"), exports);
|
|
17
|
+
__exportStar(require("./connect"), exports);
|
|
18
|
+
__exportStar(require("./send-transaction"), exports);
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.connectErrorsParser = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
ConnectErrorsParser.prototype.parseError = function (error) {
|
|
18
|
-
var ErrorConstructor = unknown_error_1.UnknownError;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const unknown_error_1 = require("../errors/unknown.error");
|
|
6
|
+
const protocol_1 = require("@tonconnect/protocol");
|
|
7
|
+
const connectEventErrorsCodes = {
|
|
8
|
+
[protocol_1.CONNECT_EVENT_ERROR_CODES.UNKNOWN_ERROR]: unknown_error_1.UnknownError,
|
|
9
|
+
[protocol_1.CONNECT_EVENT_ERROR_CODES.USER_REJECTS_ERROR]: errors_1.UserRejectsError,
|
|
10
|
+
[protocol_1.CONNECT_EVENT_ERROR_CODES.BAD_REQUEST_ERROR]: errors_1.BadRequestError,
|
|
11
|
+
[protocol_1.CONNECT_EVENT_ERROR_CODES.UNKNOWN_APP_ERROR]: errors_1.UnknownAppError
|
|
12
|
+
};
|
|
13
|
+
class ConnectErrorsParser {
|
|
14
|
+
parseError(error) {
|
|
15
|
+
let ErrorConstructor = unknown_error_1.UnknownError;
|
|
19
16
|
if (error.code in connectEventErrorsCodes) {
|
|
20
17
|
ErrorConstructor = connectEventErrorsCodes[error.code] || unknown_error_1.UnknownError;
|
|
21
18
|
}
|
|
22
19
|
return new ErrorConstructor(error.message);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
26
22
|
exports.connectErrorsParser = new ConnectErrorsParser();
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RpcParser = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
RpcParser.prototype.isError = function (response) {
|
|
4
|
+
class RpcParser {
|
|
5
|
+
isError(response) {
|
|
8
6
|
return 'error' in response;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
}());
|
|
7
|
+
}
|
|
8
|
+
}
|
|
12
9
|
exports.RpcParser = RpcParser;
|
|
@@ -1,41 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.sendTransactionParser = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
tslib_1.__extends(SendTransactionParser, _super);
|
|
18
|
-
function SendTransactionParser() {
|
|
19
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
20
|
-
}
|
|
21
|
-
SendTransactionParser.prototype.convertToRpcRequest = function (request) {
|
|
4
|
+
const protocol_1 = require("@tonconnect/protocol");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const unknown_error_1 = require("../errors/unknown.error");
|
|
7
|
+
const rpc_parser_1 = require("./rpc-parser");
|
|
8
|
+
const sendTransactionErrors = {
|
|
9
|
+
[protocol_1.SEND_TRANSACTION_ERROR_CODES.UNKNOWN_ERROR]: unknown_error_1.UnknownError,
|
|
10
|
+
[protocol_1.SEND_TRANSACTION_ERROR_CODES.USER_REJECTS_ERROR]: errors_1.UserRejectsError,
|
|
11
|
+
[protocol_1.SEND_TRANSACTION_ERROR_CODES.BAD_REQUEST_ERROR]: errors_1.BadRequestError,
|
|
12
|
+
[protocol_1.SEND_TRANSACTION_ERROR_CODES.UNKNOWN_APP_ERROR]: errors_1.UnknownAppError
|
|
13
|
+
};
|
|
14
|
+
class SendTransactionParser extends rpc_parser_1.RpcParser {
|
|
15
|
+
convertToRpcRequest(request) {
|
|
22
16
|
return {
|
|
23
17
|
method: 'sendTransaction',
|
|
24
18
|
params: [JSON.stringify(request)]
|
|
25
19
|
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
}
|
|
21
|
+
parseAndThrowError(response) {
|
|
22
|
+
let ErrorConstructor = unknown_error_1.UnknownError;
|
|
29
23
|
if (response.error.code in sendTransactionErrors) {
|
|
30
24
|
ErrorConstructor = sendTransactionErrors[response.error.code] || unknown_error_1.UnknownError;
|
|
31
25
|
}
|
|
32
26
|
throw new ErrorConstructor(response.error.message);
|
|
33
|
-
}
|
|
34
|
-
|
|
27
|
+
}
|
|
28
|
+
convertFromRpcResponse(rpcResponse) {
|
|
35
29
|
return {
|
|
36
30
|
boc: rpcResponse.result
|
|
37
31
|
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}(rpc_parser_1.RpcParser));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
41
34
|
exports.sendTransactionParser = new SendTransactionParser();
|