@ecency/sdk 1.0.44 → 1.0.46

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