@ecency/sdk 1.0.54 → 1.0.56

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,12 +1,12 @@
1
- var A = Object.defineProperty;
2
- var Q = (e, t, n) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var C = (e, t, n) => Q(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { QueryClient as K, useMutation as l, useQuery as j, useInfiniteQuery as _, queryOptions as p, infiniteQueryOptions as F } from "@tanstack/react-query";
1
+ var Q = Object.defineProperty;
2
+ var _ = (e, t, n) => t in e ? Q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var O = (e, t, n) => _(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { QueryClient as K, useMutation as l, useQuery as q, useInfiniteQuery as j, queryOptions as p, infiniteQueryOptions as F } from "@tanstack/react-query";
5
5
  import { Client as D, PrivateKey as h, cryptoUtils as P, RCAPI as N } from "@hiveio/dhive";
6
6
  import g from "hivesigner";
7
7
  class M {
8
8
  constructor() {
9
- C(this, "length", 0);
9
+ O(this, "length", 0);
10
10
  }
11
11
  clear() {
12
12
  throw new Error("Method not implemented.");
@@ -52,19 +52,19 @@ const i = {
52
52
  queryClient: new K(),
53
53
  plausibleHost: "https://pl.ecency.com"
54
54
  };
55
- var O;
55
+ var S;
56
56
  ((e) => {
57
57
  function t(n) {
58
58
  i.queryClient = n;
59
59
  }
60
60
  e.setQueryClient = t;
61
- })(O || (O = {}));
61
+ })(S || (S = {}));
62
62
  function E(e) {
63
63
  let t = atob(e);
64
64
  if (t[0] === "{")
65
65
  return JSON.parse(t);
66
66
  }
67
- const f = (e) => {
67
+ const d = (e) => {
68
68
  try {
69
69
  const t = i.storage.getItem(
70
70
  i.storagePrefix + "_user_" + e
@@ -74,7 +74,7 @@ const f = (e) => {
74
74
  console.error(t);
75
75
  return;
76
76
  }
77
- }, y = (e) => f(e) && f(e).accessToken, q = (e) => f(e) && f(e).postingKey, k = (e) => f(e) && f(e).loginType, Z = (e) => f(e) && f(e).refreshToken;
77
+ }, y = (e) => d(e) && d(e).accessToken, k = (e) => d(e) && d(e).postingKey, T = (e) => d(e) && d(e).loginType, L = (e) => d(e) && d(e).refreshToken;
78
78
  function J() {
79
79
  return new Promise((e) => {
80
80
  var t;
@@ -94,7 +94,7 @@ const w = (e, t, n, o = null) => new Promise((r, c) => {
94
94
  },
95
95
  o
96
96
  );
97
- }), L = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
97
+ }), R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
98
98
  __proto__: null,
99
99
  broadcast: w,
100
100
  handshake: J
@@ -107,7 +107,7 @@ function I(e = [], t, n) {
107
107
  throw new Error(
108
108
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
109
109
  );
110
- const r = q(t);
110
+ const r = k(t);
111
111
  if (r) {
112
112
  const s = h.fromString(r);
113
113
  return i.hiveClient.broadcast.sendOperations(
@@ -115,7 +115,7 @@ function I(e = [], t, n) {
115
115
  s
116
116
  );
117
117
  }
118
- const c = k(t);
118
+ const c = T(t);
119
119
  if (c && c == "keychain")
120
120
  return w(t, n(o), "Posting").then((s) => s.result);
121
121
  let a = y(t);
@@ -139,7 +139,7 @@ async function B(e, t, n) {
139
139
  required_auths: [],
140
140
  required_posting_auths: [e],
141
141
  json: JSON.stringify(n)
142
- }, r = q(e);
142
+ }, r = k(e);
143
143
  if (r) {
144
144
  const s = h.fromString(r);
145
145
  return i.hiveClient.broadcast.json(
@@ -147,7 +147,7 @@ async function B(e, t, n) {
147
147
  s
148
148
  );
149
149
  }
150
- const c = k(e);
150
+ const c = T(e);
151
151
  if (c && c == "keychain")
152
152
  return w(e, [["custom_json", o]], "Posting").then((s) => s.result);
153
153
  let a = y(e);
@@ -159,7 +159,7 @@ async function B(e, t, n) {
159
159
  "[SDK][Broadcast] – cannot broadcast w/o posting key or token"
160
160
  );
161
161
  }
162
- function R() {
162
+ function ee() {
163
163
  return new K({
164
164
  defaultOptions: {
165
165
  queries: {
@@ -173,7 +173,7 @@ function R() {
173
173
  });
174
174
  }
175
175
  const u = () => i.queryClient;
176
- var S;
176
+ var C;
177
177
  ((e) => {
178
178
  function t(s) {
179
179
  return u().getQueryData(s);
@@ -195,7 +195,7 @@ var S;
195
195
  return {
196
196
  prefetch: () => o(s),
197
197
  getData: () => t(s.queryKey),
198
- useClientQuery: () => j(s),
198
+ useClientQuery: () => q(s),
199
199
  fetchAndGet: () => u().fetchQuery(s)
200
200
  };
201
201
  }
@@ -204,36 +204,13 @@ var S;
204
204
  return {
205
205
  prefetch: () => r(s),
206
206
  getData: () => n(s.queryKey),
207
- useClientQuery: () => _(s),
207
+ useClientQuery: () => j(s),
208
208
  fetchAndGet: () => u().fetchInfiniteQuery(s)
209
209
  };
210
210
  }
211
211
  e.generateClientServerInfiniteQuery = a;
212
- })(S || (S = {}));
213
- function ee(e) {
214
- return I(
215
- ["accounts", "update"],
216
- e,
217
- ({
218
- profile: t,
219
- tokens: n
220
- }) => [
221
- [
222
- "account_update2",
223
- {
224
- account: e,
225
- json_metadata: "",
226
- posting_json_metadata: JSON.stringify({
227
- profile: { ...t, version: 2 },
228
- tokens: n
229
- }),
230
- extensions: []
231
- }
232
- ]
233
- ]
234
- );
235
- }
236
- function te(e) {
212
+ })(C || (C = {}));
213
+ function H(e) {
237
214
  return p({
238
215
  queryKey: ["get-account-full", e],
239
216
  queryFn: async () => {
@@ -257,7 +234,7 @@ function te(e) {
257
234
  [e, 1]
258
235
  );
259
236
  return {
260
- ...t,
237
+ ...t[0],
261
238
  follow_stats: o,
262
239
  reputation: r[0].reputation,
263
240
  profile: {
@@ -270,7 +247,7 @@ function te(e) {
270
247
  staleTime: 6e4
271
248
  });
272
249
  }
273
- function ne(e, t = 5, n = []) {
250
+ function te(e, t = 5, n = []) {
274
251
  return p({
275
252
  queryKey: ["accounts", "search", e, n],
276
253
  enabled: !!e,
@@ -282,7 +259,7 @@ function ne(e, t = 5, n = []) {
282
259
  )
283
260
  });
284
261
  }
285
- function oe(e) {
262
+ function ne(e) {
286
263
  return p({
287
264
  queryKey: ["accounts", "check-wallet-pending", e],
288
265
  queryFn: async () => await (await fetch(
@@ -301,7 +278,7 @@ function oe(e) {
301
278
  refetchOnMount: !0
302
279
  });
303
280
  }
304
- function H(e, t) {
281
+ function x(e, t) {
305
282
  return p({
306
283
  queryKey: ["accounts", "relations", e, t],
307
284
  enabled: !!e && !!t,
@@ -314,7 +291,7 @@ function H(e, t) {
314
291
  )
315
292
  });
316
293
  }
317
- function re(e) {
294
+ function oe(e) {
318
295
  return p({
319
296
  queryKey: ["accounts", "subscriptions", e],
320
297
  enabled: !!e,
@@ -327,7 +304,7 @@ function re(e) {
327
304
  ) ?? []
328
305
  });
329
306
  }
330
- function ie(e) {
307
+ function re(e) {
331
308
  return p({
332
309
  queryKey: ["accounts", "bookmarks", e],
333
310
  enabled: !!e,
@@ -347,7 +324,7 @@ function ie(e) {
347
324
  }
348
325
  });
349
326
  }
350
- function se(e) {
327
+ function ie(e) {
351
328
  return p({
352
329
  queryKey: ["accounts", "favourites", e],
353
330
  enabled: !!e,
@@ -367,11 +344,33 @@ function se(e) {
367
344
  }
368
345
  });
369
346
  }
347
+ function se(e) {
348
+ const { data: t } = q(H(e));
349
+ return I(
350
+ ["accounts", "update", t],
351
+ e,
352
+ ({ profile: n, tokens: o }) => {
353
+ const r = {
354
+ ...JSON.parse((t == null ? void 0 : t.posting_json_metadata) || "{}"),
355
+ profile: { ...t == null ? void 0 : t.profile, ...n, version: 2 }
356
+ };
357
+ return o && o.length > 0 && (r.tokens = o), [
358
+ [
359
+ "account_update2",
360
+ {
361
+ account: e,
362
+ posting_json_metadata: JSON.stringify(r)
363
+ }
364
+ ]
365
+ ];
366
+ }
367
+ );
368
+ }
370
369
  function ae(e, t, n, o) {
371
370
  return l({
372
371
  mutationKey: [],
373
372
  mutationFn: async (r) => {
374
- const c = H(
373
+ const c = x(
375
374
  e,
376
375
  t
377
376
  );
@@ -534,7 +533,7 @@ function le(e) {
534
533
  }
535
534
  });
536
535
  }
537
- function de(e, t = "Active") {
536
+ function fe(e, t = "Active") {
538
537
  return l({
539
538
  mutationKey: ["operations", "sign-keychain", e],
540
539
  mutationFn: ({ operation: n }) => {
@@ -546,7 +545,7 @@ function de(e, t = "Active") {
546
545
  }
547
546
  });
548
547
  }
549
- function fe(e = "/") {
548
+ function de(e = "/") {
550
549
  return l({
551
550
  mutationKey: ["operations", "sign-hivesigner", e],
552
551
  mutationFn: async ({ operation: t }) => g.sendOperation(t, { callback: e }, () => {
@@ -688,7 +687,7 @@ function be(e, t) {
688
687
  }
689
688
  });
690
689
  }
691
- function Ce(e, t) {
690
+ function Oe(e, t) {
692
691
  return l({
693
692
  mutationKey: ["posts", "remove-fragment", e],
694
693
  mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
@@ -709,7 +708,7 @@ function Ce(e, t) {
709
708
  }
710
709
  });
711
710
  }
712
- function T(e, t) {
711
+ function A(e, t) {
713
712
  return l({
714
713
  mutationKey: ["analytics", t],
715
714
  mutationFn: async () => {
@@ -732,11 +731,11 @@ function T(e, t) {
732
731
  }
733
732
  });
734
733
  }
735
- const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
734
+ const Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
736
735
  __proto__: null,
737
- useRecordActivity: T
736
+ useRecordActivity: A
738
737
  }, Symbol.toStringTag, { value: "Module" }));
739
- function x(e, t) {
738
+ function G(e, t) {
740
739
  return p({
741
740
  queryKey: ["integrations", "hivesigner", "decode-memo", e],
742
741
  queryFn: async () => {
@@ -748,11 +747,11 @@ function x(e, t) {
748
747
  }
749
748
  });
750
749
  }
751
- const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
750
+ const W = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
752
751
  __proto__: null,
753
- getDecodeMemoQueryOptions: x
754
- }, Symbol.toStringTag, { value: "Module" })), W = {
755
- queries: G
752
+ getDecodeMemoQueryOptions: G
753
+ }, Symbol.toStringTag, { value: "Module" })), U = {
754
+ queries: W
756
755
  };
757
756
  function m(e) {
758
757
  return p({
@@ -768,7 +767,7 @@ function m(e) {
768
767
  "Content-Type": "application/json"
769
768
  }
770
769
  }
771
- ), n = W.queries.getDecodeMemoQueryOptions(
770
+ ), n = U.queries.getDecodeMemoQueryOptions(
772
771
  e,
773
772
  (await t.json()).memo
774
773
  );
@@ -780,7 +779,7 @@ function m(e) {
780
779
  }
781
780
  });
782
781
  }
783
- function U(e) {
782
+ function z(e) {
784
783
  return p({
785
784
  queryKey: ["integrations", "3speak", "videos", e],
786
785
  enabled: !!e,
@@ -803,12 +802,12 @@ function U(e) {
803
802
  }
804
803
  });
805
804
  }
806
- const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
805
+ const $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
807
806
  __proto__: null,
808
807
  getAccountTokenQueryOptions: m,
809
- getAccountVideosQueryOptions: U
810
- }, Symbol.toStringTag, { value: "Module" })), Se = {
811
- queries: z
808
+ getAccountVideosQueryOptions: z
809
+ }, Symbol.toStringTag, { value: "Module" })), Ce = {
810
+ queries: $
812
811
  };
813
812
  function Ke() {
814
813
  return p({
@@ -851,7 +850,7 @@ function ke(e, t) {
851
850
  });
852
851
  }
853
852
  function Te(e, t, n) {
854
- const { mutateAsync: o } = T(
853
+ const { mutateAsync: o } = A(
855
854
  e,
856
855
  "spin-rolled"
857
856
  );
@@ -920,8 +919,8 @@ function Qe(e, t) {
920
919
  }
921
920
  });
922
921
  }
923
- var d = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(d || {});
924
- const je = {
922
+ var f = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(f || {});
923
+ const _e = {
925
924
  owner: [
926
925
  "admin",
927
926
  "mod",
@@ -944,7 +943,7 @@ const je = {
944
943
  /* MUTED */
945
944
  ]
946
945
  };
947
- function _e(e, t) {
946
+ function je(e, t) {
948
947
  return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
949
948
  }
950
949
  function Fe({
@@ -952,19 +951,19 @@ function Fe({
952
951
  userRole: t,
953
952
  subscribed: n
954
953
  }) {
955
- const o = t === d.MUTED ? !1 : e === "Topic" ? !0 : [d.OWNER, d.ADMIN, d.MOD, d.MEMBER].includes(
954
+ const o = t === f.MUTED ? !1 : e === "Topic" ? !0 : [f.OWNER, f.ADMIN, f.MOD, f.MEMBER].includes(
956
955
  t
957
956
  ), r = (() => {
958
- if (t === d.MUTED) return !1;
957
+ if (t === f.MUTED) return !1;
959
958
  switch (e) {
960
959
  case "Topic":
961
960
  return !0;
962
961
  case "Journal":
963
- return t !== d.GUEST || n;
962
+ return t !== f.GUEST || n;
964
963
  case "Council":
965
964
  return o;
966
965
  }
967
- })(), c = [d.OWNER, d.ADMIN, d.MOD].includes(t);
966
+ })(), c = [f.OWNER, f.ADMIN, f.MOD].includes(t);
968
967
  return {
969
968
  canPost: o,
970
969
  canComment: r,
@@ -973,53 +972,53 @@ function Fe({
973
972
  }
974
973
  export {
975
974
  i as CONFIG,
976
- O as ConfigManager,
977
- Oe as EcencyAnalytics,
978
- S as EcencyQueriesManager,
979
- W as HiveSignerIntegration,
980
- L as Keychain,
981
- d as ROLES,
982
- Se as ThreeSpeakIntegration,
975
+ S as ConfigManager,
976
+ Se as EcencyAnalytics,
977
+ C as EcencyQueriesManager,
978
+ U as HiveSignerIntegration,
979
+ R as Keychain,
980
+ f as ROLES,
981
+ Ce as ThreeSpeakIntegration,
983
982
  B as broadcastJson,
984
- oe as checkUsernameWalletsPendingQueryOptions,
983
+ ne as checkUsernameWalletsPendingQueryOptions,
985
984
  y as getAccessToken,
986
- te as getAccountFullQueryOptions,
985
+ H as getAccountFullQueryOptions,
987
986
  qe as getAccountRcQueryOptions,
988
- re as getAccountSubscriptionsQueryOptions,
989
- ie as getActiveAccountBookmarksQueryOptions,
990
- se as getActiveAccountFavouritesQueryOptions,
987
+ oe as getAccountSubscriptionsQueryOptions,
988
+ re as getActiveAccountBookmarksQueryOptions,
989
+ ie as getActiveAccountFavouritesQueryOptions,
991
990
  he as getChainPropertiesQueryOptions,
992
991
  Ae as getCommunitiesQueryOptions,
993
992
  Qe as getCommunityContextQueryOptions,
994
993
  Fe as getCommunityPermissions,
995
- _e as getCommunityType,
994
+ je as getCommunityType,
996
995
  b as getFragmentsQueryOptions,
997
996
  ke as getGameStatusCheckQueryOptions,
998
997
  ge as getHiveEngineTokensListQueryOptions,
999
- k as getLoginType,
1000
- q as getPostingKey,
998
+ T as getLoginType,
999
+ k as getPostingKey,
1001
1000
  ve as getPromotedPostsQuery,
1002
1001
  u as getQueryClient,
1003
1002
  Ke as getRcStatsQueryOptions,
1004
- Z as getRefreshToken,
1005
- H as getRelationshipBetweenAccountsQueryOptions,
1006
- ne as getSearchAccountsByUsernameQueryOptions,
1003
+ L as getRefreshToken,
1004
+ x as getRelationshipBetweenAccountsQueryOptions,
1005
+ te as getSearchAccountsByUsernameQueryOptions,
1007
1006
  we as getTrendingTagsQueryOptions,
1008
- f as getUser,
1009
- R as makeQueryClient,
1010
- je as roleMap,
1007
+ d as getUser,
1008
+ ee as makeQueryClient,
1009
+ _e as roleMap,
1011
1010
  pe as useAccountFavouriteAdd,
1012
1011
  ye as useAccountFavouriteDelete,
1013
1012
  ae as useAccountRelationsUpdate,
1014
- ee as useAccountUpdate,
1013
+ se as useAccountUpdate,
1015
1014
  me as useAddFragment,
1016
1015
  ce as useBookmarkAdd,
1017
1016
  ue as useBookmarkDelete,
1018
1017
  I as useBroadcastMutation,
1019
1018
  be as useEditFragment,
1020
1019
  Te as useGameClaim,
1021
- Ce as useRemoveFragment,
1022
- fe as useSignOperationByHivesigner,
1020
+ Oe as useRemoveFragment,
1021
+ de as useSignOperationByHivesigner,
1023
1022
  le as useSignOperationByKey,
1024
- de as useSignOperationByKeychain
1023
+ fe as useSignOperationByKeychain
1025
1024
  };
@@ -1,9 +1,12 @@
1
- export declare function useAccountUpdate(username: string): import('@tanstack/react-query').UseMutationResult<any, Error, {
2
- profile: Record<string, any>;
1
+ import { AccountProfile } from '../types';
2
+ interface Payload {
3
+ profile: Partial<AccountProfile>;
3
4
  tokens: {
4
5
  symbol: string;
5
6
  meta: {
6
7
  address: string;
7
8
  };
8
9
  }[];
9
- }, unknown>;
10
+ }
11
+ export declare function useAccountUpdate(username: string): import('@tanstack/react-query').UseMutationResult<any, Error, Partial<Payload>, unknown>;
12
+ export {};