@ecency/sdk 1.0.41 → 1.0.43

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 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";
6
- import w from "hivesigner";
7
- class F {
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 I {
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 F {
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 F() : window.localStorage,
29
+ storage: typeof window > "u" ? new I() : window.localStorage,
30
30
  storagePrefix: "ecency",
31
- hiveClient: new T(
31
+ hiveClient: new A(
32
32
  [
33
33
  "https://api.hive.blog",
34
34
  "https://api.deathwing.me",
@@ -55,54 +55,81 @@ const i = {
55
55
  var O;
56
56
  ((e) => {
57
57
  function t(n) {
58
- i.queryClient = n;
58
+ s.queryClient = n;
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);
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 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) {
79
- return p({
77
+ }, l = (e) => f(e) && f(e).accessToken, q = (e) => f(e) && f(e).postingKey, L = (e) => f(e) && f(e).refreshToken;
78
+ function N(e = [], t, n) {
79
+ return y({
80
80
  mutationKey: [...e, t],
81
- mutationFn: async (r) => {
81
+ mutationFn: async (o) => {
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 = P(t);
87
- if (a) {
88
- const l = h.fromString(a);
89
- return i.hiveClient.broadcast.sendOperations(
90
- n(r),
91
- l
86
+ const r = q(t);
87
+ if (r) {
88
+ const i = h.fromString(r);
89
+ return s.hiveClient.broadcast.sendOperations(
90
+ n(o),
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
- }).broadcast(n(r))).result;
98
+ }).broadcast(n(o))).result;
99
99
  throw new Error(
100
100
  "[SDK][Broadcast] – cannot broadcast w/o posting key or token"
101
101
  );
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 o = q(e);
111
+ if (o) {
112
+ const u = h.fromString(o);
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 r = l(e);
124
+ if (r)
125
+ return (await new d.Client({
126
+ accessToken: r
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,46 +142,46 @@ function $() {
115
142
  }
116
143
  });
117
144
  }
118
- const s = () => i.queryClient;
145
+ const c = () => s.queryClient;
119
146
  var C;
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 o(a) {
157
+ return await c().prefetchQuery(a), t(a.queryKey);
131
158
  }
132
- e.prefetchQuery = r;
133
- async function a(o) {
134
- return await s().prefetchInfiniteQuery(o), n(o.queryKey);
159
+ e.prefetchQuery = o;
160
+ async function r(a) {
161
+ return await c().prefetchInfiniteQuery(a), n(a.queryKey);
135
162
  }
136
- e.prefetchInfiniteQuery = a;
137
- function u(o) {
163
+ e.prefetchInfiniteQuery = r;
164
+ function u(a) {
138
165
  return {
139
- prefetch: () => r(o),
140
- getData: () => t(o.queryKey),
141
- useClientQuery: () => Q(o),
142
- fetchAndGet: () => s().fetchQuery(o)
166
+ prefetch: () => o(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: () => _(o),
151
- fetchAndGet: () => s().fetchInfiniteQuery(o)
175
+ prefetch: () => r(a),
176
+ getData: () => n(a.queryKey),
177
+ useClientQuery: () => T(a),
178
+ fetchAndGet: () => c().fetchInfiniteQuery(a)
152
179
  };
153
180
  }
154
- e.generateClientServerInfiniteQuery = l;
181
+ e.generateClientServerInfiniteQuery = i;
155
182
  })(C || (C = {}));
156
- function V(e) {
157
- return I(
183
+ function Y(e) {
184
+ return N(
158
185
  ["accounts", "update"],
159
186
  e,
160
187
  ({
@@ -176,36 +203,36 @@ 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
- let r;
216
+ let o;
190
217
  try {
191
- r = await i.hiveClient.database.call(
218
+ o = 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 r = await s.hiveClient.call(
198
225
  "condenser_api",
199
226
  "get_account_reputations",
200
227
  [e, 1]
201
228
  );
202
229
  return {
203
230
  ...t,
204
- follow_stats: r,
205
- reputation: a[0].reputation,
231
+ follow_stats: o,
232
+ reputation: r[0].reputation,
206
233
  profile: {
207
234
  ...n,
208
- reputation: a[0].reputation
235
+ reputation: r[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
+ (r) => n.length > 0 ? !n.includes(r) : !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, o) {
288
+ return y({
289
+ mutationKey: [],
290
+ mutationFn: async (r) => {
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
+ ...r === "toggle-ignore" && !(i != null && i.ignores) ? ["ignore"] : [],
306
+ ...r === "toggle-follow" && !(i != null && i.follows) ? ["blog"] : []
307
+ ]
308
+ }
309
+ ]), {
310
+ ...i,
311
+ ignores: r === "toggle-ignore" ? !(i != null && i.ignores) : i == null ? void 0 : i.ignores,
312
+ follows: r === "toggle-follow" ? !(i != null && i.follows) : i == null ? void 0 : i.follows
313
+ };
314
+ },
315
+ onError: o,
316
+ onSuccess(r) {
317
+ n(r), c().setQueryData(
318
+ ["accounts", "relations", e, t],
319
+ r
320
+ );
321
+ }
322
+ });
323
+ }
324
+ function ne(e) {
325
+ return y({
249
326
  mutationKey: ["operations", "sign", e],
250
327
  mutationFn: ({
251
328
  operation: t,
@@ -253,15 +330,15 @@ function Z(e) {
253
330
  }) => {
254
331
  if (!e)
255
332
  throw new Error("[Operations][Sign] – cannot sign op with anon user");
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(
333
+ let o;
334
+ return n.split(" ").length === 12 ? o = h.fromLogin(e, n, "active") : F.isWif(n) ? o = h.fromString(n) : o = h.from(n), s.hiveClient.broadcast.sendOperations(
258
335
  [t],
259
- r
336
+ o
260
337
  );
261
338
  }
262
339
  });
263
340
  }
264
- function N() {
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,46 @@ function N() {
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, o = null) => new Promise((r, 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" }), r(a);
280
357
  },
281
- r
358
+ o
282
359
  );
283
- }), ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
360
+ }), oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
284
361
  __proto__: null,
285
- broadcast: q,
286
- handshake: N
362
+ broadcast: b,
363
+ handshake: B
287
364
  }, Symbol.toStringTag, { value: "Module" }));
288
- function te(e, t = "Active") {
289
- return p({
365
+ function re(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(e, t) {
385
+ return p({
309
386
  queryKey: ["hive-engine", "tokens-list", e, t],
310
387
  queryFn: async () => (await (await fetch(
311
- `${i.privateApiHost}/private-api/engine-api`,
388
+ `${s.privateApiHost}/private-api/engine-api`,
312
389
  {
313
390
  method: "POST",
314
391
  body: JSON.stringify({
@@ -329,11 +406,11 @@ function re(e, t) {
329
406
  )).json()).result
330
407
  });
331
408
  }
332
- function oe(e = 20) {
333
- return k({
409
+ function ae(e = 20) {
410
+ return j({
334
411
  queryKey: ["posts", "trending-tags"],
335
- queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
336
- (n) => n.filter((r) => r.name !== "").filter((r) => !r.name.startsWith("hive-")).map((r) => r.name)
412
+ queryFn: async ({ pageParam: { afterTag: t } }) => s.hiveClient.database.call("get_trending_tags", [t, e]).then(
413
+ (n) => n.filter((o) => o.name !== "").filter((o) => !o.name.startsWith("hive-")).map((o) => o.name)
337
414
  ),
338
415
  initialPageParam: { afterTag: "" },
339
416
  getNextPageParam: (t) => ({
@@ -343,15 +420,15 @@ function oe(e = 20) {
343
420
  refetchOnMount: !0
344
421
  });
345
422
  }
346
- function m(e) {
347
- return c({
423
+ function v(e) {
424
+ return p({
348
425
  queryKey: ["posts", "fragments", e],
349
426
  queryFn: async () => (await fetch(
350
- i.privateApiHost + "/private-api/fragments",
427
+ s.privateApiHost + "/private-api/fragments",
351
428
  {
352
429
  method: "POST",
353
430
  body: JSON.stringify({
354
- code: y(e)
431
+ code: l(e)
355
432
  }),
356
433
  headers: {
357
434
  "Content-Type": "application/json"
@@ -361,15 +438,15 @@ function m(e) {
361
438
  enabled: !!e
362
439
  });
363
440
  }
364
- function ie(e) {
365
- return p({
441
+ function ce(e) {
442
+ return y({
366
443
  mutationKey: ["posts", "add-fragment", e],
367
444
  mutationFn: async ({ title: t, body: n }) => (await fetch(
368
- i.privateApiHost + "/private-api/fragments-add",
445
+ s.privateApiHost + "/private-api/fragments-add",
369
446
  {
370
447
  method: "POST",
371
448
  body: JSON.stringify({
372
- code: y(e),
449
+ code: l(e),
373
450
  title: t,
374
451
  body: n
375
452
  }),
@@ -379,25 +456,25 @@ function ie(e) {
379
456
  }
380
457
  )).json(),
381
458
  onSuccess(t) {
382
- s().setQueryData(
383
- m(e).queryKey,
459
+ c().setQueryData(
460
+ v(e).queryKey,
384
461
  (n) => [t, ...n ?? []]
385
462
  );
386
463
  }
387
464
  });
388
465
  }
389
- function ae(e, t) {
390
- return p({
466
+ function ue(e, t) {
467
+ return y({
391
468
  mutationKey: ["posts", "edit-fragment", e, t],
392
- mutationFn: async ({ title: n, body: r }) => (await fetch(
393
- i.privateApiHost + "/private-api/fragments-update",
469
+ mutationFn: async ({ title: n, body: o }) => (await fetch(
470
+ s.privateApiHost + "/private-api/fragments-update",
394
471
  {
395
472
  method: "POST",
396
473
  body: JSON.stringify({
397
- code: y(e),
474
+ code: l(e),
398
475
  id: t,
399
476
  title: n,
400
- body: r
477
+ body: o
401
478
  }),
402
479
  headers: {
403
480
  "Content-Type": "application/json"
@@ -405,25 +482,25 @@ function ae(e, t) {
405
482
  }
406
483
  )).json(),
407
484
  onSuccess(n) {
408
- s().setQueryData(
409
- m(e).queryKey,
410
- (r) => {
411
- if (!r)
485
+ c().setQueryData(
486
+ v(e).queryKey,
487
+ (o) => {
488
+ if (!o)
412
489
  return [];
413
- const a = r.findIndex(({ id: u }) => u === t);
414
- return a >= 0 && (r[a] = n), [...r];
490
+ const r = o.findIndex(({ id: u }) => u === t);
491
+ return r >= 0 && (o[r] = n), [...o];
415
492
  }
416
493
  );
417
494
  }
418
495
  });
419
496
  }
420
- function se(e, t) {
421
- return p({
497
+ function pe(e, t) {
498
+ return y({
422
499
  mutationKey: ["posts", "remove-fragment", e],
423
- mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
500
+ mutationFn: async () => fetch(s.privateApiHost + "/private-api/fragments-delete", {
424
501
  method: "POST",
425
502
  body: JSON.stringify({
426
- code: y(e),
503
+ code: l(e),
427
504
  id: t
428
505
  }),
429
506
  headers: {
@@ -431,20 +508,20 @@ function se(e, t) {
431
508
  }
432
509
  }),
433
510
  onSuccess() {
434
- s().setQueryData(
435
- m(e).queryKey,
436
- (n) => [...n ?? []].filter(({ id: r }) => r !== t)
511
+ c().setQueryData(
512
+ v(e).queryKey,
513
+ (n) => [...n ?? []].filter(({ id: o }) => o !== t)
437
514
  );
438
515
  }
439
516
  });
440
517
  }
441
- function H(e, t) {
442
- return p({
518
+ function K(e, t) {
519
+ return y({
443
520
  mutationKey: ["analytics", t],
444
521
  mutationFn: async () => {
445
522
  if (!t)
446
523
  throw new Error("[SDK][Analytics] – no activity type provided");
447
- await fetch(i.plausibleHost + "/api/event", {
524
+ await fetch(s.plausibleHost + "/api/event", {
448
525
  method: "POST",
449
526
  headers: {
450
527
  "Content-Type": "application/json"
@@ -461,30 +538,30 @@ function H(e, t) {
461
538
  }
462
539
  });
463
540
  }
464
- const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
541
+ const ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
465
542
  __proto__: null,
466
- useRecordActivity: H
543
+ useRecordActivity: K
467
544
  }, Symbol.toStringTag, { value: "Module" }));
468
- function J(e, t) {
469
- return c({
545
+ function E(e, t) {
546
+ return p({
470
547
  queryKey: ["integrations", "hivesigner", "decode-memo", e],
471
548
  queryFn: async () => {
472
- const n = y(e);
549
+ const n = l(e);
473
550
  if (n)
474
- return new w.Client({
551
+ return new d.Client({
475
552
  accessToken: n
476
553
  }).decode(t);
477
554
  }
478
555
  });
479
556
  }
480
- const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
557
+ const M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
481
558
  __proto__: null,
482
- getDecodeMemoQueryOptions: J
483
- }, Symbol.toStringTag, { value: "Module" })), M = {
484
- queries: E
559
+ getDecodeMemoQueryOptions: E
560
+ }, Symbol.toStringTag, { value: "Module" })), x = {
561
+ queries: M
485
562
  };
486
- function g(e) {
487
- return c({
563
+ function w(e) {
564
+ return p({
488
565
  queryKey: ["integrations", "3speak", "authenticate", e],
489
566
  enabled: !!e,
490
567
  queryFn: async () => {
@@ -497,28 +574,28 @@ function g(e) {
497
574
  "Content-Type": "application/json"
498
575
  }
499
576
  }
500
- ), n = M.queries.getDecodeMemoQueryOptions(
577
+ ), n = x.queries.getDecodeMemoQueryOptions(
501
578
  e,
502
579
  (await t.json()).memo
503
580
  );
504
- await s().prefetchQuery(n);
505
- const { memoDecoded: r } = s().getQueryData(
581
+ await c().prefetchQuery(n);
582
+ const { memoDecoded: o } = c().getQueryData(
506
583
  n.queryKey
507
584
  );
508
- return r.replace("#", "");
585
+ return o.replace("#", "");
509
586
  }
510
587
  });
511
588
  }
512
- function B(e) {
513
- return c({
589
+ function G(e) {
590
+ return p({
514
591
  queryKey: ["integrations", "3speak", "videos", e],
515
592
  enabled: !!e,
516
593
  queryFn: async () => {
517
- await s().prefetchQuery(
518
- g(e)
594
+ await c().prefetchQuery(
595
+ w(e)
519
596
  );
520
- const t = s().getQueryData(
521
- g(e).queryKey
597
+ const t = c().getQueryData(
598
+ w(e).queryKey
522
599
  );
523
600
  return await (await fetch(
524
601
  "https://studio.3speak.tv/mobile/api/my-videos",
@@ -532,44 +609,44 @@ function B(e) {
532
609
  }
533
610
  });
534
611
  }
535
- const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
612
+ const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
536
613
  __proto__: null,
537
- getAccountTokenQueryOptions: g,
538
- getAccountVideosQueryOptions: B
539
- }, Symbol.toStringTag, { value: "Module" })), ue = {
540
- queries: x
614
+ getAccountTokenQueryOptions: w,
615
+ getAccountVideosQueryOptions: G
616
+ }, Symbol.toStringTag, { value: "Module" })), le = {
617
+ queries: U
541
618
  };
542
- function pe() {
543
- return c({
619
+ function fe() {
620
+ return p({
544
621
  queryKey: ["resource-credits", "stats"],
545
- queryFn: async () => (await i.hiveClient.call(
622
+ queryFn: async () => (await s.hiveClient.call(
546
623
  "rc_api",
547
624
  "get_rc_stats",
548
625
  {}
549
626
  )).rc_stats
550
627
  });
551
628
  }
552
- function ye(e) {
553
- return c({
629
+ function he(e) {
630
+ return p({
554
631
  queryKey: ["resource-credits", "account", e],
555
- queryFn: async () => new A(i.hiveClient).findRCAccounts([e]),
632
+ queryFn: async () => new D(s.hiveClient).findRCAccounts([e]),
556
633
  enabled: !!e
557
634
  });
558
635
  }
559
- function le(e, t) {
560
- return c({
636
+ function de(e, t) {
637
+ return p({
561
638
  queryKey: ["games", "status-check", t, e],
562
639
  enabled: !!e,
563
640
  queryFn: async () => {
564
641
  if (!e)
565
642
  throw new Error("[SDK][Games] – anon user in status check");
566
643
  return await (await fetch(
567
- i.privateApiHost + "/private-api/get-game",
644
+ s.privateApiHost + "/private-api/get-game",
568
645
  {
569
646
  method: "POST",
570
647
  body: JSON.stringify({
571
648
  game_type: t,
572
- code: y(e)
649
+ code: l(e)
573
650
  }),
574
651
  headers: {
575
652
  "Content-Type": "application/json"
@@ -579,19 +656,23 @@ function le(e, t) {
579
656
  }
580
657
  });
581
658
  }
582
- function fe(e, t, n) {
583
- return p({
659
+ function ge(e, t, n) {
660
+ const { mutateAsync: o } = K(
661
+ e,
662
+ "spin-rolled"
663
+ );
664
+ return y({
584
665
  mutationKey: ["games", "post", t, e],
585
666
  mutationFn: async () => {
586
667
  if (!e)
587
668
  throw new Error("[SDK][Games] – anon user in game post");
588
669
  return await (await fetch(
589
- i.privateApiHost + "/private-api/post-game",
670
+ s.privateApiHost + "/private-api/post-game",
590
671
  {
591
672
  method: "POST",
592
673
  body: JSON.stringify({
593
674
  game_type: t,
594
- code: y(e),
675
+ code: l(e),
595
676
  key: n
596
677
  }),
597
678
  headers: {
@@ -599,39 +680,45 @@ function fe(e, t, n) {
599
680
  }
600
681
  }
601
682
  )).json();
683
+ },
684
+ onSuccess() {
685
+ o();
602
686
  }
603
687
  });
604
688
  }
605
689
  export {
606
- i as CONFIG,
690
+ s as CONFIG,
607
691
  O as ConfigManager,
608
- ce as EcencyAnalytics,
692
+ ye as EcencyAnalytics,
609
693
  C as EcencyQueriesManager,
610
- M as HiveSignerIntegration,
611
- ee as Keychain,
612
- ue as ThreeSpeakIntegration,
613
- Y as checkUsernameWalletsPendingQueryOptions,
614
- y as getAccessToken,
615
- L as getAccountFullQueryOptions,
616
- ye as getAccountRcQueryOptions,
617
- m as getFragmentsQueryOptions,
618
- le as getGameStatusCheckQueryOptions,
619
- re as getHiveEngineTokensListQueryOptions,
620
- P as getPostingKey,
621
- s as getQueryClient,
622
- pe as getRcStatsQueryOptions,
623
- W as getRefreshToken,
624
- X as getSearchAccountsByUsernameQueryOptions,
625
- oe as getTrendingTagsQueryOptions,
694
+ x as HiveSignerIntegration,
695
+ oe as Keychain,
696
+ le as ThreeSpeakIntegration,
697
+ J as broadcastJson,
698
+ ee as checkUsernameWalletsPendingQueryOptions,
699
+ l as getAccessToken,
700
+ Z as getAccountFullQueryOptions,
701
+ he as getAccountRcQueryOptions,
702
+ v as getFragmentsQueryOptions,
703
+ de as getGameStatusCheckQueryOptions,
704
+ se as getHiveEngineTokensListQueryOptions,
705
+ q as getPostingKey,
706
+ c as getQueryClient,
707
+ fe as getRcStatsQueryOptions,
708
+ L as getRefreshToken,
709
+ H as getRelationshipBetweenAccountsQueryOptions,
710
+ R as getSearchAccountsByUsernameQueryOptions,
711
+ ae as getTrendingTagsQueryOptions,
626
712
  f as getUser,
627
- $ as makeQueryClient,
628
- V as useAccountUpdate,
629
- ie as useAddFragment,
630
- I as useBroadcastMutation,
631
- ae as useEditFragment,
632
- fe as useGameClaim,
633
- se as useRemoveFragment,
634
- ne as useSignOperationByHivesigner,
635
- Z as useSignOperationByKey,
636
- te as useSignOperationByKeychain
713
+ X as makeQueryClient,
714
+ te as useAccountRelationsUpdate,
715
+ Y as useAccountUpdate,
716
+ ce as useAddFragment,
717
+ N as useBroadcastMutation,
718
+ ue as useEditFragment,
719
+ ge as useGameClaim,
720
+ pe as useRemoveFragment,
721
+ ie as useSignOperationByHivesigner,
722
+ ne as useSignOperationByKey,
723
+ re as useSignOperationByKeychain
637
724
  };
@@ -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';
@@ -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 {};
@@ -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';
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.43",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",