@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.d.mts
CHANGED
|
@@ -327,7 +327,7 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
|
|
|
327
327
|
declare class TronLinkAdapter extends BrowserWalletAdapter {
|
|
328
328
|
readonly type = WalletType.TRONLINK;
|
|
329
329
|
readonly chainType = ChainType.TRON;
|
|
330
|
-
readonly name = "
|
|
330
|
+
readonly name = "TronWeb";
|
|
331
331
|
readonly icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
332
332
|
private static readonly TRON_MAINNET_CHAIN_ID;
|
|
333
333
|
connect(chainId?: number): Promise<Account>;
|
package/dist/index.d.ts
CHANGED
|
@@ -327,7 +327,7 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
|
|
|
327
327
|
declare class TronLinkAdapter extends BrowserWalletAdapter {
|
|
328
328
|
readonly type = WalletType.TRONLINK;
|
|
329
329
|
readonly chainType = ChainType.TRON;
|
|
330
|
-
readonly name = "
|
|
330
|
+
readonly name = "TronWeb";
|
|
331
331
|
readonly icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
332
332
|
private static readonly TRON_MAINNET_CHAIN_ID;
|
|
333
333
|
connect(chainId?: number): Promise<Account>;
|
package/dist/index.js
CHANGED
|
@@ -921,7 +921,7 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
921
921
|
super(...arguments);
|
|
922
922
|
this.type = "tronlink" /* TRONLINK */;
|
|
923
923
|
this.chainType = ChainType.TRON;
|
|
924
|
-
this.name = "
|
|
924
|
+
this.name = "TronWeb";
|
|
925
925
|
this.icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
926
926
|
/**
|
|
927
927
|
* 轮询检测账户变化(备用方案)
|
|
@@ -1000,9 +1000,9 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1000
1000
|
/**
|
|
1001
1001
|
* 签名消息
|
|
1002
1002
|
*
|
|
1003
|
-
* Note:
|
|
1004
|
-
* - trx.sign():
|
|
1005
|
-
* - trx.signMessageV2():
|
|
1003
|
+
* Note: TronWeb 兼容钱包支持两种签名方法:
|
|
1004
|
+
* - trx.sign(): 签名交易对象
|
|
1005
|
+
* - trx.signMessageV2(): 签名纯文本消息(我们使用此方法)
|
|
1006
1006
|
*/
|
|
1007
1007
|
async signMessage(message) {
|
|
1008
1008
|
this.ensureConnected();
|
|
@@ -1177,7 +1177,11 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1177
1177
|
return this.getTronWeb();
|
|
1178
1178
|
}
|
|
1179
1179
|
/**
|
|
1180
|
-
* 获取浏览器中的 TronWeb
|
|
1180
|
+
* 获取浏览器中的 TronWeb 实例
|
|
1181
|
+
* 支持所有 TronWeb 兼容的钱包,包括:
|
|
1182
|
+
* - TronLink (window.tronLink.tronWeb 或 window.tronWeb)
|
|
1183
|
+
* - TokenPocket (window.tronWeb)
|
|
1184
|
+
* - 其他提供 window.tronWeb 接口的钱包
|
|
1181
1185
|
*/
|
|
1182
1186
|
getBrowserProvider() {
|
|
1183
1187
|
if (typeof window === "undefined") {
|
|
@@ -1192,7 +1196,7 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1192
1196
|
getTronWeb() {
|
|
1193
1197
|
const provider = this.getBrowserProvider();
|
|
1194
1198
|
if (!provider) {
|
|
1195
|
-
throw new Error("TronWeb
|
|
1199
|
+
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");
|
|
1196
1200
|
}
|
|
1197
1201
|
return provider;
|
|
1198
1202
|
}
|
|
@@ -1214,9 +1218,11 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1214
1218
|
w.tronLink.on("disconnect", this.handleDisconnect);
|
|
1215
1219
|
} else if (w.tronWeb && w.tronWeb.eventServer) {
|
|
1216
1220
|
this.startPolling();
|
|
1221
|
+
} else {
|
|
1222
|
+
this.startPolling();
|
|
1217
1223
|
}
|
|
1218
1224
|
} catch (error) {
|
|
1219
|
-
console.warn("
|
|
1225
|
+
console.warn("TronWeb \u94B1\u5305\u4E8B\u4EF6\u76D1\u542C\u8BBE\u7F6E\u5931\u8D25\uFF0C\u4F7F\u7528\u8F6E\u8BE2\u65B9\u5F0F:", error);
|
|
1220
1226
|
this.startPolling();
|
|
1221
1227
|
}
|
|
1222
1228
|
}
|
|
@@ -1232,7 +1238,7 @@ var _TronLinkAdapter = class _TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
1232
1238
|
w.tronLink.off("disconnect", this.handleDisconnect);
|
|
1233
1239
|
}
|
|
1234
1240
|
} catch (error) {
|
|
1235
|
-
console.warn("
|
|
1241
|
+
console.warn("TronWeb \u94B1\u5305\u4E8B\u4EF6\u76D1\u542C\u79FB\u9664\u5931\u8D25:", error);
|
|
1236
1242
|
}
|
|
1237
1243
|
this.stopPolling();
|
|
1238
1244
|
}
|
|
@@ -2240,11 +2246,11 @@ var SUPPORTED_WALLETS = {
|
|
|
2240
2246
|
},
|
|
2241
2247
|
["tronlink" /* TRONLINK */]: {
|
|
2242
2248
|
type: "tronlink" /* TRONLINK */,
|
|
2243
|
-
name: "
|
|
2249
|
+
name: "TronWeb",
|
|
2244
2250
|
chainType: ChainType.TRON,
|
|
2245
2251
|
icon: "https://www.tronlink.org/static/logoIcon.svg",
|
|
2246
2252
|
downloadUrl: "https://www.tronlink.org/",
|
|
2247
|
-
description: "
|
|
2253
|
+
description: "TronWeb \u517C\u5BB9\u94B1\u5305\uFF08\u652F\u6301 TronLink\u3001TokenPocket \u7B49\uFF09"
|
|
2248
2254
|
},
|
|
2249
2255
|
["walletconnect-tron" /* WALLETCONNECT_TRON */]: {
|
|
2250
2256
|
type: "walletconnect-tron" /* WALLETCONNECT_TRON */,
|
|
@@ -2344,7 +2350,9 @@ var WalletDetector = class {
|
|
|
2344
2350
|
return !!w.ethereum;
|
|
2345
2351
|
}
|
|
2346
2352
|
/**
|
|
2347
|
-
* 检测
|
|
2353
|
+
* 检测 TronWeb 兼容钱包
|
|
2354
|
+
* 支持所有提供 window.tronWeb 或 window.tronLink 接口的钱包
|
|
2355
|
+
* 包括但不限于:TronLink、TokenPocket 等
|
|
2348
2356
|
*/
|
|
2349
2357
|
isTronLinkAvailable() {
|
|
2350
2358
|
const w = window;
|