@ecency/wallets 1.5.16 → 1.5.18

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.
@@ -1574,7 +1574,7 @@ interface ClaimRewardsPayload<T extends HiveBasedAssetSignType> {
1574
1574
  }
1575
1575
  declare function claimHiveEngineRewards<T extends HiveBasedAssetSignType>(payload: T extends "key" ? ClaimRewardsPayload<T> & {
1576
1576
  key: PrivateKey;
1577
- } : ClaimRewardsPayload<T>, auth?: AuthContext): Promise<unknown>;
1577
+ } : ClaimRewardsPayload<T>, auth?: AuthContext): Promise<any>;
1578
1578
 
1579
1579
  declare function useClaimPoints(username: string | undefined, accessToken: string | undefined, onSuccess?: () => void, onError?: Parameters<typeof useMutation>["0"]["onError"]): _tanstack_react_query.UseMutationResult<any, unknown, unknown, unknown>;
1580
1580
 
@@ -2642,24 +2642,21 @@ async function claimHiveEngineRewards(payload, auth) {
2642
2642
  if (payload.type === "key" && "key" in payload) {
2643
2643
  return CONFIG.hiveClient.broadcast.sendOperations([operation], payload.key);
2644
2644
  }
2645
- if (payload.type === "keychain") {
2646
- if (auth?.broadcast) {
2647
- return auth.broadcast([operation], "posting");
2648
- }
2649
- throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
2645
+ if (auth?.broadcast) {
2646
+ return auth.broadcast([operation], "posting");
2647
+ }
2648
+ if (auth?.postingKey) {
2649
+ const key = PrivateKey.fromString(auth.postingKey);
2650
+ return CONFIG.hiveClient.broadcast.sendOperations([operation], key);
2651
+ }
2652
+ if (auth?.accessToken) {
2653
+ const client = new hs.Client({ accessToken: auth.accessToken });
2654
+ return client.broadcast([operation]);
2650
2655
  }
2651
2656
  if (payload.type === "hiveauth") {
2652
- if (auth?.broadcast) {
2653
- return auth.broadcast([operation], "posting");
2654
- }
2655
2657
  return broadcastWithWalletHiveAuth(payload.account, [operation], "posting");
2656
2658
  }
2657
- return hs.sendOperation(
2658
- operation,
2659
- { callback: `https://ecency.com/@${payload.account}/wallet/engine` },
2660
- () => {
2661
- }
2662
- );
2659
+ throw new Error("[SDK][Wallets] \u2013 cannot broadcast without auth context");
2663
2660
  }
2664
2661
  function getPointsQueryOptions(username) {
2665
2662
  return queryOptions({