@openocean.finance/wallet 0.4.42 → 0.4.43
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/Wallets/TronLink.js +21 -25
- package/package.json +1 -1
package/lib/Wallets/TronLink.js
CHANGED
|
@@ -64,6 +64,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
64
64
|
var tronlink_svg_1 = __importDefault(require("../assets/tronlink.svg"));
|
|
65
65
|
var types_1 = require("../types");
|
|
66
66
|
var BaseWallet_1 = __importDefault(require("./BaseWallet"));
|
|
67
|
+
var helper_1 = require("../helper");
|
|
67
68
|
var TronLink = /** @class */ (function (_super) {
|
|
68
69
|
__extends(TronLink, _super);
|
|
69
70
|
function TronLink() {
|
|
@@ -83,32 +84,27 @@ var TronLink = /** @class */ (function (_super) {
|
|
|
83
84
|
return __awaiter(this, void 0, void 0, function () {
|
|
84
85
|
var _this = this;
|
|
85
86
|
return __generator(this, function (_a) {
|
|
86
|
-
return [2 /*return*/, new Promise(function (res) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
return [2 /*return*/, new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
|
|
88
|
+
var result, account;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0: return [4 /*yield*/, (0, helper_1.autoWalletCheck)(function () {
|
|
92
|
+
return window.tronWeb && window.tronWeb.defaultAddress && window.tronWeb.defaultAddress.base58;
|
|
93
|
+
}, 3000, 30)];
|
|
94
|
+
case 1:
|
|
95
|
+
result = _a.sent();
|
|
96
|
+
if (!result) {
|
|
97
|
+
throw new Error(types_1.EnumErrors.NoTronLink);
|
|
98
|
+
}
|
|
99
|
+
account = window.tronWeb.defaultAddress.base58;
|
|
100
|
+
this.sdk = window.tronWeb;
|
|
101
|
+
this.address = account;
|
|
102
|
+
this.chainId = ''; // todo tron chainId
|
|
101
103
|
res(account);
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
_this.sdk = window.tronWeb;
|
|
107
|
-
_this.address = account;
|
|
108
|
-
_this.chainId = ''; // todo tron chainId
|
|
109
|
-
res(account);
|
|
110
|
-
}
|
|
111
|
-
})];
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); })];
|
|
112
108
|
});
|
|
113
109
|
});
|
|
114
110
|
};
|