@ecency/sdk 1.0.44 → 1.0.45

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.
@@ -1,7 +1,7 @@
1
1
  var Q = Object.defineProperty;
2
2
  var _ = (e, t, n) => t in e ? Q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var m = (e, t, n) => _(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { QueryClient as S, useMutation as y, useQuery as k, useInfiniteQuery as T, queryOptions as p, infiniteQueryOptions as j } from "@tanstack/react-query";
4
+ import { QueryClient as S, useMutation as y, useQuery as T, useInfiniteQuery as j, queryOptions as p, infiniteQueryOptions as k } from "@tanstack/react-query";
5
5
  import { Client as A, PrivateKey as h, cryptoUtils as F, RCAPI as D } from "@hiveio/dhive";
6
6
  import d from "hivesigner";
7
7
  class P {
@@ -74,7 +74,7 @@ const f = (e) => {
74
74
  console.error(t);
75
75
  return;
76
76
  }
77
- }, l = (e) => f(e) && f(e).accessToken, q = (e) => f(e) && f(e).postingKey, L = (e) => f(e) && f(e).refreshToken;
77
+ }, l = (e) => f(e) && f(e).accessToken, q = (e) => f(e) && f(e).postingKey, V = (e) => f(e) && f(e).refreshToken;
78
78
  function N(e = [], t, n) {
79
79
  return y({
80
80
  mutationKey: [...e, t],
@@ -165,7 +165,7 @@ var O;
165
165
  return {
166
166
  prefetch: () => r(a),
167
167
  getData: () => t(a.queryKey),
168
- useClientQuery: () => k(a),
168
+ useClientQuery: () => T(a),
169
169
  fetchAndGet: () => c().fetchQuery(a)
170
170
  };
171
171
  }
@@ -174,7 +174,7 @@ var O;
174
174
  return {
175
175
  prefetch: () => o(a),
176
176
  getData: () => n(a.queryKey),
177
- useClientQuery: () => T(a),
177
+ useClientQuery: () => j(a),
178
178
  fetchAndGet: () => c().fetchInfiniteQuery(a)
179
179
  };
180
180
  }
@@ -338,7 +338,7 @@ function ne(e) {
338
338
  }
339
339
  });
340
340
  }
341
- function B() {
341
+ function E() {
342
342
  return new Promise((e) => {
343
343
  var t;
344
344
  (t = window.hive_keychain) == null || t.requestHandshake(() => {
@@ -346,7 +346,7 @@ function B() {
346
346
  });
347
347
  });
348
348
  }
349
- const b = (e, t, n, r = null) => new Promise((o, u) => {
349
+ const K = (e, t, n, r = null) => new Promise((o, u) => {
350
350
  var i;
351
351
  (i = window.hive_keychain) == null || i.requestBroadcast(
352
352
  e,
@@ -359,8 +359,8 @@ const b = (e, t, n, r = null) => new Promise((o, u) => {
359
359
  );
360
360
  }), re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
361
361
  __proto__: null,
362
- broadcast: b,
363
- handshake: B
362
+ broadcast: K,
363
+ handshake: E
364
364
  }, Symbol.toStringTag, { value: "Module" }));
365
365
  function oe(e, t = "Active") {
366
366
  return y({
@@ -370,7 +370,7 @@ function oe(e, t = "Active") {
370
370
  throw new Error(
371
371
  "[SDK][Keychain] – cannot sign operation with anon user"
372
372
  );
373
- return b(e, [n], t);
373
+ return K(e, [n], t);
374
374
  }
375
375
  });
376
376
  }
@@ -413,7 +413,7 @@ function ae(e, t) {
413
413
  });
414
414
  }
415
415
  function ce(e = 20) {
416
- return j({
416
+ return k({
417
417
  queryKey: ["posts", "trending-tags"],
418
418
  queryFn: async ({ pageParam: { afterTag: t } }) => s.hiveClient.database.call("get_trending_tags", [t, e]).then(
419
419
  (n) => n.filter((r) => r.name !== "").filter((r) => !r.name.startsWith("hive-")).map((r) => r.name)
@@ -444,7 +444,23 @@ function v(e) {
444
444
  enabled: !!e
445
445
  });
446
446
  }
447
- function ue(e) {
447
+ function ue(e = "feed") {
448
+ return p({
449
+ queryKey: ["posts", "promoted", e],
450
+ queryFn: async () => {
451
+ const t = new URL(
452
+ s.privateApiHost + "/private-api/promoted-entries"
453
+ );
454
+ return e === "waves" && t.searchParams.append("short_content", "1"), await (await fetch(t.toString(), {
455
+ method: "GET",
456
+ headers: {
457
+ "Content-Type": "application/json"
458
+ }
459
+ })).json();
460
+ }
461
+ });
462
+ }
463
+ function pe(e) {
448
464
  return y({
449
465
  mutationKey: ["posts", "add-fragment", e],
450
466
  mutationFn: async ({ title: t, body: n }) => (await fetch(
@@ -469,7 +485,7 @@ function ue(e) {
469
485
  }
470
486
  });
471
487
  }
472
- function pe(e, t) {
488
+ function ye(e, t) {
473
489
  return y({
474
490
  mutationKey: ["posts", "edit-fragment", e, t],
475
491
  mutationFn: async ({ title: n, body: r }) => (await fetch(
@@ -500,7 +516,7 @@ function pe(e, t) {
500
516
  }
501
517
  });
502
518
  }
503
- function ye(e, t) {
519
+ function le(e, t) {
504
520
  return y({
505
521
  mutationKey: ["posts", "remove-fragment", e],
506
522
  mutationFn: async () => fetch(s.privateApiHost + "/private-api/fragments-delete", {
@@ -521,7 +537,7 @@ function ye(e, t) {
521
537
  }
522
538
  });
523
539
  }
524
- function K(e, t) {
540
+ function b(e, t) {
525
541
  return y({
526
542
  mutationKey: ["analytics", t],
527
543
  mutationFn: async () => {
@@ -544,11 +560,11 @@ function K(e, t) {
544
560
  }
545
561
  });
546
562
  }
547
- const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
563
+ const fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
548
564
  __proto__: null,
549
- useRecordActivity: K
565
+ useRecordActivity: b
550
566
  }, Symbol.toStringTag, { value: "Module" }));
551
- function E(e, t) {
567
+ function B(e, t) {
552
568
  return p({
553
569
  queryKey: ["integrations", "hivesigner", "decode-memo", e],
554
570
  queryFn: async () => {
@@ -562,7 +578,7 @@ function E(e, t) {
562
578
  }
563
579
  const M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
564
580
  __proto__: null,
565
- getDecodeMemoQueryOptions: E
581
+ getDecodeMemoQueryOptions: B
566
582
  }, Symbol.toStringTag, { value: "Module" })), x = {
567
583
  queries: M
568
584
  };
@@ -619,10 +635,10 @@ const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
619
635
  __proto__: null,
620
636
  getAccountTokenQueryOptions: w,
621
637
  getAccountVideosQueryOptions: G
622
- }, Symbol.toStringTag, { value: "Module" })), fe = {
638
+ }, Symbol.toStringTag, { value: "Module" })), he = {
623
639
  queries: U
624
640
  };
625
- function he() {
641
+ function de() {
626
642
  return p({
627
643
  queryKey: ["resource-credits", "stats"],
628
644
  queryFn: async () => (await s.hiveClient.call(
@@ -632,14 +648,14 @@ function he() {
632
648
  )).rc_stats
633
649
  });
634
650
  }
635
- function de(e) {
651
+ function ge(e) {
636
652
  return p({
637
653
  queryKey: ["resource-credits", "account", e],
638
654
  queryFn: async () => new D(s.hiveClient).findRCAccounts([e]),
639
655
  enabled: !!e
640
656
  });
641
657
  }
642
- function ge(e, t) {
658
+ function we(e, t) {
643
659
  return p({
644
660
  queryKey: ["games", "status-check", t, e],
645
661
  enabled: !!e,
@@ -662,8 +678,8 @@ function ge(e, t) {
662
678
  }
663
679
  });
664
680
  }
665
- function we(e, t, n) {
666
- const { mutateAsync: r } = K(
681
+ function ve(e, t, n) {
682
+ const { mutateAsync: r } = b(
667
683
  e,
668
684
  "spin-rolled"
669
685
  );
@@ -695,24 +711,25 @@ function we(e, t, n) {
695
711
  export {
696
712
  s as CONFIG,
697
713
  C as ConfigManager,
698
- le as EcencyAnalytics,
714
+ fe as EcencyAnalytics,
699
715
  O as EcencyQueriesManager,
700
716
  x as HiveSignerIntegration,
701
717
  re as Keychain,
702
- fe as ThreeSpeakIntegration,
718
+ he as ThreeSpeakIntegration,
703
719
  J as broadcastJson,
704
720
  ee as checkUsernameWalletsPendingQueryOptions,
705
721
  l as getAccessToken,
706
722
  Z as getAccountFullQueryOptions,
707
- de as getAccountRcQueryOptions,
723
+ ge as getAccountRcQueryOptions,
708
724
  se as getChainPropertiesQueryOptions,
709
725
  v as getFragmentsQueryOptions,
710
- ge as getGameStatusCheckQueryOptions,
726
+ we as getGameStatusCheckQueryOptions,
711
727
  ae as getHiveEngineTokensListQueryOptions,
712
728
  q as getPostingKey,
729
+ ue as getPromotedPostsQuery,
713
730
  c as getQueryClient,
714
- he as getRcStatsQueryOptions,
715
- L as getRefreshToken,
731
+ de as getRcStatsQueryOptions,
732
+ V as getRefreshToken,
716
733
  H as getRelationshipBetweenAccountsQueryOptions,
717
734
  R as getSearchAccountsByUsernameQueryOptions,
718
735
  ce as getTrendingTagsQueryOptions,
@@ -720,11 +737,11 @@ export {
720
737
  X as makeQueryClient,
721
738
  te as useAccountRelationsUpdate,
722
739
  Y as useAccountUpdate,
723
- ue as useAddFragment,
740
+ pe as useAddFragment,
724
741
  N as useBroadcastMutation,
725
- pe as useEditFragment,
726
- we as useGameClaim,
727
- ye as useRemoveFragment,
742
+ ye as useEditFragment,
743
+ ve as useGameClaim,
744
+ le as useRemoveFragment,
728
745
  ie as useSignOperationByHivesigner,
729
746
  ne as useSignOperationByKey,
730
747
  oe as useSignOperationByKeychain
@@ -0,0 +1,8 @@
1
+ export declare function getPromotedPostsQuery<T extends any>(type?: "feed" | "waves"): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<T[], Error, T[], string[]>, "queryFn"> & {
2
+ queryFn?: import('@tanstack/query-core').QueryFunction<T[], string[], never> | undefined;
3
+ } & {
4
+ queryKey: string[] & {
5
+ [dataTagSymbol]: T[];
6
+ [dataTagErrorSymbol]: Error;
7
+ };
8
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './get-trending-tags-query-options';
2
2
  export * from './get-fragments-query-options';
3
+ export * from './get-promoted-posts-query-options';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "1.0.44",
4
+ "version": "1.0.45",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",