@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.
@@ -34,6 +34,107 @@ var __export = (target, all) => {
34
34
  __defProp(target, name, { get: all[name], enumerable: true });
35
35
  };
36
36
 
37
+ // src/modules/keychain/keychain.ts
38
+ var keychain_exports = {};
39
+ __export(keychain_exports, {
40
+ broadcast: () => broadcast,
41
+ customJson: () => customJson,
42
+ handshake: () => handshake
43
+ });
44
+ function handshake() {
45
+ return new Promise((resolve) => {
46
+ window.hive_keychain?.requestHandshake(() => {
47
+ resolve();
48
+ });
49
+ });
50
+ }
51
+ var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
52
+ window.hive_keychain?.requestBroadcast(
53
+ account,
54
+ operations,
55
+ key,
56
+ (resp) => {
57
+ if (!resp.success) {
58
+ reject({ message: "Operation cancelled" });
59
+ }
60
+ resolve(resp);
61
+ },
62
+ rpc
63
+ );
64
+ });
65
+ var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
66
+ window.hive_keychain?.requestCustomJson(
67
+ account,
68
+ id,
69
+ key,
70
+ json,
71
+ display_msg,
72
+ (resp) => {
73
+ if (!resp.success) {
74
+ reject({ message: "Operation cancelled" });
75
+ }
76
+ resolve(resp);
77
+ },
78
+ rpc
79
+ );
80
+ });
81
+
82
+ // src/modules/core/mutations/use-broadcast-mutation.ts
83
+ function useBroadcastMutation(mutationKey = [], username, accessToken, operations, onSuccess = () => {
84
+ }, auth) {
85
+ return reactQuery.useMutation({
86
+ onSuccess,
87
+ mutationKey: [...mutationKey, username],
88
+ mutationFn: async (payload) => {
89
+ if (!username) {
90
+ throw new Error(
91
+ "[Core][Broadcast] Attempted to call broadcast API with anon user"
92
+ );
93
+ }
94
+ const postingKey = auth?.postingKey;
95
+ if (postingKey) {
96
+ const privateKey = dhive.PrivateKey.fromString(postingKey);
97
+ return CONFIG.hiveClient.broadcast.sendOperations(
98
+ operations(payload),
99
+ privateKey
100
+ );
101
+ }
102
+ const loginType = auth?.loginType;
103
+ if (loginType && loginType == "keychain") {
104
+ return keychain_exports.broadcast(
105
+ username,
106
+ operations(payload),
107
+ "Posting"
108
+ ).then((r) => r.result);
109
+ }
110
+ if (accessToken) {
111
+ const f = getBoundFetch();
112
+ const res = await f("https://hivesigner.com/api/broadcast", {
113
+ method: "POST",
114
+ headers: {
115
+ Authorization: accessToken,
116
+ "Content-Type": "application/json",
117
+ Accept: "application/json"
118
+ },
119
+ body: JSON.stringify({ operations: operations(payload) })
120
+ });
121
+ if (!res.ok) {
122
+ const txt = await res.text().catch(() => "");
123
+ throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
124
+ }
125
+ const json = await res.json();
126
+ if (json?.errors) {
127
+ throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
128
+ }
129
+ return json.result;
130
+ }
131
+ throw new Error(
132
+ "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
133
+ );
134
+ }
135
+ });
136
+ }
137
+
37
138
  // src/modules/core/mock-storage.ts
38
139
  var MockStorage = class {
39
140
  length = 0;
@@ -55,6 +156,7 @@ var MockStorage = class {
55
156
  };
56
157
  var CONFIG = {
57
158
  privateApiHost: "https://ecency.com",
159
+ imageHost: "https://images.ecency.com",
58
160
  storage: typeof window === "undefined" ? new MockStorage() : window.localStorage,
59
161
  storagePrefix: "ecency",
60
162
  hiveClient: new dhive.Client(
@@ -101,6 +203,10 @@ exports.ConfigManager = void 0;
101
203
  CONFIG.privateApiHost = host;
102
204
  }
103
205
  ConfigManager2.setPrivateApiHost = setPrivateApiHost;
206
+ function setImageHost(host) {
207
+ CONFIG.imageHost = host;
208
+ }
209
+ ConfigManager2.setImageHost = setImageHost;
104
210
  function analyzeRedosRisk(pattern) {
105
211
  if (/(\([^)]*[*+{][^)]*\))[*+{]/.test(pattern)) {
106
212
  return { safe: false, reason: "nested quantifiers detected" };
@@ -207,6 +313,40 @@ exports.ConfigManager = void 0;
207
313
  }
208
314
  ConfigManager2.setDmcaLists = setDmcaLists;
209
315
  })(exports.ConfigManager || (exports.ConfigManager = {}));
316
+ async function broadcastJson(username, id, payload, accessToken, auth) {
317
+ if (!username) {
318
+ throw new Error(
319
+ "[Core][Broadcast] Attempted to call broadcast API with anon user"
320
+ );
321
+ }
322
+ const jjson = {
323
+ id,
324
+ required_auths: [],
325
+ required_posting_auths: [username],
326
+ json: JSON.stringify(payload)
327
+ };
328
+ const postingKey = auth?.postingKey;
329
+ if (postingKey) {
330
+ const privateKey = dhive.PrivateKey.fromString(postingKey);
331
+ return CONFIG.hiveClient.broadcast.json(
332
+ jjson,
333
+ privateKey
334
+ );
335
+ }
336
+ const loginType = auth?.loginType;
337
+ if (loginType && loginType == "keychain") {
338
+ return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
339
+ }
340
+ if (accessToken) {
341
+ const response = await new hs__default.default.Client({
342
+ accessToken
343
+ }).customJson([], [username], id, JSON.stringify(payload));
344
+ return response.result;
345
+ }
346
+ throw new Error(
347
+ "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
348
+ );
349
+ }
210
350
 
211
351
  // src/modules/core/utils/decoder-encoder.ts
212
352
  function encodeObj(o) {
@@ -284,143 +424,6 @@ var getAccessToken = (username) => getUser(username) && getUser(username).access
284
424
  var getPostingKey = (username) => getUser(username) && getUser(username).postingKey;
285
425
  var getLoginType = (username) => getUser(username) && getUser(username).loginType;
286
426
  var getRefreshToken = (username) => getUser(username) && getUser(username).refreshToken;
287
-
288
- // src/modules/keychain/keychain.ts
289
- var keychain_exports = {};
290
- __export(keychain_exports, {
291
- broadcast: () => broadcast,
292
- customJson: () => customJson,
293
- handshake: () => handshake
294
- });
295
- function handshake() {
296
- return new Promise((resolve) => {
297
- window.hive_keychain?.requestHandshake(() => {
298
- resolve();
299
- });
300
- });
301
- }
302
- var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
303
- window.hive_keychain?.requestBroadcast(
304
- account,
305
- operations,
306
- key,
307
- (resp) => {
308
- if (!resp.success) {
309
- reject({ message: "Operation cancelled" });
310
- }
311
- resolve(resp);
312
- },
313
- rpc
314
- );
315
- });
316
- var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
317
- window.hive_keychain?.requestCustomJson(
318
- account,
319
- id,
320
- key,
321
- json,
322
- display_msg,
323
- (resp) => {
324
- if (!resp.success) {
325
- reject({ message: "Operation cancelled" });
326
- }
327
- resolve(resp);
328
- },
329
- rpc
330
- );
331
- });
332
-
333
- // src/modules/core/mutations/use-broadcast-mutation.ts
334
- function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
335
- }) {
336
- return reactQuery.useMutation({
337
- onSuccess,
338
- mutationKey: [...mutationKey, username],
339
- mutationFn: async (payload) => {
340
- if (!username) {
341
- throw new Error(
342
- "[Core][Broadcast] Attempted to call broadcast API with anon user"
343
- );
344
- }
345
- const postingKey = getPostingKey(username);
346
- if (postingKey) {
347
- const privateKey = dhive.PrivateKey.fromString(postingKey);
348
- return CONFIG.hiveClient.broadcast.sendOperations(
349
- operations(payload),
350
- privateKey
351
- );
352
- }
353
- const loginType = getLoginType(username);
354
- if (loginType && loginType == "keychain") {
355
- return keychain_exports.broadcast(
356
- username,
357
- operations(payload),
358
- "Posting"
359
- ).then((r) => r.result);
360
- }
361
- let token = getAccessToken(username);
362
- if (token) {
363
- const f = getBoundFetch();
364
- const res = await f("https://hivesigner.com/api/broadcast", {
365
- method: "POST",
366
- headers: {
367
- Authorization: token,
368
- "Content-Type": "application/json",
369
- Accept: "application/json"
370
- },
371
- body: JSON.stringify({ operations: operations(payload) })
372
- });
373
- if (!res.ok) {
374
- const txt = await res.text().catch(() => "");
375
- throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
376
- }
377
- const json = await res.json();
378
- if (json?.errors) {
379
- throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
380
- }
381
- return json.result;
382
- }
383
- throw new Error(
384
- "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
385
- );
386
- }
387
- });
388
- }
389
- async function broadcastJson(username, id, payload) {
390
- if (!username) {
391
- throw new Error(
392
- "[Core][Broadcast] Attempted to call broadcast API with anon user"
393
- );
394
- }
395
- const jjson = {
396
- id,
397
- required_auths: [],
398
- required_posting_auths: [username],
399
- json: JSON.stringify(payload)
400
- };
401
- const postingKey = getPostingKey(username);
402
- if (postingKey) {
403
- const privateKey = dhive.PrivateKey.fromString(postingKey);
404
- return CONFIG.hiveClient.broadcast.json(
405
- jjson,
406
- privateKey
407
- );
408
- }
409
- const loginType = getLoginType(username);
410
- if (loginType && loginType == "keychain") {
411
- return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
412
- }
413
- let token = getAccessToken(username);
414
- if (token) {
415
- const response = await new hs__default.default.Client({
416
- accessToken: token
417
- }).customJson([], [username], id, JSON.stringify(payload));
418
- return response.result;
419
- }
420
- throw new Error(
421
- "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
422
- );
423
- }
424
427
  function makeQueryClient() {
425
428
  return new reactQuery.QueryClient({
426
429
  defaultOptions: {
@@ -732,12 +735,14 @@ function parseAccounts(rawAccounts) {
732
735
  // src/modules/accounts/queries/get-accounts-query-options.ts
733
736
  function getAccountsQueryOptions(usernames) {
734
737
  return reactQuery.queryOptions({
735
- queryKey: ["accounts", "get-accounts", usernames],
738
+ queryKey: ["accounts", "list", ...usernames],
739
+ enabled: usernames.length > 0,
736
740
  queryFn: async () => {
737
- const response = await CONFIG.hiveClient.database.getAccounts(usernames);
741
+ const response = await CONFIG.hiveClient.database.getAccounts(
742
+ usernames
743
+ );
738
744
  return parseAccounts(response);
739
- },
740
- enabled: usernames.length > 0
745
+ }
741
746
  });
742
747
  }
743
748
  function getFollowCountQueryOptions(username) {
@@ -928,13 +933,13 @@ function getAccountSubscriptionsQueryOptions(username) {
928
933
  }
929
934
  });
930
935
  }
931
- function getActiveAccountBookmarksQueryOptions(activeUsername) {
936
+ function getActiveAccountBookmarksQueryOptions(activeUsername, code) {
932
937
  return reactQuery.queryOptions({
933
938
  queryKey: ["accounts", "bookmarks", activeUsername],
934
- enabled: !!activeUsername,
939
+ enabled: !!activeUsername && !!code,
935
940
  queryFn: async () => {
936
- if (!activeUsername) {
937
- throw new Error("[SDK][Accounts][Bookmarks] \u2013 no active user");
941
+ if (!activeUsername || !code) {
942
+ throw new Error("[SDK][Accounts][Bookmarks] \u2013 missing auth");
938
943
  }
939
944
  const fetchApi = getBoundFetch();
940
945
  const response = await fetchApi(
@@ -944,20 +949,20 @@ function getActiveAccountBookmarksQueryOptions(activeUsername) {
944
949
  headers: {
945
950
  "Content-Type": "application/json"
946
951
  },
947
- body: JSON.stringify({ code: getAccessToken(activeUsername) })
952
+ body: JSON.stringify({ code })
948
953
  }
949
954
  );
950
955
  return await response.json();
951
956
  }
952
957
  });
953
958
  }
954
- function getActiveAccountFavouritesQueryOptions(activeUsername) {
959
+ function getActiveAccountFavouritesQueryOptions(activeUsername, code) {
955
960
  return reactQuery.queryOptions({
956
961
  queryKey: ["accounts", "favourites", activeUsername],
957
- enabled: !!activeUsername,
962
+ enabled: !!activeUsername && !!code,
958
963
  queryFn: async () => {
959
- if (!activeUsername) {
960
- throw new Error("[SDK][Accounts][Favourites] \u2013 no active user");
964
+ if (!activeUsername || !code) {
965
+ throw new Error("[SDK][Accounts][Favourites] \u2013 missing auth");
961
966
  }
962
967
  const fetchApi = getBoundFetch();
963
968
  const response = await fetchApi(
@@ -967,18 +972,21 @@ function getActiveAccountFavouritesQueryOptions(activeUsername) {
967
972
  headers: {
968
973
  "Content-Type": "application/json"
969
974
  },
970
- body: JSON.stringify({ code: getAccessToken(activeUsername) })
975
+ body: JSON.stringify({ code })
971
976
  }
972
977
  );
973
978
  return await response.json();
974
979
  }
975
980
  });
976
981
  }
977
- function getAccountRecoveriesQueryOptions(username) {
982
+ function getAccountRecoveriesQueryOptions(username, code) {
978
983
  return reactQuery.queryOptions({
979
- enabled: !!username,
984
+ enabled: !!username && !!code,
980
985
  queryKey: ["accounts", "recoveries", username],
981
986
  queryFn: async () => {
987
+ if (!username || !code) {
988
+ throw new Error("[SDK][Accounts] Missing username or access token");
989
+ }
982
990
  const fetchApi = getBoundFetch();
983
991
  const response = await fetchApi(
984
992
  CONFIG.privateApiHost + "/private-api/recoveries",
@@ -987,7 +995,7 @@ function getAccountRecoveriesQueryOptions(username) {
987
995
  headers: {
988
996
  "Content-Type": "application/json"
989
997
  },
990
- body: JSON.stringify({ code: getAccessToken(username) })
998
+ body: JSON.stringify({ code })
991
999
  }
992
1000
  );
993
1001
  return response.json();
@@ -1005,6 +1013,22 @@ function getAccountPendingRecoveryQueryOptions(username) {
1005
1013
  )
1006
1014
  });
1007
1015
  }
1016
+ function getAccountReputationsQueryOptions(query, limit = 50) {
1017
+ return reactQuery.queryOptions({
1018
+ queryKey: ["accounts", "reputations", query, limit],
1019
+ enabled: !!query,
1020
+ queryFn: async () => {
1021
+ if (!query) {
1022
+ return [];
1023
+ }
1024
+ return CONFIG.hiveClient.call(
1025
+ "condenser_api",
1026
+ "get_account_reputations",
1027
+ [query, limit]
1028
+ );
1029
+ }
1030
+ });
1031
+ }
1008
1032
  var ops = dhive.utils.operationOrders;
1009
1033
  var ACCOUNT_OPERATION_GROUPS = {
1010
1034
  transfers: [
@@ -1262,17 +1286,20 @@ function getTrendingTagsWithStatsQueryOptions(limit = 250) {
1262
1286
  refetchOnMount: true
1263
1287
  });
1264
1288
  }
1265
- function getFragmentsQueryOptions(username) {
1289
+ function getFragmentsQueryOptions(username, code) {
1266
1290
  return reactQuery.queryOptions({
1267
1291
  queryKey: ["posts", "fragments", username],
1268
1292
  queryFn: async () => {
1293
+ if (!code) {
1294
+ return [];
1295
+ }
1269
1296
  const fetchApi = getBoundFetch();
1270
1297
  const response = await fetchApi(
1271
1298
  CONFIG.privateApiHost + "/private-api/fragments",
1272
1299
  {
1273
1300
  method: "POST",
1274
1301
  body: JSON.stringify({
1275
- code: getAccessToken(username)
1302
+ code
1276
1303
  }),
1277
1304
  headers: {
1278
1305
  "Content-Type": "application/json"
@@ -1281,7 +1308,7 @@ function getFragmentsQueryOptions(username) {
1281
1308
  );
1282
1309
  return response.json();
1283
1310
  },
1284
- enabled: !!username
1311
+ enabled: !!username && !!code
1285
1312
  });
1286
1313
  }
1287
1314
  function getPromotedPostsQuery(type = "feed") {
@@ -1318,6 +1345,26 @@ function getEntryActiveVotesQueryOptions(entry) {
1318
1345
  enabled: !!entry
1319
1346
  });
1320
1347
  }
1348
+ function getContentQueryOptions(author, permlink) {
1349
+ return reactQuery.queryOptions({
1350
+ queryKey: ["posts", "content", author, permlink],
1351
+ enabled: !!author && !!permlink,
1352
+ queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content", [
1353
+ author,
1354
+ permlink
1355
+ ])
1356
+ });
1357
+ }
1358
+ function getContentRepliesQueryOptions(author, permlink) {
1359
+ return reactQuery.queryOptions({
1360
+ queryKey: ["posts", "content-replies", author, permlink],
1361
+ enabled: !!author && !!permlink,
1362
+ queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content_replies", {
1363
+ author,
1364
+ permlink
1365
+ })
1366
+ });
1367
+ }
1321
1368
  function getPostHeaderQueryOptions(author, permlink) {
1322
1369
  return reactQuery.queryOptions({
1323
1370
  queryKey: ["posts", "post-header", author, permlink],
@@ -1379,6 +1426,212 @@ function getPostQueryOptions(author, permlink, observer = "", num) {
1379
1426
  enabled: !!author && !!permlink && permlink.trim() !== "" && permlink.trim() !== "undefined"
1380
1427
  });
1381
1428
  }
1429
+
1430
+ // src/modules/bridge/requests.ts
1431
+ function bridgeApiCall(endpoint, params) {
1432
+ return CONFIG.hiveClient.call("bridge", endpoint, params);
1433
+ }
1434
+ async function resolvePost(post, observer, num) {
1435
+ const { json_metadata: json } = post;
1436
+ if (json?.original_author && json?.original_permlink && json.tags?.[0] === "cross-post") {
1437
+ try {
1438
+ const resp = await getPost(
1439
+ json.original_author,
1440
+ json.original_permlink,
1441
+ observer,
1442
+ num
1443
+ );
1444
+ if (resp) {
1445
+ return {
1446
+ ...post,
1447
+ original_entry: resp,
1448
+ num
1449
+ };
1450
+ }
1451
+ return post;
1452
+ } catch {
1453
+ return post;
1454
+ }
1455
+ }
1456
+ return { ...post, num };
1457
+ }
1458
+ async function resolvePosts(posts, observer) {
1459
+ const validatedPosts = posts.map(validateEntry);
1460
+ const resolved = await Promise.all(validatedPosts.map((p) => resolvePost(p, observer)));
1461
+ return filterDmcaEntry(resolved);
1462
+ }
1463
+ async function getPostsRanked(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "") {
1464
+ const resp = await bridgeApiCall("get_ranked_posts", {
1465
+ sort,
1466
+ start_author,
1467
+ start_permlink,
1468
+ limit,
1469
+ tag,
1470
+ observer
1471
+ });
1472
+ if (resp) {
1473
+ return resolvePosts(resp, observer);
1474
+ }
1475
+ return resp;
1476
+ }
1477
+ async function getAccountPosts(sort, account, start_author = "", start_permlink = "", limit = 20, observer = "") {
1478
+ if (CONFIG.dmcaAccounts.includes(account)) {
1479
+ return [];
1480
+ }
1481
+ const resp = await bridgeApiCall("get_account_posts", {
1482
+ sort,
1483
+ account,
1484
+ start_author,
1485
+ start_permlink,
1486
+ limit,
1487
+ observer
1488
+ });
1489
+ if (resp) {
1490
+ return resolvePosts(resp, observer);
1491
+ }
1492
+ return resp;
1493
+ }
1494
+ function validateEntry(entry) {
1495
+ const newEntry = {
1496
+ ...entry,
1497
+ active_votes: Array.isArray(entry.active_votes) ? [...entry.active_votes] : [],
1498
+ beneficiaries: Array.isArray(entry.beneficiaries) ? [...entry.beneficiaries] : [],
1499
+ blacklists: Array.isArray(entry.blacklists) ? [...entry.blacklists] : [],
1500
+ replies: Array.isArray(entry.replies) ? [...entry.replies] : [],
1501
+ stats: entry.stats ? { ...entry.stats } : null
1502
+ };
1503
+ const requiredStringProps = [
1504
+ "author",
1505
+ "title",
1506
+ "body",
1507
+ "created",
1508
+ "category",
1509
+ "permlink",
1510
+ "url",
1511
+ "updated"
1512
+ ];
1513
+ for (const prop of requiredStringProps) {
1514
+ if (newEntry[prop] == null) {
1515
+ newEntry[prop] = "";
1516
+ }
1517
+ }
1518
+ if (newEntry.author_reputation == null) {
1519
+ newEntry.author_reputation = 0;
1520
+ }
1521
+ if (newEntry.children == null) {
1522
+ newEntry.children = 0;
1523
+ }
1524
+ if (newEntry.depth == null) {
1525
+ newEntry.depth = 0;
1526
+ }
1527
+ if (newEntry.net_rshares == null) {
1528
+ newEntry.net_rshares = 0;
1529
+ }
1530
+ if (newEntry.payout == null) {
1531
+ newEntry.payout = 0;
1532
+ }
1533
+ if (newEntry.percent_hbd == null) {
1534
+ newEntry.percent_hbd = 0;
1535
+ }
1536
+ if (!newEntry.stats) {
1537
+ newEntry.stats = {
1538
+ flag_weight: 0,
1539
+ gray: false,
1540
+ hide: false,
1541
+ total_votes: 0
1542
+ };
1543
+ }
1544
+ if (newEntry.author_payout_value == null) {
1545
+ newEntry.author_payout_value = "0.000 HBD";
1546
+ }
1547
+ if (newEntry.curator_payout_value == null) {
1548
+ newEntry.curator_payout_value = "0.000 HBD";
1549
+ }
1550
+ if (newEntry.max_accepted_payout == null) {
1551
+ newEntry.max_accepted_payout = "1000000.000 HBD";
1552
+ }
1553
+ if (newEntry.payout_at == null) {
1554
+ newEntry.payout_at = "";
1555
+ }
1556
+ if (newEntry.pending_payout_value == null) {
1557
+ newEntry.pending_payout_value = "0.000 HBD";
1558
+ }
1559
+ if (newEntry.promoted == null) {
1560
+ newEntry.promoted = "0.000 HBD";
1561
+ }
1562
+ if (newEntry.is_paidout == null) {
1563
+ newEntry.is_paidout = false;
1564
+ }
1565
+ return newEntry;
1566
+ }
1567
+ async function getPost(author = "", permlink = "", observer = "", num) {
1568
+ const resp = await bridgeApiCall("get_post", {
1569
+ author,
1570
+ permlink,
1571
+ observer
1572
+ });
1573
+ if (resp) {
1574
+ const validatedEntry = validateEntry(resp);
1575
+ const post = await resolvePost(validatedEntry, observer, num);
1576
+ return filterDmcaEntry(post);
1577
+ }
1578
+ return void 0;
1579
+ }
1580
+ async function getPostHeader(author = "", permlink = "") {
1581
+ const resp = await bridgeApiCall("get_post_header", {
1582
+ author,
1583
+ permlink
1584
+ });
1585
+ return resp ? validateEntry(resp) : resp;
1586
+ }
1587
+ async function getDiscussion(author, permlink, observer) {
1588
+ const resp = await bridgeApiCall("get_discussion", {
1589
+ author,
1590
+ permlink,
1591
+ observer: observer || author
1592
+ });
1593
+ if (resp) {
1594
+ const validatedResp = {};
1595
+ for (const [key, entry] of Object.entries(resp)) {
1596
+ validatedResp[key] = validateEntry(entry);
1597
+ }
1598
+ return validatedResp;
1599
+ }
1600
+ return resp;
1601
+ }
1602
+ async function getCommunity(name, observer = "") {
1603
+ return bridgeApiCall("get_community", { name, observer });
1604
+ }
1605
+ async function getCommunities(last = "", limit = 100, query, sort = "rank", observer = "") {
1606
+ return bridgeApiCall("list_communities", {
1607
+ last,
1608
+ limit,
1609
+ query,
1610
+ sort,
1611
+ observer
1612
+ });
1613
+ }
1614
+ async function normalizePost(post) {
1615
+ const resp = await bridgeApiCall("normalize_post", { post });
1616
+ return resp ? validateEntry(resp) : resp;
1617
+ }
1618
+ async function getSubscriptions(account) {
1619
+ return bridgeApiCall("list_all_subscriptions", { account });
1620
+ }
1621
+ async function getSubscribers(community) {
1622
+ return bridgeApiCall("list_subscribers", { community });
1623
+ }
1624
+ async function getRelationshipBetweenAccounts(follower, following) {
1625
+ return bridgeApiCall("get_relationship_between_accounts", [
1626
+ follower,
1627
+ following
1628
+ ]);
1629
+ }
1630
+ async function getProfiles(accounts, observer) {
1631
+ return bridgeApiCall("get_profiles", { accounts, observer });
1632
+ }
1633
+
1634
+ // src/modules/posts/queries/get-discussions-query-options.ts
1382
1635
  var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
1383
1636
  SortOrder2["trending"] = "trending";
1384
1637
  SortOrder2["author_reputation"] = "author_reputation";
@@ -1476,6 +1729,13 @@ function getDiscussionsQueryOptions(entry, order = "created" /* created */, enab
1476
1729
  select: (data) => sortDiscussions(entry, data, order)
1477
1730
  });
1478
1731
  }
1732
+ function getDiscussionQueryOptions(author, permlink, observer, enabled = true) {
1733
+ return reactQuery.queryOptions({
1734
+ queryKey: ["posts", "discussion", author, permlink, observer || author],
1735
+ enabled: enabled && !!author && !!permlink,
1736
+ queryFn: async () => getDiscussion(author, permlink, observer)
1737
+ });
1738
+ }
1479
1739
  function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit = 20, observer = "", enabled = true) {
1480
1740
  return reactQuery.infiniteQueryOptions({
1481
1741
  queryKey: ["posts", "account-posts", username ?? "", filter, limit, observer],
@@ -1525,6 +1785,35 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
1525
1785
  }
1526
1786
  });
1527
1787
  }
1788
+ function getAccountPostsQueryOptions(username, filter = "posts", start_author = "", start_permlink = "", limit = 20, observer = "", enabled = true) {
1789
+ return reactQuery.queryOptions({
1790
+ queryKey: [
1791
+ "posts",
1792
+ "account-posts-page",
1793
+ username ?? "",
1794
+ filter,
1795
+ start_author,
1796
+ start_permlink,
1797
+ limit,
1798
+ observer
1799
+ ],
1800
+ enabled: !!username && enabled,
1801
+ queryFn: async () => {
1802
+ if (!username) {
1803
+ return [];
1804
+ }
1805
+ const response = await getAccountPosts(
1806
+ filter,
1807
+ username,
1808
+ start_author,
1809
+ start_permlink,
1810
+ limit,
1811
+ observer
1812
+ );
1813
+ return filterDmcaEntry(response ?? []);
1814
+ }
1815
+ });
1816
+ }
1528
1817
  function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = "", enabled = true, _options = {}) {
1529
1818
  return reactQuery.infiniteQueryOptions({
1530
1819
  queryKey: ["posts", "posts-ranked", sort, tag, limit, observer],
@@ -1572,6 +1861,36 @@ function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = ""
1572
1861
  }
1573
1862
  });
1574
1863
  }
1864
+ function getPostsRankedQueryOptions(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "", enabled = true) {
1865
+ return reactQuery.queryOptions({
1866
+ queryKey: [
1867
+ "posts",
1868
+ "posts-ranked-page",
1869
+ sort,
1870
+ start_author,
1871
+ start_permlink,
1872
+ limit,
1873
+ tag,
1874
+ observer
1875
+ ],
1876
+ enabled,
1877
+ queryFn: async () => {
1878
+ let sanitizedTag = tag;
1879
+ if (CONFIG.dmcaTagRegexes.some((regex) => regex.test(tag))) {
1880
+ sanitizedTag = "";
1881
+ }
1882
+ const response = await getPostsRanked(
1883
+ sort,
1884
+ start_author,
1885
+ start_permlink,
1886
+ limit,
1887
+ sanitizedTag,
1888
+ observer
1889
+ );
1890
+ return filterDmcaEntry(response ?? []);
1891
+ }
1892
+ });
1893
+ }
1575
1894
  function getReblogsQueryOptions(username, activeUsername, limit = 200) {
1576
1895
  return reactQuery.queryOptions({
1577
1896
  queryKey: ["posts", "reblogs", username ?? "", limit],
@@ -1588,20 +1907,21 @@ function getReblogsQueryOptions(username, activeUsername, limit = 200) {
1588
1907
  enabled: !!username
1589
1908
  });
1590
1909
  }
1591
- function getSchedulesQueryOptions(activeUsername) {
1910
+ function getSchedulesQueryOptions(activeUsername, code) {
1592
1911
  return reactQuery.queryOptions({
1593
1912
  queryKey: ["posts", "schedules", activeUsername],
1594
1913
  queryFn: async () => {
1595
- if (!activeUsername) {
1914
+ if (!activeUsername || !code) {
1596
1915
  return [];
1597
1916
  }
1598
- const response = await fetch(CONFIG.privateApiHost + "/private-api/schedules", {
1917
+ const fetchApi = getBoundFetch();
1918
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules", {
1599
1919
  method: "POST",
1600
1920
  headers: {
1601
1921
  "Content-Type": "application/json"
1602
1922
  },
1603
1923
  body: JSON.stringify({
1604
- code: getAccessToken(activeUsername)
1924
+ code
1605
1925
  })
1606
1926
  });
1607
1927
  if (!response.ok) {
@@ -1609,23 +1929,24 @@ function getSchedulesQueryOptions(activeUsername) {
1609
1929
  }
1610
1930
  return response.json();
1611
1931
  },
1612
- enabled: !!activeUsername
1932
+ enabled: !!activeUsername && !!code
1613
1933
  });
1614
1934
  }
1615
- function getDraftsQueryOptions(activeUsername) {
1935
+ function getDraftsQueryOptions(activeUsername, code) {
1616
1936
  return reactQuery.queryOptions({
1617
1937
  queryKey: ["posts", "drafts", activeUsername],
1618
1938
  queryFn: async () => {
1619
- if (!activeUsername) {
1939
+ if (!activeUsername || !code) {
1620
1940
  return [];
1621
1941
  }
1622
- const response = await fetch(CONFIG.privateApiHost + "/private-api/drafts", {
1942
+ const fetchApi = getBoundFetch();
1943
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts", {
1623
1944
  method: "POST",
1624
1945
  headers: {
1625
1946
  "Content-Type": "application/json"
1626
1947
  },
1627
1948
  body: JSON.stringify({
1628
- code: getAccessToken(activeUsername)
1949
+ code
1629
1950
  })
1630
1951
  });
1631
1952
  if (!response.ok) {
@@ -1633,17 +1954,18 @@ function getDraftsQueryOptions(activeUsername) {
1633
1954
  }
1634
1955
  return response.json();
1635
1956
  },
1636
- enabled: !!activeUsername
1957
+ enabled: !!activeUsername && !!code
1637
1958
  });
1638
1959
  }
1639
- async function fetchUserImages(username) {
1640
- const response = await fetch(CONFIG.privateApiHost + "/private-api/images", {
1960
+ async function fetchUserImages(code) {
1961
+ const fetchApi = getBoundFetch();
1962
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images", {
1641
1963
  method: "POST",
1642
1964
  headers: {
1643
1965
  "Content-Type": "application/json"
1644
1966
  },
1645
1967
  body: JSON.stringify({
1646
- code: getAccessToken(username)
1968
+ code
1647
1969
  })
1648
1970
  });
1649
1971
  if (!response.ok) {
@@ -1651,28 +1973,28 @@ async function fetchUserImages(username) {
1651
1973
  }
1652
1974
  return response.json();
1653
1975
  }
1654
- function getImagesQueryOptions(username) {
1976
+ function getImagesQueryOptions(username, code) {
1655
1977
  return reactQuery.queryOptions({
1656
1978
  queryKey: ["posts", "images", username],
1657
1979
  queryFn: async () => {
1658
- if (!username) {
1980
+ if (!username || !code) {
1659
1981
  return [];
1660
1982
  }
1661
- return fetchUserImages(username);
1983
+ return fetchUserImages(code);
1662
1984
  },
1663
- enabled: !!username
1985
+ enabled: !!username && !!code
1664
1986
  });
1665
1987
  }
1666
- function getGalleryImagesQueryOptions(activeUsername) {
1988
+ function getGalleryImagesQueryOptions(activeUsername, code) {
1667
1989
  return reactQuery.queryOptions({
1668
1990
  queryKey: ["posts", "gallery-images", activeUsername],
1669
1991
  queryFn: async () => {
1670
- if (!activeUsername) {
1992
+ if (!activeUsername || !code) {
1671
1993
  return [];
1672
1994
  }
1673
- return fetchUserImages(activeUsername);
1995
+ return fetchUserImages(code);
1674
1996
  },
1675
- enabled: !!activeUsername
1997
+ enabled: !!activeUsername && !!code
1676
1998
  });
1677
1999
  }
1678
2000
  function getCommentHistoryQueryOptions(author, permlink, onlyMeta = false) {
@@ -1806,8 +2128,8 @@ function toEntryArray(x) {
1806
2128
  return Array.isArray(x) ? x : [];
1807
2129
  }
1808
2130
  async function getVisibleFirstLevelThreadItems(container) {
1809
- const queryOptions76 = getDiscussionsQueryOptions(container, "created" /* created */, true);
1810
- const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions76);
2131
+ const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
2132
+ const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
1811
2133
  const discussionItems = toEntryArray(discussionItemsRaw);
1812
2134
  if (discussionItems.length <= 1) {
1813
2135
  return [];
@@ -2016,6 +2338,18 @@ function getWavesTrendingTagsQueryOptions(host, hours = 24) {
2016
2338
  }
2017
2339
  });
2018
2340
  }
2341
+ function getNormalizePostQueryOptions(post, enabled = true) {
2342
+ return reactQuery.queryOptions({
2343
+ queryKey: [
2344
+ "posts",
2345
+ "normalize",
2346
+ post?.author ?? "",
2347
+ post?.permlink ?? ""
2348
+ ],
2349
+ enabled: enabled && !!post,
2350
+ queryFn: async () => normalizePost(post)
2351
+ });
2352
+ }
2019
2353
 
2020
2354
  // src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts
2021
2355
  function isEntry(x) {
@@ -2066,14 +2400,22 @@ function getAccountVoteHistoryInfiniteQueryOptions(username, options) {
2066
2400
  })
2067
2401
  });
2068
2402
  }
2403
+ function getProfilesQueryOptions(accounts, observer, enabled = true) {
2404
+ return reactQuery.queryOptions({
2405
+ queryKey: ["accounts", "profiles", accounts, observer ?? ""],
2406
+ enabled: enabled && accounts.length > 0,
2407
+ queryFn: async () => getProfiles(accounts, observer)
2408
+ });
2409
+ }
2069
2410
 
2070
2411
  // src/modules/accounts/mutations/use-account-update.ts
2071
- function useAccountUpdate(username) {
2412
+ function useAccountUpdate(username, accessToken, auth) {
2072
2413
  const queryClient = reactQuery.useQueryClient();
2073
2414
  const { data } = reactQuery.useQuery(getAccountFullQueryOptions(username));
2074
2415
  return useBroadcastMutation(
2075
2416
  ["accounts", "update"],
2076
2417
  username,
2418
+ accessToken,
2077
2419
  (payload) => {
2078
2420
  if (!data) {
2079
2421
  throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
@@ -2097,7 +2439,7 @@ function useAccountUpdate(username) {
2097
2439
  ]
2098
2440
  ];
2099
2441
  },
2100
- (_, variables) => queryClient.setQueryData(
2442
+ (_data, variables) => queryClient.setQueryData(
2101
2443
  getAccountFullQueryOptions(username).queryKey,
2102
2444
  (data2) => {
2103
2445
  if (!data2) {
@@ -2111,7 +2453,8 @@ function useAccountUpdate(username) {
2111
2453
  });
2112
2454
  return obj;
2113
2455
  }
2114
- )
2456
+ ),
2457
+ auth
2115
2458
  );
2116
2459
  }
2117
2460
  function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
@@ -2153,12 +2496,12 @@ function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
2153
2496
  }
2154
2497
  });
2155
2498
  }
2156
- function useBookmarkAdd(username, onSuccess, onError) {
2499
+ function useBookmarkAdd(username, code, onSuccess, onError) {
2157
2500
  return reactQuery.useMutation({
2158
2501
  mutationKey: ["accounts", "bookmarks", "add", username],
2159
2502
  mutationFn: async ({ author, permlink }) => {
2160
- if (!username) {
2161
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2503
+ if (!username || !code) {
2504
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2162
2505
  }
2163
2506
  const fetchApi = getBoundFetch();
2164
2507
  const response = await fetchApi(
@@ -2171,7 +2514,7 @@ function useBookmarkAdd(username, onSuccess, onError) {
2171
2514
  body: JSON.stringify({
2172
2515
  author,
2173
2516
  permlink,
2174
- code: getAccessToken(username)
2517
+ code
2175
2518
  })
2176
2519
  }
2177
2520
  );
@@ -2186,12 +2529,12 @@ function useBookmarkAdd(username, onSuccess, onError) {
2186
2529
  onError
2187
2530
  });
2188
2531
  }
2189
- function useBookmarkDelete(username, onSuccess, onError) {
2532
+ function useBookmarkDelete(username, code, onSuccess, onError) {
2190
2533
  return reactQuery.useMutation({
2191
2534
  mutationKey: ["accounts", "bookmarks", "delete", username],
2192
2535
  mutationFn: async (bookmarkId) => {
2193
- if (!username) {
2194
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2536
+ if (!username || !code) {
2537
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2195
2538
  }
2196
2539
  const fetchApi = getBoundFetch();
2197
2540
  const response = await fetchApi(
@@ -2203,7 +2546,7 @@ function useBookmarkDelete(username, onSuccess, onError) {
2203
2546
  },
2204
2547
  body: JSON.stringify({
2205
2548
  id: bookmarkId,
2206
- code: getAccessToken(username)
2549
+ code
2207
2550
  })
2208
2551
  }
2209
2552
  );
@@ -2218,12 +2561,12 @@ function useBookmarkDelete(username, onSuccess, onError) {
2218
2561
  onError
2219
2562
  });
2220
2563
  }
2221
- function useAccountFavouriteAdd(username, onSuccess, onError) {
2564
+ function useAccountFavouriteAdd(username, code, onSuccess, onError) {
2222
2565
  return reactQuery.useMutation({
2223
2566
  mutationKey: ["accounts", "favourites", "add", username],
2224
2567
  mutationFn: async (account) => {
2225
- if (!username) {
2226
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2568
+ if (!username || !code) {
2569
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2227
2570
  }
2228
2571
  const fetchApi = getBoundFetch();
2229
2572
  const response = await fetchApi(
@@ -2235,7 +2578,7 @@ function useAccountFavouriteAdd(username, onSuccess, onError) {
2235
2578
  },
2236
2579
  body: JSON.stringify({
2237
2580
  account,
2238
- code: getAccessToken(username)
2581
+ code
2239
2582
  })
2240
2583
  }
2241
2584
  );
@@ -2250,12 +2593,12 @@ function useAccountFavouriteAdd(username, onSuccess, onError) {
2250
2593
  onError
2251
2594
  });
2252
2595
  }
2253
- function useAccountFavouriteDelete(username, onSuccess, onError) {
2596
+ function useAccountFavouriteDelete(username, code, onSuccess, onError) {
2254
2597
  return reactQuery.useMutation({
2255
2598
  mutationKey: ["accounts", "favourites", "add", username],
2256
2599
  mutationFn: async (account) => {
2257
- if (!username) {
2258
- throw new Error("[SDK][Account][Bookmarks] \u2013 no active user");
2600
+ if (!username || !code) {
2601
+ throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
2259
2602
  }
2260
2603
  const fetchApi = getBoundFetch();
2261
2604
  const response = await fetchApi(
@@ -2267,7 +2610,7 @@ function useAccountFavouriteDelete(username, onSuccess, onError) {
2267
2610
  },
2268
2611
  body: JSON.stringify({
2269
2612
  account,
2270
- code: getAccessToken(username)
2613
+ code
2271
2614
  })
2272
2615
  }
2273
2616
  );
@@ -2425,7 +2768,7 @@ function useAccountRevokePosting(username, options) {
2425
2768
  }
2426
2769
  });
2427
2770
  }
2428
- function useAccountUpdateRecovery(username, options) {
2771
+ function useAccountUpdateRecovery(username, code, options) {
2429
2772
  const { data } = reactQuery.useQuery(getAccountFullQueryOptions(username));
2430
2773
  return reactQuery.useMutation({
2431
2774
  mutationKey: ["accounts", "recovery", data?.name],
@@ -2441,11 +2784,14 @@ function useAccountUpdateRecovery(username, options) {
2441
2784
  extensions: []
2442
2785
  };
2443
2786
  if (type === "ecency") {
2787
+ if (!code) {
2788
+ throw new Error("[SDK][Accounts] \u2013 missing access token");
2789
+ }
2444
2790
  const fetchApi = getBoundFetch();
2445
2791
  return fetchApi(CONFIG.privateApiHost + "/private-api/recoveries-add", {
2446
2792
  method: "POST",
2447
2793
  body: JSON.stringify({
2448
- code: getAccessToken(data.name),
2794
+ code,
2449
2795
  email,
2450
2796
  publicKeys: [
2451
2797
  ...data.owner.key_auths,
@@ -2514,6 +2860,152 @@ function useAccountRevokeKey(username, options) {
2514
2860
  ...options
2515
2861
  });
2516
2862
  }
2863
+
2864
+ // src/modules/accounts/utils/account-power.ts
2865
+ var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
2866
+ function vestsToRshares(vests, votingPowerValue, votePerc) {
2867
+ const vestingShares = vests * 1e6;
2868
+ const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
2869
+ return power * vestingShares / 1e4;
2870
+ }
2871
+ function toDhiveAccountForVotingMana(account) {
2872
+ return {
2873
+ id: 0,
2874
+ name: account.name,
2875
+ owner: account.owner,
2876
+ active: account.active,
2877
+ posting: account.posting,
2878
+ memo_key: account.memo_key,
2879
+ json_metadata: account.json_metadata,
2880
+ posting_json_metadata: account.posting_json_metadata,
2881
+ proxy: account.proxy ?? "",
2882
+ last_owner_update: "",
2883
+ last_account_update: "",
2884
+ created: account.created,
2885
+ mined: false,
2886
+ owner_challenged: false,
2887
+ active_challenged: false,
2888
+ last_owner_proved: "",
2889
+ last_active_proved: "",
2890
+ recovery_account: account.recovery_account ?? "",
2891
+ reset_account: "",
2892
+ last_account_recovery: "",
2893
+ comment_count: 0,
2894
+ lifetime_vote_count: 0,
2895
+ post_count: account.post_count,
2896
+ can_vote: true,
2897
+ voting_power: account.voting_power,
2898
+ last_vote_time: account.last_vote_time,
2899
+ voting_manabar: account.voting_manabar,
2900
+ balance: account.balance,
2901
+ savings_balance: account.savings_balance,
2902
+ hbd_balance: account.hbd_balance,
2903
+ hbd_seconds: "0",
2904
+ hbd_seconds_last_update: "",
2905
+ hbd_last_interest_payment: "",
2906
+ savings_hbd_balance: account.savings_hbd_balance,
2907
+ savings_hbd_seconds: account.savings_hbd_seconds,
2908
+ savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
2909
+ savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
2910
+ savings_withdraw_requests: 0,
2911
+ reward_hbd_balance: account.reward_hbd_balance,
2912
+ reward_hive_balance: account.reward_hive_balance,
2913
+ reward_vesting_balance: account.reward_vesting_balance,
2914
+ reward_vesting_hive: account.reward_vesting_hive,
2915
+ curation_rewards: 0,
2916
+ posting_rewards: 0,
2917
+ vesting_shares: account.vesting_shares,
2918
+ delegated_vesting_shares: account.delegated_vesting_shares,
2919
+ received_vesting_shares: account.received_vesting_shares,
2920
+ vesting_withdraw_rate: account.vesting_withdraw_rate,
2921
+ next_vesting_withdrawal: account.next_vesting_withdrawal,
2922
+ withdrawn: account.withdrawn,
2923
+ to_withdraw: account.to_withdraw,
2924
+ withdraw_routes: 0,
2925
+ proxied_vsf_votes: account.proxied_vsf_votes ?? [],
2926
+ witnesses_voted_for: 0,
2927
+ average_bandwidth: 0,
2928
+ lifetime_bandwidth: 0,
2929
+ last_bandwidth_update: "",
2930
+ average_market_bandwidth: 0,
2931
+ lifetime_market_bandwidth: 0,
2932
+ last_market_bandwidth_update: "",
2933
+ last_post: account.last_post,
2934
+ last_root_post: ""
2935
+ };
2936
+ }
2937
+ function votingPower(account) {
2938
+ const calc = CONFIG.hiveClient.rc.calculateVPMana(
2939
+ toDhiveAccountForVotingMana(account)
2940
+ );
2941
+ return calc.percentage / 100;
2942
+ }
2943
+ function powerRechargeTime(power) {
2944
+ if (!Number.isFinite(power)) {
2945
+ throw new TypeError("Voting power must be a finite number");
2946
+ }
2947
+ if (power < 0 || power > 100) {
2948
+ throw new RangeError("Voting power must be between 0 and 100");
2949
+ }
2950
+ const missingPower = 100 - power;
2951
+ return missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS / 1e4;
2952
+ }
2953
+ function downVotingPower(account) {
2954
+ const totalShares = parseFloat(account.vesting_shares) + parseFloat(account.received_vesting_shares) - parseFloat(account.delegated_vesting_shares);
2955
+ const elapsed = Math.floor(Date.now() / 1e3) - account.downvote_manabar.last_update_time;
2956
+ const maxMana = totalShares * 1e6 / 4;
2957
+ if (maxMana <= 0) {
2958
+ return 0;
2959
+ }
2960
+ let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
2961
+ if (currentMana > maxMana) {
2962
+ currentMana = maxMana;
2963
+ }
2964
+ const currentManaPerc = currentMana * 100 / maxMana;
2965
+ if (isNaN(currentManaPerc)) {
2966
+ return 0;
2967
+ }
2968
+ if (currentManaPerc > 100) {
2969
+ return 100;
2970
+ }
2971
+ return currentManaPerc;
2972
+ }
2973
+ function rcPower(account) {
2974
+ const calc = CONFIG.hiveClient.rc.calculateRCMana(account);
2975
+ return calc.percentage / 100;
2976
+ }
2977
+ function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
2978
+ if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {
2979
+ return 0;
2980
+ }
2981
+ const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;
2982
+ if (!Number.isFinite(fundRecentClaims) || !Number.isFinite(fundRewardBalance) || !Number.isFinite(base) || !Number.isFinite(quote)) {
2983
+ return 0;
2984
+ }
2985
+ if (fundRecentClaims === 0 || quote === 0) {
2986
+ return 0;
2987
+ }
2988
+ let totalVests = 0;
2989
+ try {
2990
+ const vesting = parseAsset(account.vesting_shares).amount;
2991
+ const received = parseAsset(account.received_vesting_shares).amount;
2992
+ const delegated = parseAsset(account.delegated_vesting_shares).amount;
2993
+ if (![vesting, received, delegated].every(Number.isFinite)) {
2994
+ return 0;
2995
+ }
2996
+ totalVests = vesting + received - delegated;
2997
+ } catch {
2998
+ return 0;
2999
+ }
3000
+ if (!Number.isFinite(totalVests)) {
3001
+ return 0;
3002
+ }
3003
+ const rShares = vestsToRshares(totalVests, votingPowerValue, weight);
3004
+ if (!Number.isFinite(rShares)) {
3005
+ return 0;
3006
+ }
3007
+ return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
3008
+ }
2517
3009
  function useSignOperationByKey(username) {
2518
3010
  return reactQuery.useMutation({
2519
3011
  mutationKey: ["operations", "sign", username],
@@ -2569,17 +3061,20 @@ function getChainPropertiesQueryOptions() {
2569
3061
  }
2570
3062
  });
2571
3063
  }
2572
- function useAddFragment(username) {
3064
+ function useAddFragment(username, code) {
2573
3065
  return reactQuery.useMutation({
2574
3066
  mutationKey: ["posts", "add-fragment", username],
2575
3067
  mutationFn: async ({ title, body }) => {
3068
+ if (!code) {
3069
+ throw new Error("[SDK][Posts] Missing access token");
3070
+ }
2576
3071
  const fetchApi = getBoundFetch();
2577
3072
  const response = await fetchApi(
2578
3073
  CONFIG.privateApiHost + "/private-api/fragments-add",
2579
3074
  {
2580
3075
  method: "POST",
2581
3076
  body: JSON.stringify({
2582
- code: getAccessToken(username),
3077
+ code,
2583
3078
  title,
2584
3079
  body
2585
3080
  }),
@@ -2592,23 +3087,26 @@ function useAddFragment(username) {
2592
3087
  },
2593
3088
  onSuccess(response) {
2594
3089
  getQueryClient().setQueryData(
2595
- getFragmentsQueryOptions(username).queryKey,
3090
+ getFragmentsQueryOptions(username, code).queryKey,
2596
3091
  (data) => [response, ...data ?? []]
2597
3092
  );
2598
3093
  }
2599
3094
  });
2600
3095
  }
2601
- function useEditFragment(username, fragmentId) {
3096
+ function useEditFragment(username, fragmentId, code) {
2602
3097
  return reactQuery.useMutation({
2603
3098
  mutationKey: ["posts", "edit-fragment", username, fragmentId],
2604
3099
  mutationFn: async ({ title, body }) => {
3100
+ if (!code) {
3101
+ throw new Error("[SDK][Posts] Missing access token");
3102
+ }
2605
3103
  const fetchApi = getBoundFetch();
2606
3104
  const response = await fetchApi(
2607
3105
  CONFIG.privateApiHost + "/private-api/fragments-update",
2608
3106
  {
2609
3107
  method: "POST",
2610
3108
  body: JSON.stringify({
2611
- code: getAccessToken(username),
3109
+ code,
2612
3110
  id: fragmentId,
2613
3111
  title,
2614
3112
  body
@@ -2622,7 +3120,7 @@ function useEditFragment(username, fragmentId) {
2622
3120
  },
2623
3121
  onSuccess(response) {
2624
3122
  getQueryClient().setQueryData(
2625
- getFragmentsQueryOptions(username).queryKey,
3123
+ getFragmentsQueryOptions(username, code).queryKey,
2626
3124
  (data) => {
2627
3125
  if (!data) {
2628
3126
  return [];
@@ -2637,15 +3135,18 @@ function useEditFragment(username, fragmentId) {
2637
3135
  }
2638
3136
  });
2639
3137
  }
2640
- function useRemoveFragment(username, fragmentId) {
3138
+ function useRemoveFragment(username, fragmentId, code) {
2641
3139
  return reactQuery.useMutation({
2642
3140
  mutationKey: ["posts", "remove-fragment", username],
2643
3141
  mutationFn: async () => {
3142
+ if (!code) {
3143
+ throw new Error("[SDK][Posts] Missing access token");
3144
+ }
2644
3145
  const fetchApi = getBoundFetch();
2645
3146
  return fetchApi(CONFIG.privateApiHost + "/private-api/fragments-delete", {
2646
3147
  method: "POST",
2647
3148
  body: JSON.stringify({
2648
- code: getAccessToken(username),
3149
+ code,
2649
3150
  id: fragmentId
2650
3151
  }),
2651
3152
  headers: {
@@ -2655,13 +3156,40 @@ function useRemoveFragment(username, fragmentId) {
2655
3156
  },
2656
3157
  onSuccess() {
2657
3158
  getQueryClient().setQueryData(
2658
- getFragmentsQueryOptions(username).queryKey,
3159
+ getFragmentsQueryOptions(username, code).queryKey,
2659
3160
  (data) => [...data ?? []].filter(({ id }) => id !== fragmentId)
2660
3161
  );
2661
3162
  }
2662
3163
  });
2663
3164
  }
2664
3165
 
3166
+ // src/modules/posts/utils/validate-post-creating.ts
3167
+ var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
3168
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3169
+ async function getContent(author, permlink) {
3170
+ return CONFIG.hiveClient.call("condenser_api", "get_content", [
3171
+ author,
3172
+ permlink
3173
+ ]);
3174
+ }
3175
+ async function validatePostCreating(author, permlink, attempts = 0, options) {
3176
+ const delays = options?.delays ?? DEFAULT_VALIDATE_POST_DELAYS;
3177
+ let response;
3178
+ try {
3179
+ response = await getContent(author, permlink);
3180
+ } catch (e) {
3181
+ response = void 0;
3182
+ }
3183
+ if (response || attempts >= delays.length) {
3184
+ return;
3185
+ }
3186
+ const waitMs = delays[attempts];
3187
+ if (waitMs > 0) {
3188
+ await delay(waitMs);
3189
+ }
3190
+ return validatePostCreating(author, permlink, attempts + 1, options);
3191
+ }
3192
+
2665
3193
  // src/modules/analytics/mutations/index.ts
2666
3194
  var mutations_exports = {};
2667
3195
  __export(mutations_exports, {
@@ -2774,11 +3302,10 @@ var queries_exports = {};
2774
3302
  __export(queries_exports, {
2775
3303
  getDecodeMemoQueryOptions: () => getDecodeMemoQueryOptions
2776
3304
  });
2777
- function getDecodeMemoQueryOptions(username, memo) {
3305
+ function getDecodeMemoQueryOptions(username, memo, accessToken) {
2778
3306
  return reactQuery.queryOptions({
2779
3307
  queryKey: ["integrations", "hivesigner", "decode-memo", username],
2780
3308
  queryFn: async () => {
2781
- const accessToken = getAccessToken(username);
2782
3309
  if (accessToken) {
2783
3310
  const hsClient = new hs__default.default.Client({
2784
3311
  accessToken
@@ -2795,12 +3322,12 @@ var HiveSignerIntegration = {
2795
3322
  };
2796
3323
 
2797
3324
  // src/modules/integrations/3speak/queries/get-account-token-query-options.ts
2798
- function getAccountTokenQueryOptions(username) {
3325
+ function getAccountTokenQueryOptions(username, accessToken) {
2799
3326
  return reactQuery.queryOptions({
2800
3327
  queryKey: ["integrations", "3speak", "authenticate", username],
2801
- enabled: !!username,
3328
+ enabled: !!username && !!accessToken,
2802
3329
  queryFn: async () => {
2803
- if (!username) {
3330
+ if (!username || !accessToken) {
2804
3331
  throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
2805
3332
  }
2806
3333
  const fetchApi = getBoundFetch();
@@ -2814,7 +3341,8 @@ function getAccountTokenQueryOptions(username) {
2814
3341
  );
2815
3342
  const memoQueryOptions = HiveSignerIntegration.queries.getDecodeMemoQueryOptions(
2816
3343
  username,
2817
- (await response.json()).memo
3344
+ (await response.json()).memo,
3345
+ accessToken
2818
3346
  );
2819
3347
  await getQueryClient().prefetchQuery(memoQueryOptions);
2820
3348
  const { memoDecoded } = getQueryClient().getQueryData(
@@ -2824,17 +3352,23 @@ function getAccountTokenQueryOptions(username) {
2824
3352
  }
2825
3353
  });
2826
3354
  }
2827
- function getAccountVideosQueryOptions(username) {
3355
+ function getAccountVideosQueryOptions(username, accessToken) {
2828
3356
  return reactQuery.queryOptions({
2829
3357
  queryKey: ["integrations", "3speak", "videos", username],
2830
- enabled: !!username,
3358
+ enabled: !!username && !!accessToken,
2831
3359
  queryFn: async () => {
2832
- await getQueryClient().prefetchQuery(
2833
- getAccountTokenQueryOptions(username)
2834
- );
2835
- const token = getQueryClient().getQueryData(
2836
- getAccountTokenQueryOptions(username).queryKey
3360
+ if (!username || !accessToken) {
3361
+ throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
3362
+ }
3363
+ const tokenQueryOptions = getAccountTokenQueryOptions(
3364
+ username,
3365
+ accessToken
2837
3366
  );
3367
+ await getQueryClient().prefetchQuery(tokenQueryOptions);
3368
+ const token = getQueryClient().getQueryData(tokenQueryOptions.queryKey);
3369
+ if (!token) {
3370
+ throw new Error("[SDK][Integrations][3Speak] \u2013 missing account token");
3371
+ }
2838
3372
  const fetchApi = getBoundFetch();
2839
3373
  const response = await fetchApi(
2840
3374
  `https://studio.3speak.tv/mobile/api/my-videos`,
@@ -2945,13 +3479,13 @@ function getAccountRcQueryOptions(username) {
2945
3479
  enabled: !!username
2946
3480
  });
2947
3481
  }
2948
- function getGameStatusCheckQueryOptions(username, gameType) {
3482
+ function getGameStatusCheckQueryOptions(username, code, gameType) {
2949
3483
  return reactQuery.queryOptions({
2950
3484
  queryKey: ["games", "status-check", gameType, username],
2951
- enabled: !!username,
3485
+ enabled: !!username && !!code,
2952
3486
  queryFn: async () => {
2953
- if (!username) {
2954
- throw new Error("[SDK][Games] \u2013 anon user in status check");
3487
+ if (!username || !code) {
3488
+ throw new Error("[SDK][Games] \u2013 missing auth");
2955
3489
  }
2956
3490
  const fetchApi = getBoundFetch();
2957
3491
  const response = await fetchApi(
@@ -2960,7 +3494,7 @@ function getGameStatusCheckQueryOptions(username, gameType) {
2960
3494
  method: "POST",
2961
3495
  body: JSON.stringify({
2962
3496
  game_type: gameType,
2963
- code: getAccessToken(username)
3497
+ code
2964
3498
  }),
2965
3499
  headers: {
2966
3500
  "Content-Type": "application/json"
@@ -2971,7 +3505,7 @@ function getGameStatusCheckQueryOptions(username, gameType) {
2971
3505
  }
2972
3506
  });
2973
3507
  }
2974
- function useGameClaim(username, gameType, key) {
3508
+ function useGameClaim(username, code, gameType, key) {
2975
3509
  const { mutateAsync: recordActivity } = useRecordActivity(
2976
3510
  username,
2977
3511
  "spin-rolled"
@@ -2979,8 +3513,8 @@ function useGameClaim(username, gameType, key) {
2979
3513
  return reactQuery.useMutation({
2980
3514
  mutationKey: ["games", "post", gameType, username],
2981
3515
  mutationFn: async () => {
2982
- if (!username) {
2983
- throw new Error("[SDK][Games] \u2013 anon user in game post");
3516
+ if (!username || !code) {
3517
+ throw new Error("[SDK][Games] \u2013 missing auth");
2984
3518
  }
2985
3519
  const fetchApi = getBoundFetch();
2986
3520
  const response = await fetchApi(
@@ -2989,7 +3523,7 @@ function useGameClaim(username, gameType, key) {
2989
3523
  method: "POST",
2990
3524
  body: JSON.stringify({
2991
3525
  game_type: gameType,
2992
- code: getAccessToken(username),
3526
+ code,
2993
3527
  key
2994
3528
  }),
2995
3529
  headers: {
@@ -3044,6 +3578,13 @@ function getCommunityContextQueryOptions(username, communityName) {
3044
3578
  }
3045
3579
  });
3046
3580
  }
3581
+ function getCommunityQueryOptions(name, observer = "", enabled = true) {
3582
+ return reactQuery.queryOptions({
3583
+ queryKey: ["community", "single", name, observer],
3584
+ enabled: enabled && !!name,
3585
+ queryFn: async () => getCommunity(name ?? "", observer)
3586
+ });
3587
+ }
3047
3588
  function getCommunitySubscribersQueryOptions(communityName) {
3048
3589
  return reactQuery.queryOptions({
3049
3590
  queryKey: ["communities", "subscribers", communityName],
@@ -3154,15 +3695,18 @@ function getCommunityPermissions({
3154
3695
  isModerator
3155
3696
  };
3156
3697
  }
3157
- function getNotificationsUnreadCountQueryOptions(activeUsername) {
3698
+ function getNotificationsUnreadCountQueryOptions(activeUsername, code) {
3158
3699
  return reactQuery.queryOptions({
3159
3700
  queryKey: ["notifications", "unread", activeUsername],
3160
3701
  queryFn: async () => {
3702
+ if (!code) {
3703
+ return 0;
3704
+ }
3161
3705
  const response = await fetch(
3162
3706
  `${CONFIG.privateApiHost}/private-api/notifications/unread`,
3163
3707
  {
3164
3708
  method: "POST",
3165
- body: JSON.stringify({ code: getAccessToken(activeUsername) }),
3709
+ body: JSON.stringify({ code }),
3166
3710
  headers: {
3167
3711
  "Content-Type": "application/json"
3168
3712
  }
@@ -3171,17 +3715,20 @@ function getNotificationsUnreadCountQueryOptions(activeUsername) {
3171
3715
  const data = await response.json();
3172
3716
  return data.count;
3173
3717
  },
3174
- enabled: !!activeUsername,
3718
+ enabled: !!activeUsername && !!code,
3175
3719
  initialData: 0,
3176
3720
  refetchInterval: 6e4
3177
3721
  });
3178
3722
  }
3179
- function getNotificationsInfiniteQueryOptions(activeUsername, filter = void 0) {
3723
+ function getNotificationsInfiniteQueryOptions(activeUsername, code, filter = void 0) {
3180
3724
  return reactQuery.infiniteQueryOptions({
3181
3725
  queryKey: ["notifications", activeUsername, filter],
3182
3726
  queryFn: async ({ pageParam }) => {
3727
+ if (!code) {
3728
+ return [];
3729
+ }
3183
3730
  const data = {
3184
- code: getAccessToken(activeUsername),
3731
+ code,
3185
3732
  filter,
3186
3733
  since: pageParam,
3187
3734
  user: void 0
@@ -3198,7 +3745,7 @@ function getNotificationsInfiniteQueryOptions(activeUsername, filter = void 0) {
3198
3745
  );
3199
3746
  return response.json();
3200
3747
  },
3201
- enabled: !!activeUsername,
3748
+ enabled: !!activeUsername && !!code,
3202
3749
  initialData: { pages: [], pageParams: [] },
3203
3750
  initialPageParam: "",
3204
3751
  getNextPageParam: (lastPage) => lastPage?.[lastPage.length - 1]?.id ?? "",
@@ -3251,16 +3798,19 @@ var NotificationViewType = /* @__PURE__ */ ((NotificationViewType2) => {
3251
3798
  })(NotificationViewType || {});
3252
3799
 
3253
3800
  // src/modules/notifications/queries/get-notifications-settings-query-options.ts
3254
- function getNotificationsSettingsQueryOptions(activeUsername) {
3801
+ function getNotificationsSettingsQueryOptions(activeUsername, code) {
3255
3802
  return reactQuery.queryOptions({
3256
3803
  queryKey: ["notifications", "settings", activeUsername],
3257
3804
  queryFn: async () => {
3258
3805
  let token = activeUsername + "-web";
3806
+ if (!code) {
3807
+ throw new Error("Missing access token");
3808
+ }
3259
3809
  const response = await fetch(
3260
3810
  CONFIG.privateApiHost + "/private-api/detail-device",
3261
3811
  {
3262
3812
  body: JSON.stringify({
3263
- code: getAccessToken(activeUsername),
3813
+ code,
3264
3814
  username: activeUsername,
3265
3815
  token
3266
3816
  }),
@@ -3275,7 +3825,7 @@ function getNotificationsSettingsQueryOptions(activeUsername) {
3275
3825
  }
3276
3826
  return response.json();
3277
3827
  },
3278
- enabled: !!activeUsername,
3828
+ enabled: !!activeUsername && !!code,
3279
3829
  refetchOnMount: false,
3280
3830
  initialData: () => {
3281
3831
  const wasMutedPreviously = typeof window !== "undefined" ? localStorage.getItem("notifications") !== "true" : false;
@@ -3477,6 +4027,25 @@ function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
3477
4027
  getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
3478
4028
  });
3479
4029
  }
4030
+ function getIncomingRcQueryOptions(username) {
4031
+ return reactQuery.queryOptions({
4032
+ queryKey: ["wallet", "incoming-rc", username],
4033
+ enabled: !!username,
4034
+ queryFn: async () => {
4035
+ if (!username) {
4036
+ throw new Error("[SDK][Wallet] - Missing username for incoming RC");
4037
+ }
4038
+ const fetchApi = getBoundFetch();
4039
+ const response = await fetchApi(
4040
+ `${CONFIG.privateApiHost}/private-api/received-rc/${username}`
4041
+ );
4042
+ if (!response.ok) {
4043
+ throw new Error(`Failed to fetch incoming RC: ${response.status}`);
4044
+ }
4045
+ return response.json();
4046
+ }
4047
+ });
4048
+ }
3480
4049
  function getReceivedVestingSharesQueryOptions(username) {
3481
4050
  return reactQuery.queryOptions({
3482
4051
  queryKey: ["wallet", "received-vesting-shares", username],
@@ -3521,15 +4090,15 @@ function getMarketStatisticsQueryOptions() {
3521
4090
  });
3522
4091
  }
3523
4092
  function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
3524
- const formatDate = (date) => {
4093
+ const formatDate2 = (date) => {
3525
4094
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3526
4095
  };
3527
4096
  return reactQuery.queryOptions({
3528
4097
  queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
3529
4098
  queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
3530
4099
  seconds,
3531
- formatDate(startDate),
3532
- formatDate(endDate)
4100
+ formatDate2(startDate),
4101
+ formatDate2(endDate)
3533
4102
  ])
3534
4103
  });
3535
4104
  }
@@ -3544,13 +4113,13 @@ function getHiveHbdStatsQueryOptions() {
3544
4113
  );
3545
4114
  const now = /* @__PURE__ */ new Date();
3546
4115
  const oneDayAgo = new Date(now.getTime() - 864e5);
3547
- const formatDate = (date) => {
4116
+ const formatDate2 = (date) => {
3548
4117
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3549
4118
  };
3550
4119
  const dayChange = await CONFIG.hiveClient.call(
3551
4120
  "condenser_api",
3552
4121
  "get_market_history",
3553
- [86400, formatDate(oneDayAgo), formatDate(now)]
4122
+ [86400, formatDate2(oneDayAgo), formatDate2(now)]
3554
4123
  );
3555
4124
  const result = {
3556
4125
  price: +stats.latest,
@@ -3569,8 +4138,9 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
3569
4138
  return reactQuery.queryOptions({
3570
4139
  queryKey: ["market", "data", coin, vsCurrency, fromTs, toTs],
3571
4140
  queryFn: async ({ signal }) => {
4141
+ const fetchApi = getBoundFetch();
3572
4142
  const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
3573
- const response = await fetch(url, { signal });
4143
+ const response = await fetchApi(url, { signal });
3574
4144
  if (!response.ok) {
3575
4145
  throw new Error(`Failed to fetch market data: ${response.status}`);
3576
4146
  }
@@ -3578,6 +4148,61 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
3578
4148
  }
3579
4149
  });
3580
4150
  }
4151
+ function formatDate(date) {
4152
+ return date.toISOString().replace(/\.\d{3}Z$/, "");
4153
+ }
4154
+ function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
4155
+ const end = endDate ?? /* @__PURE__ */ new Date();
4156
+ const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
4157
+ return reactQuery.queryOptions({
4158
+ queryKey: ["market", "trade-history", limit, start.getTime(), end.getTime()],
4159
+ queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_trade_history", [
4160
+ formatDate(start),
4161
+ formatDate(end),
4162
+ limit
4163
+ ])
4164
+ });
4165
+ }
4166
+
4167
+ // src/modules/market/requests.ts
4168
+ async function parseJsonResponse(response) {
4169
+ const data = await response.json();
4170
+ if (!response.ok) {
4171
+ const error = new Error(`Request failed with status ${response.status}`);
4172
+ error.status = response.status;
4173
+ error.data = data;
4174
+ throw error;
4175
+ }
4176
+ return data;
4177
+ }
4178
+ async function getMarketData(coin, vsCurrency, fromTs, toTs) {
4179
+ const fetchApi = getBoundFetch();
4180
+ const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
4181
+ const response = await fetchApi(url);
4182
+ return parseJsonResponse(response);
4183
+ }
4184
+ async function getCurrencyRate(cur) {
4185
+ if (cur === "hbd") {
4186
+ return 1;
4187
+ }
4188
+ const fetchApi = getBoundFetch();
4189
+ const url = `https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=${cur}`;
4190
+ const response = await fetchApi(url);
4191
+ const data = await parseJsonResponse(response);
4192
+ return data.hive_dollar[cur];
4193
+ }
4194
+ async function getCurrencyTokenRate(currency, token) {
4195
+ const fetchApi = getBoundFetch();
4196
+ const response = await fetchApi(
4197
+ CONFIG.privateApiHost + `/private-api/market-data/${currency === "hbd" ? "usd" : currency}/${token}`
4198
+ );
4199
+ return parseJsonResponse(response);
4200
+ }
4201
+ async function getCurrencyRates() {
4202
+ const fetchApi = getBoundFetch();
4203
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
4204
+ return parseJsonResponse(response);
4205
+ }
3581
4206
  function getPointsQueryOptions(username, filter = 0) {
3582
4207
  return reactQuery.queryOptions({
3583
4208
  queryKey: ["points", username, filter],
@@ -3848,6 +4473,89 @@ function getSearchPathQueryOptions(q) {
3848
4473
  }
3849
4474
  });
3850
4475
  }
4476
+
4477
+ // src/modules/search/requests.ts
4478
+ async function parseJsonResponse2(response) {
4479
+ const parseBody = async () => {
4480
+ try {
4481
+ return await response.json();
4482
+ } catch {
4483
+ try {
4484
+ return await response.text();
4485
+ } catch {
4486
+ return void 0;
4487
+ }
4488
+ }
4489
+ };
4490
+ const data = await parseBody();
4491
+ if (!response.ok) {
4492
+ const error = new Error(`Request failed with status ${response.status}`);
4493
+ error.status = response.status;
4494
+ error.data = data;
4495
+ throw error;
4496
+ }
4497
+ if (data === void 0) {
4498
+ throw new Error("Response body was empty or invalid JSON");
4499
+ }
4500
+ return data;
4501
+ }
4502
+ async function search(q, sort, hideLow, since, scroll_id, votes) {
4503
+ const data = { q, sort, hide_low: hideLow };
4504
+ if (since) {
4505
+ data.since = since;
4506
+ }
4507
+ if (scroll_id) {
4508
+ data.scroll_id = scroll_id;
4509
+ }
4510
+ if (votes) {
4511
+ data.votes = votes;
4512
+ }
4513
+ const fetchApi = getBoundFetch();
4514
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search", {
4515
+ method: "POST",
4516
+ headers: {
4517
+ "Content-Type": "application/json"
4518
+ },
4519
+ body: JSON.stringify(data)
4520
+ });
4521
+ return parseJsonResponse2(response);
4522
+ }
4523
+ async function searchAccount(q = "", limit = 20, random = 1) {
4524
+ const data = { q, limit, random };
4525
+ const fetchApi = getBoundFetch();
4526
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-account", {
4527
+ method: "POST",
4528
+ headers: {
4529
+ "Content-Type": "application/json"
4530
+ },
4531
+ body: JSON.stringify(data)
4532
+ });
4533
+ return parseJsonResponse2(response);
4534
+ }
4535
+ async function searchTag(q = "", limit = 20, random = 0) {
4536
+ const data = { q, limit, random };
4537
+ const fetchApi = getBoundFetch();
4538
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-tag", {
4539
+ method: "POST",
4540
+ headers: {
4541
+ "Content-Type": "application/json"
4542
+ },
4543
+ body: JSON.stringify(data)
4544
+ });
4545
+ return parseJsonResponse2(response);
4546
+ }
4547
+ async function searchPath(q) {
4548
+ const fetchApi = getBoundFetch();
4549
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-path", {
4550
+ method: "POST",
4551
+ headers: {
4552
+ "Content-Type": "application/json"
4553
+ },
4554
+ body: JSON.stringify({ q })
4555
+ });
4556
+ const data = await parseJsonResponse2(response);
4557
+ return data?.length > 0 ? data : [q];
4558
+ }
3851
4559
  function getBoostPlusPricesQueryOptions(accessToken) {
3852
4560
  return reactQuery.queryOptions({
3853
4561
  queryKey: ["promotions", "boost-plus-prices"],
@@ -3918,6 +4626,311 @@ function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
3918
4626
  });
3919
4627
  }
3920
4628
 
4629
+ // src/modules/private-api/requests.ts
4630
+ async function parseJsonResponse3(response) {
4631
+ if (!response.ok) {
4632
+ let errorData = void 0;
4633
+ try {
4634
+ errorData = await response.json();
4635
+ } catch {
4636
+ errorData = void 0;
4637
+ }
4638
+ const error = new Error(`Request failed with status ${response.status}`);
4639
+ error.status = response.status;
4640
+ error.data = errorData;
4641
+ throw error;
4642
+ }
4643
+ return await response.json();
4644
+ }
4645
+ async function signUp(username, email, referral) {
4646
+ const fetchApi = getBoundFetch();
4647
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/account-create", {
4648
+ method: "POST",
4649
+ headers: {
4650
+ "Content-Type": "application/json"
4651
+ },
4652
+ body: JSON.stringify({ username, email, referral })
4653
+ });
4654
+ const data = await parseJsonResponse3(response);
4655
+ return { status: response.status, data };
4656
+ }
4657
+ async function subscribeEmail(email) {
4658
+ const fetchApi = getBoundFetch();
4659
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/subscribe", {
4660
+ method: "POST",
4661
+ headers: {
4662
+ "Content-Type": "application/json"
4663
+ },
4664
+ body: JSON.stringify({ email })
4665
+ });
4666
+ const data = await parseJsonResponse3(response);
4667
+ return { status: response.status, data };
4668
+ }
4669
+ async function usrActivity(code, ty, bl = "", tx = "") {
4670
+ const params = { code, ty };
4671
+ if (bl) {
4672
+ params.bl = bl;
4673
+ }
4674
+ if (tx) {
4675
+ params.tx = tx;
4676
+ }
4677
+ const fetchApi = getBoundFetch();
4678
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/usr-activity", {
4679
+ method: "POST",
4680
+ headers: {
4681
+ "Content-Type": "application/json"
4682
+ },
4683
+ body: JSON.stringify(params)
4684
+ });
4685
+ await parseJsonResponse3(response);
4686
+ }
4687
+ async function getNotifications(code, filter, since = null, user = null) {
4688
+ const data = {
4689
+ code
4690
+ };
4691
+ if (filter) {
4692
+ data.filter = filter;
4693
+ }
4694
+ if (since) {
4695
+ data.since = since;
4696
+ }
4697
+ if (user) {
4698
+ data.user = user;
4699
+ }
4700
+ const fetchApi = getBoundFetch();
4701
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications", {
4702
+ method: "POST",
4703
+ headers: {
4704
+ "Content-Type": "application/json"
4705
+ },
4706
+ body: JSON.stringify(data)
4707
+ });
4708
+ return parseJsonResponse3(response);
4709
+ }
4710
+ async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
4711
+ const data = {
4712
+ code,
4713
+ username,
4714
+ token,
4715
+ system,
4716
+ allows_notify,
4717
+ notify_types
4718
+ };
4719
+ const fetchApi = getBoundFetch();
4720
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/register-device", {
4721
+ method: "POST",
4722
+ headers: {
4723
+ "Content-Type": "application/json"
4724
+ },
4725
+ body: JSON.stringify(data)
4726
+ });
4727
+ return parseJsonResponse3(response);
4728
+ }
4729
+ async function getNotificationSetting(code, username, token) {
4730
+ const data = { code, username, token };
4731
+ const fetchApi = getBoundFetch();
4732
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/detail-device", {
4733
+ method: "POST",
4734
+ headers: {
4735
+ "Content-Type": "application/json"
4736
+ },
4737
+ body: JSON.stringify(data)
4738
+ });
4739
+ return parseJsonResponse3(response);
4740
+ }
4741
+ async function markNotifications(code, id) {
4742
+ const data = {
4743
+ code
4744
+ };
4745
+ if (id) {
4746
+ data.id = id;
4747
+ }
4748
+ const fetchApi = getBoundFetch();
4749
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications/mark", {
4750
+ method: "POST",
4751
+ headers: {
4752
+ "Content-Type": "application/json"
4753
+ },
4754
+ body: JSON.stringify(data)
4755
+ });
4756
+ return parseJsonResponse3(response);
4757
+ }
4758
+ async function addImage(code, url) {
4759
+ const data = { code, url };
4760
+ const fetchApi = getBoundFetch();
4761
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-add", {
4762
+ method: "POST",
4763
+ headers: {
4764
+ "Content-Type": "application/json"
4765
+ },
4766
+ body: JSON.stringify(data)
4767
+ });
4768
+ return parseJsonResponse3(response);
4769
+ }
4770
+ async function uploadImage(file, token, signal) {
4771
+ const fetchApi = getBoundFetch();
4772
+ const formData = new FormData();
4773
+ formData.append("file", file);
4774
+ const response = await fetchApi(`${CONFIG.imageHost}/hs/${token}`, {
4775
+ method: "POST",
4776
+ body: formData,
4777
+ signal
4778
+ });
4779
+ return parseJsonResponse3(response);
4780
+ }
4781
+ async function deleteImage(code, imageId) {
4782
+ const data = { code, id: imageId };
4783
+ const fetchApi = getBoundFetch();
4784
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-delete", {
4785
+ method: "POST",
4786
+ headers: {
4787
+ "Content-Type": "application/json"
4788
+ },
4789
+ body: JSON.stringify(data)
4790
+ });
4791
+ return parseJsonResponse3(response);
4792
+ }
4793
+ async function addDraft(code, title, body, tags, meta) {
4794
+ const data = { code, title, body, tags, meta };
4795
+ const fetchApi = getBoundFetch();
4796
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-add", {
4797
+ method: "POST",
4798
+ headers: {
4799
+ "Content-Type": "application/json"
4800
+ },
4801
+ body: JSON.stringify(data)
4802
+ });
4803
+ return parseJsonResponse3(response);
4804
+ }
4805
+ async function updateDraft(code, draftId, title, body, tags, meta) {
4806
+ const data = { code, id: draftId, title, body, tags, meta };
4807
+ const fetchApi = getBoundFetch();
4808
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-update", {
4809
+ method: "POST",
4810
+ headers: {
4811
+ "Content-Type": "application/json"
4812
+ },
4813
+ body: JSON.stringify(data)
4814
+ });
4815
+ return parseJsonResponse3(response);
4816
+ }
4817
+ async function deleteDraft(code, draftId) {
4818
+ const data = { code, id: draftId };
4819
+ const fetchApi = getBoundFetch();
4820
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-delete", {
4821
+ method: "POST",
4822
+ headers: {
4823
+ "Content-Type": "application/json"
4824
+ },
4825
+ body: JSON.stringify(data)
4826
+ });
4827
+ return parseJsonResponse3(response);
4828
+ }
4829
+ async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
4830
+ const data = {
4831
+ code,
4832
+ permlink,
4833
+ title,
4834
+ body,
4835
+ meta,
4836
+ schedule,
4837
+ reblog
4838
+ };
4839
+ if (options) {
4840
+ data.options = options;
4841
+ }
4842
+ const fetchApi = getBoundFetch();
4843
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-add", {
4844
+ method: "POST",
4845
+ headers: {
4846
+ "Content-Type": "application/json"
4847
+ },
4848
+ body: JSON.stringify(data)
4849
+ });
4850
+ return parseJsonResponse3(response);
4851
+ }
4852
+ async function deleteSchedule(code, id) {
4853
+ const data = { code, id };
4854
+ const fetchApi = getBoundFetch();
4855
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-delete", {
4856
+ method: "POST",
4857
+ headers: {
4858
+ "Content-Type": "application/json"
4859
+ },
4860
+ body: JSON.stringify(data)
4861
+ });
4862
+ return parseJsonResponse3(response);
4863
+ }
4864
+ async function moveSchedule(code, id) {
4865
+ const data = { code, id };
4866
+ const fetchApi = getBoundFetch();
4867
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-move", {
4868
+ method: "POST",
4869
+ headers: {
4870
+ "Content-Type": "application/json"
4871
+ },
4872
+ body: JSON.stringify(data)
4873
+ });
4874
+ return parseJsonResponse3(response);
4875
+ }
4876
+ async function getPromotedPost(code, author, permlink) {
4877
+ const data = { code, author, permlink };
4878
+ const fetchApi = getBoundFetch();
4879
+ const response = await fetchApi(CONFIG.privateApiHost + "/private-api/promoted-post", {
4880
+ method: "POST",
4881
+ headers: {
4882
+ "Content-Type": "application/json"
4883
+ },
4884
+ body: JSON.stringify(data)
4885
+ });
4886
+ return parseJsonResponse3(response);
4887
+ }
4888
+ async function onboardEmail(username, email, friend) {
4889
+ const dataBody = {
4890
+ username,
4891
+ email,
4892
+ friend
4893
+ };
4894
+ const fetchApi = getBoundFetch();
4895
+ const response = await fetchApi(
4896
+ CONFIG.privateApiHost + "/private-api/account-create-friend",
4897
+ {
4898
+ method: "POST",
4899
+ headers: {
4900
+ "Content-Type": "application/json"
4901
+ },
4902
+ body: JSON.stringify(dataBody)
4903
+ }
4904
+ );
4905
+ return parseJsonResponse3(response);
4906
+ }
4907
+
4908
+ // src/modules/auth/requests.ts
4909
+ async function hsTokenRenew(code) {
4910
+ const fetchApi = getBoundFetch();
4911
+ const response = await fetchApi(CONFIG.privateApiHost + "/auth-api/hs-token-refresh", {
4912
+ method: "POST",
4913
+ headers: {
4914
+ "Content-Type": "application/json"
4915
+ },
4916
+ body: JSON.stringify({ code })
4917
+ });
4918
+ if (!response.ok) {
4919
+ let data2 = void 0;
4920
+ try {
4921
+ data2 = await response.json();
4922
+ } catch {
4923
+ data2 = void 0;
4924
+ }
4925
+ const error = new Error(`Failed to refresh token: ${response.status}`);
4926
+ error.status = response.status;
4927
+ error.data = data2;
4928
+ throw error;
4929
+ }
4930
+ const data = await response.json();
4931
+ return data;
4932
+ }
4933
+
3921
4934
  exports.ACCOUNT_OPERATION_GROUPS = ACCOUNT_OPERATION_GROUPS;
3922
4935
  exports.ALL_ACCOUNT_OPERATIONS = ALL_ACCOUNT_OPERATIONS;
3923
4936
  exports.ALL_NOTIFY_TYPES = ALL_NOTIFY_TYPES;
@@ -3933,20 +4946,31 @@ exports.ROLES = ROLES;
3933
4946
  exports.SortOrder = SortOrder;
3934
4947
  exports.Symbol = Symbol2;
3935
4948
  exports.ThreeSpeakIntegration = ThreeSpeakIntegration;
4949
+ exports.addDraft = addDraft;
4950
+ exports.addImage = addImage;
4951
+ exports.addSchedule = addSchedule;
4952
+ exports.bridgeApiCall = bridgeApiCall;
3936
4953
  exports.broadcastJson = broadcastJson;
3937
4954
  exports.buildProfileMetadata = buildProfileMetadata;
3938
4955
  exports.checkUsernameWalletsPendingQueryOptions = checkUsernameWalletsPendingQueryOptions;
3939
4956
  exports.decodeObj = decodeObj;
3940
4957
  exports.dedupeAndSortKeyAuths = dedupeAndSortKeyAuths;
4958
+ exports.deleteDraft = deleteDraft;
4959
+ exports.deleteImage = deleteImage;
4960
+ exports.deleteSchedule = deleteSchedule;
4961
+ exports.downVotingPower = downVotingPower;
3941
4962
  exports.encodeObj = encodeObj;
3942
4963
  exports.extractAccountProfile = extractAccountProfile;
3943
4964
  exports.getAccessToken = getAccessToken;
3944
4965
  exports.getAccountFullQueryOptions = getAccountFullQueryOptions;
3945
4966
  exports.getAccountNotificationsInfiniteQueryOptions = getAccountNotificationsInfiniteQueryOptions;
3946
4967
  exports.getAccountPendingRecoveryQueryOptions = getAccountPendingRecoveryQueryOptions;
4968
+ exports.getAccountPosts = getAccountPosts;
3947
4969
  exports.getAccountPostsInfiniteQueryOptions = getAccountPostsInfiniteQueryOptions;
4970
+ exports.getAccountPostsQueryOptions = getAccountPostsQueryOptions;
3948
4971
  exports.getAccountRcQueryOptions = getAccountRcQueryOptions;
3949
4972
  exports.getAccountRecoveriesQueryOptions = getAccountRecoveriesQueryOptions;
4973
+ exports.getAccountReputationsQueryOptions = getAccountReputationsQueryOptions;
3950
4974
  exports.getAccountSubscriptionsQueryOptions = getAccountSubscriptionsQueryOptions;
3951
4975
  exports.getAccountVoteHistoryInfiniteQueryOptions = getAccountVoteHistoryInfiniteQueryOptions;
3952
4976
  exports.getAccountsQueryOptions = getAccountsQueryOptions;
@@ -3960,16 +4984,26 @@ exports.getBoundFetch = getBoundFetch;
3960
4984
  exports.getChainPropertiesQueryOptions = getChainPropertiesQueryOptions;
3961
4985
  exports.getCollateralizedConversionRequestsQueryOptions = getCollateralizedConversionRequestsQueryOptions;
3962
4986
  exports.getCommentHistoryQueryOptions = getCommentHistoryQueryOptions;
4987
+ exports.getCommunities = getCommunities;
3963
4988
  exports.getCommunitiesQueryOptions = getCommunitiesQueryOptions;
4989
+ exports.getCommunity = getCommunity;
3964
4990
  exports.getCommunityContextQueryOptions = getCommunityContextQueryOptions;
3965
4991
  exports.getCommunityPermissions = getCommunityPermissions;
4992
+ exports.getCommunityQueryOptions = getCommunityQueryOptions;
3966
4993
  exports.getCommunitySubscribersQueryOptions = getCommunitySubscribersQueryOptions;
3967
4994
  exports.getCommunityType = getCommunityType;
4995
+ exports.getContentQueryOptions = getContentQueryOptions;
4996
+ exports.getContentRepliesQueryOptions = getContentRepliesQueryOptions;
3968
4997
  exports.getControversialRisingInfiniteQueryOptions = getControversialRisingInfiniteQueryOptions;
3969
4998
  exports.getConversionRequestsQueryOptions = getConversionRequestsQueryOptions;
4999
+ exports.getCurrencyRate = getCurrencyRate;
5000
+ exports.getCurrencyRates = getCurrencyRates;
5001
+ exports.getCurrencyTokenRate = getCurrencyTokenRate;
3970
5002
  exports.getDeletedEntryQueryOptions = getDeletedEntryQueryOptions;
3971
5003
  exports.getDiscoverCurationQueryOptions = getDiscoverCurationQueryOptions;
3972
5004
  exports.getDiscoverLeaderboardQueryOptions = getDiscoverLeaderboardQueryOptions;
5005
+ exports.getDiscussion = getDiscussion;
5006
+ exports.getDiscussionQueryOptions = getDiscussionQueryOptions;
3973
5007
  exports.getDiscussionsQueryOptions = getDiscussionsQueryOptions;
3974
5008
  exports.getDraftsQueryOptions = getDraftsQueryOptions;
3975
5009
  exports.getDynamicPropsQueryOptions = getDynamicPropsQueryOptions;
@@ -3983,11 +5017,16 @@ exports.getGameStatusCheckQueryOptions = getGameStatusCheckQueryOptions;
3983
5017
  exports.getHiveHbdStatsQueryOptions = getHiveHbdStatsQueryOptions;
3984
5018
  exports.getHivePoshLinksQueryOptions = getHivePoshLinksQueryOptions;
3985
5019
  exports.getImagesQueryOptions = getImagesQueryOptions;
5020
+ exports.getIncomingRcQueryOptions = getIncomingRcQueryOptions;
3986
5021
  exports.getLoginType = getLoginType;
5022
+ exports.getMarketData = getMarketData;
3987
5023
  exports.getMarketDataQueryOptions = getMarketDataQueryOptions;
3988
5024
  exports.getMarketHistoryQueryOptions = getMarketHistoryQueryOptions;
3989
5025
  exports.getMarketStatisticsQueryOptions = getMarketStatisticsQueryOptions;
3990
5026
  exports.getMutedUsersQueryOptions = getMutedUsersQueryOptions;
5027
+ exports.getNormalizePostQueryOptions = getNormalizePostQueryOptions;
5028
+ exports.getNotificationSetting = getNotificationSetting;
5029
+ exports.getNotifications = getNotifications;
3991
5030
  exports.getNotificationsInfiniteQueryOptions = getNotificationsInfiniteQueryOptions;
3992
5031
  exports.getNotificationsSettingsQueryOptions = getNotificationsSettingsQueryOptions;
3993
5032
  exports.getNotificationsUnreadCountQueryOptions = getNotificationsUnreadCountQueryOptions;
@@ -3996,12 +5035,19 @@ exports.getOrderBookQueryOptions = getOrderBookQueryOptions;
3996
5035
  exports.getOutgoingRcDelegationsInfiniteQueryOptions = getOutgoingRcDelegationsInfiniteQueryOptions;
3997
5036
  exports.getPageStatsQueryOptions = getPageStatsQueryOptions;
3998
5037
  exports.getPointsQueryOptions = getPointsQueryOptions;
5038
+ exports.getPost = getPost;
5039
+ exports.getPostHeader = getPostHeader;
3999
5040
  exports.getPostHeaderQueryOptions = getPostHeaderQueryOptions;
4000
5041
  exports.getPostQueryOptions = getPostQueryOptions;
4001
5042
  exports.getPostTipsQueryOptions = getPostTipsQueryOptions;
4002
5043
  exports.getPostingKey = getPostingKey;
5044
+ exports.getPostsRanked = getPostsRanked;
4003
5045
  exports.getPostsRankedInfiniteQueryOptions = getPostsRankedInfiniteQueryOptions;
5046
+ exports.getPostsRankedQueryOptions = getPostsRankedQueryOptions;
5047
+ exports.getProfiles = getProfiles;
5048
+ exports.getProfilesQueryOptions = getProfilesQueryOptions;
4004
5049
  exports.getPromotePriceQueryOptions = getPromotePriceQueryOptions;
5050
+ exports.getPromotedPost = getPromotedPost;
4005
5051
  exports.getPromotedPostsQuery = getPromotedPostsQuery;
4006
5052
  exports.getProposalQueryOptions = getProposalQueryOptions;
4007
5053
  exports.getProposalVotesInfiniteQueryOptions = getProposalVotesInfiniteQueryOptions;
@@ -4013,6 +5059,7 @@ exports.getReceivedVestingSharesQueryOptions = getReceivedVestingSharesQueryOpti
4013
5059
  exports.getReferralsInfiniteQueryOptions = getReferralsInfiniteQueryOptions;
4014
5060
  exports.getReferralsStatsQueryOptions = getReferralsStatsQueryOptions;
4015
5061
  exports.getRefreshToken = getRefreshToken;
5062
+ exports.getRelationshipBetweenAccounts = getRelationshipBetweenAccounts;
4016
5063
  exports.getRelationshipBetweenAccountsQueryOptions = getRelationshipBetweenAccountsQueryOptions;
4017
5064
  exports.getRewardedCommunitiesQueryOptions = getRewardedCommunitiesQueryOptions;
4018
5065
  exports.getSavingsWithdrawFromQueryOptions = getSavingsWithdrawFromQueryOptions;
@@ -4025,6 +5072,9 @@ exports.getSearchPathQueryOptions = getSearchPathQueryOptions;
4025
5072
  exports.getSearchTopicsQueryOptions = getSearchTopicsQueryOptions;
4026
5073
  exports.getSimilarEntriesQueryOptions = getSimilarEntriesQueryOptions;
4027
5074
  exports.getStatsQueryOptions = getStatsQueryOptions;
5075
+ exports.getSubscribers = getSubscribers;
5076
+ exports.getSubscriptions = getSubscriptions;
5077
+ exports.getTradeHistoryQueryOptions = getTradeHistoryQueryOptions;
4028
5078
  exports.getTransactionsInfiniteQueryOptions = getTransactionsInfiniteQueryOptions;
4029
5079
  exports.getTrendingTagsQueryOptions = getTrendingTagsQueryOptions;
4030
5080
  exports.getTrendingTagsWithStatsQueryOptions = getTrendingTagsWithStatsQueryOptions;
@@ -4038,18 +5088,35 @@ exports.getWavesFollowingQueryOptions = getWavesFollowingQueryOptions;
4038
5088
  exports.getWavesTrendingTagsQueryOptions = getWavesTrendingTagsQueryOptions;
4039
5089
  exports.getWithdrawRoutesQueryOptions = getWithdrawRoutesQueryOptions;
4040
5090
  exports.getWitnessesInfiniteQueryOptions = getWitnessesInfiniteQueryOptions;
5091
+ exports.hsTokenRenew = hsTokenRenew;
4041
5092
  exports.isCommunity = isCommunity;
4042
5093
  exports.lookupAccountsQueryOptions = lookupAccountsQueryOptions;
4043
5094
  exports.makeQueryClient = makeQueryClient;
4044
5095
  exports.mapThreadItemsToWaveEntries = mapThreadItemsToWaveEntries;
5096
+ exports.markNotifications = markNotifications;
5097
+ exports.moveSchedule = moveSchedule;
5098
+ exports.normalizePost = normalizePost;
4045
5099
  exports.normalizeWaveEntryFromApi = normalizeWaveEntryFromApi;
5100
+ exports.onboardEmail = onboardEmail;
4046
5101
  exports.parseAccounts = parseAccounts;
4047
5102
  exports.parseAsset = parseAsset;
4048
5103
  exports.parseProfileMetadata = parseProfileMetadata;
5104
+ exports.powerRechargeTime = powerRechargeTime;
5105
+ exports.rcPower = rcPower;
5106
+ exports.resolvePost = resolvePost;
4049
5107
  exports.roleMap = roleMap;
5108
+ exports.saveNotificationSetting = saveNotificationSetting;
5109
+ exports.search = search;
5110
+ exports.searchAccount = searchAccount;
5111
+ exports.searchPath = searchPath;
4050
5112
  exports.searchQueryOptions = searchQueryOptions;
5113
+ exports.searchTag = searchTag;
5114
+ exports.signUp = signUp;
4051
5115
  exports.sortDiscussions = sortDiscussions;
5116
+ exports.subscribeEmail = subscribeEmail;
4052
5117
  exports.toEntryArray = toEntryArray;
5118
+ exports.updateDraft = updateDraft;
5119
+ exports.uploadImage = uploadImage;
4053
5120
  exports.useAccountFavouriteAdd = useAccountFavouriteAdd;
4054
5121
  exports.useAccountFavouriteDelete = useAccountFavouriteDelete;
4055
5122
  exports.useAccountRelationsUpdate = useAccountRelationsUpdate;
@@ -4070,5 +5137,9 @@ exports.useRemoveFragment = useRemoveFragment;
4070
5137
  exports.useSignOperationByHivesigner = useSignOperationByHivesigner;
4071
5138
  exports.useSignOperationByKey = useSignOperationByKey;
4072
5139
  exports.useSignOperationByKeychain = useSignOperationByKeychain;
5140
+ exports.usrActivity = usrActivity;
5141
+ exports.validatePostCreating = validatePostCreating;
5142
+ exports.votingPower = votingPower;
5143
+ exports.votingValue = votingValue;
4073
5144
  //# sourceMappingURL=index.cjs.map
4074
5145
  //# sourceMappingURL=index.cjs.map