@ecency/sdk 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +160 -23
- package/dist/browser/index.js +657 -31
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +691 -30
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +657 -31
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -735,12 +735,14 @@ function parseAccounts(rawAccounts) {
|
|
|
735
735
|
// src/modules/accounts/queries/get-accounts-query-options.ts
|
|
736
736
|
function getAccountsQueryOptions(usernames) {
|
|
737
737
|
return reactQuery.queryOptions({
|
|
738
|
-
queryKey: ["accounts", "
|
|
738
|
+
queryKey: ["accounts", "list", ...usernames],
|
|
739
|
+
enabled: usernames.length > 0,
|
|
739
740
|
queryFn: async () => {
|
|
740
|
-
const response = await CONFIG.hiveClient.database.getAccounts(
|
|
741
|
+
const response = await CONFIG.hiveClient.database.getAccounts(
|
|
742
|
+
usernames
|
|
743
|
+
);
|
|
741
744
|
return parseAccounts(response);
|
|
742
|
-
}
|
|
743
|
-
enabled: usernames.length > 0
|
|
745
|
+
}
|
|
744
746
|
});
|
|
745
747
|
}
|
|
746
748
|
function getFollowCountQueryOptions(username) {
|
|
@@ -1011,6 +1013,22 @@ function getAccountPendingRecoveryQueryOptions(username) {
|
|
|
1011
1013
|
)
|
|
1012
1014
|
});
|
|
1013
1015
|
}
|
|
1016
|
+
function getAccountReputationsQueryOptions(query, limit = 50) {
|
|
1017
|
+
return reactQuery.queryOptions({
|
|
1018
|
+
queryKey: ["accounts", "reputations", query, limit],
|
|
1019
|
+
enabled: !!query,
|
|
1020
|
+
queryFn: async () => {
|
|
1021
|
+
if (!query) {
|
|
1022
|
+
return [];
|
|
1023
|
+
}
|
|
1024
|
+
return CONFIG.hiveClient.call(
|
|
1025
|
+
"condenser_api",
|
|
1026
|
+
"get_account_reputations",
|
|
1027
|
+
[query, limit]
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1014
1032
|
var ops = dhive.utils.operationOrders;
|
|
1015
1033
|
var ACCOUNT_OPERATION_GROUPS = {
|
|
1016
1034
|
transfers: [
|
|
@@ -1327,6 +1345,26 @@ function getEntryActiveVotesQueryOptions(entry) {
|
|
|
1327
1345
|
enabled: !!entry
|
|
1328
1346
|
});
|
|
1329
1347
|
}
|
|
1348
|
+
function getContentQueryOptions(author, permlink) {
|
|
1349
|
+
return reactQuery.queryOptions({
|
|
1350
|
+
queryKey: ["posts", "content", author, permlink],
|
|
1351
|
+
enabled: !!author && !!permlink,
|
|
1352
|
+
queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content", [
|
|
1353
|
+
author,
|
|
1354
|
+
permlink
|
|
1355
|
+
])
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
function getContentRepliesQueryOptions(author, permlink) {
|
|
1359
|
+
return reactQuery.queryOptions({
|
|
1360
|
+
queryKey: ["posts", "content-replies", author, permlink],
|
|
1361
|
+
enabled: !!author && !!permlink,
|
|
1362
|
+
queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content_replies", {
|
|
1363
|
+
author,
|
|
1364
|
+
permlink
|
|
1365
|
+
})
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1330
1368
|
function getPostHeaderQueryOptions(author, permlink) {
|
|
1331
1369
|
return reactQuery.queryOptions({
|
|
1332
1370
|
queryKey: ["posts", "post-header", author, permlink],
|
|
@@ -1388,6 +1426,212 @@ function getPostQueryOptions(author, permlink, observer = "", num) {
|
|
|
1388
1426
|
enabled: !!author && !!permlink && permlink.trim() !== "" && permlink.trim() !== "undefined"
|
|
1389
1427
|
});
|
|
1390
1428
|
}
|
|
1429
|
+
|
|
1430
|
+
// src/modules/bridge/requests.ts
|
|
1431
|
+
function bridgeApiCall(endpoint, params) {
|
|
1432
|
+
return CONFIG.hiveClient.call("bridge", endpoint, params);
|
|
1433
|
+
}
|
|
1434
|
+
async function resolvePost(post, observer, num) {
|
|
1435
|
+
const { json_metadata: json } = post;
|
|
1436
|
+
if (json?.original_author && json?.original_permlink && json.tags?.[0] === "cross-post") {
|
|
1437
|
+
try {
|
|
1438
|
+
const resp = await getPost(
|
|
1439
|
+
json.original_author,
|
|
1440
|
+
json.original_permlink,
|
|
1441
|
+
observer,
|
|
1442
|
+
num
|
|
1443
|
+
);
|
|
1444
|
+
if (resp) {
|
|
1445
|
+
return {
|
|
1446
|
+
...post,
|
|
1447
|
+
original_entry: resp,
|
|
1448
|
+
num
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
return post;
|
|
1452
|
+
} catch {
|
|
1453
|
+
return post;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
return { ...post, num };
|
|
1457
|
+
}
|
|
1458
|
+
async function resolvePosts(posts, observer) {
|
|
1459
|
+
const validatedPosts = posts.map(validateEntry);
|
|
1460
|
+
const resolved = await Promise.all(validatedPosts.map((p) => resolvePost(p, observer)));
|
|
1461
|
+
return filterDmcaEntry(resolved);
|
|
1462
|
+
}
|
|
1463
|
+
async function getPostsRanked(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "") {
|
|
1464
|
+
const resp = await bridgeApiCall("get_ranked_posts", {
|
|
1465
|
+
sort,
|
|
1466
|
+
start_author,
|
|
1467
|
+
start_permlink,
|
|
1468
|
+
limit,
|
|
1469
|
+
tag,
|
|
1470
|
+
observer
|
|
1471
|
+
});
|
|
1472
|
+
if (resp) {
|
|
1473
|
+
return resolvePosts(resp, observer);
|
|
1474
|
+
}
|
|
1475
|
+
return resp;
|
|
1476
|
+
}
|
|
1477
|
+
async function getAccountPosts(sort, account, start_author = "", start_permlink = "", limit = 20, observer = "") {
|
|
1478
|
+
if (CONFIG.dmcaAccounts.includes(account)) {
|
|
1479
|
+
return [];
|
|
1480
|
+
}
|
|
1481
|
+
const resp = await bridgeApiCall("get_account_posts", {
|
|
1482
|
+
sort,
|
|
1483
|
+
account,
|
|
1484
|
+
start_author,
|
|
1485
|
+
start_permlink,
|
|
1486
|
+
limit,
|
|
1487
|
+
observer
|
|
1488
|
+
});
|
|
1489
|
+
if (resp) {
|
|
1490
|
+
return resolvePosts(resp, observer);
|
|
1491
|
+
}
|
|
1492
|
+
return resp;
|
|
1493
|
+
}
|
|
1494
|
+
function validateEntry(entry) {
|
|
1495
|
+
const newEntry = {
|
|
1496
|
+
...entry,
|
|
1497
|
+
active_votes: Array.isArray(entry.active_votes) ? [...entry.active_votes] : [],
|
|
1498
|
+
beneficiaries: Array.isArray(entry.beneficiaries) ? [...entry.beneficiaries] : [],
|
|
1499
|
+
blacklists: Array.isArray(entry.blacklists) ? [...entry.blacklists] : [],
|
|
1500
|
+
replies: Array.isArray(entry.replies) ? [...entry.replies] : [],
|
|
1501
|
+
stats: entry.stats ? { ...entry.stats } : null
|
|
1502
|
+
};
|
|
1503
|
+
const requiredStringProps = [
|
|
1504
|
+
"author",
|
|
1505
|
+
"title",
|
|
1506
|
+
"body",
|
|
1507
|
+
"created",
|
|
1508
|
+
"category",
|
|
1509
|
+
"permlink",
|
|
1510
|
+
"url",
|
|
1511
|
+
"updated"
|
|
1512
|
+
];
|
|
1513
|
+
for (const prop of requiredStringProps) {
|
|
1514
|
+
if (newEntry[prop] == null) {
|
|
1515
|
+
newEntry[prop] = "";
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
if (newEntry.author_reputation == null) {
|
|
1519
|
+
newEntry.author_reputation = 0;
|
|
1520
|
+
}
|
|
1521
|
+
if (newEntry.children == null) {
|
|
1522
|
+
newEntry.children = 0;
|
|
1523
|
+
}
|
|
1524
|
+
if (newEntry.depth == null) {
|
|
1525
|
+
newEntry.depth = 0;
|
|
1526
|
+
}
|
|
1527
|
+
if (newEntry.net_rshares == null) {
|
|
1528
|
+
newEntry.net_rshares = 0;
|
|
1529
|
+
}
|
|
1530
|
+
if (newEntry.payout == null) {
|
|
1531
|
+
newEntry.payout = 0;
|
|
1532
|
+
}
|
|
1533
|
+
if (newEntry.percent_hbd == null) {
|
|
1534
|
+
newEntry.percent_hbd = 0;
|
|
1535
|
+
}
|
|
1536
|
+
if (!newEntry.stats) {
|
|
1537
|
+
newEntry.stats = {
|
|
1538
|
+
flag_weight: 0,
|
|
1539
|
+
gray: false,
|
|
1540
|
+
hide: false,
|
|
1541
|
+
total_votes: 0
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
if (newEntry.author_payout_value == null) {
|
|
1545
|
+
newEntry.author_payout_value = "0.000 HBD";
|
|
1546
|
+
}
|
|
1547
|
+
if (newEntry.curator_payout_value == null) {
|
|
1548
|
+
newEntry.curator_payout_value = "0.000 HBD";
|
|
1549
|
+
}
|
|
1550
|
+
if (newEntry.max_accepted_payout == null) {
|
|
1551
|
+
newEntry.max_accepted_payout = "1000000.000 HBD";
|
|
1552
|
+
}
|
|
1553
|
+
if (newEntry.payout_at == null) {
|
|
1554
|
+
newEntry.payout_at = "";
|
|
1555
|
+
}
|
|
1556
|
+
if (newEntry.pending_payout_value == null) {
|
|
1557
|
+
newEntry.pending_payout_value = "0.000 HBD";
|
|
1558
|
+
}
|
|
1559
|
+
if (newEntry.promoted == null) {
|
|
1560
|
+
newEntry.promoted = "0.000 HBD";
|
|
1561
|
+
}
|
|
1562
|
+
if (newEntry.is_paidout == null) {
|
|
1563
|
+
newEntry.is_paidout = false;
|
|
1564
|
+
}
|
|
1565
|
+
return newEntry;
|
|
1566
|
+
}
|
|
1567
|
+
async function getPost(author = "", permlink = "", observer = "", num) {
|
|
1568
|
+
const resp = await bridgeApiCall("get_post", {
|
|
1569
|
+
author,
|
|
1570
|
+
permlink,
|
|
1571
|
+
observer
|
|
1572
|
+
});
|
|
1573
|
+
if (resp) {
|
|
1574
|
+
const validatedEntry = validateEntry(resp);
|
|
1575
|
+
const post = await resolvePost(validatedEntry, observer, num);
|
|
1576
|
+
return filterDmcaEntry(post);
|
|
1577
|
+
}
|
|
1578
|
+
return void 0;
|
|
1579
|
+
}
|
|
1580
|
+
async function getPostHeader(author = "", permlink = "") {
|
|
1581
|
+
const resp = await bridgeApiCall("get_post_header", {
|
|
1582
|
+
author,
|
|
1583
|
+
permlink
|
|
1584
|
+
});
|
|
1585
|
+
return resp ? validateEntry(resp) : resp;
|
|
1586
|
+
}
|
|
1587
|
+
async function getDiscussion(author, permlink, observer) {
|
|
1588
|
+
const resp = await bridgeApiCall("get_discussion", {
|
|
1589
|
+
author,
|
|
1590
|
+
permlink,
|
|
1591
|
+
observer: observer || author
|
|
1592
|
+
});
|
|
1593
|
+
if (resp) {
|
|
1594
|
+
const validatedResp = {};
|
|
1595
|
+
for (const [key, entry] of Object.entries(resp)) {
|
|
1596
|
+
validatedResp[key] = validateEntry(entry);
|
|
1597
|
+
}
|
|
1598
|
+
return validatedResp;
|
|
1599
|
+
}
|
|
1600
|
+
return resp;
|
|
1601
|
+
}
|
|
1602
|
+
async function getCommunity(name, observer = "") {
|
|
1603
|
+
return bridgeApiCall("get_community", { name, observer });
|
|
1604
|
+
}
|
|
1605
|
+
async function getCommunities(last = "", limit = 100, query, sort = "rank", observer = "") {
|
|
1606
|
+
return bridgeApiCall("list_communities", {
|
|
1607
|
+
last,
|
|
1608
|
+
limit,
|
|
1609
|
+
query,
|
|
1610
|
+
sort,
|
|
1611
|
+
observer
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
async function normalizePost(post) {
|
|
1615
|
+
const resp = await bridgeApiCall("normalize_post", { post });
|
|
1616
|
+
return resp ? validateEntry(resp) : resp;
|
|
1617
|
+
}
|
|
1618
|
+
async function getSubscriptions(account) {
|
|
1619
|
+
return bridgeApiCall("list_all_subscriptions", { account });
|
|
1620
|
+
}
|
|
1621
|
+
async function getSubscribers(community) {
|
|
1622
|
+
return bridgeApiCall("list_subscribers", { community });
|
|
1623
|
+
}
|
|
1624
|
+
async function getRelationshipBetweenAccounts(follower, following) {
|
|
1625
|
+
return bridgeApiCall("get_relationship_between_accounts", [
|
|
1626
|
+
follower,
|
|
1627
|
+
following
|
|
1628
|
+
]);
|
|
1629
|
+
}
|
|
1630
|
+
async function getProfiles(accounts, observer) {
|
|
1631
|
+
return bridgeApiCall("get_profiles", { accounts, observer });
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
// src/modules/posts/queries/get-discussions-query-options.ts
|
|
1391
1635
|
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
1392
1636
|
SortOrder2["trending"] = "trending";
|
|
1393
1637
|
SortOrder2["author_reputation"] = "author_reputation";
|
|
@@ -1485,6 +1729,13 @@ function getDiscussionsQueryOptions(entry, order = "created" /* created */, enab
|
|
|
1485
1729
|
select: (data) => sortDiscussions(entry, data, order)
|
|
1486
1730
|
});
|
|
1487
1731
|
}
|
|
1732
|
+
function getDiscussionQueryOptions(author, permlink, observer, enabled = true) {
|
|
1733
|
+
return reactQuery.queryOptions({
|
|
1734
|
+
queryKey: ["posts", "discussion", author, permlink, observer || author],
|
|
1735
|
+
enabled: enabled && !!author && !!permlink,
|
|
1736
|
+
queryFn: async () => getDiscussion(author, permlink, observer)
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1488
1739
|
function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit = 20, observer = "", enabled = true) {
|
|
1489
1740
|
return reactQuery.infiniteQueryOptions({
|
|
1490
1741
|
queryKey: ["posts", "account-posts", username ?? "", filter, limit, observer],
|
|
@@ -1534,6 +1785,35 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
|
|
|
1534
1785
|
}
|
|
1535
1786
|
});
|
|
1536
1787
|
}
|
|
1788
|
+
function getAccountPostsQueryOptions(username, filter = "posts", start_author = "", start_permlink = "", limit = 20, observer = "", enabled = true) {
|
|
1789
|
+
return reactQuery.queryOptions({
|
|
1790
|
+
queryKey: [
|
|
1791
|
+
"posts",
|
|
1792
|
+
"account-posts-page",
|
|
1793
|
+
username ?? "",
|
|
1794
|
+
filter,
|
|
1795
|
+
start_author,
|
|
1796
|
+
start_permlink,
|
|
1797
|
+
limit,
|
|
1798
|
+
observer
|
|
1799
|
+
],
|
|
1800
|
+
enabled: !!username && enabled,
|
|
1801
|
+
queryFn: async () => {
|
|
1802
|
+
if (!username) {
|
|
1803
|
+
return [];
|
|
1804
|
+
}
|
|
1805
|
+
const response = await getAccountPosts(
|
|
1806
|
+
filter,
|
|
1807
|
+
username,
|
|
1808
|
+
start_author,
|
|
1809
|
+
start_permlink,
|
|
1810
|
+
limit,
|
|
1811
|
+
observer
|
|
1812
|
+
);
|
|
1813
|
+
return filterDmcaEntry(response ?? []);
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1537
1817
|
function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = "", enabled = true, _options = {}) {
|
|
1538
1818
|
return reactQuery.infiniteQueryOptions({
|
|
1539
1819
|
queryKey: ["posts", "posts-ranked", sort, tag, limit, observer],
|
|
@@ -1581,6 +1861,36 @@ function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = ""
|
|
|
1581
1861
|
}
|
|
1582
1862
|
});
|
|
1583
1863
|
}
|
|
1864
|
+
function getPostsRankedQueryOptions(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "", enabled = true) {
|
|
1865
|
+
return reactQuery.queryOptions({
|
|
1866
|
+
queryKey: [
|
|
1867
|
+
"posts",
|
|
1868
|
+
"posts-ranked-page",
|
|
1869
|
+
sort,
|
|
1870
|
+
start_author,
|
|
1871
|
+
start_permlink,
|
|
1872
|
+
limit,
|
|
1873
|
+
tag,
|
|
1874
|
+
observer
|
|
1875
|
+
],
|
|
1876
|
+
enabled,
|
|
1877
|
+
queryFn: async () => {
|
|
1878
|
+
let sanitizedTag = tag;
|
|
1879
|
+
if (CONFIG.dmcaTagRegexes.some((regex) => regex.test(tag))) {
|
|
1880
|
+
sanitizedTag = "";
|
|
1881
|
+
}
|
|
1882
|
+
const response = await getPostsRanked(
|
|
1883
|
+
sort,
|
|
1884
|
+
start_author,
|
|
1885
|
+
start_permlink,
|
|
1886
|
+
limit,
|
|
1887
|
+
sanitizedTag,
|
|
1888
|
+
observer
|
|
1889
|
+
);
|
|
1890
|
+
return filterDmcaEntry(response ?? []);
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1584
1894
|
function getReblogsQueryOptions(username, activeUsername, limit = 200) {
|
|
1585
1895
|
return reactQuery.queryOptions({
|
|
1586
1896
|
queryKey: ["posts", "reblogs", username ?? "", limit],
|
|
@@ -1818,8 +2128,8 @@ function toEntryArray(x) {
|
|
|
1818
2128
|
return Array.isArray(x) ? x : [];
|
|
1819
2129
|
}
|
|
1820
2130
|
async function getVisibleFirstLevelThreadItems(container) {
|
|
1821
|
-
const
|
|
1822
|
-
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(
|
|
2131
|
+
const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
|
|
2132
|
+
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
|
|
1823
2133
|
const discussionItems = toEntryArray(discussionItemsRaw);
|
|
1824
2134
|
if (discussionItems.length <= 1) {
|
|
1825
2135
|
return [];
|
|
@@ -2028,6 +2338,18 @@ function getWavesTrendingTagsQueryOptions(host, hours = 24) {
|
|
|
2028
2338
|
}
|
|
2029
2339
|
});
|
|
2030
2340
|
}
|
|
2341
|
+
function getNormalizePostQueryOptions(post, enabled = true) {
|
|
2342
|
+
return reactQuery.queryOptions({
|
|
2343
|
+
queryKey: [
|
|
2344
|
+
"posts",
|
|
2345
|
+
"normalize",
|
|
2346
|
+
post?.author ?? "",
|
|
2347
|
+
post?.permlink ?? ""
|
|
2348
|
+
],
|
|
2349
|
+
enabled: enabled && !!post,
|
|
2350
|
+
queryFn: async () => normalizePost(post)
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2031
2353
|
|
|
2032
2354
|
// src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts
|
|
2033
2355
|
function isEntry(x) {
|
|
@@ -2078,6 +2400,13 @@ function getAccountVoteHistoryInfiniteQueryOptions(username, options) {
|
|
|
2078
2400
|
})
|
|
2079
2401
|
});
|
|
2080
2402
|
}
|
|
2403
|
+
function getProfilesQueryOptions(accounts, observer, enabled = true) {
|
|
2404
|
+
return reactQuery.queryOptions({
|
|
2405
|
+
queryKey: ["accounts", "profiles", accounts, observer ?? ""],
|
|
2406
|
+
enabled: enabled && accounts.length > 0,
|
|
2407
|
+
queryFn: async () => getProfiles(accounts, observer)
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2081
2410
|
|
|
2082
2411
|
// src/modules/accounts/mutations/use-account-update.ts
|
|
2083
2412
|
function useAccountUpdate(username, accessToken, auth) {
|
|
@@ -2531,6 +2860,152 @@ function useAccountRevokeKey(username, options) {
|
|
|
2531
2860
|
...options
|
|
2532
2861
|
});
|
|
2533
2862
|
}
|
|
2863
|
+
|
|
2864
|
+
// src/modules/accounts/utils/account-power.ts
|
|
2865
|
+
var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
|
|
2866
|
+
function vestsToRshares(vests, votingPowerValue, votePerc) {
|
|
2867
|
+
const vestingShares = vests * 1e6;
|
|
2868
|
+
const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
|
|
2869
|
+
return power * vestingShares / 1e4;
|
|
2870
|
+
}
|
|
2871
|
+
function toDhiveAccountForVotingMana(account) {
|
|
2872
|
+
return {
|
|
2873
|
+
id: 0,
|
|
2874
|
+
name: account.name,
|
|
2875
|
+
owner: account.owner,
|
|
2876
|
+
active: account.active,
|
|
2877
|
+
posting: account.posting,
|
|
2878
|
+
memo_key: account.memo_key,
|
|
2879
|
+
json_metadata: account.json_metadata,
|
|
2880
|
+
posting_json_metadata: account.posting_json_metadata,
|
|
2881
|
+
proxy: account.proxy ?? "",
|
|
2882
|
+
last_owner_update: "",
|
|
2883
|
+
last_account_update: "",
|
|
2884
|
+
created: account.created,
|
|
2885
|
+
mined: false,
|
|
2886
|
+
owner_challenged: false,
|
|
2887
|
+
active_challenged: false,
|
|
2888
|
+
last_owner_proved: "",
|
|
2889
|
+
last_active_proved: "",
|
|
2890
|
+
recovery_account: account.recovery_account ?? "",
|
|
2891
|
+
reset_account: "",
|
|
2892
|
+
last_account_recovery: "",
|
|
2893
|
+
comment_count: 0,
|
|
2894
|
+
lifetime_vote_count: 0,
|
|
2895
|
+
post_count: account.post_count,
|
|
2896
|
+
can_vote: true,
|
|
2897
|
+
voting_power: account.voting_power,
|
|
2898
|
+
last_vote_time: account.last_vote_time,
|
|
2899
|
+
voting_manabar: account.voting_manabar,
|
|
2900
|
+
balance: account.balance,
|
|
2901
|
+
savings_balance: account.savings_balance,
|
|
2902
|
+
hbd_balance: account.hbd_balance,
|
|
2903
|
+
hbd_seconds: "0",
|
|
2904
|
+
hbd_seconds_last_update: "",
|
|
2905
|
+
hbd_last_interest_payment: "",
|
|
2906
|
+
savings_hbd_balance: account.savings_hbd_balance,
|
|
2907
|
+
savings_hbd_seconds: account.savings_hbd_seconds,
|
|
2908
|
+
savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
|
|
2909
|
+
savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
|
|
2910
|
+
savings_withdraw_requests: 0,
|
|
2911
|
+
reward_hbd_balance: account.reward_hbd_balance,
|
|
2912
|
+
reward_hive_balance: account.reward_hive_balance,
|
|
2913
|
+
reward_vesting_balance: account.reward_vesting_balance,
|
|
2914
|
+
reward_vesting_hive: account.reward_vesting_hive,
|
|
2915
|
+
curation_rewards: 0,
|
|
2916
|
+
posting_rewards: 0,
|
|
2917
|
+
vesting_shares: account.vesting_shares,
|
|
2918
|
+
delegated_vesting_shares: account.delegated_vesting_shares,
|
|
2919
|
+
received_vesting_shares: account.received_vesting_shares,
|
|
2920
|
+
vesting_withdraw_rate: account.vesting_withdraw_rate,
|
|
2921
|
+
next_vesting_withdrawal: account.next_vesting_withdrawal,
|
|
2922
|
+
withdrawn: account.withdrawn,
|
|
2923
|
+
to_withdraw: account.to_withdraw,
|
|
2924
|
+
withdraw_routes: 0,
|
|
2925
|
+
proxied_vsf_votes: account.proxied_vsf_votes ?? [],
|
|
2926
|
+
witnesses_voted_for: 0,
|
|
2927
|
+
average_bandwidth: 0,
|
|
2928
|
+
lifetime_bandwidth: 0,
|
|
2929
|
+
last_bandwidth_update: "",
|
|
2930
|
+
average_market_bandwidth: 0,
|
|
2931
|
+
lifetime_market_bandwidth: 0,
|
|
2932
|
+
last_market_bandwidth_update: "",
|
|
2933
|
+
last_post: account.last_post,
|
|
2934
|
+
last_root_post: ""
|
|
2935
|
+
};
|
|
2936
|
+
}
|
|
2937
|
+
function votingPower(account) {
|
|
2938
|
+
const calc = CONFIG.hiveClient.rc.calculateVPMana(
|
|
2939
|
+
toDhiveAccountForVotingMana(account)
|
|
2940
|
+
);
|
|
2941
|
+
return calc.percentage / 100;
|
|
2942
|
+
}
|
|
2943
|
+
function powerRechargeTime(power) {
|
|
2944
|
+
if (!Number.isFinite(power)) {
|
|
2945
|
+
throw new TypeError("Voting power must be a finite number");
|
|
2946
|
+
}
|
|
2947
|
+
if (power < 0 || power > 100) {
|
|
2948
|
+
throw new RangeError("Voting power must be between 0 and 100");
|
|
2949
|
+
}
|
|
2950
|
+
const missingPower = 100 - power;
|
|
2951
|
+
return missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS / 1e4;
|
|
2952
|
+
}
|
|
2953
|
+
function downVotingPower(account) {
|
|
2954
|
+
const totalShares = parseFloat(account.vesting_shares) + parseFloat(account.received_vesting_shares) - parseFloat(account.delegated_vesting_shares);
|
|
2955
|
+
const elapsed = Math.floor(Date.now() / 1e3) - account.downvote_manabar.last_update_time;
|
|
2956
|
+
const maxMana = totalShares * 1e6 / 4;
|
|
2957
|
+
if (maxMana <= 0) {
|
|
2958
|
+
return 0;
|
|
2959
|
+
}
|
|
2960
|
+
let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
|
|
2961
|
+
if (currentMana > maxMana) {
|
|
2962
|
+
currentMana = maxMana;
|
|
2963
|
+
}
|
|
2964
|
+
const currentManaPerc = currentMana * 100 / maxMana;
|
|
2965
|
+
if (isNaN(currentManaPerc)) {
|
|
2966
|
+
return 0;
|
|
2967
|
+
}
|
|
2968
|
+
if (currentManaPerc > 100) {
|
|
2969
|
+
return 100;
|
|
2970
|
+
}
|
|
2971
|
+
return currentManaPerc;
|
|
2972
|
+
}
|
|
2973
|
+
function rcPower(account) {
|
|
2974
|
+
const calc = CONFIG.hiveClient.rc.calculateRCMana(account);
|
|
2975
|
+
return calc.percentage / 100;
|
|
2976
|
+
}
|
|
2977
|
+
function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
|
|
2978
|
+
if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {
|
|
2979
|
+
return 0;
|
|
2980
|
+
}
|
|
2981
|
+
const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;
|
|
2982
|
+
if (!Number.isFinite(fundRecentClaims) || !Number.isFinite(fundRewardBalance) || !Number.isFinite(base) || !Number.isFinite(quote)) {
|
|
2983
|
+
return 0;
|
|
2984
|
+
}
|
|
2985
|
+
if (fundRecentClaims === 0 || quote === 0) {
|
|
2986
|
+
return 0;
|
|
2987
|
+
}
|
|
2988
|
+
let totalVests = 0;
|
|
2989
|
+
try {
|
|
2990
|
+
const vesting = parseAsset(account.vesting_shares).amount;
|
|
2991
|
+
const received = parseAsset(account.received_vesting_shares).amount;
|
|
2992
|
+
const delegated = parseAsset(account.delegated_vesting_shares).amount;
|
|
2993
|
+
if (![vesting, received, delegated].every(Number.isFinite)) {
|
|
2994
|
+
return 0;
|
|
2995
|
+
}
|
|
2996
|
+
totalVests = vesting + received - delegated;
|
|
2997
|
+
} catch {
|
|
2998
|
+
return 0;
|
|
2999
|
+
}
|
|
3000
|
+
if (!Number.isFinite(totalVests)) {
|
|
3001
|
+
return 0;
|
|
3002
|
+
}
|
|
3003
|
+
const rShares = vestsToRshares(totalVests, votingPowerValue, weight);
|
|
3004
|
+
if (!Number.isFinite(rShares)) {
|
|
3005
|
+
return 0;
|
|
3006
|
+
}
|
|
3007
|
+
return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
|
|
3008
|
+
}
|
|
2534
3009
|
function useSignOperationByKey(username) {
|
|
2535
3010
|
return reactQuery.useMutation({
|
|
2536
3011
|
mutationKey: ["operations", "sign", username],
|
|
@@ -2688,6 +3163,33 @@ function useRemoveFragment(username, fragmentId, code) {
|
|
|
2688
3163
|
});
|
|
2689
3164
|
}
|
|
2690
3165
|
|
|
3166
|
+
// src/modules/posts/utils/validate-post-creating.ts
|
|
3167
|
+
var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
|
|
3168
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3169
|
+
async function getContent(author, permlink) {
|
|
3170
|
+
return CONFIG.hiveClient.call("condenser_api", "get_content", [
|
|
3171
|
+
author,
|
|
3172
|
+
permlink
|
|
3173
|
+
]);
|
|
3174
|
+
}
|
|
3175
|
+
async function validatePostCreating(author, permlink, attempts = 0, options) {
|
|
3176
|
+
const delays = options?.delays ?? DEFAULT_VALIDATE_POST_DELAYS;
|
|
3177
|
+
let response;
|
|
3178
|
+
try {
|
|
3179
|
+
response = await getContent(author, permlink);
|
|
3180
|
+
} catch (e) {
|
|
3181
|
+
response = void 0;
|
|
3182
|
+
}
|
|
3183
|
+
if (response || attempts >= delays.length) {
|
|
3184
|
+
return;
|
|
3185
|
+
}
|
|
3186
|
+
const waitMs = delays[attempts];
|
|
3187
|
+
if (waitMs > 0) {
|
|
3188
|
+
await delay(waitMs);
|
|
3189
|
+
}
|
|
3190
|
+
return validatePostCreating(author, permlink, attempts + 1, options);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
2691
3193
|
// src/modules/analytics/mutations/index.ts
|
|
2692
3194
|
var mutations_exports = {};
|
|
2693
3195
|
__export(mutations_exports, {
|
|
@@ -3076,6 +3578,13 @@ function getCommunityContextQueryOptions(username, communityName) {
|
|
|
3076
3578
|
}
|
|
3077
3579
|
});
|
|
3078
3580
|
}
|
|
3581
|
+
function getCommunityQueryOptions(name, observer = "", enabled = true) {
|
|
3582
|
+
return reactQuery.queryOptions({
|
|
3583
|
+
queryKey: ["community", "single", name, observer],
|
|
3584
|
+
enabled: enabled && !!name,
|
|
3585
|
+
queryFn: async () => getCommunity(name ?? "", observer)
|
|
3586
|
+
});
|
|
3587
|
+
}
|
|
3079
3588
|
function getCommunitySubscribersQueryOptions(communityName) {
|
|
3080
3589
|
return reactQuery.queryOptions({
|
|
3081
3590
|
queryKey: ["communities", "subscribers", communityName],
|
|
@@ -3518,6 +4027,25 @@ function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
|
|
|
3518
4027
|
getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
|
|
3519
4028
|
});
|
|
3520
4029
|
}
|
|
4030
|
+
function getIncomingRcQueryOptions(username) {
|
|
4031
|
+
return reactQuery.queryOptions({
|
|
4032
|
+
queryKey: ["wallet", "incoming-rc", username],
|
|
4033
|
+
enabled: !!username,
|
|
4034
|
+
queryFn: async () => {
|
|
4035
|
+
if (!username) {
|
|
4036
|
+
throw new Error("[SDK][Wallet] - Missing username for incoming RC");
|
|
4037
|
+
}
|
|
4038
|
+
const fetchApi = getBoundFetch();
|
|
4039
|
+
const response = await fetchApi(
|
|
4040
|
+
`${CONFIG.privateApiHost}/private-api/received-rc/${username}`
|
|
4041
|
+
);
|
|
4042
|
+
if (!response.ok) {
|
|
4043
|
+
throw new Error(`Failed to fetch incoming RC: ${response.status}`);
|
|
4044
|
+
}
|
|
4045
|
+
return response.json();
|
|
4046
|
+
}
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
3521
4049
|
function getReceivedVestingSharesQueryOptions(username) {
|
|
3522
4050
|
return reactQuery.queryOptions({
|
|
3523
4051
|
queryKey: ["wallet", "received-vesting-shares", username],
|
|
@@ -3562,15 +4090,15 @@ function getMarketStatisticsQueryOptions() {
|
|
|
3562
4090
|
});
|
|
3563
4091
|
}
|
|
3564
4092
|
function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
|
|
3565
|
-
const
|
|
4093
|
+
const formatDate2 = (date) => {
|
|
3566
4094
|
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
3567
4095
|
};
|
|
3568
4096
|
return reactQuery.queryOptions({
|
|
3569
4097
|
queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
|
|
3570
4098
|
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
|
|
3571
4099
|
seconds,
|
|
3572
|
-
|
|
3573
|
-
|
|
4100
|
+
formatDate2(startDate),
|
|
4101
|
+
formatDate2(endDate)
|
|
3574
4102
|
])
|
|
3575
4103
|
});
|
|
3576
4104
|
}
|
|
@@ -3585,13 +4113,13 @@ function getHiveHbdStatsQueryOptions() {
|
|
|
3585
4113
|
);
|
|
3586
4114
|
const now = /* @__PURE__ */ new Date();
|
|
3587
4115
|
const oneDayAgo = new Date(now.getTime() - 864e5);
|
|
3588
|
-
const
|
|
4116
|
+
const formatDate2 = (date) => {
|
|
3589
4117
|
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
3590
4118
|
};
|
|
3591
4119
|
const dayChange = await CONFIG.hiveClient.call(
|
|
3592
4120
|
"condenser_api",
|
|
3593
4121
|
"get_market_history",
|
|
3594
|
-
[86400,
|
|
4122
|
+
[86400, formatDate2(oneDayAgo), formatDate2(now)]
|
|
3595
4123
|
);
|
|
3596
4124
|
const result = {
|
|
3597
4125
|
price: +stats.latest,
|
|
@@ -3620,6 +4148,21 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
|
|
|
3620
4148
|
}
|
|
3621
4149
|
});
|
|
3622
4150
|
}
|
|
4151
|
+
function formatDate(date) {
|
|
4152
|
+
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4153
|
+
}
|
|
4154
|
+
function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
|
|
4155
|
+
const end = endDate ?? /* @__PURE__ */ new Date();
|
|
4156
|
+
const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
|
|
4157
|
+
return reactQuery.queryOptions({
|
|
4158
|
+
queryKey: ["market", "trade-history", limit, start.getTime(), end.getTime()],
|
|
4159
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_trade_history", [
|
|
4160
|
+
formatDate(start),
|
|
4161
|
+
formatDate(end),
|
|
4162
|
+
limit
|
|
4163
|
+
])
|
|
4164
|
+
});
|
|
4165
|
+
}
|
|
3623
4166
|
|
|
3624
4167
|
// src/modules/market/requests.ts
|
|
3625
4168
|
async function parseJsonResponse(response) {
|
|
@@ -3930,6 +4473,89 @@ function getSearchPathQueryOptions(q) {
|
|
|
3930
4473
|
}
|
|
3931
4474
|
});
|
|
3932
4475
|
}
|
|
4476
|
+
|
|
4477
|
+
// src/modules/search/requests.ts
|
|
4478
|
+
async function parseJsonResponse2(response) {
|
|
4479
|
+
const parseBody = async () => {
|
|
4480
|
+
try {
|
|
4481
|
+
return await response.json();
|
|
4482
|
+
} catch {
|
|
4483
|
+
try {
|
|
4484
|
+
return await response.text();
|
|
4485
|
+
} catch {
|
|
4486
|
+
return void 0;
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
};
|
|
4490
|
+
const data = await parseBody();
|
|
4491
|
+
if (!response.ok) {
|
|
4492
|
+
const error = new Error(`Request failed with status ${response.status}`);
|
|
4493
|
+
error.status = response.status;
|
|
4494
|
+
error.data = data;
|
|
4495
|
+
throw error;
|
|
4496
|
+
}
|
|
4497
|
+
if (data === void 0) {
|
|
4498
|
+
throw new Error("Response body was empty or invalid JSON");
|
|
4499
|
+
}
|
|
4500
|
+
return data;
|
|
4501
|
+
}
|
|
4502
|
+
async function search(q, sort, hideLow, since, scroll_id, votes) {
|
|
4503
|
+
const data = { q, sort, hide_low: hideLow };
|
|
4504
|
+
if (since) {
|
|
4505
|
+
data.since = since;
|
|
4506
|
+
}
|
|
4507
|
+
if (scroll_id) {
|
|
4508
|
+
data.scroll_id = scroll_id;
|
|
4509
|
+
}
|
|
4510
|
+
if (votes) {
|
|
4511
|
+
data.votes = votes;
|
|
4512
|
+
}
|
|
4513
|
+
const fetchApi = getBoundFetch();
|
|
4514
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search", {
|
|
4515
|
+
method: "POST",
|
|
4516
|
+
headers: {
|
|
4517
|
+
"Content-Type": "application/json"
|
|
4518
|
+
},
|
|
4519
|
+
body: JSON.stringify(data)
|
|
4520
|
+
});
|
|
4521
|
+
return parseJsonResponse2(response);
|
|
4522
|
+
}
|
|
4523
|
+
async function searchAccount(q = "", limit = 20, random = 1) {
|
|
4524
|
+
const data = { q, limit, random };
|
|
4525
|
+
const fetchApi = getBoundFetch();
|
|
4526
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-account", {
|
|
4527
|
+
method: "POST",
|
|
4528
|
+
headers: {
|
|
4529
|
+
"Content-Type": "application/json"
|
|
4530
|
+
},
|
|
4531
|
+
body: JSON.stringify(data)
|
|
4532
|
+
});
|
|
4533
|
+
return parseJsonResponse2(response);
|
|
4534
|
+
}
|
|
4535
|
+
async function searchTag(q = "", limit = 20, random = 0) {
|
|
4536
|
+
const data = { q, limit, random };
|
|
4537
|
+
const fetchApi = getBoundFetch();
|
|
4538
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-tag", {
|
|
4539
|
+
method: "POST",
|
|
4540
|
+
headers: {
|
|
4541
|
+
"Content-Type": "application/json"
|
|
4542
|
+
},
|
|
4543
|
+
body: JSON.stringify(data)
|
|
4544
|
+
});
|
|
4545
|
+
return parseJsonResponse2(response);
|
|
4546
|
+
}
|
|
4547
|
+
async function searchPath(q) {
|
|
4548
|
+
const fetchApi = getBoundFetch();
|
|
4549
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-path", {
|
|
4550
|
+
method: "POST",
|
|
4551
|
+
headers: {
|
|
4552
|
+
"Content-Type": "application/json"
|
|
4553
|
+
},
|
|
4554
|
+
body: JSON.stringify({ q })
|
|
4555
|
+
});
|
|
4556
|
+
const data = await parseJsonResponse2(response);
|
|
4557
|
+
return data?.length > 0 ? data : [q];
|
|
4558
|
+
}
|
|
3933
4559
|
function getBoostPlusPricesQueryOptions(accessToken) {
|
|
3934
4560
|
return reactQuery.queryOptions({
|
|
3935
4561
|
queryKey: ["promotions", "boost-plus-prices"],
|
|
@@ -4001,7 +4627,7 @@ function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
|
|
|
4001
4627
|
}
|
|
4002
4628
|
|
|
4003
4629
|
// src/modules/private-api/requests.ts
|
|
4004
|
-
async function
|
|
4630
|
+
async function parseJsonResponse3(response) {
|
|
4005
4631
|
if (!response.ok) {
|
|
4006
4632
|
let errorData = void 0;
|
|
4007
4633
|
try {
|
|
@@ -4025,7 +4651,7 @@ async function signUp(username, email, referral) {
|
|
|
4025
4651
|
},
|
|
4026
4652
|
body: JSON.stringify({ username, email, referral })
|
|
4027
4653
|
});
|
|
4028
|
-
const data = await
|
|
4654
|
+
const data = await parseJsonResponse3(response);
|
|
4029
4655
|
return { status: response.status, data };
|
|
4030
4656
|
}
|
|
4031
4657
|
async function subscribeEmail(email) {
|
|
@@ -4037,7 +4663,7 @@ async function subscribeEmail(email) {
|
|
|
4037
4663
|
},
|
|
4038
4664
|
body: JSON.stringify({ email })
|
|
4039
4665
|
});
|
|
4040
|
-
const data = await
|
|
4666
|
+
const data = await parseJsonResponse3(response);
|
|
4041
4667
|
return { status: response.status, data };
|
|
4042
4668
|
}
|
|
4043
4669
|
async function usrActivity(code, ty, bl = "", tx = "") {
|
|
@@ -4056,7 +4682,7 @@ async function usrActivity(code, ty, bl = "", tx = "") {
|
|
|
4056
4682
|
},
|
|
4057
4683
|
body: JSON.stringify(params)
|
|
4058
4684
|
});
|
|
4059
|
-
await
|
|
4685
|
+
await parseJsonResponse3(response);
|
|
4060
4686
|
}
|
|
4061
4687
|
async function getNotifications(code, filter, since = null, user = null) {
|
|
4062
4688
|
const data = {
|
|
@@ -4079,7 +4705,7 @@ async function getNotifications(code, filter, since = null, user = null) {
|
|
|
4079
4705
|
},
|
|
4080
4706
|
body: JSON.stringify(data)
|
|
4081
4707
|
});
|
|
4082
|
-
return
|
|
4708
|
+
return parseJsonResponse3(response);
|
|
4083
4709
|
}
|
|
4084
4710
|
async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
|
|
4085
4711
|
const data = {
|
|
@@ -4098,7 +4724,7 @@ async function saveNotificationSetting(code, username, system, allows_notify, no
|
|
|
4098
4724
|
},
|
|
4099
4725
|
body: JSON.stringify(data)
|
|
4100
4726
|
});
|
|
4101
|
-
return
|
|
4727
|
+
return parseJsonResponse3(response);
|
|
4102
4728
|
}
|
|
4103
4729
|
async function getNotificationSetting(code, username, token) {
|
|
4104
4730
|
const data = { code, username, token };
|
|
@@ -4110,7 +4736,7 @@ async function getNotificationSetting(code, username, token) {
|
|
|
4110
4736
|
},
|
|
4111
4737
|
body: JSON.stringify(data)
|
|
4112
4738
|
});
|
|
4113
|
-
return
|
|
4739
|
+
return parseJsonResponse3(response);
|
|
4114
4740
|
}
|
|
4115
4741
|
async function markNotifications(code, id) {
|
|
4116
4742
|
const data = {
|
|
@@ -4127,7 +4753,7 @@ async function markNotifications(code, id) {
|
|
|
4127
4753
|
},
|
|
4128
4754
|
body: JSON.stringify(data)
|
|
4129
4755
|
});
|
|
4130
|
-
return
|
|
4756
|
+
return parseJsonResponse3(response);
|
|
4131
4757
|
}
|
|
4132
4758
|
async function addImage(code, url) {
|
|
4133
4759
|
const data = { code, url };
|
|
@@ -4139,7 +4765,7 @@ async function addImage(code, url) {
|
|
|
4139
4765
|
},
|
|
4140
4766
|
body: JSON.stringify(data)
|
|
4141
4767
|
});
|
|
4142
|
-
return
|
|
4768
|
+
return parseJsonResponse3(response);
|
|
4143
4769
|
}
|
|
4144
4770
|
async function uploadImage(file, token, signal) {
|
|
4145
4771
|
const fetchApi = getBoundFetch();
|
|
@@ -4150,7 +4776,7 @@ async function uploadImage(file, token, signal) {
|
|
|
4150
4776
|
body: formData,
|
|
4151
4777
|
signal
|
|
4152
4778
|
});
|
|
4153
|
-
return
|
|
4779
|
+
return parseJsonResponse3(response);
|
|
4154
4780
|
}
|
|
4155
4781
|
async function deleteImage(code, imageId) {
|
|
4156
4782
|
const data = { code, id: imageId };
|
|
@@ -4162,7 +4788,7 @@ async function deleteImage(code, imageId) {
|
|
|
4162
4788
|
},
|
|
4163
4789
|
body: JSON.stringify(data)
|
|
4164
4790
|
});
|
|
4165
|
-
return
|
|
4791
|
+
return parseJsonResponse3(response);
|
|
4166
4792
|
}
|
|
4167
4793
|
async function addDraft(code, title, body, tags, meta) {
|
|
4168
4794
|
const data = { code, title, body, tags, meta };
|
|
@@ -4174,7 +4800,7 @@ async function addDraft(code, title, body, tags, meta) {
|
|
|
4174
4800
|
},
|
|
4175
4801
|
body: JSON.stringify(data)
|
|
4176
4802
|
});
|
|
4177
|
-
return
|
|
4803
|
+
return parseJsonResponse3(response);
|
|
4178
4804
|
}
|
|
4179
4805
|
async function updateDraft(code, draftId, title, body, tags, meta) {
|
|
4180
4806
|
const data = { code, id: draftId, title, body, tags, meta };
|
|
@@ -4186,7 +4812,7 @@ async function updateDraft(code, draftId, title, body, tags, meta) {
|
|
|
4186
4812
|
},
|
|
4187
4813
|
body: JSON.stringify(data)
|
|
4188
4814
|
});
|
|
4189
|
-
return
|
|
4815
|
+
return parseJsonResponse3(response);
|
|
4190
4816
|
}
|
|
4191
4817
|
async function deleteDraft(code, draftId) {
|
|
4192
4818
|
const data = { code, id: draftId };
|
|
@@ -4198,7 +4824,7 @@ async function deleteDraft(code, draftId) {
|
|
|
4198
4824
|
},
|
|
4199
4825
|
body: JSON.stringify(data)
|
|
4200
4826
|
});
|
|
4201
|
-
return
|
|
4827
|
+
return parseJsonResponse3(response);
|
|
4202
4828
|
}
|
|
4203
4829
|
async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
|
|
4204
4830
|
const data = {
|
|
@@ -4221,7 +4847,7 @@ async function addSchedule(code, permlink, title, body, meta, options, schedule,
|
|
|
4221
4847
|
},
|
|
4222
4848
|
body: JSON.stringify(data)
|
|
4223
4849
|
});
|
|
4224
|
-
return
|
|
4850
|
+
return parseJsonResponse3(response);
|
|
4225
4851
|
}
|
|
4226
4852
|
async function deleteSchedule(code, id) {
|
|
4227
4853
|
const data = { code, id };
|
|
@@ -4233,7 +4859,7 @@ async function deleteSchedule(code, id) {
|
|
|
4233
4859
|
},
|
|
4234
4860
|
body: JSON.stringify(data)
|
|
4235
4861
|
});
|
|
4236
|
-
return
|
|
4862
|
+
return parseJsonResponse3(response);
|
|
4237
4863
|
}
|
|
4238
4864
|
async function moveSchedule(code, id) {
|
|
4239
4865
|
const data = { code, id };
|
|
@@ -4245,7 +4871,7 @@ async function moveSchedule(code, id) {
|
|
|
4245
4871
|
},
|
|
4246
4872
|
body: JSON.stringify(data)
|
|
4247
4873
|
});
|
|
4248
|
-
return
|
|
4874
|
+
return parseJsonResponse3(response);
|
|
4249
4875
|
}
|
|
4250
4876
|
async function getPromotedPost(code, author, permlink) {
|
|
4251
4877
|
const data = { code, author, permlink };
|
|
@@ -4257,7 +4883,7 @@ async function getPromotedPost(code, author, permlink) {
|
|
|
4257
4883
|
},
|
|
4258
4884
|
body: JSON.stringify(data)
|
|
4259
4885
|
});
|
|
4260
|
-
return
|
|
4886
|
+
return parseJsonResponse3(response);
|
|
4261
4887
|
}
|
|
4262
4888
|
async function onboardEmail(username, email, friend) {
|
|
4263
4889
|
const dataBody = {
|
|
@@ -4276,7 +4902,7 @@ async function onboardEmail(username, email, friend) {
|
|
|
4276
4902
|
body: JSON.stringify(dataBody)
|
|
4277
4903
|
}
|
|
4278
4904
|
);
|
|
4279
|
-
return
|
|
4905
|
+
return parseJsonResponse3(response);
|
|
4280
4906
|
}
|
|
4281
4907
|
|
|
4282
4908
|
// src/modules/auth/requests.ts
|
|
@@ -4323,6 +4949,7 @@ exports.ThreeSpeakIntegration = ThreeSpeakIntegration;
|
|
|
4323
4949
|
exports.addDraft = addDraft;
|
|
4324
4950
|
exports.addImage = addImage;
|
|
4325
4951
|
exports.addSchedule = addSchedule;
|
|
4952
|
+
exports.bridgeApiCall = bridgeApiCall;
|
|
4326
4953
|
exports.broadcastJson = broadcastJson;
|
|
4327
4954
|
exports.buildProfileMetadata = buildProfileMetadata;
|
|
4328
4955
|
exports.checkUsernameWalletsPendingQueryOptions = checkUsernameWalletsPendingQueryOptions;
|
|
@@ -4331,15 +4958,19 @@ exports.dedupeAndSortKeyAuths = dedupeAndSortKeyAuths;
|
|
|
4331
4958
|
exports.deleteDraft = deleteDraft;
|
|
4332
4959
|
exports.deleteImage = deleteImage;
|
|
4333
4960
|
exports.deleteSchedule = deleteSchedule;
|
|
4961
|
+
exports.downVotingPower = downVotingPower;
|
|
4334
4962
|
exports.encodeObj = encodeObj;
|
|
4335
4963
|
exports.extractAccountProfile = extractAccountProfile;
|
|
4336
4964
|
exports.getAccessToken = getAccessToken;
|
|
4337
4965
|
exports.getAccountFullQueryOptions = getAccountFullQueryOptions;
|
|
4338
4966
|
exports.getAccountNotificationsInfiniteQueryOptions = getAccountNotificationsInfiniteQueryOptions;
|
|
4339
4967
|
exports.getAccountPendingRecoveryQueryOptions = getAccountPendingRecoveryQueryOptions;
|
|
4968
|
+
exports.getAccountPosts = getAccountPosts;
|
|
4340
4969
|
exports.getAccountPostsInfiniteQueryOptions = getAccountPostsInfiniteQueryOptions;
|
|
4970
|
+
exports.getAccountPostsQueryOptions = getAccountPostsQueryOptions;
|
|
4341
4971
|
exports.getAccountRcQueryOptions = getAccountRcQueryOptions;
|
|
4342
4972
|
exports.getAccountRecoveriesQueryOptions = getAccountRecoveriesQueryOptions;
|
|
4973
|
+
exports.getAccountReputationsQueryOptions = getAccountReputationsQueryOptions;
|
|
4343
4974
|
exports.getAccountSubscriptionsQueryOptions = getAccountSubscriptionsQueryOptions;
|
|
4344
4975
|
exports.getAccountVoteHistoryInfiniteQueryOptions = getAccountVoteHistoryInfiniteQueryOptions;
|
|
4345
4976
|
exports.getAccountsQueryOptions = getAccountsQueryOptions;
|
|
@@ -4353,11 +4984,16 @@ exports.getBoundFetch = getBoundFetch;
|
|
|
4353
4984
|
exports.getChainPropertiesQueryOptions = getChainPropertiesQueryOptions;
|
|
4354
4985
|
exports.getCollateralizedConversionRequestsQueryOptions = getCollateralizedConversionRequestsQueryOptions;
|
|
4355
4986
|
exports.getCommentHistoryQueryOptions = getCommentHistoryQueryOptions;
|
|
4987
|
+
exports.getCommunities = getCommunities;
|
|
4356
4988
|
exports.getCommunitiesQueryOptions = getCommunitiesQueryOptions;
|
|
4989
|
+
exports.getCommunity = getCommunity;
|
|
4357
4990
|
exports.getCommunityContextQueryOptions = getCommunityContextQueryOptions;
|
|
4358
4991
|
exports.getCommunityPermissions = getCommunityPermissions;
|
|
4992
|
+
exports.getCommunityQueryOptions = getCommunityQueryOptions;
|
|
4359
4993
|
exports.getCommunitySubscribersQueryOptions = getCommunitySubscribersQueryOptions;
|
|
4360
4994
|
exports.getCommunityType = getCommunityType;
|
|
4995
|
+
exports.getContentQueryOptions = getContentQueryOptions;
|
|
4996
|
+
exports.getContentRepliesQueryOptions = getContentRepliesQueryOptions;
|
|
4361
4997
|
exports.getControversialRisingInfiniteQueryOptions = getControversialRisingInfiniteQueryOptions;
|
|
4362
4998
|
exports.getConversionRequestsQueryOptions = getConversionRequestsQueryOptions;
|
|
4363
4999
|
exports.getCurrencyRate = getCurrencyRate;
|
|
@@ -4366,6 +5002,8 @@ exports.getCurrencyTokenRate = getCurrencyTokenRate;
|
|
|
4366
5002
|
exports.getDeletedEntryQueryOptions = getDeletedEntryQueryOptions;
|
|
4367
5003
|
exports.getDiscoverCurationQueryOptions = getDiscoverCurationQueryOptions;
|
|
4368
5004
|
exports.getDiscoverLeaderboardQueryOptions = getDiscoverLeaderboardQueryOptions;
|
|
5005
|
+
exports.getDiscussion = getDiscussion;
|
|
5006
|
+
exports.getDiscussionQueryOptions = getDiscussionQueryOptions;
|
|
4369
5007
|
exports.getDiscussionsQueryOptions = getDiscussionsQueryOptions;
|
|
4370
5008
|
exports.getDraftsQueryOptions = getDraftsQueryOptions;
|
|
4371
5009
|
exports.getDynamicPropsQueryOptions = getDynamicPropsQueryOptions;
|
|
@@ -4379,12 +5017,14 @@ exports.getGameStatusCheckQueryOptions = getGameStatusCheckQueryOptions;
|
|
|
4379
5017
|
exports.getHiveHbdStatsQueryOptions = getHiveHbdStatsQueryOptions;
|
|
4380
5018
|
exports.getHivePoshLinksQueryOptions = getHivePoshLinksQueryOptions;
|
|
4381
5019
|
exports.getImagesQueryOptions = getImagesQueryOptions;
|
|
5020
|
+
exports.getIncomingRcQueryOptions = getIncomingRcQueryOptions;
|
|
4382
5021
|
exports.getLoginType = getLoginType;
|
|
4383
5022
|
exports.getMarketData = getMarketData;
|
|
4384
5023
|
exports.getMarketDataQueryOptions = getMarketDataQueryOptions;
|
|
4385
5024
|
exports.getMarketHistoryQueryOptions = getMarketHistoryQueryOptions;
|
|
4386
5025
|
exports.getMarketStatisticsQueryOptions = getMarketStatisticsQueryOptions;
|
|
4387
5026
|
exports.getMutedUsersQueryOptions = getMutedUsersQueryOptions;
|
|
5027
|
+
exports.getNormalizePostQueryOptions = getNormalizePostQueryOptions;
|
|
4388
5028
|
exports.getNotificationSetting = getNotificationSetting;
|
|
4389
5029
|
exports.getNotifications = getNotifications;
|
|
4390
5030
|
exports.getNotificationsInfiniteQueryOptions = getNotificationsInfiniteQueryOptions;
|
|
@@ -4395,11 +5035,17 @@ exports.getOrderBookQueryOptions = getOrderBookQueryOptions;
|
|
|
4395
5035
|
exports.getOutgoingRcDelegationsInfiniteQueryOptions = getOutgoingRcDelegationsInfiniteQueryOptions;
|
|
4396
5036
|
exports.getPageStatsQueryOptions = getPageStatsQueryOptions;
|
|
4397
5037
|
exports.getPointsQueryOptions = getPointsQueryOptions;
|
|
5038
|
+
exports.getPost = getPost;
|
|
5039
|
+
exports.getPostHeader = getPostHeader;
|
|
4398
5040
|
exports.getPostHeaderQueryOptions = getPostHeaderQueryOptions;
|
|
4399
5041
|
exports.getPostQueryOptions = getPostQueryOptions;
|
|
4400
5042
|
exports.getPostTipsQueryOptions = getPostTipsQueryOptions;
|
|
4401
5043
|
exports.getPostingKey = getPostingKey;
|
|
5044
|
+
exports.getPostsRanked = getPostsRanked;
|
|
4402
5045
|
exports.getPostsRankedInfiniteQueryOptions = getPostsRankedInfiniteQueryOptions;
|
|
5046
|
+
exports.getPostsRankedQueryOptions = getPostsRankedQueryOptions;
|
|
5047
|
+
exports.getProfiles = getProfiles;
|
|
5048
|
+
exports.getProfilesQueryOptions = getProfilesQueryOptions;
|
|
4403
5049
|
exports.getPromotePriceQueryOptions = getPromotePriceQueryOptions;
|
|
4404
5050
|
exports.getPromotedPost = getPromotedPost;
|
|
4405
5051
|
exports.getPromotedPostsQuery = getPromotedPostsQuery;
|
|
@@ -4413,6 +5059,7 @@ exports.getReceivedVestingSharesQueryOptions = getReceivedVestingSharesQueryOpti
|
|
|
4413
5059
|
exports.getReferralsInfiniteQueryOptions = getReferralsInfiniteQueryOptions;
|
|
4414
5060
|
exports.getReferralsStatsQueryOptions = getReferralsStatsQueryOptions;
|
|
4415
5061
|
exports.getRefreshToken = getRefreshToken;
|
|
5062
|
+
exports.getRelationshipBetweenAccounts = getRelationshipBetweenAccounts;
|
|
4416
5063
|
exports.getRelationshipBetweenAccountsQueryOptions = getRelationshipBetweenAccountsQueryOptions;
|
|
4417
5064
|
exports.getRewardedCommunitiesQueryOptions = getRewardedCommunitiesQueryOptions;
|
|
4418
5065
|
exports.getSavingsWithdrawFromQueryOptions = getSavingsWithdrawFromQueryOptions;
|
|
@@ -4425,6 +5072,9 @@ exports.getSearchPathQueryOptions = getSearchPathQueryOptions;
|
|
|
4425
5072
|
exports.getSearchTopicsQueryOptions = getSearchTopicsQueryOptions;
|
|
4426
5073
|
exports.getSimilarEntriesQueryOptions = getSimilarEntriesQueryOptions;
|
|
4427
5074
|
exports.getStatsQueryOptions = getStatsQueryOptions;
|
|
5075
|
+
exports.getSubscribers = getSubscribers;
|
|
5076
|
+
exports.getSubscriptions = getSubscriptions;
|
|
5077
|
+
exports.getTradeHistoryQueryOptions = getTradeHistoryQueryOptions;
|
|
4428
5078
|
exports.getTransactionsInfiniteQueryOptions = getTransactionsInfiniteQueryOptions;
|
|
4429
5079
|
exports.getTrendingTagsQueryOptions = getTrendingTagsQueryOptions;
|
|
4430
5080
|
exports.getTrendingTagsWithStatsQueryOptions = getTrendingTagsWithStatsQueryOptions;
|
|
@@ -4445,14 +5095,22 @@ exports.makeQueryClient = makeQueryClient;
|
|
|
4445
5095
|
exports.mapThreadItemsToWaveEntries = mapThreadItemsToWaveEntries;
|
|
4446
5096
|
exports.markNotifications = markNotifications;
|
|
4447
5097
|
exports.moveSchedule = moveSchedule;
|
|
5098
|
+
exports.normalizePost = normalizePost;
|
|
4448
5099
|
exports.normalizeWaveEntryFromApi = normalizeWaveEntryFromApi;
|
|
4449
5100
|
exports.onboardEmail = onboardEmail;
|
|
4450
5101
|
exports.parseAccounts = parseAccounts;
|
|
4451
5102
|
exports.parseAsset = parseAsset;
|
|
4452
5103
|
exports.parseProfileMetadata = parseProfileMetadata;
|
|
5104
|
+
exports.powerRechargeTime = powerRechargeTime;
|
|
5105
|
+
exports.rcPower = rcPower;
|
|
5106
|
+
exports.resolvePost = resolvePost;
|
|
4453
5107
|
exports.roleMap = roleMap;
|
|
4454
5108
|
exports.saveNotificationSetting = saveNotificationSetting;
|
|
5109
|
+
exports.search = search;
|
|
5110
|
+
exports.searchAccount = searchAccount;
|
|
5111
|
+
exports.searchPath = searchPath;
|
|
4455
5112
|
exports.searchQueryOptions = searchQueryOptions;
|
|
5113
|
+
exports.searchTag = searchTag;
|
|
4456
5114
|
exports.signUp = signUp;
|
|
4457
5115
|
exports.sortDiscussions = sortDiscussions;
|
|
4458
5116
|
exports.subscribeEmail = subscribeEmail;
|
|
@@ -4480,5 +5138,8 @@ exports.useSignOperationByHivesigner = useSignOperationByHivesigner;
|
|
|
4480
5138
|
exports.useSignOperationByKey = useSignOperationByKey;
|
|
4481
5139
|
exports.useSignOperationByKeychain = useSignOperationByKeychain;
|
|
4482
5140
|
exports.usrActivity = usrActivity;
|
|
5141
|
+
exports.validatePostCreating = validatePostCreating;
|
|
5142
|
+
exports.votingPower = votingPower;
|
|
5143
|
+
exports.votingValue = votingValue;
|
|
4483
5144
|
//# sourceMappingURL=index.cjs.map
|
|
4484
5145
|
//# sourceMappingURL=index.cjs.map
|