@enclave-hq/wallet-sdk 1.1.5 → 1.2.0
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.js +14 -8
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +14 -8
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -913,7 +913,7 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
913
913
|
super(...arguments);
|
|
914
914
|
this.type = "tronlink" /* TRONLINK */;
|
|
915
915
|
this.chainType = ChainType.TRON;
|
|
916
|
-
this.name = "
|
|
916
|
+
this.name = "TronWeb";
|
|
917
917
|
this.icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
918
918
|
/**
|
|
919
919
|
* 轮询检测账户变化(备用方案)
|
|
@@ -992,9 +992,9 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
992
992
|
/**
|
|
993
993
|
* 签名消息
|
|
994
994
|
*
|
|
995
|
-
* Note:
|
|
996
|
-
* - trx.sign():
|
|
997
|
-
* - trx.signMessageV2():
|
|
995
|
+
* Note: TronWeb 兼容钱包支持两种签名方法:
|
|
996
|
+
* - trx.sign(): 签名交易对象
|
|
997
|
+
* - trx.signMessageV2(): 签名纯文本消息(我们使用此方法)
|
|
998
998
|
*/
|
|
999
999
|
async signMessage(message) {
|
|
1000
1000
|
this.ensureConnected();
|
|
@@ -1169,7 +1169,11 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1169
1169
|
return this.getTronWeb();
|
|
1170
1170
|
}
|
|
1171
1171
|
/**
|
|
1172
|
-
* 获取浏览器中的 TronWeb
|
|
1172
|
+
* 获取浏览器中的 TronWeb 实例
|
|
1173
|
+
* 支持所有 TronWeb 兼容的钱包,包括:
|
|
1174
|
+
* - TronLink (window.tronLink.tronWeb 或 window.tronWeb)
|
|
1175
|
+
* - TokenPocket (window.tronWeb)
|
|
1176
|
+
* - 其他提供 window.tronWeb 接口的钱包
|
|
1173
1177
|
*/
|
|
1174
1178
|
getBrowserProvider() {
|
|
1175
1179
|
if (typeof window === "undefined") {
|
|
@@ -1184,7 +1188,7 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1184
1188
|
getTronWeb() {
|
|
1185
1189
|
const provider = this.getBrowserProvider();
|
|
1186
1190
|
if (!provider) {
|
|
1187
|
-
throw new Error("TronWeb
|
|
1191
|
+
throw new Error("\u672A\u68C0\u6D4B\u5230 TronWeb \u517C\u5BB9\u7684\u94B1\u5305\u3002\u8BF7\u5B89\u88C5 TronLink \u6216\u5176\u4ED6 TronWeb \u517C\u5BB9\u7684\u94B1\u5305\u3002");
|
|
1188
1192
|
}
|
|
1189
1193
|
return provider;
|
|
1190
1194
|
}
|
|
@@ -1206,9 +1210,11 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1206
1210
|
w.tronLink.on("disconnect", this.handleDisconnect);
|
|
1207
1211
|
} else if (w.tronWeb && w.tronWeb.eventServer) {
|
|
1208
1212
|
this.startPolling();
|
|
1213
|
+
} else {
|
|
1214
|
+
this.startPolling();
|
|
1209
1215
|
}
|
|
1210
1216
|
} catch (error) {
|
|
1211
|
-
console.warn("
|
|
1217
|
+
console.warn("TronWeb \u94B1\u5305\u4E8B\u4EF6\u76D1\u542C\u8BBE\u7F6E\u5931\u8D25\uFF0C\u4F7F\u7528\u8F6E\u8BE2\u65B9\u5F0F:", error);
|
|
1212
1218
|
this.startPolling();
|
|
1213
1219
|
}
|
|
1214
1220
|
}
|
|
@@ -1224,7 +1230,7 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1224
1230
|
w.tronLink.off("disconnect", this.handleDisconnect);
|
|
1225
1231
|
}
|
|
1226
1232
|
} catch (error) {
|
|
1227
|
-
console.warn("
|
|
1233
|
+
console.warn("TronWeb \u94B1\u5305\u4E8B\u4EF6\u76D1\u542C\u79FB\u9664\u5931\u8D25:", error);
|
|
1228
1234
|
}
|
|
1229
1235
|
this.stopPolling();
|
|
1230
1236
|
}
|
|
@@ -2232,11 +2238,11 @@ var SUPPORTED_WALLETS = {
|
|
|
2232
2238
|
},
|
|
2233
2239
|
["tronlink" /* TRONLINK */]: {
|
|
2234
2240
|
type: "tronlink" /* TRONLINK */,
|
|
2235
|
-
name: "
|
|
2241
|
+
name: "TronWeb",
|
|
2236
2242
|
chainType: ChainType.TRON,
|
|
2237
2243
|
icon: "https://www.tronlink.org/static/logoIcon.svg",
|
|
2238
2244
|
downloadUrl: "https://www.tronlink.org/",
|
|
2239
|
-
description: "
|
|
2245
|
+
description: "TronWeb \u517C\u5BB9\u94B1\u5305\uFF08\u652F\u6301 TronLink\u3001TokenPocket \u7B49\uFF09"
|
|
2240
2246
|
},
|
|
2241
2247
|
["walletconnect-tron" /* WALLETCONNECT_TRON */]: {
|
|
2242
2248
|
type: "walletconnect-tron" /* WALLETCONNECT_TRON */,
|
|
@@ -2336,7 +2342,9 @@ var WalletDetector = class {
|
|
|
2336
2342
|
return !!w.ethereum;
|
|
2337
2343
|
}
|
|
2338
2344
|
/**
|
|
2339
|
-
* 检测
|
|
2345
|
+
* 检测 TronWeb 兼容钱包
|
|
2346
|
+
* 支持所有提供 window.tronWeb 或 window.tronLink 接口的钱包
|
|
2347
|
+
* 包括但不限于:TronLink、TokenPocket 等
|
|
2340
2348
|
*/
|
|
2341
2349
|
isTronLinkAvailable() {
|
|
2342
2350
|
const w = window;
|