@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.
@@ -810,7 +810,7 @@ interface TransferPayload<T extends HiveBasedAssetSignType> {
810
810
  }
811
811
  declare function transferHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? TransferPayload<T> & {
812
812
  key: PrivateKey;
813
- } : TransferPayload<T>, auth?: AuthContext): Promise<unknown>;
813
+ } : TransferPayload<T>, auth?: AuthContext): Promise<any>;
814
814
 
815
815
  interface Payload$5<T extends HiveBasedAssetSignType> {
816
816
  from: string;
@@ -821,7 +821,7 @@ interface Payload$5<T extends HiveBasedAssetSignType> {
821
821
  }
822
822
  declare function transferToSavingsHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? Payload$5<T> & {
823
823
  key: PrivateKey;
824
- } : Payload$5<T>, auth?: AuthContext): Promise<unknown>;
824
+ } : Payload$5<T>, auth?: AuthContext): Promise<any>;
825
825
 
826
826
  interface PayloadBase$1 {
827
827
  from: string;
@@ -835,7 +835,7 @@ interface PayloadWithKey$1<T extends HiveBasedAssetSignType> extends PayloadBase
835
835
  }
836
836
  declare function transferFromSavingsHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? PayloadWithKey$1<T> & {
837
837
  key: PrivateKey;
838
- } : PayloadWithKey$1<T>, auth?: AuthContext): Promise<unknown>;
838
+ } : PayloadWithKey$1<T>, auth?: AuthContext): Promise<any>;
839
839
 
840
840
  interface Payload$4<T extends HiveBasedAssetSignType> {
841
841
  from: string;
@@ -846,7 +846,7 @@ interface Payload$4<T extends HiveBasedAssetSignType> {
846
846
  }
847
847
  declare function powerUpHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? Payload$4<T> & {
848
848
  key: PrivateKey;
849
- } : Payload$4<T>, auth?: AuthContext): Promise<unknown>;
849
+ } : Payload$4<T>, auth?: AuthContext): Promise<any>;
850
850
 
851
851
  interface Payload$3<T extends HiveBasedAssetSignType> {
852
852
  from: string;
@@ -857,7 +857,7 @@ interface Payload$3<T extends HiveBasedAssetSignType> {
857
857
  }
858
858
  declare function delegateHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? Payload$3<T> & {
859
859
  key: PrivateKey;
860
- } : Payload$3<T>, auth?: AuthContext): Promise<unknown>;
860
+ } : Payload$3<T>, auth?: AuthContext): Promise<any>;
861
861
 
862
862
  interface Payload$2<T extends HiveBasedAssetSignType> {
863
863
  from: string;
@@ -866,7 +866,7 @@ interface Payload$2<T extends HiveBasedAssetSignType> {
866
866
  }
867
867
  declare function powerDownHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? Payload$2<T> & {
868
868
  key: PrivateKey;
869
- } : Payload$2<T>, auth?: AuthContext): Promise<unknown>;
869
+ } : Payload$2<T>, auth?: AuthContext): Promise<any>;
870
870
 
871
871
  interface Payload$1<T extends HiveBasedAssetSignType> {
872
872
  from_account: string;
@@ -877,7 +877,7 @@ interface Payload$1<T extends HiveBasedAssetSignType> {
877
877
  }
878
878
  declare function withdrawVestingRouteHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? Payload$1<T> & {
879
879
  key: PrivateKey;
880
- } : Payload$1<T>, auth?: AuthContext): Promise<unknown>;
880
+ } : Payload$1<T>, auth?: AuthContext): Promise<any>;
881
881
 
882
882
  declare function useClaimRewards(username: string, auth: AuthContext | undefined, onSuccess: () => void): ReturnType<typeof useBroadcastMutation<void>>;
883
883
 
@@ -893,7 +893,7 @@ interface PayloadWithKey<T extends HiveBasedAssetSignType> extends PayloadBase {
893
893
  }
894
894
  declare function claimInterestHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? PayloadWithKey<T> & {
895
895
  key: PrivateKey;
896
- } : PayloadWithKey<T>, auth?: AuthContext): Promise<unknown>;
896
+ } : PayloadWithKey<T>, auth?: AuthContext): Promise<any>;
897
897
 
898
898
  interface Payload<T extends HiveBasedAssetSignType> {
899
899
  from: string;
@@ -902,7 +902,7 @@ interface Payload<T extends HiveBasedAssetSignType> {
902
902
  }
903
903
  declare function convertHbd<T extends HiveBasedAssetSignType>(payload: T extends "key" ? Payload<T> & {
904
904
  key: PrivateKey;
905
- } : Payload<T>, auth?: AuthContext): Promise<unknown>;
905
+ } : Payload<T>, auth?: AuthContext): Promise<any>;
906
906
 
907
907
  declare const HIVE_ACCOUNT_OPERATION_GROUPS: Record<HiveOperationGroup, number[]>;
908
908
 
@@ -951,7 +951,7 @@ interface SpkTransferPayload<T extends HiveBasedAssetSignType> {
951
951
  }
952
952
  declare function transferSpk<T extends HiveBasedAssetSignType>(payload: T extends "key" ? SpkTransferPayload<T> & {
953
953
  key: PrivateKey;
954
- } : SpkTransferPayload<T>, auth?: AuthContext): Promise<unknown>;
954
+ } : SpkTransferPayload<T>, auth?: AuthContext): Promise<any>;
955
955
 
956
956
  interface SpkLockPayload<T extends HiveBasedAssetSignType> {
957
957
  mode: "lock" | "unlock";
@@ -961,7 +961,7 @@ interface SpkLockPayload<T extends HiveBasedAssetSignType> {
961
961
  }
962
962
  declare const lockLarynx: <T extends HiveBasedAssetSignType>(payload: T extends "key" ? SpkLockPayload<T> & {
963
963
  key: PrivateKey;
964
- } : SpkLockPayload<T>, auth?: AuthContext) => Promise<unknown>;
964
+ } : SpkLockPayload<T>, auth?: AuthContext) => Promise<any>;
965
965
 
966
966
  interface SpkPowerPayload<T extends HiveBasedAssetSignType> {
967
967
  mode: "up" | "down";
@@ -971,7 +971,7 @@ interface SpkPowerPayload<T extends HiveBasedAssetSignType> {
971
971
  }
972
972
  declare function powerUpLarynx<T extends HiveBasedAssetSignType>(payload: T extends "key" ? SpkPowerPayload<T> & {
973
973
  key: PrivateKey;
974
- } : SpkPowerPayload<T>, auth?: AuthContext): Promise<unknown>;
974
+ } : SpkPowerPayload<T>, auth?: AuthContext): Promise<any>;
975
975
 
976
976
  interface LarynxTransferPayload<T extends HiveBasedAssetSignType> {
977
977
  from: string;
@@ -982,7 +982,7 @@ interface LarynxTransferPayload<T extends HiveBasedAssetSignType> {
982
982
  }
983
983
  declare function transferLarynx<T extends HiveBasedAssetSignType>(payload: T extends "key" ? LarynxTransferPayload<T> & {
984
984
  key: PrivateKey;
985
- } : LarynxTransferPayload<T>, auth?: AuthContext): Promise<unknown>;
985
+ } : LarynxTransferPayload<T>, auth?: AuthContext): Promise<any>;
986
986
 
987
987
  declare function getLarynxAssetGeneralInfoQueryOptions(username: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<{
988
988
  name: string;
@@ -1510,7 +1510,7 @@ interface DelegateEnginePayload<T extends HiveBasedAssetSignType> {
1510
1510
  }
1511
1511
  declare function delegateEngineToken<T extends HiveBasedAssetSignType>(payload: T extends "key" ? DelegateEnginePayload<T> & {
1512
1512
  key: PrivateKey;
1513
- } : DelegateEnginePayload<T>, auth?: AuthContext): Promise<unknown>;
1513
+ } : DelegateEnginePayload<T>, auth?: AuthContext): Promise<any>;
1514
1514
 
1515
1515
  interface UndelegateEnginePayload<T extends HiveBasedAssetSignType> {
1516
1516
  from: string;
@@ -1521,7 +1521,7 @@ interface UndelegateEnginePayload<T extends HiveBasedAssetSignType> {
1521
1521
  }
1522
1522
  declare function undelegateEngineToken<T extends HiveBasedAssetSignType>(payload: T extends "key" ? UndelegateEnginePayload<T> & {
1523
1523
  key: PrivateKey;
1524
- } : UndelegateEnginePayload<T>, auth?: AuthContext): Promise<unknown>;
1524
+ } : UndelegateEnginePayload<T>, auth?: AuthContext): Promise<any>;
1525
1525
 
1526
1526
  interface StakeEnginePayload<T extends HiveBasedAssetSignType> {
1527
1527
  from: string;
@@ -1532,7 +1532,7 @@ interface StakeEnginePayload<T extends HiveBasedAssetSignType> {
1532
1532
  }
1533
1533
  declare function stakeEngineToken<T extends HiveBasedAssetSignType>(payload: T extends "key" ? StakeEnginePayload<T> & {
1534
1534
  key: PrivateKey;
1535
- } : StakeEnginePayload<T>, auth?: AuthContext): Promise<unknown>;
1535
+ } : StakeEnginePayload<T>, auth?: AuthContext): Promise<any>;
1536
1536
 
1537
1537
  interface UnstakeEnginePayload<T extends HiveBasedAssetSignType> {
1538
1538
  from: string;
@@ -1543,7 +1543,7 @@ interface UnstakeEnginePayload<T extends HiveBasedAssetSignType> {
1543
1543
  }
1544
1544
  declare function unstakeEngineToken<T extends HiveBasedAssetSignType>(payload: T extends "key" ? UnstakeEnginePayload<T> & {
1545
1545
  key: PrivateKey;
1546
- } : UnstakeEnginePayload<T>, auth?: AuthContext): Promise<unknown>;
1546
+ } : UnstakeEnginePayload<T>, auth?: AuthContext): Promise<any>;
1547
1547
 
1548
1548
  interface TransferEnginePayload<T extends HiveBasedAssetSignType> {
1549
1549
  from: string;
@@ -1555,7 +1555,7 @@ interface TransferEnginePayload<T extends HiveBasedAssetSignType> {
1555
1555
  }
1556
1556
  declare function transferEngineToken<T extends HiveBasedAssetSignType>(payload: T extends "key" ? TransferEnginePayload<T> & {
1557
1557
  key: PrivateKey;
1558
- } : TransferEnginePayload<T>, auth?: AuthContext): Promise<unknown>;
1558
+ } : TransferEnginePayload<T>, auth?: AuthContext): Promise<any>;
1559
1559
 
1560
1560
  type EngineOrderSignMethod = "key" | "keychain" | "hivesigner" | "hiveauth";
1561
1561
  interface EngineOrderBroadcastOptions {
@@ -1563,9 +1563,9 @@ interface EngineOrderBroadcastOptions {
1563
1563
  key?: PrivateKey;
1564
1564
  auth?: AuthContext;
1565
1565
  }
1566
- declare const placeHiveEngineBuyOrder: (account: string, symbol: string, quantity: string, price: string, options?: EngineOrderBroadcastOptions) => Promise<unknown>;
1567
- declare const placeHiveEngineSellOrder: (account: string, symbol: string, quantity: string, price: string, options?: EngineOrderBroadcastOptions) => Promise<unknown>;
1568
- declare const cancelHiveEngineOrder: (account: string, type: "buy" | "sell", orderId: string, options?: EngineOrderBroadcastOptions) => Promise<unknown>;
1566
+ declare const placeHiveEngineBuyOrder: (account: string, symbol: string, quantity: string, price: string, options?: EngineOrderBroadcastOptions) => Promise<any>;
1567
+ declare const placeHiveEngineSellOrder: (account: string, symbol: string, quantity: string, price: string, options?: EngineOrderBroadcastOptions) => Promise<any>;
1568
+ declare const cancelHiveEngineOrder: (account: string, type: "buy" | "sell", orderId: string, options?: EngineOrderBroadcastOptions) => Promise<any>;
1569
1569
 
1570
1570
  interface ClaimRewardsPayload<T extends HiveBasedAssetSignType> {
1571
1571
  account: string;
@@ -38,10 +38,23 @@ if (typeof globalLike._scrypt_bsv !== "undefined") {
38
38
  globalLike._scrypt_bsv = void 0;
39
39
  }
40
40
  }
41
+ if (typeof globalLike._bitcore !== "undefined") {
42
+ if (typeof globalLike._bitcore === "object") {
43
+ globalLike.__bitcorePreviousVersion = globalLike._bitcore;
44
+ }
45
+ try {
46
+ delete globalLike._bitcore;
47
+ } catch {
48
+ globalLike._bitcore = void 0;
49
+ }
50
+ }
41
51
  function rememberScryptBsvVersion() {
42
52
  if (typeof globalLike._scrypt_bsv === "string") {
43
53
  globalLike.__scryptBsvPreviousVersion = globalLike._scrypt_bsv;
44
54
  }
55
+ if (typeof globalLike._bitcore === "object") {
56
+ globalLike.__bitcorePreviousVersion = globalLike._bitcore;
57
+ }
45
58
  }
46
59
 
47
60
  // src/modules/wallets/enums/ecency-wallet-currency.ts
@@ -1238,6 +1251,29 @@ function getHivePowerDelegatingsQueryOptions(username) {
1238
1251
  )
1239
1252
  });
1240
1253
  }
1254
+
1255
+ // src/modules/assets/utils/keychain-fallback.ts
1256
+ async function broadcastWithKeychainFallback(account, operations, authority = "Active") {
1257
+ if (typeof window === "undefined" || !window.hive_keychain) {
1258
+ throw new Error("[SDK][Wallets] \u2013 Keychain extension not found");
1259
+ }
1260
+ return new Promise((resolve, reject) => {
1261
+ window.hive_keychain.requestBroadcast(
1262
+ account,
1263
+ operations,
1264
+ authority,
1265
+ (response) => {
1266
+ if (!response.success) {
1267
+ reject(new Error(response.message || "Keychain operation cancelled"));
1268
+ return;
1269
+ }
1270
+ resolve(response.result);
1271
+ }
1272
+ );
1273
+ });
1274
+ }
1275
+
1276
+ // src/modules/assets/hive/mutations/transfer.ts
1241
1277
  async function transferHive(payload, auth) {
1242
1278
  const parsedAsset = parseAsset(payload.amount);
1243
1279
  const token = parsedAsset.symbol;
@@ -1268,7 +1304,7 @@ async function transferHive(payload, auth) {
1268
1304
  if (auth?.broadcast) {
1269
1305
  return auth.broadcast([operation], "active");
1270
1306
  }
1271
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1307
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1272
1308
  } else if (payload.type === "hiveauth") {
1273
1309
  if (auth?.broadcast) {
1274
1310
  return auth.broadcast([operation], "active");
@@ -1301,7 +1337,7 @@ async function transferToSavingsHive(payload, auth) {
1301
1337
  if (auth?.broadcast) {
1302
1338
  return auth.broadcast([operation], "active");
1303
1339
  }
1304
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1340
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1305
1341
  } else if (payload.type === "hiveauth") {
1306
1342
  if (auth?.broadcast) {
1307
1343
  return auth.broadcast([operation], "active");
@@ -1333,7 +1369,7 @@ async function transferFromSavingsHive(payload, auth) {
1333
1369
  if (auth?.broadcast) {
1334
1370
  return auth.broadcast([operation], "active");
1335
1371
  }
1336
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1372
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1337
1373
  }
1338
1374
  if (payload.type === "hiveauth") {
1339
1375
  if (auth?.broadcast) {
@@ -1362,7 +1398,7 @@ async function powerUpHive(payload, auth) {
1362
1398
  if (auth?.broadcast) {
1363
1399
  return auth.broadcast([operation], "active");
1364
1400
  }
1365
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1401
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1366
1402
  } else if (payload.type === "hiveauth") {
1367
1403
  if (auth?.broadcast) {
1368
1404
  return auth.broadcast([operation], "active");
@@ -1390,7 +1426,7 @@ async function delegateHive(payload, auth) {
1390
1426
  if (auth?.broadcast) {
1391
1427
  return auth.broadcast([operation], "active");
1392
1428
  }
1393
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1429
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1394
1430
  } else if (payload.type === "hiveauth") {
1395
1431
  if (auth?.broadcast) {
1396
1432
  return auth.broadcast([operation], "active");
@@ -1417,7 +1453,7 @@ async function powerDownHive(payload, auth) {
1417
1453
  if (auth?.broadcast) {
1418
1454
  return auth.broadcast([operation], "active");
1419
1455
  }
1420
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1456
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1421
1457
  } else if (payload.type === "hiveauth") {
1422
1458
  if (auth?.broadcast) {
1423
1459
  return auth.broadcast([operation], "active");
@@ -1447,7 +1483,7 @@ async function withdrawVestingRouteHive(payload, auth) {
1447
1483
  if (auth?.broadcast) {
1448
1484
  return auth.broadcast([operation], "active");
1449
1485
  }
1450
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1486
+ return broadcastWithKeychainFallback(payload.from_account, [operation], "Active");
1451
1487
  }
1452
1488
  if (payload.type === "hiveauth") {
1453
1489
  if (auth?.broadcast) {
@@ -1560,7 +1596,7 @@ async function claimInterestHive(payload, auth) {
1560
1596
  if (auth?.broadcast) {
1561
1597
  return auth.broadcast(operations, "active");
1562
1598
  }
1563
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1599
+ return broadcastWithKeychainFallback(payload.from, operations, "Active");
1564
1600
  }
1565
1601
  if (payload.type === "hiveauth") {
1566
1602
  if (auth?.broadcast) {
@@ -1589,7 +1625,7 @@ async function convertHbd(payload, auth) {
1589
1625
  if (auth?.broadcast) {
1590
1626
  return auth.broadcast([operation], "active");
1591
1627
  }
1592
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1628
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1593
1629
  } else if (payload.type === "hiveauth") {
1594
1630
  if (auth?.broadcast) {
1595
1631
  return auth.broadcast([operation], "active");
@@ -1651,7 +1687,7 @@ async function transferSpk(payload, auth) {
1651
1687
  if (auth?.broadcast) {
1652
1688
  return auth.broadcast([operation], "active");
1653
1689
  }
1654
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1690
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1655
1691
  } else if (payload.type === "hiveauth") {
1656
1692
  if (auth?.broadcast) {
1657
1693
  return auth.broadcast([operation], "active");
@@ -1700,7 +1736,7 @@ var lockLarynx = async (payload, auth) => {
1700
1736
  if (auth?.broadcast) {
1701
1737
  return auth.broadcast([operation], "active");
1702
1738
  }
1703
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1739
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1704
1740
  } else if (payload.type === "hiveauth") {
1705
1741
  if (auth?.broadcast) {
1706
1742
  return auth.broadcast([operation], "active");
@@ -1745,7 +1781,7 @@ async function powerUpLarynx(payload, auth) {
1745
1781
  if (auth?.broadcast) {
1746
1782
  return auth.broadcast([operation], "active");
1747
1783
  }
1748
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1784
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1749
1785
  } else if (payload.type === "hiveauth") {
1750
1786
  if (auth?.broadcast) {
1751
1787
  return auth.broadcast([operation], "active");
@@ -1794,7 +1830,7 @@ async function transferLarynx(payload, auth) {
1794
1830
  if (auth?.broadcast) {
1795
1831
  return auth.broadcast([operation], "active");
1796
1832
  }
1797
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1833
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
1798
1834
  } else if (payload.type === "hiveauth") {
1799
1835
  if (auth?.broadcast) {
1800
1836
  return auth.broadcast([operation], "active");
@@ -2305,7 +2341,7 @@ async function broadcastHiveEngineOperation(payload, operation, auth) {
2305
2341
  if (auth?.broadcast) {
2306
2342
  return auth.broadcast([operation], "active");
2307
2343
  }
2308
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
2344
+ return broadcastWithKeychainFallback(payload.from, [operation], "Active");
2309
2345
  }
2310
2346
  if (payload.type === "hiveauth") {
2311
2347
  if (auth?.broadcast) {
@@ -2592,15 +2628,17 @@ async function broadcastEngineOperation(account, payload, options2) {
2592
2628
  }
2593
2629
  return CONFIG.hiveClient.broadcast.json(operation, options2.key);
2594
2630
  }
2595
- case "keychain":
2596
- case "hiveauth": {
2631
+ case "keychain": {
2597
2632
  if (options2.auth?.broadcast) {
2598
2633
  return options2.auth.broadcast([opTuple], "active");
2599
2634
  }
2600
- if (options2.method === "hiveauth") {
2601
- return broadcastWithWalletHiveAuth(account, [opTuple], "active");
2635
+ return broadcastWithKeychainFallback(account, [opTuple], "Active");
2636
+ }
2637
+ case "hiveauth": {
2638
+ if (options2.auth?.broadcast) {
2639
+ return options2.auth.broadcast([opTuple], "active");
2602
2640
  }
2603
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
2641
+ return broadcastWithWalletHiveAuth(account, [opTuple], "active");
2604
2642
  }
2605
2643
  case "hivesigner":
2606
2644
  return hs.sendOperation(