@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.
- package/dist/ecency-sdk.es.js +285 -198
- package/dist/modules/accounts/mutations/index.d.ts +1 -0
- package/dist/modules/accounts/mutations/use-account-relations-update.d.ts +9 -0
- package/dist/modules/accounts/queries/get-relationship-between-accounts-query-options.d.ts +9 -0
- package/dist/modules/accounts/queries/index.d.ts +1 -0
- package/dist/modules/accounts/types/account-relationship.d.ts +6 -0
- package/dist/modules/accounts/types/index.d.ts +1 -0
- package/dist/modules/analytics/mutations/use-record-activity.d.ts +1 -1
- package/dist/modules/core/mutations/broadcast-json.d.ts +1 -0
- package/dist/modules/core/mutations/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/ecency-sdk.es.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
import { QueryClient as S, useMutation as
|
5
|
-
import { Client as
|
6
|
-
import
|
7
|
-
class
|
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
|
-
|
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
|
27
|
+
const s = {
|
28
28
|
privateApiHost: "https://ecency.com",
|
29
|
-
storage: typeof window > "u" ? new
|
29
|
+
storage: typeof window > "u" ? new I() : window.localStorage,
|
30
30
|
storagePrefix: "ecency",
|
31
|
-
hiveClient: new
|
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
|
-
|
58
|
+
s.queryClient = n;
|
59
59
|
}
|
60
60
|
e.setQueryClient = t;
|
61
61
|
})(O || (O = {}));
|
62
|
-
function
|
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 =
|
70
|
-
|
69
|
+
const t = s.storage.getItem(
|
70
|
+
s.storagePrefix + "_user_" + e
|
71
71
|
);
|
72
|
-
return
|
72
|
+
return P(JSON.parse(t));
|
73
73
|
} catch (t) {
|
74
74
|
console.error(t);
|
75
75
|
return;
|
76
76
|
}
|
77
|
-
},
|
78
|
-
function
|
79
|
-
return
|
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 (
|
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
|
87
|
-
if (
|
88
|
-
const
|
89
|
-
return
|
90
|
-
n(
|
91
|
-
|
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 =
|
94
|
+
let u = l(t);
|
95
95
|
if (u)
|
96
|
-
return (await new
|
96
|
+
return (await new d.Client({
|
97
97
|
accessToken: u
|
98
|
-
}).broadcast(n(
|
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
|
145
|
+
const c = () => s.queryClient;
|
119
146
|
var C;
|
120
147
|
((e) => {
|
121
|
-
function t(
|
122
|
-
return
|
148
|
+
function t(a) {
|
149
|
+
return c().getQueryData(a);
|
123
150
|
}
|
124
151
|
e.getQueryData = t;
|
125
|
-
function n(
|
126
|
-
return
|
152
|
+
function n(a) {
|
153
|
+
return c().getQueryData(a);
|
127
154
|
}
|
128
155
|
e.getInfiniteQueryData = n;
|
129
|
-
async function
|
130
|
-
return await
|
156
|
+
async function o(a) {
|
157
|
+
return await c().prefetchQuery(a), t(a.queryKey);
|
131
158
|
}
|
132
|
-
e.prefetchQuery =
|
133
|
-
async function a
|
134
|
-
return await
|
159
|
+
e.prefetchQuery = o;
|
160
|
+
async function r(a) {
|
161
|
+
return await c().prefetchInfiniteQuery(a), n(a.queryKey);
|
135
162
|
}
|
136
|
-
e.prefetchInfiniteQuery =
|
137
|
-
function u(
|
163
|
+
e.prefetchInfiniteQuery = r;
|
164
|
+
function u(a) {
|
138
165
|
return {
|
139
|
-
prefetch: () =>
|
140
|
-
getData: () => t(
|
141
|
-
useClientQuery: () =>
|
142
|
-
fetchAndGet: () =>
|
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
|
173
|
+
function i(a) {
|
147
174
|
return {
|
148
|
-
prefetch: () => a
|
149
|
-
getData: () => n(
|
150
|
-
useClientQuery: () =>
|
151
|
-
fetchAndGet: () =>
|
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 =
|
181
|
+
e.generateClientServerInfiniteQuery = i;
|
155
182
|
})(C || (C = {}));
|
156
|
-
function
|
157
|
-
return
|
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
|
180
|
-
return
|
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
|
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
|
216
|
+
let o;
|
190
217
|
try {
|
191
|
-
|
218
|
+
o = await s.hiveClient.database.call(
|
192
219
|
"get_follow_count",
|
193
220
|
[e]
|
194
221
|
);
|
195
222
|
} catch {
|
196
223
|
}
|
197
|
-
const
|
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:
|
205
|
-
reputation:
|
231
|
+
follow_stats: o,
|
232
|
+
reputation: r[0].reputation,
|
206
233
|
profile: {
|
207
234
|
...n,
|
208
|
-
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
|
217
|
-
return
|
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
|
247
|
+
queryFn: async () => (await s.hiveClient.database.call(
|
221
248
|
"lookup_accounts",
|
222
249
|
[e, t]
|
223
250
|
)).filter(
|
224
|
-
(
|
251
|
+
(r) => n.length > 0 ? !n.includes(r) : !0
|
225
252
|
)
|
226
253
|
});
|
227
254
|
}
|
228
|
-
function
|
229
|
-
return
|
255
|
+
function ee(e) {
|
256
|
+
return p({
|
230
257
|
queryKey: ["accounts", "check-wallet-pending", e],
|
231
258
|
queryFn: async () => await (await fetch(
|
232
|
-
|
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
|
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
|
257
|
-
return n.split(" ").length === 12 ?
|
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
|
-
|
336
|
+
o
|
260
337
|
);
|
261
338
|
}
|
262
339
|
});
|
263
340
|
}
|
264
|
-
function
|
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
|
273
|
-
var
|
274
|
-
(
|
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
|
-
(
|
279
|
-
|
355
|
+
(a) => {
|
356
|
+
a.success || u({ message: "Operation cancelled" }), r(a);
|
280
357
|
},
|
281
|
-
|
358
|
+
o
|
282
359
|
);
|
283
|
-
}),
|
360
|
+
}), oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
284
361
|
__proto__: null,
|
285
|
-
broadcast:
|
286
|
-
handshake:
|
362
|
+
broadcast: b,
|
363
|
+
handshake: B
|
287
364
|
}, Symbol.toStringTag, { value: "Module" }));
|
288
|
-
function
|
289
|
-
return
|
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
|
373
|
+
return b(e, [n], t);
|
297
374
|
}
|
298
375
|
});
|
299
376
|
}
|
300
|
-
function
|
301
|
-
return
|
377
|
+
function ie(e = "/") {
|
378
|
+
return y({
|
302
379
|
mutationKey: ["operations", "sign-hivesigner", e],
|
303
|
-
mutationFn: async ({ operation: t }) =>
|
380
|
+
mutationFn: async ({ operation: t }) => d.sendOperation(t, { callback: e }, () => {
|
304
381
|
})
|
305
382
|
});
|
306
383
|
}
|
307
|
-
function
|
308
|
-
return
|
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
|
-
`${
|
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
|
333
|
-
return
|
409
|
+
function ae(e = 20) {
|
410
|
+
return j({
|
334
411
|
queryKey: ["posts", "trending-tags"],
|
335
|
-
queryFn: async ({ pageParam: { afterTag: t } }) =>
|
336
|
-
(n) => n.filter((
|
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
|
347
|
-
return
|
423
|
+
function v(e) {
|
424
|
+
return p({
|
348
425
|
queryKey: ["posts", "fragments", e],
|
349
426
|
queryFn: async () => (await fetch(
|
350
|
-
|
427
|
+
s.privateApiHost + "/private-api/fragments",
|
351
428
|
{
|
352
429
|
method: "POST",
|
353
430
|
body: JSON.stringify({
|
354
|
-
code:
|
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
|
365
|
-
return
|
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
|
-
|
445
|
+
s.privateApiHost + "/private-api/fragments-add",
|
369
446
|
{
|
370
447
|
method: "POST",
|
371
448
|
body: JSON.stringify({
|
372
|
-
code:
|
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
|
-
|
383
|
-
|
459
|
+
c().setQueryData(
|
460
|
+
v(e).queryKey,
|
384
461
|
(n) => [t, ...n ?? []]
|
385
462
|
);
|
386
463
|
}
|
387
464
|
});
|
388
465
|
}
|
389
|
-
function
|
390
|
-
return
|
466
|
+
function ue(e, t) {
|
467
|
+
return y({
|
391
468
|
mutationKey: ["posts", "edit-fragment", e, t],
|
392
|
-
mutationFn: async ({ title: n, body:
|
393
|
-
|
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:
|
474
|
+
code: l(e),
|
398
475
|
id: t,
|
399
476
|
title: n,
|
400
|
-
body:
|
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
|
-
|
409
|
-
|
410
|
-
(
|
411
|
-
if (!
|
485
|
+
c().setQueryData(
|
486
|
+
v(e).queryKey,
|
487
|
+
(o) => {
|
488
|
+
if (!o)
|
412
489
|
return [];
|
413
|
-
const
|
414
|
-
return
|
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
|
421
|
-
return
|
497
|
+
function pe(e, t) {
|
498
|
+
return y({
|
422
499
|
mutationKey: ["posts", "remove-fragment", e],
|
423
|
-
mutationFn: async () => fetch(
|
500
|
+
mutationFn: async () => fetch(s.privateApiHost + "/private-api/fragments-delete", {
|
424
501
|
method: "POST",
|
425
502
|
body: JSON.stringify({
|
426
|
-
code:
|
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
|
-
|
435
|
-
|
436
|
-
(n) => [...n ?? []].filter(({ id:
|
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
|
442
|
-
return
|
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(
|
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
|
541
|
+
const ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
465
542
|
__proto__: null,
|
466
|
-
useRecordActivity:
|
543
|
+
useRecordActivity: K
|
467
544
|
}, Symbol.toStringTag, { value: "Module" }));
|
468
|
-
function
|
469
|
-
return
|
545
|
+
function E(e, t) {
|
546
|
+
return p({
|
470
547
|
queryKey: ["integrations", "hivesigner", "decode-memo", e],
|
471
548
|
queryFn: async () => {
|
472
|
-
const n =
|
549
|
+
const n = l(e);
|
473
550
|
if (n)
|
474
|
-
return new
|
551
|
+
return new d.Client({
|
475
552
|
accessToken: n
|
476
553
|
}).decode(t);
|
477
554
|
}
|
478
555
|
});
|
479
556
|
}
|
480
|
-
const
|
557
|
+
const M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
481
558
|
__proto__: null,
|
482
|
-
getDecodeMemoQueryOptions:
|
483
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
484
|
-
queries:
|
559
|
+
getDecodeMemoQueryOptions: E
|
560
|
+
}, Symbol.toStringTag, { value: "Module" })), x = {
|
561
|
+
queries: M
|
485
562
|
};
|
486
|
-
function
|
487
|
-
return
|
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 =
|
577
|
+
), n = x.queries.getDecodeMemoQueryOptions(
|
501
578
|
e,
|
502
579
|
(await t.json()).memo
|
503
580
|
);
|
504
|
-
await
|
505
|
-
const { memoDecoded:
|
581
|
+
await c().prefetchQuery(n);
|
582
|
+
const { memoDecoded: o } = c().getQueryData(
|
506
583
|
n.queryKey
|
507
584
|
);
|
508
|
-
return
|
585
|
+
return o.replace("#", "");
|
509
586
|
}
|
510
587
|
});
|
511
588
|
}
|
512
|
-
function
|
513
|
-
return
|
589
|
+
function G(e) {
|
590
|
+
return p({
|
514
591
|
queryKey: ["integrations", "3speak", "videos", e],
|
515
592
|
enabled: !!e,
|
516
593
|
queryFn: async () => {
|
517
|
-
await
|
518
|
-
|
594
|
+
await c().prefetchQuery(
|
595
|
+
w(e)
|
519
596
|
);
|
520
|
-
const t =
|
521
|
-
|
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
|
612
|
+
const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
536
613
|
__proto__: null,
|
537
|
-
getAccountTokenQueryOptions:
|
538
|
-
getAccountVideosQueryOptions:
|
539
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
540
|
-
queries:
|
614
|
+
getAccountTokenQueryOptions: w,
|
615
|
+
getAccountVideosQueryOptions: G
|
616
|
+
}, Symbol.toStringTag, { value: "Module" })), le = {
|
617
|
+
queries: U
|
541
618
|
};
|
542
|
-
function
|
543
|
-
return
|
619
|
+
function fe() {
|
620
|
+
return p({
|
544
621
|
queryKey: ["resource-credits", "stats"],
|
545
|
-
queryFn: async () => (await
|
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
|
553
|
-
return
|
629
|
+
function he(e) {
|
630
|
+
return p({
|
554
631
|
queryKey: ["resource-credits", "account", e],
|
555
|
-
queryFn: async () => new
|
632
|
+
queryFn: async () => new D(s.hiveClient).findRCAccounts([e]),
|
556
633
|
enabled: !!e
|
557
634
|
});
|
558
635
|
}
|
559
|
-
function
|
560
|
-
return
|
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
|
-
|
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:
|
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
|
583
|
-
|
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
|
-
|
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:
|
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
|
-
|
690
|
+
s as CONFIG,
|
607
691
|
O as ConfigManager,
|
608
|
-
|
692
|
+
ye as EcencyAnalytics,
|
609
693
|
C as EcencyQueriesManager,
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
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
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
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
|
};
|
@@ -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,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>;
|