@ecency/sdk 1.0.55 → 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 +300 -220
- package/dist/index.d.ts +0 -1
- package/dist/modules/accounts/mutations/use-account-update.d.ts +2 -5
- package/dist/modules/accounts/queries/get-account-full-query-options.d.ts +208 -328
- package/dist/modules/accounts/types/account-profile.d.ts +14 -0
- package/dist/modules/accounts/types/full-account.d.ts +52 -0
- package/dist/modules/accounts/types/index.d.ts +2 -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,12 +1,12 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
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
|
}
|
11
11
|
clear() {
|
12
12
|
throw new Error("Method not implemented.");
|
@@ -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 b;
|
|
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 b;
|
|
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,40 +456,33 @@ 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
|
-
({ profile: n, tokens: o
|
353
|
-
|
354
|
-
"
|
355
|
-
{
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
}
|
368
|
-
} : {}
|
369
|
-
}),
|
370
|
-
extensions: []
|
371
|
-
}
|
372
|
-
]
|
373
|
-
]
|
464
|
+
({ profile: n, tokens: o }) => {
|
465
|
+
const r = {
|
466
|
+
...JSON.parse((t == null ? void 0 : t.posting_json_metadata) || "{}"),
|
467
|
+
profile: { ...t == null ? void 0 : t.profile, ...n, version: 2 }
|
468
|
+
};
|
469
|
+
return o && o.length > 0 && (r.tokens = o), [
|
470
|
+
[
|
471
|
+
"account_update2",
|
472
|
+
{
|
473
|
+
account: e,
|
474
|
+
posting_json_metadata: JSON.stringify(r)
|
475
|
+
}
|
476
|
+
]
|
477
|
+
];
|
478
|
+
}
|
374
479
|
);
|
375
480
|
}
|
376
|
-
function
|
377
|
-
return
|
481
|
+
function be(e, t, n, o) {
|
482
|
+
return d({
|
378
483
|
mutationKey: [],
|
379
484
|
mutationFn: async (r) => {
|
380
|
-
const c =
|
485
|
+
const c = te(
|
381
486
|
e,
|
382
487
|
t
|
383
488
|
);
|
@@ -385,7 +490,7 @@ function ae(e, t, n, o) {
|
|
385
490
|
const a = u().getQueryData(
|
386
491
|
c.queryKey
|
387
492
|
);
|
388
|
-
return await
|
493
|
+
return await L(e, "follow", [
|
389
494
|
"follow",
|
390
495
|
{
|
391
496
|
follower: e,
|
@@ -410,8 +515,8 @@ function ae(e, t, n, o) {
|
|
410
515
|
}
|
411
516
|
});
|
412
517
|
}
|
413
|
-
function
|
414
|
-
return
|
518
|
+
function Se(e, t, n) {
|
519
|
+
return d({
|
415
520
|
mutationKey: ["accounts", "bookmarks", "add", e],
|
416
521
|
mutationFn: async ({ author: o, permlink: r }) => {
|
417
522
|
if (!e)
|
@@ -439,8 +544,8 @@ function ce(e, t, n) {
|
|
439
544
|
onError: n
|
440
545
|
});
|
441
546
|
}
|
442
|
-
function
|
443
|
-
return
|
547
|
+
function Ce(e, t, n) {
|
548
|
+
return d({
|
444
549
|
mutationKey: ["accounts", "bookmarks", "delete", e],
|
445
550
|
mutationFn: async (o) => {
|
446
551
|
if (!e)
|
@@ -467,8 +572,8 @@ function ue(e, t, n) {
|
|
467
572
|
onError: n
|
468
573
|
});
|
469
574
|
}
|
470
|
-
function
|
471
|
-
return
|
575
|
+
function Oe(e, t, n) {
|
576
|
+
return d({
|
472
577
|
mutationKey: ["accounts", "favourites", "add", e],
|
473
578
|
mutationFn: async (o) => {
|
474
579
|
if (!e)
|
@@ -495,8 +600,8 @@ function pe(e, t, n) {
|
|
495
600
|
onError: n
|
496
601
|
});
|
497
602
|
}
|
498
|
-
function
|
499
|
-
return
|
603
|
+
function ke(e, t, n) {
|
604
|
+
return d({
|
500
605
|
mutationKey: ["accounts", "favourites", "add", e],
|
501
606
|
mutationFn: async (o) => {
|
502
607
|
if (!e)
|
@@ -523,8 +628,8 @@ function ye(e, t, n) {
|
|
523
628
|
onError: n
|
524
629
|
});
|
525
630
|
}
|
526
|
-
function
|
527
|
-
return
|
631
|
+
function Ke(e) {
|
632
|
+
return d({
|
528
633
|
mutationKey: ["operations", "sign", e],
|
529
634
|
mutationFn: ({
|
530
635
|
operation: t,
|
@@ -533,65 +638,40 @@ function le(e) {
|
|
533
638
|
if (!e)
|
534
639
|
throw new Error("[Operations][Sign] – cannot sign op with anon user");
|
535
640
|
let o;
|
536
|
-
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(
|
537
642
|
[t],
|
538
643
|
o
|
539
644
|
);
|
540
645
|
}
|
541
646
|
});
|
542
647
|
}
|
543
|
-
function
|
544
|
-
return
|
648
|
+
function qe(e, t = "Active") {
|
649
|
+
return d({
|
545
650
|
mutationKey: ["operations", "sign-keychain", e],
|
546
651
|
mutationFn: ({ operation: n }) => {
|
547
652
|
if (!e)
|
548
653
|
throw new Error(
|
549
654
|
"[SDK][Keychain] – cannot sign operation with anon user"
|
550
655
|
);
|
551
|
-
return
|
656
|
+
return b(e, [n], t);
|
552
657
|
}
|
553
658
|
});
|
554
659
|
}
|
555
|
-
function
|
556
|
-
return
|
660
|
+
function Te(e = "/") {
|
661
|
+
return d({
|
557
662
|
mutationKey: ["operations", "sign-hivesigner", e],
|
558
|
-
mutationFn: async ({ operation: t }) =>
|
663
|
+
mutationFn: async ({ operation: t }) => m.sendOperation(t, { callback: e }, () => {
|
559
664
|
})
|
560
665
|
});
|
561
666
|
}
|
562
|
-
function
|
667
|
+
function Ae() {
|
563
668
|
return p({
|
564
669
|
queryKey: ["operations", "chain-properties"],
|
565
670
|
queryFn: async () => await i.hiveClient.database.getChainProperties()
|
566
671
|
});
|
567
672
|
}
|
568
|
-
function
|
569
|
-
return
|
570
|
-
queryKey: ["hive-engine", "tokens-list", e, t],
|
571
|
-
queryFn: async () => (await (await fetch(
|
572
|
-
`${i.privateApiHost}/private-api/engine-api`,
|
573
|
-
{
|
574
|
-
method: "POST",
|
575
|
-
body: JSON.stringify({
|
576
|
-
jsonrpc: "2.0",
|
577
|
-
method: "find",
|
578
|
-
params: {
|
579
|
-
contract: "market",
|
580
|
-
table: "metrics",
|
581
|
-
query: {
|
582
|
-
symbol: t,
|
583
|
-
account: e
|
584
|
-
}
|
585
|
-
},
|
586
|
-
id: 1
|
587
|
-
}),
|
588
|
-
headers: { "Content-type": "application/json" }
|
589
|
-
}
|
590
|
-
)).json()).result
|
591
|
-
});
|
592
|
-
}
|
593
|
-
function we(e = 20) {
|
594
|
-
return F({
|
673
|
+
function Qe(e = 20) {
|
674
|
+
return V({
|
595
675
|
queryKey: ["posts", "trending-tags"],
|
596
676
|
queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
597
677
|
(n) => n.filter((o) => o.name !== "").filter((o) => !o.name.startsWith("hive-")).map((o) => o.name)
|
@@ -604,7 +684,7 @@ function we(e = 20) {
|
|
604
684
|
refetchOnMount: !0
|
605
685
|
});
|
606
686
|
}
|
607
|
-
function
|
687
|
+
function C(e) {
|
608
688
|
return p({
|
609
689
|
queryKey: ["posts", "fragments", e],
|
610
690
|
queryFn: async () => (await fetch(
|
@@ -622,7 +702,7 @@ function O(e) {
|
|
622
702
|
enabled: !!e
|
623
703
|
});
|
624
704
|
}
|
625
|
-
function
|
705
|
+
function je(e = "feed") {
|
626
706
|
return p({
|
627
707
|
queryKey: ["posts", "promoted", e],
|
628
708
|
queryFn: async () => {
|
@@ -638,8 +718,8 @@ function ve(e = "feed") {
|
|
638
718
|
}
|
639
719
|
});
|
640
720
|
}
|
641
|
-
function
|
642
|
-
return
|
721
|
+
function Fe(e) {
|
722
|
+
return d({
|
643
723
|
mutationKey: ["posts", "add-fragment", e],
|
644
724
|
mutationFn: async ({ title: t, body: n }) => (await fetch(
|
645
725
|
i.privateApiHost + "/private-api/fragments-add",
|
@@ -657,14 +737,14 @@ function me(e) {
|
|
657
737
|
)).json(),
|
658
738
|
onSuccess(t) {
|
659
739
|
u().setQueryData(
|
660
|
-
|
740
|
+
C(e).queryKey,
|
661
741
|
(n) => [t, ...n ?? []]
|
662
742
|
);
|
663
743
|
}
|
664
744
|
});
|
665
745
|
}
|
666
|
-
function
|
667
|
-
return
|
746
|
+
function De(e, t) {
|
747
|
+
return d({
|
668
748
|
mutationKey: ["posts", "edit-fragment", e, t],
|
669
749
|
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
670
750
|
i.privateApiHost + "/private-api/fragments-update",
|
@@ -683,7 +763,7 @@ function Oe(e, t) {
|
|
683
763
|
)).json(),
|
684
764
|
onSuccess(n) {
|
685
765
|
u().setQueryData(
|
686
|
-
|
766
|
+
C(e).queryKey,
|
687
767
|
(o) => {
|
688
768
|
if (!o)
|
689
769
|
return [];
|
@@ -694,8 +774,8 @@ function Oe(e, t) {
|
|
694
774
|
}
|
695
775
|
});
|
696
776
|
}
|
697
|
-
function
|
698
|
-
return
|
777
|
+
function Pe(e, t) {
|
778
|
+
return d({
|
699
779
|
mutationKey: ["posts", "remove-fragment", e],
|
700
780
|
mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
|
701
781
|
method: "POST",
|
@@ -709,14 +789,14 @@ function Se(e, t) {
|
|
709
789
|
}),
|
710
790
|
onSuccess() {
|
711
791
|
u().setQueryData(
|
712
|
-
|
792
|
+
C(e).queryKey,
|
713
793
|
(n) => [...n ?? []].filter(({ id: o }) => o !== t)
|
714
794
|
);
|
715
795
|
}
|
716
796
|
});
|
717
797
|
}
|
718
|
-
function
|
719
|
-
return
|
798
|
+
function D(e, t) {
|
799
|
+
return d({
|
720
800
|
mutationKey: ["analytics", t],
|
721
801
|
mutationFn: async () => {
|
722
802
|
if (!t)
|
@@ -738,29 +818,29 @@ function A(e, t) {
|
|
738
818
|
}
|
739
819
|
});
|
740
820
|
}
|
741
|
-
const
|
821
|
+
const Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
742
822
|
__proto__: null,
|
743
|
-
useRecordActivity:
|
823
|
+
useRecordActivity: D
|
744
824
|
}, Symbol.toStringTag, { value: "Module" }));
|
745
|
-
function
|
825
|
+
function ne(e, t) {
|
746
826
|
return p({
|
747
827
|
queryKey: ["integrations", "hivesigner", "decode-memo", e],
|
748
828
|
queryFn: async () => {
|
749
829
|
const n = y(e);
|
750
830
|
if (n)
|
751
|
-
return new
|
831
|
+
return new m.Client({
|
752
832
|
accessToken: n
|
753
833
|
}).decode(t);
|
754
834
|
}
|
755
835
|
});
|
756
836
|
}
|
757
|
-
const
|
837
|
+
const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
758
838
|
__proto__: null,
|
759
|
-
getDecodeMemoQueryOptions:
|
760
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
761
|
-
queries:
|
839
|
+
getDecodeMemoQueryOptions: ne
|
840
|
+
}, Symbol.toStringTag, { value: "Module" })), re = {
|
841
|
+
queries: oe
|
762
842
|
};
|
763
|
-
function
|
843
|
+
function S(e) {
|
764
844
|
return p({
|
765
845
|
queryKey: ["integrations", "3speak", "authenticate", e],
|
766
846
|
enabled: !!e,
|
@@ -774,7 +854,7 @@ function m(e) {
|
|
774
854
|
"Content-Type": "application/json"
|
775
855
|
}
|
776
856
|
}
|
777
|
-
), n =
|
857
|
+
), n = re.queries.getDecodeMemoQueryOptions(
|
778
858
|
e,
|
779
859
|
(await t.json()).memo
|
780
860
|
);
|
@@ -786,16 +866,16 @@ function m(e) {
|
|
786
866
|
}
|
787
867
|
});
|
788
868
|
}
|
789
|
-
function
|
869
|
+
function ie(e) {
|
790
870
|
return p({
|
791
871
|
queryKey: ["integrations", "3speak", "videos", e],
|
792
872
|
enabled: !!e,
|
793
873
|
queryFn: async () => {
|
794
874
|
await u().prefetchQuery(
|
795
|
-
|
875
|
+
S(e)
|
796
876
|
);
|
797
877
|
const t = u().getQueryData(
|
798
|
-
|
878
|
+
S(e).queryKey
|
799
879
|
);
|
800
880
|
return await (await fetch(
|
801
881
|
"https://studio.3speak.tv/mobile/api/my-videos",
|
@@ -809,14 +889,14 @@ function z(e) {
|
|
809
889
|
}
|
810
890
|
});
|
811
891
|
}
|
812
|
-
const
|
892
|
+
const se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
813
893
|
__proto__: null,
|
814
|
-
getAccountTokenQueryOptions:
|
815
|
-
getAccountVideosQueryOptions:
|
816
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
817
|
-
queries:
|
894
|
+
getAccountTokenQueryOptions: S,
|
895
|
+
getAccountVideosQueryOptions: ie
|
896
|
+
}, Symbol.toStringTag, { value: "Module" })), Ie = {
|
897
|
+
queries: se
|
818
898
|
};
|
819
|
-
function
|
899
|
+
function Me() {
|
820
900
|
return p({
|
821
901
|
queryKey: ["resource-credits", "stats"],
|
822
902
|
queryFn: async () => (await i.hiveClient.call(
|
@@ -826,14 +906,14 @@ function Ke() {
|
|
826
906
|
)).rc_stats
|
827
907
|
});
|
828
908
|
}
|
829
|
-
function
|
909
|
+
function Be(e) {
|
830
910
|
return p({
|
831
911
|
queryKey: ["resource-credits", "account", e],
|
832
|
-
queryFn: async () => new
|
912
|
+
queryFn: async () => new U(i.hiveClient).findRCAccounts([e]),
|
833
913
|
enabled: !!e
|
834
914
|
});
|
835
915
|
}
|
836
|
-
function
|
916
|
+
function He(e, t) {
|
837
917
|
return p({
|
838
918
|
queryKey: ["games", "status-check", t, e],
|
839
919
|
enabled: !!e,
|
@@ -856,12 +936,12 @@ function ke(e, t) {
|
|
856
936
|
}
|
857
937
|
});
|
858
938
|
}
|
859
|
-
function
|
860
|
-
const { mutateAsync: o } =
|
939
|
+
function Je(e, t, n) {
|
940
|
+
const { mutateAsync: o } = D(
|
861
941
|
e,
|
862
942
|
"spin-rolled"
|
863
943
|
);
|
864
|
-
return
|
944
|
+
return d({
|
865
945
|
mutationKey: ["games", "post", t, e],
|
866
946
|
mutationFn: async () => {
|
867
947
|
if (!e)
|
@@ -886,7 +966,7 @@ function Te(e, t, n) {
|
|
886
966
|
}
|
887
967
|
});
|
888
968
|
}
|
889
|
-
function
|
969
|
+
function Ne(e, t, n = 100, o = void 0, r = !0) {
|
890
970
|
return p({
|
891
971
|
queryKey: ["communities", "list", e, t, n],
|
892
972
|
enabled: r,
|
@@ -906,7 +986,7 @@ function Ae(e, t, n = 100, o = void 0, r = !0) {
|
|
906
986
|
}
|
907
987
|
});
|
908
988
|
}
|
909
|
-
function
|
989
|
+
function xe(e, t) {
|
910
990
|
return p({
|
911
991
|
queryKey: ["community", "context", e, t],
|
912
992
|
enabled: !!e && !!t,
|
@@ -926,8 +1006,8 @@ function Qe(e, t) {
|
|
926
1006
|
}
|
927
1007
|
});
|
928
1008
|
}
|
929
|
-
var
|
930
|
-
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 = {
|
931
1011
|
owner: [
|
932
1012
|
"admin",
|
933
1013
|
"mod",
|
@@ -950,27 +1030,27 @@ const _e = {
|
|
950
1030
|
/* MUTED */
|
951
1031
|
]
|
952
1032
|
};
|
953
|
-
function
|
1033
|
+
function Ve(e, t) {
|
954
1034
|
return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
|
955
1035
|
}
|
956
|
-
function
|
1036
|
+
function We({
|
957
1037
|
communityType: e,
|
958
1038
|
userRole: t,
|
959
1039
|
subscribed: n
|
960
1040
|
}) {
|
961
|
-
const o = t ===
|
1041
|
+
const o = t === l.MUTED ? !1 : e === "Topic" ? !0 : [l.OWNER, l.ADMIN, l.MOD, l.MEMBER].includes(
|
962
1042
|
t
|
963
1043
|
), r = (() => {
|
964
|
-
if (t ===
|
1044
|
+
if (t === l.MUTED) return !1;
|
965
1045
|
switch (e) {
|
966
1046
|
case "Topic":
|
967
1047
|
return !0;
|
968
1048
|
case "Journal":
|
969
|
-
return t !==
|
1049
|
+
return t !== l.GUEST || n;
|
970
1050
|
case "Council":
|
971
1051
|
return o;
|
972
1052
|
}
|
973
|
-
})(), c = [
|
1053
|
+
})(), c = [l.OWNER, l.ADMIN, l.MOD].includes(t);
|
974
1054
|
return {
|
975
1055
|
canPost: o,
|
976
1056
|
canComment: r,
|
@@ -979,53 +1059,53 @@ function Fe({
|
|
979
1059
|
}
|
980
1060
|
export {
|
981
1061
|
i as CONFIG,
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
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,
|
991
1071
|
y as getAccessToken,
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
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,
|
1008
1088
|
u as getQueryClient,
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
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
|
1031
1111
|
};
|