@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.
package/dist/ecency-sdk.es.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
import { QueryClient as
|
5
|
-
import { Client as
|
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
|
7
|
+
class I {
|
8
8
|
constructor() {
|
9
|
-
|
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
|
27
|
+
const a = {
|
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 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
|
52
|
+
queryClient: new q(),
|
53
53
|
plausibleHost: "https://pl.ecency.com"
|
54
54
|
};
|
55
|
-
var
|
55
|
+
var O;
|
56
56
|
((e) => {
|
57
57
|
function t(n) {
|
58
|
-
|
58
|
+
a.queryClient = n;
|
59
59
|
}
|
60
60
|
e.setQueryClient = t;
|
61
|
-
})(
|
62
|
-
function
|
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 =
|
70
|
-
|
69
|
+
const t = a.storage.getItem(
|
70
|
+
a.storagePrefix + "_user_" + e
|
71
71
|
);
|
72
|
-
return
|
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,
|
78
|
-
function
|
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 (
|
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
|
87
|
-
if (
|
88
|
-
const
|
89
|
-
return
|
90
|
-
n(
|
91
|
-
|
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
|
-
|
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:
|
98
|
-
}).broadcast(n(
|
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
|
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
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
-
|
124
|
-
if (
|
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:
|
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
|
133
|
-
return new
|
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 = () =>
|
146
|
-
var
|
175
|
+
const c = () => a.queryClient;
|
176
|
+
var S;
|
147
177
|
((e) => {
|
148
|
-
function t(
|
149
|
-
return c().getQueryData(
|
178
|
+
function t(r) {
|
179
|
+
return c().getQueryData(r);
|
150
180
|
}
|
151
181
|
e.getQueryData = t;
|
152
|
-
function n(
|
153
|
-
return c().getQueryData(
|
182
|
+
function n(r) {
|
183
|
+
return c().getQueryData(r);
|
154
184
|
}
|
155
185
|
e.getInfiniteQueryData = n;
|
156
|
-
async function r
|
157
|
-
return await c().prefetchQuery(
|
186
|
+
async function o(r) {
|
187
|
+
return await c().prefetchQuery(r), t(r.queryKey);
|
158
188
|
}
|
159
|
-
e.prefetchQuery =
|
160
|
-
async function
|
161
|
-
return await c().prefetchInfiniteQuery(
|
189
|
+
e.prefetchQuery = o;
|
190
|
+
async function s(r) {
|
191
|
+
return await c().prefetchInfiniteQuery(r), n(r.queryKey);
|
162
192
|
}
|
163
|
-
e.prefetchInfiniteQuery =
|
164
|
-
function u(
|
193
|
+
e.prefetchInfiniteQuery = s;
|
194
|
+
function u(r) {
|
165
195
|
return {
|
166
|
-
prefetch: () => r
|
167
|
-
getData: () => t(
|
168
|
-
useClientQuery: () =>
|
169
|
-
fetchAndGet: () => c().fetchQuery(
|
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(
|
203
|
+
function i(r) {
|
174
204
|
return {
|
175
|
-
prefetch: () =>
|
176
|
-
getData: () => n(
|
177
|
-
useClientQuery: () =>
|
178
|
-
fetchAndGet: () => c().fetchInfiniteQuery(
|
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
|
-
})(
|
183
|
-
function
|
184
|
-
return
|
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
|
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
|
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
|
246
|
+
let o;
|
217
247
|
try {
|
218
|
-
|
248
|
+
o = await a.hiveClient.database.call(
|
219
249
|
"get_follow_count",
|
220
250
|
[e]
|
221
251
|
);
|
222
252
|
} catch {
|
223
253
|
}
|
224
|
-
const
|
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:
|
232
|
-
reputation:
|
261
|
+
follow_stats: o,
|
262
|
+
reputation: s[0].reputation,
|
233
263
|
profile: {
|
234
264
|
...n,
|
235
|
-
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
|
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
|
277
|
+
queryFn: async () => (await a.hiveClient.database.call(
|
248
278
|
"lookup_accounts",
|
249
279
|
[e, t]
|
250
280
|
)).filter(
|
251
|
-
(
|
281
|
+
(s) => n.length > 0 ? !n.includes(s) : !0
|
252
282
|
)
|
253
283
|
});
|
254
284
|
}
|
255
|
-
function
|
285
|
+
function ne(e) {
|
256
286
|
return p({
|
257
287
|
queryKey: ["accounts", "check-wallet-pending", e],
|
258
288
|
queryFn: async () => await (await fetch(
|
259
|
-
|
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
|
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
|
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
|
317
|
+
function oe(e, t, n, o) {
|
288
318
|
return y({
|
289
319
|
mutationKey: [],
|
290
|
-
mutationFn: async (
|
291
|
-
const u =
|
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
|
329
|
+
return await E(e, "follow", [
|
300
330
|
"follow",
|
301
331
|
{
|
302
332
|
follower: e,
|
303
333
|
following: t,
|
304
334
|
what: [
|
305
|
-
...
|
306
|
-
...
|
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:
|
312
|
-
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:
|
316
|
-
onSuccess(
|
317
|
-
n(
|
345
|
+
onError: o,
|
346
|
+
onSuccess(s) {
|
347
|
+
n(s), c().setQueryData(
|
318
348
|
["accounts", "relations", e, t],
|
319
|
-
|
349
|
+
s
|
320
350
|
);
|
321
351
|
}
|
322
352
|
});
|
323
353
|
}
|
324
|
-
function
|
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
|
334
|
-
return n.split(" ").length === 12 ?
|
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
|
-
|
366
|
+
o
|
337
367
|
);
|
338
368
|
}
|
339
369
|
});
|
340
370
|
}
|
341
|
-
function
|
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
|
379
|
+
return g(e, [n], t);
|
374
380
|
}
|
375
381
|
});
|
376
382
|
}
|
377
|
-
function
|
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
|
390
|
+
function ae() {
|
385
391
|
return p({
|
386
392
|
queryKey: ["operations", "chain-properties"],
|
387
|
-
queryFn: async () => await
|
393
|
+
queryFn: async () => await a.hiveClient.database.getChainProperties()
|
388
394
|
});
|
389
395
|
}
|
390
|
-
function
|
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
|
-
`${
|
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
|
416
|
-
return
|
421
|
+
function ue(e = 20) {
|
422
|
+
return A({
|
417
423
|
queryKey: ["posts", "trending-tags"],
|
418
|
-
queryFn: async ({ pageParam: { afterTag: t } }) =>
|
419
|
-
(n) => n.filter((
|
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
|
435
|
+
function m(e) {
|
430
436
|
return p({
|
431
437
|
queryKey: ["posts", "fragments", e],
|
432
438
|
queryFn: async () => (await fetch(
|
433
|
-
|
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
|
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
|
-
|
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
|
-
|
488
|
+
m(e).queryKey,
|
467
489
|
(n) => [t, ...n ?? []]
|
468
490
|
);
|
469
491
|
}
|
470
492
|
});
|
471
493
|
}
|
472
|
-
function
|
494
|
+
function le(e, t) {
|
473
495
|
return y({
|
474
496
|
mutationKey: ["posts", "edit-fragment", e, t],
|
475
|
-
mutationFn: async ({ title: n, body:
|
476
|
-
|
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:
|
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
|
-
|
493
|
-
(
|
494
|
-
if (!
|
514
|
+
m(e).queryKey,
|
515
|
+
(o) => {
|
516
|
+
if (!o)
|
495
517
|
return [];
|
496
|
-
const
|
497
|
-
return
|
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
|
525
|
+
function fe(e, t) {
|
504
526
|
return y({
|
505
527
|
mutationKey: ["posts", "remove-fragment", e],
|
506
|
-
mutationFn: async () => fetch(
|
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
|
-
|
519
|
-
(n) => [...n ?? []].filter(({ id:
|
540
|
+
m(e).queryKey,
|
541
|
+
(n) => [...n ?? []].filter(({ id: o }) => o !== t)
|
520
542
|
);
|
521
543
|
}
|
522
544
|
});
|
523
545
|
}
|
524
|
-
function
|
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(
|
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
|
569
|
+
const he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
548
570
|
__proto__: null,
|
549
|
-
useRecordActivity:
|
571
|
+
useRecordActivity: Q
|
550
572
|
}, Symbol.toStringTag, { value: "Module" }));
|
551
|
-
function
|
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
|
585
|
+
const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
564
586
|
__proto__: null,
|
565
|
-
getDecodeMemoQueryOptions:
|
566
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
567
|
-
queries:
|
587
|
+
getDecodeMemoQueryOptions: M
|
588
|
+
}, Symbol.toStringTag, { value: "Module" })), G = {
|
589
|
+
queries: x
|
568
590
|
};
|
569
|
-
function
|
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 =
|
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:
|
610
|
+
const { memoDecoded: o } = c().getQueryData(
|
589
611
|
n.queryKey
|
590
612
|
);
|
591
|
-
return
|
613
|
+
return o.replace("#", "");
|
592
614
|
}
|
593
615
|
});
|
594
616
|
}
|
595
|
-
function
|
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
|
-
|
623
|
+
v(e)
|
602
624
|
);
|
603
625
|
const t = c().getQueryData(
|
604
|
-
|
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
|
640
|
+
const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
619
641
|
__proto__: null,
|
620
|
-
getAccountTokenQueryOptions:
|
621
|
-
getAccountVideosQueryOptions:
|
622
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
623
|
-
queries:
|
642
|
+
getAccountTokenQueryOptions: v,
|
643
|
+
getAccountVideosQueryOptions: U
|
644
|
+
}, Symbol.toStringTag, { value: "Module" })), de = {
|
645
|
+
queries: z
|
624
646
|
};
|
625
|
-
function
|
647
|
+
function ge() {
|
626
648
|
return p({
|
627
649
|
queryKey: ["resource-credits", "stats"],
|
628
|
-
queryFn: async () => (await
|
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
|
657
|
+
function we(e) {
|
636
658
|
return p({
|
637
659
|
queryKey: ["resource-credits", "account", e],
|
638
|
-
queryFn: async () => new
|
660
|
+
queryFn: async () => new P(a.hiveClient).findRCAccounts([e]),
|
639
661
|
enabled: !!e
|
640
662
|
});
|
641
663
|
}
|
642
|
-
function
|
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
|
-
|
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
|
666
|
-
const { mutateAsync:
|
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
|
-
|
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
|
-
|
713
|
+
o();
|
692
714
|
}
|
693
715
|
});
|
694
716
|
}
|
695
717
|
export {
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
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
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
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
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
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
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
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
|
};
|
@@ -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
|
+
};
|