@ecency/wallets 1.5.18 → 1.5.19
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 +44 -19
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +44 -19
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +44 -19
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -1263,6 +1263,29 @@ function getHivePowerDelegatingsQueryOptions(username) {
|
|
|
1263
1263
|
)
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
1266
|
+
|
|
1267
|
+
// src/modules/assets/utils/keychain-fallback.ts
|
|
1268
|
+
async function broadcastWithKeychainFallback(account, operations, authority = "Active") {
|
|
1269
|
+
if (typeof window === "undefined" || !window.hive_keychain) {
|
|
1270
|
+
throw new Error("[SDK][Wallets] \u2013 Keychain extension not found");
|
|
1271
|
+
}
|
|
1272
|
+
return new Promise((resolve, reject) => {
|
|
1273
|
+
window.hive_keychain.requestBroadcast(
|
|
1274
|
+
account,
|
|
1275
|
+
operations,
|
|
1276
|
+
authority,
|
|
1277
|
+
(response) => {
|
|
1278
|
+
if (!response.success) {
|
|
1279
|
+
reject(new Error(response.message || "Keychain operation cancelled"));
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
resolve(response.result);
|
|
1283
|
+
}
|
|
1284
|
+
);
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
// src/modules/assets/hive/mutations/transfer.ts
|
|
1266
1289
|
async function transferHive(payload, auth) {
|
|
1267
1290
|
const parsedAsset = parseAsset(payload.amount);
|
|
1268
1291
|
const token = parsedAsset.symbol;
|
|
@@ -1293,7 +1316,7 @@ async function transferHive(payload, auth) {
|
|
|
1293
1316
|
if (auth?.broadcast) {
|
|
1294
1317
|
return auth.broadcast([operation], "active");
|
|
1295
1318
|
}
|
|
1296
|
-
|
|
1319
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1297
1320
|
} else if (payload.type === "hiveauth") {
|
|
1298
1321
|
if (auth?.broadcast) {
|
|
1299
1322
|
return auth.broadcast([operation], "active");
|
|
@@ -1326,7 +1349,7 @@ async function transferToSavingsHive(payload, auth) {
|
|
|
1326
1349
|
if (auth?.broadcast) {
|
|
1327
1350
|
return auth.broadcast([operation], "active");
|
|
1328
1351
|
}
|
|
1329
|
-
|
|
1352
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1330
1353
|
} else if (payload.type === "hiveauth") {
|
|
1331
1354
|
if (auth?.broadcast) {
|
|
1332
1355
|
return auth.broadcast([operation], "active");
|
|
@@ -1358,7 +1381,7 @@ async function transferFromSavingsHive(payload, auth) {
|
|
|
1358
1381
|
if (auth?.broadcast) {
|
|
1359
1382
|
return auth.broadcast([operation], "active");
|
|
1360
1383
|
}
|
|
1361
|
-
|
|
1384
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1362
1385
|
}
|
|
1363
1386
|
if (payload.type === "hiveauth") {
|
|
1364
1387
|
if (auth?.broadcast) {
|
|
@@ -1387,7 +1410,7 @@ async function powerUpHive(payload, auth) {
|
|
|
1387
1410
|
if (auth?.broadcast) {
|
|
1388
1411
|
return auth.broadcast([operation], "active");
|
|
1389
1412
|
}
|
|
1390
|
-
|
|
1413
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1391
1414
|
} else if (payload.type === "hiveauth") {
|
|
1392
1415
|
if (auth?.broadcast) {
|
|
1393
1416
|
return auth.broadcast([operation], "active");
|
|
@@ -1415,7 +1438,7 @@ async function delegateHive(payload, auth) {
|
|
|
1415
1438
|
if (auth?.broadcast) {
|
|
1416
1439
|
return auth.broadcast([operation], "active");
|
|
1417
1440
|
}
|
|
1418
|
-
|
|
1441
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1419
1442
|
} else if (payload.type === "hiveauth") {
|
|
1420
1443
|
if (auth?.broadcast) {
|
|
1421
1444
|
return auth.broadcast([operation], "active");
|
|
@@ -1442,7 +1465,7 @@ async function powerDownHive(payload, auth) {
|
|
|
1442
1465
|
if (auth?.broadcast) {
|
|
1443
1466
|
return auth.broadcast([operation], "active");
|
|
1444
1467
|
}
|
|
1445
|
-
|
|
1468
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1446
1469
|
} else if (payload.type === "hiveauth") {
|
|
1447
1470
|
if (auth?.broadcast) {
|
|
1448
1471
|
return auth.broadcast([operation], "active");
|
|
@@ -1472,7 +1495,7 @@ async function withdrawVestingRouteHive(payload, auth) {
|
|
|
1472
1495
|
if (auth?.broadcast) {
|
|
1473
1496
|
return auth.broadcast([operation], "active");
|
|
1474
1497
|
}
|
|
1475
|
-
|
|
1498
|
+
return broadcastWithKeychainFallback(payload.from_account, [operation], "Active");
|
|
1476
1499
|
}
|
|
1477
1500
|
if (payload.type === "hiveauth") {
|
|
1478
1501
|
if (auth?.broadcast) {
|
|
@@ -1585,7 +1608,7 @@ async function claimInterestHive(payload, auth) {
|
|
|
1585
1608
|
if (auth?.broadcast) {
|
|
1586
1609
|
return auth.broadcast(operations, "active");
|
|
1587
1610
|
}
|
|
1588
|
-
|
|
1611
|
+
return broadcastWithKeychainFallback(payload.from, operations, "Active");
|
|
1589
1612
|
}
|
|
1590
1613
|
if (payload.type === "hiveauth") {
|
|
1591
1614
|
if (auth?.broadcast) {
|
|
@@ -1614,7 +1637,7 @@ async function convertHbd(payload, auth) {
|
|
|
1614
1637
|
if (auth?.broadcast) {
|
|
1615
1638
|
return auth.broadcast([operation], "active");
|
|
1616
1639
|
}
|
|
1617
|
-
|
|
1640
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1618
1641
|
} else if (payload.type === "hiveauth") {
|
|
1619
1642
|
if (auth?.broadcast) {
|
|
1620
1643
|
return auth.broadcast([operation], "active");
|
|
@@ -1676,7 +1699,7 @@ async function transferSpk(payload, auth) {
|
|
|
1676
1699
|
if (auth?.broadcast) {
|
|
1677
1700
|
return auth.broadcast([operation], "active");
|
|
1678
1701
|
}
|
|
1679
|
-
|
|
1702
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1680
1703
|
} else if (payload.type === "hiveauth") {
|
|
1681
1704
|
if (auth?.broadcast) {
|
|
1682
1705
|
return auth.broadcast([operation], "active");
|
|
@@ -1725,7 +1748,7 @@ var lockLarynx = async (payload, auth) => {
|
|
|
1725
1748
|
if (auth?.broadcast) {
|
|
1726
1749
|
return auth.broadcast([operation], "active");
|
|
1727
1750
|
}
|
|
1728
|
-
|
|
1751
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1729
1752
|
} else if (payload.type === "hiveauth") {
|
|
1730
1753
|
if (auth?.broadcast) {
|
|
1731
1754
|
return auth.broadcast([operation], "active");
|
|
@@ -1770,7 +1793,7 @@ async function powerUpLarynx(payload, auth) {
|
|
|
1770
1793
|
if (auth?.broadcast) {
|
|
1771
1794
|
return auth.broadcast([operation], "active");
|
|
1772
1795
|
}
|
|
1773
|
-
|
|
1796
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1774
1797
|
} else if (payload.type === "hiveauth") {
|
|
1775
1798
|
if (auth?.broadcast) {
|
|
1776
1799
|
return auth.broadcast([operation], "active");
|
|
@@ -1819,7 +1842,7 @@ async function transferLarynx(payload, auth) {
|
|
|
1819
1842
|
if (auth?.broadcast) {
|
|
1820
1843
|
return auth.broadcast([operation], "active");
|
|
1821
1844
|
}
|
|
1822
|
-
|
|
1845
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1823
1846
|
} else if (payload.type === "hiveauth") {
|
|
1824
1847
|
if (auth?.broadcast) {
|
|
1825
1848
|
return auth.broadcast([operation], "active");
|
|
@@ -2330,7 +2353,7 @@ async function broadcastHiveEngineOperation(payload, operation, auth) {
|
|
|
2330
2353
|
if (auth?.broadcast) {
|
|
2331
2354
|
return auth.broadcast([operation], "active");
|
|
2332
2355
|
}
|
|
2333
|
-
|
|
2356
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
2334
2357
|
}
|
|
2335
2358
|
if (payload.type === "hiveauth") {
|
|
2336
2359
|
if (auth?.broadcast) {
|
|
@@ -2617,15 +2640,17 @@ async function broadcastEngineOperation(account, payload, options2) {
|
|
|
2617
2640
|
}
|
|
2618
2641
|
return sdk.CONFIG.hiveClient.broadcast.json(operation, options2.key);
|
|
2619
2642
|
}
|
|
2620
|
-
case "keychain":
|
|
2621
|
-
case "hiveauth": {
|
|
2643
|
+
case "keychain": {
|
|
2622
2644
|
if (options2.auth?.broadcast) {
|
|
2623
2645
|
return options2.auth.broadcast([opTuple], "active");
|
|
2624
2646
|
}
|
|
2625
|
-
|
|
2626
|
-
|
|
2647
|
+
return broadcastWithKeychainFallback(account, [opTuple], "Active");
|
|
2648
|
+
}
|
|
2649
|
+
case "hiveauth": {
|
|
2650
|
+
if (options2.auth?.broadcast) {
|
|
2651
|
+
return options2.auth.broadcast([opTuple], "active");
|
|
2627
2652
|
}
|
|
2628
|
-
|
|
2653
|
+
return broadcastWithWalletHiveAuth(account, [opTuple], "active");
|
|
2629
2654
|
}
|
|
2630
2655
|
case "hivesigner":
|
|
2631
2656
|
return hs__default.default.sendOperation(
|