@ecency/wallets 1.5.18 → 1.5.20
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/browser/index.d.ts +21 -21
- package/dist/browser/index.js +57 -19
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +57 -19
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +57 -19
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -36,10 +36,23 @@ if (typeof globalLike._scrypt_bsv !== "undefined") {
|
|
|
36
36
|
globalLike._scrypt_bsv = void 0;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
if (typeof globalLike._bitcore !== "undefined") {
|
|
40
|
+
if (typeof globalLike._bitcore === "object") {
|
|
41
|
+
globalLike.__bitcorePreviousVersion = globalLike._bitcore;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
delete globalLike._bitcore;
|
|
45
|
+
} catch {
|
|
46
|
+
globalLike._bitcore = void 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
39
49
|
function rememberScryptBsvVersion() {
|
|
40
50
|
if (typeof globalLike._scrypt_bsv === "string") {
|
|
41
51
|
globalLike.__scryptBsvPreviousVersion = globalLike._scrypt_bsv;
|
|
42
52
|
}
|
|
53
|
+
if (typeof globalLike._bitcore === "object") {
|
|
54
|
+
globalLike.__bitcorePreviousVersion = globalLike._bitcore;
|
|
55
|
+
}
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
// src/modules/wallets/enums/ecency-wallet-currency.ts
|
|
@@ -1236,6 +1249,29 @@ function getHivePowerDelegatingsQueryOptions(username) {
|
|
|
1236
1249
|
)
|
|
1237
1250
|
});
|
|
1238
1251
|
}
|
|
1252
|
+
|
|
1253
|
+
// src/modules/assets/utils/keychain-fallback.ts
|
|
1254
|
+
async function broadcastWithKeychainFallback(account, operations, authority = "Active") {
|
|
1255
|
+
if (typeof window === "undefined" || !window.hive_keychain) {
|
|
1256
|
+
throw new Error("[SDK][Wallets] \u2013 Keychain extension not found");
|
|
1257
|
+
}
|
|
1258
|
+
return new Promise((resolve, reject) => {
|
|
1259
|
+
window.hive_keychain.requestBroadcast(
|
|
1260
|
+
account,
|
|
1261
|
+
operations,
|
|
1262
|
+
authority,
|
|
1263
|
+
(response) => {
|
|
1264
|
+
if (!response.success) {
|
|
1265
|
+
reject(new Error(response.message || "Keychain operation cancelled"));
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
resolve(response.result);
|
|
1269
|
+
}
|
|
1270
|
+
);
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
// src/modules/assets/hive/mutations/transfer.ts
|
|
1239
1275
|
async function transferHive(payload, auth) {
|
|
1240
1276
|
const parsedAsset = parseAsset(payload.amount);
|
|
1241
1277
|
const token = parsedAsset.symbol;
|
|
@@ -1266,7 +1302,7 @@ async function transferHive(payload, auth) {
|
|
|
1266
1302
|
if (auth?.broadcast) {
|
|
1267
1303
|
return auth.broadcast([operation], "active");
|
|
1268
1304
|
}
|
|
1269
|
-
|
|
1305
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1270
1306
|
} else if (payload.type === "hiveauth") {
|
|
1271
1307
|
if (auth?.broadcast) {
|
|
1272
1308
|
return auth.broadcast([operation], "active");
|
|
@@ -1299,7 +1335,7 @@ async function transferToSavingsHive(payload, auth) {
|
|
|
1299
1335
|
if (auth?.broadcast) {
|
|
1300
1336
|
return auth.broadcast([operation], "active");
|
|
1301
1337
|
}
|
|
1302
|
-
|
|
1338
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1303
1339
|
} else if (payload.type === "hiveauth") {
|
|
1304
1340
|
if (auth?.broadcast) {
|
|
1305
1341
|
return auth.broadcast([operation], "active");
|
|
@@ -1331,7 +1367,7 @@ async function transferFromSavingsHive(payload, auth) {
|
|
|
1331
1367
|
if (auth?.broadcast) {
|
|
1332
1368
|
return auth.broadcast([operation], "active");
|
|
1333
1369
|
}
|
|
1334
|
-
|
|
1370
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1335
1371
|
}
|
|
1336
1372
|
if (payload.type === "hiveauth") {
|
|
1337
1373
|
if (auth?.broadcast) {
|
|
@@ -1360,7 +1396,7 @@ async function powerUpHive(payload, auth) {
|
|
|
1360
1396
|
if (auth?.broadcast) {
|
|
1361
1397
|
return auth.broadcast([operation], "active");
|
|
1362
1398
|
}
|
|
1363
|
-
|
|
1399
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1364
1400
|
} else if (payload.type === "hiveauth") {
|
|
1365
1401
|
if (auth?.broadcast) {
|
|
1366
1402
|
return auth.broadcast([operation], "active");
|
|
@@ -1388,7 +1424,7 @@ async function delegateHive(payload, auth) {
|
|
|
1388
1424
|
if (auth?.broadcast) {
|
|
1389
1425
|
return auth.broadcast([operation], "active");
|
|
1390
1426
|
}
|
|
1391
|
-
|
|
1427
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1392
1428
|
} else if (payload.type === "hiveauth") {
|
|
1393
1429
|
if (auth?.broadcast) {
|
|
1394
1430
|
return auth.broadcast([operation], "active");
|
|
@@ -1415,7 +1451,7 @@ async function powerDownHive(payload, auth) {
|
|
|
1415
1451
|
if (auth?.broadcast) {
|
|
1416
1452
|
return auth.broadcast([operation], "active");
|
|
1417
1453
|
}
|
|
1418
|
-
|
|
1454
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1419
1455
|
} else if (payload.type === "hiveauth") {
|
|
1420
1456
|
if (auth?.broadcast) {
|
|
1421
1457
|
return auth.broadcast([operation], "active");
|
|
@@ -1445,7 +1481,7 @@ async function withdrawVestingRouteHive(payload, auth) {
|
|
|
1445
1481
|
if (auth?.broadcast) {
|
|
1446
1482
|
return auth.broadcast([operation], "active");
|
|
1447
1483
|
}
|
|
1448
|
-
|
|
1484
|
+
return broadcastWithKeychainFallback(payload.from_account, [operation], "Active");
|
|
1449
1485
|
}
|
|
1450
1486
|
if (payload.type === "hiveauth") {
|
|
1451
1487
|
if (auth?.broadcast) {
|
|
@@ -1558,7 +1594,7 @@ async function claimInterestHive(payload, auth) {
|
|
|
1558
1594
|
if (auth?.broadcast) {
|
|
1559
1595
|
return auth.broadcast(operations, "active");
|
|
1560
1596
|
}
|
|
1561
|
-
|
|
1597
|
+
return broadcastWithKeychainFallback(payload.from, operations, "Active");
|
|
1562
1598
|
}
|
|
1563
1599
|
if (payload.type === "hiveauth") {
|
|
1564
1600
|
if (auth?.broadcast) {
|
|
@@ -1587,7 +1623,7 @@ async function convertHbd(payload, auth) {
|
|
|
1587
1623
|
if (auth?.broadcast) {
|
|
1588
1624
|
return auth.broadcast([operation], "active");
|
|
1589
1625
|
}
|
|
1590
|
-
|
|
1626
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1591
1627
|
} else if (payload.type === "hiveauth") {
|
|
1592
1628
|
if (auth?.broadcast) {
|
|
1593
1629
|
return auth.broadcast([operation], "active");
|
|
@@ -1649,7 +1685,7 @@ async function transferSpk(payload, auth) {
|
|
|
1649
1685
|
if (auth?.broadcast) {
|
|
1650
1686
|
return auth.broadcast([operation], "active");
|
|
1651
1687
|
}
|
|
1652
|
-
|
|
1688
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1653
1689
|
} else if (payload.type === "hiveauth") {
|
|
1654
1690
|
if (auth?.broadcast) {
|
|
1655
1691
|
return auth.broadcast([operation], "active");
|
|
@@ -1698,7 +1734,7 @@ var lockLarynx = async (payload, auth) => {
|
|
|
1698
1734
|
if (auth?.broadcast) {
|
|
1699
1735
|
return auth.broadcast([operation], "active");
|
|
1700
1736
|
}
|
|
1701
|
-
|
|
1737
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1702
1738
|
} else if (payload.type === "hiveauth") {
|
|
1703
1739
|
if (auth?.broadcast) {
|
|
1704
1740
|
return auth.broadcast([operation], "active");
|
|
@@ -1743,7 +1779,7 @@ async function powerUpLarynx(payload, auth) {
|
|
|
1743
1779
|
if (auth?.broadcast) {
|
|
1744
1780
|
return auth.broadcast([operation], "active");
|
|
1745
1781
|
}
|
|
1746
|
-
|
|
1782
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1747
1783
|
} else if (payload.type === "hiveauth") {
|
|
1748
1784
|
if (auth?.broadcast) {
|
|
1749
1785
|
return auth.broadcast([operation], "active");
|
|
@@ -1792,7 +1828,7 @@ async function transferLarynx(payload, auth) {
|
|
|
1792
1828
|
if (auth?.broadcast) {
|
|
1793
1829
|
return auth.broadcast([operation], "active");
|
|
1794
1830
|
}
|
|
1795
|
-
|
|
1831
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1796
1832
|
} else if (payload.type === "hiveauth") {
|
|
1797
1833
|
if (auth?.broadcast) {
|
|
1798
1834
|
return auth.broadcast([operation], "active");
|
|
@@ -2303,7 +2339,7 @@ async function broadcastHiveEngineOperation(payload, operation, auth) {
|
|
|
2303
2339
|
if (auth?.broadcast) {
|
|
2304
2340
|
return auth.broadcast([operation], "active");
|
|
2305
2341
|
}
|
|
2306
|
-
|
|
2342
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
2307
2343
|
}
|
|
2308
2344
|
if (payload.type === "hiveauth") {
|
|
2309
2345
|
if (auth?.broadcast) {
|
|
@@ -2590,15 +2626,17 @@ async function broadcastEngineOperation(account, payload, options2) {
|
|
|
2590
2626
|
}
|
|
2591
2627
|
return CONFIG.hiveClient.broadcast.json(operation, options2.key);
|
|
2592
2628
|
}
|
|
2593
|
-
case "keychain":
|
|
2594
|
-
case "hiveauth": {
|
|
2629
|
+
case "keychain": {
|
|
2595
2630
|
if (options2.auth?.broadcast) {
|
|
2596
2631
|
return options2.auth.broadcast([opTuple], "active");
|
|
2597
2632
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2633
|
+
return broadcastWithKeychainFallback(account, [opTuple], "Active");
|
|
2634
|
+
}
|
|
2635
|
+
case "hiveauth": {
|
|
2636
|
+
if (options2.auth?.broadcast) {
|
|
2637
|
+
return options2.auth.broadcast([opTuple], "active");
|
|
2600
2638
|
}
|
|
2601
|
-
|
|
2639
|
+
return broadcastWithWalletHiveAuth(account, [opTuple], "active");
|
|
2602
2640
|
}
|
|
2603
2641
|
case "hivesigner":
|
|
2604
2642
|
return hs.sendOperation(
|