@ecency/sdk 1.1.11 → 1.1.13
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 +526 -297
- package/dist/modules/accounts/mutations/index.d.ts +4 -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 +15 -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 k, 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 Q;
|
59
59
|
((e) => {
|
60
60
|
function t(n) {
|
61
|
-
|
61
|
+
c.queryClient = n;
|
62
62
|
}
|
63
63
|
e.setQueryClient = t;
|
64
|
-
})(
|
65
|
-
function
|
64
|
+
})(Q || (Q = {}));
|
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
|
106
|
-
var
|
107
|
-
(
|
105
|
+
const C = (e, t, n, o = null) => new Promise((r, a) => {
|
106
|
+
var i;
|
107
|
+
(i = window.hive_keychain) == null || i.requestBroadcast(
|
108
108
|
e,
|
109
109
|
t,
|
110
110
|
n,
|
111
|
-
(
|
112
|
-
|
111
|
+
(s) => {
|
112
|
+
s.success || a({ message: "Operation cancelled" }), r(s);
|
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((i, s) => {
|
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 || s({ message: "Operation cancelled" }), i(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
|
154
|
-
if (
|
155
|
-
return
|
153
|
+
const i = J(t);
|
154
|
+
if (i && i == "keychain")
|
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 s = l(t);
|
161
|
+
if (s)
|
162
|
+
return (await new K.Client({
|
163
|
+
accessToken: s
|
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 s = _.fromString(r);
|
184
|
+
return c.hiveClient.broadcast.json(
|
185
185
|
o,
|
186
|
-
|
186
|
+
s
|
187
187
|
);
|
188
188
|
}
|
189
|
-
const
|
190
|
-
if (
|
191
|
-
return
|
192
|
-
let
|
193
|
-
if (
|
194
|
-
return (await new
|
195
|
-
accessToken:
|
189
|
+
const a = J(e);
|
190
|
+
if (a && a == "keychain")
|
191
|
+
return C(e, [["custom_json", o]], "Posting").then((s) => s.result);
|
192
|
+
let i = l(e);
|
193
|
+
if (i)
|
194
|
+
return (await new K.Client({
|
195
|
+
accessToken: i
|
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 j;
|
216
216
|
((e) => {
|
217
|
-
function t(
|
218
|
-
return
|
217
|
+
function t(s) {
|
218
|
+
return y().getQueryData(s);
|
219
219
|
}
|
220
220
|
e.getQueryData = t;
|
221
|
-
function n(
|
222
|
-
return
|
221
|
+
function n(s) {
|
222
|
+
return y().getQueryData(s);
|
223
223
|
}
|
224
224
|
e.getInfiniteQueryData = n;
|
225
|
-
async function o(
|
226
|
-
return await
|
225
|
+
async function o(s) {
|
226
|
+
return await y().prefetchQuery(s), t(s.queryKey);
|
227
227
|
}
|
228
228
|
e.prefetchQuery = o;
|
229
|
-
async function r(
|
230
|
-
return await
|
229
|
+
async function r(s) {
|
230
|
+
return await y().prefetchInfiniteQuery(s), n(s.queryKey);
|
231
231
|
}
|
232
232
|
e.prefetchInfiniteQuery = r;
|
233
|
-
function
|
233
|
+
function a(s) {
|
234
234
|
return {
|
235
|
-
prefetch: () => o(
|
236
|
-
getData: () => t(
|
237
|
-
useClientQuery: () =>
|
238
|
-
fetchAndGet: () =>
|
235
|
+
prefetch: () => o(s),
|
236
|
+
getData: () => t(s.queryKey),
|
237
|
+
useClientQuery: () => k(s),
|
238
|
+
fetchAndGet: () => y().fetchQuery(s)
|
239
239
|
};
|
240
240
|
}
|
241
|
-
e.generateClientServerQuery =
|
242
|
-
function s
|
241
|
+
e.generateClientServerQuery = a;
|
242
|
+
function i(s) {
|
243
243
|
return {
|
244
|
-
prefetch: () => r(
|
245
|
-
getData: () => n(
|
246
|
-
useClientQuery: () => z(
|
247
|
-
fetchAndGet: () =>
|
244
|
+
prefetch: () => r(s),
|
245
|
+
getData: () => n(s.queryKey),
|
246
|
+
useClientQuery: () => z(s),
|
247
|
+
fetchAndGet: () => y().fetchInfiniteQuery(s)
|
248
248
|
};
|
249
249
|
}
|
250
|
-
e.generateClientServerInfiniteQuery =
|
251
|
-
})(
|
252
|
-
function
|
250
|
+
e.generateClientServerInfiniteQuery = i;
|
251
|
+
})(j || (j = {}));
|
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, i = m(t.current_median_history.quote).amount, s = parseFloat(o.recent_claims), u = m(o.reward_balance).amount, h = e.hbd_print_rate, S = 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, G = e.vesting_reward_percent, U = n.account_creation_fee;
|
277
277
|
return {
|
278
278
|
hivePerMVests: r,
|
279
|
-
base:
|
280
|
-
quote:
|
281
|
-
fundRecentClaims:
|
282
|
-
fundRewardBalance:
|
283
|
-
hbdPrintRate:
|
284
|
-
hbdInterestRate:
|
285
|
-
headBlock:
|
286
|
-
totalVestingFund:
|
287
|
-
totalVestingShares:
|
288
|
-
virtualSupply:
|
289
|
-
vestingRewardPercent:
|
290
|
-
accountCreationFee:
|
279
|
+
base: a,
|
280
|
+
quote: i,
|
281
|
+
fundRecentClaims: s,
|
282
|
+
fundRewardBalance: u,
|
283
|
+
hbdPrintRate: h,
|
284
|
+
hbdInterestRate: S,
|
285
|
+
headBlock: O,
|
286
|
+
totalVestingFund: N,
|
287
|
+
totalVestingShares: I,
|
288
|
+
virtualSupply: x,
|
289
|
+
vestingRewardPercent: G,
|
290
|
+
accountCreationFee: U
|
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 } = k(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
|
514
|
-
return
|
536
|
+
b(e).queryKey,
|
537
|
+
(a) => {
|
538
|
+
if (!a)
|
539
|
+
return a;
|
540
|
+
const i = f.clone(a);
|
541
|
+
return i.profile = D({ ...r, data: a }), i;
|
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
|
529
|
-
|
554
|
+
await y().prefetchQuery(a);
|
555
|
+
const i = y().getQueryData(
|
556
|
+
a.queryKey
|
530
557
|
);
|
531
558
|
return await oe(e, "follow", [
|
532
559
|
"follow",
|
@@ -534,33 +561,33 @@ function Ke(e, t, n, o) {
|
|
534
561
|
follower: e,
|
535
562
|
following: t,
|
536
563
|
what: [
|
537
|
-
...r === "toggle-ignore" && !(
|
538
|
-
...r === "toggle-follow" && !(
|
564
|
+
...r === "toggle-ignore" && !(i != null && i.ignores) ? ["ignore"] : [],
|
565
|
+
...r === "toggle-follow" && !(i != null && i.follows) ? ["blog"] : []
|
539
566
|
]
|
540
567
|
}
|
541
568
|
]), {
|
542
|
-
...
|
543
|
-
ignores: r === "toggle-ignore" ? !(
|
544
|
-
follows: r === "toggle-follow" ? !(
|
569
|
+
...i,
|
570
|
+
ignores: r === "toggle-ignore" ? !(i != null && i.ignores) : i == null ? void 0 : i.ignores,
|
571
|
+
follows: r === "toggle-follow" ? !(i != null && i.follows) : i == null ? void 0 : i.follows
|
545
572
|
};
|
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 Qe(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 je(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,216 @@ 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 } = k(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 i = (s) => {
|
717
|
+
const u = f.clone(n[s]);
|
718
|
+
return u.key_auths = se(
|
719
|
+
r ? u.key_auths : [],
|
720
|
+
o.map(
|
721
|
+
(h, S) => [h[s].createPublic().toString(), S + 1]
|
722
|
+
)
|
723
|
+
), u;
|
724
|
+
};
|
725
|
+
return c.hiveClient.broadcast.updateAccount(
|
726
|
+
{
|
727
|
+
account: e,
|
728
|
+
json_metadata: n.json_metadata,
|
729
|
+
owner: i("owner"),
|
730
|
+
active: i("active"),
|
731
|
+
posting: i("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 } = k(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: i
|
748
|
+
}) => {
|
749
|
+
if (!n)
|
750
|
+
throw new Error(
|
751
|
+
"[SDK][Update password] – cannot update password for anon user"
|
752
|
+
);
|
753
|
+
const s = _.fromLogin(
|
754
|
+
e,
|
755
|
+
a,
|
756
|
+
"owner"
|
757
|
+
);
|
758
|
+
return o({
|
759
|
+
currentKey: s,
|
760
|
+
keepCurrent: i,
|
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 } = k(b(e));
|
776
|
+
return d({
|
777
|
+
mutationKey: ["accounts", "revoke-posting", o == null ? void 0 : o.name],
|
778
|
+
mutationFn: async ({ accountName: r, type: a, key: i }) => {
|
779
|
+
if (!o)
|
780
|
+
throw new Error(
|
781
|
+
"[SDK][Accounts] – cannot revoke posting for anonymous user"
|
782
|
+
);
|
783
|
+
const s = f.pipe(
|
784
|
+
{},
|
785
|
+
f.mergeDeep(o.posting)
|
786
|
+
);
|
787
|
+
s.account_auths = s.account_auths.filter(
|
788
|
+
([h]) => h !== r
|
789
|
+
);
|
790
|
+
const u = {
|
791
|
+
account: o.name,
|
792
|
+
posting: s,
|
793
|
+
memo_key: o.memo_key,
|
794
|
+
json_metadata: o.json_metadata
|
795
|
+
};
|
796
|
+
if (a === "key" && i)
|
797
|
+
return c.hiveClient.broadcast.updateAccount(u, i);
|
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, i) => {
|
818
|
+
var s;
|
819
|
+
(s = t.onSuccess) == null || s.call(t, r, a, i), n.setQueryData(
|
820
|
+
b(e).queryKey,
|
821
|
+
(u) => {
|
822
|
+
var h, S;
|
823
|
+
return {
|
824
|
+
...u,
|
825
|
+
posting: {
|
826
|
+
...u == null ? void 0 : u.posting,
|
827
|
+
account_auths: ((S = (h = u == null ? void 0 : u.posting) == null ? void 0 : h.account_auths) == null ? void 0 : S.filter(
|
828
|
+
([O]) => O !== a.accountName
|
829
|
+
)) ?? []
|
830
|
+
}
|
831
|
+
};
|
832
|
+
}
|
833
|
+
);
|
834
|
+
}
|
835
|
+
});
|
836
|
+
}
|
837
|
+
function Be(e, t) {
|
838
|
+
const { data: n } = k(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: i }) => {
|
842
|
+
if (!n)
|
843
|
+
throw new Error(
|
844
|
+
"[SDK][Accounts] – cannot change recovery for anonymous user"
|
845
|
+
);
|
846
|
+
const s = {
|
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: i,
|
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", s]],
|
868
|
+
a
|
869
|
+
);
|
870
|
+
if (r === "keychain")
|
871
|
+
return C(
|
872
|
+
n.name,
|
873
|
+
[["change_recovery_account", s]],
|
874
|
+
"Active"
|
875
|
+
);
|
876
|
+
{
|
877
|
+
const u = {
|
878
|
+
callback: `https://ecency.com/@${n.name}/permissions`
|
879
|
+
};
|
880
|
+
return K.sendOperation(
|
881
|
+
["change_recovery_account", s],
|
882
|
+
u,
|
883
|
+
() => {
|
884
|
+
}
|
885
|
+
);
|
886
|
+
}
|
887
|
+
},
|
888
|
+
onError: t.onError,
|
889
|
+
onSuccess: t.onSuccess
|
890
|
+
});
|
891
|
+
}
|
892
|
+
function He(e) {
|
670
893
|
return d({
|
671
894
|
mutationKey: ["operations", "sign", e],
|
672
895
|
mutationFn: ({
|
@@ -676,14 +899,14 @@ function Ae(e) {
|
|
676
899
|
if (!e)
|
677
900
|
throw new Error("[Operations][Sign] – cannot sign op with anon user");
|
678
901
|
let o;
|
679
|
-
return n.split(" ").length === 12 ? o =
|
902
|
+
return n.split(" ").length === 12 ? o = _.fromLogin(e, n, "active") : L.isWif(n) ? o = _.fromString(n) : o = _.from(n), c.hiveClient.broadcast.sendOperations(
|
680
903
|
[t],
|
681
904
|
o
|
682
905
|
);
|
683
906
|
}
|
684
907
|
});
|
685
908
|
}
|
686
|
-
function
|
909
|
+
function Je(e, t = "Active") {
|
687
910
|
return d({
|
688
911
|
mutationKey: ["operations", "sign-keychain", e],
|
689
912
|
mutationFn: ({ operation: n }) => {
|
@@ -691,27 +914,27 @@ function je(e, t = "Active") {
|
|
691
914
|
throw new Error(
|
692
915
|
"[SDK][Keychain] – cannot sign operation with anon user"
|
693
916
|
);
|
694
|
-
return
|
917
|
+
return C(e, [n], t);
|
695
918
|
}
|
696
919
|
});
|
697
920
|
}
|
698
|
-
function
|
921
|
+
function Me(e = "/") {
|
699
922
|
return d({
|
700
923
|
mutationKey: ["operations", "sign-hivesigner", e],
|
701
|
-
mutationFn: async ({ operation: t }) =>
|
924
|
+
mutationFn: async ({ operation: t }) => K.sendOperation(t, { callback: e }, () => {
|
702
925
|
})
|
703
926
|
});
|
704
927
|
}
|
705
|
-
function
|
928
|
+
function Ne() {
|
706
929
|
return p({
|
707
930
|
queryKey: ["operations", "chain-properties"],
|
708
|
-
queryFn: async () => await
|
931
|
+
queryFn: async () => await c.hiveClient.database.getChainProperties()
|
709
932
|
});
|
710
933
|
}
|
711
|
-
function
|
934
|
+
function Ie(e = 20) {
|
712
935
|
return $({
|
713
936
|
queryKey: ["posts", "trending-tags"],
|
714
|
-
queryFn: async ({ pageParam: { afterTag: t } }) =>
|
937
|
+
queryFn: async ({ pageParam: { afterTag: t } }) => c.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
715
938
|
(n) => n.filter((o) => o.name !== "").filter((o) => !o.name.startsWith("hive-")).map((o) => o.name)
|
716
939
|
),
|
717
940
|
initialPageParam: { afterTag: "" },
|
@@ -722,15 +945,15 @@ function Pe(e = 20) {
|
|
722
945
|
refetchOnMount: !0
|
723
946
|
});
|
724
947
|
}
|
725
|
-
function
|
948
|
+
function A(e) {
|
726
949
|
return p({
|
727
950
|
queryKey: ["posts", "fragments", e],
|
728
951
|
queryFn: async () => (await fetch(
|
729
|
-
|
952
|
+
c.privateApiHost + "/private-api/fragments",
|
730
953
|
{
|
731
954
|
method: "POST",
|
732
955
|
body: JSON.stringify({
|
733
|
-
code:
|
956
|
+
code: l(e)
|
734
957
|
}),
|
735
958
|
headers: {
|
736
959
|
"Content-Type": "application/json"
|
@@ -740,12 +963,12 @@ function O(e) {
|
|
740
963
|
enabled: !!e
|
741
964
|
});
|
742
965
|
}
|
743
|
-
function
|
966
|
+
function xe(e = "feed") {
|
744
967
|
return p({
|
745
968
|
queryKey: ["posts", "promoted", e],
|
746
969
|
queryFn: async () => {
|
747
970
|
const t = new URL(
|
748
|
-
|
971
|
+
c.privateApiHost + "/private-api/promoted-entries"
|
749
972
|
);
|
750
973
|
return e === "waves" && t.searchParams.append("short_content", "1"), await (await fetch(t.toString(), {
|
751
974
|
method: "GET",
|
@@ -756,15 +979,15 @@ function Ee(e = "feed") {
|
|
756
979
|
}
|
757
980
|
});
|
758
981
|
}
|
759
|
-
function
|
982
|
+
function Ge(e) {
|
760
983
|
return d({
|
761
984
|
mutationKey: ["posts", "add-fragment", e],
|
762
985
|
mutationFn: async ({ title: t, body: n }) => (await fetch(
|
763
|
-
|
986
|
+
c.privateApiHost + "/private-api/fragments-add",
|
764
987
|
{
|
765
988
|
method: "POST",
|
766
989
|
body: JSON.stringify({
|
767
|
-
code:
|
990
|
+
code: l(e),
|
768
991
|
title: t,
|
769
992
|
body: n
|
770
993
|
}),
|
@@ -774,22 +997,22 @@ function Me(e) {
|
|
774
997
|
}
|
775
998
|
)).json(),
|
776
999
|
onSuccess(t) {
|
777
|
-
|
778
|
-
|
1000
|
+
y().setQueryData(
|
1001
|
+
A(e).queryKey,
|
779
1002
|
(n) => [t, ...n ?? []]
|
780
1003
|
);
|
781
1004
|
}
|
782
1005
|
});
|
783
1006
|
}
|
784
|
-
function
|
1007
|
+
function Ue(e, t) {
|
785
1008
|
return d({
|
786
1009
|
mutationKey: ["posts", "edit-fragment", e, t],
|
787
1010
|
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
788
|
-
|
1011
|
+
c.privateApiHost + "/private-api/fragments-update",
|
789
1012
|
{
|
790
1013
|
method: "POST",
|
791
1014
|
body: JSON.stringify({
|
792
|
-
code:
|
1015
|
+
code: l(e),
|
793
1016
|
id: t,
|
794
1017
|
title: n,
|
795
1018
|
body: o
|
@@ -800,25 +1023,25 @@ function Be(e, t) {
|
|
800
1023
|
}
|
801
1024
|
)).json(),
|
802
1025
|
onSuccess(n) {
|
803
|
-
|
804
|
-
|
1026
|
+
y().setQueryData(
|
1027
|
+
A(e).queryKey,
|
805
1028
|
(o) => {
|
806
1029
|
if (!o)
|
807
1030
|
return [];
|
808
|
-
const r = o.findIndex(({ id:
|
1031
|
+
const r = o.findIndex(({ id: a }) => a === t);
|
809
1032
|
return r >= 0 && (o[r] = n), [...o];
|
810
1033
|
}
|
811
1034
|
);
|
812
1035
|
}
|
813
1036
|
});
|
814
1037
|
}
|
815
|
-
function
|
1038
|
+
function Ve(e, t) {
|
816
1039
|
return d({
|
817
1040
|
mutationKey: ["posts", "remove-fragment", e],
|
818
|
-
mutationFn: async () => fetch(
|
1041
|
+
mutationFn: async () => fetch(c.privateApiHost + "/private-api/fragments-delete", {
|
819
1042
|
method: "POST",
|
820
1043
|
body: JSON.stringify({
|
821
|
-
code:
|
1044
|
+
code: l(e),
|
822
1045
|
id: t
|
823
1046
|
}),
|
824
1047
|
headers: {
|
@@ -826,8 +1049,8 @@ function He(e, t) {
|
|
826
1049
|
}
|
827
1050
|
}),
|
828
1051
|
onSuccess() {
|
829
|
-
|
830
|
-
|
1052
|
+
y().setQueryData(
|
1053
|
+
A(e).queryKey,
|
831
1054
|
(n) => [...n ?? []].filter(({ id: o }) => o !== t)
|
832
1055
|
);
|
833
1056
|
}
|
@@ -839,7 +1062,7 @@ function M(e, t) {
|
|
839
1062
|
mutationFn: async () => {
|
840
1063
|
if (!t)
|
841
1064
|
throw new Error("[SDK][Analytics] – no activity type provided");
|
842
|
-
await fetch(
|
1065
|
+
await fetch(c.plausibleHost + "/api/event", {
|
843
1066
|
method: "POST",
|
844
1067
|
headers: {
|
845
1068
|
"Content-Type": "application/json"
|
@@ -856,29 +1079,29 @@ function M(e, t) {
|
|
856
1079
|
}
|
857
1080
|
});
|
858
1081
|
}
|
859
|
-
const
|
1082
|
+
const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
860
1083
|
__proto__: null,
|
861
1084
|
useRecordActivity: M
|
862
1085
|
}, Symbol.toStringTag, { value: "Module" }));
|
863
|
-
function
|
1086
|
+
function ce(e, t) {
|
864
1087
|
return p({
|
865
1088
|
queryKey: ["integrations", "hivesigner", "decode-memo", e],
|
866
1089
|
queryFn: async () => {
|
867
|
-
const n =
|
1090
|
+
const n = l(e);
|
868
1091
|
if (n)
|
869
|
-
return new
|
1092
|
+
return new K.Client({
|
870
1093
|
accessToken: n
|
871
1094
|
}).decode(t);
|
872
1095
|
}
|
873
1096
|
});
|
874
1097
|
}
|
875
|
-
const
|
1098
|
+
const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
876
1099
|
__proto__: null,
|
877
|
-
getDecodeMemoQueryOptions:
|
878
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
879
|
-
queries:
|
1100
|
+
getDecodeMemoQueryOptions: ce
|
1101
|
+
}, Symbol.toStringTag, { value: "Module" })), pe = {
|
1102
|
+
queries: ue
|
880
1103
|
};
|
881
|
-
function
|
1104
|
+
function q(e) {
|
882
1105
|
return p({
|
883
1106
|
queryKey: ["integrations", "3speak", "authenticate", e],
|
884
1107
|
enabled: !!e,
|
@@ -892,28 +1115,28 @@ function S(e) {
|
|
892
1115
|
"Content-Type": "application/json"
|
893
1116
|
}
|
894
1117
|
}
|
895
|
-
), n =
|
1118
|
+
), n = pe.queries.getDecodeMemoQueryOptions(
|
896
1119
|
e,
|
897
1120
|
(await t.json()).memo
|
898
1121
|
);
|
899
|
-
await
|
900
|
-
const { memoDecoded: o } =
|
1122
|
+
await y().prefetchQuery(n);
|
1123
|
+
const { memoDecoded: o } = y().getQueryData(
|
901
1124
|
n.queryKey
|
902
1125
|
);
|
903
1126
|
return o.replace("#", "");
|
904
1127
|
}
|
905
1128
|
});
|
906
1129
|
}
|
907
|
-
function
|
1130
|
+
function ye(e) {
|
908
1131
|
return p({
|
909
1132
|
queryKey: ["integrations", "3speak", "videos", e],
|
910
1133
|
enabled: !!e,
|
911
1134
|
queryFn: async () => {
|
912
|
-
await
|
913
|
-
|
1135
|
+
await y().prefetchQuery(
|
1136
|
+
q(e)
|
914
1137
|
);
|
915
|
-
const t =
|
916
|
-
|
1138
|
+
const t = y().getQueryData(
|
1139
|
+
q(e).queryKey
|
917
1140
|
);
|
918
1141
|
return await (await fetch(
|
919
1142
|
"https://studio.3speak.tv/mobile/api/my-videos",
|
@@ -927,14 +1150,14 @@ function ue(e) {
|
|
927
1150
|
}
|
928
1151
|
});
|
929
1152
|
}
|
930
|
-
const
|
1153
|
+
const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
931
1154
|
__proto__: null,
|
932
|
-
getAccountTokenQueryOptions:
|
933
|
-
getAccountVideosQueryOptions:
|
934
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
935
|
-
queries:
|
1155
|
+
getAccountTokenQueryOptions: q,
|
1156
|
+
getAccountVideosQueryOptions: ye
|
1157
|
+
}, Symbol.toStringTag, { value: "Module" })), ze = {
|
1158
|
+
queries: de
|
936
1159
|
};
|
937
|
-
function
|
1160
|
+
function $e(e) {
|
938
1161
|
return p({
|
939
1162
|
queryKey: ["integrations", "hiveposh", "links", e],
|
940
1163
|
queryFn: async () => {
|
@@ -959,24 +1182,24 @@ function Ne(e) {
|
|
959
1182
|
}
|
960
1183
|
});
|
961
1184
|
}
|
962
|
-
function
|
1185
|
+
function Re() {
|
963
1186
|
return p({
|
964
1187
|
queryKey: ["resource-credits", "stats"],
|
965
|
-
queryFn: async () => (await
|
1188
|
+
queryFn: async () => (await c.hiveClient.call(
|
966
1189
|
"rc_api",
|
967
1190
|
"get_rc_stats",
|
968
1191
|
{}
|
969
1192
|
)).rc_stats
|
970
1193
|
});
|
971
1194
|
}
|
972
|
-
function
|
1195
|
+
function Le(e) {
|
973
1196
|
return p({
|
974
1197
|
queryKey: ["resource-credits", "account", e],
|
975
|
-
queryFn: async () => new
|
1198
|
+
queryFn: async () => new X(c.hiveClient).findRCAccounts([e]),
|
976
1199
|
enabled: !!e
|
977
1200
|
});
|
978
1201
|
}
|
979
|
-
function
|
1202
|
+
function Xe(e, t) {
|
980
1203
|
return p({
|
981
1204
|
queryKey: ["games", "status-check", t, e],
|
982
1205
|
enabled: !!e,
|
@@ -984,12 +1207,12 @@ function Ve(e, t) {
|
|
984
1207
|
if (!e)
|
985
1208
|
throw new Error("[SDK][Games] – anon user in status check");
|
986
1209
|
return await (await fetch(
|
987
|
-
|
1210
|
+
c.privateApiHost + "/private-api/get-game",
|
988
1211
|
{
|
989
1212
|
method: "POST",
|
990
1213
|
body: JSON.stringify({
|
991
1214
|
game_type: t,
|
992
|
-
code:
|
1215
|
+
code: l(e)
|
993
1216
|
}),
|
994
1217
|
headers: {
|
995
1218
|
"Content-Type": "application/json"
|
@@ -999,7 +1222,7 @@ function Ve(e, t) {
|
|
999
1222
|
}
|
1000
1223
|
});
|
1001
1224
|
}
|
1002
|
-
function
|
1225
|
+
function Ye(e, t, n) {
|
1003
1226
|
const { mutateAsync: o } = M(
|
1004
1227
|
e,
|
1005
1228
|
"spin-rolled"
|
@@ -1010,12 +1233,12 @@ function We(e, t, n) {
|
|
1010
1233
|
if (!e)
|
1011
1234
|
throw new Error("[SDK][Games] – anon user in game post");
|
1012
1235
|
return await (await fetch(
|
1013
|
-
|
1236
|
+
c.privateApiHost + "/private-api/post-game",
|
1014
1237
|
{
|
1015
1238
|
method: "POST",
|
1016
1239
|
body: JSON.stringify({
|
1017
1240
|
game_type: t,
|
1018
|
-
code:
|
1241
|
+
code: l(e),
|
1019
1242
|
key: n
|
1020
1243
|
}),
|
1021
1244
|
headers: {
|
@@ -1029,12 +1252,12 @@ function We(e, t, n) {
|
|
1029
1252
|
}
|
1030
1253
|
});
|
1031
1254
|
}
|
1032
|
-
function
|
1255
|
+
function Ze(e, t, n = 100, o = void 0, r = !0) {
|
1033
1256
|
return p({
|
1034
1257
|
queryKey: ["communities", "list", e, t, n],
|
1035
1258
|
enabled: r,
|
1036
1259
|
queryFn: async () => {
|
1037
|
-
const
|
1260
|
+
const a = await c.hiveClient.call(
|
1038
1261
|
"bridge",
|
1039
1262
|
"list_communities",
|
1040
1263
|
{
|
@@ -1045,16 +1268,16 @@ function ze(e, t, n = 100, o = void 0, r = !0) {
|
|
1045
1268
|
observer: o
|
1046
1269
|
}
|
1047
1270
|
);
|
1048
|
-
return
|
1271
|
+
return a ? e === "hot" ? a.sort(() => Math.random() - 0.5) : a : [];
|
1049
1272
|
}
|
1050
1273
|
});
|
1051
1274
|
}
|
1052
|
-
function
|
1275
|
+
function et(e, t) {
|
1053
1276
|
return p({
|
1054
1277
|
queryKey: ["community", "context", e, t],
|
1055
1278
|
enabled: !!e && !!t,
|
1056
1279
|
queryFn: async () => {
|
1057
|
-
const n = await
|
1280
|
+
const n = await c.hiveClient.call(
|
1058
1281
|
"bridge",
|
1059
1282
|
"get_community_context",
|
1060
1283
|
{
|
@@ -1069,8 +1292,8 @@ function Ue(e, t) {
|
|
1069
1292
|
}
|
1070
1293
|
});
|
1071
1294
|
}
|
1072
|
-
var
|
1073
|
-
const
|
1295
|
+
var g = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(g || {});
|
1296
|
+
const tt = {
|
1074
1297
|
owner: [
|
1075
1298
|
"admin",
|
1076
1299
|
"mod",
|
@@ -1093,83 +1316,89 @@ const $e = {
|
|
1093
1316
|
/* MUTED */
|
1094
1317
|
]
|
1095
1318
|
};
|
1096
|
-
function
|
1319
|
+
function nt(e, t) {
|
1097
1320
|
return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
|
1098
1321
|
}
|
1099
|
-
function
|
1322
|
+
function ot({
|
1100
1323
|
communityType: e,
|
1101
1324
|
userRole: t,
|
1102
1325
|
subscribed: n
|
1103
1326
|
}) {
|
1104
|
-
const o = t ===
|
1327
|
+
const o = t === g.MUTED ? !1 : e === "Topic" ? !0 : [g.OWNER, g.ADMIN, g.MOD, g.MEMBER].includes(
|
1105
1328
|
t
|
1106
1329
|
), r = (() => {
|
1107
|
-
if (t ===
|
1330
|
+
if (t === g.MUTED) return !1;
|
1108
1331
|
switch (e) {
|
1109
1332
|
case "Topic":
|
1110
1333
|
return !0;
|
1111
1334
|
case "Journal":
|
1112
|
-
return t !==
|
1335
|
+
return t !== g.GUEST || n;
|
1113
1336
|
case "Council":
|
1114
1337
|
return o;
|
1115
1338
|
}
|
1116
|
-
})(),
|
1339
|
+
})(), a = [g.OWNER, g.ADMIN, g.MOD].includes(t);
|
1117
1340
|
return {
|
1118
1341
|
canPost: o,
|
1119
1342
|
canComment: r,
|
1120
|
-
isModerator:
|
1343
|
+
isModerator: a
|
1121
1344
|
};
|
1122
1345
|
}
|
1123
1346
|
export {
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1347
|
+
c as CONFIG,
|
1348
|
+
Q as ConfigManager,
|
1349
|
+
We as EcencyAnalytics,
|
1350
|
+
j as EcencyQueriesManager,
|
1351
|
+
pe as HiveSignerIntegration,
|
1352
|
+
ve as Keychain,
|
1353
|
+
g as ROLES,
|
1354
|
+
ze as ThreeSpeakIntegration,
|
1132
1355
|
oe as broadcastJson,
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
xe as
|
1154
|
-
|
1356
|
+
Se as checkUsernameWalletsPendingQueryOptions,
|
1357
|
+
l as getAccessToken,
|
1358
|
+
b as getAccountFullQueryOptions,
|
1359
|
+
qe as getAccountPendingRecoveryQueryOptions,
|
1360
|
+
Le as getAccountRcQueryOptions,
|
1361
|
+
Oe as getAccountRecoveriesQueryOptions,
|
1362
|
+
ke as getAccountSubscriptionsQueryOptions,
|
1363
|
+
Ke as getActiveAccountBookmarksQueryOptions,
|
1364
|
+
Ce as getActiveAccountFavouritesQueryOptions,
|
1365
|
+
Ne as getChainPropertiesQueryOptions,
|
1366
|
+
Ze as getCommunitiesQueryOptions,
|
1367
|
+
et as getCommunityContextQueryOptions,
|
1368
|
+
ot as getCommunityPermissions,
|
1369
|
+
nt as getCommunityType,
|
1370
|
+
we as getDynamicPropsQueryOptions,
|
1371
|
+
A as getFragmentsQueryOptions,
|
1372
|
+
Xe as getGameStatusCheckQueryOptions,
|
1373
|
+
$e as getHivePoshLinksQueryOptions,
|
1374
|
+
J as getLoginType,
|
1375
|
+
H as getPostingKey,
|
1376
|
+
xe as getPromotedPostsQuery,
|
1377
|
+
y as getQueryClient,
|
1378
|
+
Re as getRcStatsQueryOptions,
|
1379
|
+
_e as getRefreshToken,
|
1155
1380
|
re as getRelationshipBetweenAccountsQueryOptions,
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1381
|
+
be as getSearchAccountsByUsernameQueryOptions,
|
1382
|
+
Ie as getTrendingTagsQueryOptions,
|
1383
|
+
w as getUser,
|
1384
|
+
me as makeQueryClient,
|
1385
|
+
tt as roleMap,
|
1386
|
+
De as useAccountFavouriteAdd,
|
1387
|
+
Fe as useAccountFavouriteDelete,
|
1388
|
+
Te as useAccountRelationsUpdate,
|
1389
|
+
Ee as useAccountRevokePosting,
|
1390
|
+
Ae as useAccountUpdate,
|
1391
|
+
ae as useAccountUpdateKeyAuths,
|
1392
|
+
Pe as useAccountUpdatePassword,
|
1393
|
+
Be as useAccountUpdateRecovery,
|
1394
|
+
Ge as useAddFragment,
|
1395
|
+
Qe as useBookmarkAdd,
|
1396
|
+
je as useBookmarkDelete,
|
1168
1397
|
ne as useBroadcastMutation,
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1398
|
+
Ue as useEditFragment,
|
1399
|
+
Ye as useGameClaim,
|
1400
|
+
Ve as useRemoveFragment,
|
1401
|
+
Me as useSignOperationByHivesigner,
|
1402
|
+
He as useSignOperationByKey,
|
1403
|
+
Je as useSignOperationByKeychain
|
1175
1404
|
};
|