@ecency/sdk 1.1.12 → 1.1.14
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 +545 -284
- package/dist/modules/accounts/mutations/index.d.ts +5 -0
- package/dist/modules/accounts/mutations/use-account-revoke-key.d.ts +19 -0
- package/dist/modules/accounts/mutations/use-account-revoke-posting.d.ts +10 -0
- package/dist/modules/accounts/mutations/use-account-update-key-auths.d.ts +19 -0
- package/dist/modules/accounts/mutations/use-account-update-password.d.ts +12 -0
- package/dist/modules/accounts/mutations/use-account-update-recovery.d.ts +11 -0
- package/dist/modules/accounts/queries/get-account-full-query-options.d.ts +4 -4
- package/dist/modules/accounts/queries/get-account-pending-recovery-query-options.d.ts +8 -0
- package/dist/modules/accounts/queries/get-account-recoveries-query-options.d.ts +9 -0
- package/dist/modules/accounts/queries/index.d.ts +2 -0
- package/dist/modules/accounts/types/account-recovery.d.ts +8 -0
- package/dist/modules/accounts/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/ecency-sdk.es.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
var V = Object.defineProperty;
|
2
2
|
var W = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
3
|
-
var
|
4
|
-
import { QueryClient as
|
5
|
-
import { Client as R, PrivateKey as
|
6
|
-
import
|
7
|
-
import * as
|
8
|
-
class
|
3
|
+
var T = (e, t, n) => W(e, typeof t != "symbol" ? t + "" : t, n);
|
4
|
+
import { QueryClient as F, useMutation as d, useQuery as S, useInfiniteQuery as z, queryOptions as p, useQueryClient as P, infiniteQueryOptions as $ } from "@tanstack/react-query";
|
5
|
+
import { Client as R, PrivateKey as _, cryptoUtils as L, RCAPI as X } from "@hiveio/dhive";
|
6
|
+
import K from "hivesigner";
|
7
|
+
import * as f from "remeda";
|
8
|
+
class Y {
|
9
9
|
constructor() {
|
10
|
-
|
10
|
+
T(this, "length", 0);
|
11
11
|
}
|
12
12
|
clear() {
|
13
13
|
throw new Error("Method not implemented.");
|
@@ -25,9 +25,9 @@ class Z {
|
|
25
25
|
this[t] = n;
|
26
26
|
}
|
27
27
|
}
|
28
|
-
const
|
28
|
+
const c = {
|
29
29
|
privateApiHost: "https://ecency.com",
|
30
|
-
storage: typeof window > "u" ? new
|
30
|
+
storage: typeof window > "u" ? new Y() : window.localStorage,
|
31
31
|
storagePrefix: "ecency",
|
32
32
|
hiveClient: new R(
|
33
33
|
[
|
@@ -51,49 +51,49 @@ const i = {
|
|
51
51
|
),
|
52
52
|
heliusApiKey: void 0,
|
53
53
|
bitqueryApiKey: void 0,
|
54
|
-
queryClient: new
|
54
|
+
queryClient: new F(),
|
55
55
|
plausibleHost: "https://pl.ecency.com",
|
56
56
|
spkNode: "https://spk.good-karma.xyz"
|
57
57
|
};
|
58
|
-
var
|
58
|
+
var j;
|
59
59
|
((e) => {
|
60
60
|
function t(n) {
|
61
|
-
|
61
|
+
c.queryClient = n;
|
62
62
|
}
|
63
63
|
e.setQueryClient = t;
|
64
|
-
})(
|
65
|
-
function
|
64
|
+
})(j || (j = {}));
|
65
|
+
function Z(e) {
|
66
66
|
let t = atob(e);
|
67
67
|
if (t[0] === "{")
|
68
68
|
return JSON.parse(t);
|
69
69
|
}
|
70
|
-
var
|
71
|
-
function
|
70
|
+
var E = /* @__PURE__ */ ((e) => (e.HIVE = "HIVE", e.HBD = "HBD", e.VESTS = "VESTS", e.SPK = "SPK", e))(E || {}), B = /* @__PURE__ */ ((e) => (e["@@000000021"] = "HIVE", e["@@000000013"] = "HBD", e["@@000000037"] = "VESTS", e))(B || {});
|
71
|
+
function m(e) {
|
72
72
|
if (typeof e == "string") {
|
73
73
|
const t = e.split(" ");
|
74
74
|
return {
|
75
75
|
amount: parseFloat(t[0]),
|
76
76
|
// @ts-ignore
|
77
|
-
symbol:
|
77
|
+
symbol: E[t[1]]
|
78
78
|
};
|
79
79
|
} else
|
80
80
|
return {
|
81
81
|
amount: parseFloat(e.amount.toString()) / Math.pow(10, e.precision),
|
82
82
|
// @ts-ignore
|
83
|
-
symbol:
|
83
|
+
symbol: B[e.nai]
|
84
84
|
};
|
85
85
|
}
|
86
|
-
const
|
86
|
+
const w = (e) => {
|
87
87
|
try {
|
88
|
-
const t =
|
89
|
-
|
88
|
+
const t = c.storage.getItem(
|
89
|
+
c.storagePrefix + "_user_" + e
|
90
90
|
);
|
91
|
-
return
|
91
|
+
return Z(JSON.parse(t));
|
92
92
|
} catch (t) {
|
93
93
|
console.error(t);
|
94
94
|
return;
|
95
95
|
}
|
96
|
-
},
|
96
|
+
}, l = (e) => w(e) && w(e).accessToken, H = (e) => w(e) && w(e).postingKey, J = (e) => w(e) && w(e).loginType, _e = (e) => w(e) && w(e).refreshToken;
|
97
97
|
function ee() {
|
98
98
|
return new Promise((e) => {
|
99
99
|
var t;
|
@@ -102,33 +102,33 @@ function ee() {
|
|
102
102
|
});
|
103
103
|
});
|
104
104
|
}
|
105
|
-
const
|
105
|
+
const C = (e, t, n, o = null) => new Promise((r, a) => {
|
106
106
|
var s;
|
107
107
|
(s = window.hive_keychain) == null || s.requestBroadcast(
|
108
108
|
e,
|
109
109
|
t,
|
110
110
|
n,
|
111
|
-
(
|
112
|
-
|
111
|
+
(i) => {
|
112
|
+
i.success || a({ message: "Operation cancelled" }), r(i);
|
113
113
|
},
|
114
114
|
o
|
115
115
|
);
|
116
|
-
}), te = (e, t, n, o, r,
|
117
|
-
var
|
118
|
-
(
|
116
|
+
}), te = (e, t, n, o, r, a = null) => new Promise((s, i) => {
|
117
|
+
var u;
|
118
|
+
(u = window.hive_keychain) == null || u.requestCustomJson(
|
119
119
|
e,
|
120
120
|
t,
|
121
121
|
n,
|
122
122
|
o,
|
123
123
|
r,
|
124
|
-
(
|
125
|
-
|
124
|
+
(h) => {
|
125
|
+
h.success || i({ message: "Operation cancelled" }), s(h);
|
126
126
|
},
|
127
|
-
|
127
|
+
a
|
128
128
|
);
|
129
|
-
}),
|
129
|
+
}), ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
130
130
|
__proto__: null,
|
131
|
-
broadcast:
|
131
|
+
broadcast: C,
|
132
132
|
customJson: te,
|
133
133
|
handshake: ee
|
134
134
|
}, Symbol.toStringTag, { value: "Module" }));
|
@@ -142,25 +142,25 @@ function ne(e = [], t, n, o = () => {
|
|
142
142
|
throw new Error(
|
143
143
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
144
144
|
);
|
145
|
-
const
|
146
|
-
if (
|
147
|
-
const
|
148
|
-
return
|
145
|
+
const a = H(t);
|
146
|
+
if (a) {
|
147
|
+
const u = _.fromString(a);
|
148
|
+
return c.hiveClient.broadcast.sendOperations(
|
149
149
|
n(r),
|
150
|
-
|
150
|
+
u
|
151
151
|
);
|
152
152
|
}
|
153
|
-
const s =
|
153
|
+
const s = J(t);
|
154
154
|
if (s && s == "keychain")
|
155
|
-
return
|
155
|
+
return C(
|
156
156
|
t,
|
157
157
|
n(r),
|
158
158
|
"Posting"
|
159
|
-
).then((
|
160
|
-
let
|
161
|
-
if (
|
162
|
-
return (await new
|
163
|
-
accessToken:
|
159
|
+
).then((u) => u.result);
|
160
|
+
let i = l(t);
|
161
|
+
if (i)
|
162
|
+
return (await new K.Client({
|
163
|
+
accessToken: i
|
164
164
|
}).broadcast(n(r))).result;
|
165
165
|
throw new Error(
|
166
166
|
"[SDK][Broadcast] – cannot broadcast w/o posting key or token"
|
@@ -178,28 +178,28 @@ async function oe(e, t, n) {
|
|
178
178
|
required_auths: [],
|
179
179
|
required_posting_auths: [e],
|
180
180
|
json: JSON.stringify(n)
|
181
|
-
}, r =
|
181
|
+
}, r = H(e);
|
182
182
|
if (r) {
|
183
|
-
const
|
184
|
-
return
|
183
|
+
const i = _.fromString(r);
|
184
|
+
return c.hiveClient.broadcast.json(
|
185
185
|
o,
|
186
|
-
|
186
|
+
i
|
187
187
|
);
|
188
188
|
}
|
189
|
-
const
|
190
|
-
if (
|
191
|
-
return
|
192
|
-
let s =
|
189
|
+
const a = J(e);
|
190
|
+
if (a && a == "keychain")
|
191
|
+
return C(e, [["custom_json", o]], "Posting").then((i) => i.result);
|
192
|
+
let s = l(e);
|
193
193
|
if (s)
|
194
|
-
return (await new
|
194
|
+
return (await new K.Client({
|
195
195
|
accessToken: s
|
196
196
|
}).customJson([], [e], t, JSON.stringify(n))).result;
|
197
197
|
throw new Error(
|
198
198
|
"[SDK][Broadcast] – cannot broadcast w/o posting key or token"
|
199
199
|
);
|
200
200
|
}
|
201
|
-
function
|
202
|
-
return new
|
201
|
+
function me() {
|
202
|
+
return new F({
|
203
203
|
defaultOptions: {
|
204
204
|
queries: {
|
205
205
|
// With SSR, we usually want to set some default staleTime
|
@@ -211,94 +211,94 @@ function _e() {
|
|
211
211
|
}
|
212
212
|
});
|
213
213
|
}
|
214
|
-
const
|
215
|
-
var
|
214
|
+
const y = () => c.queryClient;
|
215
|
+
var Q;
|
216
216
|
((e) => {
|
217
|
-
function t(
|
218
|
-
return
|
217
|
+
function t(i) {
|
218
|
+
return y().getQueryData(i);
|
219
219
|
}
|
220
220
|
e.getQueryData = t;
|
221
|
-
function n(
|
222
|
-
return
|
221
|
+
function n(i) {
|
222
|
+
return y().getQueryData(i);
|
223
223
|
}
|
224
224
|
e.getInfiniteQueryData = n;
|
225
|
-
async function o(
|
226
|
-
return await
|
225
|
+
async function o(i) {
|
226
|
+
return await y().prefetchQuery(i), t(i.queryKey);
|
227
227
|
}
|
228
228
|
e.prefetchQuery = o;
|
229
|
-
async function r(
|
230
|
-
return await
|
229
|
+
async function r(i) {
|
230
|
+
return await y().prefetchInfiniteQuery(i), n(i.queryKey);
|
231
231
|
}
|
232
232
|
e.prefetchInfiniteQuery = r;
|
233
|
-
function
|
233
|
+
function a(i) {
|
234
234
|
return {
|
235
|
-
prefetch: () => o(
|
236
|
-
getData: () => t(
|
237
|
-
useClientQuery: () =>
|
238
|
-
fetchAndGet: () =>
|
235
|
+
prefetch: () => o(i),
|
236
|
+
getData: () => t(i.queryKey),
|
237
|
+
useClientQuery: () => S(i),
|
238
|
+
fetchAndGet: () => y().fetchQuery(i)
|
239
239
|
};
|
240
240
|
}
|
241
|
-
e.generateClientServerQuery =
|
242
|
-
function s(
|
241
|
+
e.generateClientServerQuery = a;
|
242
|
+
function s(i) {
|
243
243
|
return {
|
244
|
-
prefetch: () => r(
|
245
|
-
getData: () => n(
|
246
|
-
useClientQuery: () => z(
|
247
|
-
fetchAndGet: () =>
|
244
|
+
prefetch: () => r(i),
|
245
|
+
getData: () => n(i.queryKey),
|
246
|
+
useClientQuery: () => z(i),
|
247
|
+
fetchAndGet: () => y().fetchInfiniteQuery(i)
|
248
248
|
};
|
249
249
|
}
|
250
250
|
e.generateClientServerInfiniteQuery = s;
|
251
|
-
})(
|
252
|
-
function
|
251
|
+
})(Q || (Q = {}));
|
252
|
+
function we() {
|
253
253
|
return p({
|
254
254
|
queryKey: ["core", "dynamic-props"],
|
255
255
|
refetchInterval: 6e4,
|
256
256
|
staleTime: 6e4,
|
257
257
|
refetchOnMount: !0,
|
258
258
|
queryFn: async () => {
|
259
|
-
const e = await
|
260
|
-
total_vesting_fund_hive:
|
261
|
-
total_vesting_shares:
|
262
|
-
hbd_print_rate:
|
263
|
-
hbd_interest_rate:
|
264
|
-
head_block_number:
|
265
|
-
vesting_reward_percent:
|
266
|
-
virtual_supply:
|
267
|
-
})), t = await
|
259
|
+
const e = await c.hiveClient.database.getDynamicGlobalProperties().then((v) => ({
|
260
|
+
total_vesting_fund_hive: v.total_vesting_fund_hive || v.total_vesting_fund_steem,
|
261
|
+
total_vesting_shares: v.total_vesting_shares,
|
262
|
+
hbd_print_rate: v.hbd_print_rate || v.sbd_print_rate,
|
263
|
+
hbd_interest_rate: v.hbd_interest_rate,
|
264
|
+
head_block_number: v.head_block_number,
|
265
|
+
vesting_reward_percent: v.vesting_reward_percent,
|
266
|
+
virtual_supply: v.virtual_supply
|
267
|
+
})), t = await c.hiveClient.database.call("get_feed_history"), n = await c.hiveClient.database.call(
|
268
268
|
"get_chain_properties"
|
269
|
-
), o = await
|
269
|
+
), o = await c.hiveClient.database.call(
|
270
270
|
"get_reward_fund",
|
271
271
|
["post"]
|
272
|
-
), r =
|
272
|
+
), r = m(e.total_vesting_fund_hive).amount / m(e.total_vesting_shares).amount * 1e6, a = m(t.current_median_history.base).amount, s = m(t.current_median_history.quote).amount, i = parseFloat(o.recent_claims), u = m(o.reward_balance).amount, h = e.hbd_print_rate, k = e.hbd_interest_rate, O = e.head_block_number, N = m(
|
273
273
|
e.total_vesting_fund_hive
|
274
|
-
).amount,
|
274
|
+
).amount, I = m(
|
275
275
|
e.total_vesting_shares
|
276
|
-
).amount,
|
276
|
+
).amount, x = m(e.virtual_supply).amount, U = e.vesting_reward_percent, G = n.account_creation_fee;
|
277
277
|
return {
|
278
278
|
hivePerMVests: r,
|
279
|
-
base:
|
279
|
+
base: a,
|
280
280
|
quote: s,
|
281
|
-
fundRecentClaims:
|
282
|
-
fundRewardBalance:
|
283
|
-
hbdPrintRate:
|
284
|
-
hbdInterestRate:
|
285
|
-
headBlock:
|
286
|
-
totalVestingFund:
|
287
|
-
totalVestingShares:
|
288
|
-
virtualSupply:
|
289
|
-
vestingRewardPercent:
|
281
|
+
fundRecentClaims: i,
|
282
|
+
fundRewardBalance: u,
|
283
|
+
hbdPrintRate: h,
|
284
|
+
hbdInterestRate: k,
|
285
|
+
headBlock: O,
|
286
|
+
totalVestingFund: N,
|
287
|
+
totalVestingShares: I,
|
288
|
+
virtualSupply: x,
|
289
|
+
vestingRewardPercent: U,
|
290
290
|
accountCreationFee: G
|
291
291
|
};
|
292
292
|
}
|
293
293
|
});
|
294
294
|
}
|
295
|
-
function
|
295
|
+
function b(e) {
|
296
296
|
return p({
|
297
297
|
queryKey: ["get-account-full", e],
|
298
298
|
queryFn: async () => {
|
299
299
|
if (!e)
|
300
300
|
throw new Error("[SDK] Username is empty");
|
301
|
-
const t = await
|
301
|
+
const t = await c.hiveClient.database.getAccounts([
|
302
302
|
e
|
303
303
|
]);
|
304
304
|
if (!t[0])
|
@@ -306,13 +306,13 @@ function T(e) {
|
|
306
306
|
const n = JSON.parse(t[0].posting_json_metadata).profile;
|
307
307
|
let o;
|
308
308
|
try {
|
309
|
-
o = await
|
309
|
+
o = await c.hiveClient.database.call(
|
310
310
|
"get_follow_count",
|
311
311
|
[e]
|
312
312
|
);
|
313
313
|
} catch {
|
314
314
|
}
|
315
|
-
const r = await
|
315
|
+
const r = await c.hiveClient.call(
|
316
316
|
"condenser_api",
|
317
317
|
"get_account_reputations",
|
318
318
|
[e, 1]
|
@@ -367,11 +367,11 @@ function T(e) {
|
|
367
367
|
staleTime: 6e4
|
368
368
|
});
|
369
369
|
}
|
370
|
-
function
|
370
|
+
function be(e, t = 5, n = []) {
|
371
371
|
return p({
|
372
372
|
queryKey: ["accounts", "search", e, n],
|
373
373
|
enabled: !!e,
|
374
|
-
queryFn: async () => (await
|
374
|
+
queryFn: async () => (await c.hiveClient.database.call(
|
375
375
|
"lookup_accounts",
|
376
376
|
[e, t]
|
377
377
|
)).filter(
|
@@ -379,11 +379,11 @@ function we(e, t = 5, n = []) {
|
|
379
379
|
)
|
380
380
|
});
|
381
381
|
}
|
382
|
-
function
|
382
|
+
function Se(e) {
|
383
383
|
return p({
|
384
384
|
queryKey: ["accounts", "check-wallet-pending", e],
|
385
385
|
queryFn: async () => await (await fetch(
|
386
|
-
|
386
|
+
c.privateApiHost + "/private-api/wallets-chkuser",
|
387
387
|
{
|
388
388
|
method: "POST",
|
389
389
|
headers: {
|
@@ -404,18 +404,18 @@ function re(e, t) {
|
|
404
404
|
enabled: !!e && !!t,
|
405
405
|
refetchOnMount: !1,
|
406
406
|
refetchInterval: 36e5,
|
407
|
-
queryFn: async () => await
|
407
|
+
queryFn: async () => await c.hiveClient.call(
|
408
408
|
"bridge",
|
409
409
|
"get_relationship_between_accounts",
|
410
410
|
[e, t]
|
411
411
|
)
|
412
412
|
});
|
413
413
|
}
|
414
|
-
function
|
414
|
+
function ke(e) {
|
415
415
|
return p({
|
416
416
|
queryKey: ["accounts", "subscriptions", e],
|
417
417
|
enabled: !!e,
|
418
|
-
queryFn: async () => await
|
418
|
+
queryFn: async () => await c.hiveClient.call(
|
419
419
|
"bridge",
|
420
420
|
"list_all_subscriptions",
|
421
421
|
{
|
@@ -424,7 +424,7 @@ function be(e) {
|
|
424
424
|
) ?? []
|
425
425
|
});
|
426
426
|
}
|
427
|
-
function
|
427
|
+
function Ke(e) {
|
428
428
|
return p({
|
429
429
|
queryKey: ["accounts", "bookmarks", e],
|
430
430
|
enabled: !!e,
|
@@ -432,19 +432,19 @@ function Ce(e) {
|
|
432
432
|
if (!e)
|
433
433
|
throw new Error("[SDK][Accounts][Bookmarks] – no active user");
|
434
434
|
return await (await fetch(
|
435
|
-
|
435
|
+
c.privateApiHost + "/private-api/bookmarks",
|
436
436
|
{
|
437
437
|
method: "POST",
|
438
438
|
headers: {
|
439
439
|
"Content-Type": "application/json"
|
440
440
|
},
|
441
|
-
body: JSON.stringify({ code:
|
441
|
+
body: JSON.stringify({ code: l(e) })
|
442
442
|
}
|
443
443
|
)).json();
|
444
444
|
}
|
445
445
|
});
|
446
446
|
}
|
447
|
-
function
|
447
|
+
function Ce(e) {
|
448
448
|
return p({
|
449
449
|
queryKey: ["accounts", "favourites", e],
|
450
450
|
enabled: !!e,
|
@@ -452,39 +452,66 @@ function Se(e) {
|
|
452
452
|
if (!e)
|
453
453
|
throw new Error("[SDK][Accounts][Favourites] – no active user");
|
454
454
|
return await (await fetch(
|
455
|
-
|
455
|
+
c.privateApiHost + "/private-api/favorites",
|
456
456
|
{
|
457
457
|
method: "POST",
|
458
458
|
headers: {
|
459
459
|
"Content-Type": "application/json"
|
460
460
|
},
|
461
|
-
body: JSON.stringify({ code:
|
461
|
+
body: JSON.stringify({ code: l(e) })
|
462
462
|
}
|
463
463
|
)).json();
|
464
464
|
}
|
465
465
|
});
|
466
466
|
}
|
467
|
+
function Oe(e) {
|
468
|
+
return p({
|
469
|
+
enabled: !!e,
|
470
|
+
queryKey: ["accounts", "recoveries", e],
|
471
|
+
queryFn: async () => (await fetch(
|
472
|
+
c.privateApiHost + "/private-api/recoveries",
|
473
|
+
{
|
474
|
+
method: "POST",
|
475
|
+
headers: {
|
476
|
+
"Content-Type": "application/json"
|
477
|
+
},
|
478
|
+
body: JSON.stringify({ code: l(e) })
|
479
|
+
}
|
480
|
+
)).json()
|
481
|
+
});
|
482
|
+
}
|
483
|
+
function qe(e) {
|
484
|
+
return p({
|
485
|
+
enabled: !!e,
|
486
|
+
queryKey: ["accounts", "recoveries", e, "pending-request"],
|
487
|
+
queryFn: () => c.hiveClient.call(
|
488
|
+
"database_api",
|
489
|
+
"find_change_recovery_account_requests",
|
490
|
+
{ accounts: [e] }
|
491
|
+
)
|
492
|
+
});
|
493
|
+
}
|
467
494
|
function ie(e) {
|
468
495
|
return e == null ? void 0 : e.map(({ meta: t, ...n }) => {
|
469
496
|
if (!t || typeof t != "object")
|
470
497
|
return { ...n, meta: t };
|
471
|
-
const { privateKey: o, username: r, ...
|
472
|
-
return { ...n, meta:
|
498
|
+
const { privateKey: o, username: r, ...a } = t;
|
499
|
+
return { ...n, meta: a };
|
473
500
|
});
|
474
501
|
}
|
475
|
-
function
|
502
|
+
function D({
|
476
503
|
profile: e,
|
477
504
|
tokens: t,
|
478
505
|
data: n
|
479
506
|
}) {
|
480
|
-
const o =
|
507
|
+
const o = f.pipe(
|
481
508
|
JSON.parse((n == null ? void 0 : n.posting_json_metadata) || "{}"),
|
482
|
-
|
509
|
+
f.mergeDeep(e ?? {})
|
483
510
|
);
|
484
511
|
return t && t.length > 0 && (o.tokens = t), o.tokens = ie(o.tokens), o;
|
485
512
|
}
|
486
|
-
function
|
487
|
-
const t =
|
513
|
+
function Ae(e) {
|
514
|
+
const t = P(), { data: n } = S(b(e));
|
488
515
|
return ne(
|
489
516
|
["accounts", "update", n == null ? void 0 : n.name],
|
490
517
|
e,
|
@@ -499,34 +526,34 @@ function Oe(e) {
|
|
499
526
|
json_metadata: "",
|
500
527
|
extensions: [],
|
501
528
|
posting_json_metadata: JSON.stringify({
|
502
|
-
profile:
|
529
|
+
profile: D({ ...o, data: n })
|
503
530
|
})
|
504
531
|
}
|
505
532
|
]
|
506
533
|
];
|
507
534
|
},
|
508
535
|
(o, r) => t.setQueryData(
|
509
|
-
|
510
|
-
(
|
511
|
-
if (!
|
512
|
-
return
|
513
|
-
const s =
|
514
|
-
return s.profile =
|
536
|
+
b(e).queryKey,
|
537
|
+
(a) => {
|
538
|
+
if (!a)
|
539
|
+
return a;
|
540
|
+
const s = f.clone(a);
|
541
|
+
return s.profile = D({ ...r, data: a }), s;
|
515
542
|
}
|
516
543
|
)
|
517
544
|
);
|
518
545
|
}
|
519
|
-
function
|
546
|
+
function Te(e, t, n, o) {
|
520
547
|
return d({
|
521
|
-
mutationKey: [],
|
548
|
+
mutationKey: ["accounts", "relation", "update", e, t],
|
522
549
|
mutationFn: async (r) => {
|
523
|
-
const
|
550
|
+
const a = re(
|
524
551
|
e,
|
525
552
|
t
|
526
553
|
);
|
527
|
-
await
|
528
|
-
const s =
|
529
|
-
|
554
|
+
await y().prefetchQuery(a);
|
555
|
+
const s = y().getQueryData(
|
556
|
+
a.queryKey
|
530
557
|
);
|
531
558
|
return await oe(e, "follow", [
|
532
559
|
"follow",
|
@@ -546,21 +573,21 @@ function Ke(e, t, n, o) {
|
|
546
573
|
},
|
547
574
|
onError: o,
|
548
575
|
onSuccess(r) {
|
549
|
-
n(r),
|
576
|
+
n(r), y().setQueryData(
|
550
577
|
["accounts", "relations", e, t],
|
551
578
|
r
|
552
579
|
);
|
553
580
|
}
|
554
581
|
});
|
555
582
|
}
|
556
|
-
function
|
583
|
+
function je(e, t, n) {
|
557
584
|
return d({
|
558
585
|
mutationKey: ["accounts", "bookmarks", "add", e],
|
559
586
|
mutationFn: async ({ author: o, permlink: r }) => {
|
560
587
|
if (!e)
|
561
588
|
throw new Error("[SDK][Account][Bookmarks] – no active user");
|
562
589
|
return (await fetch(
|
563
|
-
|
590
|
+
c.privateApiHost + "/private-api/bookmarks-add",
|
564
591
|
{
|
565
592
|
method: "POST",
|
566
593
|
headers: {
|
@@ -569,27 +596,27 @@ function ke(e, t, n) {
|
|
569
596
|
body: JSON.stringify({
|
570
597
|
author: o,
|
571
598
|
permlink: r,
|
572
|
-
code:
|
599
|
+
code: l(e)
|
573
600
|
})
|
574
601
|
}
|
575
602
|
)).json();
|
576
603
|
},
|
577
604
|
onSuccess: () => {
|
578
|
-
t(),
|
605
|
+
t(), y().invalidateQueries({
|
579
606
|
queryKey: ["accounts", "bookmarks", e]
|
580
607
|
});
|
581
608
|
},
|
582
609
|
onError: n
|
583
610
|
});
|
584
611
|
}
|
585
|
-
function
|
612
|
+
function Qe(e, t, n) {
|
586
613
|
return d({
|
587
614
|
mutationKey: ["accounts", "bookmarks", "delete", e],
|
588
615
|
mutationFn: async (o) => {
|
589
616
|
if (!e)
|
590
617
|
throw new Error("[SDK][Account][Bookmarks] – no active user");
|
591
618
|
return (await fetch(
|
592
|
-
|
619
|
+
c.privateApiHost + "/private-api/bookmarks-delete",
|
593
620
|
{
|
594
621
|
method: "POST",
|
595
622
|
headers: {
|
@@ -597,27 +624,27 @@ function qe(e, t, n) {
|
|
597
624
|
},
|
598
625
|
body: JSON.stringify({
|
599
626
|
id: o,
|
600
|
-
code:
|
627
|
+
code: l(e)
|
601
628
|
})
|
602
629
|
}
|
603
630
|
)).json();
|
604
631
|
},
|
605
632
|
onSuccess: () => {
|
606
|
-
t(),
|
633
|
+
t(), y().invalidateQueries({
|
607
634
|
queryKey: ["accounts", "bookmarks", e]
|
608
635
|
});
|
609
636
|
},
|
610
637
|
onError: n
|
611
638
|
});
|
612
639
|
}
|
613
|
-
function
|
640
|
+
function De(e, t, n) {
|
614
641
|
return d({
|
615
642
|
mutationKey: ["accounts", "favourites", "add", e],
|
616
643
|
mutationFn: async (o) => {
|
617
644
|
if (!e)
|
618
645
|
throw new Error("[SDK][Account][Bookmarks] – no active user");
|
619
646
|
return (await fetch(
|
620
|
-
|
647
|
+
c.privateApiHost + "/private-api/favorites-add",
|
621
648
|
{
|
622
649
|
method: "POST",
|
623
650
|
headers: {
|
@@ -625,27 +652,27 @@ function Te(e, t, n) {
|
|
625
652
|
},
|
626
653
|
body: JSON.stringify({
|
627
654
|
account: o,
|
628
|
-
code:
|
655
|
+
code: l(e)
|
629
656
|
})
|
630
657
|
}
|
631
658
|
)).json();
|
632
659
|
},
|
633
660
|
onSuccess: () => {
|
634
|
-
t(),
|
661
|
+
t(), y().invalidateQueries({
|
635
662
|
queryKey: ["accounts", "favourites", e]
|
636
663
|
});
|
637
664
|
},
|
638
665
|
onError: n
|
639
666
|
});
|
640
667
|
}
|
641
|
-
function
|
668
|
+
function Fe(e, t, n) {
|
642
669
|
return d({
|
643
670
|
mutationKey: ["accounts", "favourites", "add", e],
|
644
671
|
mutationFn: async (o) => {
|
645
672
|
if (!e)
|
646
673
|
throw new Error("[SDK][Account][Bookmarks] – no active user");
|
647
674
|
return (await fetch(
|
648
|
-
|
675
|
+
c.privateApiHost + "/private-api/favorites-delete",
|
649
676
|
{
|
650
677
|
method: "POST",
|
651
678
|
headers: {
|
@@ -653,20 +680,246 @@ function Qe(e, t, n) {
|
|
653
680
|
},
|
654
681
|
body: JSON.stringify({
|
655
682
|
account: o,
|
656
|
-
code:
|
683
|
+
code: l(e)
|
657
684
|
})
|
658
685
|
}
|
659
686
|
)).json();
|
660
687
|
},
|
661
688
|
onSuccess: () => {
|
662
|
-
t(),
|
689
|
+
t(), y().invalidateQueries({
|
663
690
|
queryKey: ["accounts", "favourites", e]
|
664
691
|
});
|
665
692
|
},
|
666
693
|
onError: n
|
667
694
|
});
|
668
695
|
}
|
669
|
-
function
|
696
|
+
function se(e, t) {
|
697
|
+
const n = f.fromEntries(
|
698
|
+
e.map(([o, r]) => [o.toString(), r])
|
699
|
+
);
|
700
|
+
return f.pipe(
|
701
|
+
n,
|
702
|
+
f.merge(f.fromEntries(t)),
|
703
|
+
f.entries(),
|
704
|
+
f.sortBy(([o]) => o)
|
705
|
+
);
|
706
|
+
}
|
707
|
+
function ae(e, t) {
|
708
|
+
const { data: n } = S(b(e));
|
709
|
+
return d({
|
710
|
+
mutationKey: ["accounts", "keys-update", e],
|
711
|
+
mutationFn: async ({ keys: o, keepCurrent: r = !1, currentKey: a }) => {
|
712
|
+
if (!n)
|
713
|
+
throw new Error(
|
714
|
+
"[SDK][Update password] – cannot update keys for anon user"
|
715
|
+
);
|
716
|
+
const s = (i) => {
|
717
|
+
const u = f.clone(n[i]);
|
718
|
+
return u.key_auths = se(
|
719
|
+
r ? u.key_auths : [],
|
720
|
+
o.map(
|
721
|
+
(h, k) => [h[i].createPublic().toString(), k + 1]
|
722
|
+
)
|
723
|
+
), u;
|
724
|
+
};
|
725
|
+
return c.hiveClient.broadcast.updateAccount(
|
726
|
+
{
|
727
|
+
account: e,
|
728
|
+
json_metadata: n.json_metadata,
|
729
|
+
owner: s("owner"),
|
730
|
+
active: s("active"),
|
731
|
+
posting: s("posting"),
|
732
|
+
memo_key: r ? n.memo_key : o[0].memo_key.createPublic().toString()
|
733
|
+
},
|
734
|
+
a
|
735
|
+
);
|
736
|
+
},
|
737
|
+
...t
|
738
|
+
});
|
739
|
+
}
|
740
|
+
function Pe(e, t) {
|
741
|
+
const { data: n } = S(b(e)), { mutateAsync: o } = ae(e);
|
742
|
+
return d({
|
743
|
+
mutationKey: ["accounts", "password-update", e],
|
744
|
+
mutationFn: async ({
|
745
|
+
newPassword: r,
|
746
|
+
currentPassword: a,
|
747
|
+
keepCurrent: s
|
748
|
+
}) => {
|
749
|
+
if (!n)
|
750
|
+
throw new Error(
|
751
|
+
"[SDK][Update password] – cannot update password for anon user"
|
752
|
+
);
|
753
|
+
const i = _.fromLogin(
|
754
|
+
e,
|
755
|
+
a,
|
756
|
+
"owner"
|
757
|
+
);
|
758
|
+
return o({
|
759
|
+
currentKey: i,
|
760
|
+
keepCurrent: s,
|
761
|
+
keys: [
|
762
|
+
{
|
763
|
+
owner: _.fromLogin(e, r, "owner"),
|
764
|
+
active: _.fromLogin(e, r, "active"),
|
765
|
+
posting: _.fromLogin(e, r, "posting"),
|
766
|
+
memo_key: _.fromLogin(e, r, "memo")
|
767
|
+
}
|
768
|
+
]
|
769
|
+
});
|
770
|
+
},
|
771
|
+
...t
|
772
|
+
});
|
773
|
+
}
|
774
|
+
function Ee(e, t) {
|
775
|
+
const n = P(), { data: o } = S(b(e));
|
776
|
+
return d({
|
777
|
+
mutationKey: ["accounts", "revoke-posting", o == null ? void 0 : o.name],
|
778
|
+
mutationFn: async ({ accountName: r, type: a, key: s }) => {
|
779
|
+
if (!o)
|
780
|
+
throw new Error(
|
781
|
+
"[SDK][Accounts] – cannot revoke posting for anonymous user"
|
782
|
+
);
|
783
|
+
const i = f.pipe(
|
784
|
+
{},
|
785
|
+
f.mergeDeep(o.posting)
|
786
|
+
);
|
787
|
+
i.account_auths = i.account_auths.filter(
|
788
|
+
([h]) => h !== r
|
789
|
+
);
|
790
|
+
const u = {
|
791
|
+
account: o.name,
|
792
|
+
posting: i,
|
793
|
+
memo_key: o.memo_key,
|
794
|
+
json_metadata: o.json_metadata
|
795
|
+
};
|
796
|
+
if (a === "key" && s)
|
797
|
+
return c.hiveClient.broadcast.updateAccount(u, s);
|
798
|
+
if (a === "keychain")
|
799
|
+
return C(
|
800
|
+
o.name,
|
801
|
+
[["account_update", u]],
|
802
|
+
"Active"
|
803
|
+
);
|
804
|
+
{
|
805
|
+
const h = {
|
806
|
+
callback: `https://ecency.com/@${o.name}/permissions`
|
807
|
+
};
|
808
|
+
return K.sendOperation(
|
809
|
+
["account_update", u],
|
810
|
+
h,
|
811
|
+
() => {
|
812
|
+
}
|
813
|
+
);
|
814
|
+
}
|
815
|
+
},
|
816
|
+
onError: t.onError,
|
817
|
+
onSuccess: (r, a, s) => {
|
818
|
+
var i;
|
819
|
+
(i = t.onSuccess) == null || i.call(t, r, a, s), n.setQueryData(
|
820
|
+
b(e).queryKey,
|
821
|
+
(u) => {
|
822
|
+
var h, k;
|
823
|
+
return {
|
824
|
+
...u,
|
825
|
+
posting: {
|
826
|
+
...u == null ? void 0 : u.posting,
|
827
|
+
account_auths: ((k = (h = u == null ? void 0 : u.posting) == null ? void 0 : h.account_auths) == null ? void 0 : k.filter(
|
828
|
+
([O]) => O !== a.accountName
|
829
|
+
)) ?? []
|
830
|
+
}
|
831
|
+
};
|
832
|
+
}
|
833
|
+
);
|
834
|
+
}
|
835
|
+
});
|
836
|
+
}
|
837
|
+
function Be(e, t) {
|
838
|
+
const { data: n } = S(b(e));
|
839
|
+
return d({
|
840
|
+
mutationKey: ["accounts", "recovery", n == null ? void 0 : n.name],
|
841
|
+
mutationFn: async ({ accountName: o, type: r, key: a, email: s }) => {
|
842
|
+
if (!n)
|
843
|
+
throw new Error(
|
844
|
+
"[SDK][Accounts] – cannot change recovery for anonymous user"
|
845
|
+
);
|
846
|
+
const i = {
|
847
|
+
account_to_recover: n.name,
|
848
|
+
new_recovery_account: o,
|
849
|
+
extensions: []
|
850
|
+
};
|
851
|
+
if (r === "ecency")
|
852
|
+
return fetch(c.privateApiHost + "/private-api/recoveries-add", {
|
853
|
+
method: "POST",
|
854
|
+
body: JSON.stringify({
|
855
|
+
code: l(n.name),
|
856
|
+
email: s,
|
857
|
+
publicKeys: [
|
858
|
+
...n.owner.key_auths,
|
859
|
+
...n.active.key_auths,
|
860
|
+
...n.posting.key_auths,
|
861
|
+
n.memo_key
|
862
|
+
]
|
863
|
+
})
|
864
|
+
});
|
865
|
+
if (r === "key" && a)
|
866
|
+
return c.hiveClient.broadcast.sendOperations(
|
867
|
+
[["change_recovery_account", i]],
|
868
|
+
a
|
869
|
+
);
|
870
|
+
if (r === "keychain")
|
871
|
+
return C(
|
872
|
+
n.name,
|
873
|
+
[["change_recovery_account", i]],
|
874
|
+
"Active"
|
875
|
+
);
|
876
|
+
{
|
877
|
+
const u = {
|
878
|
+
callback: `https://ecency.com/@${n.name}/permissions`
|
879
|
+
};
|
880
|
+
return K.sendOperation(
|
881
|
+
["change_recovery_account", i],
|
882
|
+
u,
|
883
|
+
() => {
|
884
|
+
}
|
885
|
+
);
|
886
|
+
}
|
887
|
+
},
|
888
|
+
onError: t.onError,
|
889
|
+
onSuccess: t.onSuccess
|
890
|
+
});
|
891
|
+
}
|
892
|
+
function He(e, t) {
|
893
|
+
const { data: n } = S(b(e));
|
894
|
+
return d({
|
895
|
+
mutationKey: ["accounts", "revoke-key", n == null ? void 0 : n.name],
|
896
|
+
mutationFn: async ({ currentKey: o, revokingKey: r }) => {
|
897
|
+
if (!n)
|
898
|
+
throw new Error(
|
899
|
+
"[SDK][Update password] – cannot update keys for anon user"
|
900
|
+
);
|
901
|
+
const a = (s) => {
|
902
|
+
const i = f.clone(n[s]);
|
903
|
+
return i.key_auths = i.key_auths.filter(
|
904
|
+
([u]) => u !== r.toString()
|
905
|
+
), i;
|
906
|
+
};
|
907
|
+
return c.hiveClient.broadcast.updateAccount(
|
908
|
+
{
|
909
|
+
account: n.name,
|
910
|
+
json_metadata: n.json_metadata,
|
911
|
+
owner: a("owner"),
|
912
|
+
active: a("active"),
|
913
|
+
posting: a("posting"),
|
914
|
+
memo_key: n.memo_key
|
915
|
+
},
|
916
|
+
o
|
917
|
+
);
|
918
|
+
},
|
919
|
+
...t
|
920
|
+
});
|
921
|
+
}
|
922
|
+
function Je(e) {
|
670
923
|
return d({
|
671
924
|
mutationKey: ["operations", "sign", e],
|
672
925
|
mutationFn: ({
|
@@ -676,14 +929,14 @@ function Ae(e) {
|
|
676
929
|
if (!e)
|
677
930
|
throw new Error("[Operations][Sign] – cannot sign op with anon user");
|
678
931
|
let o;
|
679
|
-
return n.split(" ").length === 12 ? o =
|
932
|
+
return n.split(" ").length === 12 ? o = _.fromLogin(e, n, "active") : L.isWif(n) ? o = _.fromString(n) : o = _.from(n), c.hiveClient.broadcast.sendOperations(
|
680
933
|
[t],
|
681
934
|
o
|
682
935
|
);
|
683
936
|
}
|
684
937
|
});
|
685
938
|
}
|
686
|
-
function
|
939
|
+
function Me(e, t = "Active") {
|
687
940
|
return d({
|
688
941
|
mutationKey: ["operations", "sign-keychain", e],
|
689
942
|
mutationFn: ({ operation: n }) => {
|
@@ -691,27 +944,27 @@ function je(e, t = "Active") {
|
|
691
944
|
throw new Error(
|
692
945
|
"[SDK][Keychain] – cannot sign operation with anon user"
|
693
946
|
);
|
694
|
-
return
|
947
|
+
return C(e, [n], t);
|
695
948
|
}
|
696
949
|
});
|
697
950
|
}
|
698
|
-
function
|
951
|
+
function Ne(e = "/") {
|
699
952
|
return d({
|
700
953
|
mutationKey: ["operations", "sign-hivesigner", e],
|
701
|
-
mutationFn: async ({ operation: t }) =>
|
954
|
+
mutationFn: async ({ operation: t }) => K.sendOperation(t, { callback: e }, () => {
|
702
955
|
})
|
703
956
|
});
|
704
957
|
}
|
705
|
-
function
|
958
|
+
function Ie() {
|
706
959
|
return p({
|
707
960
|
queryKey: ["operations", "chain-properties"],
|
708
|
-
queryFn: async () => await
|
961
|
+
queryFn: async () => await c.hiveClient.database.getChainProperties()
|
709
962
|
});
|
710
963
|
}
|
711
|
-
function
|
964
|
+
function xe(e = 20) {
|
712
965
|
return $({
|
713
966
|
queryKey: ["posts", "trending-tags"],
|
714
|
-
queryFn: async ({ pageParam: { afterTag: t } }) =>
|
967
|
+
queryFn: async ({ pageParam: { afterTag: t } }) => c.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
715
968
|
(n) => n.filter((o) => o.name !== "").filter((o) => !o.name.startsWith("hive-")).map((o) => o.name)
|
716
969
|
),
|
717
970
|
initialPageParam: { afterTag: "" },
|
@@ -722,15 +975,15 @@ function Pe(e = 20) {
|
|
722
975
|
refetchOnMount: !0
|
723
976
|
});
|
724
977
|
}
|
725
|
-
function
|
978
|
+
function A(e) {
|
726
979
|
return p({
|
727
980
|
queryKey: ["posts", "fragments", e],
|
728
981
|
queryFn: async () => (await fetch(
|
729
|
-
|
982
|
+
c.privateApiHost + "/private-api/fragments",
|
730
983
|
{
|
731
984
|
method: "POST",
|
732
985
|
body: JSON.stringify({
|
733
|
-
code:
|
986
|
+
code: l(e)
|
734
987
|
}),
|
735
988
|
headers: {
|
736
989
|
"Content-Type": "application/json"
|
@@ -740,12 +993,12 @@ function O(e) {
|
|
740
993
|
enabled: !!e
|
741
994
|
});
|
742
995
|
}
|
743
|
-
function
|
996
|
+
function Ue(e = "feed") {
|
744
997
|
return p({
|
745
998
|
queryKey: ["posts", "promoted", e],
|
746
999
|
queryFn: async () => {
|
747
1000
|
const t = new URL(
|
748
|
-
|
1001
|
+
c.privateApiHost + "/private-api/promoted-entries"
|
749
1002
|
);
|
750
1003
|
return e === "waves" && t.searchParams.append("short_content", "1"), await (await fetch(t.toString(), {
|
751
1004
|
method: "GET",
|
@@ -756,15 +1009,15 @@ function Ee(e = "feed") {
|
|
756
1009
|
}
|
757
1010
|
});
|
758
1011
|
}
|
759
|
-
function
|
1012
|
+
function Ge(e) {
|
760
1013
|
return d({
|
761
1014
|
mutationKey: ["posts", "add-fragment", e],
|
762
1015
|
mutationFn: async ({ title: t, body: n }) => (await fetch(
|
763
|
-
|
1016
|
+
c.privateApiHost + "/private-api/fragments-add",
|
764
1017
|
{
|
765
1018
|
method: "POST",
|
766
1019
|
body: JSON.stringify({
|
767
|
-
code:
|
1020
|
+
code: l(e),
|
768
1021
|
title: t,
|
769
1022
|
body: n
|
770
1023
|
}),
|
@@ -774,22 +1027,22 @@ function Me(e) {
|
|
774
1027
|
}
|
775
1028
|
)).json(),
|
776
1029
|
onSuccess(t) {
|
777
|
-
|
778
|
-
|
1030
|
+
y().setQueryData(
|
1031
|
+
A(e).queryKey,
|
779
1032
|
(n) => [t, ...n ?? []]
|
780
1033
|
);
|
781
1034
|
}
|
782
1035
|
});
|
783
1036
|
}
|
784
|
-
function
|
1037
|
+
function Ve(e, t) {
|
785
1038
|
return d({
|
786
1039
|
mutationKey: ["posts", "edit-fragment", e, t],
|
787
1040
|
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
788
|
-
|
1041
|
+
c.privateApiHost + "/private-api/fragments-update",
|
789
1042
|
{
|
790
1043
|
method: "POST",
|
791
1044
|
body: JSON.stringify({
|
792
|
-
code:
|
1045
|
+
code: l(e),
|
793
1046
|
id: t,
|
794
1047
|
title: n,
|
795
1048
|
body: o
|
@@ -800,25 +1053,25 @@ function Be(e, t) {
|
|
800
1053
|
}
|
801
1054
|
)).json(),
|
802
1055
|
onSuccess(n) {
|
803
|
-
|
804
|
-
|
1056
|
+
y().setQueryData(
|
1057
|
+
A(e).queryKey,
|
805
1058
|
(o) => {
|
806
1059
|
if (!o)
|
807
1060
|
return [];
|
808
|
-
const r = o.findIndex(({ id:
|
1061
|
+
const r = o.findIndex(({ id: a }) => a === t);
|
809
1062
|
return r >= 0 && (o[r] = n), [...o];
|
810
1063
|
}
|
811
1064
|
);
|
812
1065
|
}
|
813
1066
|
});
|
814
1067
|
}
|
815
|
-
function
|
1068
|
+
function We(e, t) {
|
816
1069
|
return d({
|
817
1070
|
mutationKey: ["posts", "remove-fragment", e],
|
818
|
-
mutationFn: async () => fetch(
|
1071
|
+
mutationFn: async () => fetch(c.privateApiHost + "/private-api/fragments-delete", {
|
819
1072
|
method: "POST",
|
820
1073
|
body: JSON.stringify({
|
821
|
-
code:
|
1074
|
+
code: l(e),
|
822
1075
|
id: t
|
823
1076
|
}),
|
824
1077
|
headers: {
|
@@ -826,8 +1079,8 @@ function He(e, t) {
|
|
826
1079
|
}
|
827
1080
|
}),
|
828
1081
|
onSuccess() {
|
829
|
-
|
830
|
-
|
1082
|
+
y().setQueryData(
|
1083
|
+
A(e).queryKey,
|
831
1084
|
(n) => [...n ?? []].filter(({ id: o }) => o !== t)
|
832
1085
|
);
|
833
1086
|
}
|
@@ -839,7 +1092,7 @@ function M(e, t) {
|
|
839
1092
|
mutationFn: async () => {
|
840
1093
|
if (!t)
|
841
1094
|
throw new Error("[SDK][Analytics] – no activity type provided");
|
842
|
-
await fetch(
|
1095
|
+
await fetch(c.plausibleHost + "/api/event", {
|
843
1096
|
method: "POST",
|
844
1097
|
headers: {
|
845
1098
|
"Content-Type": "application/json"
|
@@ -856,29 +1109,29 @@ function M(e, t) {
|
|
856
1109
|
}
|
857
1110
|
});
|
858
1111
|
}
|
859
|
-
const
|
1112
|
+
const ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
860
1113
|
__proto__: null,
|
861
1114
|
useRecordActivity: M
|
862
1115
|
}, Symbol.toStringTag, { value: "Module" }));
|
863
|
-
function
|
1116
|
+
function ce(e, t) {
|
864
1117
|
return p({
|
865
1118
|
queryKey: ["integrations", "hivesigner", "decode-memo", e],
|
866
1119
|
queryFn: async () => {
|
867
|
-
const n =
|
1120
|
+
const n = l(e);
|
868
1121
|
if (n)
|
869
|
-
return new
|
1122
|
+
return new K.Client({
|
870
1123
|
accessToken: n
|
871
1124
|
}).decode(t);
|
872
1125
|
}
|
873
1126
|
});
|
874
1127
|
}
|
875
|
-
const
|
1128
|
+
const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
876
1129
|
__proto__: null,
|
877
|
-
getDecodeMemoQueryOptions:
|
878
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
879
|
-
queries:
|
1130
|
+
getDecodeMemoQueryOptions: ce
|
1131
|
+
}, Symbol.toStringTag, { value: "Module" })), pe = {
|
1132
|
+
queries: ue
|
880
1133
|
};
|
881
|
-
function
|
1134
|
+
function q(e) {
|
882
1135
|
return p({
|
883
1136
|
queryKey: ["integrations", "3speak", "authenticate", e],
|
884
1137
|
enabled: !!e,
|
@@ -892,28 +1145,28 @@ function S(e) {
|
|
892
1145
|
"Content-Type": "application/json"
|
893
1146
|
}
|
894
1147
|
}
|
895
|
-
), n =
|
1148
|
+
), n = pe.queries.getDecodeMemoQueryOptions(
|
896
1149
|
e,
|
897
1150
|
(await t.json()).memo
|
898
1151
|
);
|
899
|
-
await
|
900
|
-
const { memoDecoded: o } =
|
1152
|
+
await y().prefetchQuery(n);
|
1153
|
+
const { memoDecoded: o } = y().getQueryData(
|
901
1154
|
n.queryKey
|
902
1155
|
);
|
903
1156
|
return o.replace("#", "");
|
904
1157
|
}
|
905
1158
|
});
|
906
1159
|
}
|
907
|
-
function
|
1160
|
+
function ye(e) {
|
908
1161
|
return p({
|
909
1162
|
queryKey: ["integrations", "3speak", "videos", e],
|
910
1163
|
enabled: !!e,
|
911
1164
|
queryFn: async () => {
|
912
|
-
await
|
913
|
-
|
1165
|
+
await y().prefetchQuery(
|
1166
|
+
q(e)
|
914
1167
|
);
|
915
|
-
const t =
|
916
|
-
|
1168
|
+
const t = y().getQueryData(
|
1169
|
+
q(e).queryKey
|
917
1170
|
);
|
918
1171
|
return await (await fetch(
|
919
1172
|
"https://studio.3speak.tv/mobile/api/my-videos",
|
@@ -927,14 +1180,14 @@ function ue(e) {
|
|
927
1180
|
}
|
928
1181
|
});
|
929
1182
|
}
|
930
|
-
const
|
1183
|
+
const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
931
1184
|
__proto__: null,
|
932
|
-
getAccountTokenQueryOptions:
|
933
|
-
getAccountVideosQueryOptions:
|
934
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
935
|
-
queries:
|
1185
|
+
getAccountTokenQueryOptions: q,
|
1186
|
+
getAccountVideosQueryOptions: ye
|
1187
|
+
}, Symbol.toStringTag, { value: "Module" })), $e = {
|
1188
|
+
queries: de
|
936
1189
|
};
|
937
|
-
function
|
1190
|
+
function Re(e) {
|
938
1191
|
return p({
|
939
1192
|
queryKey: ["integrations", "hiveposh", "links", e],
|
940
1193
|
queryFn: async () => {
|
@@ -959,24 +1212,24 @@ function Ne(e) {
|
|
959
1212
|
}
|
960
1213
|
});
|
961
1214
|
}
|
962
|
-
function
|
1215
|
+
function Le() {
|
963
1216
|
return p({
|
964
1217
|
queryKey: ["resource-credits", "stats"],
|
965
|
-
queryFn: async () => (await
|
1218
|
+
queryFn: async () => (await c.hiveClient.call(
|
966
1219
|
"rc_api",
|
967
1220
|
"get_rc_stats",
|
968
1221
|
{}
|
969
1222
|
)).rc_stats
|
970
1223
|
});
|
971
1224
|
}
|
972
|
-
function
|
1225
|
+
function Xe(e) {
|
973
1226
|
return p({
|
974
1227
|
queryKey: ["resource-credits", "account", e],
|
975
|
-
queryFn: async () => new
|
1228
|
+
queryFn: async () => new X(c.hiveClient).findRCAccounts([e]),
|
976
1229
|
enabled: !!e
|
977
1230
|
});
|
978
1231
|
}
|
979
|
-
function
|
1232
|
+
function Ye(e, t) {
|
980
1233
|
return p({
|
981
1234
|
queryKey: ["games", "status-check", t, e],
|
982
1235
|
enabled: !!e,
|
@@ -984,12 +1237,12 @@ function Ve(e, t) {
|
|
984
1237
|
if (!e)
|
985
1238
|
throw new Error("[SDK][Games] – anon user in status check");
|
986
1239
|
return await (await fetch(
|
987
|
-
|
1240
|
+
c.privateApiHost + "/private-api/get-game",
|
988
1241
|
{
|
989
1242
|
method: "POST",
|
990
1243
|
body: JSON.stringify({
|
991
1244
|
game_type: t,
|
992
|
-
code:
|
1245
|
+
code: l(e)
|
993
1246
|
}),
|
994
1247
|
headers: {
|
995
1248
|
"Content-Type": "application/json"
|
@@ -999,7 +1252,7 @@ function Ve(e, t) {
|
|
999
1252
|
}
|
1000
1253
|
});
|
1001
1254
|
}
|
1002
|
-
function
|
1255
|
+
function Ze(e, t, n) {
|
1003
1256
|
const { mutateAsync: o } = M(
|
1004
1257
|
e,
|
1005
1258
|
"spin-rolled"
|
@@ -1010,12 +1263,12 @@ function We(e, t, n) {
|
|
1010
1263
|
if (!e)
|
1011
1264
|
throw new Error("[SDK][Games] – anon user in game post");
|
1012
1265
|
return await (await fetch(
|
1013
|
-
|
1266
|
+
c.privateApiHost + "/private-api/post-game",
|
1014
1267
|
{
|
1015
1268
|
method: "POST",
|
1016
1269
|
body: JSON.stringify({
|
1017
1270
|
game_type: t,
|
1018
|
-
code:
|
1271
|
+
code: l(e),
|
1019
1272
|
key: n
|
1020
1273
|
}),
|
1021
1274
|
headers: {
|
@@ -1029,12 +1282,12 @@ function We(e, t, n) {
|
|
1029
1282
|
}
|
1030
1283
|
});
|
1031
1284
|
}
|
1032
|
-
function
|
1285
|
+
function et(e, t, n = 100, o = void 0, r = !0) {
|
1033
1286
|
return p({
|
1034
1287
|
queryKey: ["communities", "list", e, t, n],
|
1035
1288
|
enabled: r,
|
1036
1289
|
queryFn: async () => {
|
1037
|
-
const
|
1290
|
+
const a = await c.hiveClient.call(
|
1038
1291
|
"bridge",
|
1039
1292
|
"list_communities",
|
1040
1293
|
{
|
@@ -1045,16 +1298,16 @@ function ze(e, t, n = 100, o = void 0, r = !0) {
|
|
1045
1298
|
observer: o
|
1046
1299
|
}
|
1047
1300
|
);
|
1048
|
-
return
|
1301
|
+
return a ? e === "hot" ? a.sort(() => Math.random() - 0.5) : a : [];
|
1049
1302
|
}
|
1050
1303
|
});
|
1051
1304
|
}
|
1052
|
-
function
|
1305
|
+
function tt(e, t) {
|
1053
1306
|
return p({
|
1054
1307
|
queryKey: ["community", "context", e, t],
|
1055
1308
|
enabled: !!e && !!t,
|
1056
1309
|
queryFn: async () => {
|
1057
|
-
const n = await
|
1310
|
+
const n = await c.hiveClient.call(
|
1058
1311
|
"bridge",
|
1059
1312
|
"get_community_context",
|
1060
1313
|
{
|
@@ -1069,8 +1322,8 @@ function Ue(e, t) {
|
|
1069
1322
|
}
|
1070
1323
|
});
|
1071
1324
|
}
|
1072
|
-
var
|
1073
|
-
const
|
1325
|
+
var g = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(g || {});
|
1326
|
+
const nt = {
|
1074
1327
|
owner: [
|
1075
1328
|
"admin",
|
1076
1329
|
"mod",
|
@@ -1093,83 +1346,91 @@ const $e = {
|
|
1093
1346
|
/* MUTED */
|
1094
1347
|
]
|
1095
1348
|
};
|
1096
|
-
function
|
1349
|
+
function ot(e, t) {
|
1097
1350
|
return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
|
1098
1351
|
}
|
1099
|
-
function
|
1352
|
+
function rt({
|
1100
1353
|
communityType: e,
|
1101
1354
|
userRole: t,
|
1102
1355
|
subscribed: n
|
1103
1356
|
}) {
|
1104
|
-
const o = t ===
|
1357
|
+
const o = t === g.MUTED ? !1 : e === "Topic" ? !0 : [g.OWNER, g.ADMIN, g.MOD, g.MEMBER].includes(
|
1105
1358
|
t
|
1106
1359
|
), r = (() => {
|
1107
|
-
if (t ===
|
1360
|
+
if (t === g.MUTED) return !1;
|
1108
1361
|
switch (e) {
|
1109
1362
|
case "Topic":
|
1110
1363
|
return !0;
|
1111
1364
|
case "Journal":
|
1112
|
-
return t !==
|
1365
|
+
return t !== g.GUEST || n;
|
1113
1366
|
case "Council":
|
1114
1367
|
return o;
|
1115
1368
|
}
|
1116
|
-
})(),
|
1369
|
+
})(), a = [g.OWNER, g.ADMIN, g.MOD].includes(t);
|
1117
1370
|
return {
|
1118
1371
|
canPost: o,
|
1119
1372
|
canComment: r,
|
1120
|
-
isModerator:
|
1373
|
+
isModerator: a
|
1121
1374
|
};
|
1122
1375
|
}
|
1123
1376
|
export {
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1377
|
+
c as CONFIG,
|
1378
|
+
j as ConfigManager,
|
1379
|
+
ze as EcencyAnalytics,
|
1380
|
+
Q as EcencyQueriesManager,
|
1381
|
+
pe as HiveSignerIntegration,
|
1382
|
+
ve as Keychain,
|
1383
|
+
g as ROLES,
|
1384
|
+
$e as ThreeSpeakIntegration,
|
1132
1385
|
oe as broadcastJson,
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1386
|
+
Se as checkUsernameWalletsPendingQueryOptions,
|
1387
|
+
se as dedupeAndSortKeyAuths,
|
1388
|
+
l as getAccessToken,
|
1389
|
+
b as getAccountFullQueryOptions,
|
1390
|
+
qe as getAccountPendingRecoveryQueryOptions,
|
1391
|
+
Xe as getAccountRcQueryOptions,
|
1392
|
+
Oe as getAccountRecoveriesQueryOptions,
|
1393
|
+
ke as getAccountSubscriptionsQueryOptions,
|
1394
|
+
Ke as getActiveAccountBookmarksQueryOptions,
|
1395
|
+
Ce as getActiveAccountFavouritesQueryOptions,
|
1396
|
+
Ie as getChainPropertiesQueryOptions,
|
1397
|
+
et as getCommunitiesQueryOptions,
|
1398
|
+
tt as getCommunityContextQueryOptions,
|
1399
|
+
rt as getCommunityPermissions,
|
1400
|
+
ot as getCommunityType,
|
1401
|
+
we as getDynamicPropsQueryOptions,
|
1402
|
+
A as getFragmentsQueryOptions,
|
1403
|
+
Ye as getGameStatusCheckQueryOptions,
|
1404
|
+
Re as getHivePoshLinksQueryOptions,
|
1405
|
+
J as getLoginType,
|
1406
|
+
H as getPostingKey,
|
1407
|
+
Ue as getPromotedPostsQuery,
|
1408
|
+
y as getQueryClient,
|
1409
|
+
Le as getRcStatsQueryOptions,
|
1410
|
+
_e as getRefreshToken,
|
1155
1411
|
re as getRelationshipBetweenAccountsQueryOptions,
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1412
|
+
be as getSearchAccountsByUsernameQueryOptions,
|
1413
|
+
xe as getTrendingTagsQueryOptions,
|
1414
|
+
w as getUser,
|
1415
|
+
me as makeQueryClient,
|
1416
|
+
nt as roleMap,
|
1417
|
+
De as useAccountFavouriteAdd,
|
1418
|
+
Fe as useAccountFavouriteDelete,
|
1419
|
+
Te as useAccountRelationsUpdate,
|
1420
|
+
He as useAccountRevokeKey,
|
1421
|
+
Ee as useAccountRevokePosting,
|
1422
|
+
Ae as useAccountUpdate,
|
1423
|
+
ae as useAccountUpdateKeyAuths,
|
1424
|
+
Pe as useAccountUpdatePassword,
|
1425
|
+
Be as useAccountUpdateRecovery,
|
1426
|
+
Ge as useAddFragment,
|
1427
|
+
je as useBookmarkAdd,
|
1428
|
+
Qe as useBookmarkDelete,
|
1168
1429
|
ne as useBroadcastMutation,
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1430
|
+
Ve as useEditFragment,
|
1431
|
+
Ze as useGameClaim,
|
1432
|
+
We as useRemoveFragment,
|
1433
|
+
Ne as useSignOperationByHivesigner,
|
1434
|
+
Je as useSignOperationByKey,
|
1435
|
+
Me as useSignOperationByKeychain
|
1175
1436
|
};
|