@ecency/sdk 1.5.0 → 1.5.2

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.
@@ -4,60 +4,11 @@ import hs from 'hivesigner';
4
4
  import * as R4 from 'remeda';
5
5
 
6
6
  var __defProp = Object.defineProperty;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
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 = () => {
11
+ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
61
12
  }, auth) {
62
13
  return useMutation({
63
14
  onSuccess,
@@ -68,6 +19,9 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
68
19
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
69
20
  );
70
21
  }
22
+ if (auth?.broadcast) {
23
+ return auth.broadcast(operations(payload), "posting");
24
+ }
71
25
  const postingKey = auth?.postingKey;
72
26
  if (postingKey) {
73
27
  const privateKey = PrivateKey.fromString(postingKey);
@@ -76,34 +30,12 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
76
30
  privateKey
77
31
  );
78
32
  }
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
- }
33
+ const accessToken = auth?.accessToken;
87
34
  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;
35
+ const ops2 = operations(payload);
36
+ const client = new hs.Client({ accessToken });
37
+ const response = await client.broadcast(ops2);
38
+ return response.result;
107
39
  }
108
40
  throw new Error(
109
41
  "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
@@ -111,33 +43,9 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
111
43
  }
112
44
  });
113
45
  }
114
-
115
- // src/modules/core/mock-storage.ts
116
- var MockStorage = class {
117
- constructor() {
118
- __publicField(this, "length", 0);
119
- }
120
- clear() {
121
- throw new Error("Method not implemented.");
122
- }
123
- getItem(key) {
124
- return this[key];
125
- }
126
- key(index) {
127
- return Object.keys(this)[index];
128
- }
129
- removeItem(key) {
130
- delete this[key];
131
- }
132
- setItem(key, value) {
133
- this[key] = value;
134
- }
135
- };
136
46
  var CONFIG = {
137
47
  privateApiHost: "https://ecency.com",
138
48
  imageHost: "https://images.ecency.com",
139
- storage: typeof window === "undefined" ? new MockStorage() : window.localStorage,
140
- storagePrefix: "ecency",
141
49
  hiveClient: new Client(
142
50
  [
143
51
  "https://api.hive.blog",
@@ -292,7 +200,7 @@ var ConfigManager;
292
200
  }
293
201
  ConfigManager2.setDmcaLists = setDmcaLists;
294
202
  })(ConfigManager || (ConfigManager = {}));
295
- async function broadcastJson(username, id, payload, accessToken, auth) {
203
+ async function broadcastJson(username, id, payload, auth) {
296
204
  if (!username) {
297
205
  throw new Error(
298
206
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
@@ -304,6 +212,9 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
304
212
  required_posting_auths: [username],
305
213
  json: JSON.stringify(payload)
306
214
  };
215
+ if (auth?.broadcast) {
216
+ return auth.broadcast([["custom_json", jjson]], "posting");
217
+ }
307
218
  const postingKey = auth?.postingKey;
308
219
  if (postingKey) {
309
220
  const privateKey = PrivateKey.fromString(postingKey);
@@ -312,10 +223,7 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
312
223
  privateKey
313
224
  );
314
225
  }
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
- }
226
+ const accessToken = auth?.accessToken;
319
227
  if (accessToken) {
320
228
  const response = await new hs.Client({
321
229
  accessToken
@@ -326,6 +234,63 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
326
234
  "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
327
235
  );
328
236
  }
237
+ function makeQueryClient() {
238
+ return new QueryClient({
239
+ defaultOptions: {
240
+ queries: {
241
+ // With SSR, we usually want to set some default staleTime
242
+ // above 0 to avoid refetching immediately on the client
243
+ // staleTime: 60 * 1000,
244
+ refetchOnWindowFocus: false,
245
+ refetchOnMount: false
246
+ }
247
+ }
248
+ });
249
+ }
250
+ var getQueryClient = () => CONFIG.queryClient;
251
+ var EcencyQueriesManager;
252
+ ((EcencyQueriesManager2) => {
253
+ function getQueryData(queryKey) {
254
+ const queryClient = getQueryClient();
255
+ return queryClient.getQueryData(queryKey);
256
+ }
257
+ EcencyQueriesManager2.getQueryData = getQueryData;
258
+ function getInfiniteQueryData(queryKey) {
259
+ const queryClient = getQueryClient();
260
+ return queryClient.getQueryData(queryKey);
261
+ }
262
+ EcencyQueriesManager2.getInfiniteQueryData = getInfiniteQueryData;
263
+ async function prefetchQuery(options) {
264
+ const queryClient = getQueryClient();
265
+ await queryClient.prefetchQuery(options);
266
+ return getQueryData(options.queryKey);
267
+ }
268
+ EcencyQueriesManager2.prefetchQuery = prefetchQuery;
269
+ async function prefetchInfiniteQuery(options) {
270
+ const queryClient = getQueryClient();
271
+ await queryClient.prefetchInfiniteQuery(options);
272
+ return getInfiniteQueryData(options.queryKey);
273
+ }
274
+ EcencyQueriesManager2.prefetchInfiniteQuery = prefetchInfiniteQuery;
275
+ function generateClientServerQuery(options) {
276
+ return {
277
+ prefetch: () => prefetchQuery(options),
278
+ getData: () => getQueryData(options.queryKey),
279
+ useClientQuery: () => useQuery(options),
280
+ fetchAndGet: () => getQueryClient().fetchQuery(options)
281
+ };
282
+ }
283
+ EcencyQueriesManager2.generateClientServerQuery = generateClientServerQuery;
284
+ function generateClientServerInfiniteQuery(options) {
285
+ return {
286
+ prefetch: () => prefetchInfiniteQuery(options),
287
+ getData: () => getInfiniteQueryData(options.queryKey),
288
+ useClientQuery: () => useInfiniteQuery(options),
289
+ fetchAndGet: () => getQueryClient().fetchInfiniteQuery(options)
290
+ };
291
+ }
292
+ EcencyQueriesManager2.generateClientServerInfiniteQuery = generateClientServerInfiniteQuery;
293
+ })(EcencyQueriesManager || (EcencyQueriesManager = {}));
329
294
 
330
295
  // src/modules/core/utils/decoder-encoder.ts
331
296
  function encodeObj(o) {
@@ -387,79 +352,7 @@ function isCommunity(value) {
387
352
  return typeof value === "string" ? /^hive-\d+$/.test(value) : false;
388
353
  }
389
354
 
390
- // src/modules/core/storage.ts
391
- var getUser = (username) => {
392
- try {
393
- const raw = CONFIG.storage.getItem(
394
- CONFIG.storagePrefix + "_user_" + username
395
- );
396
- return decodeObj(JSON.parse(raw));
397
- } catch (e) {
398
- console.error(e);
399
- return void 0;
400
- }
401
- };
402
- var getAccessToken = (username) => getUser(username) && getUser(username).accessToken;
403
- var getPostingKey = (username) => getUser(username) && getUser(username).postingKey;
404
- var getLoginType = (username) => getUser(username) && getUser(username).loginType;
405
- var getRefreshToken = (username) => getUser(username) && getUser(username).refreshToken;
406
- function makeQueryClient() {
407
- return new QueryClient({
408
- defaultOptions: {
409
- queries: {
410
- // With SSR, we usually want to set some default staleTime
411
- // above 0 to avoid refetching immediately on the client
412
- // staleTime: 60 * 1000,
413
- refetchOnWindowFocus: false,
414
- refetchOnMount: false
415
- }
416
- }
417
- });
418
- }
419
- var getQueryClient = () => CONFIG.queryClient;
420
- var EcencyQueriesManager;
421
- ((EcencyQueriesManager2) => {
422
- function getQueryData(queryKey) {
423
- const queryClient = getQueryClient();
424
- return queryClient.getQueryData(queryKey);
425
- }
426
- EcencyQueriesManager2.getQueryData = getQueryData;
427
- function getInfiniteQueryData(queryKey) {
428
- const queryClient = getQueryClient();
429
- return queryClient.getQueryData(queryKey);
430
- }
431
- EcencyQueriesManager2.getInfiniteQueryData = getInfiniteQueryData;
432
- async function prefetchQuery(options) {
433
- const queryClient = getQueryClient();
434
- await queryClient.prefetchQuery(options);
435
- return getQueryData(options.queryKey);
436
- }
437
- EcencyQueriesManager2.prefetchQuery = prefetchQuery;
438
- async function prefetchInfiniteQuery(options) {
439
- const queryClient = getQueryClient();
440
- await queryClient.prefetchInfiniteQuery(options);
441
- return getInfiniteQueryData(options.queryKey);
442
- }
443
- EcencyQueriesManager2.prefetchInfiniteQuery = prefetchInfiniteQuery;
444
- function generateClientServerQuery(options) {
445
- return {
446
- prefetch: () => prefetchQuery(options),
447
- getData: () => getQueryData(options.queryKey),
448
- useClientQuery: () => useQuery(options),
449
- fetchAndGet: () => getQueryClient().fetchQuery(options)
450
- };
451
- }
452
- EcencyQueriesManager2.generateClientServerQuery = generateClientServerQuery;
453
- function generateClientServerInfiniteQuery(options) {
454
- return {
455
- prefetch: () => prefetchInfiniteQuery(options),
456
- getData: () => getInfiniteQueryData(options.queryKey),
457
- useClientQuery: () => useInfiniteQuery(options),
458
- fetchAndGet: () => getQueryClient().fetchInfiniteQuery(options)
459
- };
460
- }
461
- EcencyQueriesManager2.generateClientServerInfiniteQuery = generateClientServerInfiniteQuery;
462
- })(EcencyQueriesManager || (EcencyQueriesManager = {}));
355
+ // src/modules/core/queries/get-dynamic-props-query-options.ts
463
356
  function getDynamicPropsQueryOptions() {
464
357
  return queryOptions({
465
358
  queryKey: ["core", "dynamic-props"],
@@ -714,12 +607,14 @@ function parseAccounts(rawAccounts) {
714
607
  // src/modules/accounts/queries/get-accounts-query-options.ts
715
608
  function getAccountsQueryOptions(usernames) {
716
609
  return queryOptions({
717
- queryKey: ["accounts", "get-accounts", usernames],
610
+ queryKey: ["accounts", "list", ...usernames],
611
+ enabled: usernames.length > 0,
718
612
  queryFn: async () => {
719
- const response = await CONFIG.hiveClient.database.getAccounts(usernames);
613
+ const response = await CONFIG.hiveClient.database.getAccounts(
614
+ usernames
615
+ );
720
616
  return parseAccounts(response);
721
- },
722
- enabled: usernames.length > 0
617
+ }
723
618
  });
724
619
  }
725
620
  function getFollowCountQueryOptions(username) {
@@ -990,6 +885,22 @@ function getAccountPendingRecoveryQueryOptions(username) {
990
885
  )
991
886
  });
992
887
  }
888
+ function getAccountReputationsQueryOptions(query, limit = 50) {
889
+ return queryOptions({
890
+ queryKey: ["accounts", "reputations", query, limit],
891
+ enabled: !!query,
892
+ queryFn: async () => {
893
+ if (!query) {
894
+ return [];
895
+ }
896
+ return CONFIG.hiveClient.call(
897
+ "condenser_api",
898
+ "get_account_reputations",
899
+ [query, limit]
900
+ );
901
+ }
902
+ });
903
+ }
993
904
  var ops = utils.operationOrders;
994
905
  var ACCOUNT_OPERATION_GROUPS = {
995
906
  transfers: [
@@ -1306,6 +1217,26 @@ function getEntryActiveVotesQueryOptions(entry) {
1306
1217
  enabled: !!entry
1307
1218
  });
1308
1219
  }
1220
+ function getContentQueryOptions(author, permlink) {
1221
+ return queryOptions({
1222
+ queryKey: ["posts", "content", author, permlink],
1223
+ enabled: !!author && !!permlink,
1224
+ queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content", [
1225
+ author,
1226
+ permlink
1227
+ ])
1228
+ });
1229
+ }
1230
+ function getContentRepliesQueryOptions(author, permlink) {
1231
+ return queryOptions({
1232
+ queryKey: ["posts", "content-replies", author, permlink],
1233
+ enabled: !!author && !!permlink,
1234
+ queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content_replies", {
1235
+ author,
1236
+ permlink
1237
+ })
1238
+ });
1239
+ }
1309
1240
  function getPostHeaderQueryOptions(author, permlink) {
1310
1241
  return queryOptions({
1311
1242
  queryKey: ["posts", "post-header", author, permlink],
@@ -1367,6 +1298,212 @@ function getPostQueryOptions(author, permlink, observer = "", num) {
1367
1298
  enabled: !!author && !!permlink && permlink.trim() !== "" && permlink.trim() !== "undefined"
1368
1299
  });
1369
1300
  }
1301
+
1302
+ // src/modules/bridge/requests.ts
1303
+ function bridgeApiCall(endpoint, params) {
1304
+ return CONFIG.hiveClient.call("bridge", endpoint, params);
1305
+ }
1306
+ async function resolvePost(post, observer, num) {
1307
+ const { json_metadata: json } = post;
1308
+ if (json?.original_author && json?.original_permlink && json.tags?.[0] === "cross-post") {
1309
+ try {
1310
+ const resp = await getPost(
1311
+ json.original_author,
1312
+ json.original_permlink,
1313
+ observer,
1314
+ num
1315
+ );
1316
+ if (resp) {
1317
+ return {
1318
+ ...post,
1319
+ original_entry: resp,
1320
+ num
1321
+ };
1322
+ }
1323
+ return post;
1324
+ } catch {
1325
+ return post;
1326
+ }
1327
+ }
1328
+ return { ...post, num };
1329
+ }
1330
+ async function resolvePosts(posts, observer) {
1331
+ const validatedPosts = posts.map(validateEntry);
1332
+ const resolved = await Promise.all(validatedPosts.map((p) => resolvePost(p, observer)));
1333
+ return filterDmcaEntry(resolved);
1334
+ }
1335
+ async function getPostsRanked(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "") {
1336
+ const resp = await bridgeApiCall("get_ranked_posts", {
1337
+ sort,
1338
+ start_author,
1339
+ start_permlink,
1340
+ limit,
1341
+ tag,
1342
+ observer
1343
+ });
1344
+ if (resp) {
1345
+ return resolvePosts(resp, observer);
1346
+ }
1347
+ return resp;
1348
+ }
1349
+ async function getAccountPosts(sort, account, start_author = "", start_permlink = "", limit = 20, observer = "") {
1350
+ if (CONFIG.dmcaAccounts.includes(account)) {
1351
+ return [];
1352
+ }
1353
+ const resp = await bridgeApiCall("get_account_posts", {
1354
+ sort,
1355
+ account,
1356
+ start_author,
1357
+ start_permlink,
1358
+ limit,
1359
+ observer
1360
+ });
1361
+ if (resp) {
1362
+ return resolvePosts(resp, observer);
1363
+ }
1364
+ return resp;
1365
+ }
1366
+ function validateEntry(entry) {
1367
+ const newEntry = {
1368
+ ...entry,
1369
+ active_votes: Array.isArray(entry.active_votes) ? [...entry.active_votes] : [],
1370
+ beneficiaries: Array.isArray(entry.beneficiaries) ? [...entry.beneficiaries] : [],
1371
+ blacklists: Array.isArray(entry.blacklists) ? [...entry.blacklists] : [],
1372
+ replies: Array.isArray(entry.replies) ? [...entry.replies] : [],
1373
+ stats: entry.stats ? { ...entry.stats } : null
1374
+ };
1375
+ const requiredStringProps = [
1376
+ "author",
1377
+ "title",
1378
+ "body",
1379
+ "created",
1380
+ "category",
1381
+ "permlink",
1382
+ "url",
1383
+ "updated"
1384
+ ];
1385
+ for (const prop of requiredStringProps) {
1386
+ if (newEntry[prop] == null) {
1387
+ newEntry[prop] = "";
1388
+ }
1389
+ }
1390
+ if (newEntry.author_reputation == null) {
1391
+ newEntry.author_reputation = 0;
1392
+ }
1393
+ if (newEntry.children == null) {
1394
+ newEntry.children = 0;
1395
+ }
1396
+ if (newEntry.depth == null) {
1397
+ newEntry.depth = 0;
1398
+ }
1399
+ if (newEntry.net_rshares == null) {
1400
+ newEntry.net_rshares = 0;
1401
+ }
1402
+ if (newEntry.payout == null) {
1403
+ newEntry.payout = 0;
1404
+ }
1405
+ if (newEntry.percent_hbd == null) {
1406
+ newEntry.percent_hbd = 0;
1407
+ }
1408
+ if (!newEntry.stats) {
1409
+ newEntry.stats = {
1410
+ flag_weight: 0,
1411
+ gray: false,
1412
+ hide: false,
1413
+ total_votes: 0
1414
+ };
1415
+ }
1416
+ if (newEntry.author_payout_value == null) {
1417
+ newEntry.author_payout_value = "0.000 HBD";
1418
+ }
1419
+ if (newEntry.curator_payout_value == null) {
1420
+ newEntry.curator_payout_value = "0.000 HBD";
1421
+ }
1422
+ if (newEntry.max_accepted_payout == null) {
1423
+ newEntry.max_accepted_payout = "1000000.000 HBD";
1424
+ }
1425
+ if (newEntry.payout_at == null) {
1426
+ newEntry.payout_at = "";
1427
+ }
1428
+ if (newEntry.pending_payout_value == null) {
1429
+ newEntry.pending_payout_value = "0.000 HBD";
1430
+ }
1431
+ if (newEntry.promoted == null) {
1432
+ newEntry.promoted = "0.000 HBD";
1433
+ }
1434
+ if (newEntry.is_paidout == null) {
1435
+ newEntry.is_paidout = false;
1436
+ }
1437
+ return newEntry;
1438
+ }
1439
+ async function getPost(author = "", permlink = "", observer = "", num) {
1440
+ const resp = await bridgeApiCall("get_post", {
1441
+ author,
1442
+ permlink,
1443
+ observer
1444
+ });
1445
+ if (resp) {
1446
+ const validatedEntry = validateEntry(resp);
1447
+ const post = await resolvePost(validatedEntry, observer, num);
1448
+ return filterDmcaEntry(post);
1449
+ }
1450
+ return void 0;
1451
+ }
1452
+ async function getPostHeader(author = "", permlink = "") {
1453
+ const resp = await bridgeApiCall("get_post_header", {
1454
+ author,
1455
+ permlink
1456
+ });
1457
+ return resp ? validateEntry(resp) : resp;
1458
+ }
1459
+ async function getDiscussion(author, permlink, observer) {
1460
+ const resp = await bridgeApiCall("get_discussion", {
1461
+ author,
1462
+ permlink,
1463
+ observer: observer || author
1464
+ });
1465
+ if (resp) {
1466
+ const validatedResp = {};
1467
+ for (const [key, entry] of Object.entries(resp)) {
1468
+ validatedResp[key] = validateEntry(entry);
1469
+ }
1470
+ return validatedResp;
1471
+ }
1472
+ return resp;
1473
+ }
1474
+ async function getCommunity(name, observer = "") {
1475
+ return bridgeApiCall("get_community", { name, observer });
1476
+ }
1477
+ async function getCommunities(last = "", limit = 100, query, sort = "rank", observer = "") {
1478
+ return bridgeApiCall("list_communities", {
1479
+ last,
1480
+ limit,
1481
+ query,
1482
+ sort,
1483
+ observer
1484
+ });
1485
+ }
1486
+ async function normalizePost(post) {
1487
+ const resp = await bridgeApiCall("normalize_post", { post });
1488
+ return resp ? validateEntry(resp) : resp;
1489
+ }
1490
+ async function getSubscriptions(account) {
1491
+ return bridgeApiCall("list_all_subscriptions", { account });
1492
+ }
1493
+ async function getSubscribers(community) {
1494
+ return bridgeApiCall("list_subscribers", { community });
1495
+ }
1496
+ async function getRelationshipBetweenAccounts(follower, following) {
1497
+ return bridgeApiCall("get_relationship_between_accounts", [
1498
+ follower,
1499
+ following
1500
+ ]);
1501
+ }
1502
+ async function getProfiles(accounts, observer) {
1503
+ return bridgeApiCall("get_profiles", { accounts, observer });
1504
+ }
1505
+
1506
+ // src/modules/posts/queries/get-discussions-query-options.ts
1370
1507
  var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
1371
1508
  SortOrder2["trending"] = "trending";
1372
1509
  SortOrder2["author_reputation"] = "author_reputation";
@@ -1464,6 +1601,13 @@ function getDiscussionsQueryOptions(entry, order = "created" /* created */, enab
1464
1601
  select: (data) => sortDiscussions(entry, data, order)
1465
1602
  });
1466
1603
  }
1604
+ function getDiscussionQueryOptions(author, permlink, observer, enabled = true) {
1605
+ return queryOptions({
1606
+ queryKey: ["posts", "discussion", author, permlink, observer || author],
1607
+ enabled: enabled && !!author && !!permlink,
1608
+ queryFn: async () => getDiscussion(author, permlink, observer)
1609
+ });
1610
+ }
1467
1611
  function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit = 20, observer = "", enabled = true) {
1468
1612
  return infiniteQueryOptions({
1469
1613
  queryKey: ["posts", "account-posts", username ?? "", filter, limit, observer],
@@ -1513,6 +1657,35 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
1513
1657
  }
1514
1658
  });
1515
1659
  }
1660
+ function getAccountPostsQueryOptions(username, filter = "posts", start_author = "", start_permlink = "", limit = 20, observer = "", enabled = true) {
1661
+ return queryOptions({
1662
+ queryKey: [
1663
+ "posts",
1664
+ "account-posts-page",
1665
+ username ?? "",
1666
+ filter,
1667
+ start_author,
1668
+ start_permlink,
1669
+ limit,
1670
+ observer
1671
+ ],
1672
+ enabled: !!username && enabled,
1673
+ queryFn: async () => {
1674
+ if (!username) {
1675
+ return [];
1676
+ }
1677
+ const response = await getAccountPosts(
1678
+ filter,
1679
+ username,
1680
+ start_author,
1681
+ start_permlink,
1682
+ limit,
1683
+ observer
1684
+ );
1685
+ return filterDmcaEntry(response ?? []);
1686
+ }
1687
+ });
1688
+ }
1516
1689
  function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = "", enabled = true, _options = {}) {
1517
1690
  return infiniteQueryOptions({
1518
1691
  queryKey: ["posts", "posts-ranked", sort, tag, limit, observer],
@@ -1560,6 +1733,36 @@ function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = ""
1560
1733
  }
1561
1734
  });
1562
1735
  }
1736
+ function getPostsRankedQueryOptions(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "", enabled = true) {
1737
+ return queryOptions({
1738
+ queryKey: [
1739
+ "posts",
1740
+ "posts-ranked-page",
1741
+ sort,
1742
+ start_author,
1743
+ start_permlink,
1744
+ limit,
1745
+ tag,
1746
+ observer
1747
+ ],
1748
+ enabled,
1749
+ queryFn: async () => {
1750
+ let sanitizedTag = tag;
1751
+ if (CONFIG.dmcaTagRegexes.some((regex) => regex.test(tag))) {
1752
+ sanitizedTag = "";
1753
+ }
1754
+ const response = await getPostsRanked(
1755
+ sort,
1756
+ start_author,
1757
+ start_permlink,
1758
+ limit,
1759
+ sanitizedTag,
1760
+ observer
1761
+ );
1762
+ return filterDmcaEntry(response ?? []);
1763
+ }
1764
+ });
1765
+ }
1563
1766
  function getReblogsQueryOptions(username, activeUsername, limit = 200) {
1564
1767
  return queryOptions({
1565
1768
  queryKey: ["posts", "reblogs", username ?? "", limit],
@@ -1797,8 +2000,8 @@ function toEntryArray(x) {
1797
2000
  return Array.isArray(x) ? x : [];
1798
2001
  }
1799
2002
  async function getVisibleFirstLevelThreadItems(container) {
1800
- const queryOptions76 = getDiscussionsQueryOptions(container, "created" /* created */, true);
1801
- const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions76);
2003
+ const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
2004
+ const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
1802
2005
  const discussionItems = toEntryArray(discussionItemsRaw);
1803
2006
  if (discussionItems.length <= 1) {
1804
2007
  return [];
@@ -2007,6 +2210,18 @@ function getWavesTrendingTagsQueryOptions(host, hours = 24) {
2007
2210
  }
2008
2211
  });
2009
2212
  }
2213
+ function getNormalizePostQueryOptions(post, enabled = true) {
2214
+ return queryOptions({
2215
+ queryKey: [
2216
+ "posts",
2217
+ "normalize",
2218
+ post?.author ?? "",
2219
+ post?.permlink ?? ""
2220
+ ],
2221
+ enabled: enabled && !!post,
2222
+ queryFn: async () => normalizePost(post)
2223
+ });
2224
+ }
2010
2225
 
2011
2226
  // src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts
2012
2227
  function isEntry(x) {
@@ -2057,15 +2272,21 @@ function getAccountVoteHistoryInfiniteQueryOptions(username, options) {
2057
2272
  })
2058
2273
  });
2059
2274
  }
2275
+ function getProfilesQueryOptions(accounts, observer, enabled = true) {
2276
+ return queryOptions({
2277
+ queryKey: ["accounts", "profiles", accounts, observer ?? ""],
2278
+ enabled: enabled && accounts.length > 0,
2279
+ queryFn: async () => getProfiles(accounts, observer)
2280
+ });
2281
+ }
2060
2282
 
2061
2283
  // src/modules/accounts/mutations/use-account-update.ts
2062
- function useAccountUpdate(username, accessToken, auth) {
2284
+ function useAccountUpdate(username, auth) {
2063
2285
  const queryClient = useQueryClient();
2064
2286
  const { data } = useQuery(getAccountFullQueryOptions(username));
2065
2287
  return useBroadcastMutation(
2066
2288
  ["accounts", "update"],
2067
2289
  username,
2068
- accessToken,
2069
2290
  (payload) => {
2070
2291
  if (!data) {
2071
2292
  throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
@@ -2107,7 +2328,7 @@ function useAccountUpdate(username, accessToken, auth) {
2107
2328
  auth
2108
2329
  );
2109
2330
  }
2110
- function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
2331
+ function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError) {
2111
2332
  return useMutation({
2112
2333
  mutationKey: ["accounts", "relation", "update", reference, target],
2113
2334
  mutationFn: async (kind) => {
@@ -2119,17 +2340,22 @@ function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
2119
2340
  const actualRelation = getQueryClient().getQueryData(
2120
2341
  relationsQuery.queryKey
2121
2342
  );
2122
- await broadcastJson(reference, "follow", [
2343
+ await broadcastJson(
2344
+ reference,
2123
2345
  "follow",
2124
- {
2125
- follower: reference,
2126
- following: target,
2127
- what: [
2128
- ...kind === "toggle-ignore" && !actualRelation?.ignores ? ["ignore"] : [],
2129
- ...kind === "toggle-follow" && !actualRelation?.follows ? ["blog"] : []
2130
- ]
2131
- }
2132
- ]);
2346
+ [
2347
+ "follow",
2348
+ {
2349
+ follower: reference,
2350
+ following: target,
2351
+ what: [
2352
+ ...kind === "toggle-ignore" && !actualRelation?.ignores ? ["ignore"] : [],
2353
+ ...kind === "toggle-follow" && !actualRelation?.follows ? ["blog"] : []
2354
+ ]
2355
+ }
2356
+ ],
2357
+ auth
2358
+ );
2133
2359
  return {
2134
2360
  ...actualRelation,
2135
2361
  ignores: kind === "toggle-ignore" ? !actualRelation?.ignores : actualRelation?.ignores,
@@ -2356,7 +2582,7 @@ function useAccountUpdatePassword(username, options) {
2356
2582
  ...options
2357
2583
  });
2358
2584
  }
2359
- function useAccountRevokePosting(username, options) {
2585
+ function useAccountRevokePosting(username, options, auth) {
2360
2586
  const queryClient = useQueryClient();
2361
2587
  const { data } = useQuery(getAccountFullQueryOptions(username));
2362
2588
  return useMutation({
@@ -2383,11 +2609,10 @@ function useAccountRevokePosting(username, options) {
2383
2609
  if (type === "key" && key) {
2384
2610
  return CONFIG.hiveClient.broadcast.updateAccount(operationBody, key);
2385
2611
  } else if (type === "keychain") {
2386
- return keychain_exports.broadcast(
2387
- data.name,
2388
- [["account_update", operationBody]],
2389
- "Active"
2390
- );
2612
+ if (!auth?.broadcast) {
2613
+ throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
2614
+ }
2615
+ return auth.broadcast([["account_update", operationBody]], "active");
2391
2616
  } else {
2392
2617
  const params = {
2393
2618
  callback: `https://ecency.com/@${data.name}/permissions`
@@ -2418,7 +2643,7 @@ function useAccountRevokePosting(username, options) {
2418
2643
  }
2419
2644
  });
2420
2645
  }
2421
- function useAccountUpdateRecovery(username, code, options) {
2646
+ function useAccountUpdateRecovery(username, code, options, auth) {
2422
2647
  const { data } = useQuery(getAccountFullQueryOptions(username));
2423
2648
  return useMutation({
2424
2649
  mutationKey: ["accounts", "recovery", data?.name],
@@ -2457,11 +2682,10 @@ function useAccountUpdateRecovery(username, code, options) {
2457
2682
  key
2458
2683
  );
2459
2684
  } else if (type === "keychain") {
2460
- return keychain_exports.broadcast(
2461
- data.name,
2462
- [["change_recovery_account", operationBody]],
2463
- "Active"
2464
- );
2685
+ if (!auth?.broadcast) {
2686
+ throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
2687
+ }
2688
+ return auth.broadcast([["change_recovery_account", operationBody]], "owner");
2465
2689
  } else {
2466
2690
  const params = {
2467
2691
  callback: `https://ecency.com/@${data.name}/permissions`
@@ -2510,6 +2734,152 @@ function useAccountRevokeKey(username, options) {
2510
2734
  ...options
2511
2735
  });
2512
2736
  }
2737
+
2738
+ // src/modules/accounts/utils/account-power.ts
2739
+ var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
2740
+ function vestsToRshares(vests, votingPowerValue, votePerc) {
2741
+ const vestingShares = vests * 1e6;
2742
+ const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
2743
+ return power * vestingShares / 1e4;
2744
+ }
2745
+ function toDhiveAccountForVotingMana(account) {
2746
+ return {
2747
+ id: 0,
2748
+ name: account.name,
2749
+ owner: account.owner,
2750
+ active: account.active,
2751
+ posting: account.posting,
2752
+ memo_key: account.memo_key,
2753
+ json_metadata: account.json_metadata,
2754
+ posting_json_metadata: account.posting_json_metadata,
2755
+ proxy: account.proxy ?? "",
2756
+ last_owner_update: "",
2757
+ last_account_update: "",
2758
+ created: account.created,
2759
+ mined: false,
2760
+ owner_challenged: false,
2761
+ active_challenged: false,
2762
+ last_owner_proved: "",
2763
+ last_active_proved: "",
2764
+ recovery_account: account.recovery_account ?? "",
2765
+ reset_account: "",
2766
+ last_account_recovery: "",
2767
+ comment_count: 0,
2768
+ lifetime_vote_count: 0,
2769
+ post_count: account.post_count,
2770
+ can_vote: true,
2771
+ voting_power: account.voting_power,
2772
+ last_vote_time: account.last_vote_time,
2773
+ voting_manabar: account.voting_manabar,
2774
+ balance: account.balance,
2775
+ savings_balance: account.savings_balance,
2776
+ hbd_balance: account.hbd_balance,
2777
+ hbd_seconds: "0",
2778
+ hbd_seconds_last_update: "",
2779
+ hbd_last_interest_payment: "",
2780
+ savings_hbd_balance: account.savings_hbd_balance,
2781
+ savings_hbd_seconds: account.savings_hbd_seconds,
2782
+ savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
2783
+ savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
2784
+ savings_withdraw_requests: 0,
2785
+ reward_hbd_balance: account.reward_hbd_balance,
2786
+ reward_hive_balance: account.reward_hive_balance,
2787
+ reward_vesting_balance: account.reward_vesting_balance,
2788
+ reward_vesting_hive: account.reward_vesting_hive,
2789
+ curation_rewards: 0,
2790
+ posting_rewards: 0,
2791
+ vesting_shares: account.vesting_shares,
2792
+ delegated_vesting_shares: account.delegated_vesting_shares,
2793
+ received_vesting_shares: account.received_vesting_shares,
2794
+ vesting_withdraw_rate: account.vesting_withdraw_rate,
2795
+ next_vesting_withdrawal: account.next_vesting_withdrawal,
2796
+ withdrawn: account.withdrawn,
2797
+ to_withdraw: account.to_withdraw,
2798
+ withdraw_routes: 0,
2799
+ proxied_vsf_votes: account.proxied_vsf_votes ?? [],
2800
+ witnesses_voted_for: 0,
2801
+ average_bandwidth: 0,
2802
+ lifetime_bandwidth: 0,
2803
+ last_bandwidth_update: "",
2804
+ average_market_bandwidth: 0,
2805
+ lifetime_market_bandwidth: 0,
2806
+ last_market_bandwidth_update: "",
2807
+ last_post: account.last_post,
2808
+ last_root_post: ""
2809
+ };
2810
+ }
2811
+ function votingPower(account) {
2812
+ const calc = CONFIG.hiveClient.rc.calculateVPMana(
2813
+ toDhiveAccountForVotingMana(account)
2814
+ );
2815
+ return calc.percentage / 100;
2816
+ }
2817
+ function powerRechargeTime(power) {
2818
+ if (!Number.isFinite(power)) {
2819
+ throw new TypeError("Voting power must be a finite number");
2820
+ }
2821
+ if (power < 0 || power > 100) {
2822
+ throw new RangeError("Voting power must be between 0 and 100");
2823
+ }
2824
+ const missingPower = 100 - power;
2825
+ return missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS / 1e4;
2826
+ }
2827
+ function downVotingPower(account) {
2828
+ const totalShares = parseFloat(account.vesting_shares) + parseFloat(account.received_vesting_shares) - parseFloat(account.delegated_vesting_shares);
2829
+ const elapsed = Math.floor(Date.now() / 1e3) - account.downvote_manabar.last_update_time;
2830
+ const maxMana = totalShares * 1e6 / 4;
2831
+ if (maxMana <= 0) {
2832
+ return 0;
2833
+ }
2834
+ let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
2835
+ if (currentMana > maxMana) {
2836
+ currentMana = maxMana;
2837
+ }
2838
+ const currentManaPerc = currentMana * 100 / maxMana;
2839
+ if (isNaN(currentManaPerc)) {
2840
+ return 0;
2841
+ }
2842
+ if (currentManaPerc > 100) {
2843
+ return 100;
2844
+ }
2845
+ return currentManaPerc;
2846
+ }
2847
+ function rcPower(account) {
2848
+ const calc = CONFIG.hiveClient.rc.calculateRCMana(account);
2849
+ return calc.percentage / 100;
2850
+ }
2851
+ function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
2852
+ if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {
2853
+ return 0;
2854
+ }
2855
+ const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;
2856
+ if (!Number.isFinite(fundRecentClaims) || !Number.isFinite(fundRewardBalance) || !Number.isFinite(base) || !Number.isFinite(quote)) {
2857
+ return 0;
2858
+ }
2859
+ if (fundRecentClaims === 0 || quote === 0) {
2860
+ return 0;
2861
+ }
2862
+ let totalVests = 0;
2863
+ try {
2864
+ const vesting = parseAsset(account.vesting_shares).amount;
2865
+ const received = parseAsset(account.received_vesting_shares).amount;
2866
+ const delegated = parseAsset(account.delegated_vesting_shares).amount;
2867
+ if (![vesting, received, delegated].every(Number.isFinite)) {
2868
+ return 0;
2869
+ }
2870
+ totalVests = vesting + received - delegated;
2871
+ } catch {
2872
+ return 0;
2873
+ }
2874
+ if (!Number.isFinite(totalVests)) {
2875
+ return 0;
2876
+ }
2877
+ const rShares = vestsToRshares(totalVests, votingPowerValue, weight);
2878
+ if (!Number.isFinite(rShares)) {
2879
+ return 0;
2880
+ }
2881
+ return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
2882
+ }
2513
2883
  function useSignOperationByKey(username) {
2514
2884
  return useMutation({
2515
2885
  mutationKey: ["operations", "sign", username],
@@ -2535,7 +2905,7 @@ function useSignOperationByKey(username) {
2535
2905
  }
2536
2906
  });
2537
2907
  }
2538
- function useSignOperationByKeychain(username, keyType = "Active") {
2908
+ function useSignOperationByKeychain(username, auth, keyType = "active") {
2539
2909
  return useMutation({
2540
2910
  mutationKey: ["operations", "sign-keychain", username],
2541
2911
  mutationFn: ({ operation }) => {
@@ -2544,7 +2914,10 @@ function useSignOperationByKeychain(username, keyType = "Active") {
2544
2914
  "[SDK][Keychain] \u2013\xA0cannot sign operation with anon user"
2545
2915
  );
2546
2916
  }
2547
- return keychain_exports.broadcast(username, [operation], keyType);
2917
+ if (!auth?.broadcast) {
2918
+ throw new Error("[SDK][Keychain] \u2013 missing keychain broadcaster");
2919
+ }
2920
+ return auth.broadcast([operation], keyType);
2548
2921
  }
2549
2922
  });
2550
2923
  }
@@ -2667,6 +3040,33 @@ function useRemoveFragment(username, fragmentId, code) {
2667
3040
  });
2668
3041
  }
2669
3042
 
3043
+ // src/modules/posts/utils/validate-post-creating.ts
3044
+ var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
3045
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3046
+ async function getContent(author, permlink) {
3047
+ return CONFIG.hiveClient.call("condenser_api", "get_content", [
3048
+ author,
3049
+ permlink
3050
+ ]);
3051
+ }
3052
+ async function validatePostCreating(author, permlink, attempts = 0, options) {
3053
+ const delays = options?.delays ?? DEFAULT_VALIDATE_POST_DELAYS;
3054
+ let response;
3055
+ try {
3056
+ response = await getContent(author, permlink);
3057
+ } catch (e) {
3058
+ response = void 0;
3059
+ }
3060
+ if (response || attempts >= delays.length) {
3061
+ return;
3062
+ }
3063
+ const waitMs = delays[attempts];
3064
+ if (waitMs > 0) {
3065
+ await delay(waitMs);
3066
+ }
3067
+ return validatePostCreating(author, permlink, attempts + 1, options);
3068
+ }
3069
+
2670
3070
  // src/modules/analytics/mutations/index.ts
2671
3071
  var mutations_exports = {};
2672
3072
  __export(mutations_exports, {
@@ -3055,6 +3455,13 @@ function getCommunityContextQueryOptions(username, communityName) {
3055
3455
  }
3056
3456
  });
3057
3457
  }
3458
+ function getCommunityQueryOptions(name, observer = "", enabled = true) {
3459
+ return queryOptions({
3460
+ queryKey: ["community", "single", name, observer],
3461
+ enabled: enabled && !!name,
3462
+ queryFn: async () => getCommunity(name ?? "", observer)
3463
+ });
3464
+ }
3058
3465
  function getCommunitySubscribersQueryOptions(communityName) {
3059
3466
  return queryOptions({
3060
3467
  queryKey: ["communities", "subscribers", communityName],
@@ -3497,6 +3904,25 @@ function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
3497
3904
  getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
3498
3905
  });
3499
3906
  }
3907
+ function getIncomingRcQueryOptions(username) {
3908
+ return queryOptions({
3909
+ queryKey: ["wallet", "incoming-rc", username],
3910
+ enabled: !!username,
3911
+ queryFn: async () => {
3912
+ if (!username) {
3913
+ throw new Error("[SDK][Wallet] - Missing username for incoming RC");
3914
+ }
3915
+ const fetchApi = getBoundFetch();
3916
+ const response = await fetchApi(
3917
+ `${CONFIG.privateApiHost}/private-api/received-rc/${username}`
3918
+ );
3919
+ if (!response.ok) {
3920
+ throw new Error(`Failed to fetch incoming RC: ${response.status}`);
3921
+ }
3922
+ return response.json();
3923
+ }
3924
+ });
3925
+ }
3500
3926
  function getReceivedVestingSharesQueryOptions(username) {
3501
3927
  return queryOptions({
3502
3928
  queryKey: ["wallet", "received-vesting-shares", username],
@@ -3541,15 +3967,15 @@ function getMarketStatisticsQueryOptions() {
3541
3967
  });
3542
3968
  }
3543
3969
  function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
3544
- const formatDate = (date) => {
3970
+ const formatDate2 = (date) => {
3545
3971
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3546
3972
  };
3547
3973
  return queryOptions({
3548
3974
  queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
3549
3975
  queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
3550
3976
  seconds,
3551
- formatDate(startDate),
3552
- formatDate(endDate)
3977
+ formatDate2(startDate),
3978
+ formatDate2(endDate)
3553
3979
  ])
3554
3980
  });
3555
3981
  }
@@ -3564,13 +3990,13 @@ function getHiveHbdStatsQueryOptions() {
3564
3990
  );
3565
3991
  const now = /* @__PURE__ */ new Date();
3566
3992
  const oneDayAgo = new Date(now.getTime() - 864e5);
3567
- const formatDate = (date) => {
3993
+ const formatDate2 = (date) => {
3568
3994
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3569
3995
  };
3570
3996
  const dayChange = await CONFIG.hiveClient.call(
3571
3997
  "condenser_api",
3572
3998
  "get_market_history",
3573
- [86400, formatDate(oneDayAgo), formatDate(now)]
3999
+ [86400, formatDate2(oneDayAgo), formatDate2(now)]
3574
4000
  );
3575
4001
  const result = {
3576
4002
  price: +stats.latest,
@@ -3599,6 +4025,21 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
3599
4025
  }
3600
4026
  });
3601
4027
  }
4028
+ function formatDate(date) {
4029
+ return date.toISOString().replace(/\.\d{3}Z$/, "");
4030
+ }
4031
+ function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
4032
+ const end = endDate ?? /* @__PURE__ */ new Date();
4033
+ const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
4034
+ return queryOptions({
4035
+ queryKey: ["market", "trade-history", limit, start.getTime(), end.getTime()],
4036
+ queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_trade_history", [
4037
+ formatDate(start),
4038
+ formatDate(end),
4039
+ limit
4040
+ ])
4041
+ });
4042
+ }
3602
4043
 
3603
4044
  // src/modules/market/requests.ts
3604
4045
  async function parseJsonResponse(response) {
@@ -3639,6 +4080,13 @@ async function getCurrencyRates() {
3639
4080
  const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
3640
4081
  return parseJsonResponse(response);
3641
4082
  }
4083
+ async function getHivePrice() {
4084
+ const fetchApi = getBoundFetch();
4085
+ const response = await fetchApi(
4086
+ "https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd"
4087
+ );
4088
+ return parseJsonResponse(response);
4089
+ }
3642
4090
  function getPointsQueryOptions(username, filter = 0) {
3643
4091
  return queryOptions({
3644
4092
  queryKey: ["points", username, filter],
@@ -3909,6 +4357,89 @@ function getSearchPathQueryOptions(q) {
3909
4357
  }
3910
4358
  });
3911
4359
  }
4360
+
4361
+ // src/modules/search/requests.ts
4362
+ async function parseJsonResponse2(response) {
4363
+ const parseBody = async () => {
4364
+ try {
4365
+ return await response.json();
4366
+ } catch {
4367
+ try {
4368
+ return await response.text();
4369
+ } catch {
4370
+ return void 0;
4371
+ }
4372
+ }
4373
+ };
4374
+ const data = await parseBody();
4375
+ if (!response.ok) {
4376
+ const error = new Error(`Request failed with status ${response.status}`);
4377
+ error.status = response.status;
4378
+ error.data = data;
4379
+ throw error;
4380
+ }
4381
+ if (data === void 0) {
4382
+ throw new Error("Response body was empty or invalid JSON");
4383
+ }
4384
+ return data;
4385
+ }
4386
+ async function search(q, sort, hideLow, since, scroll_id, votes) {
4387
+ const data = { q, sort, hide_low: hideLow };
4388
+ if (since) {
4389
+ data.since = since;
4390
+ }
4391
+ if (scroll_id) {
4392
+ data.scroll_id = scroll_id;
4393
+ }
4394
+ if (votes) {
4395
+ data.votes = votes;
4396
+ }
4397
+ const fetchApi = getBoundFetch();
4398
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search", {
4399
+ method: "POST",
4400
+ headers: {
4401
+ "Content-Type": "application/json"
4402
+ },
4403
+ body: JSON.stringify(data)
4404
+ });
4405
+ return parseJsonResponse2(response);
4406
+ }
4407
+ async function searchAccount(q = "", limit = 20, random = 1) {
4408
+ const data = { q, limit, random };
4409
+ const fetchApi = getBoundFetch();
4410
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-account", {
4411
+ method: "POST",
4412
+ headers: {
4413
+ "Content-Type": "application/json"
4414
+ },
4415
+ body: JSON.stringify(data)
4416
+ });
4417
+ return parseJsonResponse2(response);
4418
+ }
4419
+ async function searchTag(q = "", limit = 20, random = 0) {
4420
+ const data = { q, limit, random };
4421
+ const fetchApi = getBoundFetch();
4422
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-tag", {
4423
+ method: "POST",
4424
+ headers: {
4425
+ "Content-Type": "application/json"
4426
+ },
4427
+ body: JSON.stringify(data)
4428
+ });
4429
+ return parseJsonResponse2(response);
4430
+ }
4431
+ async function searchPath(q) {
4432
+ const fetchApi = getBoundFetch();
4433
+ const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-path", {
4434
+ method: "POST",
4435
+ headers: {
4436
+ "Content-Type": "application/json"
4437
+ },
4438
+ body: JSON.stringify({ q })
4439
+ });
4440
+ const data = await parseJsonResponse2(response);
4441
+ return data?.length > 0 ? data : [q];
4442
+ }
3912
4443
  function getBoostPlusPricesQueryOptions(accessToken) {
3913
4444
  return queryOptions({
3914
4445
  queryKey: ["promotions", "boost-plus-prices"],
@@ -3980,7 +4511,7 @@ function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
3980
4511
  }
3981
4512
 
3982
4513
  // src/modules/private-api/requests.ts
3983
- async function parseJsonResponse2(response) {
4514
+ async function parseJsonResponse3(response) {
3984
4515
  if (!response.ok) {
3985
4516
  let errorData = void 0;
3986
4517
  try {
@@ -4004,7 +4535,7 @@ async function signUp(username, email, referral) {
4004
4535
  },
4005
4536
  body: JSON.stringify({ username, email, referral })
4006
4537
  });
4007
- const data = await parseJsonResponse2(response);
4538
+ const data = await parseJsonResponse3(response);
4008
4539
  return { status: response.status, data };
4009
4540
  }
4010
4541
  async function subscribeEmail(email) {
@@ -4016,7 +4547,7 @@ async function subscribeEmail(email) {
4016
4547
  },
4017
4548
  body: JSON.stringify({ email })
4018
4549
  });
4019
- const data = await parseJsonResponse2(response);
4550
+ const data = await parseJsonResponse3(response);
4020
4551
  return { status: response.status, data };
4021
4552
  }
4022
4553
  async function usrActivity(code, ty, bl = "", tx = "") {
@@ -4035,7 +4566,7 @@ async function usrActivity(code, ty, bl = "", tx = "") {
4035
4566
  },
4036
4567
  body: JSON.stringify(params)
4037
4568
  });
4038
- await parseJsonResponse2(response);
4569
+ await parseJsonResponse3(response);
4039
4570
  }
4040
4571
  async function getNotifications(code, filter, since = null, user = null) {
4041
4572
  const data = {
@@ -4058,7 +4589,7 @@ async function getNotifications(code, filter, since = null, user = null) {
4058
4589
  },
4059
4590
  body: JSON.stringify(data)
4060
4591
  });
4061
- return parseJsonResponse2(response);
4592
+ return parseJsonResponse3(response);
4062
4593
  }
4063
4594
  async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
4064
4595
  const data = {
@@ -4077,7 +4608,7 @@ async function saveNotificationSetting(code, username, system, allows_notify, no
4077
4608
  },
4078
4609
  body: JSON.stringify(data)
4079
4610
  });
4080
- return parseJsonResponse2(response);
4611
+ return parseJsonResponse3(response);
4081
4612
  }
4082
4613
  async function getNotificationSetting(code, username, token) {
4083
4614
  const data = { code, username, token };
@@ -4089,7 +4620,7 @@ async function getNotificationSetting(code, username, token) {
4089
4620
  },
4090
4621
  body: JSON.stringify(data)
4091
4622
  });
4092
- return parseJsonResponse2(response);
4623
+ return parseJsonResponse3(response);
4093
4624
  }
4094
4625
  async function markNotifications(code, id) {
4095
4626
  const data = {
@@ -4106,7 +4637,7 @@ async function markNotifications(code, id) {
4106
4637
  },
4107
4638
  body: JSON.stringify(data)
4108
4639
  });
4109
- return parseJsonResponse2(response);
4640
+ return parseJsonResponse3(response);
4110
4641
  }
4111
4642
  async function addImage(code, url) {
4112
4643
  const data = { code, url };
@@ -4118,7 +4649,7 @@ async function addImage(code, url) {
4118
4649
  },
4119
4650
  body: JSON.stringify(data)
4120
4651
  });
4121
- return parseJsonResponse2(response);
4652
+ return parseJsonResponse3(response);
4122
4653
  }
4123
4654
  async function uploadImage(file, token, signal) {
4124
4655
  const fetchApi = getBoundFetch();
@@ -4129,7 +4660,7 @@ async function uploadImage(file, token, signal) {
4129
4660
  body: formData,
4130
4661
  signal
4131
4662
  });
4132
- return parseJsonResponse2(response);
4663
+ return parseJsonResponse3(response);
4133
4664
  }
4134
4665
  async function deleteImage(code, imageId) {
4135
4666
  const data = { code, id: imageId };
@@ -4141,7 +4672,7 @@ async function deleteImage(code, imageId) {
4141
4672
  },
4142
4673
  body: JSON.stringify(data)
4143
4674
  });
4144
- return parseJsonResponse2(response);
4675
+ return parseJsonResponse3(response);
4145
4676
  }
4146
4677
  async function addDraft(code, title, body, tags, meta) {
4147
4678
  const data = { code, title, body, tags, meta };
@@ -4153,7 +4684,7 @@ async function addDraft(code, title, body, tags, meta) {
4153
4684
  },
4154
4685
  body: JSON.stringify(data)
4155
4686
  });
4156
- return parseJsonResponse2(response);
4687
+ return parseJsonResponse3(response);
4157
4688
  }
4158
4689
  async function updateDraft(code, draftId, title, body, tags, meta) {
4159
4690
  const data = { code, id: draftId, title, body, tags, meta };
@@ -4165,7 +4696,7 @@ async function updateDraft(code, draftId, title, body, tags, meta) {
4165
4696
  },
4166
4697
  body: JSON.stringify(data)
4167
4698
  });
4168
- return parseJsonResponse2(response);
4699
+ return parseJsonResponse3(response);
4169
4700
  }
4170
4701
  async function deleteDraft(code, draftId) {
4171
4702
  const data = { code, id: draftId };
@@ -4177,7 +4708,7 @@ async function deleteDraft(code, draftId) {
4177
4708
  },
4178
4709
  body: JSON.stringify(data)
4179
4710
  });
4180
- return parseJsonResponse2(response);
4711
+ return parseJsonResponse3(response);
4181
4712
  }
4182
4713
  async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
4183
4714
  const data = {
@@ -4200,7 +4731,7 @@ async function addSchedule(code, permlink, title, body, meta, options, schedule,
4200
4731
  },
4201
4732
  body: JSON.stringify(data)
4202
4733
  });
4203
- return parseJsonResponse2(response);
4734
+ return parseJsonResponse3(response);
4204
4735
  }
4205
4736
  async function deleteSchedule(code, id) {
4206
4737
  const data = { code, id };
@@ -4212,7 +4743,7 @@ async function deleteSchedule(code, id) {
4212
4743
  },
4213
4744
  body: JSON.stringify(data)
4214
4745
  });
4215
- return parseJsonResponse2(response);
4746
+ return parseJsonResponse3(response);
4216
4747
  }
4217
4748
  async function moveSchedule(code, id) {
4218
4749
  const data = { code, id };
@@ -4224,7 +4755,7 @@ async function moveSchedule(code, id) {
4224
4755
  },
4225
4756
  body: JSON.stringify(data)
4226
4757
  });
4227
- return parseJsonResponse2(response);
4758
+ return parseJsonResponse3(response);
4228
4759
  }
4229
4760
  async function getPromotedPost(code, author, permlink) {
4230
4761
  const data = { code, author, permlink };
@@ -4236,7 +4767,7 @@ async function getPromotedPost(code, author, permlink) {
4236
4767
  },
4237
4768
  body: JSON.stringify(data)
4238
4769
  });
4239
- return parseJsonResponse2(response);
4770
+ return parseJsonResponse3(response);
4240
4771
  }
4241
4772
  async function onboardEmail(username, email, friend) {
4242
4773
  const dataBody = {
@@ -4255,7 +4786,7 @@ async function onboardEmail(username, email, friend) {
4255
4786
  body: JSON.stringify(dataBody)
4256
4787
  }
4257
4788
  );
4258
- return parseJsonResponse2(response);
4789
+ return parseJsonResponse3(response);
4259
4790
  }
4260
4791
 
4261
4792
  // src/modules/auth/requests.ts
@@ -4284,6 +4815,279 @@ async function hsTokenRenew(code) {
4284
4815
  return data;
4285
4816
  }
4286
4817
 
4287
- 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, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, 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, getCurrencyRate, getCurrencyRates, getCurrencyTokenRate, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussionsQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFollowCountQueryOptions, getFollowingQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getImagesQueryOptions, getLoginType, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostingKey, getPostsRankedInfiniteQueryOptions, getPromotePriceQueryOptions, getPromotedPost, 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, hsTokenRenew, isCommunity, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseProfileMetadata, roleMap, saveNotificationSetting, searchQueryOptions, 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 };
4818
+ // src/modules/hive-engine/requests.ts
4819
+ var ENGINE_RPC_HEADERS = { "Content-type": "application/json" };
4820
+ async function engineRpc(payload) {
4821
+ const fetchApi = getBoundFetch();
4822
+ const response = await fetchApi(`${CONFIG.privateApiHost}/private-api/engine-api`, {
4823
+ method: "POST",
4824
+ body: JSON.stringify(payload),
4825
+ headers: ENGINE_RPC_HEADERS
4826
+ });
4827
+ if (!response.ok) {
4828
+ throw new Error(
4829
+ `[SDK][HiveEngine] \u2013 request failed with ${response.status}`
4830
+ );
4831
+ }
4832
+ const data = await response.json();
4833
+ return data.result;
4834
+ }
4835
+ async function engineRpcSafe(payload, fallback) {
4836
+ try {
4837
+ return await engineRpc(payload);
4838
+ } catch (e) {
4839
+ return fallback;
4840
+ }
4841
+ }
4842
+ async function getHiveEngineOrderBook(symbol, limit = 50) {
4843
+ const baseParams = {
4844
+ jsonrpc: "2.0",
4845
+ method: "find",
4846
+ params: {
4847
+ contract: "market",
4848
+ query: { symbol },
4849
+ limit,
4850
+ offset: 0
4851
+ },
4852
+ id: 1
4853
+ };
4854
+ const [buy, sell] = await Promise.all([
4855
+ engineRpcSafe(
4856
+ {
4857
+ ...baseParams,
4858
+ params: {
4859
+ ...baseParams.params,
4860
+ table: "buyBook",
4861
+ indexes: [{ index: "price", descending: true }]
4862
+ }
4863
+ },
4864
+ []
4865
+ ),
4866
+ engineRpcSafe(
4867
+ {
4868
+ ...baseParams,
4869
+ params: {
4870
+ ...baseParams.params,
4871
+ table: "sellBook",
4872
+ indexes: [{ index: "price", descending: false }]
4873
+ }
4874
+ },
4875
+ []
4876
+ )
4877
+ ]);
4878
+ const sortByPriceDesc = (items) => items.sort((a, b) => {
4879
+ const left = Number(a.price ?? 0);
4880
+ const right = Number(b.price ?? 0);
4881
+ return right - left;
4882
+ });
4883
+ const sortByPriceAsc = (items) => items.sort((a, b) => {
4884
+ const left = Number(a.price ?? 0);
4885
+ const right = Number(b.price ?? 0);
4886
+ return left - right;
4887
+ });
4888
+ return {
4889
+ buy: sortByPriceDesc(buy),
4890
+ sell: sortByPriceAsc(sell)
4891
+ };
4892
+ }
4893
+ async function getHiveEngineTradeHistory(symbol, limit = 50) {
4894
+ return engineRpcSafe(
4895
+ {
4896
+ jsonrpc: "2.0",
4897
+ method: "find",
4898
+ params: {
4899
+ contract: "market",
4900
+ table: "tradesHistory",
4901
+ query: { symbol },
4902
+ limit,
4903
+ offset: 0,
4904
+ indexes: [{ index: "timestamp", descending: true }]
4905
+ },
4906
+ id: 1
4907
+ },
4908
+ []
4909
+ );
4910
+ }
4911
+ async function getHiveEngineOpenOrders(account, symbol, limit = 100) {
4912
+ const baseParams = {
4913
+ jsonrpc: "2.0",
4914
+ method: "find",
4915
+ params: {
4916
+ contract: "market",
4917
+ query: { symbol, account },
4918
+ limit,
4919
+ offset: 0
4920
+ },
4921
+ id: 1
4922
+ };
4923
+ const [buyRaw, sellRaw] = await Promise.all([
4924
+ engineRpcSafe(
4925
+ {
4926
+ ...baseParams,
4927
+ params: {
4928
+ ...baseParams.params,
4929
+ table: "buyBook",
4930
+ indexes: [{ index: "timestamp", descending: true }]
4931
+ }
4932
+ },
4933
+ []
4934
+ ),
4935
+ engineRpcSafe(
4936
+ {
4937
+ ...baseParams,
4938
+ params: {
4939
+ ...baseParams.params,
4940
+ table: "sellBook",
4941
+ indexes: [{ index: "timestamp", descending: true }]
4942
+ }
4943
+ },
4944
+ []
4945
+ )
4946
+ ]);
4947
+ const formatTotal = (quantity, price) => (Number(quantity || 0) * Number(price || 0)).toFixed(8);
4948
+ const buy = buyRaw.map((order) => ({
4949
+ id: order.txId,
4950
+ type: "buy",
4951
+ account: order.account,
4952
+ symbol: order.symbol,
4953
+ quantity: order.quantity,
4954
+ price: order.price,
4955
+ total: order.tokensLocked ?? formatTotal(order.quantity, order.price),
4956
+ timestamp: Number(order.timestamp ?? 0)
4957
+ }));
4958
+ const sell = sellRaw.map((order) => ({
4959
+ id: order.txId,
4960
+ type: "sell",
4961
+ account: order.account,
4962
+ symbol: order.symbol,
4963
+ quantity: order.quantity,
4964
+ price: order.price,
4965
+ total: formatTotal(order.quantity, order.price),
4966
+ timestamp: Number(order.timestamp ?? 0)
4967
+ }));
4968
+ return [...buy, ...sell].sort((a, b) => b.timestamp - a.timestamp);
4969
+ }
4970
+ async function getHiveEngineMetrics(symbol, account) {
4971
+ return engineRpcSafe(
4972
+ {
4973
+ jsonrpc: "2.0",
4974
+ method: "find",
4975
+ params: {
4976
+ contract: "market",
4977
+ table: "metrics",
4978
+ query: {
4979
+ ...symbol ? { symbol } : {},
4980
+ ...account ? { account } : {}
4981
+ }
4982
+ },
4983
+ id: 1
4984
+ },
4985
+ []
4986
+ );
4987
+ }
4988
+ async function getHiveEngineTokensMarket(account, symbol) {
4989
+ return getHiveEngineMetrics(symbol, account);
4990
+ }
4991
+ async function getHiveEngineTokensBalances(username) {
4992
+ return engineRpcSafe(
4993
+ {
4994
+ jsonrpc: "2.0",
4995
+ method: "find",
4996
+ params: {
4997
+ contract: "tokens",
4998
+ table: "balances",
4999
+ query: {
5000
+ account: username
5001
+ }
5002
+ },
5003
+ id: 1
5004
+ },
5005
+ []
5006
+ );
5007
+ }
5008
+ async function getHiveEngineTokensMetadata(tokens) {
5009
+ return engineRpcSafe(
5010
+ {
5011
+ jsonrpc: "2.0",
5012
+ method: "find",
5013
+ params: {
5014
+ contract: "tokens",
5015
+ table: "tokens",
5016
+ query: {
5017
+ symbol: { $in: tokens }
5018
+ }
5019
+ },
5020
+ id: 2
5021
+ },
5022
+ []
5023
+ );
5024
+ }
5025
+ async function getHiveEngineTokenTransactions(username, symbol, limit, offset) {
5026
+ const fetchApi = getBoundFetch();
5027
+ const url = new URL(
5028
+ `${CONFIG.privateApiHost}/private-api/engine-account-history`
5029
+ );
5030
+ url.searchParams.set("account", username);
5031
+ url.searchParams.set("symbol", symbol);
5032
+ url.searchParams.set("limit", limit.toString());
5033
+ url.searchParams.set("offset", offset.toString());
5034
+ const response = await fetchApi(url.toString(), {
5035
+ method: "GET",
5036
+ headers: { "Content-type": "application/json" }
5037
+ });
5038
+ if (!response.ok) {
5039
+ throw new Error(
5040
+ `[SDK][HiveEngine] \u2013 account history failed with ${response.status}`
5041
+ );
5042
+ }
5043
+ return await response.json();
5044
+ }
5045
+ async function getHiveEngineTokenMetrics(symbol, interval = "daily") {
5046
+ const fetchApi = getBoundFetch();
5047
+ const url = new URL(`${CONFIG.privateApiHost}/private-api/engine-chart-api`);
5048
+ url.searchParams.set("symbol", symbol);
5049
+ url.searchParams.set("interval", interval);
5050
+ const response = await fetchApi(url.toString(), {
5051
+ headers: { "Content-type": "application/json" }
5052
+ });
5053
+ if (!response.ok) {
5054
+ throw new Error(
5055
+ `[SDK][HiveEngine] \u2013 chart failed with ${response.status}`
5056
+ );
5057
+ }
5058
+ return await response.json();
5059
+ }
5060
+ async function getHiveEngineUnclaimedRewards(username) {
5061
+ const fetchApi = getBoundFetch();
5062
+ const response = await fetchApi(
5063
+ `${CONFIG.privateApiHost}/private-api/engine-reward-api/${username}?hive=1`
5064
+ );
5065
+ if (!response.ok) {
5066
+ throw new Error(
5067
+ `[SDK][HiveEngine] \u2013 rewards failed with ${response.status}`
5068
+ );
5069
+ }
5070
+ return await response.json();
5071
+ }
5072
+
5073
+ // src/modules/spk/requests.ts
5074
+ async function getSpkWallet(username) {
5075
+ const fetchApi = getBoundFetch();
5076
+ const response = await fetchApi(`${CONFIG.spkNode}/@${username}`);
5077
+ if (!response.ok) {
5078
+ throw new Error(`[SDK][SPK] \u2013 wallet failed with ${response.status}`);
5079
+ }
5080
+ return await response.json();
5081
+ }
5082
+ async function getSpkMarkets() {
5083
+ const fetchApi = getBoundFetch();
5084
+ const response = await fetchApi(`${CONFIG.spkNode}/markets`);
5085
+ if (!response.ok) {
5086
+ throw new Error(`[SDK][SPK] \u2013 markets failed with ${response.status}`);
5087
+ }
5088
+ return await response.json();
5089
+ }
5090
+
5091
+ export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, 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, 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, getHiveEngineMetrics, getHiveEngineOpenOrders, getHiveEngineOrderBook, getHiveEngineTokenMetrics, getHiveEngineTokenTransactions, getHiveEngineTokensBalances, getHiveEngineTokensMarket, getHiveEngineTokensMetadata, getHiveEngineTradeHistory, getHiveEngineUnclaimedRewards, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getHivePrice, getImagesQueryOptions, getIncomingRcQueryOptions, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getSpkMarkets, getSpkWallet, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, 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 };
4288
5092
  //# sourceMappingURL=index.js.map
4289
5093
  //# sourceMappingURL=index.js.map