@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.
@@ -8,54 +8,7 @@ var __export = (target, all) => {
8
8
  for (var name in all)
9
9
  __defProp(target, name, { get: all[name], enumerable: true });
10
10
  };
11
-
12
- // src/modules/keychain/keychain.ts
13
- var keychain_exports = {};
14
- __export(keychain_exports, {
15
- broadcast: () => broadcast,
16
- customJson: () => customJson,
17
- handshake: () => handshake
18
- });
19
- function handshake() {
20
- return new Promise((resolve) => {
21
- window.hive_keychain?.requestHandshake(() => {
22
- resolve();
23
- });
24
- });
25
- }
26
- var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
27
- window.hive_keychain?.requestBroadcast(
28
- account,
29
- operations,
30
- key,
31
- (resp) => {
32
- if (!resp.success) {
33
- reject({ message: "Operation cancelled" });
34
- }
35
- resolve(resp);
36
- },
37
- rpc
38
- );
39
- });
40
- var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
41
- window.hive_keychain?.requestCustomJson(
42
- account,
43
- id,
44
- key,
45
- json,
46
- display_msg,
47
- (resp) => {
48
- if (!resp.success) {
49
- reject({ message: "Operation cancelled" });
50
- }
51
- resolve(resp);
52
- },
53
- rpc
54
- );
55
- });
56
-
57
- // src/modules/core/mutations/use-broadcast-mutation.ts
58
- function useBroadcastMutation(mutationKey = [], username, accessToken, operations, onSuccess = () => {
11
+ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
59
12
  }, auth) {
60
13
  return useMutation({
61
14
  onSuccess,
@@ -66,6 +19,9 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
66
19
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
67
20
  );
68
21
  }
22
+ if (auth?.broadcast) {
23
+ return auth.broadcast(operations(payload), "posting");
24
+ }
69
25
  const postingKey = auth?.postingKey;
70
26
  if (postingKey) {
71
27
  const privateKey = PrivateKey.fromString(postingKey);
@@ -74,34 +30,12 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
74
30
  privateKey
75
31
  );
76
32
  }
77
- const loginType = auth?.loginType;
78
- if (loginType && loginType == "keychain") {
79
- return keychain_exports.broadcast(
80
- username,
81
- operations(payload),
82
- "Posting"
83
- ).then((r) => r.result);
84
- }
33
+ const accessToken = auth?.accessToken;
85
34
  if (accessToken) {
86
- const f = getBoundFetch();
87
- const res = await f("https://hivesigner.com/api/broadcast", {
88
- method: "POST",
89
- headers: {
90
- Authorization: accessToken,
91
- "Content-Type": "application/json",
92
- Accept: "application/json"
93
- },
94
- body: JSON.stringify({ operations: operations(payload) })
95
- });
96
- if (!res.ok) {
97
- const txt = await res.text().catch(() => "");
98
- throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
99
- }
100
- const json = await res.json();
101
- if (json?.errors) {
102
- throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
103
- }
104
- 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;
105
39
  }
106
40
  throw new Error(
107
41
  "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
@@ -109,31 +43,9 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
109
43
  }
110
44
  });
111
45
  }
112
-
113
- // src/modules/core/mock-storage.ts
114
- var MockStorage = class {
115
- length = 0;
116
- clear() {
117
- throw new Error("Method not implemented.");
118
- }
119
- getItem(key) {
120
- return this[key];
121
- }
122
- key(index) {
123
- return Object.keys(this)[index];
124
- }
125
- removeItem(key) {
126
- delete this[key];
127
- }
128
- setItem(key, value) {
129
- this[key] = value;
130
- }
131
- };
132
46
  var CONFIG = {
133
47
  privateApiHost: "https://ecency.com",
134
48
  imageHost: "https://images.ecency.com",
135
- storage: typeof window === "undefined" ? new MockStorage() : window.localStorage,
136
- storagePrefix: "ecency",
137
49
  hiveClient: new Client(
138
50
  [
139
51
  "https://api.hive.blog",
@@ -288,7 +200,7 @@ var ConfigManager;
288
200
  }
289
201
  ConfigManager2.setDmcaLists = setDmcaLists;
290
202
  })(ConfigManager || (ConfigManager = {}));
291
- async function broadcastJson(username, id, payload, accessToken, auth) {
203
+ async function broadcastJson(username, id, payload, auth) {
292
204
  if (!username) {
293
205
  throw new Error(
294
206
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
@@ -300,6 +212,9 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
300
212
  required_posting_auths: [username],
301
213
  json: JSON.stringify(payload)
302
214
  };
215
+ if (auth?.broadcast) {
216
+ return auth.broadcast([["custom_json", jjson]], "posting");
217
+ }
303
218
  const postingKey = auth?.postingKey;
304
219
  if (postingKey) {
305
220
  const privateKey = PrivateKey.fromString(postingKey);
@@ -308,10 +223,7 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
308
223
  privateKey
309
224
  );
310
225
  }
311
- const loginType = auth?.loginType;
312
- if (loginType && loginType == "keychain") {
313
- return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
314
- }
226
+ const accessToken = auth?.accessToken;
315
227
  if (accessToken) {
316
228
  const response = await new hs.Client({
317
229
  accessToken
@@ -322,6 +234,63 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
322
234
  "[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
323
235
  );
324
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 = {}));
325
294
 
326
295
  // src/modules/core/utils/decoder-encoder.ts
327
296
  function encodeObj(o) {
@@ -383,79 +352,7 @@ function isCommunity(value) {
383
352
  return typeof value === "string" ? /^hive-\d+$/.test(value) : false;
384
353
  }
385
354
 
386
- // src/modules/core/storage.ts
387
- var getUser = (username) => {
388
- try {
389
- const raw = CONFIG.storage.getItem(
390
- CONFIG.storagePrefix + "_user_" + username
391
- );
392
- return decodeObj(JSON.parse(raw));
393
- } catch (e) {
394
- console.error(e);
395
- return void 0;
396
- }
397
- };
398
- var getAccessToken = (username) => getUser(username) && getUser(username).accessToken;
399
- var getPostingKey = (username) => getUser(username) && getUser(username).postingKey;
400
- var getLoginType = (username) => getUser(username) && getUser(username).loginType;
401
- var getRefreshToken = (username) => getUser(username) && getUser(username).refreshToken;
402
- function makeQueryClient() {
403
- return new QueryClient({
404
- defaultOptions: {
405
- queries: {
406
- // With SSR, we usually want to set some default staleTime
407
- // above 0 to avoid refetching immediately on the client
408
- // staleTime: 60 * 1000,
409
- refetchOnWindowFocus: false,
410
- refetchOnMount: false
411
- }
412
- }
413
- });
414
- }
415
- var getQueryClient = () => CONFIG.queryClient;
416
- var EcencyQueriesManager;
417
- ((EcencyQueriesManager2) => {
418
- function getQueryData(queryKey) {
419
- const queryClient = getQueryClient();
420
- return queryClient.getQueryData(queryKey);
421
- }
422
- EcencyQueriesManager2.getQueryData = getQueryData;
423
- function getInfiniteQueryData(queryKey) {
424
- const queryClient = getQueryClient();
425
- return queryClient.getQueryData(queryKey);
426
- }
427
- EcencyQueriesManager2.getInfiniteQueryData = getInfiniteQueryData;
428
- async function prefetchQuery(options) {
429
- const queryClient = getQueryClient();
430
- await queryClient.prefetchQuery(options);
431
- return getQueryData(options.queryKey);
432
- }
433
- EcencyQueriesManager2.prefetchQuery = prefetchQuery;
434
- async function prefetchInfiniteQuery(options) {
435
- const queryClient = getQueryClient();
436
- await queryClient.prefetchInfiniteQuery(options);
437
- return getInfiniteQueryData(options.queryKey);
438
- }
439
- EcencyQueriesManager2.prefetchInfiniteQuery = prefetchInfiniteQuery;
440
- function generateClientServerQuery(options) {
441
- return {
442
- prefetch: () => prefetchQuery(options),
443
- getData: () => getQueryData(options.queryKey),
444
- useClientQuery: () => useQuery(options),
445
- fetchAndGet: () => getQueryClient().fetchQuery(options)
446
- };
447
- }
448
- EcencyQueriesManager2.generateClientServerQuery = generateClientServerQuery;
449
- function generateClientServerInfiniteQuery(options) {
450
- return {
451
- prefetch: () => prefetchInfiniteQuery(options),
452
- getData: () => getInfiniteQueryData(options.queryKey),
453
- useClientQuery: () => useInfiniteQuery(options),
454
- fetchAndGet: () => getQueryClient().fetchInfiniteQuery(options)
455
- };
456
- }
457
- EcencyQueriesManager2.generateClientServerInfiniteQuery = generateClientServerInfiniteQuery;
458
- })(EcencyQueriesManager || (EcencyQueriesManager = {}));
355
+ // src/modules/core/queries/get-dynamic-props-query-options.ts
459
356
  function getDynamicPropsQueryOptions() {
460
357
  return queryOptions({
461
358
  queryKey: ["core", "dynamic-props"],
@@ -710,12 +607,14 @@ function parseAccounts(rawAccounts) {
710
607
  // src/modules/accounts/queries/get-accounts-query-options.ts
711
608
  function getAccountsQueryOptions(usernames) {
712
609
  return queryOptions({
713
- queryKey: ["accounts", "get-accounts", usernames],
610
+ queryKey: ["accounts", "list", ...usernames],
611
+ enabled: usernames.length > 0,
714
612
  queryFn: async () => {
715
- const response = await CONFIG.hiveClient.database.getAccounts(usernames);
613
+ const response = await CONFIG.hiveClient.database.getAccounts(
614
+ usernames
615
+ );
716
616
  return parseAccounts(response);
717
- },
718
- enabled: usernames.length > 0
617
+ }
719
618
  });
720
619
  }
721
620
  function getFollowCountQueryOptions(username) {
@@ -986,6 +885,22 @@ function getAccountPendingRecoveryQueryOptions(username) {
986
885
  )
987
886
  });
988
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
+ }
989
904
  var ops = utils.operationOrders;
990
905
  var ACCOUNT_OPERATION_GROUPS = {
991
906
  transfers: [
@@ -1302,6 +1217,26 @@ function getEntryActiveVotesQueryOptions(entry) {
1302
1217
  enabled: !!entry
1303
1218
  });
1304
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
+ }
1305
1240
  function getPostHeaderQueryOptions(author, permlink) {
1306
1241
  return queryOptions({
1307
1242
  queryKey: ["posts", "post-header", author, permlink],
@@ -1363,6 +1298,212 @@ function getPostQueryOptions(author, permlink, observer = "", num) {
1363
1298
  enabled: !!author && !!permlink && permlink.trim() !== "" && permlink.trim() !== "undefined"
1364
1299
  });
1365
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
1366
1507
  var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
1367
1508
  SortOrder2["trending"] = "trending";
1368
1509
  SortOrder2["author_reputation"] = "author_reputation";
@@ -1460,6 +1601,13 @@ function getDiscussionsQueryOptions(entry, order = "created" /* created */, enab
1460
1601
  select: (data) => sortDiscussions(entry, data, order)
1461
1602
  });
1462
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
+ }
1463
1611
  function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit = 20, observer = "", enabled = true) {
1464
1612
  return infiniteQueryOptions({
1465
1613
  queryKey: ["posts", "account-posts", username ?? "", filter, limit, observer],
@@ -1509,6 +1657,35 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
1509
1657
  }
1510
1658
  });
1511
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
+ }
1512
1689
  function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = "", enabled = true, _options = {}) {
1513
1690
  return infiniteQueryOptions({
1514
1691
  queryKey: ["posts", "posts-ranked", sort, tag, limit, observer],
@@ -1556,6 +1733,36 @@ function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = ""
1556
1733
  }
1557
1734
  });
1558
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
+ }
1559
1766
  function getReblogsQueryOptions(username, activeUsername, limit = 200) {
1560
1767
  return queryOptions({
1561
1768
  queryKey: ["posts", "reblogs", username ?? "", limit],
@@ -1793,8 +2000,8 @@ function toEntryArray(x) {
1793
2000
  return Array.isArray(x) ? x : [];
1794
2001
  }
1795
2002
  async function getVisibleFirstLevelThreadItems(container) {
1796
- const queryOptions76 = getDiscussionsQueryOptions(container, "created" /* created */, true);
1797
- const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions76);
2003
+ const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
2004
+ const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
1798
2005
  const discussionItems = toEntryArray(discussionItemsRaw);
1799
2006
  if (discussionItems.length <= 1) {
1800
2007
  return [];
@@ -2003,6 +2210,18 @@ function getWavesTrendingTagsQueryOptions(host, hours = 24) {
2003
2210
  }
2004
2211
  });
2005
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
+ }
2006
2225
 
2007
2226
  // src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts
2008
2227
  function isEntry(x) {
@@ -2053,15 +2272,21 @@ function getAccountVoteHistoryInfiniteQueryOptions(username, options) {
2053
2272
  })
2054
2273
  });
2055
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
+ }
2056
2282
 
2057
2283
  // src/modules/accounts/mutations/use-account-update.ts
2058
- function useAccountUpdate(username, accessToken, auth) {
2284
+ function useAccountUpdate(username, auth) {
2059
2285
  const queryClient = useQueryClient();
2060
2286
  const { data } = useQuery(getAccountFullQueryOptions(username));
2061
2287
  return useBroadcastMutation(
2062
2288
  ["accounts", "update"],
2063
2289
  username,
2064
- accessToken,
2065
2290
  (payload) => {
2066
2291
  if (!data) {
2067
2292
  throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
@@ -2103,7 +2328,7 @@ function useAccountUpdate(username, accessToken, auth) {
2103
2328
  auth
2104
2329
  );
2105
2330
  }
2106
- function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
2331
+ function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError) {
2107
2332
  return useMutation({
2108
2333
  mutationKey: ["accounts", "relation", "update", reference, target],
2109
2334
  mutationFn: async (kind) => {
@@ -2115,17 +2340,22 @@ function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
2115
2340
  const actualRelation = getQueryClient().getQueryData(
2116
2341
  relationsQuery.queryKey
2117
2342
  );
2118
- await broadcastJson(reference, "follow", [
2343
+ await broadcastJson(
2344
+ reference,
2119
2345
  "follow",
2120
- {
2121
- follower: reference,
2122
- following: target,
2123
- what: [
2124
- ...kind === "toggle-ignore" && !actualRelation?.ignores ? ["ignore"] : [],
2125
- ...kind === "toggle-follow" && !actualRelation?.follows ? ["blog"] : []
2126
- ]
2127
- }
2128
- ]);
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
+ );
2129
2359
  return {
2130
2360
  ...actualRelation,
2131
2361
  ignores: kind === "toggle-ignore" ? !actualRelation?.ignores : actualRelation?.ignores,
@@ -2352,7 +2582,7 @@ function useAccountUpdatePassword(username, options) {
2352
2582
  ...options
2353
2583
  });
2354
2584
  }
2355
- function useAccountRevokePosting(username, options) {
2585
+ function useAccountRevokePosting(username, options, auth) {
2356
2586
  const queryClient = useQueryClient();
2357
2587
  const { data } = useQuery(getAccountFullQueryOptions(username));
2358
2588
  return useMutation({
@@ -2379,11 +2609,10 @@ function useAccountRevokePosting(username, options) {
2379
2609
  if (type === "key" && key) {
2380
2610
  return CONFIG.hiveClient.broadcast.updateAccount(operationBody, key);
2381
2611
  } else if (type === "keychain") {
2382
- return keychain_exports.broadcast(
2383
- data.name,
2384
- [["account_update", operationBody]],
2385
- "Active"
2386
- );
2612
+ if (!auth?.broadcast) {
2613
+ throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
2614
+ }
2615
+ return auth.broadcast([["account_update", operationBody]], "active");
2387
2616
  } else {
2388
2617
  const params = {
2389
2618
  callback: `https://ecency.com/@${data.name}/permissions`
@@ -2414,7 +2643,7 @@ function useAccountRevokePosting(username, options) {
2414
2643
  }
2415
2644
  });
2416
2645
  }
2417
- function useAccountUpdateRecovery(username, code, options) {
2646
+ function useAccountUpdateRecovery(username, code, options, auth) {
2418
2647
  const { data } = useQuery(getAccountFullQueryOptions(username));
2419
2648
  return useMutation({
2420
2649
  mutationKey: ["accounts", "recovery", data?.name],
@@ -2453,11 +2682,10 @@ function useAccountUpdateRecovery(username, code, options) {
2453
2682
  key
2454
2683
  );
2455
2684
  } else if (type === "keychain") {
2456
- return keychain_exports.broadcast(
2457
- data.name,
2458
- [["change_recovery_account", operationBody]],
2459
- "Active"
2460
- );
2685
+ if (!auth?.broadcast) {
2686
+ throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
2687
+ }
2688
+ return auth.broadcast([["change_recovery_account", operationBody]], "owner");
2461
2689
  } else {
2462
2690
  const params = {
2463
2691
  callback: `https://ecency.com/@${data.name}/permissions`
@@ -2506,6 +2734,152 @@ function useAccountRevokeKey(username, options) {
2506
2734
  ...options
2507
2735
  });
2508
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
+ }
2509
2883
  function useSignOperationByKey(username) {
2510
2884
  return useMutation({
2511
2885
  mutationKey: ["operations", "sign", username],
@@ -2531,7 +2905,7 @@ function useSignOperationByKey(username) {
2531
2905
  }
2532
2906
  });
2533
2907
  }
2534
- function useSignOperationByKeychain(username, keyType = "Active") {
2908
+ function useSignOperationByKeychain(username, auth, keyType = "active") {
2535
2909
  return useMutation({
2536
2910
  mutationKey: ["operations", "sign-keychain", username],
2537
2911
  mutationFn: ({ operation }) => {
@@ -2540,7 +2914,10 @@ function useSignOperationByKeychain(username, keyType = "Active") {
2540
2914
  "[SDK][Keychain] \u2013\xA0cannot sign operation with anon user"
2541
2915
  );
2542
2916
  }
2543
- 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);
2544
2921
  }
2545
2922
  });
2546
2923
  }
@@ -2663,6 +3040,33 @@ function useRemoveFragment(username, fragmentId, code) {
2663
3040
  });
2664
3041
  }
2665
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
+
2666
3070
  // src/modules/analytics/mutations/index.ts
2667
3071
  var mutations_exports = {};
2668
3072
  __export(mutations_exports, {
@@ -3051,6 +3455,13 @@ function getCommunityContextQueryOptions(username, communityName) {
3051
3455
  }
3052
3456
  });
3053
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
+ }
3054
3465
  function getCommunitySubscribersQueryOptions(communityName) {
3055
3466
  return queryOptions({
3056
3467
  queryKey: ["communities", "subscribers", communityName],
@@ -3493,6 +3904,25 @@ function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
3493
3904
  getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
3494
3905
  });
3495
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
+ }
3496
3926
  function getReceivedVestingSharesQueryOptions(username) {
3497
3927
  return queryOptions({
3498
3928
  queryKey: ["wallet", "received-vesting-shares", username],
@@ -3537,15 +3967,15 @@ function getMarketStatisticsQueryOptions() {
3537
3967
  });
3538
3968
  }
3539
3969
  function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
3540
- const formatDate = (date) => {
3970
+ const formatDate2 = (date) => {
3541
3971
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3542
3972
  };
3543
3973
  return queryOptions({
3544
3974
  queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
3545
3975
  queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
3546
3976
  seconds,
3547
- formatDate(startDate),
3548
- formatDate(endDate)
3977
+ formatDate2(startDate),
3978
+ formatDate2(endDate)
3549
3979
  ])
3550
3980
  });
3551
3981
  }
@@ -3560,13 +3990,13 @@ function getHiveHbdStatsQueryOptions() {
3560
3990
  );
3561
3991
  const now = /* @__PURE__ */ new Date();
3562
3992
  const oneDayAgo = new Date(now.getTime() - 864e5);
3563
- const formatDate = (date) => {
3993
+ const formatDate2 = (date) => {
3564
3994
  return date.toISOString().replace(/\.\d{3}Z$/, "");
3565
3995
  };
3566
3996
  const dayChange = await CONFIG.hiveClient.call(
3567
3997
  "condenser_api",
3568
3998
  "get_market_history",
3569
- [86400, formatDate(oneDayAgo), formatDate(now)]
3999
+ [86400, formatDate2(oneDayAgo), formatDate2(now)]
3570
4000
  );
3571
4001
  const result = {
3572
4002
  price: +stats.latest,
@@ -3595,6 +4025,21 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
3595
4025
  }
3596
4026
  });
3597
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
+ }
3598
4043
 
3599
4044
  // src/modules/market/requests.ts
3600
4045
  async function parseJsonResponse(response) {
@@ -3635,6 +4080,13 @@ async function getCurrencyRates() {
3635
4080
  const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
3636
4081
  return parseJsonResponse(response);
3637
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
+ }
3638
4090
  function getPointsQueryOptions(username, filter = 0) {
3639
4091
  return queryOptions({
3640
4092
  queryKey: ["points", username, filter],
@@ -3905,6 +4357,89 @@ function getSearchPathQueryOptions(q) {
3905
4357
  }
3906
4358
  });
3907
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
+ }
3908
4443
  function getBoostPlusPricesQueryOptions(accessToken) {
3909
4444
  return queryOptions({
3910
4445
  queryKey: ["promotions", "boost-plus-prices"],
@@ -3976,7 +4511,7 @@ function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
3976
4511
  }
3977
4512
 
3978
4513
  // src/modules/private-api/requests.ts
3979
- async function parseJsonResponse2(response) {
4514
+ async function parseJsonResponse3(response) {
3980
4515
  if (!response.ok) {
3981
4516
  let errorData = void 0;
3982
4517
  try {
@@ -4000,7 +4535,7 @@ async function signUp(username, email, referral) {
4000
4535
  },
4001
4536
  body: JSON.stringify({ username, email, referral })
4002
4537
  });
4003
- const data = await parseJsonResponse2(response);
4538
+ const data = await parseJsonResponse3(response);
4004
4539
  return { status: response.status, data };
4005
4540
  }
4006
4541
  async function subscribeEmail(email) {
@@ -4012,7 +4547,7 @@ async function subscribeEmail(email) {
4012
4547
  },
4013
4548
  body: JSON.stringify({ email })
4014
4549
  });
4015
- const data = await parseJsonResponse2(response);
4550
+ const data = await parseJsonResponse3(response);
4016
4551
  return { status: response.status, data };
4017
4552
  }
4018
4553
  async function usrActivity(code, ty, bl = "", tx = "") {
@@ -4031,7 +4566,7 @@ async function usrActivity(code, ty, bl = "", tx = "") {
4031
4566
  },
4032
4567
  body: JSON.stringify(params)
4033
4568
  });
4034
- await parseJsonResponse2(response);
4569
+ await parseJsonResponse3(response);
4035
4570
  }
4036
4571
  async function getNotifications(code, filter, since = null, user = null) {
4037
4572
  const data = {
@@ -4054,7 +4589,7 @@ async function getNotifications(code, filter, since = null, user = null) {
4054
4589
  },
4055
4590
  body: JSON.stringify(data)
4056
4591
  });
4057
- return parseJsonResponse2(response);
4592
+ return parseJsonResponse3(response);
4058
4593
  }
4059
4594
  async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
4060
4595
  const data = {
@@ -4073,7 +4608,7 @@ async function saveNotificationSetting(code, username, system, allows_notify, no
4073
4608
  },
4074
4609
  body: JSON.stringify(data)
4075
4610
  });
4076
- return parseJsonResponse2(response);
4611
+ return parseJsonResponse3(response);
4077
4612
  }
4078
4613
  async function getNotificationSetting(code, username, token) {
4079
4614
  const data = { code, username, token };
@@ -4085,7 +4620,7 @@ async function getNotificationSetting(code, username, token) {
4085
4620
  },
4086
4621
  body: JSON.stringify(data)
4087
4622
  });
4088
- return parseJsonResponse2(response);
4623
+ return parseJsonResponse3(response);
4089
4624
  }
4090
4625
  async function markNotifications(code, id) {
4091
4626
  const data = {
@@ -4102,7 +4637,7 @@ async function markNotifications(code, id) {
4102
4637
  },
4103
4638
  body: JSON.stringify(data)
4104
4639
  });
4105
- return parseJsonResponse2(response);
4640
+ return parseJsonResponse3(response);
4106
4641
  }
4107
4642
  async function addImage(code, url) {
4108
4643
  const data = { code, url };
@@ -4114,7 +4649,7 @@ async function addImage(code, url) {
4114
4649
  },
4115
4650
  body: JSON.stringify(data)
4116
4651
  });
4117
- return parseJsonResponse2(response);
4652
+ return parseJsonResponse3(response);
4118
4653
  }
4119
4654
  async function uploadImage(file, token, signal) {
4120
4655
  const fetchApi = getBoundFetch();
@@ -4125,7 +4660,7 @@ async function uploadImage(file, token, signal) {
4125
4660
  body: formData,
4126
4661
  signal
4127
4662
  });
4128
- return parseJsonResponse2(response);
4663
+ return parseJsonResponse3(response);
4129
4664
  }
4130
4665
  async function deleteImage(code, imageId) {
4131
4666
  const data = { code, id: imageId };
@@ -4137,7 +4672,7 @@ async function deleteImage(code, imageId) {
4137
4672
  },
4138
4673
  body: JSON.stringify(data)
4139
4674
  });
4140
- return parseJsonResponse2(response);
4675
+ return parseJsonResponse3(response);
4141
4676
  }
4142
4677
  async function addDraft(code, title, body, tags, meta) {
4143
4678
  const data = { code, title, body, tags, meta };
@@ -4149,7 +4684,7 @@ async function addDraft(code, title, body, tags, meta) {
4149
4684
  },
4150
4685
  body: JSON.stringify(data)
4151
4686
  });
4152
- return parseJsonResponse2(response);
4687
+ return parseJsonResponse3(response);
4153
4688
  }
4154
4689
  async function updateDraft(code, draftId, title, body, tags, meta) {
4155
4690
  const data = { code, id: draftId, title, body, tags, meta };
@@ -4161,7 +4696,7 @@ async function updateDraft(code, draftId, title, body, tags, meta) {
4161
4696
  },
4162
4697
  body: JSON.stringify(data)
4163
4698
  });
4164
- return parseJsonResponse2(response);
4699
+ return parseJsonResponse3(response);
4165
4700
  }
4166
4701
  async function deleteDraft(code, draftId) {
4167
4702
  const data = { code, id: draftId };
@@ -4173,7 +4708,7 @@ async function deleteDraft(code, draftId) {
4173
4708
  },
4174
4709
  body: JSON.stringify(data)
4175
4710
  });
4176
- return parseJsonResponse2(response);
4711
+ return parseJsonResponse3(response);
4177
4712
  }
4178
4713
  async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
4179
4714
  const data = {
@@ -4196,7 +4731,7 @@ async function addSchedule(code, permlink, title, body, meta, options, schedule,
4196
4731
  },
4197
4732
  body: JSON.stringify(data)
4198
4733
  });
4199
- return parseJsonResponse2(response);
4734
+ return parseJsonResponse3(response);
4200
4735
  }
4201
4736
  async function deleteSchedule(code, id) {
4202
4737
  const data = { code, id };
@@ -4208,7 +4743,7 @@ async function deleteSchedule(code, id) {
4208
4743
  },
4209
4744
  body: JSON.stringify(data)
4210
4745
  });
4211
- return parseJsonResponse2(response);
4746
+ return parseJsonResponse3(response);
4212
4747
  }
4213
4748
  async function moveSchedule(code, id) {
4214
4749
  const data = { code, id };
@@ -4220,7 +4755,7 @@ async function moveSchedule(code, id) {
4220
4755
  },
4221
4756
  body: JSON.stringify(data)
4222
4757
  });
4223
- return parseJsonResponse2(response);
4758
+ return parseJsonResponse3(response);
4224
4759
  }
4225
4760
  async function getPromotedPost(code, author, permlink) {
4226
4761
  const data = { code, author, permlink };
@@ -4232,7 +4767,7 @@ async function getPromotedPost(code, author, permlink) {
4232
4767
  },
4233
4768
  body: JSON.stringify(data)
4234
4769
  });
4235
- return parseJsonResponse2(response);
4770
+ return parseJsonResponse3(response);
4236
4771
  }
4237
4772
  async function onboardEmail(username, email, friend) {
4238
4773
  const dataBody = {
@@ -4251,7 +4786,7 @@ async function onboardEmail(username, email, friend) {
4251
4786
  body: JSON.stringify(dataBody)
4252
4787
  }
4253
4788
  );
4254
- return parseJsonResponse2(response);
4789
+ return parseJsonResponse3(response);
4255
4790
  }
4256
4791
 
4257
4792
  // src/modules/auth/requests.ts
@@ -4280,6 +4815,279 @@ async function hsTokenRenew(code) {
4280
4815
  return data;
4281
4816
  }
4282
4817
 
4283
- 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 };
4284
5092
  //# sourceMappingURL=index.mjs.map
4285
5093
  //# sourceMappingURL=index.mjs.map