@openocean.finance/wallet 0.4.43 → 0.4.44
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 +15 -4
- package/package.json +1 -1
package/lib/Wallets/TronLink.js
CHANGED
|
@@ -85,19 +85,30 @@ var TronLink = /** @class */ (function (_super) {
|
|
|
85
85
|
var _this = this;
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
return [2 /*return*/, new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
|
|
88
|
-
var result, account;
|
|
88
|
+
var result, tronWeb, res_1, account;
|
|
89
89
|
return __generator(this, function (_a) {
|
|
90
90
|
switch (_a.label) {
|
|
91
91
|
case 0: return [4 /*yield*/, (0, helper_1.autoWalletCheck)(function () {
|
|
92
|
-
return window.
|
|
92
|
+
return window.tronLink;
|
|
93
93
|
}, 3000, 30)];
|
|
94
94
|
case 1:
|
|
95
95
|
result = _a.sent();
|
|
96
96
|
if (!result) {
|
|
97
97
|
throw new Error(types_1.EnumErrors.NoTronLink);
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
if (!window.tronLink.ready) return [3 /*break*/, 2];
|
|
100
|
+
tronWeb = window.tronLink.tronWeb;
|
|
101
|
+
return [3 /*break*/, 4];
|
|
102
|
+
case 2: return [4 /*yield*/, window.tronLink.request({ method: 'tron_requestAccounts' })];
|
|
103
|
+
case 3:
|
|
104
|
+
res_1 = _a.sent();
|
|
105
|
+
if (res_1.code === 200) {
|
|
106
|
+
tronWeb = window.tronLink.tronWeb;
|
|
107
|
+
}
|
|
108
|
+
_a.label = 4;
|
|
109
|
+
case 4:
|
|
110
|
+
account = tronWeb.defaultAddress.base58;
|
|
111
|
+
this.sdk = tronWeb;
|
|
101
112
|
this.address = account;
|
|
102
113
|
this.chainId = ''; // todo tron chainId
|
|
103
114
|
res(account);
|