@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.cjs
CHANGED
|
@@ -63,10 +63,23 @@ if (typeof globalLike._scrypt_bsv !== "undefined") {
|
|
|
63
63
|
globalLike._scrypt_bsv = void 0;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
if (typeof globalLike._bitcore !== "undefined") {
|
|
67
|
+
if (typeof globalLike._bitcore === "object") {
|
|
68
|
+
globalLike.__bitcorePreviousVersion = globalLike._bitcore;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
delete globalLike._bitcore;
|
|
72
|
+
} catch {
|
|
73
|
+
globalLike._bitcore = void 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
66
76
|
function rememberScryptBsvVersion() {
|
|
67
77
|
if (typeof globalLike._scrypt_bsv === "string") {
|
|
68
78
|
globalLike.__scryptBsvPreviousVersion = globalLike._scrypt_bsv;
|
|
69
79
|
}
|
|
80
|
+
if (typeof globalLike._bitcore === "object") {
|
|
81
|
+
globalLike.__bitcorePreviousVersion = globalLike._bitcore;
|
|
82
|
+
}
|
|
70
83
|
}
|
|
71
84
|
|
|
72
85
|
// src/modules/wallets/enums/ecency-wallet-currency.ts
|
|
@@ -1263,6 +1276,29 @@ function getHivePowerDelegatingsQueryOptions(username) {
|
|
|
1263
1276
|
)
|
|
1264
1277
|
});
|
|
1265
1278
|
}
|
|
1279
|
+
|
|
1280
|
+
// src/modules/assets/utils/keychain-fallback.ts
|
|
1281
|
+
async function broadcastWithKeychainFallback(account, operations, authority = "Active") {
|
|
1282
|
+
if (typeof window === "undefined" || !window.hive_keychain) {
|
|
1283
|
+
throw new Error("[SDK][Wallets] \u2013 Keychain extension not found");
|
|
1284
|
+
}
|
|
1285
|
+
return new Promise((resolve, reject) => {
|
|
1286
|
+
window.hive_keychain.requestBroadcast(
|
|
1287
|
+
account,
|
|
1288
|
+
operations,
|
|
1289
|
+
authority,
|
|
1290
|
+
(response) => {
|
|
1291
|
+
if (!response.success) {
|
|
1292
|
+
reject(new Error(response.message || "Keychain operation cancelled"));
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
resolve(response.result);
|
|
1296
|
+
}
|
|
1297
|
+
);
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// src/modules/assets/hive/mutations/transfer.ts
|
|
1266
1302
|
async function transferHive(payload, auth) {
|
|
1267
1303
|
const parsedAsset = parseAsset(payload.amount);
|
|
1268
1304
|
const token = parsedAsset.symbol;
|
|
@@ -1293,7 +1329,7 @@ async function transferHive(payload, auth) {
|
|
|
1293
1329
|
if (auth?.broadcast) {
|
|
1294
1330
|
return auth.broadcast([operation], "active");
|
|
1295
1331
|
}
|
|
1296
|
-
|
|
1332
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1297
1333
|
} else if (payload.type === "hiveauth") {
|
|
1298
1334
|
if (auth?.broadcast) {
|
|
1299
1335
|
return auth.broadcast([operation], "active");
|
|
@@ -1326,7 +1362,7 @@ async function transferToSavingsHive(payload, auth) {
|
|
|
1326
1362
|
if (auth?.broadcast) {
|
|
1327
1363
|
return auth.broadcast([operation], "active");
|
|
1328
1364
|
}
|
|
1329
|
-
|
|
1365
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1330
1366
|
} else if (payload.type === "hiveauth") {
|
|
1331
1367
|
if (auth?.broadcast) {
|
|
1332
1368
|
return auth.broadcast([operation], "active");
|
|
@@ -1358,7 +1394,7 @@ async function transferFromSavingsHive(payload, auth) {
|
|
|
1358
1394
|
if (auth?.broadcast) {
|
|
1359
1395
|
return auth.broadcast([operation], "active");
|
|
1360
1396
|
}
|
|
1361
|
-
|
|
1397
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1362
1398
|
}
|
|
1363
1399
|
if (payload.type === "hiveauth") {
|
|
1364
1400
|
if (auth?.broadcast) {
|
|
@@ -1387,7 +1423,7 @@ async function powerUpHive(payload, auth) {
|
|
|
1387
1423
|
if (auth?.broadcast) {
|
|
1388
1424
|
return auth.broadcast([operation], "active");
|
|
1389
1425
|
}
|
|
1390
|
-
|
|
1426
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1391
1427
|
} else if (payload.type === "hiveauth") {
|
|
1392
1428
|
if (auth?.broadcast) {
|
|
1393
1429
|
return auth.broadcast([operation], "active");
|
|
@@ -1415,7 +1451,7 @@ async function delegateHive(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");
|
|
@@ -1442,7 +1478,7 @@ async function powerDownHive(payload, auth) {
|
|
|
1442
1478
|
if (auth?.broadcast) {
|
|
1443
1479
|
return auth.broadcast([operation], "active");
|
|
1444
1480
|
}
|
|
1445
|
-
|
|
1481
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1446
1482
|
} else if (payload.type === "hiveauth") {
|
|
1447
1483
|
if (auth?.broadcast) {
|
|
1448
1484
|
return auth.broadcast([operation], "active");
|
|
@@ -1472,7 +1508,7 @@ async function withdrawVestingRouteHive(payload, auth) {
|
|
|
1472
1508
|
if (auth?.broadcast) {
|
|
1473
1509
|
return auth.broadcast([operation], "active");
|
|
1474
1510
|
}
|
|
1475
|
-
|
|
1511
|
+
return broadcastWithKeychainFallback(payload.from_account, [operation], "Active");
|
|
1476
1512
|
}
|
|
1477
1513
|
if (payload.type === "hiveauth") {
|
|
1478
1514
|
if (auth?.broadcast) {
|
|
@@ -1585,7 +1621,7 @@ async function claimInterestHive(payload, auth) {
|
|
|
1585
1621
|
if (auth?.broadcast) {
|
|
1586
1622
|
return auth.broadcast(operations, "active");
|
|
1587
1623
|
}
|
|
1588
|
-
|
|
1624
|
+
return broadcastWithKeychainFallback(payload.from, operations, "Active");
|
|
1589
1625
|
}
|
|
1590
1626
|
if (payload.type === "hiveauth") {
|
|
1591
1627
|
if (auth?.broadcast) {
|
|
@@ -1614,7 +1650,7 @@ async function convertHbd(payload, auth) {
|
|
|
1614
1650
|
if (auth?.broadcast) {
|
|
1615
1651
|
return auth.broadcast([operation], "active");
|
|
1616
1652
|
}
|
|
1617
|
-
|
|
1653
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1618
1654
|
} else if (payload.type === "hiveauth") {
|
|
1619
1655
|
if (auth?.broadcast) {
|
|
1620
1656
|
return auth.broadcast([operation], "active");
|
|
@@ -1676,7 +1712,7 @@ async function transferSpk(payload, auth) {
|
|
|
1676
1712
|
if (auth?.broadcast) {
|
|
1677
1713
|
return auth.broadcast([operation], "active");
|
|
1678
1714
|
}
|
|
1679
|
-
|
|
1715
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1680
1716
|
} else if (payload.type === "hiveauth") {
|
|
1681
1717
|
if (auth?.broadcast) {
|
|
1682
1718
|
return auth.broadcast([operation], "active");
|
|
@@ -1725,7 +1761,7 @@ var lockLarynx = async (payload, auth) => {
|
|
|
1725
1761
|
if (auth?.broadcast) {
|
|
1726
1762
|
return auth.broadcast([operation], "active");
|
|
1727
1763
|
}
|
|
1728
|
-
|
|
1764
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1729
1765
|
} else if (payload.type === "hiveauth") {
|
|
1730
1766
|
if (auth?.broadcast) {
|
|
1731
1767
|
return auth.broadcast([operation], "active");
|
|
@@ -1770,7 +1806,7 @@ async function powerUpLarynx(payload, auth) {
|
|
|
1770
1806
|
if (auth?.broadcast) {
|
|
1771
1807
|
return auth.broadcast([operation], "active");
|
|
1772
1808
|
}
|
|
1773
|
-
|
|
1809
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1774
1810
|
} else if (payload.type === "hiveauth") {
|
|
1775
1811
|
if (auth?.broadcast) {
|
|
1776
1812
|
return auth.broadcast([operation], "active");
|
|
@@ -1819,7 +1855,7 @@ async function transferLarynx(payload, auth) {
|
|
|
1819
1855
|
if (auth?.broadcast) {
|
|
1820
1856
|
return auth.broadcast([operation], "active");
|
|
1821
1857
|
}
|
|
1822
|
-
|
|
1858
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1823
1859
|
} else if (payload.type === "hiveauth") {
|
|
1824
1860
|
if (auth?.broadcast) {
|
|
1825
1861
|
return auth.broadcast([operation], "active");
|
|
@@ -2330,7 +2366,7 @@ async function broadcastHiveEngineOperation(payload, operation, auth) {
|
|
|
2330
2366
|
if (auth?.broadcast) {
|
|
2331
2367
|
return auth.broadcast([operation], "active");
|
|
2332
2368
|
}
|
|
2333
|
-
|
|
2369
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
2334
2370
|
}
|
|
2335
2371
|
if (payload.type === "hiveauth") {
|
|
2336
2372
|
if (auth?.broadcast) {
|
|
@@ -2617,15 +2653,17 @@ async function broadcastEngineOperation(account, payload, options2) {
|
|
|
2617
2653
|
}
|
|
2618
2654
|
return sdk.CONFIG.hiveClient.broadcast.json(operation, options2.key);
|
|
2619
2655
|
}
|
|
2620
|
-
case "keychain":
|
|
2621
|
-
case "hiveauth": {
|
|
2656
|
+
case "keychain": {
|
|
2622
2657
|
if (options2.auth?.broadcast) {
|
|
2623
2658
|
return options2.auth.broadcast([opTuple], "active");
|
|
2624
2659
|
}
|
|
2625
|
-
|
|
2626
|
-
|
|
2660
|
+
return broadcastWithKeychainFallback(account, [opTuple], "Active");
|
|
2661
|
+
}
|
|
2662
|
+
case "hiveauth": {
|
|
2663
|
+
if (options2.auth?.broadcast) {
|
|
2664
|
+
return options2.auth.broadcast([opTuple], "active");
|
|
2627
2665
|
}
|
|
2628
|
-
|
|
2666
|
+
return broadcastWithWalletHiveAuth(account, [opTuple], "active");
|
|
2629
2667
|
}
|
|
2630
2668
|
case "hivesigner":
|
|
2631
2669
|
return hs__default.default.sendOperation(
|