@ecency/sdk 1.0.56 → 1.1.0
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 +284 -197
- package/dist/index.d.ts +0 -1
- package/dist/modules/accounts/queries/get-account-full-query-options.d.ts +196 -368
- package/dist/modules/accounts/types/account-profile.d.ts +1 -0
- package/dist/modules/accounts/types/full-account.d.ts +52 -0
- package/dist/modules/accounts/types/index.d.ts +1 -0
- package/dist/modules/core/config.d.ts +1 -0
- package/dist/modules/core/index.d.ts +2 -0
- package/dist/modules/core/queries/get-dynamic-props-query-options.d.ts +9 -0
- package/dist/modules/core/queries/index.d.ts +1 -0
- package/dist/modules/core/types/dynamic-props.d.ts +15 -0
- package/dist/modules/core/types/index.d.ts +1 -0
- package/dist/modules/core/utils/index.d.ts +1 -0
- package/dist/modules/core/utils/parse-asset.d.ts +17 -0
- package/dist/modules/keychain/keychain.d.ts +1 -0
- package/package.json +1 -1
- package/dist/modules/hive-engine/index.d.ts +0 -1
- package/dist/modules/hive-engine/queries/index.d.ts +0 -1
- package/dist/modules/hive-engine/queries/use-get-hive-engine-tokens-list-query-options.d.ts +0 -8
- package/dist/modules/hive-engine/types/hive-engine-list-response.d.ts +0 -18
- package/dist/modules/hive-engine/types/index.d.ts +0 -1
package/dist/ecency-sdk.es.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var O = (e, t, n) =>
|
4
|
-
import { QueryClient as
|
5
|
-
import { Client as
|
6
|
-
import
|
7
|
-
class
|
1
|
+
var N = Object.defineProperty;
|
2
|
+
var x = (e, t, n) => t in e ? N(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
3
|
+
var O = (e, t, n) => x(e, typeof t != "symbol" ? t + "" : t, n);
|
4
|
+
import { QueryClient as q, useMutation as d, useQuery as T, useInfiniteQuery as G, queryOptions as p, infiniteQueryOptions as V } from "@tanstack/react-query";
|
5
|
+
import { Client as W, PrivateKey as v, cryptoUtils as z, RCAPI as U } from "@hiveio/dhive";
|
6
|
+
import m from "hivesigner";
|
7
|
+
class $ {
|
8
8
|
constructor() {
|
9
9
|
O(this, "length", 0);
|
10
10
|
}
|
@@ -26,9 +26,9 @@ class M {
|
|
26
26
|
}
|
27
27
|
const i = {
|
28
28
|
privateApiHost: "https://ecency.com",
|
29
|
-
storage: typeof window > "u" ? new
|
29
|
+
storage: typeof window > "u" ? new $() : window.localStorage,
|
30
30
|
storagePrefix: "ecency",
|
31
|
-
hiveClient: new
|
31
|
+
hiveClient: new W(
|
32
32
|
[
|
33
33
|
"https://api.hive.blog",
|
34
34
|
"https://api.deathwing.me",
|
@@ -49,33 +49,50 @@ const i = {
|
|
49
49
|
}
|
50
50
|
),
|
51
51
|
heliusApiKey: void 0,
|
52
|
-
queryClient: new
|
53
|
-
plausibleHost: "https://pl.ecency.com"
|
52
|
+
queryClient: new q(),
|
53
|
+
plausibleHost: "https://pl.ecency.com",
|
54
|
+
spkNode: "https://spk.good-karma.xyz"
|
54
55
|
};
|
55
|
-
var
|
56
|
+
var k;
|
56
57
|
((e) => {
|
57
58
|
function t(n) {
|
58
59
|
i.queryClient = n;
|
59
60
|
}
|
60
61
|
e.setQueryClient = t;
|
61
|
-
})(
|
62
|
-
function
|
62
|
+
})(k || (k = {}));
|
63
|
+
function R(e) {
|
63
64
|
let t = atob(e);
|
64
65
|
if (t[0] === "{")
|
65
66
|
return JSON.parse(t);
|
66
67
|
}
|
67
|
-
|
68
|
+
var A = /* @__PURE__ */ ((e) => (e.HIVE = "HIVE", e.HBD = "HBD", e.VESTS = "VESTS", e.SPK = "SPK", e))(A || {}), Q = /* @__PURE__ */ ((e) => (e["@@000000021"] = "HIVE", e["@@000000013"] = "HBD", e["@@000000037"] = "VESTS", e))(Q || {});
|
69
|
+
function g(e) {
|
70
|
+
if (typeof e == "string") {
|
71
|
+
const t = e.split(" ");
|
72
|
+
return {
|
73
|
+
amount: parseFloat(t[0]),
|
74
|
+
// @ts-ignore
|
75
|
+
symbol: A[t[1]]
|
76
|
+
};
|
77
|
+
} else
|
78
|
+
return {
|
79
|
+
amount: parseFloat(e.amount.toString()) / Math.pow(10, e.precision),
|
80
|
+
// @ts-ignore
|
81
|
+
symbol: Q[e.nai]
|
82
|
+
};
|
83
|
+
}
|
84
|
+
const _ = (e) => {
|
68
85
|
try {
|
69
86
|
const t = i.storage.getItem(
|
70
87
|
i.storagePrefix + "_user_" + e
|
71
88
|
);
|
72
|
-
return
|
89
|
+
return R(JSON.parse(t));
|
73
90
|
} catch (t) {
|
74
91
|
console.error(t);
|
75
92
|
return;
|
76
93
|
}
|
77
|
-
}, y = (e) =>
|
78
|
-
function
|
94
|
+
}, y = (e) => _(e) && _(e).accessToken, j = (e) => _(e) && _(e).postingKey, F = (e) => _(e) && _(e).loginType, ye = (e) => _(e) && _(e).refreshToken;
|
95
|
+
function X() {
|
79
96
|
return new Promise((e) => {
|
80
97
|
var t;
|
81
98
|
(t = window.hive_keychain) == null || t.requestHandshake(() => {
|
@@ -83,7 +100,7 @@ function J() {
|
|
83
100
|
});
|
84
101
|
});
|
85
102
|
}
|
86
|
-
const
|
103
|
+
const b = (e, t, n, o = null) => new Promise((r, c) => {
|
87
104
|
var a;
|
88
105
|
(a = window.hive_keychain) == null || a.requestBroadcast(
|
89
106
|
e,
|
@@ -94,33 +111,47 @@ const w = (e, t, n, o = null) => new Promise((r, c) => {
|
|
94
111
|
},
|
95
112
|
o
|
96
113
|
);
|
97
|
-
}),
|
114
|
+
}), Y = (e, t, n, o, r, c = null) => new Promise((a, s) => {
|
115
|
+
var f;
|
116
|
+
(f = window.hive_keychain) == null || f.requestCustomJson(
|
117
|
+
e,
|
118
|
+
t,
|
119
|
+
n,
|
120
|
+
o,
|
121
|
+
r,
|
122
|
+
(w) => {
|
123
|
+
w.success || s({ message: "Operation cancelled" }), a(w);
|
124
|
+
},
|
125
|
+
c
|
126
|
+
);
|
127
|
+
}), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
98
128
|
__proto__: null,
|
99
|
-
broadcast:
|
100
|
-
|
129
|
+
broadcast: b,
|
130
|
+
customJson: Y,
|
131
|
+
handshake: X
|
101
132
|
}, Symbol.toStringTag, { value: "Module" }));
|
102
|
-
function
|
103
|
-
return
|
133
|
+
function Z(e = [], t, n) {
|
134
|
+
return d({
|
104
135
|
mutationKey: [...e, t],
|
105
136
|
mutationFn: async (o) => {
|
106
137
|
if (!t)
|
107
138
|
throw new Error(
|
108
139
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
109
140
|
);
|
110
|
-
const r =
|
141
|
+
const r = j(t);
|
111
142
|
if (r) {
|
112
|
-
const s =
|
143
|
+
const s = v.fromString(r);
|
113
144
|
return i.hiveClient.broadcast.sendOperations(
|
114
145
|
n(o),
|
115
146
|
s
|
116
147
|
);
|
117
148
|
}
|
118
|
-
const c =
|
149
|
+
const c = F(t);
|
119
150
|
if (c && c == "keychain")
|
120
|
-
return
|
151
|
+
return b(t, n(o), "Posting").then((s) => s.result);
|
121
152
|
let a = y(t);
|
122
153
|
if (a)
|
123
|
-
return (await new
|
154
|
+
return (await new m.Client({
|
124
155
|
accessToken: a
|
125
156
|
}).broadcast(n(o))).result;
|
126
157
|
throw new Error(
|
@@ -129,7 +160,7 @@ function I(e = [], t, n) {
|
|
129
160
|
}
|
130
161
|
});
|
131
162
|
}
|
132
|
-
async function
|
163
|
+
async function L(e, t, n) {
|
133
164
|
if (!e)
|
134
165
|
throw new Error(
|
135
166
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
@@ -139,28 +170,28 @@ async function B(e, t, n) {
|
|
139
170
|
required_auths: [],
|
140
171
|
required_posting_auths: [e],
|
141
172
|
json: JSON.stringify(n)
|
142
|
-
}, r =
|
173
|
+
}, r = j(e);
|
143
174
|
if (r) {
|
144
|
-
const s =
|
175
|
+
const s = v.fromString(r);
|
145
176
|
return i.hiveClient.broadcast.json(
|
146
177
|
o,
|
147
178
|
s
|
148
179
|
);
|
149
180
|
}
|
150
|
-
const c =
|
181
|
+
const c = F(e);
|
151
182
|
if (c && c == "keychain")
|
152
|
-
return
|
183
|
+
return b(e, [["custom_json", o]], "Posting").then((s) => s.result);
|
153
184
|
let a = y(e);
|
154
185
|
if (a)
|
155
|
-
return (await new
|
186
|
+
return (await new m.Client({
|
156
187
|
accessToken: a
|
157
188
|
}).customJson([], [e], t, JSON.stringify(n))).result;
|
158
189
|
throw new Error(
|
159
190
|
"[SDK][Broadcast] – cannot broadcast w/o posting key or token"
|
160
191
|
);
|
161
192
|
}
|
162
|
-
function
|
163
|
-
return new
|
193
|
+
function le() {
|
194
|
+
return new q({
|
164
195
|
defaultOptions: {
|
165
196
|
queries: {
|
166
197
|
// With SSR, we usually want to set some default staleTime
|
@@ -173,7 +204,7 @@ function ee() {
|
|
173
204
|
});
|
174
205
|
}
|
175
206
|
const u = () => i.queryClient;
|
176
|
-
var
|
207
|
+
var K;
|
177
208
|
((e) => {
|
178
209
|
function t(s) {
|
179
210
|
return u().getQueryData(s);
|
@@ -195,7 +226,7 @@ var C;
|
|
195
226
|
return {
|
196
227
|
prefetch: () => o(s),
|
197
228
|
getData: () => t(s.queryKey),
|
198
|
-
useClientQuery: () =>
|
229
|
+
useClientQuery: () => T(s),
|
199
230
|
fetchAndGet: () => u().fetchQuery(s)
|
200
231
|
};
|
201
232
|
}
|
@@ -204,19 +235,64 @@ var C;
|
|
204
235
|
return {
|
205
236
|
prefetch: () => r(s),
|
206
237
|
getData: () => n(s.queryKey),
|
207
|
-
useClientQuery: () =>
|
238
|
+
useClientQuery: () => G(s),
|
208
239
|
fetchAndGet: () => u().fetchInfiniteQuery(s)
|
209
240
|
};
|
210
241
|
}
|
211
242
|
e.generateClientServerInfiniteQuery = a;
|
212
|
-
})(
|
213
|
-
function
|
243
|
+
})(K || (K = {}));
|
244
|
+
function he() {
|
245
|
+
return p({
|
246
|
+
queryKey: ["core", "dynamic-props"],
|
247
|
+
refetchInterval: 6e4,
|
248
|
+
staleTime: 6e4,
|
249
|
+
refetchOnMount: !0,
|
250
|
+
queryFn: async () => {
|
251
|
+
const e = await i.hiveClient.database.getDynamicGlobalProperties().then((h) => ({
|
252
|
+
total_vesting_fund_hive: h.total_vesting_fund_hive || h.total_vesting_fund_steem,
|
253
|
+
total_vesting_shares: h.total_vesting_shares,
|
254
|
+
hbd_print_rate: h.hbd_print_rate || h.sbd_print_rate,
|
255
|
+
hbd_interest_rate: h.hbd_interest_rate,
|
256
|
+
head_block_number: h.head_block_number,
|
257
|
+
vesting_reward_percent: h.vesting_reward_percent,
|
258
|
+
virtual_supply: h.virtual_supply
|
259
|
+
})), t = await i.hiveClient.database.call("get_feed_history"), n = await i.hiveClient.database.call(
|
260
|
+
"get_chain_properties"
|
261
|
+
), o = await i.hiveClient.database.call(
|
262
|
+
"get_reward_fund",
|
263
|
+
["post"]
|
264
|
+
), r = g(e.total_vesting_fund_hive).amount / g(e.total_vesting_shares).amount * 1e6, c = g(t.current_median_history.base).amount, a = g(t.current_median_history.quote).amount, s = parseFloat(o.recent_claims), f = g(o.reward_balance).amount, w = e.hbd_print_rate, P = e.hbd_interest_rate, E = e.head_block_number, I = g(
|
265
|
+
e.total_vesting_fund_hive
|
266
|
+
).amount, M = g(
|
267
|
+
e.total_vesting_shares
|
268
|
+
).amount, B = g(e.virtual_supply).amount, H = e.vesting_reward_percent, J = n.account_creation_fee;
|
269
|
+
return {
|
270
|
+
hivePerMVests: r,
|
271
|
+
base: c,
|
272
|
+
quote: a,
|
273
|
+
fundRecentClaims: s,
|
274
|
+
fundRewardBalance: f,
|
275
|
+
hbdPrintRate: w,
|
276
|
+
hbdInterestRate: P,
|
277
|
+
headBlock: E,
|
278
|
+
totalVestingFund: I,
|
279
|
+
totalVestingShares: M,
|
280
|
+
virtualSupply: B,
|
281
|
+
vestingRewardPercent: H,
|
282
|
+
accountCreationFee: J
|
283
|
+
};
|
284
|
+
}
|
285
|
+
});
|
286
|
+
}
|
287
|
+
function ee(e) {
|
214
288
|
return p({
|
215
289
|
queryKey: ["get-account-full", e],
|
216
290
|
queryFn: async () => {
|
217
291
|
if (!e)
|
218
292
|
throw new Error("[SDK] Username is empty");
|
219
|
-
const t = await i.hiveClient.database.getAccounts([
|
293
|
+
const t = await i.hiveClient.database.getAccounts([
|
294
|
+
e
|
295
|
+
]);
|
220
296
|
if (!t[0])
|
221
297
|
throw new Error("[SDK] No account with given username");
|
222
298
|
const n = JSON.parse(t[0].posting_json_metadata).profile;
|
@@ -234,7 +310,43 @@ function H(e) {
|
|
234
310
|
[e, 1]
|
235
311
|
);
|
236
312
|
return {
|
237
|
-
|
313
|
+
name: t[0].name,
|
314
|
+
owner: t[0].owner,
|
315
|
+
active: t[0].active,
|
316
|
+
posting: t[0].posting,
|
317
|
+
memo_key: t[0].memo_key,
|
318
|
+
post_count: t[0].post_count,
|
319
|
+
created: t[0].created,
|
320
|
+
posting_json_metadata: t[0].posting_json_metadata,
|
321
|
+
last_vote_time: t[0].last_vote_time,
|
322
|
+
last_post: t[0].last_post,
|
323
|
+
json_metadata: t[0].json_metadata,
|
324
|
+
reward_hive_balance: t[0].reward_hive_balance,
|
325
|
+
reward_hbd_balance: t[0].reward_hbd_balance,
|
326
|
+
reward_vesting_hive: t[0].reward_vesting_hive,
|
327
|
+
reward_vesting_balance: t[0].reward_vesting_balance,
|
328
|
+
balance: t[0].balance,
|
329
|
+
hbd_balance: t[0].hbd_balance,
|
330
|
+
savings_balance: t[0].savings_balance,
|
331
|
+
savings_hbd_balance: t[0].savings_hbd_balance,
|
332
|
+
savings_hbd_last_interest_payment: t[0].savings_hbd_last_interest_payment,
|
333
|
+
savings_hbd_seconds_last_update: t[0].savings_hbd_seconds_last_update,
|
334
|
+
savings_hbd_seconds: t[0].savings_hbd_seconds,
|
335
|
+
next_vesting_withdrawal: t[0].next_vesting_withdrawal,
|
336
|
+
pending_claimed_accounts: t[0].pending_claimed_accounts,
|
337
|
+
vesting_shares: t[0].vesting_shares,
|
338
|
+
delegated_vesting_shares: t[0].delegated_vesting_shares,
|
339
|
+
received_vesting_shares: t[0].received_vesting_shares,
|
340
|
+
vesting_withdraw_rate: t[0].vesting_withdraw_rate,
|
341
|
+
to_withdraw: t[0].to_withdraw,
|
342
|
+
withdrawn: t[0].withdrawn,
|
343
|
+
witness_votes: t[0].witness_votes,
|
344
|
+
proxy: t[0].proxy,
|
345
|
+
recovery_account: t[0].recovery_account,
|
346
|
+
proxied_vsf_votes: t[0].proxied_vsf_votes,
|
347
|
+
voting_manabar: t[0].voting_manabar,
|
348
|
+
voting_power: t[0].voting_power,
|
349
|
+
downvote_manabar: t[0].downvote_manabar,
|
238
350
|
follow_stats: o,
|
239
351
|
reputation: r[0].reputation,
|
240
352
|
profile: {
|
@@ -247,7 +359,7 @@ function H(e) {
|
|
247
359
|
staleTime: 6e4
|
248
360
|
});
|
249
361
|
}
|
250
|
-
function
|
362
|
+
function fe(e, t = 5, n = []) {
|
251
363
|
return p({
|
252
364
|
queryKey: ["accounts", "search", e, n],
|
253
365
|
enabled: !!e,
|
@@ -259,7 +371,7 @@ function te(e, t = 5, n = []) {
|
|
259
371
|
)
|
260
372
|
});
|
261
373
|
}
|
262
|
-
function
|
374
|
+
function ge(e) {
|
263
375
|
return p({
|
264
376
|
queryKey: ["accounts", "check-wallet-pending", e],
|
265
377
|
queryFn: async () => await (await fetch(
|
@@ -278,7 +390,7 @@ function ne(e) {
|
|
278
390
|
refetchOnMount: !0
|
279
391
|
});
|
280
392
|
}
|
281
|
-
function
|
393
|
+
function te(e, t) {
|
282
394
|
return p({
|
283
395
|
queryKey: ["accounts", "relations", e, t],
|
284
396
|
enabled: !!e && !!t,
|
@@ -291,7 +403,7 @@ function x(e, t) {
|
|
291
403
|
)
|
292
404
|
});
|
293
405
|
}
|
294
|
-
function
|
406
|
+
function _e(e) {
|
295
407
|
return p({
|
296
408
|
queryKey: ["accounts", "subscriptions", e],
|
297
409
|
enabled: !!e,
|
@@ -304,7 +416,7 @@ function oe(e) {
|
|
304
416
|
) ?? []
|
305
417
|
});
|
306
418
|
}
|
307
|
-
function
|
419
|
+
function ve(e) {
|
308
420
|
return p({
|
309
421
|
queryKey: ["accounts", "bookmarks", e],
|
310
422
|
enabled: !!e,
|
@@ -324,7 +436,7 @@ function re(e) {
|
|
324
436
|
}
|
325
437
|
});
|
326
438
|
}
|
327
|
-
function
|
439
|
+
function we(e) {
|
328
440
|
return p({
|
329
441
|
queryKey: ["accounts", "favourites", e],
|
330
442
|
enabled: !!e,
|
@@ -344,9 +456,9 @@ function ie(e) {
|
|
344
456
|
}
|
345
457
|
});
|
346
458
|
}
|
347
|
-
function
|
348
|
-
const { data: t } =
|
349
|
-
return
|
459
|
+
function me(e) {
|
460
|
+
const { data: t } = T(ee(e));
|
461
|
+
return Z(
|
350
462
|
["accounts", "update", t],
|
351
463
|
e,
|
352
464
|
({ profile: n, tokens: o }) => {
|
@@ -366,11 +478,11 @@ function se(e) {
|
|
366
478
|
}
|
367
479
|
);
|
368
480
|
}
|
369
|
-
function
|
370
|
-
return
|
481
|
+
function be(e, t, n, o) {
|
482
|
+
return d({
|
371
483
|
mutationKey: [],
|
372
484
|
mutationFn: async (r) => {
|
373
|
-
const c =
|
485
|
+
const c = te(
|
374
486
|
e,
|
375
487
|
t
|
376
488
|
);
|
@@ -378,7 +490,7 @@ function ae(e, t, n, o) {
|
|
378
490
|
const a = u().getQueryData(
|
379
491
|
c.queryKey
|
380
492
|
);
|
381
|
-
return await
|
493
|
+
return await L(e, "follow", [
|
382
494
|
"follow",
|
383
495
|
{
|
384
496
|
follower: e,
|
@@ -403,8 +515,8 @@ function ae(e, t, n, o) {
|
|
403
515
|
}
|
404
516
|
});
|
405
517
|
}
|
406
|
-
function
|
407
|
-
return
|
518
|
+
function Se(e, t, n) {
|
519
|
+
return d({
|
408
520
|
mutationKey: ["accounts", "bookmarks", "add", e],
|
409
521
|
mutationFn: async ({ author: o, permlink: r }) => {
|
410
522
|
if (!e)
|
@@ -432,8 +544,8 @@ function ce(e, t, n) {
|
|
432
544
|
onError: n
|
433
545
|
});
|
434
546
|
}
|
435
|
-
function
|
436
|
-
return
|
547
|
+
function Ce(e, t, n) {
|
548
|
+
return d({
|
437
549
|
mutationKey: ["accounts", "bookmarks", "delete", e],
|
438
550
|
mutationFn: async (o) => {
|
439
551
|
if (!e)
|
@@ -460,8 +572,8 @@ function ue(e, t, n) {
|
|
460
572
|
onError: n
|
461
573
|
});
|
462
574
|
}
|
463
|
-
function
|
464
|
-
return
|
575
|
+
function Oe(e, t, n) {
|
576
|
+
return d({
|
465
577
|
mutationKey: ["accounts", "favourites", "add", e],
|
466
578
|
mutationFn: async (o) => {
|
467
579
|
if (!e)
|
@@ -488,8 +600,8 @@ function pe(e, t, n) {
|
|
488
600
|
onError: n
|
489
601
|
});
|
490
602
|
}
|
491
|
-
function
|
492
|
-
return
|
603
|
+
function ke(e, t, n) {
|
604
|
+
return d({
|
493
605
|
mutationKey: ["accounts", "favourites", "add", e],
|
494
606
|
mutationFn: async (o) => {
|
495
607
|
if (!e)
|
@@ -516,8 +628,8 @@ function ye(e, t, n) {
|
|
516
628
|
onError: n
|
517
629
|
});
|
518
630
|
}
|
519
|
-
function
|
520
|
-
return
|
631
|
+
function Ke(e) {
|
632
|
+
return d({
|
521
633
|
mutationKey: ["operations", "sign", e],
|
522
634
|
mutationFn: ({
|
523
635
|
operation: t,
|
@@ -526,65 +638,40 @@ function le(e) {
|
|
526
638
|
if (!e)
|
527
639
|
throw new Error("[Operations][Sign] – cannot sign op with anon user");
|
528
640
|
let o;
|
529
|
-
return n.split(" ").length === 12 ? o =
|
641
|
+
return n.split(" ").length === 12 ? o = v.fromLogin(e, n, "active") : z.isWif(n) ? o = v.fromString(n) : o = v.from(n), i.hiveClient.broadcast.sendOperations(
|
530
642
|
[t],
|
531
643
|
o
|
532
644
|
);
|
533
645
|
}
|
534
646
|
});
|
535
647
|
}
|
536
|
-
function
|
537
|
-
return
|
648
|
+
function qe(e, t = "Active") {
|
649
|
+
return d({
|
538
650
|
mutationKey: ["operations", "sign-keychain", e],
|
539
651
|
mutationFn: ({ operation: n }) => {
|
540
652
|
if (!e)
|
541
653
|
throw new Error(
|
542
654
|
"[SDK][Keychain] – cannot sign operation with anon user"
|
543
655
|
);
|
544
|
-
return
|
656
|
+
return b(e, [n], t);
|
545
657
|
}
|
546
658
|
});
|
547
659
|
}
|
548
|
-
function
|
549
|
-
return
|
660
|
+
function Te(e = "/") {
|
661
|
+
return d({
|
550
662
|
mutationKey: ["operations", "sign-hivesigner", e],
|
551
|
-
mutationFn: async ({ operation: t }) =>
|
663
|
+
mutationFn: async ({ operation: t }) => m.sendOperation(t, { callback: e }, () => {
|
552
664
|
})
|
553
665
|
});
|
554
666
|
}
|
555
|
-
function
|
667
|
+
function Ae() {
|
556
668
|
return p({
|
557
669
|
queryKey: ["operations", "chain-properties"],
|
558
670
|
queryFn: async () => await i.hiveClient.database.getChainProperties()
|
559
671
|
});
|
560
672
|
}
|
561
|
-
function
|
562
|
-
return
|
563
|
-
queryKey: ["hive-engine", "tokens-list", e, t],
|
564
|
-
queryFn: async () => (await (await fetch(
|
565
|
-
`${i.privateApiHost}/private-api/engine-api`,
|
566
|
-
{
|
567
|
-
method: "POST",
|
568
|
-
body: JSON.stringify({
|
569
|
-
jsonrpc: "2.0",
|
570
|
-
method: "find",
|
571
|
-
params: {
|
572
|
-
contract: "market",
|
573
|
-
table: "metrics",
|
574
|
-
query: {
|
575
|
-
symbol: t,
|
576
|
-
account: e
|
577
|
-
}
|
578
|
-
},
|
579
|
-
id: 1
|
580
|
-
}),
|
581
|
-
headers: { "Content-type": "application/json" }
|
582
|
-
}
|
583
|
-
)).json()).result
|
584
|
-
});
|
585
|
-
}
|
586
|
-
function we(e = 20) {
|
587
|
-
return F({
|
673
|
+
function Qe(e = 20) {
|
674
|
+
return V({
|
588
675
|
queryKey: ["posts", "trending-tags"],
|
589
676
|
queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
590
677
|
(n) => n.filter((o) => o.name !== "").filter((o) => !o.name.startsWith("hive-")).map((o) => o.name)
|
@@ -597,7 +684,7 @@ function we(e = 20) {
|
|
597
684
|
refetchOnMount: !0
|
598
685
|
});
|
599
686
|
}
|
600
|
-
function
|
687
|
+
function C(e) {
|
601
688
|
return p({
|
602
689
|
queryKey: ["posts", "fragments", e],
|
603
690
|
queryFn: async () => (await fetch(
|
@@ -615,7 +702,7 @@ function b(e) {
|
|
615
702
|
enabled: !!e
|
616
703
|
});
|
617
704
|
}
|
618
|
-
function
|
705
|
+
function je(e = "feed") {
|
619
706
|
return p({
|
620
707
|
queryKey: ["posts", "promoted", e],
|
621
708
|
queryFn: async () => {
|
@@ -631,8 +718,8 @@ function ve(e = "feed") {
|
|
631
718
|
}
|
632
719
|
});
|
633
720
|
}
|
634
|
-
function
|
635
|
-
return
|
721
|
+
function Fe(e) {
|
722
|
+
return d({
|
636
723
|
mutationKey: ["posts", "add-fragment", e],
|
637
724
|
mutationFn: async ({ title: t, body: n }) => (await fetch(
|
638
725
|
i.privateApiHost + "/private-api/fragments-add",
|
@@ -650,14 +737,14 @@ function me(e) {
|
|
650
737
|
)).json(),
|
651
738
|
onSuccess(t) {
|
652
739
|
u().setQueryData(
|
653
|
-
|
740
|
+
C(e).queryKey,
|
654
741
|
(n) => [t, ...n ?? []]
|
655
742
|
);
|
656
743
|
}
|
657
744
|
});
|
658
745
|
}
|
659
|
-
function
|
660
|
-
return
|
746
|
+
function De(e, t) {
|
747
|
+
return d({
|
661
748
|
mutationKey: ["posts", "edit-fragment", e, t],
|
662
749
|
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
663
750
|
i.privateApiHost + "/private-api/fragments-update",
|
@@ -676,7 +763,7 @@ function be(e, t) {
|
|
676
763
|
)).json(),
|
677
764
|
onSuccess(n) {
|
678
765
|
u().setQueryData(
|
679
|
-
|
766
|
+
C(e).queryKey,
|
680
767
|
(o) => {
|
681
768
|
if (!o)
|
682
769
|
return [];
|
@@ -687,8 +774,8 @@ function be(e, t) {
|
|
687
774
|
}
|
688
775
|
});
|
689
776
|
}
|
690
|
-
function
|
691
|
-
return
|
777
|
+
function Pe(e, t) {
|
778
|
+
return d({
|
692
779
|
mutationKey: ["posts", "remove-fragment", e],
|
693
780
|
mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
|
694
781
|
method: "POST",
|
@@ -702,14 +789,14 @@ function Oe(e, t) {
|
|
702
789
|
}),
|
703
790
|
onSuccess() {
|
704
791
|
u().setQueryData(
|
705
|
-
|
792
|
+
C(e).queryKey,
|
706
793
|
(n) => [...n ?? []].filter(({ id: o }) => o !== t)
|
707
794
|
);
|
708
795
|
}
|
709
796
|
});
|
710
797
|
}
|
711
|
-
function
|
712
|
-
return
|
798
|
+
function D(e, t) {
|
799
|
+
return d({
|
713
800
|
mutationKey: ["analytics", t],
|
714
801
|
mutationFn: async () => {
|
715
802
|
if (!t)
|
@@ -731,29 +818,29 @@ function A(e, t) {
|
|
731
818
|
}
|
732
819
|
});
|
733
820
|
}
|
734
|
-
const
|
821
|
+
const Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
735
822
|
__proto__: null,
|
736
|
-
useRecordActivity:
|
823
|
+
useRecordActivity: D
|
737
824
|
}, Symbol.toStringTag, { value: "Module" }));
|
738
|
-
function
|
825
|
+
function ne(e, t) {
|
739
826
|
return p({
|
740
827
|
queryKey: ["integrations", "hivesigner", "decode-memo", e],
|
741
828
|
queryFn: async () => {
|
742
829
|
const n = y(e);
|
743
830
|
if (n)
|
744
|
-
return new
|
831
|
+
return new m.Client({
|
745
832
|
accessToken: n
|
746
833
|
}).decode(t);
|
747
834
|
}
|
748
835
|
});
|
749
836
|
}
|
750
|
-
const
|
837
|
+
const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
751
838
|
__proto__: null,
|
752
|
-
getDecodeMemoQueryOptions:
|
753
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
754
|
-
queries:
|
839
|
+
getDecodeMemoQueryOptions: ne
|
840
|
+
}, Symbol.toStringTag, { value: "Module" })), re = {
|
841
|
+
queries: oe
|
755
842
|
};
|
756
|
-
function
|
843
|
+
function S(e) {
|
757
844
|
return p({
|
758
845
|
queryKey: ["integrations", "3speak", "authenticate", e],
|
759
846
|
enabled: !!e,
|
@@ -767,7 +854,7 @@ function m(e) {
|
|
767
854
|
"Content-Type": "application/json"
|
768
855
|
}
|
769
856
|
}
|
770
|
-
), n =
|
857
|
+
), n = re.queries.getDecodeMemoQueryOptions(
|
771
858
|
e,
|
772
859
|
(await t.json()).memo
|
773
860
|
);
|
@@ -779,16 +866,16 @@ function m(e) {
|
|
779
866
|
}
|
780
867
|
});
|
781
868
|
}
|
782
|
-
function
|
869
|
+
function ie(e) {
|
783
870
|
return p({
|
784
871
|
queryKey: ["integrations", "3speak", "videos", e],
|
785
872
|
enabled: !!e,
|
786
873
|
queryFn: async () => {
|
787
874
|
await u().prefetchQuery(
|
788
|
-
|
875
|
+
S(e)
|
789
876
|
);
|
790
877
|
const t = u().getQueryData(
|
791
|
-
|
878
|
+
S(e).queryKey
|
792
879
|
);
|
793
880
|
return await (await fetch(
|
794
881
|
"https://studio.3speak.tv/mobile/api/my-videos",
|
@@ -802,14 +889,14 @@ function z(e) {
|
|
802
889
|
}
|
803
890
|
});
|
804
891
|
}
|
805
|
-
const
|
892
|
+
const se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
806
893
|
__proto__: null,
|
807
|
-
getAccountTokenQueryOptions:
|
808
|
-
getAccountVideosQueryOptions:
|
809
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
810
|
-
queries:
|
894
|
+
getAccountTokenQueryOptions: S,
|
895
|
+
getAccountVideosQueryOptions: ie
|
896
|
+
}, Symbol.toStringTag, { value: "Module" })), Ie = {
|
897
|
+
queries: se
|
811
898
|
};
|
812
|
-
function
|
899
|
+
function Me() {
|
813
900
|
return p({
|
814
901
|
queryKey: ["resource-credits", "stats"],
|
815
902
|
queryFn: async () => (await i.hiveClient.call(
|
@@ -819,14 +906,14 @@ function Ke() {
|
|
819
906
|
)).rc_stats
|
820
907
|
});
|
821
908
|
}
|
822
|
-
function
|
909
|
+
function Be(e) {
|
823
910
|
return p({
|
824
911
|
queryKey: ["resource-credits", "account", e],
|
825
|
-
queryFn: async () => new
|
912
|
+
queryFn: async () => new U(i.hiveClient).findRCAccounts([e]),
|
826
913
|
enabled: !!e
|
827
914
|
});
|
828
915
|
}
|
829
|
-
function
|
916
|
+
function He(e, t) {
|
830
917
|
return p({
|
831
918
|
queryKey: ["games", "status-check", t, e],
|
832
919
|
enabled: !!e,
|
@@ -849,12 +936,12 @@ function ke(e, t) {
|
|
849
936
|
}
|
850
937
|
});
|
851
938
|
}
|
852
|
-
function
|
853
|
-
const { mutateAsync: o } =
|
939
|
+
function Je(e, t, n) {
|
940
|
+
const { mutateAsync: o } = D(
|
854
941
|
e,
|
855
942
|
"spin-rolled"
|
856
943
|
);
|
857
|
-
return
|
944
|
+
return d({
|
858
945
|
mutationKey: ["games", "post", t, e],
|
859
946
|
mutationFn: async () => {
|
860
947
|
if (!e)
|
@@ -879,7 +966,7 @@ function Te(e, t, n) {
|
|
879
966
|
}
|
880
967
|
});
|
881
968
|
}
|
882
|
-
function
|
969
|
+
function Ne(e, t, n = 100, o = void 0, r = !0) {
|
883
970
|
return p({
|
884
971
|
queryKey: ["communities", "list", e, t, n],
|
885
972
|
enabled: r,
|
@@ -899,7 +986,7 @@ function Ae(e, t, n = 100, o = void 0, r = !0) {
|
|
899
986
|
}
|
900
987
|
});
|
901
988
|
}
|
902
|
-
function
|
989
|
+
function xe(e, t) {
|
903
990
|
return p({
|
904
991
|
queryKey: ["community", "context", e, t],
|
905
992
|
enabled: !!e && !!t,
|
@@ -919,8 +1006,8 @@ function Qe(e, t) {
|
|
919
1006
|
}
|
920
1007
|
});
|
921
1008
|
}
|
922
|
-
var
|
923
|
-
const
|
1009
|
+
var l = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(l || {});
|
1010
|
+
const Ge = {
|
924
1011
|
owner: [
|
925
1012
|
"admin",
|
926
1013
|
"mod",
|
@@ -943,27 +1030,27 @@ const _e = {
|
|
943
1030
|
/* MUTED */
|
944
1031
|
]
|
945
1032
|
};
|
946
|
-
function
|
1033
|
+
function Ve(e, t) {
|
947
1034
|
return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
|
948
1035
|
}
|
949
|
-
function
|
1036
|
+
function We({
|
950
1037
|
communityType: e,
|
951
1038
|
userRole: t,
|
952
1039
|
subscribed: n
|
953
1040
|
}) {
|
954
|
-
const o = t ===
|
1041
|
+
const o = t === l.MUTED ? !1 : e === "Topic" ? !0 : [l.OWNER, l.ADMIN, l.MOD, l.MEMBER].includes(
|
955
1042
|
t
|
956
1043
|
), r = (() => {
|
957
|
-
if (t ===
|
1044
|
+
if (t === l.MUTED) return !1;
|
958
1045
|
switch (e) {
|
959
1046
|
case "Topic":
|
960
1047
|
return !0;
|
961
1048
|
case "Journal":
|
962
|
-
return t !==
|
1049
|
+
return t !== l.GUEST || n;
|
963
1050
|
case "Council":
|
964
1051
|
return o;
|
965
1052
|
}
|
966
|
-
})(), c = [
|
1053
|
+
})(), c = [l.OWNER, l.ADMIN, l.MOD].includes(t);
|
967
1054
|
return {
|
968
1055
|
canPost: o,
|
969
1056
|
canComment: r,
|
@@ -972,53 +1059,53 @@ function Fe({
|
|
972
1059
|
}
|
973
1060
|
export {
|
974
1061
|
i as CONFIG,
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
1062
|
+
k as ConfigManager,
|
1063
|
+
Ee as EcencyAnalytics,
|
1064
|
+
K as EcencyQueriesManager,
|
1065
|
+
re as HiveSignerIntegration,
|
1066
|
+
de as Keychain,
|
1067
|
+
l as ROLES,
|
1068
|
+
Ie as ThreeSpeakIntegration,
|
1069
|
+
L as broadcastJson,
|
1070
|
+
ge as checkUsernameWalletsPendingQueryOptions,
|
984
1071
|
y as getAccessToken,
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1072
|
+
ee as getAccountFullQueryOptions,
|
1073
|
+
Be as getAccountRcQueryOptions,
|
1074
|
+
_e as getAccountSubscriptionsQueryOptions,
|
1075
|
+
ve as getActiveAccountBookmarksQueryOptions,
|
1076
|
+
we as getActiveAccountFavouritesQueryOptions,
|
1077
|
+
Ae as getChainPropertiesQueryOptions,
|
1078
|
+
Ne as getCommunitiesQueryOptions,
|
1079
|
+
xe as getCommunityContextQueryOptions,
|
1080
|
+
We as getCommunityPermissions,
|
1081
|
+
Ve as getCommunityType,
|
1082
|
+
he as getDynamicPropsQueryOptions,
|
1083
|
+
C as getFragmentsQueryOptions,
|
1084
|
+
He as getGameStatusCheckQueryOptions,
|
1085
|
+
F as getLoginType,
|
1086
|
+
j as getPostingKey,
|
1087
|
+
je as getPromotedPostsQuery,
|
1001
1088
|
u as getQueryClient,
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1089
|
+
Me as getRcStatsQueryOptions,
|
1090
|
+
ye as getRefreshToken,
|
1091
|
+
te as getRelationshipBetweenAccountsQueryOptions,
|
1092
|
+
fe as getSearchAccountsByUsernameQueryOptions,
|
1093
|
+
Qe as getTrendingTagsQueryOptions,
|
1094
|
+
_ as getUser,
|
1095
|
+
le as makeQueryClient,
|
1096
|
+
Ge as roleMap,
|
1097
|
+
Oe as useAccountFavouriteAdd,
|
1098
|
+
ke as useAccountFavouriteDelete,
|
1099
|
+
be as useAccountRelationsUpdate,
|
1100
|
+
me as useAccountUpdate,
|
1101
|
+
Fe as useAddFragment,
|
1102
|
+
Se as useBookmarkAdd,
|
1103
|
+
Ce as useBookmarkDelete,
|
1104
|
+
Z as useBroadcastMutation,
|
1105
|
+
De as useEditFragment,
|
1106
|
+
Je as useGameClaim,
|
1107
|
+
Pe as useRemoveFragment,
|
1108
|
+
Te as useSignOperationByHivesigner,
|
1109
|
+
Ke as useSignOperationByKey,
|
1110
|
+
qe as useSignOperationByKeychain
|
1024
1111
|
};
|