@ecency/sdk 1.4.1 → 1.5.1

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.
@@ -11,6 +11,107 @@ var __export = (target, all) => {
11
11
  };
12
12
  var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
13
13
 
14
+ // src/modules/keychain/keychain.ts
15
+ var keychain_exports = {};
16
+ __export(keychain_exports, {
17
+ broadcast: () => broadcast,
18
+ customJson: () => customJson,
19
+ handshake: () => handshake
20
+ });
21
+ function handshake() {
22
+ return new Promise((resolve) => {
23
+ window.hive_keychain?.requestHandshake(() => {
24
+ resolve();
25
+ });
26
+ });
27
+ }
28
+ var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
29
+ window.hive_keychain?.requestBroadcast(
30
+ account,
31
+ operations,
32
+ key,
33
+ (resp) => {
34
+ if (!resp.success) {
35
+ reject({ message: "Operation cancelled" });
36
+ }
37
+ resolve(resp);
38
+ },
39
+ rpc
40
+ );
41
+ });
42
+ var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
43
+ window.hive_keychain?.requestCustomJson(
44
+ account,
45
+ id,
46
+ key,
47
+ json,
48
+ display_msg,
49
+ (resp) => {
50
+ if (!resp.success) {
51
+ reject({ message: "Operation cancelled" });
52
+ }
53
+ resolve(resp);
54
+ },
55
+ rpc
56
+ );
57
+ });
58
+
59
+ // src/modules/core/mutations/use-broadcast-mutation.ts
60
+ function useBroadcastMutation(mutationKey = [], username, accessToken, operations, onSuccess = () => {
61
+ }, auth) {
62
+ return useMutation({
63
+ onSuccess,
64
+ mutationKey: [...mutationKey, username],
65
+ mutationFn: async (payload) => {
66
+ if (!username) {
67
+ throw new Error(
68
+ "[Core][Broadcast] Attempted to call broadcast API with anon user"
69
+ );
70
+ }
71
+ const postingKey = auth?.postingKey;
72
+ if (postingKey) {
73
+ const privateKey = PrivateKey.fromString(postingKey);
74
+ return CONFIG.hiveClient.broadcast.sendOperations(
75
+ operations(payload),
76
+ privateKey
77
+ );
78
+ }
79
+ const loginType = auth?.loginType;
80
+ if (loginType && loginType == "keychain") {
81
+ return keychain_exports.broadcast(
82
+ username,
83
+ operations(payload),
84
+ "Posting"
85
+ ).then((r) => r.result);
86
+ }
87
+ if (accessToken) {
88
+ const f = getBoundFetch();
89
+ const res = await f("https://hivesigner.com/api/broadcast", {
90
+ method: "POST",
91
+ headers: {
92
+ Authorization: accessToken,
93
+ "Content-Type": "application/json",
94
+ Accept: "application/json"
95
+ },
96
+ body: JSON.stringify({ operations: operations(payload) })
97
+ });
98
+ if (!res.ok) {
99
+ const txt = await res.text().catch(() => "");
100
+ throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
101
+ }
102
+ const json = await res.json();
103
+ if (json?.errors) {
104
+ throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
105
+ }
106
+ return json.result;
107
+ }
108
+ throw new Error(
109
+ "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
110
+ );
111
+ }
112
+ });
113
+ }
114
+
14
115
  // src/modules/core/mock-storage.ts
15
116
  var MockStorage = class {
16
117
  constructor() {
@@ -34,6 +135,7 @@ var MockStorage = class {
34
135
  };
35
136
  var CONFIG = {
36
137
  privateApiHost: "https://ecency.com",
138
+ imageHost: "https://images.ecency.com",
37
139
  storage: typeof window === "undefined" ? new MockStorage() : window.localStorage,
38
140
  storagePrefix: "ecency",
39
141
  hiveClient: new Client(
@@ -80,6 +182,10 @@ var ConfigManager;
80
182
  CONFIG.privateApiHost = host;
81
183
  }
82
184
  ConfigManager2.setPrivateApiHost = setPrivateApiHost;
185
+ function setImageHost(host) {
186
+ CONFIG.imageHost = host;
187
+ }
188
+ ConfigManager2.setImageHost = setImageHost;
83
189
  function analyzeRedosRisk(pattern) {
84
190
  if (/(\([^)]*[*+{][^)]*\))[*+{]/.test(pattern)) {
85
191
  return { safe: false, reason: "nested quantifiers detected" };
@@ -186,6 +292,40 @@ var ConfigManager;
186
292
  }
187
293
  ConfigManager2.setDmcaLists = setDmcaLists;
188
294
  })(ConfigManager || (ConfigManager = {}));
295
+ async function broadcastJson(username, id, payload, accessToken, auth) {
296
+ if (!username) {
297
+ throw new Error(
298
+ "[Core][Broadcast] Attempted to call broadcast API with anon user"
299
+ );
300
+ }
301
+ const jjson = {
302
+ id,
303
+ required_auths: [],
304
+ required_posting_auths: [username],
305
+ json: JSON.stringify(payload)
306
+ };
307
+ const postingKey = auth?.postingKey;
308
+ if (postingKey) {
309
+ const privateKey = PrivateKey.fromString(postingKey);
310
+ return CONFIG.hiveClient.broadcast.json(
311
+ jjson,
312
+ privateKey
313
+ );
314
+ }
315
+ const loginType = auth?.loginType;
316
+ if (loginType && loginType == "keychain") {
317
+ return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
318
+ }
319
+ if (accessToken) {
320
+ const response = await new hs.Client({
321
+ accessToken
322
+ }).customJson([], [username], id, JSON.stringify(payload));
323
+ return response.result;
324
+ }
325
+ throw new Error(
326
+ "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
327
+ );
328
+ }
189
329
 
190
330
  // src/modules/core/utils/decoder-encoder.ts
191
331
  function encodeObj(o) {
@@ -263,143 +403,6 @@ var getAccessToken = (username) => getUser(username) && getUser(username).access
263
403
  var getPostingKey = (username) => getUser(username) && getUser(username).postingKey;
264
404
  var getLoginType = (username) => getUser(username) && getUser(username).loginType;
265
405
  var getRefreshToken = (username) => getUser(username) && getUser(username).refreshToken;
266
-
267
- // src/modules/keychain/keychain.ts
268
- var keychain_exports = {};
269
- __export(keychain_exports, {
270
- broadcast: () => broadcast,
271
- customJson: () => customJson,
272
- handshake: () => handshake
273
- });
274
- function handshake() {
275
- return new Promise((resolve) => {
276
- window.hive_keychain?.requestHandshake(() => {
277
- resolve();
278
- });
279
- });
280
- }
281
- var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
282
- window.hive_keychain?.requestBroadcast(
283
- account,
284
- operations,
285
- key,
286
- (resp) => {
287
- if (!resp.success) {
288
- reject({ message: "Operation cancelled" });
289
- }
290
- resolve(resp);
291
- },
292
- rpc
293
- );
294
- });
295
- var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
296
- window.hive_keychain?.requestCustomJson(
297
- account,
298
- id,
299
- key,
300
- json,
301
- display_msg,
302
- (resp) => {
303
- if (!resp.success) {
304
- reject({ message: "Operation cancelled" });
305
- }
306
- resolve(resp);
307
- },
308
- rpc
309
- );
310
- });
311
-
312
- // src/modules/core/mutations/use-broadcast-mutation.ts
313
- function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
314
- }) {
315
- return useMutation({
316
- onSuccess,
317
- mutationKey: [...mutationKey, username],
318
- mutationFn: async (payload) => {
319
- if (!username) {
320
- throw new Error(
321
- "[Core][Broadcast] Attempted to call broadcast API with anon user"
322
- );
323
- }
324
- const postingKey = getPostingKey(username);
325
- if (postingKey) {
326
- const privateKey = PrivateKey.fromString(postingKey);
327
- return CONFIG.hiveClient.broadcast.sendOperations(
328
- operations(payload),
329
- privateKey
330
- );
331
- }
332
- const loginType = getLoginType(username);
333
- if (loginType && loginType == "keychain") {
334
- return keychain_exports.broadcast(
335
- username,
336
- operations(payload),
337
- "Posting"
338
- ).then((r) => r.result);
339
- }
340
- let token = getAccessToken(username);
341
- if (token) {
342
- const f = getBoundFetch();
343
- const res = await f("https://hivesigner.com/api/broadcast", {
344
- method: "POST",
345
- headers: {
346
- Authorization: token,
347
- "Content-Type": "application/json",
348
- Accept: "application/json"
349
- },
350
- body: JSON.stringify({ operations: operations(payload) })
351
- });
352
- if (!res.ok) {
353
- const txt = await res.text().catch(() => "");
354
- throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
355
- }
356
- const json = await res.json();
357
- if (json?.errors) {
358
- throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
359
- }
360
- return json.result;
361
- }
362
- throw new Error(
363
- "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
364
- );
365
- }
366
- });
367
- }
368
- async function broadcastJson(username, id, payload) {
369
- if (!username) {
370
- throw new Error(
371
- "[Core][Broadcast] Attempted to call broadcast API with anon user"
372
- );
373
- }
374
- const jjson = {
375
- id,
376
- required_auths: [],
377
- required_posting_auths: [username],
378
- json: JSON.stringify(payload)
379
- };
380
- const postingKey = getPostingKey(username);
381
- if (postingKey) {
382
- const privateKey = PrivateKey.fromString(postingKey);
383
- return CONFIG.hiveClient.broadcast.json(
384
- jjson,
385
- privateKey
386
- );
387
- }
388
- const loginType = getLoginType(username);
389
- if (loginType && loginType == "keychain") {
390
- return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
391
- }
392
- let token = getAccessToken(username);
393
- if (token) {
394
- const response = await new hs.Client({
395
- accessToken: token
396
- }).customJson([], [username], id, JSON.stringify(payload));
397
- return response.result;
398
- }
399
- throw new Error(
400
- "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
401
- );
402
- }
403
406
  function makeQueryClient() {
404
407
  return new QueryClient({
405
408
  defaultOptions: {
@@ -711,12 +714,14 @@ function parseAccounts(rawAccounts) {
711
714
  // src/modules/accounts/queries/get-accounts-query-options.ts
712
715
  function getAccountsQueryOptions(usernames) {
713
716
  return queryOptions({
714
- queryKey: ["accounts", "get-accounts", usernames],
717
+ queryKey: ["accounts", "list", ...usernames],
718
+ enabled: usernames.length > 0,
715
719
  queryFn: async () => {
716
- const response = await CONFIG.hiveClient.database.getAccounts(usernames);
720
+ const response = await CONFIG.hiveClient.database.getAccounts(
721
+ usernames
722
+ );
717
723
  return parseAccounts(response);
718
- },
719
- enabled: usernames.length > 0
724
+ }
720
725
  });
721
726
  }
722
727
  function getFollowCountQueryOptions(username) {
@@ -907,13 +912,13 @@ function getAccountSubscriptionsQueryOptions(username) {
907
912
  }
908
913
  });
909
914
  }
910
- function getActiveAccountBookmarksQueryOptions(activeUsername) {
915
+ function getActiveAccountBookmarksQueryOptions(activeUsername, code) {
911
916
  return queryOptions({
912
917
  queryKey: ["accounts", "bookmarks", activeUsername],
913
- enabled: !!activeUsername,
918
+ enabled: !!activeUsername && !!code,
914
919
  queryFn: async () => {
915
- if (!activeUsername) {
916
- throw new Error("[SDK][Accounts][Bookmarks] \u2013 no active user");
920
+ if (!activeUsername || !code) {
921
+ throw new Error("[SDK][Accounts][Bookmarks] \u2013 missing auth");
917
922
  }
918
923
  const fetchApi = getBoundFetch();
919
924
  const response = await fetchApi(
@@ -923,20 +928,20 @@ function getActiveAccountBookmarksQueryOptions(activeUsername) {
923
928
  headers: {
924
929
  "Content-Type": "application/json"
925
930
  },
926
- body: JSON.stringify({ code: getAccessToken(activeUsername) })
931
+ body: JSON.stringify({ code })
927
932
  }
928
933
  );
929
934
  return await response.json();
930
935
  }
931
936
  });
932
937
  }
933
- function getActiveAccountFavouritesQueryOptions(activeUsername) {
938
+ function getActiveAccountFavouritesQueryOptions(activeUsername, code) {
934
939
  return queryOptions({
935
940
  queryKey: ["accounts", "favourites", activeUsername],
936
- enabled: !!activeUsername,
941
+ enabled: !!activeUsername && !!code,
937
942
  queryFn: async () => {
938
- if (!activeUsername) {
939
- throw new Error("[SDK][Accounts][Favourites] \u2013 no active user");
943
+ if (!activeUsername || !code) {
944
+ throw new Error("[SDK][Accounts][Favourites] \u2013 missing auth");
940
945
  }
941
946
  const fetchApi = getBoundFetch();
942
947
  const response = await fetchApi(
@@ -946,18 +951,21 @@ function getActiveAccountFavouritesQueryOptions(activeUsername) {
946
951
  headers: {
947
952
  "Content-Type": "application/json"
948
953
  },
949
- body: JSON.stringify({ code: getAccessToken(activeUsername) })
954
+ body: JSON.stringify({ code })
950
955
  }
951
956
  );
952
957
  return await response.json();
953
958
  }
954
959
  });
955
960
  }
956
- function getAccountRecoveriesQueryOptions(username) {
961
+ function getAccountRecoveriesQueryOptions(username, code) {
957
962
  return queryOptions({
958
- enabled: !!username,
963
+ enabled: !!username && !!code,
959
964
  queryKey: ["accounts", "recoveries", username],
960
965
  queryFn: async () => {
966
+ if (!username || !code) {
967
+ throw new Error("[SDK][Accounts] Missing username or access token");
968
+ }
961
969
  const fetchApi = getBoundFetch();
962
970
  const response = await fetchApi(
963
971
  CONFIG.privateApiHost + "/private-api/recoveries",
@@ -966,7 +974,7 @@ function getAccountRecoveriesQueryOptions(username) {
966
974
  headers: {
967
975
  "Content-Type": "application/json"
968
976
  },
969
- body: JSON.stringify({ code: getAccessToken(username) })
977
+ body: JSON.stringify({ code })
970
978
  }
971
979
  );
972
980
  return response.json();
@@ -984,6 +992,22 @@ function getAccountPendingRecoveryQueryOptions(username) {
984
992
  )
985
993
  });
986
994
  }
995
+ function getAccountReputationsQueryOptions(query, limit = 50) {
996
+ return queryOptions({
997
+ queryKey: ["accounts", "reputations", query, limit],
998
+ enabled: !!query,
999
+ queryFn: async () => {
1000
+ if (!query) {
1001
+ return [];
1002
+ }
1003
+ return CONFIG.hiveClient.call(
1004
+ "condenser_api",
1005
+ "get_account_reputations",
1006
+ [query, limit]
1007
+ );
1008
+ }
1009
+ });
1010
+ }
987
1011
  var ops = utils.operationOrders;
988
1012
  var ACCOUNT_OPERATION_GROUPS = {
989
1013
  transfers: [
@@ -1241,17 +1265,20 @@ function getTrendingTagsWithStatsQueryOptions(limit = 250) {
1241
1265
  refetchOnMount: true
1242
1266
  });
1243
1267
  }
1244
- function getFragmentsQueryOptions(username) {
1268
+ function getFragmentsQueryOptions(username, code) {
1245
1269
  return queryOptions({
1246
1270
  queryKey: ["posts", "fragments", username],
1247
1271
  queryFn: async () => {
1272
+ if (!code) {
1273
+ return [];
1274
+ }
1248
1275
  const fetchApi = getBoundFetch();
1249
1276
  const response = await fetchApi(
1250
1277
  CONFIG.privateApiHost + "/private-api/fragments",
1251
1278
  {
1252
1279
  method: "POST",
1253
1280
  body: JSON.stringify({
1254
- code: getAccessToken(username)
1281
+ code
1255
1282
  }),
1256
1283
  headers: {
1257
1284
  "Content-Type": "application/json"
@@ -1260,7 +1287,7 @@ function getFragmentsQueryOptions(username) {
1260
1287
  );
1261
1288
  return response.json();
1262
1289
  },
1263
- enabled: !!username
1290
+ enabled: !!username && !!code
1264
1291
  });
1265
1292
  }
1266
1293
  function getPromotedPostsQuery(type = "feed") {
@@ -1297,6 +1324,26 @@ function getEntryActiveVotesQueryOptions(entry) {
1297
1324
  enabled: !!entry
1298
1325
  });
1299
1326
  }
1327
+ function getContentQueryOptions(author, permlink) {
1328
+ return queryOptions({
1329
+ queryKey: ["posts", "content", author, permlink],
1330
+ enabled: !!author && !!permlink,
1331
+ queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content", [
1332
+ author,
1333
+ permlink
1334
+ ])
1335
+ });
1336
+ }
1337
+ function getContentRepliesQueryOptions(author, permlink) {
1338
+ return queryOptions({
1339
+ queryKey: ["posts", "content-replies", author, permlink],
1340
+ enabled: !!author && !!permlink,
1341
+ queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content_replies", {
1342
+ author,
1343
+ permlink
1344
+ })
1345
+ });
1346
+ }
1300
1347
  function getPostHeaderQueryOptions(author, permlink) {
1301
1348
  return queryOptions({
1302
1349
  queryKey: ["posts", "post-header", author, permlink],
@@ -1358,6 +1405,212 @@ function getPostQueryOptions(author, permlink, observer = "", num) {
1358
1405
  enabled: !!author && !!permlink && permlink.trim() !== "" && permlink.trim() !== "undefined"
1359
1406
  });
1360
1407
  }
1408
+
1409
+ // src/modules/bridge/requests.ts
1410
+ function bridgeApiCall(endpoint, params) {
1411
+ return CONFIG.hiveClient.call("bridge", endpoint, params);
1412
+ }
1413
+ async function resolvePost(post, observer, num) {
1414
+ const { json_metadata: json } = post;
1415
+ if (json?.original_author && json?.original_permlink && json.tags?.[0] === "cross-post") {
1416
+ try {
1417
+ const resp = await getPost(
1418
+ json.original_author,
1419
+ json.original_permlink,
1420
+ observer,
1421
+ num
1422
+ );
1423
+ if (resp) {
1424
+ return {
1425
+ ...post,
1426
+ original_entry: resp,
1427
+ num
1428
+ };
1429
+ }
1430
+ return post;
1431
+ } catch {
1432
+ return post;
1433
+ }
1434
+ }
1435
+ return { ...post, num };
1436
+ }
1437
+ async function resolvePosts(posts, observer) {
1438
+ const validatedPosts = posts.map(validateEntry);
1439
+ const resolved = await Promise.all(validatedPosts.map((p) => resolvePost(p, observer)));
1440
+ return filterDmcaEntry(resolved);
1441
+ }
1442
+ async function getPostsRanked(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "") {
1443
+ const resp = await bridgeApiCall("get_ranked_posts", {
1444
+ sort,
1445
+ start_author,
1446
+ start_permlink,
1447
+ limit,
1448
+ tag,
1449
+ observer
1450
+ });
1451
+ if (resp) {
1452
+ return resolvePosts(resp, observer);
1453
+ }
1454
+ return resp;
1455
+ }
1456
+ async function getAccountPosts(sort, account, start_author = "", start_permlink = "", limit = 20, observer = "") {
1457
+ if (CONFIG.dmcaAccounts.includes(account)) {
1458
+ return [];
1459
+ }
1460
+ const resp = await bridgeApiCall("get_account_posts", {
1461
+ sort,
1462
+ account,
1463
+ start_author,
1464
+ start_permlink,
1465
+ limit,
1466
+ observer
1467
+ });
1468
+ if (resp) {
1469
+ return resolvePosts(resp, observer);
1470
+ }
1471
+ return resp;
1472
+ }
1473
+ function validateEntry(entry) {
1474
+ const newEntry = {
1475
+ ...entry,
1476
+ active_votes: Array.isArray(entry.active_votes) ? [...entry.active_votes] : [],
1477
+ beneficiaries: Array.isArray(entry.beneficiaries) ? [...entry.beneficiaries] : [],
1478
+ blacklists: Array.isArray(entry.blacklists) ? [...entry.blacklists] : [],
1479
+ replies: Array.isArray(entry.replies) ? [...entry.replies] : [],
1480
+ stats: entry.stats ? { ...entry.stats } : null
1481
+ };
1482
+ const requiredStringProps = [
1483
+ "author",
1484
+ "title",
1485
+ "body",
1486
+ "created",
1487
+ "category",
1488
+ "permlink",
1489
+ "url",
1490
+ "updated"
1491
+ ];
1492
+ for (const prop of requiredStringProps) {
1493
+ if (newEntry[prop] == null) {
1494
+ newEntry[prop] = "";
1495
+ }
1496
+ }
1497
+ if (newEntry.author_reputation == null) {
1498
+ newEntry.author_reputation = 0;
1499
+ }
1500
+ if (newEntry.children == null) {
1501
+ newEntry.children = 0;
1502
+ }
1503
+ if (newEntry.depth == null) {
1504
+ newEntry.depth = 0;
1505
+ }
1506
+ if (newEntry.net_rshares == null) {
1507
+ newEntry.net_rshares = 0;
1508
+ }
1509
+ if (newEntry.payout == null) {
1510
+ newEntry.payout = 0;
1511
+ }
1512
+ if (newEntry.percent_hbd == null) {
1513
+ newEntry.percent_hbd = 0;
1514
+ }
1515
+ if (!newEntry.stats) {
1516
+ newEntry.stats = {
1517
+ flag_weight: 0,
1518
+ gray: false,
1519
+ hide: false,
1520
+ total_votes: 0
1521
+ };
1522
+ }
1523
+ if (newEntry.author_payout_value == null) {
1524
+ newEntry.author_payout_value = "0.000 HBD";
1525
+ }
1526
+ if (newEntry.curator_payout_value == null) {
1527
+ newEntry.curator_payout_value = "0.000 HBD";
1528
+ }
1529
+ if (newEntry.max_accepted_payout == null) {
1530
+ newEntry.max_accepted_payout = "1000000.000 HBD";
1531
+ }
1532
+ if (newEntry.payout_at == null) {
1533
+ newEntry.payout_at = "";
1534
+ }
1535
+ if (newEntry.pending_payout_value == null) {
1536
+ newEntry.pending_payout_value = "0.000 HBD";
1537
+ }
1538
+ if (newEntry.promoted == null) {
1539
+ newEntry.promoted = "0.000 HBD";
1540
+ }
1541
+ if (newEntry.is_paidout == null) {
1542
+ newEntry.is_paidout = false;
1543
+ }
1544
+ return newEntry;
1545
+ }
1546
+ async function getPost(author = "", permlink = "", observer = "", num) {
1547
+ const resp = await bridgeApiCall("get_post", {
1548
+ author,
1549
+ permlink,
1550
+ observer
1551
+ });
1552
+ if (resp) {
1553
+ const validatedEntry = validateEntry(resp);
1554
+ const post = await resolvePost(validatedEntry, observer, num);
1555
+ return filterDmcaEntry(post);
1556
+ }
1557
+ return void 0;
1558
+ }
1559
+ async function getPostHeader(author = "", permlink = "") {
1560
+ const resp = await bridgeApiCall("get_post_header", {
1561
+ author,
1562
+ permlink
1563
+ });
1564
+ return resp ? validateEntry(resp) : resp;
1565
+ }
1566
+ async function getDiscussion(author, permlink, observer) {
1567
+ const resp = await bridgeApiCall("get_discussion", {
1568
+ author,
1569
+ permlink,
1570
+ observer: observer || author
1571
+ });
1572
+ if (resp) {
1573
+ const validatedResp = {};
1574
+ for (const [key, entry] of Object.entries(resp)) {
1575
+ validatedResp[key] = validateEntry(entry);
1576
+ }
1577
+ return validatedResp;
1578
+ }
1579
+ return resp;
1580
+ }
1581
+ async function getCommunity(name, observer = "") {
1582
+ return bridgeApiCall("get_community", { name, observer });
1583
+ }
1584
+ async function getCommunities(last = "", limit = 100, query, sort = "rank", observer = "") {
1585
+ return bridgeApiCall("list_communities", {
1586
+ last,
1587
+ limit,
1588
+ query,
1589
+ sort,
1590
+ observer
1591
+ });
1592
+ }
1593
+ async function normalizePost(post) {
1594
+ const resp = await bridgeApiCall("normalize_post", { post });
1595
+ return resp ? validateEntry(resp) : resp;
1596
+ }
1597
+ async function getSubscriptions(account) {
1598
+ return bridgeApiCall("list_all_subscriptions", { account });
1599
+ }
1600
+ async function getSubscribers(community) {
1601
+ return bridgeApiCall("list_subscribers", { community });
1602
+ }
1603
+ async function getRelationshipBetweenAccounts(follower, following) {
1604
+ return bridgeApiCall("get_relationship_between_accounts", [
1605
+ follower,
1606
+ following
1607
+ ]);
1608
+ }
1609
+ async function getProfiles(accounts, observer) {
1610
+ return bridgeApiCall("get_profiles", { accounts, observer });
1611
+ }
1612
+
1613
+ // src/modules/posts/queries/get-discussions-query-options.ts
1361
1614
  var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
1362
1615
  SortOrder2["trending"] = "trending";
1363
1616
  SortOrder2["author_reputation"] = "author_reputation";
@@ -1455,6 +1708,13 @@ function getDiscussionsQueryOptions(entry, order = "created" /* created */, enab
1455
1708
  select: (data) => sortDiscussions(entry, data, order)
1456
1709
  });
1457
1710
  }
1711
+ function getDiscussionQueryOptions(author, permlink, observer, enabled = true) {
1712
+ return queryOptions({
1713
+ queryKey: ["posts", "discussion", author, permlink, observer || author],
1714
+ enabled: enabled && !!author && !!permlink,
1715
+ queryFn: async () => getDiscussion(author, permlink, observer)
1716
+ });
1717
+ }
1458
1718
  function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit = 20, observer = "", enabled = true) {
1459
1719
  return infiniteQueryOptions({
1460
1720
  queryKey: ["posts", "account-posts", username ?? "", filter, limit, observer],
@@ -1504,6 +1764,35 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
1504
1764
  }
1505
1765
  });
1506
1766
  }
1767
+ function getAccountPostsQueryOptions(username, filter = "posts", start_author = "", start_permlink = "", limit = 20, observer = "", enabled = true) {
1768
+ return queryOptions({
1769
+ queryKey: [
1770
+ "posts",
1771
+ "account-posts-page",
1772
+ username ?? "",
1773
+ filter,
1774
+ start_author,
1775
+ start_permlink,
1776
+ limit,
1777
+ observer
1778
+ ],
1779
+ enabled: !!username && enabled,
1780
+ queryFn: async () => {
1781
+ if (!username) {
1782
+ return [];
1783
+ }
1784
+ const response = await getAccountPosts(
1785
+ filter,
1786
+ username,
1787
+ start_author,
1788
+ start_permlink,
1789
+ limit,
1790
+ observer
1791
+ );
1792
+ return filterDmcaEntry(response ?? []);
1793
+ }
1794
+ });
1795
+ }
1507
1796
  function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = "", enabled = true, _options = {}) {
1508
1797
  return infiniteQueryOptions({
1509
1798
  queryKey: ["posts", "posts-ranked", sort, tag, limit, observer],
@@ -1551,6 +1840,36 @@ function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = ""
1551
1840
  }
1552
1841
  });
1553
1842
  }
1843
+ function getPostsRankedQueryOptions(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "", enabled = true) {
1844
+ return queryOptions({
1845
+ queryKey: [
1846
+ "posts",
1847
+ "posts-ranked-page",
1848
+ sort,
1849
+ start_author,
1850
+ start_permlink,
1851
+ limit,
1852
+ tag,
1853
+ observer
1854
+ ],
1855
+ enabled,
1856
+ queryFn: async () => {
1857
+ let sanitizedTag = tag;
1858
+ if (CONFIG.dmcaTagRegexes.some((regex) => regex.test(tag))) {
1859
+ sanitizedTag = "";
1860
+ }
1861
+ const response = await getPostsRanked(
1862
+ sort,
1863
+ start_author,
1864
+ start_permlink,
1865
+ limit,
1866
+ sanitizedTag,
1867
+ observer
1868
+ );
1869
+ return filterDmcaEntry(response ?? []);
1870
+ }
1871
+ });
1872
+ }
1554
1873
  function getReblogsQueryOptions(username, activeUsername, limit = 200) {
1555
1874
  return queryOptions({
1556
1875
  queryKey: ["posts", "reblogs", username ?? "", limit],
@@ -1567,20 +1886,21 @@ function getReblogsQueryOptions(username, activeUsername, limit = 200) {
1567
1886
  enabled: !!username
1568
1887
  });
1569
1888
  }
1570
- function getSchedulesQueryOptions(activeUsername) {
1889
+ function getSchedulesQueryOptions(activeUsername, code) {
1571
1890
  return queryOptions({
1572
1891
  queryKey: ["posts", "schedules", activeUsername],
1573
1892
  queryFn: async () => {
1574
- if (!activeUsername) {
1893
+ if (!activeUsername || !code) {
1575
1894
  return [];
1576
1895
  }
1577
- const response = await fetch(CONFIG.privateApiHost + "/private-api/schedules", {
1896
+ const fetchApi = getBoundFetch();
1897
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules", {
1578
1898
  method: "POST",
1579
1899
  headers: {
1580
1900
  "Content-Type": "application/json"
1581
1901
  },
1582
1902
  body: JSON.stringify({
1583
- code: getAccessToken(activeUsername)
1903
+ code
1584
1904
  })
1585
1905
  });
1586
1906
  if (!response.ok) {
@@ -1588,23 +1908,24 @@ function getSchedulesQueryOptions(activeUsername) {
1588
1908
  }
1589
1909
  return response.json();
1590
1910
  },
1591
- enabled: !!activeUsername
1911
+ enabled: !!activeUsername && !!code
1592
1912
  });
1593
1913
  }
1594
- function getDraftsQueryOptions(activeUsername) {
1914
+ function getDraftsQueryOptions(activeUsername, code) {
1595
1915
  return queryOptions({
1596
1916
  queryKey: ["posts", "drafts", activeUsername],
1597
1917
  queryFn: async () => {
1598
- if (!activeUsername) {
1918
+ if (!activeUsername || !code) {
1599
1919
  return [];
1600
1920
  }
1601
- const response = await fetch(CONFIG.privateApiHost + "/private-api/drafts", {
1921
+ const fetchApi = getBoundFetch();
1922
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts", {
1602
1923
  method: "POST",
1603
1924
  headers: {
1604
1925
  "Content-Type": "application/json"
1605
1926
  },
1606
1927
  body: JSON.stringify({
1607
- code: getAccessToken(activeUsername)
1928
+ code
1608
1929
  })
1609
1930
  });
1610
1931
  if (!response.ok) {
@@ -1612,17 +1933,18 @@ function getDraftsQueryOptions(activeUsername) {
1612
1933
  }
1613
1934
  return response.json();
1614
1935
  },
1615
- enabled: !!activeUsername
1936
+ enabled: !!activeUsername && !!code
1616
1937
  });
1617
1938
  }
1618
- async function fetchUserImages(username) {
1619
- const response = await fetch(CONFIG.privateApiHost + "/private-api/images", {
1939
+ async function fetchUserImages(code) {
1940
+ const fetchApi = getBoundFetch();
1941
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images", {
1620
1942
  method: "POST",
1621
1943
  headers: {
1622
1944
  "Content-Type": "application/json"
1623
1945
  },
1624
1946
  body: JSON.stringify({
1625
- code: getAccessToken(username)
1947
+ code
1626
1948
  })
1627
1949
  });
1628
1950
  if (!response.ok) {
@@ -1630,28 +1952,28 @@ async function fetchUserImages(username) {
1630
1952
  }
1631
1953
  return response.json();
1632
1954
  }
1633
- function getImagesQueryOptions(username) {
1955
+ function getImagesQueryOptions(username, code) {
1634
1956
  return queryOptions({
1635
1957
  queryKey: ["posts", "images", username],
1636
1958
  queryFn: async () => {
1637
- if (!username) {
1959
+ if (!username || !code) {
1638
1960
  return [];
1639
1961
  }
1640
- return fetchUserImages(username);
1962
+ return fetchUserImages(code);
1641
1963
  },
1642
- enabled: !!username
1964
+ enabled: !!username && !!code
1643
1965
  });
1644
1966
  }
1645
- function getGalleryImagesQueryOptions(activeUsername) {
1967
+ function getGalleryImagesQueryOptions(activeUsername, code) {
1646
1968
  return queryOptions({
1647
1969
  queryKey: ["posts", "gallery-images", activeUsername],
1648
1970
  queryFn: async () => {
1649
- if (!activeUsername) {
1971
+ if (!activeUsername || !code) {
1650
1972
  return [];
1651
1973
  }
1652
- return fetchUserImages(activeUsername);
1974
+ return fetchUserImages(code);
1653
1975
  },
1654
- enabled: !!activeUsername
1976
+ enabled: !!activeUsername && !!code
1655
1977
  });
1656
1978
  }
1657
1979
  function getCommentHistoryQueryOptions(author, permlink, onlyMeta = false) {
@@ -1785,8 +2107,8 @@ function toEntryArray(x) {
1785
2107
  return Array.isArray(x) ? x : [];
1786
2108
  }
1787
2109
  async function getVisibleFirstLevelThreadItems(container) {
1788
- const queryOptions76 = getDiscussionsQueryOptions(container, "created" /* created */, true);
1789
- const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions76);
2110
+ const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
2111
+ const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
1790
2112
  const discussionItems = toEntryArray(discussionItemsRaw);
1791
2113
  if (discussionItems.length <= 1) {
1792
2114
  return [];
@@ -1995,6 +2317,18 @@ function getWavesTrendingTagsQueryOptions(host, hours = 24) {
1995
2317
  }
1996
2318
  });
1997
2319
  }
2320
+ function getNormalizePostQueryOptions(post, enabled = true) {
2321
+ return queryOptions({
2322
+ queryKey: [
2323
+ "posts",
2324
+ "normalize",
2325
+ post?.author ?? "",
2326
+ post?.permlink ?? ""
2327
+ ],
2328
+ enabled: enabled && !!post,
2329
+ queryFn: async () => normalizePost(post)
2330
+ });
2331
+ }
1998
2332
 
1999
2333
  // src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts
2000
2334
  function isEntry(x) {
@@ -2045,14 +2379,22 @@ function getAccountVoteHistoryInfiniteQueryOptions(username, options) {
2045
2379
  })
2046
2380
  });
2047
2381
  }
2382
+ function getProfilesQueryOptions(accounts, observer, enabled = true) {
2383
+ return queryOptions({
2384
+ queryKey: ["accounts", "profiles", accounts, observer ?? ""],
2385
+ enabled: enabled && accounts.length > 0,
2386
+ queryFn: async () => getProfiles(accounts, observer)
2387
+ });
2388
+ }
2048
2389
 
2049
2390
  // src/modules/accounts/mutations/use-account-update.ts
2050
- function useAccountUpdate(username) {
2391
+ function useAccountUpdate(username, accessToken, auth) {
2051
2392
  const queryClient = useQueryClient();
2052
2393
  const { data } = useQuery(getAccountFullQueryOptions(username));
2053
2394
  return useBroadcastMutation(
2054
2395
  ["accounts", "update"],
2055
2396
  username,
2397
+ accessToken,
2056
2398
  (payload) => {
2057
2399
  if (!data) {
2058
2400
  throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
@@ -2076,7 +2418,7 @@ function useAccountUpdate(username) {
2076
2418
  ]
2077
2419
  ];
2078
2420
  },
2079
- (_, variables) => queryClient.setQueryData(
2421
+ (_data, variables) => queryClient.setQueryData(
2080
2422
  getAccountFullQueryOptions(username).queryKey,
2081
2423
  (data2) => {
2082
2424
  if (!data2) {
@@ -2090,7 +2432,8 @@ function useAccountUpdate(username) {
2090
2432
  });
2091
2433
  return obj;
2092
2434
  }
2093
- )
2435
+ ),
2436
+ auth
2094
2437
  );
2095
2438
  }
2096
2439
  function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
@@ -2132,12 +2475,12 @@ function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
2132
2475
  }
2133
2476
  });
2134
2477
  }
2135
- function useBookmarkAdd(username, onSuccess, onError) {
2478
+ function useBookmarkAdd(username, code, onSuccess, onError) {
2136
2479
  return useMutation({
2137
2480
  mutationKey: ["accounts", "bookmarks", "add", username],
2138
2481
  mutationFn: async ({ author, permlink }) => {
2139
- if (!username) {
2140
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2482
+ if (!username || !code) {
2483
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2141
2484
  }
2142
2485
  const fetchApi = getBoundFetch();
2143
2486
  const response = await fetchApi(
@@ -2150,7 +2493,7 @@ function useBookmarkAdd(username, onSuccess, onError) {
2150
2493
  body: JSON.stringify({
2151
2494
  author,
2152
2495
  permlink,
2153
- code: getAccessToken(username)
2496
+ code
2154
2497
  })
2155
2498
  }
2156
2499
  );
@@ -2165,12 +2508,12 @@ function useBookmarkAdd(username, onSuccess, onError) {
2165
2508
  onError
2166
2509
  });
2167
2510
  }
2168
- function useBookmarkDelete(username, onSuccess, onError) {
2511
+ function useBookmarkDelete(username, code, onSuccess, onError) {
2169
2512
  return useMutation({
2170
2513
  mutationKey: ["accounts", "bookmarks", "delete", username],
2171
2514
  mutationFn: async (bookmarkId) => {
2172
- if (!username) {
2173
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2515
+ if (!username || !code) {
2516
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2174
2517
  }
2175
2518
  const fetchApi = getBoundFetch();
2176
2519
  const response = await fetchApi(
@@ -2182,7 +2525,7 @@ function useBookmarkDelete(username, onSuccess, onError) {
2182
2525
  },
2183
2526
  body: JSON.stringify({
2184
2527
  id: bookmarkId,
2185
- code: getAccessToken(username)
2528
+ code
2186
2529
  })
2187
2530
  }
2188
2531
  );
@@ -2197,12 +2540,12 @@ function useBookmarkDelete(username, onSuccess, onError) {
2197
2540
  onError
2198
2541
  });
2199
2542
  }
2200
- function useAccountFavouriteAdd(username, onSuccess, onError) {
2543
+ function useAccountFavouriteAdd(username, code, onSuccess, onError) {
2201
2544
  return useMutation({
2202
2545
  mutationKey: ["accounts", "favourites", "add", username],
2203
2546
  mutationFn: async (account) => {
2204
- if (!username) {
2205
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2547
+ if (!username || !code) {
2548
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2206
2549
  }
2207
2550
  const fetchApi = getBoundFetch();
2208
2551
  const response = await fetchApi(
@@ -2214,7 +2557,7 @@ function useAccountFavouriteAdd(username, onSuccess, onError) {
2214
2557
  },
2215
2558
  body: JSON.stringify({
2216
2559
  account,
2217
- code: getAccessToken(username)
2560
+ code
2218
2561
  })
2219
2562
  }
2220
2563
  );
@@ -2229,12 +2572,12 @@ function useAccountFavouriteAdd(username, onSuccess, onError) {
2229
2572
  onError
2230
2573
  });
2231
2574
  }
2232
- function useAccountFavouriteDelete(username, onSuccess, onError) {
2575
+ function useAccountFavouriteDelete(username, code, onSuccess, onError) {
2233
2576
  return useMutation({
2234
2577
  mutationKey: ["accounts", "favourites", "add", username],
2235
2578
  mutationFn: async (account) => {
2236
- if (!username) {
2237
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2579
+ if (!username || !code) {
2580
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2238
2581
  }
2239
2582
  const fetchApi = getBoundFetch();
2240
2583
  const response = await fetchApi(
@@ -2246,7 +2589,7 @@ function useAccountFavouriteDelete(username, onSuccess, onError) {
2246
2589
  },
2247
2590
  body: JSON.stringify({
2248
2591
  account,
2249
- code: getAccessToken(username)
2592
+ code
2250
2593
  })
2251
2594
  }
2252
2595
  );
@@ -2404,7 +2747,7 @@ function useAccountRevokePosting(username, options) {
2404
2747
  }
2405
2748
  });
2406
2749
  }
2407
- function useAccountUpdateRecovery(username, options) {
2750
+ function useAccountUpdateRecovery(username, code, options) {
2408
2751
  const { data } = useQuery(getAccountFullQueryOptions(username));
2409
2752
  return useMutation({
2410
2753
  mutationKey: ["accounts", "recovery", data?.name],
@@ -2420,11 +2763,14 @@ function useAccountUpdateRecovery(username, options) {
2420
2763
  extensions: []
2421
2764
  };
2422
2765
  if (type === "ecency") {
2766
+ if (!code) {
2767
+ throw new Error("[SDK][Accounts] \u2013 missing access token");
2768
+ }
2423
2769
  const fetchApi = getBoundFetch();
2424
2770
  return fetchApi(CONFIG.privateApiHost + "/private-api/recoveries-add", {
2425
2771
  method: "POST",
2426
2772
  body: JSON.stringify({
2427
- code: getAccessToken(data.name),
2773
+ code,
2428
2774
  email,
2429
2775
  publicKeys: [
2430
2776
  ...data.owner.key_auths,
@@ -2493,6 +2839,152 @@ function useAccountRevokeKey(username, options) {
2493
2839
  ...options
2494
2840
  });
2495
2841
  }
2842
+
2843
+ // src/modules/accounts/utils/account-power.ts
2844
+ var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
2845
+ function vestsToRshares(vests, votingPowerValue, votePerc) {
2846
+ const vestingShares = vests * 1e6;
2847
+ const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
2848
+ return power * vestingShares / 1e4;
2849
+ }
2850
+ function toDhiveAccountForVotingMana(account) {
2851
+ return {
2852
+ id: 0,
2853
+ name: account.name,
2854
+ owner: account.owner,
2855
+ active: account.active,
2856
+ posting: account.posting,
2857
+ memo_key: account.memo_key,
2858
+ json_metadata: account.json_metadata,
2859
+ posting_json_metadata: account.posting_json_metadata,
2860
+ proxy: account.proxy ?? "",
2861
+ last_owner_update: "",
2862
+ last_account_update: "",
2863
+ created: account.created,
2864
+ mined: false,
2865
+ owner_challenged: false,
2866
+ active_challenged: false,
2867
+ last_owner_proved: "",
2868
+ last_active_proved: "",
2869
+ recovery_account: account.recovery_account ?? "",
2870
+ reset_account: "",
2871
+ last_account_recovery: "",
2872
+ comment_count: 0,
2873
+ lifetime_vote_count: 0,
2874
+ post_count: account.post_count,
2875
+ can_vote: true,
2876
+ voting_power: account.voting_power,
2877
+ last_vote_time: account.last_vote_time,
2878
+ voting_manabar: account.voting_manabar,
2879
+ balance: account.balance,
2880
+ savings_balance: account.savings_balance,
2881
+ hbd_balance: account.hbd_balance,
2882
+ hbd_seconds: "0",
2883
+ hbd_seconds_last_update: "",
2884
+ hbd_last_interest_payment: "",
2885
+ savings_hbd_balance: account.savings_hbd_balance,
2886
+ savings_hbd_seconds: account.savings_hbd_seconds,
2887
+ savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
2888
+ savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
2889
+ savings_withdraw_requests: 0,
2890
+ reward_hbd_balance: account.reward_hbd_balance,
2891
+ reward_hive_balance: account.reward_hive_balance,
2892
+ reward_vesting_balance: account.reward_vesting_balance,
2893
+ reward_vesting_hive: account.reward_vesting_hive,
2894
+ curation_rewards: 0,
2895
+ posting_rewards: 0,
2896
+ vesting_shares: account.vesting_shares,
2897
+ delegated_vesting_shares: account.delegated_vesting_shares,
2898
+ received_vesting_shares: account.received_vesting_shares,
2899
+ vesting_withdraw_rate: account.vesting_withdraw_rate,
2900
+ next_vesting_withdrawal: account.next_vesting_withdrawal,
2901
+ withdrawn: account.withdrawn,
2902
+ to_withdraw: account.to_withdraw,
2903
+ withdraw_routes: 0,
2904
+ proxied_vsf_votes: account.proxied_vsf_votes ?? [],
2905
+ witnesses_voted_for: 0,
2906
+ average_bandwidth: 0,
2907
+ lifetime_bandwidth: 0,
2908
+ last_bandwidth_update: "",
2909
+ average_market_bandwidth: 0,
2910
+ lifetime_market_bandwidth: 0,
2911
+ last_market_bandwidth_update: "",
2912
+ last_post: account.last_post,
2913
+ last_root_post: ""
2914
+ };
2915
+ }
2916
+ function votingPower(account) {
2917
+ const calc = CONFIG.hiveClient.rc.calculateVPMana(
2918
+ toDhiveAccountForVotingMana(account)
2919
+ );
2920
+ return calc.percentage / 100;
2921
+ }
2922
+ function powerRechargeTime(power) {
2923
+ if (!Number.isFinite(power)) {
2924
+ throw new TypeError("Voting power must be a finite number");
2925
+ }
2926
+ if (power < 0 || power > 100) {
2927
+ throw new RangeError("Voting power must be between 0 and 100");
2928
+ }
2929
+ const missingPower = 100 - power;
2930
+ return missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS / 1e4;
2931
+ }
2932
+ function downVotingPower(account) {
2933
+ const totalShares = parseFloat(account.vesting_shares) + parseFloat(account.received_vesting_shares) - parseFloat(account.delegated_vesting_shares);
2934
+ const elapsed = Math.floor(Date.now() / 1e3) - account.downvote_manabar.last_update_time;
2935
+ const maxMana = totalShares * 1e6 / 4;
2936
+ if (maxMana <= 0) {
2937
+ return 0;
2938
+ }
2939
+ let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
2940
+ if (currentMana > maxMana) {
2941
+ currentMana = maxMana;
2942
+ }
2943
+ const currentManaPerc = currentMana * 100 / maxMana;
2944
+ if (isNaN(currentManaPerc)) {
2945
+ return 0;
2946
+ }
2947
+ if (currentManaPerc > 100) {
2948
+ return 100;
2949
+ }
2950
+ return currentManaPerc;
2951
+ }
2952
+ function rcPower(account) {
2953
+ const calc = CONFIG.hiveClient.rc.calculateRCMana(account);
2954
+ return calc.percentage / 100;
2955
+ }
2956
+ function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
2957
+ if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {
2958
+ return 0;
2959
+ }
2960
+ const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;
2961
+ if (!Number.isFinite(fundRecentClaims) || !Number.isFinite(fundRewardBalance) || !Number.isFinite(base) || !Number.isFinite(quote)) {
2962
+ return 0;
2963
+ }
2964
+ if (fundRecentClaims === 0 || quote === 0) {
2965
+ return 0;
2966
+ }
2967
+ let totalVests = 0;
2968
+ try {
2969
+ const vesting = parseAsset(account.vesting_shares).amount;
2970
+ const received = parseAsset(account.received_vesting_shares).amount;
2971
+ const delegated = parseAsset(account.delegated_vesting_shares).amount;
2972
+ if (![vesting, received, delegated].every(Number.isFinite)) {
2973
+ return 0;
2974
+ }
2975
+ totalVests = vesting + received - delegated;
2976
+ } catch {
2977
+ return 0;
2978
+ }
2979
+ if (!Number.isFinite(totalVests)) {
2980
+ return 0;
2981
+ }
2982
+ const rShares = vestsToRshares(totalVests, votingPowerValue, weight);
2983
+ if (!Number.isFinite(rShares)) {
2984
+ return 0;
2985
+ }
2986
+ return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
2987
+ }
2496
2988
  function useSignOperationByKey(username) {
2497
2989
  return useMutation({
2498
2990
  mutationKey: ["operations", "sign", username],
@@ -2548,17 +3040,20 @@ function getChainPropertiesQueryOptions() {
2548
3040
  }
2549
3041
  });
2550
3042
  }
2551
- function useAddFragment(username) {
3043
+ function useAddFragment(username, code) {
2552
3044
  return useMutation({
2553
3045
  mutationKey: ["posts", "add-fragment", username],
2554
3046
  mutationFn: async ({ title, body }) => {
3047
+ if (!code) {
3048
+ throw new Error("[SDK][Posts] Missing access token");
3049
+ }
2555
3050
  const fetchApi = getBoundFetch();
2556
3051
  const response = await fetchApi(
2557
3052
  CONFIG.privateApiHost + "/private-api/fragments-add",
2558
3053
  {
2559
3054
  method: "POST",
2560
3055
  body: JSON.stringify({
2561
- code: getAccessToken(username),
3056
+ code,
2562
3057
  title,
2563
3058
  body
2564
3059
  }),
@@ -2571,23 +3066,26 @@ function useAddFragment(username) {
2571
3066
  },
2572
3067
  onSuccess(response) {
2573
3068
  getQueryClient().setQueryData(
2574
- getFragmentsQueryOptions(username).queryKey,
3069
+ getFragmentsQueryOptions(username, code).queryKey,
2575
3070
  (data) => [response, ...data ?? []]
2576
3071
  );
2577
3072
  }
2578
3073
  });
2579
3074
  }
2580
- function useEditFragment(username, fragmentId) {
3075
+ function useEditFragment(username, fragmentId, code) {
2581
3076
  return useMutation({
2582
3077
  mutationKey: ["posts", "edit-fragment", username, fragmentId],
2583
3078
  mutationFn: async ({ title, body }) => {
3079
+ if (!code) {
3080
+ throw new Error("[SDK][Posts] Missing access token");
3081
+ }
2584
3082
  const fetchApi = getBoundFetch();
2585
3083
  const response = await fetchApi(
2586
3084
  CONFIG.privateApiHost + "/private-api/fragments-update",
2587
3085
  {
2588
3086
  method: "POST",
2589
3087
  body: JSON.stringify({
2590
- code: getAccessToken(username),
3088
+ code,
2591
3089
  id: fragmentId,
2592
3090
  title,
2593
3091
  body
@@ -2601,7 +3099,7 @@ function useEditFragment(username, fragmentId) {
2601
3099
  },
2602
3100
  onSuccess(response) {
2603
3101
  getQueryClient().setQueryData(
2604
- getFragmentsQueryOptions(username).queryKey,
3102
+ getFragmentsQueryOptions(username, code).queryKey,
2605
3103
  (data) => {
2606
3104
  if (!data) {
2607
3105
  return [];
@@ -2616,15 +3114,18 @@ function useEditFragment(username, fragmentId) {
2616
3114
  }
2617
3115
  });
2618
3116
  }
2619
- function useRemoveFragment(username, fragmentId) {
3117
+ function useRemoveFragment(username, fragmentId, code) {
2620
3118
  return useMutation({
2621
3119
  mutationKey: ["posts", "remove-fragment", username],
2622
3120
  mutationFn: async () => {
3121
+ if (!code) {
3122
+ throw new Error("[SDK][Posts] Missing access token");
3123
+ }
2623
3124
  const fetchApi = getBoundFetch();
2624
3125
  return fetchApi(CONFIG.privateApiHost + "/private-api/fragments-delete", {
2625
3126
  method: "POST",
2626
3127
  body: JSON.stringify({
2627
- code: getAccessToken(username),
3128
+ code,
2628
3129
  id: fragmentId
2629
3130
  }),
2630
3131
  headers: {
@@ -2634,13 +3135,40 @@ function useRemoveFragment(username, fragmentId) {
2634
3135
  },
2635
3136
  onSuccess() {
2636
3137
  getQueryClient().setQueryData(
2637
- getFragmentsQueryOptions(username).queryKey,
3138
+ getFragmentsQueryOptions(username, code).queryKey,
2638
3139
  (data) => [...data ?? []].filter(({ id }) => id !== fragmentId)
2639
3140
  );
2640
3141
  }
2641
3142
  });
2642
3143
  }
2643
3144
 
3145
+ // src/modules/posts/utils/validate-post-creating.ts
3146
+ var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
3147
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3148
+ async function getContent(author, permlink) {
3149
+ return CONFIG.hiveClient.call("condenser_api", "get_content", [
3150
+ author,
3151
+ permlink
3152
+ ]);
3153
+ }
3154
+ async function validatePostCreating(author, permlink, attempts = 0, options) {
3155
+ const delays = options?.delays ?? DEFAULT_VALIDATE_POST_DELAYS;
3156
+ let response;
3157
+ try {
3158
+ response = await getContent(author, permlink);
3159
+ } catch (e) {
3160
+ response = void 0;
3161
+ }
3162
+ if (response || attempts >= delays.length) {
3163
+ return;
3164
+ }
3165
+ const waitMs = delays[attempts];
3166
+ if (waitMs > 0) {
3167
+ await delay(waitMs);
3168
+ }
3169
+ return validatePostCreating(author, permlink, attempts + 1, options);
3170
+ }
3171
+
2644
3172
  // src/modules/analytics/mutations/index.ts
2645
3173
  var mutations_exports = {};
2646
3174
  __export(mutations_exports, {
@@ -2753,11 +3281,10 @@ var queries_exports = {};
2753
3281
  __export(queries_exports, {
2754
3282
  getDecodeMemoQueryOptions: () => getDecodeMemoQueryOptions
2755
3283
  });
2756
- function getDecodeMemoQueryOptions(username, memo) {
3284
+ function getDecodeMemoQueryOptions(username, memo, accessToken) {
2757
3285
  return queryOptions({
2758
3286
  queryKey: ["integrations", "hivesigner", "decode-memo", username],
2759
3287
  queryFn: async () => {
2760
- const accessToken = getAccessToken(username);
2761
3288
  if (accessToken) {
2762
3289
  const hsClient = new hs.Client({
2763
3290
  accessToken
@@ -2774,12 +3301,12 @@ var HiveSignerIntegration = {
2774
3301
  };
2775
3302
 
2776
3303
  // src/modules/integrations/3speak/queries/get-account-token-query-options.ts
2777
- function getAccountTokenQueryOptions(username) {
3304
+ function getAccountTokenQueryOptions(username, accessToken) {
2778
3305
  return queryOptions({
2779
3306
  queryKey: ["integrations", "3speak", "authenticate", username],
2780
- enabled: !!username,
3307
+ enabled: !!username && !!accessToken,
2781
3308
  queryFn: async () => {
2782
- if (!username) {
3309
+ if (!username || !accessToken) {
2783
3310
  throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
2784
3311
  }
2785
3312
  const fetchApi = getBoundFetch();
@@ -2793,7 +3320,8 @@ function getAccountTokenQueryOptions(username) {
2793
3320
  );
2794
3321
  const memoQueryOptions = HiveSignerIntegration.queries.getDecodeMemoQueryOptions(
2795
3322
  username,
2796
- (await response.json()).memo
3323
+ (await response.json()).memo,
3324
+ accessToken
2797
3325
  );
2798
3326
  await getQueryClient().prefetchQuery(memoQueryOptions);
2799
3327
  const { memoDecoded } = getQueryClient().getQueryData(
@@ -2803,17 +3331,23 @@ function getAccountTokenQueryOptions(username) {
2803
3331
  }
2804
3332
  });
2805
3333
  }
2806
- function getAccountVideosQueryOptions(username) {
3334
+ function getAccountVideosQueryOptions(username, accessToken) {
2807
3335
  return queryOptions({
2808
3336
  queryKey: ["integrations", "3speak", "videos", username],
2809
- enabled: !!username,
3337
+ enabled: !!username && !!accessToken,
2810
3338
  queryFn: async () => {
2811
- await getQueryClient().prefetchQuery(
2812
- getAccountTokenQueryOptions(username)
2813
- );
2814
- const token = getQueryClient().getQueryData(
2815
- getAccountTokenQueryOptions(username).queryKey
3339
+ if (!username || !accessToken) {
3340
+ throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
3341
+ }
3342
+ const tokenQueryOptions = getAccountTokenQueryOptions(
3343
+ username,
3344
+ accessToken
2816
3345
  );
3346
+ await getQueryClient().prefetchQuery(tokenQueryOptions);
3347
+ const token = getQueryClient().getQueryData(tokenQueryOptions.queryKey);
3348
+ if (!token) {
3349
+ throw new Error("[SDK][Integrations][3Speak] \u2013 missing account token");
3350
+ }
2817
3351
  const fetchApi = getBoundFetch();
2818
3352
  const response = await fetchApi(
2819
3353
  `https://studio.3speak.tv/mobile/api/my-videos`,
@@ -2924,13 +3458,13 @@ function getAccountRcQueryOptions(username) {
2924
3458
  enabled: !!username
2925
3459
  });
2926
3460
  }
2927
- function getGameStatusCheckQueryOptions(username, gameType) {
3461
+ function getGameStatusCheckQueryOptions(username, code, gameType) {
2928
3462
  return queryOptions({
2929
3463
  queryKey: ["games", "status-check", gameType, username],
2930
- enabled: !!username,
3464
+ enabled: !!username && !!code,
2931
3465
  queryFn: async () => {
2932
- if (!username) {
2933
- throw new Error("[SDK][Games] \u2013 anon user in status check");
3466
+ if (!username || !code) {
3467
+ throw new Error("[SDK][Games] \u2013 missing auth");
2934
3468
  }
2935
3469
  const fetchApi = getBoundFetch();
2936
3470
  const response = await fetchApi(
@@ -2939,7 +3473,7 @@ function getGameStatusCheckQueryOptions(username, gameType) {
2939
3473
  method: "POST",
2940
3474
  body: JSON.stringify({
2941
3475
  game_type: gameType,
2942
- code: getAccessToken(username)
3476
+ code
2943
3477
  }),
2944
3478
  headers: {
2945
3479
  "Content-Type": "application/json"
@@ -2950,7 +3484,7 @@ function getGameStatusCheckQueryOptions(username, gameType) {
2950
3484
  }
2951
3485
  });
2952
3486
  }
2953
- function useGameClaim(username, gameType, key) {
3487
+ function useGameClaim(username, code, gameType, key) {
2954
3488
  const { mutateAsync: recordActivity } = useRecordActivity(
2955
3489
  username,
2956
3490
  "spin-rolled"
@@ -2958,8 +3492,8 @@ function useGameClaim(username, gameType, key) {
2958
3492
  return useMutation({
2959
3493
  mutationKey: ["games", "post", gameType, username],
2960
3494
  mutationFn: async () => {
2961
- if (!username) {
2962
- throw new Error("[SDK][Games] \u2013 anon user in game post");
3495
+ if (!username || !code) {
3496
+ throw new Error("[SDK][Games] \u2013 missing auth");
2963
3497
  }
2964
3498
  const fetchApi = getBoundFetch();
2965
3499
  const response = await fetchApi(
@@ -2968,7 +3502,7 @@ function useGameClaim(username, gameType, key) {
2968
3502
  method: "POST",
2969
3503
  body: JSON.stringify({
2970
3504
  game_type: gameType,
2971
- code: getAccessToken(username),
3505
+ code,
2972
3506
  key
2973
3507
  }),
2974
3508
  headers: {
@@ -3023,6 +3557,13 @@ function getCommunityContextQueryOptions(username, communityName) {
3023
3557
  }
3024
3558
  });
3025
3559
  }
3560
+ function getCommunityQueryOptions(name, observer = "", enabled = true) {
3561
+ return queryOptions({
3562
+ queryKey: ["community", "single", name, observer],
3563
+ enabled: enabled && !!name,
3564
+ queryFn: async () => getCommunity(name ?? "", observer)
3565
+ });
3566
+ }
3026
3567
  function getCommunitySubscribersQueryOptions(communityName) {
3027
3568
  return queryOptions({
3028
3569
  queryKey: ["communities", "subscribers", communityName],
@@ -3133,15 +3674,18 @@ function getCommunityPermissions({
3133
3674
  isModerator
3134
3675
  };
3135
3676
  }
3136
- function getNotificationsUnreadCountQueryOptions(activeUsername) {
3677
+ function getNotificationsUnreadCountQueryOptions(activeUsername, code) {
3137
3678
  return queryOptions({
3138
3679
  queryKey: ["notifications", "unread", activeUsername],
3139
3680
  queryFn: async () => {
3681
+ if (!code) {
3682
+ return 0;
3683
+ }
3140
3684
  const response = await fetch(
3141
3685
  `${CONFIG.privateApiHost}/private-api/notifications/unread`,
3142
3686
  {
3143
3687
  method: "POST",
3144
- body: JSON.stringify({ code: getAccessToken(activeUsername) }),
3688
+ body: JSON.stringify({ code }),
3145
3689
  headers: {
3146
3690
  "Content-Type": "application/json"
3147
3691
  }
@@ -3150,17 +3694,20 @@ function getNotificationsUnreadCountQueryOptions(activeUsername) {
3150
3694
  const data = await response.json();
3151
3695
  return data.count;
3152
3696
  },
3153
- enabled: !!activeUsername,
3697
+ enabled: !!activeUsername && !!code,
3154
3698
  initialData: 0,
3155
3699
  refetchInterval: 6e4
3156
3700
  });
3157
3701
  }
3158
- function getNotificationsInfiniteQueryOptions(activeUsername, filter = void 0) {
3702
+ function getNotificationsInfiniteQueryOptions(activeUsername, code, filter = void 0) {
3159
3703
  return infiniteQueryOptions({
3160
3704
  queryKey: ["notifications", activeUsername, filter],
3161
3705
  queryFn: async ({ pageParam }) => {
3706
+ if (!code) {
3707
+ return [];
3708
+ }
3162
3709
  const data = {
3163
- code: getAccessToken(activeUsername),
3710
+ code,
3164
3711
  filter,
3165
3712
  since: pageParam,
3166
3713
  user: void 0
@@ -3177,7 +3724,7 @@ function getNotificationsInfiniteQueryOptions(activeUsername, filter = void 0) {
3177
3724
  );
3178
3725
  return response.json();
3179
3726
  },
3180
- enabled: !!activeUsername,
3727
+ enabled: !!activeUsername && !!code,
3181
3728
  initialData: { pages: [], pageParams: [] },
3182
3729
  initialPageParam: "",
3183
3730
  getNextPageParam: (lastPage) => lastPage?.[lastPage.length - 1]?.id ?? "",
@@ -3230,16 +3777,19 @@ var NotificationViewType = /* @__PURE__ */ ((NotificationViewType2) => {
3230
3777
  })(NotificationViewType || {});
3231
3778
 
3232
3779
  // src/modules/notifications/queries/get-notifications-settings-query-options.ts
3233
- function getNotificationsSettingsQueryOptions(activeUsername) {
3780
+ function getNotificationsSettingsQueryOptions(activeUsername, code) {
3234
3781
  return queryOptions({
3235
3782
  queryKey: ["notifications", "settings", activeUsername],
3236
3783
  queryFn: async () => {
3237
3784
  let token = activeUsername + "-web";
3785
+ if (!code) {
3786
+ throw new Error("Missing access token");
3787
+ }
3238
3788
  const response = await fetch(
3239
3789
  CONFIG.privateApiHost + "/private-api/detail-device",
3240
3790
  {
3241
3791
  body: JSON.stringify({
3242
- code: getAccessToken(activeUsername),
3792
+ code,
3243
3793
  username: activeUsername,
3244
3794
  token
3245
3795
  }),
@@ -3254,7 +3804,7 @@ function getNotificationsSettingsQueryOptions(activeUsername) {
3254
3804
  }
3255
3805
  return response.json();
3256
3806
  },
3257
- enabled: !!activeUsername,
3807
+ enabled: !!activeUsername && !!code,
3258
3808
  refetchOnMount: false,
3259
3809
  initialData: () => {
3260
3810
  const wasMutedPreviously = typeof window !== "undefined" ? localStorage.getItem("notifications") !== "true" : false;
@@ -3456,6 +4006,25 @@ function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
3456
4006
  getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
3457
4007
  });
3458
4008
  }
4009
+ function getIncomingRcQueryOptions(username) {
4010
+ return queryOptions({
4011
+ queryKey: ["wallet", "incoming-rc", username],
4012
+ enabled: !!username,
4013
+ queryFn: async () => {
4014
+ if (!username) {
4015
+ throw new Error("[SDK][Wallet] - Missing username for incoming RC");
4016
+ }
4017
+ const fetchApi = getBoundFetch();
4018
+ const response = await fetchApi(
4019
+ `${CONFIG.privateApiHost}/private-api/received-rc/${username}`
4020
+ );
4021
+ if (!response.ok) {
4022
+ throw new Error(`Failed to fetch incoming RC: ${response.status}`);
4023
+ }
4024
+ return response.json();
4025
+ }
4026
+ });
4027
+ }
3459
4028
  function getReceivedVestingSharesQueryOptions(username) {
3460
4029
  return queryOptions({
3461
4030
  queryKey: ["wallet", "received-vesting-shares", username],
@@ -3500,15 +4069,15 @@ function getMarketStatisticsQueryOptions() {
3500
4069
  });
3501
4070
  }
3502
4071
  function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
3503
- const formatDate = (date) => {
4072
+ const formatDate2 = (date) => {
3504
4073
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3505
4074
  };
3506
4075
  return queryOptions({
3507
4076
  queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
3508
4077
  queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
3509
4078
  seconds,
3510
- formatDate(startDate),
3511
- formatDate(endDate)
4079
+ formatDate2(startDate),
4080
+ formatDate2(endDate)
3512
4081
  ])
3513
4082
  });
3514
4083
  }
@@ -3523,13 +4092,13 @@ function getHiveHbdStatsQueryOptions() {
3523
4092
  );
3524
4093
  const now = /* @__PURE__ */ new Date();
3525
4094
  const oneDayAgo = new Date(now.getTime() - 864e5);
3526
- const formatDate = (date) => {
4095
+ const formatDate2 = (date) => {
3527
4096
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3528
4097
  };
3529
4098
  const dayChange = await CONFIG.hiveClient.call(
3530
4099
  "condenser_api",
3531
4100
  "get_market_history",
3532
- [86400, formatDate(oneDayAgo), formatDate(now)]
4101
+ [86400, formatDate2(oneDayAgo), formatDate2(now)]
3533
4102
  );
3534
4103
  const result = {
3535
4104
  price: +stats.latest,
@@ -3548,8 +4117,9 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
3548
4117
  return queryOptions({
3549
4118
  queryKey: ["market", "data", coin, vsCurrency, fromTs, toTs],
3550
4119
  queryFn: async ({ signal }) => {
4120
+ const fetchApi = getBoundFetch();
3551
4121
  const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
3552
- const response = await fetch(url, { signal });
4122
+ const response = await fetchApi(url, { signal });
3553
4123
  if (!response.ok) {
3554
4124
  throw new Error(`Failed to fetch market data: ${response.status}`);
3555
4125
  }
@@ -3557,6 +4127,61 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
3557
4127
  }
3558
4128
  });
3559
4129
  }
4130
+ function formatDate(date) {
4131
+ return date.toISOString().replace(/\.\d{3}Z$/, "");
4132
+ }
4133
+ function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
4134
+ const end = endDate ?? /* @__PURE__ */ new Date();
4135
+ const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
4136
+ return queryOptions({
4137
+ queryKey: ["market", "trade-history", limit, start.getTime(), end.getTime()],
4138
+ queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_trade_history", [
4139
+ formatDate(start),
4140
+ formatDate(end),
4141
+ limit
4142
+ ])
4143
+ });
4144
+ }
4145
+
4146
+ // src/modules/market/requests.ts
4147
+ async function parseJsonResponse(response) {
4148
+ const data = await response.json();
4149
+ if (!response.ok) {
4150
+ const error = new Error(`Request failed with status ${response.status}`);
4151
+ error.status = response.status;
4152
+ error.data = data;
4153
+ throw error;
4154
+ }
4155
+ return data;
4156
+ }
4157
+ async function getMarketData(coin, vsCurrency, fromTs, toTs) {
4158
+ const fetchApi = getBoundFetch();
4159
+ const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
4160
+ const response = await fetchApi(url);
4161
+ return parseJsonResponse(response);
4162
+ }
4163
+ async function getCurrencyRate(cur) {
4164
+ if (cur === "hbd") {
4165
+ return 1;
4166
+ }
4167
+ const fetchApi = getBoundFetch();
4168
+ const url = `https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=${cur}`;
4169
+ const response = await fetchApi(url);
4170
+ const data = await parseJsonResponse(response);
4171
+ return data.hive_dollar[cur];
4172
+ }
4173
+ async function getCurrencyTokenRate(currency, token) {
4174
+ const fetchApi = getBoundFetch();
4175
+ const response = await fetchApi(
4176
+ CONFIG.privateApiHost + `/private-api/market-data/${currency === "hbd" ? "usd" : currency}/${token}`
4177
+ );
4178
+ return parseJsonResponse(response);
4179
+ }
4180
+ async function getCurrencyRates() {
4181
+ const fetchApi = getBoundFetch();
4182
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
4183
+ return parseJsonResponse(response);
4184
+ }
3560
4185
  function getPointsQueryOptions(username, filter = 0) {
3561
4186
  return queryOptions({
3562
4187
  queryKey: ["points", username, filter],
@@ -3827,6 +4452,89 @@ function getSearchPathQueryOptions(q) {
3827
4452
  }
3828
4453
  });
3829
4454
  }
4455
+
4456
+ // src/modules/search/requests.ts
4457
+ async function parseJsonResponse2(response) {
4458
+ const parseBody = async () => {
4459
+ try {
4460
+ return await response.json();
4461
+ } catch {
4462
+ try {
4463
+ return await response.text();
4464
+ } catch {
4465
+ return void 0;
4466
+ }
4467
+ }
4468
+ };
4469
+ const data = await parseBody();
4470
+ if (!response.ok) {
4471
+ const error = new Error(`Request failed with status ${response.status}`);
4472
+ error.status = response.status;
4473
+ error.data = data;
4474
+ throw error;
4475
+ }
4476
+ if (data === void 0) {
4477
+ throw new Error("Response body was empty or invalid JSON");
4478
+ }
4479
+ return data;
4480
+ }
4481
+ async function search(q, sort, hideLow, since, scroll_id, votes) {
4482
+ const data = { q, sort, hide_low: hideLow };
4483
+ if (since) {
4484
+ data.since = since;
4485
+ }
4486
+ if (scroll_id) {
4487
+ data.scroll_id = scroll_id;
4488
+ }
4489
+ if (votes) {
4490
+ data.votes = votes;
4491
+ }
4492
+ const fetchApi = getBoundFetch();
4493
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search", {
4494
+ method: "POST",
4495
+ headers: {
4496
+ "Content-Type": "application/json"
4497
+ },
4498
+ body: JSON.stringify(data)
4499
+ });
4500
+ return parseJsonResponse2(response);
4501
+ }
4502
+ async function searchAccount(q = "", limit = 20, random = 1) {
4503
+ const data = { q, limit, random };
4504
+ const fetchApi = getBoundFetch();
4505
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-account", {
4506
+ method: "POST",
4507
+ headers: {
4508
+ "Content-Type": "application/json"
4509
+ },
4510
+ body: JSON.stringify(data)
4511
+ });
4512
+ return parseJsonResponse2(response);
4513
+ }
4514
+ async function searchTag(q = "", limit = 20, random = 0) {
4515
+ const data = { q, limit, random };
4516
+ const fetchApi = getBoundFetch();
4517
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-tag", {
4518
+ method: "POST",
4519
+ headers: {
4520
+ "Content-Type": "application/json"
4521
+ },
4522
+ body: JSON.stringify(data)
4523
+ });
4524
+ return parseJsonResponse2(response);
4525
+ }
4526
+ async function searchPath(q) {
4527
+ const fetchApi = getBoundFetch();
4528
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-path", {
4529
+ method: "POST",
4530
+ headers: {
4531
+ "Content-Type": "application/json"
4532
+ },
4533
+ body: JSON.stringify({ q })
4534
+ });
4535
+ const data = await parseJsonResponse2(response);
4536
+ return data?.length > 0 ? data : [q];
4537
+ }
3830
4538
  function getBoostPlusPricesQueryOptions(accessToken) {
3831
4539
  return queryOptions({
3832
4540
  queryKey: ["promotions", "boost-plus-prices"],
@@ -3897,6 +4605,311 @@ function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
3897
4605
  });
3898
4606
  }
3899
4607
 
3900
- export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, keychain_exports as Keychain, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, encodeObj, extractAccountProfile, getAccessToken, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPostsInfiniteQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getActiveAccountBookmarksQueryOptions, getActiveAccountFavouritesQueryOptions, getAnnouncementsQueryOptions, getBoostPlusAccountPricesQueryOptions, getBoostPlusPricesQueryOptions, getBotsQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCollateralizedConversionRequestsQueryOptions, getCommentHistoryQueryOptions, getCommunitiesQueryOptions, getCommunityContextQueryOptions, getCommunityPermissions, getCommunitySubscribersQueryOptions, getCommunityType, getControversialRisingInfiniteQueryOptions, getConversionRequestsQueryOptions, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussionsQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFollowCountQueryOptions, getFollowingQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getImagesQueryOptions, getLoginType, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostingKey, getPostsRankedInfiniteQueryOptions, getPromotePriceQueryOptions, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRefreshToken, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getStatsQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUser, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, isCommunity, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, normalizeWaveEntryFromApi, parseAccounts, parseAsset, parseProfileMetadata, roleMap, searchQueryOptions, sortDiscussions, toEntryArray, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddFragment, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useEditFragment, useGameClaim, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain };
4608
+ // src/modules/private-api/requests.ts
4609
+ async function parseJsonResponse3(response) {
4610
+ if (!response.ok) {
4611
+ let errorData = void 0;
4612
+ try {
4613
+ errorData = await response.json();
4614
+ } catch {
4615
+ errorData = void 0;
4616
+ }
4617
+ const error = new Error(`Request failed with status ${response.status}`);
4618
+ error.status = response.status;
4619
+ error.data = errorData;
4620
+ throw error;
4621
+ }
4622
+ return await response.json();
4623
+ }
4624
+ async function signUp(username, email, referral) {
4625
+ const fetchApi = getBoundFetch();
4626
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/account-create", {
4627
+ method: "POST",
4628
+ headers: {
4629
+ "Content-Type": "application/json"
4630
+ },
4631
+ body: JSON.stringify({ username, email, referral })
4632
+ });
4633
+ const data = await parseJsonResponse3(response);
4634
+ return { status: response.status, data };
4635
+ }
4636
+ async function subscribeEmail(email) {
4637
+ const fetchApi = getBoundFetch();
4638
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/subscribe", {
4639
+ method: "POST",
4640
+ headers: {
4641
+ "Content-Type": "application/json"
4642
+ },
4643
+ body: JSON.stringify({ email })
4644
+ });
4645
+ const data = await parseJsonResponse3(response);
4646
+ return { status: response.status, data };
4647
+ }
4648
+ async function usrActivity(code, ty, bl = "", tx = "") {
4649
+ const params = { code, ty };
4650
+ if (bl) {
4651
+ params.bl = bl;
4652
+ }
4653
+ if (tx) {
4654
+ params.tx = tx;
4655
+ }
4656
+ const fetchApi = getBoundFetch();
4657
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/usr-activity", {
4658
+ method: "POST",
4659
+ headers: {
4660
+ "Content-Type": "application/json"
4661
+ },
4662
+ body: JSON.stringify(params)
4663
+ });
4664
+ await parseJsonResponse3(response);
4665
+ }
4666
+ async function getNotifications(code, filter, since = null, user = null) {
4667
+ const data = {
4668
+ code
4669
+ };
4670
+ if (filter) {
4671
+ data.filter = filter;
4672
+ }
4673
+ if (since) {
4674
+ data.since = since;
4675
+ }
4676
+ if (user) {
4677
+ data.user = user;
4678
+ }
4679
+ const fetchApi = getBoundFetch();
4680
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications", {
4681
+ method: "POST",
4682
+ headers: {
4683
+ "Content-Type": "application/json"
4684
+ },
4685
+ body: JSON.stringify(data)
4686
+ });
4687
+ return parseJsonResponse3(response);
4688
+ }
4689
+ async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
4690
+ const data = {
4691
+ code,
4692
+ username,
4693
+ token,
4694
+ system,
4695
+ allows_notify,
4696
+ notify_types
4697
+ };
4698
+ const fetchApi = getBoundFetch();
4699
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/register-device", {
4700
+ method: "POST",
4701
+ headers: {
4702
+ "Content-Type": "application/json"
4703
+ },
4704
+ body: JSON.stringify(data)
4705
+ });
4706
+ return parseJsonResponse3(response);
4707
+ }
4708
+ async function getNotificationSetting(code, username, token) {
4709
+ const data = { code, username, token };
4710
+ const fetchApi = getBoundFetch();
4711
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/detail-device", {
4712
+ method: "POST",
4713
+ headers: {
4714
+ "Content-Type": "application/json"
4715
+ },
4716
+ body: JSON.stringify(data)
4717
+ });
4718
+ return parseJsonResponse3(response);
4719
+ }
4720
+ async function markNotifications(code, id) {
4721
+ const data = {
4722
+ code
4723
+ };
4724
+ if (id) {
4725
+ data.id = id;
4726
+ }
4727
+ const fetchApi = getBoundFetch();
4728
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications/mark", {
4729
+ method: "POST",
4730
+ headers: {
4731
+ "Content-Type": "application/json"
4732
+ },
4733
+ body: JSON.stringify(data)
4734
+ });
4735
+ return parseJsonResponse3(response);
4736
+ }
4737
+ async function addImage(code, url) {
4738
+ const data = { code, url };
4739
+ const fetchApi = getBoundFetch();
4740
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-add", {
4741
+ method: "POST",
4742
+ headers: {
4743
+ "Content-Type": "application/json"
4744
+ },
4745
+ body: JSON.stringify(data)
4746
+ });
4747
+ return parseJsonResponse3(response);
4748
+ }
4749
+ async function uploadImage(file, token, signal) {
4750
+ const fetchApi = getBoundFetch();
4751
+ const formData = new FormData();
4752
+ formData.append("file", file);
4753
+ const response = await fetchApi(`${CONFIG.imageHost}/hs/${token}`, {
4754
+ method: "POST",
4755
+ body: formData,
4756
+ signal
4757
+ });
4758
+ return parseJsonResponse3(response);
4759
+ }
4760
+ async function deleteImage(code, imageId) {
4761
+ const data = { code, id: imageId };
4762
+ const fetchApi = getBoundFetch();
4763
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-delete", {
4764
+ method: "POST",
4765
+ headers: {
4766
+ "Content-Type": "application/json"
4767
+ },
4768
+ body: JSON.stringify(data)
4769
+ });
4770
+ return parseJsonResponse3(response);
4771
+ }
4772
+ async function addDraft(code, title, body, tags, meta) {
4773
+ const data = { code, title, body, tags, meta };
4774
+ const fetchApi = getBoundFetch();
4775
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-add", {
4776
+ method: "POST",
4777
+ headers: {
4778
+ "Content-Type": "application/json"
4779
+ },
4780
+ body: JSON.stringify(data)
4781
+ });
4782
+ return parseJsonResponse3(response);
4783
+ }
4784
+ async function updateDraft(code, draftId, title, body, tags, meta) {
4785
+ const data = { code, id: draftId, title, body, tags, meta };
4786
+ const fetchApi = getBoundFetch();
4787
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-update", {
4788
+ method: "POST",
4789
+ headers: {
4790
+ "Content-Type": "application/json"
4791
+ },
4792
+ body: JSON.stringify(data)
4793
+ });
4794
+ return parseJsonResponse3(response);
4795
+ }
4796
+ async function deleteDraft(code, draftId) {
4797
+ const data = { code, id: draftId };
4798
+ const fetchApi = getBoundFetch();
4799
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-delete", {
4800
+ method: "POST",
4801
+ headers: {
4802
+ "Content-Type": "application/json"
4803
+ },
4804
+ body: JSON.stringify(data)
4805
+ });
4806
+ return parseJsonResponse3(response);
4807
+ }
4808
+ async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
4809
+ const data = {
4810
+ code,
4811
+ permlink,
4812
+ title,
4813
+ body,
4814
+ meta,
4815
+ schedule,
4816
+ reblog
4817
+ };
4818
+ if (options) {
4819
+ data.options = options;
4820
+ }
4821
+ const fetchApi = getBoundFetch();
4822
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-add", {
4823
+ method: "POST",
4824
+ headers: {
4825
+ "Content-Type": "application/json"
4826
+ },
4827
+ body: JSON.stringify(data)
4828
+ });
4829
+ return parseJsonResponse3(response);
4830
+ }
4831
+ async function deleteSchedule(code, id) {
4832
+ const data = { code, id };
4833
+ const fetchApi = getBoundFetch();
4834
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-delete", {
4835
+ method: "POST",
4836
+ headers: {
4837
+ "Content-Type": "application/json"
4838
+ },
4839
+ body: JSON.stringify(data)
4840
+ });
4841
+ return parseJsonResponse3(response);
4842
+ }
4843
+ async function moveSchedule(code, id) {
4844
+ const data = { code, id };
4845
+ const fetchApi = getBoundFetch();
4846
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-move", {
4847
+ method: "POST",
4848
+ headers: {
4849
+ "Content-Type": "application/json"
4850
+ },
4851
+ body: JSON.stringify(data)
4852
+ });
4853
+ return parseJsonResponse3(response);
4854
+ }
4855
+ async function getPromotedPost(code, author, permlink) {
4856
+ const data = { code, author, permlink };
4857
+ const fetchApi = getBoundFetch();
4858
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/promoted-post", {
4859
+ method: "POST",
4860
+ headers: {
4861
+ "Content-Type": "application/json"
4862
+ },
4863
+ body: JSON.stringify(data)
4864
+ });
4865
+ return parseJsonResponse3(response);
4866
+ }
4867
+ async function onboardEmail(username, email, friend) {
4868
+ const dataBody = {
4869
+ username,
4870
+ email,
4871
+ friend
4872
+ };
4873
+ const fetchApi = getBoundFetch();
4874
+ const response = await fetchApi(
4875
+ CONFIG.privateApiHost + "/private-api/account-create-friend",
4876
+ {
4877
+ method: "POST",
4878
+ headers: {
4879
+ "Content-Type": "application/json"
4880
+ },
4881
+ body: JSON.stringify(dataBody)
4882
+ }
4883
+ );
4884
+ return parseJsonResponse3(response);
4885
+ }
4886
+
4887
+ // src/modules/auth/requests.ts
4888
+ async function hsTokenRenew(code) {
4889
+ const fetchApi = getBoundFetch();
4890
+ const response = await fetchApi(CONFIG.privateApiHost + "/auth-api/hs-token-refresh", {
4891
+ method: "POST",
4892
+ headers: {
4893
+ "Content-Type": "application/json"
4894
+ },
4895
+ body: JSON.stringify({ code })
4896
+ });
4897
+ if (!response.ok) {
4898
+ let data2 = void 0;
4899
+ try {
4900
+ data2 = await response.json();
4901
+ } catch {
4902
+ data2 = void 0;
4903
+ }
4904
+ const error = new Error(`Failed to refresh token: ${response.status}`);
4905
+ error.status = response.status;
4906
+ error.data = data2;
4907
+ throw error;
4908
+ }
4909
+ const data = await response.json();
4910
+ return data;
4911
+ }
4912
+
4913
+ export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, keychain_exports as Keychain, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, getAccessToken, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getActiveAccountBookmarksQueryOptions, getActiveAccountFavouritesQueryOptions, getAnnouncementsQueryOptions, getBoostPlusAccountPricesQueryOptions, getBoostPlusPricesQueryOptions, getBotsQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCollateralizedConversionRequestsQueryOptions, getCommentHistoryQueryOptions, getCommunities, getCommunitiesQueryOptions, getCommunity, getCommunityContextQueryOptions, getCommunityPermissions, getCommunityQueryOptions, getCommunitySubscribersQueryOptions, getCommunityType, getContentQueryOptions, getContentRepliesQueryOptions, getControversialRisingInfiniteQueryOptions, getConversionRequestsQueryOptions, getCurrencyRate, getCurrencyRates, getCurrencyTokenRate, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussion, getDiscussionQueryOptions, getDiscussionsQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFollowCountQueryOptions, getFollowingQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getLoginType, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostingKey, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRefreshToken, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUser, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseProfileMetadata, powerRechargeTime, rcPower, resolvePost, roleMap, saveNotificationSetting, search, searchAccount, searchPath, searchQueryOptions, searchTag, signUp, sortDiscussions, subscribeEmail, toEntryArray, updateDraft, uploadImage, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddFragment, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useEditFragment, useGameClaim, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, usrActivity, validatePostCreating, votingPower, votingValue };
3901
4914
  //# sourceMappingURL=index.js.map
3902
4915
  //# sourceMappingURL=index.js.map