@ecency/sdk 1.0.42 → 1.0.44

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 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
- import w from "hivesigner";
7
- class D {
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 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";
5
+ import { Client as A, PrivateKey as h, cryptoUtils as F, RCAPI as D } from "@hiveio/dhive";
6
+ import d from "hivesigner";
7
+ class P {
8
8
  constructor() {
9
- v(this, "length", 0);
9
+ m(this, "length", 0);
10
10
  }
11
11
  clear() {
12
12
  throw new Error("Method not implemented.");
@@ -24,11 +24,11 @@ class D {
24
24
  this[t] = n;
25
25
  }
26
26
  }
27
- const i = {
27
+ const s = {
28
28
  privateApiHost: "https://ecency.com",
29
- storage: typeof window > "u" ? new D() : window.localStorage,
29
+ storage: typeof window > "u" ? new P() : window.localStorage,
30
30
  storagePrefix: "ecency",
31
- hiveClient: new j(
31
+ hiveClient: new A(
32
32
  [
33
33
  "https://api.hive.blog",
34
34
  "https://api.deathwing.me",
@@ -52,48 +52,48 @@ const i = {
52
52
  queryClient: new S(),
53
53
  plausibleHost: "https://pl.ecency.com"
54
54
  };
55
- var O;
55
+ var C;
56
56
  ((e) => {
57
57
  function t(n) {
58
- i.queryClient = n;
58
+ s.queryClient = n;
59
59
  }
60
60
  e.setQueryClient = t;
61
- })(O || (O = {}));
62
- function P(e) {
61
+ })(C || (C = {}));
62
+ function I(e) {
63
63
  let t = atob(e);
64
64
  if (t[0] === "{")
65
65
  return JSON.parse(t);
66
66
  }
67
67
  const f = (e) => {
68
68
  try {
69
- const t = i.storage.getItem(
70
- i.storagePrefix + "_user_" + e
69
+ const t = s.storage.getItem(
70
+ s.storagePrefix + "_user_" + e
71
71
  );
72
- return P(JSON.parse(t));
72
+ return I(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, I = (e) => f(e) && f(e).postingKey, W = (e) => f(e) && f(e).refreshToken;
77
+ }, l = (e) => f(e) && f(e).accessToken, q = (e) => f(e) && f(e).postingKey, L = (e) => f(e) && f(e).refreshToken;
78
78
  function N(e = [], t, n) {
79
- return p({
79
+ return y({
80
80
  mutationKey: [...e, t],
81
81
  mutationFn: async (r) => {
82
82
  if (!t)
83
83
  throw new Error(
84
84
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
85
85
  );
86
- const a = I(t);
87
- if (a) {
88
- const l = h.fromString(a);
89
- return i.hiveClient.broadcast.sendOperations(
86
+ const o = q(t);
87
+ if (o) {
88
+ const i = h.fromString(o);
89
+ return s.hiveClient.broadcast.sendOperations(
90
90
  n(r),
91
- l
91
+ i
92
92
  );
93
93
  }
94
- let u = y(t);
94
+ let u = l(t);
95
95
  if (u)
96
- return (await new w.Client({
96
+ return (await new d.Client({
97
97
  accessToken: u
98
98
  }).broadcast(n(r))).result;
99
99
  throw new Error(
@@ -102,7 +102,34 @@ function N(e = [], t, n) {
102
102
  }
103
103
  });
104
104
  }
105
- function $() {
105
+ async function J(e, t, n) {
106
+ if (!e)
107
+ throw new Error(
108
+ "[Core][Broadcast] Attempted to call broadcast API with anon user"
109
+ );
110
+ const r = q(e);
111
+ if (r) {
112
+ const u = h.fromString(r);
113
+ return s.hiveClient.broadcast.json(
114
+ {
115
+ id: t,
116
+ required_auths: [],
117
+ required_posting_auths: [e],
118
+ json: JSON.stringify(n)
119
+ },
120
+ u
121
+ );
122
+ }
123
+ let o = l(e);
124
+ if (o)
125
+ return (await new d.Client({
126
+ accessToken: o
127
+ }).customJson([], [e], t, JSON.stringify(n))).result;
128
+ throw new Error(
129
+ "[SDK][Broadcast] – cannot broadcast w/o posting key or token"
130
+ );
131
+ }
132
+ function X() {
106
133
  return new S({
107
134
  defaultOptions: {
108
135
  queries: {
@@ -115,45 +142,45 @@ function $() {
115
142
  }
116
143
  });
117
144
  }
118
- const s = () => i.queryClient;
119
- var C;
145
+ const c = () => s.queryClient;
146
+ var O;
120
147
  ((e) => {
121
- function t(o) {
122
- return s().getQueryData(o);
148
+ function t(a) {
149
+ return c().getQueryData(a);
123
150
  }
124
151
  e.getQueryData = t;
125
- function n(o) {
126
- return s().getQueryData(o);
152
+ function n(a) {
153
+ return c().getQueryData(a);
127
154
  }
128
155
  e.getInfiniteQueryData = n;
129
- async function r(o) {
130
- return await s().prefetchQuery(o), t(o.queryKey);
156
+ async function r(a) {
157
+ return await c().prefetchQuery(a), t(a.queryKey);
131
158
  }
132
159
  e.prefetchQuery = r;
133
- async function a(o) {
134
- return await s().prefetchInfiniteQuery(o), n(o.queryKey);
160
+ async function o(a) {
161
+ return await c().prefetchInfiniteQuery(a), n(a.queryKey);
135
162
  }
136
- e.prefetchInfiniteQuery = a;
137
- function u(o) {
163
+ e.prefetchInfiniteQuery = o;
164
+ function u(a) {
138
165
  return {
139
- prefetch: () => r(o),
140
- getData: () => t(o.queryKey),
141
- useClientQuery: () => _(o),
142
- fetchAndGet: () => s().fetchQuery(o)
166
+ prefetch: () => r(a),
167
+ getData: () => t(a.queryKey),
168
+ useClientQuery: () => k(a),
169
+ fetchAndGet: () => c().fetchQuery(a)
143
170
  };
144
171
  }
145
172
  e.generateClientServerQuery = u;
146
- function l(o) {
173
+ function i(a) {
147
174
  return {
148
- prefetch: () => a(o),
149
- getData: () => n(o.queryKey),
150
- useClientQuery: () => k(o),
151
- fetchAndGet: () => s().fetchInfiniteQuery(o)
175
+ prefetch: () => o(a),
176
+ getData: () => n(a.queryKey),
177
+ useClientQuery: () => T(a),
178
+ fetchAndGet: () => c().fetchInfiniteQuery(a)
152
179
  };
153
180
  }
154
- e.generateClientServerInfiniteQuery = l;
155
- })(C || (C = {}));
156
- function V(e) {
181
+ e.generateClientServerInfiniteQuery = i;
182
+ })(O || (O = {}));
183
+ function Y(e) {
157
184
  return N(
158
185
  ["accounts", "update"],
159
186
  e,
@@ -176,25 +203,25 @@ function V(e) {
176
203
  ]
177
204
  );
178
205
  }
179
- function L(e) {
180
- return c({
206
+ function Z(e) {
207
+ return p({
181
208
  queryKey: ["get-account-full", e],
182
209
  queryFn: async () => {
183
210
  if (!e)
184
211
  throw new Error("[SDK] Username is empty");
185
- const t = await i.hiveClient.database.getAccounts([e]);
212
+ const t = await s.hiveClient.database.getAccounts([e]);
186
213
  if (!t[0])
187
214
  throw new Error("[SDK] No account with given username");
188
215
  const n = JSON.parse(t[0].posting_json_metadata).profile;
189
216
  let r;
190
217
  try {
191
- r = await i.hiveClient.database.call(
218
+ r = await s.hiveClient.database.call(
192
219
  "get_follow_count",
193
220
  [e]
194
221
  );
195
222
  } catch {
196
223
  }
197
- const a = await i.hiveClient.call(
224
+ const o = await s.hiveClient.call(
198
225
  "condenser_api",
199
226
  "get_account_reputations",
200
227
  [e, 1]
@@ -202,10 +229,10 @@ function L(e) {
202
229
  return {
203
230
  ...t,
204
231
  follow_stats: r,
205
- reputation: a[0].reputation,
232
+ reputation: o[0].reputation,
206
233
  profile: {
207
234
  ...n,
208
- reputation: a[0].reputation
235
+ reputation: o[0].reputation
209
236
  }
210
237
  };
211
238
  },
@@ -213,23 +240,23 @@ function L(e) {
213
240
  staleTime: 6e4
214
241
  });
215
242
  }
216
- function X(e, t = 5, n = []) {
217
- return c({
243
+ function R(e, t = 5, n = []) {
244
+ return p({
218
245
  queryKey: ["accounts", "search", e, n],
219
246
  enabled: !!e,
220
- queryFn: async () => (await i.hiveClient.database.call(
247
+ queryFn: async () => (await s.hiveClient.database.call(
221
248
  "lookup_accounts",
222
249
  [e, t]
223
250
  )).filter(
224
- (a) => n.length > 0 ? !n.includes(a) : !0
251
+ (o) => n.length > 0 ? !n.includes(o) : !0
225
252
  )
226
253
  });
227
254
  }
228
- function Y(e) {
229
- return c({
255
+ function ee(e) {
256
+ return p({
230
257
  queryKey: ["accounts", "check-wallet-pending", e],
231
258
  queryFn: async () => await (await fetch(
232
- i.privateApiHost + "/private-api/wallets-chkuser",
259
+ s.privateApiHost + "/private-api/wallets-chkuser",
233
260
  {
234
261
  method: "POST",
235
262
  headers: {
@@ -244,8 +271,58 @@ function Y(e) {
244
271
  refetchOnMount: !0
245
272
  });
246
273
  }
247
- function Z(e) {
274
+ function H(e, t) {
248
275
  return p({
276
+ queryKey: ["accounts", "relations", e, t],
277
+ enabled: !!e && !!t,
278
+ refetchOnMount: !1,
279
+ refetchInterval: 36e5,
280
+ queryFn: async () => await s.hiveClient.call(
281
+ "bridge",
282
+ "get_relationship_between_accounts",
283
+ [e, t]
284
+ )
285
+ });
286
+ }
287
+ function te(e, t, n, r) {
288
+ return y({
289
+ mutationKey: [],
290
+ mutationFn: async (o) => {
291
+ const u = H(
292
+ e,
293
+ t
294
+ );
295
+ await c().prefetchQuery(u);
296
+ const i = c().getQueryData(
297
+ u.queryKey
298
+ );
299
+ return await J(e, "follow", [
300
+ "follow",
301
+ {
302
+ follower: e,
303
+ following: t,
304
+ what: [
305
+ ...o === "toggle-ignore" && !(i != null && i.ignores) ? ["ignore"] : [],
306
+ ...o === "toggle-follow" && !(i != null && i.follows) ? ["blog"] : []
307
+ ]
308
+ }
309
+ ]), {
310
+ ...i,
311
+ ignores: o === "toggle-ignore" ? !(i != null && i.ignores) : i == null ? void 0 : i.ignores,
312
+ follows: o === "toggle-follow" ? !(i != null && i.follows) : i == null ? void 0 : i.follows
313
+ };
314
+ },
315
+ onError: r,
316
+ onSuccess(o) {
317
+ n(o), c().setQueryData(
318
+ ["accounts", "relations", e, t],
319
+ o
320
+ );
321
+ }
322
+ });
323
+ }
324
+ function ne(e) {
325
+ return y({
249
326
  mutationKey: ["operations", "sign", e],
250
327
  mutationFn: ({
251
328
  operation: t,
@@ -254,14 +331,14 @@ function Z(e) {
254
331
  if (!e)
255
332
  throw new Error("[Operations][Sign] – cannot sign op with anon user");
256
333
  let r;
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(
334
+ return n.split(" ").length === 12 ? r = h.fromLogin(e, n, "active") : F.isWif(n) ? r = h.fromString(n) : r = h.from(n), s.hiveClient.broadcast.sendOperations(
258
335
  [t],
259
336
  r
260
337
  );
261
338
  }
262
339
  });
263
340
  }
264
- function H() {
341
+ function B() {
265
342
  return new Promise((e) => {
266
343
  var t;
267
344
  (t = window.hive_keychain) == null || t.requestHandshake(() => {
@@ -269,46 +346,52 @@ function H() {
269
346
  });
270
347
  });
271
348
  }
272
- const q = (e, t, n, r = null) => new Promise((a, u) => {
273
- var l;
274
- (l = window.hive_keychain) == null || l.requestBroadcast(
349
+ const b = (e, t, n, r = null) => new Promise((o, u) => {
350
+ var i;
351
+ (i = window.hive_keychain) == null || i.requestBroadcast(
275
352
  e,
276
353
  t,
277
354
  n,
278
- (o) => {
279
- o.success || u({ message: "Operation cancelled" }), a(o);
355
+ (a) => {
356
+ a.success || u({ message: "Operation cancelled" }), o(a);
280
357
  },
281
358
  r
282
359
  );
283
- }), ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
360
+ }), re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
284
361
  __proto__: null,
285
- broadcast: q,
286
- handshake: H
362
+ broadcast: b,
363
+ handshake: B
287
364
  }, Symbol.toStringTag, { value: "Module" }));
288
- function te(e, t = "Active") {
289
- return p({
365
+ function oe(e, t = "Active") {
366
+ return y({
290
367
  mutationKey: ["operations", "sign-keychain", e],
291
368
  mutationFn: ({ operation: n }) => {
292
369
  if (!e)
293
370
  throw new Error(
294
371
  "[SDK][Keychain] – cannot sign operation with anon user"
295
372
  );
296
- return q(e, [n], t);
373
+ return b(e, [n], t);
297
374
  }
298
375
  });
299
376
  }
300
- function ne(e = "/") {
301
- return p({
377
+ function ie(e = "/") {
378
+ return y({
302
379
  mutationKey: ["operations", "sign-hivesigner", e],
303
- mutationFn: async ({ operation: t }) => w.sendOperation(t, { callback: e }, () => {
380
+ mutationFn: async ({ operation: t }) => d.sendOperation(t, { callback: e }, () => {
304
381
  })
305
382
  });
306
383
  }
307
- function re(e, t) {
308
- return c({
384
+ function se() {
385
+ return p({
386
+ queryKey: ["operations", "chain-properties"],
387
+ queryFn: async () => await s.hiveClient.database.getChainProperties()
388
+ });
389
+ }
390
+ function ae(e, t) {
391
+ return p({
309
392
  queryKey: ["hive-engine", "tokens-list", e, t],
310
393
  queryFn: async () => (await (await fetch(
311
- `${i.privateApiHost}/private-api/engine-api`,
394
+ `${s.privateApiHost}/private-api/engine-api`,
312
395
  {
313
396
  method: "POST",
314
397
  body: JSON.stringify({
@@ -329,10 +412,10 @@ function re(e, t) {
329
412
  )).json()).result
330
413
  });
331
414
  }
332
- function oe(e = 20) {
333
- return T({
415
+ function ce(e = 20) {
416
+ return j({
334
417
  queryKey: ["posts", "trending-tags"],
335
- queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
418
+ queryFn: async ({ pageParam: { afterTag: t } }) => s.hiveClient.database.call("get_trending_tags", [t, e]).then(
336
419
  (n) => n.filter((r) => r.name !== "").filter((r) => !r.name.startsWith("hive-")).map((r) => r.name)
337
420
  ),
338
421
  initialPageParam: { afterTag: "" },
@@ -343,15 +426,15 @@ function oe(e = 20) {
343
426
  refetchOnMount: !0
344
427
  });
345
428
  }
346
- function m(e) {
347
- return c({
429
+ function v(e) {
430
+ return p({
348
431
  queryKey: ["posts", "fragments", e],
349
432
  queryFn: async () => (await fetch(
350
- i.privateApiHost + "/private-api/fragments",
433
+ s.privateApiHost + "/private-api/fragments",
351
434
  {
352
435
  method: "POST",
353
436
  body: JSON.stringify({
354
- code: y(e)
437
+ code: l(e)
355
438
  }),
356
439
  headers: {
357
440
  "Content-Type": "application/json"
@@ -361,15 +444,15 @@ function m(e) {
361
444
  enabled: !!e
362
445
  });
363
446
  }
364
- function ie(e) {
365
- return p({
447
+ function ue(e) {
448
+ return y({
366
449
  mutationKey: ["posts", "add-fragment", e],
367
450
  mutationFn: async ({ title: t, body: n }) => (await fetch(
368
- i.privateApiHost + "/private-api/fragments-add",
451
+ s.privateApiHost + "/private-api/fragments-add",
369
452
  {
370
453
  method: "POST",
371
454
  body: JSON.stringify({
372
- code: y(e),
455
+ code: l(e),
373
456
  title: t,
374
457
  body: n
375
458
  }),
@@ -379,22 +462,22 @@ function ie(e) {
379
462
  }
380
463
  )).json(),
381
464
  onSuccess(t) {
382
- s().setQueryData(
383
- m(e).queryKey,
465
+ c().setQueryData(
466
+ v(e).queryKey,
384
467
  (n) => [t, ...n ?? []]
385
468
  );
386
469
  }
387
470
  });
388
471
  }
389
- function ae(e, t) {
390
- return p({
472
+ function pe(e, t) {
473
+ return y({
391
474
  mutationKey: ["posts", "edit-fragment", e, t],
392
475
  mutationFn: async ({ title: n, body: r }) => (await fetch(
393
- i.privateApiHost + "/private-api/fragments-update",
476
+ s.privateApiHost + "/private-api/fragments-update",
394
477
  {
395
478
  method: "POST",
396
479
  body: JSON.stringify({
397
- code: y(e),
480
+ code: l(e),
398
481
  id: t,
399
482
  title: n,
400
483
  body: r
@@ -405,25 +488,25 @@ function ae(e, t) {
405
488
  }
406
489
  )).json(),
407
490
  onSuccess(n) {
408
- s().setQueryData(
409
- m(e).queryKey,
491
+ c().setQueryData(
492
+ v(e).queryKey,
410
493
  (r) => {
411
494
  if (!r)
412
495
  return [];
413
- const a = r.findIndex(({ id: u }) => u === t);
414
- return a >= 0 && (r[a] = n), [...r];
496
+ const o = r.findIndex(({ id: u }) => u === t);
497
+ return o >= 0 && (r[o] = n), [...r];
415
498
  }
416
499
  );
417
500
  }
418
501
  });
419
502
  }
420
- function se(e, t) {
421
- return p({
503
+ function ye(e, t) {
504
+ return y({
422
505
  mutationKey: ["posts", "remove-fragment", e],
423
- mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
506
+ mutationFn: async () => fetch(s.privateApiHost + "/private-api/fragments-delete", {
424
507
  method: "POST",
425
508
  body: JSON.stringify({
426
- code: y(e),
509
+ code: l(e),
427
510
  id: t
428
511
  }),
429
512
  headers: {
@@ -431,20 +514,20 @@ function se(e, t) {
431
514
  }
432
515
  }),
433
516
  onSuccess() {
434
- s().setQueryData(
435
- m(e).queryKey,
517
+ c().setQueryData(
518
+ v(e).queryKey,
436
519
  (n) => [...n ?? []].filter(({ id: r }) => r !== t)
437
520
  );
438
521
  }
439
522
  });
440
523
  }
441
524
  function K(e, t) {
442
- return p({
525
+ return y({
443
526
  mutationKey: ["analytics", t],
444
527
  mutationFn: async () => {
445
528
  if (!t)
446
529
  throw new Error("[SDK][Analytics] – no activity type provided");
447
- await fetch(i.plausibleHost + "/api/event", {
530
+ await fetch(s.plausibleHost + "/api/event", {
448
531
  method: "POST",
449
532
  headers: {
450
533
  "Content-Type": "application/json"
@@ -461,30 +544,30 @@ function K(e, t) {
461
544
  }
462
545
  });
463
546
  }
464
- const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
547
+ const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
465
548
  __proto__: null,
466
549
  useRecordActivity: K
467
550
  }, Symbol.toStringTag, { value: "Module" }));
468
- function J(e, t) {
469
- return c({
551
+ function E(e, t) {
552
+ return p({
470
553
  queryKey: ["integrations", "hivesigner", "decode-memo", e],
471
554
  queryFn: async () => {
472
- const n = y(e);
555
+ const n = l(e);
473
556
  if (n)
474
- return new w.Client({
557
+ return new d.Client({
475
558
  accessToken: n
476
559
  }).decode(t);
477
560
  }
478
561
  });
479
562
  }
480
- const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
563
+ const M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
481
564
  __proto__: null,
482
- getDecodeMemoQueryOptions: J
483
- }, Symbol.toStringTag, { value: "Module" })), M = {
484
- queries: E
565
+ getDecodeMemoQueryOptions: E
566
+ }, Symbol.toStringTag, { value: "Module" })), x = {
567
+ queries: M
485
568
  };
486
- function g(e) {
487
- return c({
569
+ function w(e) {
570
+ return p({
488
571
  queryKey: ["integrations", "3speak", "authenticate", e],
489
572
  enabled: !!e,
490
573
  queryFn: async () => {
@@ -497,28 +580,28 @@ function g(e) {
497
580
  "Content-Type": "application/json"
498
581
  }
499
582
  }
500
- ), n = M.queries.getDecodeMemoQueryOptions(
583
+ ), n = x.queries.getDecodeMemoQueryOptions(
501
584
  e,
502
585
  (await t.json()).memo
503
586
  );
504
- await s().prefetchQuery(n);
505
- const { memoDecoded: r } = s().getQueryData(
587
+ await c().prefetchQuery(n);
588
+ const { memoDecoded: r } = c().getQueryData(
506
589
  n.queryKey
507
590
  );
508
591
  return r.replace("#", "");
509
592
  }
510
593
  });
511
594
  }
512
- function B(e) {
513
- return c({
595
+ function G(e) {
596
+ return p({
514
597
  queryKey: ["integrations", "3speak", "videos", e],
515
598
  enabled: !!e,
516
599
  queryFn: async () => {
517
- await s().prefetchQuery(
518
- g(e)
600
+ await c().prefetchQuery(
601
+ w(e)
519
602
  );
520
- const t = s().getQueryData(
521
- g(e).queryKey
603
+ const t = c().getQueryData(
604
+ w(e).queryKey
522
605
  );
523
606
  return await (await fetch(
524
607
  "https://studio.3speak.tv/mobile/api/my-videos",
@@ -532,44 +615,44 @@ function B(e) {
532
615
  }
533
616
  });
534
617
  }
535
- const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
618
+ const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
536
619
  __proto__: null,
537
- getAccountTokenQueryOptions: g,
538
- getAccountVideosQueryOptions: B
539
- }, Symbol.toStringTag, { value: "Module" })), ue = {
540
- queries: x
620
+ getAccountTokenQueryOptions: w,
621
+ getAccountVideosQueryOptions: G
622
+ }, Symbol.toStringTag, { value: "Module" })), fe = {
623
+ queries: U
541
624
  };
542
- function pe() {
543
- return c({
625
+ function he() {
626
+ return p({
544
627
  queryKey: ["resource-credits", "stats"],
545
- queryFn: async () => (await i.hiveClient.call(
628
+ queryFn: async () => (await s.hiveClient.call(
546
629
  "rc_api",
547
630
  "get_rc_stats",
548
631
  {}
549
632
  )).rc_stats
550
633
  });
551
634
  }
552
- function ye(e) {
553
- return c({
635
+ function de(e) {
636
+ return p({
554
637
  queryKey: ["resource-credits", "account", e],
555
- queryFn: async () => new F(i.hiveClient).findRCAccounts([e]),
638
+ queryFn: async () => new D(s.hiveClient).findRCAccounts([e]),
556
639
  enabled: !!e
557
640
  });
558
641
  }
559
- function le(e, t) {
560
- return c({
642
+ function ge(e, t) {
643
+ return p({
561
644
  queryKey: ["games", "status-check", t, e],
562
645
  enabled: !!e,
563
646
  queryFn: async () => {
564
647
  if (!e)
565
648
  throw new Error("[SDK][Games] – anon user in status check");
566
649
  return await (await fetch(
567
- i.privateApiHost + "/private-api/get-game",
650
+ s.privateApiHost + "/private-api/get-game",
568
651
  {
569
652
  method: "POST",
570
653
  body: JSON.stringify({
571
654
  game_type: t,
572
- code: y(e)
655
+ code: l(e)
573
656
  }),
574
657
  headers: {
575
658
  "Content-Type": "application/json"
@@ -579,23 +662,23 @@ function le(e, t) {
579
662
  }
580
663
  });
581
664
  }
582
- function fe(e, t, n) {
665
+ function we(e, t, n) {
583
666
  const { mutateAsync: r } = K(
584
667
  e,
585
668
  "spin-rolled"
586
669
  );
587
- return p({
670
+ return y({
588
671
  mutationKey: ["games", "post", t, e],
589
672
  mutationFn: async () => {
590
673
  if (!e)
591
674
  throw new Error("[SDK][Games] – anon user in game post");
592
675
  return await (await fetch(
593
- i.privateApiHost + "/private-api/post-game",
676
+ s.privateApiHost + "/private-api/post-game",
594
677
  {
595
678
  method: "POST",
596
679
  body: JSON.stringify({
597
680
  game_type: t,
598
- code: y(e),
681
+ code: l(e),
599
682
  key: n
600
683
  }),
601
684
  headers: {
@@ -610,35 +693,39 @@ function fe(e, t, n) {
610
693
  });
611
694
  }
612
695
  export {
613
- i as CONFIG,
614
- O as ConfigManager,
615
- ce as EcencyAnalytics,
616
- C as EcencyQueriesManager,
617
- M as HiveSignerIntegration,
618
- ee as Keychain,
619
- ue as ThreeSpeakIntegration,
620
- Y as checkUsernameWalletsPendingQueryOptions,
621
- y as getAccessToken,
622
- L as getAccountFullQueryOptions,
623
- ye as getAccountRcQueryOptions,
624
- m as getFragmentsQueryOptions,
625
- le as getGameStatusCheckQueryOptions,
626
- re as getHiveEngineTokensListQueryOptions,
627
- I as getPostingKey,
628
- s as getQueryClient,
629
- pe as getRcStatsQueryOptions,
630
- W as getRefreshToken,
631
- X as getSearchAccountsByUsernameQueryOptions,
632
- oe as getTrendingTagsQueryOptions,
696
+ s as CONFIG,
697
+ C as ConfigManager,
698
+ le as EcencyAnalytics,
699
+ O as EcencyQueriesManager,
700
+ x as HiveSignerIntegration,
701
+ re as Keychain,
702
+ fe as ThreeSpeakIntegration,
703
+ J as broadcastJson,
704
+ ee as checkUsernameWalletsPendingQueryOptions,
705
+ l as getAccessToken,
706
+ Z as getAccountFullQueryOptions,
707
+ de as getAccountRcQueryOptions,
708
+ se as getChainPropertiesQueryOptions,
709
+ v as getFragmentsQueryOptions,
710
+ ge as getGameStatusCheckQueryOptions,
711
+ ae as getHiveEngineTokensListQueryOptions,
712
+ q as getPostingKey,
713
+ c as getQueryClient,
714
+ he as getRcStatsQueryOptions,
715
+ L as getRefreshToken,
716
+ H as getRelationshipBetweenAccountsQueryOptions,
717
+ R as getSearchAccountsByUsernameQueryOptions,
718
+ ce as getTrendingTagsQueryOptions,
633
719
  f as getUser,
634
- $ as makeQueryClient,
635
- V as useAccountUpdate,
636
- ie as useAddFragment,
720
+ X as makeQueryClient,
721
+ te as useAccountRelationsUpdate,
722
+ Y as useAccountUpdate,
723
+ ue as useAddFragment,
637
724
  N as useBroadcastMutation,
638
- ae as useEditFragment,
639
- fe as useGameClaim,
640
- se as useRemoveFragment,
641
- ne as useSignOperationByHivesigner,
642
- Z as useSignOperationByKey,
643
- te as useSignOperationByKeychain
725
+ pe as useEditFragment,
726
+ we as useGameClaim,
727
+ ye as useRemoveFragment,
728
+ ie as useSignOperationByHivesigner,
729
+ ne as useSignOperationByKey,
730
+ oe as useSignOperationByKeychain
644
731
  };
@@ -1 +1,2 @@
1
1
  export * from './use-account-update';
2
+ export * from './use-account-relations-update';
@@ -0,0 +1,9 @@
1
+ import { AccountRelationship } from '../types';
2
+ type Kind = "toggle-ignore" | "toggle-follow";
3
+ export declare function useAccountRelationsUpdate(reference: string | undefined, target: string | undefined, onSuccess: (data: Partial<AccountRelationship> | undefined) => void, onError: (e: Error) => void): import('@tanstack/react-query').UseMutationResult<{
4
+ ignores: boolean | undefined;
5
+ follows: boolean | undefined;
6
+ is_blacklisted?: boolean | undefined;
7
+ follows_blacklists?: boolean | undefined;
8
+ }, Error, Kind, unknown>;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { AccountRelationship } from '../types';
2
+ export declare function getRelationshipBetweenAccountsQueryOptions(reference: string | undefined, target: string | undefined): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<AccountRelationship, Error, AccountRelationship, (string | undefined)[]>, "queryFn"> & {
3
+ queryFn?: import('@tanstack/query-core').QueryFunction<AccountRelationship, (string | undefined)[], never> | undefined;
4
+ } & {
5
+ queryKey: (string | undefined)[] & {
6
+ [dataTagSymbol]: AccountRelationship;
7
+ [dataTagErrorSymbol]: Error;
8
+ };
9
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './get-account-full-query-options';
2
2
  export * from './search-accounts-by-username-query-options';
3
3
  export * from './check-username-wallets-pending-query-options';
4
+ export * from './get-relationship-between-accounts-query-options';
@@ -0,0 +1,6 @@
1
+ export interface AccountRelationship {
2
+ follows: boolean;
3
+ ignores: boolean;
4
+ is_blacklisted: boolean;
5
+ follows_blacklists: boolean;
6
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './account-follow-stats';
2
2
  export * from './account-reputation';
3
+ export * from './account-relationship';
@@ -0,0 +1 @@
1
+ export declare function broadcastJson<T>(username: string | undefined, id: string, payload: T): Promise<any>;
@@ -1 +1,2 @@
1
1
  export * from './use-broadcast-mutation';
2
+ export * from './broadcast-json';
@@ -1 +1,2 @@
1
1
  export * from './mutations';
2
+ export * from './queries';
@@ -0,0 +1,8 @@
1
+ export declare function getChainPropertiesQueryOptions(): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<import('@hiveio/dhive').ChainProperties, Error, import('@hiveio/dhive').ChainProperties, string[]>, "queryFn"> & {
2
+ queryFn?: import('@tanstack/query-core').QueryFunction<import('@hiveio/dhive').ChainProperties, string[], never> | undefined;
3
+ } & {
4
+ queryKey: string[] & {
5
+ [dataTagSymbol]: import('@hiveio/dhive').ChainProperties;
6
+ [dataTagErrorSymbol]: Error;
7
+ };
8
+ };
@@ -0,0 +1 @@
1
+ export * from './get-chain-properties-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.42",
4
+ "version": "1.0.44",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",