@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.mjs
CHANGED
|
@@ -1236,6 +1236,29 @@ function getHivePowerDelegatingsQueryOptions(username) {
|
|
|
1236
1236
|
)
|
|
1237
1237
|
});
|
|
1238
1238
|
}
|
|
1239
|
+
|
|
1240
|
+
// src/modules/assets/utils/keychain-fallback.ts
|
|
1241
|
+
async function broadcastWithKeychainFallback(account, operations, authority = "Active") {
|
|
1242
|
+
if (typeof window === "undefined" || !window.hive_keychain) {
|
|
1243
|
+
throw new Error("[SDK][Wallets] \u2013 Keychain extension not found");
|
|
1244
|
+
}
|
|
1245
|
+
return new Promise((resolve, reject) => {
|
|
1246
|
+
window.hive_keychain.requestBroadcast(
|
|
1247
|
+
account,
|
|
1248
|
+
operations,
|
|
1249
|
+
authority,
|
|
1250
|
+
(response) => {
|
|
1251
|
+
if (!response.success) {
|
|
1252
|
+
reject(new Error(response.message || "Keychain operation cancelled"));
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
resolve(response.result);
|
|
1256
|
+
}
|
|
1257
|
+
);
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
// src/modules/assets/hive/mutations/transfer.ts
|
|
1239
1262
|
async function transferHive(payload, auth) {
|
|
1240
1263
|
const parsedAsset = parseAsset(payload.amount);
|
|
1241
1264
|
const token = parsedAsset.symbol;
|
|
@@ -1266,7 +1289,7 @@ async function transferHive(payload, auth) {
|
|
|
1266
1289
|
if (auth?.broadcast) {
|
|
1267
1290
|
return auth.broadcast([operation], "active");
|
|
1268
1291
|
}
|
|
1269
|
-
|
|
1292
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1270
1293
|
} else if (payload.type === "hiveauth") {
|
|
1271
1294
|
if (auth?.broadcast) {
|
|
1272
1295
|
return auth.broadcast([operation], "active");
|
|
@@ -1299,7 +1322,7 @@ async function transferToSavingsHive(payload, auth) {
|
|
|
1299
1322
|
if (auth?.broadcast) {
|
|
1300
1323
|
return auth.broadcast([operation], "active");
|
|
1301
1324
|
}
|
|
1302
|
-
|
|
1325
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1303
1326
|
} else if (payload.type === "hiveauth") {
|
|
1304
1327
|
if (auth?.broadcast) {
|
|
1305
1328
|
return auth.broadcast([operation], "active");
|
|
@@ -1331,7 +1354,7 @@ async function transferFromSavingsHive(payload, auth) {
|
|
|
1331
1354
|
if (auth?.broadcast) {
|
|
1332
1355
|
return auth.broadcast([operation], "active");
|
|
1333
1356
|
}
|
|
1334
|
-
|
|
1357
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1335
1358
|
}
|
|
1336
1359
|
if (payload.type === "hiveauth") {
|
|
1337
1360
|
if (auth?.broadcast) {
|
|
@@ -1360,7 +1383,7 @@ async function powerUpHive(payload, auth) {
|
|
|
1360
1383
|
if (auth?.broadcast) {
|
|
1361
1384
|
return auth.broadcast([operation], "active");
|
|
1362
1385
|
}
|
|
1363
|
-
|
|
1386
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1364
1387
|
} else if (payload.type === "hiveauth") {
|
|
1365
1388
|
if (auth?.broadcast) {
|
|
1366
1389
|
return auth.broadcast([operation], "active");
|
|
@@ -1388,7 +1411,7 @@ async function delegateHive(payload, auth) {
|
|
|
1388
1411
|
if (auth?.broadcast) {
|
|
1389
1412
|
return auth.broadcast([operation], "active");
|
|
1390
1413
|
}
|
|
1391
|
-
|
|
1414
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1392
1415
|
} else if (payload.type === "hiveauth") {
|
|
1393
1416
|
if (auth?.broadcast) {
|
|
1394
1417
|
return auth.broadcast([operation], "active");
|
|
@@ -1415,7 +1438,7 @@ async function powerDownHive(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");
|
|
@@ -1445,7 +1468,7 @@ async function withdrawVestingRouteHive(payload, auth) {
|
|
|
1445
1468
|
if (auth?.broadcast) {
|
|
1446
1469
|
return auth.broadcast([operation], "active");
|
|
1447
1470
|
}
|
|
1448
|
-
|
|
1471
|
+
return broadcastWithKeychainFallback(payload.from_account, [operation], "Active");
|
|
1449
1472
|
}
|
|
1450
1473
|
if (payload.type === "hiveauth") {
|
|
1451
1474
|
if (auth?.broadcast) {
|
|
@@ -1558,7 +1581,7 @@ async function claimInterestHive(payload, auth) {
|
|
|
1558
1581
|
if (auth?.broadcast) {
|
|
1559
1582
|
return auth.broadcast(operations, "active");
|
|
1560
1583
|
}
|
|
1561
|
-
|
|
1584
|
+
return broadcastWithKeychainFallback(payload.from, operations, "Active");
|
|
1562
1585
|
}
|
|
1563
1586
|
if (payload.type === "hiveauth") {
|
|
1564
1587
|
if (auth?.broadcast) {
|
|
@@ -1587,7 +1610,7 @@ async function convertHbd(payload, auth) {
|
|
|
1587
1610
|
if (auth?.broadcast) {
|
|
1588
1611
|
return auth.broadcast([operation], "active");
|
|
1589
1612
|
}
|
|
1590
|
-
|
|
1613
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1591
1614
|
} else if (payload.type === "hiveauth") {
|
|
1592
1615
|
if (auth?.broadcast) {
|
|
1593
1616
|
return auth.broadcast([operation], "active");
|
|
@@ -1649,7 +1672,7 @@ async function transferSpk(payload, auth) {
|
|
|
1649
1672
|
if (auth?.broadcast) {
|
|
1650
1673
|
return auth.broadcast([operation], "active");
|
|
1651
1674
|
}
|
|
1652
|
-
|
|
1675
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1653
1676
|
} else if (payload.type === "hiveauth") {
|
|
1654
1677
|
if (auth?.broadcast) {
|
|
1655
1678
|
return auth.broadcast([operation], "active");
|
|
@@ -1698,7 +1721,7 @@ var lockLarynx = async (payload, auth) => {
|
|
|
1698
1721
|
if (auth?.broadcast) {
|
|
1699
1722
|
return auth.broadcast([operation], "active");
|
|
1700
1723
|
}
|
|
1701
|
-
|
|
1724
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1702
1725
|
} else if (payload.type === "hiveauth") {
|
|
1703
1726
|
if (auth?.broadcast) {
|
|
1704
1727
|
return auth.broadcast([operation], "active");
|
|
@@ -1743,7 +1766,7 @@ async function powerUpLarynx(payload, auth) {
|
|
|
1743
1766
|
if (auth?.broadcast) {
|
|
1744
1767
|
return auth.broadcast([operation], "active");
|
|
1745
1768
|
}
|
|
1746
|
-
|
|
1769
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1747
1770
|
} else if (payload.type === "hiveauth") {
|
|
1748
1771
|
if (auth?.broadcast) {
|
|
1749
1772
|
return auth.broadcast([operation], "active");
|
|
@@ -1792,7 +1815,7 @@ async function transferLarynx(payload, auth) {
|
|
|
1792
1815
|
if (auth?.broadcast) {
|
|
1793
1816
|
return auth.broadcast([operation], "active");
|
|
1794
1817
|
}
|
|
1795
|
-
|
|
1818
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
1796
1819
|
} else if (payload.type === "hiveauth") {
|
|
1797
1820
|
if (auth?.broadcast) {
|
|
1798
1821
|
return auth.broadcast([operation], "active");
|
|
@@ -2303,7 +2326,7 @@ async function broadcastHiveEngineOperation(payload, operation, auth) {
|
|
|
2303
2326
|
if (auth?.broadcast) {
|
|
2304
2327
|
return auth.broadcast([operation], "active");
|
|
2305
2328
|
}
|
|
2306
|
-
|
|
2329
|
+
return broadcastWithKeychainFallback(payload.from, [operation], "Active");
|
|
2307
2330
|
}
|
|
2308
2331
|
if (payload.type === "hiveauth") {
|
|
2309
2332
|
if (auth?.broadcast) {
|
|
@@ -2590,15 +2613,17 @@ async function broadcastEngineOperation(account, payload, options2) {
|
|
|
2590
2613
|
}
|
|
2591
2614
|
return CONFIG.hiveClient.broadcast.json(operation, options2.key);
|
|
2592
2615
|
}
|
|
2593
|
-
case "keychain":
|
|
2594
|
-
case "hiveauth": {
|
|
2616
|
+
case "keychain": {
|
|
2595
2617
|
if (options2.auth?.broadcast) {
|
|
2596
2618
|
return options2.auth.broadcast([opTuple], "active");
|
|
2597
2619
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2620
|
+
return broadcastWithKeychainFallback(account, [opTuple], "Active");
|
|
2621
|
+
}
|
|
2622
|
+
case "hiveauth": {
|
|
2623
|
+
if (options2.auth?.broadcast) {
|
|
2624
|
+
return options2.auth.broadcast([opTuple], "active");
|
|
2600
2625
|
}
|
|
2601
|
-
|
|
2626
|
+
return broadcastWithWalletHiveAuth(account, [opTuple], "active");
|
|
2602
2627
|
}
|
|
2603
2628
|
case "hivesigner":
|
|
2604
2629
|
return hs.sendOperation(
|