@ecency/sdk 1.0.45 → 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 K = (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: K,
|
363
|
-
handshake: E
|
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,12 +450,12 @@ function v(e) {
|
|
444
450
|
enabled: !!e
|
445
451
|
});
|
446
452
|
}
|
447
|
-
function
|
453
|
+
function pe(e = "feed") {
|
448
454
|
return p({
|
449
455
|
queryKey: ["posts", "promoted", e],
|
450
456
|
queryFn: async () => {
|
451
457
|
const t = new URL(
|
452
|
-
|
458
|
+
a.privateApiHost + "/private-api/promoted-entries"
|
453
459
|
);
|
454
460
|
return e === "waves" && t.searchParams.append("short_content", "1"), await (await fetch(t.toString(), {
|
455
461
|
method: "GET",
|
@@ -460,11 +466,11 @@ function ue(e = "feed") {
|
|
460
466
|
}
|
461
467
|
});
|
462
468
|
}
|
463
|
-
function
|
469
|
+
function ye(e) {
|
464
470
|
return y({
|
465
471
|
mutationKey: ["posts", "add-fragment", e],
|
466
472
|
mutationFn: async ({ title: t, body: n }) => (await fetch(
|
467
|
-
|
473
|
+
a.privateApiHost + "/private-api/fragments-add",
|
468
474
|
{
|
469
475
|
method: "POST",
|
470
476
|
body: JSON.stringify({
|
@@ -479,24 +485,24 @@ function pe(e) {
|
|
479
485
|
)).json(),
|
480
486
|
onSuccess(t) {
|
481
487
|
c().setQueryData(
|
482
|
-
|
488
|
+
m(e).queryKey,
|
483
489
|
(n) => [t, ...n ?? []]
|
484
490
|
);
|
485
491
|
}
|
486
492
|
});
|
487
493
|
}
|
488
|
-
function
|
494
|
+
function le(e, t) {
|
489
495
|
return y({
|
490
496
|
mutationKey: ["posts", "edit-fragment", e, t],
|
491
|
-
mutationFn: async ({ title: n, body:
|
492
|
-
|
497
|
+
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
498
|
+
a.privateApiHost + "/private-api/fragments-update",
|
493
499
|
{
|
494
500
|
method: "POST",
|
495
501
|
body: JSON.stringify({
|
496
502
|
code: l(e),
|
497
503
|
id: t,
|
498
504
|
title: n,
|
499
|
-
body:
|
505
|
+
body: o
|
500
506
|
}),
|
501
507
|
headers: {
|
502
508
|
"Content-Type": "application/json"
|
@@ -505,21 +511,21 @@ function ye(e, t) {
|
|
505
511
|
)).json(),
|
506
512
|
onSuccess(n) {
|
507
513
|
c().setQueryData(
|
508
|
-
|
509
|
-
(
|
510
|
-
if (!
|
514
|
+
m(e).queryKey,
|
515
|
+
(o) => {
|
516
|
+
if (!o)
|
511
517
|
return [];
|
512
|
-
const
|
513
|
-
return
|
518
|
+
const s = o.findIndex(({ id: u }) => u === t);
|
519
|
+
return s >= 0 && (o[s] = n), [...o];
|
514
520
|
}
|
515
521
|
);
|
516
522
|
}
|
517
523
|
});
|
518
524
|
}
|
519
|
-
function
|
525
|
+
function fe(e, t) {
|
520
526
|
return y({
|
521
527
|
mutationKey: ["posts", "remove-fragment", e],
|
522
|
-
mutationFn: async () => fetch(
|
528
|
+
mutationFn: async () => fetch(a.privateApiHost + "/private-api/fragments-delete", {
|
523
529
|
method: "POST",
|
524
530
|
body: JSON.stringify({
|
525
531
|
code: l(e),
|
@@ -531,19 +537,19 @@ function le(e, t) {
|
|
531
537
|
}),
|
532
538
|
onSuccess() {
|
533
539
|
c().setQueryData(
|
534
|
-
|
535
|
-
(n) => [...n ?? []].filter(({ id:
|
540
|
+
m(e).queryKey,
|
541
|
+
(n) => [...n ?? []].filter(({ id: o }) => o !== t)
|
536
542
|
);
|
537
543
|
}
|
538
544
|
});
|
539
545
|
}
|
540
|
-
function
|
546
|
+
function Q(e, t) {
|
541
547
|
return y({
|
542
548
|
mutationKey: ["analytics", t],
|
543
549
|
mutationFn: async () => {
|
544
550
|
if (!t)
|
545
551
|
throw new Error("[SDK][Analytics] – no activity type provided");
|
546
|
-
await fetch(
|
552
|
+
await fetch(a.plausibleHost + "/api/event", {
|
547
553
|
method: "POST",
|
548
554
|
headers: {
|
549
555
|
"Content-Type": "application/json"
|
@@ -560,11 +566,11 @@ function b(e, t) {
|
|
560
566
|
}
|
561
567
|
});
|
562
568
|
}
|
563
|
-
const
|
569
|
+
const he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
564
570
|
__proto__: null,
|
565
|
-
useRecordActivity:
|
571
|
+
useRecordActivity: Q
|
566
572
|
}, Symbol.toStringTag, { value: "Module" }));
|
567
|
-
function
|
573
|
+
function M(e, t) {
|
568
574
|
return p({
|
569
575
|
queryKey: ["integrations", "hivesigner", "decode-memo", e],
|
570
576
|
queryFn: async () => {
|
@@ -576,13 +582,13 @@ function B(e, t) {
|
|
576
582
|
}
|
577
583
|
});
|
578
584
|
}
|
579
|
-
const
|
585
|
+
const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
580
586
|
__proto__: null,
|
581
|
-
getDecodeMemoQueryOptions:
|
582
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
583
|
-
queries:
|
587
|
+
getDecodeMemoQueryOptions: M
|
588
|
+
}, Symbol.toStringTag, { value: "Module" })), G = {
|
589
|
+
queries: x
|
584
590
|
};
|
585
|
-
function
|
591
|
+
function v(e) {
|
586
592
|
return p({
|
587
593
|
queryKey: ["integrations", "3speak", "authenticate", e],
|
588
594
|
enabled: !!e,
|
@@ -596,28 +602,28 @@ function w(e) {
|
|
596
602
|
"Content-Type": "application/json"
|
597
603
|
}
|
598
604
|
}
|
599
|
-
), n =
|
605
|
+
), n = G.queries.getDecodeMemoQueryOptions(
|
600
606
|
e,
|
601
607
|
(await t.json()).memo
|
602
608
|
);
|
603
609
|
await c().prefetchQuery(n);
|
604
|
-
const { memoDecoded:
|
610
|
+
const { memoDecoded: o } = c().getQueryData(
|
605
611
|
n.queryKey
|
606
612
|
);
|
607
|
-
return
|
613
|
+
return o.replace("#", "");
|
608
614
|
}
|
609
615
|
});
|
610
616
|
}
|
611
|
-
function
|
617
|
+
function U(e) {
|
612
618
|
return p({
|
613
619
|
queryKey: ["integrations", "3speak", "videos", e],
|
614
620
|
enabled: !!e,
|
615
621
|
queryFn: async () => {
|
616
622
|
await c().prefetchQuery(
|
617
|
-
|
623
|
+
v(e)
|
618
624
|
);
|
619
625
|
const t = c().getQueryData(
|
620
|
-
|
626
|
+
v(e).queryKey
|
621
627
|
);
|
622
628
|
return await (await fetch(
|
623
629
|
"https://studio.3speak.tv/mobile/api/my-videos",
|
@@ -631,31 +637,31 @@ function G(e) {
|
|
631
637
|
}
|
632
638
|
});
|
633
639
|
}
|
634
|
-
const
|
640
|
+
const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
635
641
|
__proto__: null,
|
636
|
-
getAccountTokenQueryOptions:
|
637
|
-
getAccountVideosQueryOptions:
|
638
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
639
|
-
queries:
|
642
|
+
getAccountTokenQueryOptions: v,
|
643
|
+
getAccountVideosQueryOptions: U
|
644
|
+
}, Symbol.toStringTag, { value: "Module" })), de = {
|
645
|
+
queries: z
|
640
646
|
};
|
641
|
-
function
|
647
|
+
function ge() {
|
642
648
|
return p({
|
643
649
|
queryKey: ["resource-credits", "stats"],
|
644
|
-
queryFn: async () => (await
|
650
|
+
queryFn: async () => (await a.hiveClient.call(
|
645
651
|
"rc_api",
|
646
652
|
"get_rc_stats",
|
647
653
|
{}
|
648
654
|
)).rc_stats
|
649
655
|
});
|
650
656
|
}
|
651
|
-
function
|
657
|
+
function we(e) {
|
652
658
|
return p({
|
653
659
|
queryKey: ["resource-credits", "account", e],
|
654
|
-
queryFn: async () => new
|
660
|
+
queryFn: async () => new P(a.hiveClient).findRCAccounts([e]),
|
655
661
|
enabled: !!e
|
656
662
|
});
|
657
663
|
}
|
658
|
-
function
|
664
|
+
function ve(e, t) {
|
659
665
|
return p({
|
660
666
|
queryKey: ["games", "status-check", t, e],
|
661
667
|
enabled: !!e,
|
@@ -663,7 +669,7 @@ function we(e, t) {
|
|
663
669
|
if (!e)
|
664
670
|
throw new Error("[SDK][Games] – anon user in status check");
|
665
671
|
return await (await fetch(
|
666
|
-
|
672
|
+
a.privateApiHost + "/private-api/get-game",
|
667
673
|
{
|
668
674
|
method: "POST",
|
669
675
|
body: JSON.stringify({
|
@@ -678,8 +684,8 @@ function we(e, t) {
|
|
678
684
|
}
|
679
685
|
});
|
680
686
|
}
|
681
|
-
function
|
682
|
-
const { mutateAsync:
|
687
|
+
function me(e, t, n) {
|
688
|
+
const { mutateAsync: o } = Q(
|
683
689
|
e,
|
684
690
|
"spin-rolled"
|
685
691
|
);
|
@@ -689,7 +695,7 @@ function ve(e, t, n) {
|
|
689
695
|
if (!e)
|
690
696
|
throw new Error("[SDK][Games] – anon user in game post");
|
691
697
|
return await (await fetch(
|
692
|
-
|
698
|
+
a.privateApiHost + "/private-api/post-game",
|
693
699
|
{
|
694
700
|
method: "POST",
|
695
701
|
body: JSON.stringify({
|
@@ -704,45 +710,46 @@ function ve(e, t, n) {
|
|
704
710
|
)).json();
|
705
711
|
},
|
706
712
|
onSuccess() {
|
707
|
-
|
713
|
+
o();
|
708
714
|
}
|
709
715
|
});
|
710
716
|
}
|
711
717
|
export {
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
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,
|
721
727
|
l as getAccessToken,
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
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,
|
730
737
|
c as getQueryClient,
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
738
|
+
ge as getRcStatsQueryOptions,
|
739
|
+
X as getRefreshToken,
|
740
|
+
B as getRelationshipBetweenAccountsQueryOptions,
|
741
|
+
te as getSearchAccountsByUsernameQueryOptions,
|
742
|
+
ue as getTrendingTagsQueryOptions,
|
736
743
|
f as getUser,
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
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
|
748
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;
|