@ecency/sdk 1.0.41 → 1.0.42

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,10 +1,10 @@
1
- var K = Object.defineProperty;
2
- var b = (e, t, n) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var v = (e, t, n) => b(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { QueryClient as S, useMutation as p, useQuery as Q, useInfiniteQuery as _, queryOptions as c, infiniteQueryOptions as k } from "@tanstack/react-query";
5
- import { Client as T, PrivateKey as h, cryptoUtils as j, RCAPI as A } from "@hiveio/dhive";
1
+ var b = Object.defineProperty;
2
+ var Q = (e, t, n) => t in e ? b(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var v = (e, t, n) => Q(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { QueryClient as S, useMutation as p, useQuery as _, useInfiniteQuery as k, queryOptions as c, infiniteQueryOptions as T } from "@tanstack/react-query";
5
+ import { Client as j, PrivateKey as h, cryptoUtils as A, RCAPI as F } from "@hiveio/dhive";
6
6
  import w from "hivesigner";
7
- class F {
7
+ class D {
8
8
  constructor() {
9
9
  v(this, "length", 0);
10
10
  }
@@ -26,9 +26,9 @@ class F {
26
26
  }
27
27
  const i = {
28
28
  privateApiHost: "https://ecency.com",
29
- storage: typeof window > "u" ? new F() : window.localStorage,
29
+ storage: typeof window > "u" ? new D() : window.localStorage,
30
30
  storagePrefix: "ecency",
31
- hiveClient: new T(
31
+ hiveClient: new j(
32
32
  [
33
33
  "https://api.hive.blog",
34
34
  "https://api.deathwing.me",
@@ -59,7 +59,7 @@ var O;
59
59
  }
60
60
  e.setQueryClient = t;
61
61
  })(O || (O = {}));
62
- function D(e) {
62
+ function P(e) {
63
63
  let t = atob(e);
64
64
  if (t[0] === "{")
65
65
  return JSON.parse(t);
@@ -69,13 +69,13 @@ const f = (e) => {
69
69
  const t = i.storage.getItem(
70
70
  i.storagePrefix + "_user_" + e
71
71
  );
72
- return D(JSON.parse(t));
72
+ return P(JSON.parse(t));
73
73
  } catch (t) {
74
74
  console.error(t);
75
75
  return;
76
76
  }
77
- }, y = (e) => f(e) && f(e).accessToken, P = (e) => f(e) && f(e).postingKey, W = (e) => f(e) && f(e).refreshToken;
78
- function I(e = [], t, n) {
77
+ }, y = (e) => f(e) && f(e).accessToken, I = (e) => f(e) && f(e).postingKey, W = (e) => f(e) && f(e).refreshToken;
78
+ function N(e = [], t, n) {
79
79
  return p({
80
80
  mutationKey: [...e, t],
81
81
  mutationFn: async (r) => {
@@ -83,7 +83,7 @@ function I(e = [], t, n) {
83
83
  throw new Error(
84
84
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
85
85
  );
86
- const a = P(t);
86
+ const a = I(t);
87
87
  if (a) {
88
88
  const l = h.fromString(a);
89
89
  return i.hiveClient.broadcast.sendOperations(
@@ -138,7 +138,7 @@ var C;
138
138
  return {
139
139
  prefetch: () => r(o),
140
140
  getData: () => t(o.queryKey),
141
- useClientQuery: () => Q(o),
141
+ useClientQuery: () => _(o),
142
142
  fetchAndGet: () => s().fetchQuery(o)
143
143
  };
144
144
  }
@@ -147,14 +147,14 @@ var C;
147
147
  return {
148
148
  prefetch: () => a(o),
149
149
  getData: () => n(o.queryKey),
150
- useClientQuery: () => _(o),
150
+ useClientQuery: () => k(o),
151
151
  fetchAndGet: () => s().fetchInfiniteQuery(o)
152
152
  };
153
153
  }
154
154
  e.generateClientServerInfiniteQuery = l;
155
155
  })(C || (C = {}));
156
156
  function V(e) {
157
- return I(
157
+ return N(
158
158
  ["accounts", "update"],
159
159
  e,
160
160
  ({
@@ -254,14 +254,14 @@ function Z(e) {
254
254
  if (!e)
255
255
  throw new Error("[Operations][Sign] – cannot sign op with anon user");
256
256
  let r;
257
- return n.split(" ").length === 12 ? r = h.fromLogin(e, n, "active") : j.isWif(n) ? r = h.fromString(n) : r = h.from(n), i.hiveClient.broadcast.sendOperations(
257
+ return n.split(" ").length === 12 ? r = h.fromLogin(e, n, "active") : A.isWif(n) ? r = h.fromString(n) : r = h.from(n), i.hiveClient.broadcast.sendOperations(
258
258
  [t],
259
259
  r
260
260
  );
261
261
  }
262
262
  });
263
263
  }
264
- function N() {
264
+ function H() {
265
265
  return new Promise((e) => {
266
266
  var t;
267
267
  (t = window.hive_keychain) == null || t.requestHandshake(() => {
@@ -283,7 +283,7 @@ const q = (e, t, n, r = null) => new Promise((a, u) => {
283
283
  }), ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
284
284
  __proto__: null,
285
285
  broadcast: q,
286
- handshake: N
286
+ handshake: H
287
287
  }, Symbol.toStringTag, { value: "Module" }));
288
288
  function te(e, t = "Active") {
289
289
  return p({
@@ -330,7 +330,7 @@ function re(e, t) {
330
330
  });
331
331
  }
332
332
  function oe(e = 20) {
333
- return k({
333
+ return T({
334
334
  queryKey: ["posts", "trending-tags"],
335
335
  queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
336
336
  (n) => n.filter((r) => r.name !== "").filter((r) => !r.name.startsWith("hive-")).map((r) => r.name)
@@ -438,7 +438,7 @@ function se(e, t) {
438
438
  }
439
439
  });
440
440
  }
441
- function H(e, t) {
441
+ function K(e, t) {
442
442
  return p({
443
443
  mutationKey: ["analytics", t],
444
444
  mutationFn: async () => {
@@ -463,7 +463,7 @@ function H(e, t) {
463
463
  }
464
464
  const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
465
465
  __proto__: null,
466
- useRecordActivity: H
466
+ useRecordActivity: K
467
467
  }, Symbol.toStringTag, { value: "Module" }));
468
468
  function J(e, t) {
469
469
  return c({
@@ -552,7 +552,7 @@ function pe() {
552
552
  function ye(e) {
553
553
  return c({
554
554
  queryKey: ["resource-credits", "account", e],
555
- queryFn: async () => new A(i.hiveClient).findRCAccounts([e]),
555
+ queryFn: async () => new F(i.hiveClient).findRCAccounts([e]),
556
556
  enabled: !!e
557
557
  });
558
558
  }
@@ -580,6 +580,10 @@ function le(e, t) {
580
580
  });
581
581
  }
582
582
  function fe(e, t, n) {
583
+ const { mutateAsync: r } = K(
584
+ e,
585
+ "spin-rolled"
586
+ );
583
587
  return p({
584
588
  mutationKey: ["games", "post", t, e],
585
589
  mutationFn: async () => {
@@ -599,6 +603,9 @@ function fe(e, t, n) {
599
603
  }
600
604
  }
601
605
  )).json();
606
+ },
607
+ onSuccess() {
608
+ r();
602
609
  }
603
610
  });
604
611
  }
@@ -617,7 +624,7 @@ export {
617
624
  m as getFragmentsQueryOptions,
618
625
  le as getGameStatusCheckQueryOptions,
619
626
  re as getHiveEngineTokensListQueryOptions,
620
- P as getPostingKey,
627
+ I as getPostingKey,
621
628
  s as getQueryClient,
622
629
  pe as getRcStatsQueryOptions,
623
630
  W as getRefreshToken,
@@ -627,7 +634,7 @@ export {
627
634
  $ as makeQueryClient,
628
635
  V as useAccountUpdate,
629
636
  ie as useAddFragment,
630
- I as useBroadcastMutation,
637
+ N as useBroadcastMutation,
631
638
  ae as useEditFragment,
632
639
  fe as useGameClaim,
633
640
  se as useRemoveFragment,
@@ -1,3 +1,3 @@
1
- type ActivityType = "post-created" | "post-updated" | "post-scheduled" | "draft-created" | "video-published" | "legacy-post-created" | "legacy-post-updated" | "legacy-post-scheduled" | "legacy-draft-created" | "legacy-video-published" | "perks-points-by-qr" | "perks-account-boost" | "perks-promote" | "perks-boost-plus" | "points-claimed" | "signed-up-with-wallets" | "signed-up-with-email";
1
+ type ActivityType = "post-created" | "post-updated" | "post-scheduled" | "draft-created" | "video-published" | "legacy-post-created" | "legacy-post-updated" | "legacy-post-scheduled" | "legacy-draft-created" | "legacy-video-published" | "perks-points-by-qr" | "perks-account-boost" | "perks-promote" | "perks-boost-plus" | "points-claimed" | "spin-rolled" | "signed-up-with-wallets" | "signed-up-with-email";
2
2
  export declare function useRecordActivity(username: string | undefined, activityType: ActivityType): import('@tanstack/react-query').UseMutationResult<void, Error, void, unknown>;
3
3
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "1.0.41",
4
+ "version": "1.0.42",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",