@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.
- package/README.md +145 -10
- package/dist/browser/index.d.ts +216 -75
- package/dist/browser/index.js +1041 -237
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +1088 -238
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +1041 -233
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -33,54 +33,7 @@ var __export = (target, all) => {
|
|
|
33
33
|
for (var name in all)
|
|
34
34
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
// src/modules/keychain/keychain.ts
|
|
38
|
-
var keychain_exports = {};
|
|
39
|
-
__export(keychain_exports, {
|
|
40
|
-
broadcast: () => broadcast,
|
|
41
|
-
customJson: () => customJson,
|
|
42
|
-
handshake: () => handshake
|
|
43
|
-
});
|
|
44
|
-
function handshake() {
|
|
45
|
-
return new Promise((resolve) => {
|
|
46
|
-
window.hive_keychain?.requestHandshake(() => {
|
|
47
|
-
resolve();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
|
|
52
|
-
window.hive_keychain?.requestBroadcast(
|
|
53
|
-
account,
|
|
54
|
-
operations,
|
|
55
|
-
key,
|
|
56
|
-
(resp) => {
|
|
57
|
-
if (!resp.success) {
|
|
58
|
-
reject({ message: "Operation cancelled" });
|
|
59
|
-
}
|
|
60
|
-
resolve(resp);
|
|
61
|
-
},
|
|
62
|
-
rpc
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
|
|
66
|
-
window.hive_keychain?.requestCustomJson(
|
|
67
|
-
account,
|
|
68
|
-
id,
|
|
69
|
-
key,
|
|
70
|
-
json,
|
|
71
|
-
display_msg,
|
|
72
|
-
(resp) => {
|
|
73
|
-
if (!resp.success) {
|
|
74
|
-
reject({ message: "Operation cancelled" });
|
|
75
|
-
}
|
|
76
|
-
resolve(resp);
|
|
77
|
-
},
|
|
78
|
-
rpc
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// src/modules/core/mutations/use-broadcast-mutation.ts
|
|
83
|
-
function useBroadcastMutation(mutationKey = [], username, accessToken, operations, onSuccess = () => {
|
|
36
|
+
function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
|
|
84
37
|
}, auth) {
|
|
85
38
|
return reactQuery.useMutation({
|
|
86
39
|
onSuccess,
|
|
@@ -91,6 +44,9 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
|
|
|
91
44
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
92
45
|
);
|
|
93
46
|
}
|
|
47
|
+
if (auth?.broadcast) {
|
|
48
|
+
return auth.broadcast(operations(payload), "posting");
|
|
49
|
+
}
|
|
94
50
|
const postingKey = auth?.postingKey;
|
|
95
51
|
if (postingKey) {
|
|
96
52
|
const privateKey = dhive.PrivateKey.fromString(postingKey);
|
|
@@ -99,34 +55,12 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
|
|
|
99
55
|
privateKey
|
|
100
56
|
);
|
|
101
57
|
}
|
|
102
|
-
const
|
|
103
|
-
if (loginType && loginType == "keychain") {
|
|
104
|
-
return keychain_exports.broadcast(
|
|
105
|
-
username,
|
|
106
|
-
operations(payload),
|
|
107
|
-
"Posting"
|
|
108
|
-
).then((r) => r.result);
|
|
109
|
-
}
|
|
58
|
+
const accessToken = auth?.accessToken;
|
|
110
59
|
if (accessToken) {
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Authorization: accessToken,
|
|
116
|
-
"Content-Type": "application/json",
|
|
117
|
-
Accept: "application/json"
|
|
118
|
-
},
|
|
119
|
-
body: JSON.stringify({ operations: operations(payload) })
|
|
120
|
-
});
|
|
121
|
-
if (!res.ok) {
|
|
122
|
-
const txt = await res.text().catch(() => "");
|
|
123
|
-
throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
|
|
124
|
-
}
|
|
125
|
-
const json = await res.json();
|
|
126
|
-
if (json?.errors) {
|
|
127
|
-
throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
|
|
128
|
-
}
|
|
129
|
-
return json.result;
|
|
60
|
+
const ops2 = operations(payload);
|
|
61
|
+
const client = new hs__default.default.Client({ accessToken });
|
|
62
|
+
const response = await client.broadcast(ops2);
|
|
63
|
+
return response.result;
|
|
130
64
|
}
|
|
131
65
|
throw new Error(
|
|
132
66
|
"[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
|
|
@@ -134,31 +68,9 @@ function useBroadcastMutation(mutationKey = [], username, accessToken, operation
|
|
|
134
68
|
}
|
|
135
69
|
});
|
|
136
70
|
}
|
|
137
|
-
|
|
138
|
-
// src/modules/core/mock-storage.ts
|
|
139
|
-
var MockStorage = class {
|
|
140
|
-
length = 0;
|
|
141
|
-
clear() {
|
|
142
|
-
throw new Error("Method not implemented.");
|
|
143
|
-
}
|
|
144
|
-
getItem(key) {
|
|
145
|
-
return this[key];
|
|
146
|
-
}
|
|
147
|
-
key(index) {
|
|
148
|
-
return Object.keys(this)[index];
|
|
149
|
-
}
|
|
150
|
-
removeItem(key) {
|
|
151
|
-
delete this[key];
|
|
152
|
-
}
|
|
153
|
-
setItem(key, value) {
|
|
154
|
-
this[key] = value;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
71
|
var CONFIG = {
|
|
158
72
|
privateApiHost: "https://ecency.com",
|
|
159
73
|
imageHost: "https://images.ecency.com",
|
|
160
|
-
storage: typeof window === "undefined" ? new MockStorage() : window.localStorage,
|
|
161
|
-
storagePrefix: "ecency",
|
|
162
74
|
hiveClient: new dhive.Client(
|
|
163
75
|
[
|
|
164
76
|
"https://api.hive.blog",
|
|
@@ -313,7 +225,7 @@ exports.ConfigManager = void 0;
|
|
|
313
225
|
}
|
|
314
226
|
ConfigManager2.setDmcaLists = setDmcaLists;
|
|
315
227
|
})(exports.ConfigManager || (exports.ConfigManager = {}));
|
|
316
|
-
async function broadcastJson(username, id, payload,
|
|
228
|
+
async function broadcastJson(username, id, payload, auth) {
|
|
317
229
|
if (!username) {
|
|
318
230
|
throw new Error(
|
|
319
231
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
@@ -325,6 +237,9 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
|
|
|
325
237
|
required_posting_auths: [username],
|
|
326
238
|
json: JSON.stringify(payload)
|
|
327
239
|
};
|
|
240
|
+
if (auth?.broadcast) {
|
|
241
|
+
return auth.broadcast([["custom_json", jjson]], "posting");
|
|
242
|
+
}
|
|
328
243
|
const postingKey = auth?.postingKey;
|
|
329
244
|
if (postingKey) {
|
|
330
245
|
const privateKey = dhive.PrivateKey.fromString(postingKey);
|
|
@@ -333,10 +248,7 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
|
|
|
333
248
|
privateKey
|
|
334
249
|
);
|
|
335
250
|
}
|
|
336
|
-
const
|
|
337
|
-
if (loginType && loginType == "keychain") {
|
|
338
|
-
return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
|
|
339
|
-
}
|
|
251
|
+
const accessToken = auth?.accessToken;
|
|
340
252
|
if (accessToken) {
|
|
341
253
|
const response = await new hs__default.default.Client({
|
|
342
254
|
accessToken
|
|
@@ -347,6 +259,63 @@ async function broadcastJson(username, id, payload, accessToken, auth) {
|
|
|
347
259
|
"[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
|
|
348
260
|
);
|
|
349
261
|
}
|
|
262
|
+
function makeQueryClient() {
|
|
263
|
+
return new reactQuery.QueryClient({
|
|
264
|
+
defaultOptions: {
|
|
265
|
+
queries: {
|
|
266
|
+
// With SSR, we usually want to set some default staleTime
|
|
267
|
+
// above 0 to avoid refetching immediately on the client
|
|
268
|
+
// staleTime: 60 * 1000,
|
|
269
|
+
refetchOnWindowFocus: false,
|
|
270
|
+
refetchOnMount: false
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
var getQueryClient = () => CONFIG.queryClient;
|
|
276
|
+
exports.EcencyQueriesManager = void 0;
|
|
277
|
+
((EcencyQueriesManager2) => {
|
|
278
|
+
function getQueryData(queryKey) {
|
|
279
|
+
const queryClient = getQueryClient();
|
|
280
|
+
return queryClient.getQueryData(queryKey);
|
|
281
|
+
}
|
|
282
|
+
EcencyQueriesManager2.getQueryData = getQueryData;
|
|
283
|
+
function getInfiniteQueryData(queryKey) {
|
|
284
|
+
const queryClient = getQueryClient();
|
|
285
|
+
return queryClient.getQueryData(queryKey);
|
|
286
|
+
}
|
|
287
|
+
EcencyQueriesManager2.getInfiniteQueryData = getInfiniteQueryData;
|
|
288
|
+
async function prefetchQuery(options) {
|
|
289
|
+
const queryClient = getQueryClient();
|
|
290
|
+
await queryClient.prefetchQuery(options);
|
|
291
|
+
return getQueryData(options.queryKey);
|
|
292
|
+
}
|
|
293
|
+
EcencyQueriesManager2.prefetchQuery = prefetchQuery;
|
|
294
|
+
async function prefetchInfiniteQuery(options) {
|
|
295
|
+
const queryClient = getQueryClient();
|
|
296
|
+
await queryClient.prefetchInfiniteQuery(options);
|
|
297
|
+
return getInfiniteQueryData(options.queryKey);
|
|
298
|
+
}
|
|
299
|
+
EcencyQueriesManager2.prefetchInfiniteQuery = prefetchInfiniteQuery;
|
|
300
|
+
function generateClientServerQuery(options) {
|
|
301
|
+
return {
|
|
302
|
+
prefetch: () => prefetchQuery(options),
|
|
303
|
+
getData: () => getQueryData(options.queryKey),
|
|
304
|
+
useClientQuery: () => reactQuery.useQuery(options),
|
|
305
|
+
fetchAndGet: () => getQueryClient().fetchQuery(options)
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
EcencyQueriesManager2.generateClientServerQuery = generateClientServerQuery;
|
|
309
|
+
function generateClientServerInfiniteQuery(options) {
|
|
310
|
+
return {
|
|
311
|
+
prefetch: () => prefetchInfiniteQuery(options),
|
|
312
|
+
getData: () => getInfiniteQueryData(options.queryKey),
|
|
313
|
+
useClientQuery: () => reactQuery.useInfiniteQuery(options),
|
|
314
|
+
fetchAndGet: () => getQueryClient().fetchInfiniteQuery(options)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
EcencyQueriesManager2.generateClientServerInfiniteQuery = generateClientServerInfiniteQuery;
|
|
318
|
+
})(exports.EcencyQueriesManager || (exports.EcencyQueriesManager = {}));
|
|
350
319
|
|
|
351
320
|
// src/modules/core/utils/decoder-encoder.ts
|
|
352
321
|
function encodeObj(o) {
|
|
@@ -408,79 +377,7 @@ function isCommunity(value) {
|
|
|
408
377
|
return typeof value === "string" ? /^hive-\d+$/.test(value) : false;
|
|
409
378
|
}
|
|
410
379
|
|
|
411
|
-
// src/modules/core/
|
|
412
|
-
var getUser = (username) => {
|
|
413
|
-
try {
|
|
414
|
-
const raw = CONFIG.storage.getItem(
|
|
415
|
-
CONFIG.storagePrefix + "_user_" + username
|
|
416
|
-
);
|
|
417
|
-
return decodeObj(JSON.parse(raw));
|
|
418
|
-
} catch (e) {
|
|
419
|
-
console.error(e);
|
|
420
|
-
return void 0;
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
var getAccessToken = (username) => getUser(username) && getUser(username).accessToken;
|
|
424
|
-
var getPostingKey = (username) => getUser(username) && getUser(username).postingKey;
|
|
425
|
-
var getLoginType = (username) => getUser(username) && getUser(username).loginType;
|
|
426
|
-
var getRefreshToken = (username) => getUser(username) && getUser(username).refreshToken;
|
|
427
|
-
function makeQueryClient() {
|
|
428
|
-
return new reactQuery.QueryClient({
|
|
429
|
-
defaultOptions: {
|
|
430
|
-
queries: {
|
|
431
|
-
// With SSR, we usually want to set some default staleTime
|
|
432
|
-
// above 0 to avoid refetching immediately on the client
|
|
433
|
-
// staleTime: 60 * 1000,
|
|
434
|
-
refetchOnWindowFocus: false,
|
|
435
|
-
refetchOnMount: false
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
var getQueryClient = () => CONFIG.queryClient;
|
|
441
|
-
exports.EcencyQueriesManager = void 0;
|
|
442
|
-
((EcencyQueriesManager2) => {
|
|
443
|
-
function getQueryData(queryKey) {
|
|
444
|
-
const queryClient = getQueryClient();
|
|
445
|
-
return queryClient.getQueryData(queryKey);
|
|
446
|
-
}
|
|
447
|
-
EcencyQueriesManager2.getQueryData = getQueryData;
|
|
448
|
-
function getInfiniteQueryData(queryKey) {
|
|
449
|
-
const queryClient = getQueryClient();
|
|
450
|
-
return queryClient.getQueryData(queryKey);
|
|
451
|
-
}
|
|
452
|
-
EcencyQueriesManager2.getInfiniteQueryData = getInfiniteQueryData;
|
|
453
|
-
async function prefetchQuery(options) {
|
|
454
|
-
const queryClient = getQueryClient();
|
|
455
|
-
await queryClient.prefetchQuery(options);
|
|
456
|
-
return getQueryData(options.queryKey);
|
|
457
|
-
}
|
|
458
|
-
EcencyQueriesManager2.prefetchQuery = prefetchQuery;
|
|
459
|
-
async function prefetchInfiniteQuery(options) {
|
|
460
|
-
const queryClient = getQueryClient();
|
|
461
|
-
await queryClient.prefetchInfiniteQuery(options);
|
|
462
|
-
return getInfiniteQueryData(options.queryKey);
|
|
463
|
-
}
|
|
464
|
-
EcencyQueriesManager2.prefetchInfiniteQuery = prefetchInfiniteQuery;
|
|
465
|
-
function generateClientServerQuery(options) {
|
|
466
|
-
return {
|
|
467
|
-
prefetch: () => prefetchQuery(options),
|
|
468
|
-
getData: () => getQueryData(options.queryKey),
|
|
469
|
-
useClientQuery: () => reactQuery.useQuery(options),
|
|
470
|
-
fetchAndGet: () => getQueryClient().fetchQuery(options)
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
EcencyQueriesManager2.generateClientServerQuery = generateClientServerQuery;
|
|
474
|
-
function generateClientServerInfiniteQuery(options) {
|
|
475
|
-
return {
|
|
476
|
-
prefetch: () => prefetchInfiniteQuery(options),
|
|
477
|
-
getData: () => getInfiniteQueryData(options.queryKey),
|
|
478
|
-
useClientQuery: () => reactQuery.useInfiniteQuery(options),
|
|
479
|
-
fetchAndGet: () => getQueryClient().fetchInfiniteQuery(options)
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
EcencyQueriesManager2.generateClientServerInfiniteQuery = generateClientServerInfiniteQuery;
|
|
483
|
-
})(exports.EcencyQueriesManager || (exports.EcencyQueriesManager = {}));
|
|
380
|
+
// src/modules/core/queries/get-dynamic-props-query-options.ts
|
|
484
381
|
function getDynamicPropsQueryOptions() {
|
|
485
382
|
return reactQuery.queryOptions({
|
|
486
383
|
queryKey: ["core", "dynamic-props"],
|
|
@@ -735,12 +632,14 @@ function parseAccounts(rawAccounts) {
|
|
|
735
632
|
// src/modules/accounts/queries/get-accounts-query-options.ts
|
|
736
633
|
function getAccountsQueryOptions(usernames) {
|
|
737
634
|
return reactQuery.queryOptions({
|
|
738
|
-
queryKey: ["accounts", "
|
|
635
|
+
queryKey: ["accounts", "list", ...usernames],
|
|
636
|
+
enabled: usernames.length > 0,
|
|
739
637
|
queryFn: async () => {
|
|
740
|
-
const response = await CONFIG.hiveClient.database.getAccounts(
|
|
638
|
+
const response = await CONFIG.hiveClient.database.getAccounts(
|
|
639
|
+
usernames
|
|
640
|
+
);
|
|
741
641
|
return parseAccounts(response);
|
|
742
|
-
}
|
|
743
|
-
enabled: usernames.length > 0
|
|
642
|
+
}
|
|
744
643
|
});
|
|
745
644
|
}
|
|
746
645
|
function getFollowCountQueryOptions(username) {
|
|
@@ -1011,6 +910,22 @@ function getAccountPendingRecoveryQueryOptions(username) {
|
|
|
1011
910
|
)
|
|
1012
911
|
});
|
|
1013
912
|
}
|
|
913
|
+
function getAccountReputationsQueryOptions(query, limit = 50) {
|
|
914
|
+
return reactQuery.queryOptions({
|
|
915
|
+
queryKey: ["accounts", "reputations", query, limit],
|
|
916
|
+
enabled: !!query,
|
|
917
|
+
queryFn: async () => {
|
|
918
|
+
if (!query) {
|
|
919
|
+
return [];
|
|
920
|
+
}
|
|
921
|
+
return CONFIG.hiveClient.call(
|
|
922
|
+
"condenser_api",
|
|
923
|
+
"get_account_reputations",
|
|
924
|
+
[query, limit]
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
}
|
|
1014
929
|
var ops = dhive.utils.operationOrders;
|
|
1015
930
|
var ACCOUNT_OPERATION_GROUPS = {
|
|
1016
931
|
transfers: [
|
|
@@ -1327,6 +1242,26 @@ function getEntryActiveVotesQueryOptions(entry) {
|
|
|
1327
1242
|
enabled: !!entry
|
|
1328
1243
|
});
|
|
1329
1244
|
}
|
|
1245
|
+
function getContentQueryOptions(author, permlink) {
|
|
1246
|
+
return reactQuery.queryOptions({
|
|
1247
|
+
queryKey: ["posts", "content", author, permlink],
|
|
1248
|
+
enabled: !!author && !!permlink,
|
|
1249
|
+
queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content", [
|
|
1250
|
+
author,
|
|
1251
|
+
permlink
|
|
1252
|
+
])
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
function getContentRepliesQueryOptions(author, permlink) {
|
|
1256
|
+
return reactQuery.queryOptions({
|
|
1257
|
+
queryKey: ["posts", "content-replies", author, permlink],
|
|
1258
|
+
enabled: !!author && !!permlink,
|
|
1259
|
+
queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content_replies", {
|
|
1260
|
+
author,
|
|
1261
|
+
permlink
|
|
1262
|
+
})
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1330
1265
|
function getPostHeaderQueryOptions(author, permlink) {
|
|
1331
1266
|
return reactQuery.queryOptions({
|
|
1332
1267
|
queryKey: ["posts", "post-header", author, permlink],
|
|
@@ -1388,6 +1323,212 @@ function getPostQueryOptions(author, permlink, observer = "", num) {
|
|
|
1388
1323
|
enabled: !!author && !!permlink && permlink.trim() !== "" && permlink.trim() !== "undefined"
|
|
1389
1324
|
});
|
|
1390
1325
|
}
|
|
1326
|
+
|
|
1327
|
+
// src/modules/bridge/requests.ts
|
|
1328
|
+
function bridgeApiCall(endpoint, params) {
|
|
1329
|
+
return CONFIG.hiveClient.call("bridge", endpoint, params);
|
|
1330
|
+
}
|
|
1331
|
+
async function resolvePost(post, observer, num) {
|
|
1332
|
+
const { json_metadata: json } = post;
|
|
1333
|
+
if (json?.original_author && json?.original_permlink && json.tags?.[0] === "cross-post") {
|
|
1334
|
+
try {
|
|
1335
|
+
const resp = await getPost(
|
|
1336
|
+
json.original_author,
|
|
1337
|
+
json.original_permlink,
|
|
1338
|
+
observer,
|
|
1339
|
+
num
|
|
1340
|
+
);
|
|
1341
|
+
if (resp) {
|
|
1342
|
+
return {
|
|
1343
|
+
...post,
|
|
1344
|
+
original_entry: resp,
|
|
1345
|
+
num
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
return post;
|
|
1349
|
+
} catch {
|
|
1350
|
+
return post;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
return { ...post, num };
|
|
1354
|
+
}
|
|
1355
|
+
async function resolvePosts(posts, observer) {
|
|
1356
|
+
const validatedPosts = posts.map(validateEntry);
|
|
1357
|
+
const resolved = await Promise.all(validatedPosts.map((p) => resolvePost(p, observer)));
|
|
1358
|
+
return filterDmcaEntry(resolved);
|
|
1359
|
+
}
|
|
1360
|
+
async function getPostsRanked(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "") {
|
|
1361
|
+
const resp = await bridgeApiCall("get_ranked_posts", {
|
|
1362
|
+
sort,
|
|
1363
|
+
start_author,
|
|
1364
|
+
start_permlink,
|
|
1365
|
+
limit,
|
|
1366
|
+
tag,
|
|
1367
|
+
observer
|
|
1368
|
+
});
|
|
1369
|
+
if (resp) {
|
|
1370
|
+
return resolvePosts(resp, observer);
|
|
1371
|
+
}
|
|
1372
|
+
return resp;
|
|
1373
|
+
}
|
|
1374
|
+
async function getAccountPosts(sort, account, start_author = "", start_permlink = "", limit = 20, observer = "") {
|
|
1375
|
+
if (CONFIG.dmcaAccounts.includes(account)) {
|
|
1376
|
+
return [];
|
|
1377
|
+
}
|
|
1378
|
+
const resp = await bridgeApiCall("get_account_posts", {
|
|
1379
|
+
sort,
|
|
1380
|
+
account,
|
|
1381
|
+
start_author,
|
|
1382
|
+
start_permlink,
|
|
1383
|
+
limit,
|
|
1384
|
+
observer
|
|
1385
|
+
});
|
|
1386
|
+
if (resp) {
|
|
1387
|
+
return resolvePosts(resp, observer);
|
|
1388
|
+
}
|
|
1389
|
+
return resp;
|
|
1390
|
+
}
|
|
1391
|
+
function validateEntry(entry) {
|
|
1392
|
+
const newEntry = {
|
|
1393
|
+
...entry,
|
|
1394
|
+
active_votes: Array.isArray(entry.active_votes) ? [...entry.active_votes] : [],
|
|
1395
|
+
beneficiaries: Array.isArray(entry.beneficiaries) ? [...entry.beneficiaries] : [],
|
|
1396
|
+
blacklists: Array.isArray(entry.blacklists) ? [...entry.blacklists] : [],
|
|
1397
|
+
replies: Array.isArray(entry.replies) ? [...entry.replies] : [],
|
|
1398
|
+
stats: entry.stats ? { ...entry.stats } : null
|
|
1399
|
+
};
|
|
1400
|
+
const requiredStringProps = [
|
|
1401
|
+
"author",
|
|
1402
|
+
"title",
|
|
1403
|
+
"body",
|
|
1404
|
+
"created",
|
|
1405
|
+
"category",
|
|
1406
|
+
"permlink",
|
|
1407
|
+
"url",
|
|
1408
|
+
"updated"
|
|
1409
|
+
];
|
|
1410
|
+
for (const prop of requiredStringProps) {
|
|
1411
|
+
if (newEntry[prop] == null) {
|
|
1412
|
+
newEntry[prop] = "";
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
if (newEntry.author_reputation == null) {
|
|
1416
|
+
newEntry.author_reputation = 0;
|
|
1417
|
+
}
|
|
1418
|
+
if (newEntry.children == null) {
|
|
1419
|
+
newEntry.children = 0;
|
|
1420
|
+
}
|
|
1421
|
+
if (newEntry.depth == null) {
|
|
1422
|
+
newEntry.depth = 0;
|
|
1423
|
+
}
|
|
1424
|
+
if (newEntry.net_rshares == null) {
|
|
1425
|
+
newEntry.net_rshares = 0;
|
|
1426
|
+
}
|
|
1427
|
+
if (newEntry.payout == null) {
|
|
1428
|
+
newEntry.payout = 0;
|
|
1429
|
+
}
|
|
1430
|
+
if (newEntry.percent_hbd == null) {
|
|
1431
|
+
newEntry.percent_hbd = 0;
|
|
1432
|
+
}
|
|
1433
|
+
if (!newEntry.stats) {
|
|
1434
|
+
newEntry.stats = {
|
|
1435
|
+
flag_weight: 0,
|
|
1436
|
+
gray: false,
|
|
1437
|
+
hide: false,
|
|
1438
|
+
total_votes: 0
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
if (newEntry.author_payout_value == null) {
|
|
1442
|
+
newEntry.author_payout_value = "0.000 HBD";
|
|
1443
|
+
}
|
|
1444
|
+
if (newEntry.curator_payout_value == null) {
|
|
1445
|
+
newEntry.curator_payout_value = "0.000 HBD";
|
|
1446
|
+
}
|
|
1447
|
+
if (newEntry.max_accepted_payout == null) {
|
|
1448
|
+
newEntry.max_accepted_payout = "1000000.000 HBD";
|
|
1449
|
+
}
|
|
1450
|
+
if (newEntry.payout_at == null) {
|
|
1451
|
+
newEntry.payout_at = "";
|
|
1452
|
+
}
|
|
1453
|
+
if (newEntry.pending_payout_value == null) {
|
|
1454
|
+
newEntry.pending_payout_value = "0.000 HBD";
|
|
1455
|
+
}
|
|
1456
|
+
if (newEntry.promoted == null) {
|
|
1457
|
+
newEntry.promoted = "0.000 HBD";
|
|
1458
|
+
}
|
|
1459
|
+
if (newEntry.is_paidout == null) {
|
|
1460
|
+
newEntry.is_paidout = false;
|
|
1461
|
+
}
|
|
1462
|
+
return newEntry;
|
|
1463
|
+
}
|
|
1464
|
+
async function getPost(author = "", permlink = "", observer = "", num) {
|
|
1465
|
+
const resp = await bridgeApiCall("get_post", {
|
|
1466
|
+
author,
|
|
1467
|
+
permlink,
|
|
1468
|
+
observer
|
|
1469
|
+
});
|
|
1470
|
+
if (resp) {
|
|
1471
|
+
const validatedEntry = validateEntry(resp);
|
|
1472
|
+
const post = await resolvePost(validatedEntry, observer, num);
|
|
1473
|
+
return filterDmcaEntry(post);
|
|
1474
|
+
}
|
|
1475
|
+
return void 0;
|
|
1476
|
+
}
|
|
1477
|
+
async function getPostHeader(author = "", permlink = "") {
|
|
1478
|
+
const resp = await bridgeApiCall("get_post_header", {
|
|
1479
|
+
author,
|
|
1480
|
+
permlink
|
|
1481
|
+
});
|
|
1482
|
+
return resp ? validateEntry(resp) : resp;
|
|
1483
|
+
}
|
|
1484
|
+
async function getDiscussion(author, permlink, observer) {
|
|
1485
|
+
const resp = await bridgeApiCall("get_discussion", {
|
|
1486
|
+
author,
|
|
1487
|
+
permlink,
|
|
1488
|
+
observer: observer || author
|
|
1489
|
+
});
|
|
1490
|
+
if (resp) {
|
|
1491
|
+
const validatedResp = {};
|
|
1492
|
+
for (const [key, entry] of Object.entries(resp)) {
|
|
1493
|
+
validatedResp[key] = validateEntry(entry);
|
|
1494
|
+
}
|
|
1495
|
+
return validatedResp;
|
|
1496
|
+
}
|
|
1497
|
+
return resp;
|
|
1498
|
+
}
|
|
1499
|
+
async function getCommunity(name, observer = "") {
|
|
1500
|
+
return bridgeApiCall("get_community", { name, observer });
|
|
1501
|
+
}
|
|
1502
|
+
async function getCommunities(last = "", limit = 100, query, sort = "rank", observer = "") {
|
|
1503
|
+
return bridgeApiCall("list_communities", {
|
|
1504
|
+
last,
|
|
1505
|
+
limit,
|
|
1506
|
+
query,
|
|
1507
|
+
sort,
|
|
1508
|
+
observer
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
async function normalizePost(post) {
|
|
1512
|
+
const resp = await bridgeApiCall("normalize_post", { post });
|
|
1513
|
+
return resp ? validateEntry(resp) : resp;
|
|
1514
|
+
}
|
|
1515
|
+
async function getSubscriptions(account) {
|
|
1516
|
+
return bridgeApiCall("list_all_subscriptions", { account });
|
|
1517
|
+
}
|
|
1518
|
+
async function getSubscribers(community) {
|
|
1519
|
+
return bridgeApiCall("list_subscribers", { community });
|
|
1520
|
+
}
|
|
1521
|
+
async function getRelationshipBetweenAccounts(follower, following) {
|
|
1522
|
+
return bridgeApiCall("get_relationship_between_accounts", [
|
|
1523
|
+
follower,
|
|
1524
|
+
following
|
|
1525
|
+
]);
|
|
1526
|
+
}
|
|
1527
|
+
async function getProfiles(accounts, observer) {
|
|
1528
|
+
return bridgeApiCall("get_profiles", { accounts, observer });
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// src/modules/posts/queries/get-discussions-query-options.ts
|
|
1391
1532
|
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
1392
1533
|
SortOrder2["trending"] = "trending";
|
|
1393
1534
|
SortOrder2["author_reputation"] = "author_reputation";
|
|
@@ -1485,6 +1626,13 @@ function getDiscussionsQueryOptions(entry, order = "created" /* created */, enab
|
|
|
1485
1626
|
select: (data) => sortDiscussions(entry, data, order)
|
|
1486
1627
|
});
|
|
1487
1628
|
}
|
|
1629
|
+
function getDiscussionQueryOptions(author, permlink, observer, enabled = true) {
|
|
1630
|
+
return reactQuery.queryOptions({
|
|
1631
|
+
queryKey: ["posts", "discussion", author, permlink, observer || author],
|
|
1632
|
+
enabled: enabled && !!author && !!permlink,
|
|
1633
|
+
queryFn: async () => getDiscussion(author, permlink, observer)
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1488
1636
|
function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit = 20, observer = "", enabled = true) {
|
|
1489
1637
|
return reactQuery.infiniteQueryOptions({
|
|
1490
1638
|
queryKey: ["posts", "account-posts", username ?? "", filter, limit, observer],
|
|
@@ -1534,6 +1682,35 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
|
|
|
1534
1682
|
}
|
|
1535
1683
|
});
|
|
1536
1684
|
}
|
|
1685
|
+
function getAccountPostsQueryOptions(username, filter = "posts", start_author = "", start_permlink = "", limit = 20, observer = "", enabled = true) {
|
|
1686
|
+
return reactQuery.queryOptions({
|
|
1687
|
+
queryKey: [
|
|
1688
|
+
"posts",
|
|
1689
|
+
"account-posts-page",
|
|
1690
|
+
username ?? "",
|
|
1691
|
+
filter,
|
|
1692
|
+
start_author,
|
|
1693
|
+
start_permlink,
|
|
1694
|
+
limit,
|
|
1695
|
+
observer
|
|
1696
|
+
],
|
|
1697
|
+
enabled: !!username && enabled,
|
|
1698
|
+
queryFn: async () => {
|
|
1699
|
+
if (!username) {
|
|
1700
|
+
return [];
|
|
1701
|
+
}
|
|
1702
|
+
const response = await getAccountPosts(
|
|
1703
|
+
filter,
|
|
1704
|
+
username,
|
|
1705
|
+
start_author,
|
|
1706
|
+
start_permlink,
|
|
1707
|
+
limit,
|
|
1708
|
+
observer
|
|
1709
|
+
);
|
|
1710
|
+
return filterDmcaEntry(response ?? []);
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1537
1714
|
function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = "", enabled = true, _options = {}) {
|
|
1538
1715
|
return reactQuery.infiniteQueryOptions({
|
|
1539
1716
|
queryKey: ["posts", "posts-ranked", sort, tag, limit, observer],
|
|
@@ -1581,6 +1758,36 @@ function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = ""
|
|
|
1581
1758
|
}
|
|
1582
1759
|
});
|
|
1583
1760
|
}
|
|
1761
|
+
function getPostsRankedQueryOptions(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "", enabled = true) {
|
|
1762
|
+
return reactQuery.queryOptions({
|
|
1763
|
+
queryKey: [
|
|
1764
|
+
"posts",
|
|
1765
|
+
"posts-ranked-page",
|
|
1766
|
+
sort,
|
|
1767
|
+
start_author,
|
|
1768
|
+
start_permlink,
|
|
1769
|
+
limit,
|
|
1770
|
+
tag,
|
|
1771
|
+
observer
|
|
1772
|
+
],
|
|
1773
|
+
enabled,
|
|
1774
|
+
queryFn: async () => {
|
|
1775
|
+
let sanitizedTag = tag;
|
|
1776
|
+
if (CONFIG.dmcaTagRegexes.some((regex) => regex.test(tag))) {
|
|
1777
|
+
sanitizedTag = "";
|
|
1778
|
+
}
|
|
1779
|
+
const response = await getPostsRanked(
|
|
1780
|
+
sort,
|
|
1781
|
+
start_author,
|
|
1782
|
+
start_permlink,
|
|
1783
|
+
limit,
|
|
1784
|
+
sanitizedTag,
|
|
1785
|
+
observer
|
|
1786
|
+
);
|
|
1787
|
+
return filterDmcaEntry(response ?? []);
|
|
1788
|
+
}
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1584
1791
|
function getReblogsQueryOptions(username, activeUsername, limit = 200) {
|
|
1585
1792
|
return reactQuery.queryOptions({
|
|
1586
1793
|
queryKey: ["posts", "reblogs", username ?? "", limit],
|
|
@@ -1818,8 +2025,8 @@ function toEntryArray(x) {
|
|
|
1818
2025
|
return Array.isArray(x) ? x : [];
|
|
1819
2026
|
}
|
|
1820
2027
|
async function getVisibleFirstLevelThreadItems(container) {
|
|
1821
|
-
const
|
|
1822
|
-
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(
|
|
2028
|
+
const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
|
|
2029
|
+
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
|
|
1823
2030
|
const discussionItems = toEntryArray(discussionItemsRaw);
|
|
1824
2031
|
if (discussionItems.length <= 1) {
|
|
1825
2032
|
return [];
|
|
@@ -2028,6 +2235,18 @@ function getWavesTrendingTagsQueryOptions(host, hours = 24) {
|
|
|
2028
2235
|
}
|
|
2029
2236
|
});
|
|
2030
2237
|
}
|
|
2238
|
+
function getNormalizePostQueryOptions(post, enabled = true) {
|
|
2239
|
+
return reactQuery.queryOptions({
|
|
2240
|
+
queryKey: [
|
|
2241
|
+
"posts",
|
|
2242
|
+
"normalize",
|
|
2243
|
+
post?.author ?? "",
|
|
2244
|
+
post?.permlink ?? ""
|
|
2245
|
+
],
|
|
2246
|
+
enabled: enabled && !!post,
|
|
2247
|
+
queryFn: async () => normalizePost(post)
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2031
2250
|
|
|
2032
2251
|
// src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts
|
|
2033
2252
|
function isEntry(x) {
|
|
@@ -2078,15 +2297,21 @@ function getAccountVoteHistoryInfiniteQueryOptions(username, options) {
|
|
|
2078
2297
|
})
|
|
2079
2298
|
});
|
|
2080
2299
|
}
|
|
2300
|
+
function getProfilesQueryOptions(accounts, observer, enabled = true) {
|
|
2301
|
+
return reactQuery.queryOptions({
|
|
2302
|
+
queryKey: ["accounts", "profiles", accounts, observer ?? ""],
|
|
2303
|
+
enabled: enabled && accounts.length > 0,
|
|
2304
|
+
queryFn: async () => getProfiles(accounts, observer)
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2081
2307
|
|
|
2082
2308
|
// src/modules/accounts/mutations/use-account-update.ts
|
|
2083
|
-
function useAccountUpdate(username,
|
|
2309
|
+
function useAccountUpdate(username, auth) {
|
|
2084
2310
|
const queryClient = reactQuery.useQueryClient();
|
|
2085
2311
|
const { data } = reactQuery.useQuery(getAccountFullQueryOptions(username));
|
|
2086
2312
|
return useBroadcastMutation(
|
|
2087
2313
|
["accounts", "update"],
|
|
2088
2314
|
username,
|
|
2089
|
-
accessToken,
|
|
2090
2315
|
(payload) => {
|
|
2091
2316
|
if (!data) {
|
|
2092
2317
|
throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
|
|
@@ -2128,7 +2353,7 @@ function useAccountUpdate(username, accessToken, auth) {
|
|
|
2128
2353
|
auth
|
|
2129
2354
|
);
|
|
2130
2355
|
}
|
|
2131
|
-
function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
|
|
2356
|
+
function useAccountRelationsUpdate(reference, target, auth, onSuccess, onError) {
|
|
2132
2357
|
return reactQuery.useMutation({
|
|
2133
2358
|
mutationKey: ["accounts", "relation", "update", reference, target],
|
|
2134
2359
|
mutationFn: async (kind) => {
|
|
@@ -2140,17 +2365,22 @@ function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
|
|
|
2140
2365
|
const actualRelation = getQueryClient().getQueryData(
|
|
2141
2366
|
relationsQuery.queryKey
|
|
2142
2367
|
);
|
|
2143
|
-
await broadcastJson(
|
|
2368
|
+
await broadcastJson(
|
|
2369
|
+
reference,
|
|
2144
2370
|
"follow",
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2371
|
+
[
|
|
2372
|
+
"follow",
|
|
2373
|
+
{
|
|
2374
|
+
follower: reference,
|
|
2375
|
+
following: target,
|
|
2376
|
+
what: [
|
|
2377
|
+
...kind === "toggle-ignore" && !actualRelation?.ignores ? ["ignore"] : [],
|
|
2378
|
+
...kind === "toggle-follow" && !actualRelation?.follows ? ["blog"] : []
|
|
2379
|
+
]
|
|
2380
|
+
}
|
|
2381
|
+
],
|
|
2382
|
+
auth
|
|
2383
|
+
);
|
|
2154
2384
|
return {
|
|
2155
2385
|
...actualRelation,
|
|
2156
2386
|
ignores: kind === "toggle-ignore" ? !actualRelation?.ignores : actualRelation?.ignores,
|
|
@@ -2377,7 +2607,7 @@ function useAccountUpdatePassword(username, options) {
|
|
|
2377
2607
|
...options
|
|
2378
2608
|
});
|
|
2379
2609
|
}
|
|
2380
|
-
function useAccountRevokePosting(username, options) {
|
|
2610
|
+
function useAccountRevokePosting(username, options, auth) {
|
|
2381
2611
|
const queryClient = reactQuery.useQueryClient();
|
|
2382
2612
|
const { data } = reactQuery.useQuery(getAccountFullQueryOptions(username));
|
|
2383
2613
|
return reactQuery.useMutation({
|
|
@@ -2404,11 +2634,10 @@ function useAccountRevokePosting(username, options) {
|
|
|
2404
2634
|
if (type === "key" && key) {
|
|
2405
2635
|
return CONFIG.hiveClient.broadcast.updateAccount(operationBody, key);
|
|
2406
2636
|
} else if (type === "keychain") {
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
);
|
|
2637
|
+
if (!auth?.broadcast) {
|
|
2638
|
+
throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
|
|
2639
|
+
}
|
|
2640
|
+
return auth.broadcast([["account_update", operationBody]], "active");
|
|
2412
2641
|
} else {
|
|
2413
2642
|
const params = {
|
|
2414
2643
|
callback: `https://ecency.com/@${data.name}/permissions`
|
|
@@ -2439,7 +2668,7 @@ function useAccountRevokePosting(username, options) {
|
|
|
2439
2668
|
}
|
|
2440
2669
|
});
|
|
2441
2670
|
}
|
|
2442
|
-
function useAccountUpdateRecovery(username, code, options) {
|
|
2671
|
+
function useAccountUpdateRecovery(username, code, options, auth) {
|
|
2443
2672
|
const { data } = reactQuery.useQuery(getAccountFullQueryOptions(username));
|
|
2444
2673
|
return reactQuery.useMutation({
|
|
2445
2674
|
mutationKey: ["accounts", "recovery", data?.name],
|
|
@@ -2478,11 +2707,10 @@ function useAccountUpdateRecovery(username, code, options) {
|
|
|
2478
2707
|
key
|
|
2479
2708
|
);
|
|
2480
2709
|
} else if (type === "keychain") {
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
);
|
|
2710
|
+
if (!auth?.broadcast) {
|
|
2711
|
+
throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");
|
|
2712
|
+
}
|
|
2713
|
+
return auth.broadcast([["change_recovery_account", operationBody]], "owner");
|
|
2486
2714
|
} else {
|
|
2487
2715
|
const params = {
|
|
2488
2716
|
callback: `https://ecency.com/@${data.name}/permissions`
|
|
@@ -2531,6 +2759,152 @@ function useAccountRevokeKey(username, options) {
|
|
|
2531
2759
|
...options
|
|
2532
2760
|
});
|
|
2533
2761
|
}
|
|
2762
|
+
|
|
2763
|
+
// src/modules/accounts/utils/account-power.ts
|
|
2764
|
+
var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
|
|
2765
|
+
function vestsToRshares(vests, votingPowerValue, votePerc) {
|
|
2766
|
+
const vestingShares = vests * 1e6;
|
|
2767
|
+
const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
|
|
2768
|
+
return power * vestingShares / 1e4;
|
|
2769
|
+
}
|
|
2770
|
+
function toDhiveAccountForVotingMana(account) {
|
|
2771
|
+
return {
|
|
2772
|
+
id: 0,
|
|
2773
|
+
name: account.name,
|
|
2774
|
+
owner: account.owner,
|
|
2775
|
+
active: account.active,
|
|
2776
|
+
posting: account.posting,
|
|
2777
|
+
memo_key: account.memo_key,
|
|
2778
|
+
json_metadata: account.json_metadata,
|
|
2779
|
+
posting_json_metadata: account.posting_json_metadata,
|
|
2780
|
+
proxy: account.proxy ?? "",
|
|
2781
|
+
last_owner_update: "",
|
|
2782
|
+
last_account_update: "",
|
|
2783
|
+
created: account.created,
|
|
2784
|
+
mined: false,
|
|
2785
|
+
owner_challenged: false,
|
|
2786
|
+
active_challenged: false,
|
|
2787
|
+
last_owner_proved: "",
|
|
2788
|
+
last_active_proved: "",
|
|
2789
|
+
recovery_account: account.recovery_account ?? "",
|
|
2790
|
+
reset_account: "",
|
|
2791
|
+
last_account_recovery: "",
|
|
2792
|
+
comment_count: 0,
|
|
2793
|
+
lifetime_vote_count: 0,
|
|
2794
|
+
post_count: account.post_count,
|
|
2795
|
+
can_vote: true,
|
|
2796
|
+
voting_power: account.voting_power,
|
|
2797
|
+
last_vote_time: account.last_vote_time,
|
|
2798
|
+
voting_manabar: account.voting_manabar,
|
|
2799
|
+
balance: account.balance,
|
|
2800
|
+
savings_balance: account.savings_balance,
|
|
2801
|
+
hbd_balance: account.hbd_balance,
|
|
2802
|
+
hbd_seconds: "0",
|
|
2803
|
+
hbd_seconds_last_update: "",
|
|
2804
|
+
hbd_last_interest_payment: "",
|
|
2805
|
+
savings_hbd_balance: account.savings_hbd_balance,
|
|
2806
|
+
savings_hbd_seconds: account.savings_hbd_seconds,
|
|
2807
|
+
savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
|
|
2808
|
+
savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
|
|
2809
|
+
savings_withdraw_requests: 0,
|
|
2810
|
+
reward_hbd_balance: account.reward_hbd_balance,
|
|
2811
|
+
reward_hive_balance: account.reward_hive_balance,
|
|
2812
|
+
reward_vesting_balance: account.reward_vesting_balance,
|
|
2813
|
+
reward_vesting_hive: account.reward_vesting_hive,
|
|
2814
|
+
curation_rewards: 0,
|
|
2815
|
+
posting_rewards: 0,
|
|
2816
|
+
vesting_shares: account.vesting_shares,
|
|
2817
|
+
delegated_vesting_shares: account.delegated_vesting_shares,
|
|
2818
|
+
received_vesting_shares: account.received_vesting_shares,
|
|
2819
|
+
vesting_withdraw_rate: account.vesting_withdraw_rate,
|
|
2820
|
+
next_vesting_withdrawal: account.next_vesting_withdrawal,
|
|
2821
|
+
withdrawn: account.withdrawn,
|
|
2822
|
+
to_withdraw: account.to_withdraw,
|
|
2823
|
+
withdraw_routes: 0,
|
|
2824
|
+
proxied_vsf_votes: account.proxied_vsf_votes ?? [],
|
|
2825
|
+
witnesses_voted_for: 0,
|
|
2826
|
+
average_bandwidth: 0,
|
|
2827
|
+
lifetime_bandwidth: 0,
|
|
2828
|
+
last_bandwidth_update: "",
|
|
2829
|
+
average_market_bandwidth: 0,
|
|
2830
|
+
lifetime_market_bandwidth: 0,
|
|
2831
|
+
last_market_bandwidth_update: "",
|
|
2832
|
+
last_post: account.last_post,
|
|
2833
|
+
last_root_post: ""
|
|
2834
|
+
};
|
|
2835
|
+
}
|
|
2836
|
+
function votingPower(account) {
|
|
2837
|
+
const calc = CONFIG.hiveClient.rc.calculateVPMana(
|
|
2838
|
+
toDhiveAccountForVotingMana(account)
|
|
2839
|
+
);
|
|
2840
|
+
return calc.percentage / 100;
|
|
2841
|
+
}
|
|
2842
|
+
function powerRechargeTime(power) {
|
|
2843
|
+
if (!Number.isFinite(power)) {
|
|
2844
|
+
throw new TypeError("Voting power must be a finite number");
|
|
2845
|
+
}
|
|
2846
|
+
if (power < 0 || power > 100) {
|
|
2847
|
+
throw new RangeError("Voting power must be between 0 and 100");
|
|
2848
|
+
}
|
|
2849
|
+
const missingPower = 100 - power;
|
|
2850
|
+
return missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS / 1e4;
|
|
2851
|
+
}
|
|
2852
|
+
function downVotingPower(account) {
|
|
2853
|
+
const totalShares = parseFloat(account.vesting_shares) + parseFloat(account.received_vesting_shares) - parseFloat(account.delegated_vesting_shares);
|
|
2854
|
+
const elapsed = Math.floor(Date.now() / 1e3) - account.downvote_manabar.last_update_time;
|
|
2855
|
+
const maxMana = totalShares * 1e6 / 4;
|
|
2856
|
+
if (maxMana <= 0) {
|
|
2857
|
+
return 0;
|
|
2858
|
+
}
|
|
2859
|
+
let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
|
|
2860
|
+
if (currentMana > maxMana) {
|
|
2861
|
+
currentMana = maxMana;
|
|
2862
|
+
}
|
|
2863
|
+
const currentManaPerc = currentMana * 100 / maxMana;
|
|
2864
|
+
if (isNaN(currentManaPerc)) {
|
|
2865
|
+
return 0;
|
|
2866
|
+
}
|
|
2867
|
+
if (currentManaPerc > 100) {
|
|
2868
|
+
return 100;
|
|
2869
|
+
}
|
|
2870
|
+
return currentManaPerc;
|
|
2871
|
+
}
|
|
2872
|
+
function rcPower(account) {
|
|
2873
|
+
const calc = CONFIG.hiveClient.rc.calculateRCMana(account);
|
|
2874
|
+
return calc.percentage / 100;
|
|
2875
|
+
}
|
|
2876
|
+
function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
|
|
2877
|
+
if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {
|
|
2878
|
+
return 0;
|
|
2879
|
+
}
|
|
2880
|
+
const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;
|
|
2881
|
+
if (!Number.isFinite(fundRecentClaims) || !Number.isFinite(fundRewardBalance) || !Number.isFinite(base) || !Number.isFinite(quote)) {
|
|
2882
|
+
return 0;
|
|
2883
|
+
}
|
|
2884
|
+
if (fundRecentClaims === 0 || quote === 0) {
|
|
2885
|
+
return 0;
|
|
2886
|
+
}
|
|
2887
|
+
let totalVests = 0;
|
|
2888
|
+
try {
|
|
2889
|
+
const vesting = parseAsset(account.vesting_shares).amount;
|
|
2890
|
+
const received = parseAsset(account.received_vesting_shares).amount;
|
|
2891
|
+
const delegated = parseAsset(account.delegated_vesting_shares).amount;
|
|
2892
|
+
if (![vesting, received, delegated].every(Number.isFinite)) {
|
|
2893
|
+
return 0;
|
|
2894
|
+
}
|
|
2895
|
+
totalVests = vesting + received - delegated;
|
|
2896
|
+
} catch {
|
|
2897
|
+
return 0;
|
|
2898
|
+
}
|
|
2899
|
+
if (!Number.isFinite(totalVests)) {
|
|
2900
|
+
return 0;
|
|
2901
|
+
}
|
|
2902
|
+
const rShares = vestsToRshares(totalVests, votingPowerValue, weight);
|
|
2903
|
+
if (!Number.isFinite(rShares)) {
|
|
2904
|
+
return 0;
|
|
2905
|
+
}
|
|
2906
|
+
return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
|
|
2907
|
+
}
|
|
2534
2908
|
function useSignOperationByKey(username) {
|
|
2535
2909
|
return reactQuery.useMutation({
|
|
2536
2910
|
mutationKey: ["operations", "sign", username],
|
|
@@ -2556,7 +2930,7 @@ function useSignOperationByKey(username) {
|
|
|
2556
2930
|
}
|
|
2557
2931
|
});
|
|
2558
2932
|
}
|
|
2559
|
-
function useSignOperationByKeychain(username, keyType = "
|
|
2933
|
+
function useSignOperationByKeychain(username, auth, keyType = "active") {
|
|
2560
2934
|
return reactQuery.useMutation({
|
|
2561
2935
|
mutationKey: ["operations", "sign-keychain", username],
|
|
2562
2936
|
mutationFn: ({ operation }) => {
|
|
@@ -2565,7 +2939,10 @@ function useSignOperationByKeychain(username, keyType = "Active") {
|
|
|
2565
2939
|
"[SDK][Keychain] \u2013\xA0cannot sign operation with anon user"
|
|
2566
2940
|
);
|
|
2567
2941
|
}
|
|
2568
|
-
|
|
2942
|
+
if (!auth?.broadcast) {
|
|
2943
|
+
throw new Error("[SDK][Keychain] \u2013 missing keychain broadcaster");
|
|
2944
|
+
}
|
|
2945
|
+
return auth.broadcast([operation], keyType);
|
|
2569
2946
|
}
|
|
2570
2947
|
});
|
|
2571
2948
|
}
|
|
@@ -2688,6 +3065,33 @@ function useRemoveFragment(username, fragmentId, code) {
|
|
|
2688
3065
|
});
|
|
2689
3066
|
}
|
|
2690
3067
|
|
|
3068
|
+
// src/modules/posts/utils/validate-post-creating.ts
|
|
3069
|
+
var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
|
|
3070
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3071
|
+
async function getContent(author, permlink) {
|
|
3072
|
+
return CONFIG.hiveClient.call("condenser_api", "get_content", [
|
|
3073
|
+
author,
|
|
3074
|
+
permlink
|
|
3075
|
+
]);
|
|
3076
|
+
}
|
|
3077
|
+
async function validatePostCreating(author, permlink, attempts = 0, options) {
|
|
3078
|
+
const delays = options?.delays ?? DEFAULT_VALIDATE_POST_DELAYS;
|
|
3079
|
+
let response;
|
|
3080
|
+
try {
|
|
3081
|
+
response = await getContent(author, permlink);
|
|
3082
|
+
} catch (e) {
|
|
3083
|
+
response = void 0;
|
|
3084
|
+
}
|
|
3085
|
+
if (response || attempts >= delays.length) {
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
const waitMs = delays[attempts];
|
|
3089
|
+
if (waitMs > 0) {
|
|
3090
|
+
await delay(waitMs);
|
|
3091
|
+
}
|
|
3092
|
+
return validatePostCreating(author, permlink, attempts + 1, options);
|
|
3093
|
+
}
|
|
3094
|
+
|
|
2691
3095
|
// src/modules/analytics/mutations/index.ts
|
|
2692
3096
|
var mutations_exports = {};
|
|
2693
3097
|
__export(mutations_exports, {
|
|
@@ -3076,6 +3480,13 @@ function getCommunityContextQueryOptions(username, communityName) {
|
|
|
3076
3480
|
}
|
|
3077
3481
|
});
|
|
3078
3482
|
}
|
|
3483
|
+
function getCommunityQueryOptions(name, observer = "", enabled = true) {
|
|
3484
|
+
return reactQuery.queryOptions({
|
|
3485
|
+
queryKey: ["community", "single", name, observer],
|
|
3486
|
+
enabled: enabled && !!name,
|
|
3487
|
+
queryFn: async () => getCommunity(name ?? "", observer)
|
|
3488
|
+
});
|
|
3489
|
+
}
|
|
3079
3490
|
function getCommunitySubscribersQueryOptions(communityName) {
|
|
3080
3491
|
return reactQuery.queryOptions({
|
|
3081
3492
|
queryKey: ["communities", "subscribers", communityName],
|
|
@@ -3518,6 +3929,25 @@ function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
|
|
|
3518
3929
|
getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
|
|
3519
3930
|
});
|
|
3520
3931
|
}
|
|
3932
|
+
function getIncomingRcQueryOptions(username) {
|
|
3933
|
+
return reactQuery.queryOptions({
|
|
3934
|
+
queryKey: ["wallet", "incoming-rc", username],
|
|
3935
|
+
enabled: !!username,
|
|
3936
|
+
queryFn: async () => {
|
|
3937
|
+
if (!username) {
|
|
3938
|
+
throw new Error("[SDK][Wallet] - Missing username for incoming RC");
|
|
3939
|
+
}
|
|
3940
|
+
const fetchApi = getBoundFetch();
|
|
3941
|
+
const response = await fetchApi(
|
|
3942
|
+
`${CONFIG.privateApiHost}/private-api/received-rc/${username}`
|
|
3943
|
+
);
|
|
3944
|
+
if (!response.ok) {
|
|
3945
|
+
throw new Error(`Failed to fetch incoming RC: ${response.status}`);
|
|
3946
|
+
}
|
|
3947
|
+
return response.json();
|
|
3948
|
+
}
|
|
3949
|
+
});
|
|
3950
|
+
}
|
|
3521
3951
|
function getReceivedVestingSharesQueryOptions(username) {
|
|
3522
3952
|
return reactQuery.queryOptions({
|
|
3523
3953
|
queryKey: ["wallet", "received-vesting-shares", username],
|
|
@@ -3562,15 +3992,15 @@ function getMarketStatisticsQueryOptions() {
|
|
|
3562
3992
|
});
|
|
3563
3993
|
}
|
|
3564
3994
|
function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
|
|
3565
|
-
const
|
|
3995
|
+
const formatDate2 = (date) => {
|
|
3566
3996
|
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
3567
3997
|
};
|
|
3568
3998
|
return reactQuery.queryOptions({
|
|
3569
3999
|
queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
|
|
3570
4000
|
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
|
|
3571
4001
|
seconds,
|
|
3572
|
-
|
|
3573
|
-
|
|
4002
|
+
formatDate2(startDate),
|
|
4003
|
+
formatDate2(endDate)
|
|
3574
4004
|
])
|
|
3575
4005
|
});
|
|
3576
4006
|
}
|
|
@@ -3585,13 +4015,13 @@ function getHiveHbdStatsQueryOptions() {
|
|
|
3585
4015
|
);
|
|
3586
4016
|
const now = /* @__PURE__ */ new Date();
|
|
3587
4017
|
const oneDayAgo = new Date(now.getTime() - 864e5);
|
|
3588
|
-
const
|
|
4018
|
+
const formatDate2 = (date) => {
|
|
3589
4019
|
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
3590
4020
|
};
|
|
3591
4021
|
const dayChange = await CONFIG.hiveClient.call(
|
|
3592
4022
|
"condenser_api",
|
|
3593
4023
|
"get_market_history",
|
|
3594
|
-
[86400,
|
|
4024
|
+
[86400, formatDate2(oneDayAgo), formatDate2(now)]
|
|
3595
4025
|
);
|
|
3596
4026
|
const result = {
|
|
3597
4027
|
price: +stats.latest,
|
|
@@ -3620,6 +4050,21 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
|
|
|
3620
4050
|
}
|
|
3621
4051
|
});
|
|
3622
4052
|
}
|
|
4053
|
+
function formatDate(date) {
|
|
4054
|
+
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4055
|
+
}
|
|
4056
|
+
function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
|
|
4057
|
+
const end = endDate ?? /* @__PURE__ */ new Date();
|
|
4058
|
+
const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
|
|
4059
|
+
return reactQuery.queryOptions({
|
|
4060
|
+
queryKey: ["market", "trade-history", limit, start.getTime(), end.getTime()],
|
|
4061
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_trade_history", [
|
|
4062
|
+
formatDate(start),
|
|
4063
|
+
formatDate(end),
|
|
4064
|
+
limit
|
|
4065
|
+
])
|
|
4066
|
+
});
|
|
4067
|
+
}
|
|
3623
4068
|
|
|
3624
4069
|
// src/modules/market/requests.ts
|
|
3625
4070
|
async function parseJsonResponse(response) {
|
|
@@ -3660,6 +4105,13 @@ async function getCurrencyRates() {
|
|
|
3660
4105
|
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
|
|
3661
4106
|
return parseJsonResponse(response);
|
|
3662
4107
|
}
|
|
4108
|
+
async function getHivePrice() {
|
|
4109
|
+
const fetchApi = getBoundFetch();
|
|
4110
|
+
const response = await fetchApi(
|
|
4111
|
+
"https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd"
|
|
4112
|
+
);
|
|
4113
|
+
return parseJsonResponse(response);
|
|
4114
|
+
}
|
|
3663
4115
|
function getPointsQueryOptions(username, filter = 0) {
|
|
3664
4116
|
return reactQuery.queryOptions({
|
|
3665
4117
|
queryKey: ["points", username, filter],
|
|
@@ -3930,6 +4382,89 @@ function getSearchPathQueryOptions(q) {
|
|
|
3930
4382
|
}
|
|
3931
4383
|
});
|
|
3932
4384
|
}
|
|
4385
|
+
|
|
4386
|
+
// src/modules/search/requests.ts
|
|
4387
|
+
async function parseJsonResponse2(response) {
|
|
4388
|
+
const parseBody = async () => {
|
|
4389
|
+
try {
|
|
4390
|
+
return await response.json();
|
|
4391
|
+
} catch {
|
|
4392
|
+
try {
|
|
4393
|
+
return await response.text();
|
|
4394
|
+
} catch {
|
|
4395
|
+
return void 0;
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
};
|
|
4399
|
+
const data = await parseBody();
|
|
4400
|
+
if (!response.ok) {
|
|
4401
|
+
const error = new Error(`Request failed with status ${response.status}`);
|
|
4402
|
+
error.status = response.status;
|
|
4403
|
+
error.data = data;
|
|
4404
|
+
throw error;
|
|
4405
|
+
}
|
|
4406
|
+
if (data === void 0) {
|
|
4407
|
+
throw new Error("Response body was empty or invalid JSON");
|
|
4408
|
+
}
|
|
4409
|
+
return data;
|
|
4410
|
+
}
|
|
4411
|
+
async function search(q, sort, hideLow, since, scroll_id, votes) {
|
|
4412
|
+
const data = { q, sort, hide_low: hideLow };
|
|
4413
|
+
if (since) {
|
|
4414
|
+
data.since = since;
|
|
4415
|
+
}
|
|
4416
|
+
if (scroll_id) {
|
|
4417
|
+
data.scroll_id = scroll_id;
|
|
4418
|
+
}
|
|
4419
|
+
if (votes) {
|
|
4420
|
+
data.votes = votes;
|
|
4421
|
+
}
|
|
4422
|
+
const fetchApi = getBoundFetch();
|
|
4423
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search", {
|
|
4424
|
+
method: "POST",
|
|
4425
|
+
headers: {
|
|
4426
|
+
"Content-Type": "application/json"
|
|
4427
|
+
},
|
|
4428
|
+
body: JSON.stringify(data)
|
|
4429
|
+
});
|
|
4430
|
+
return parseJsonResponse2(response);
|
|
4431
|
+
}
|
|
4432
|
+
async function searchAccount(q = "", limit = 20, random = 1) {
|
|
4433
|
+
const data = { q, limit, random };
|
|
4434
|
+
const fetchApi = getBoundFetch();
|
|
4435
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-account", {
|
|
4436
|
+
method: "POST",
|
|
4437
|
+
headers: {
|
|
4438
|
+
"Content-Type": "application/json"
|
|
4439
|
+
},
|
|
4440
|
+
body: JSON.stringify(data)
|
|
4441
|
+
});
|
|
4442
|
+
return parseJsonResponse2(response);
|
|
4443
|
+
}
|
|
4444
|
+
async function searchTag(q = "", limit = 20, random = 0) {
|
|
4445
|
+
const data = { q, limit, random };
|
|
4446
|
+
const fetchApi = getBoundFetch();
|
|
4447
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-tag", {
|
|
4448
|
+
method: "POST",
|
|
4449
|
+
headers: {
|
|
4450
|
+
"Content-Type": "application/json"
|
|
4451
|
+
},
|
|
4452
|
+
body: JSON.stringify(data)
|
|
4453
|
+
});
|
|
4454
|
+
return parseJsonResponse2(response);
|
|
4455
|
+
}
|
|
4456
|
+
async function searchPath(q) {
|
|
4457
|
+
const fetchApi = getBoundFetch();
|
|
4458
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-path", {
|
|
4459
|
+
method: "POST",
|
|
4460
|
+
headers: {
|
|
4461
|
+
"Content-Type": "application/json"
|
|
4462
|
+
},
|
|
4463
|
+
body: JSON.stringify({ q })
|
|
4464
|
+
});
|
|
4465
|
+
const data = await parseJsonResponse2(response);
|
|
4466
|
+
return data?.length > 0 ? data : [q];
|
|
4467
|
+
}
|
|
3933
4468
|
function getBoostPlusPricesQueryOptions(accessToken) {
|
|
3934
4469
|
return reactQuery.queryOptions({
|
|
3935
4470
|
queryKey: ["promotions", "boost-plus-prices"],
|
|
@@ -4001,7 +4536,7 @@ function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
|
|
|
4001
4536
|
}
|
|
4002
4537
|
|
|
4003
4538
|
// src/modules/private-api/requests.ts
|
|
4004
|
-
async function
|
|
4539
|
+
async function parseJsonResponse3(response) {
|
|
4005
4540
|
if (!response.ok) {
|
|
4006
4541
|
let errorData = void 0;
|
|
4007
4542
|
try {
|
|
@@ -4025,7 +4560,7 @@ async function signUp(username, email, referral) {
|
|
|
4025
4560
|
},
|
|
4026
4561
|
body: JSON.stringify({ username, email, referral })
|
|
4027
4562
|
});
|
|
4028
|
-
const data = await
|
|
4563
|
+
const data = await parseJsonResponse3(response);
|
|
4029
4564
|
return { status: response.status, data };
|
|
4030
4565
|
}
|
|
4031
4566
|
async function subscribeEmail(email) {
|
|
@@ -4037,7 +4572,7 @@ async function subscribeEmail(email) {
|
|
|
4037
4572
|
},
|
|
4038
4573
|
body: JSON.stringify({ email })
|
|
4039
4574
|
});
|
|
4040
|
-
const data = await
|
|
4575
|
+
const data = await parseJsonResponse3(response);
|
|
4041
4576
|
return { status: response.status, data };
|
|
4042
4577
|
}
|
|
4043
4578
|
async function usrActivity(code, ty, bl = "", tx = "") {
|
|
@@ -4056,7 +4591,7 @@ async function usrActivity(code, ty, bl = "", tx = "") {
|
|
|
4056
4591
|
},
|
|
4057
4592
|
body: JSON.stringify(params)
|
|
4058
4593
|
});
|
|
4059
|
-
await
|
|
4594
|
+
await parseJsonResponse3(response);
|
|
4060
4595
|
}
|
|
4061
4596
|
async function getNotifications(code, filter, since = null, user = null) {
|
|
4062
4597
|
const data = {
|
|
@@ -4079,7 +4614,7 @@ async function getNotifications(code, filter, since = null, user = null) {
|
|
|
4079
4614
|
},
|
|
4080
4615
|
body: JSON.stringify(data)
|
|
4081
4616
|
});
|
|
4082
|
-
return
|
|
4617
|
+
return parseJsonResponse3(response);
|
|
4083
4618
|
}
|
|
4084
4619
|
async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
|
|
4085
4620
|
const data = {
|
|
@@ -4098,7 +4633,7 @@ async function saveNotificationSetting(code, username, system, allows_notify, no
|
|
|
4098
4633
|
},
|
|
4099
4634
|
body: JSON.stringify(data)
|
|
4100
4635
|
});
|
|
4101
|
-
return
|
|
4636
|
+
return parseJsonResponse3(response);
|
|
4102
4637
|
}
|
|
4103
4638
|
async function getNotificationSetting(code, username, token) {
|
|
4104
4639
|
const data = { code, username, token };
|
|
@@ -4110,7 +4645,7 @@ async function getNotificationSetting(code, username, token) {
|
|
|
4110
4645
|
},
|
|
4111
4646
|
body: JSON.stringify(data)
|
|
4112
4647
|
});
|
|
4113
|
-
return
|
|
4648
|
+
return parseJsonResponse3(response);
|
|
4114
4649
|
}
|
|
4115
4650
|
async function markNotifications(code, id) {
|
|
4116
4651
|
const data = {
|
|
@@ -4127,7 +4662,7 @@ async function markNotifications(code, id) {
|
|
|
4127
4662
|
},
|
|
4128
4663
|
body: JSON.stringify(data)
|
|
4129
4664
|
});
|
|
4130
|
-
return
|
|
4665
|
+
return parseJsonResponse3(response);
|
|
4131
4666
|
}
|
|
4132
4667
|
async function addImage(code, url) {
|
|
4133
4668
|
const data = { code, url };
|
|
@@ -4139,7 +4674,7 @@ async function addImage(code, url) {
|
|
|
4139
4674
|
},
|
|
4140
4675
|
body: JSON.stringify(data)
|
|
4141
4676
|
});
|
|
4142
|
-
return
|
|
4677
|
+
return parseJsonResponse3(response);
|
|
4143
4678
|
}
|
|
4144
4679
|
async function uploadImage(file, token, signal) {
|
|
4145
4680
|
const fetchApi = getBoundFetch();
|
|
@@ -4150,7 +4685,7 @@ async function uploadImage(file, token, signal) {
|
|
|
4150
4685
|
body: formData,
|
|
4151
4686
|
signal
|
|
4152
4687
|
});
|
|
4153
|
-
return
|
|
4688
|
+
return parseJsonResponse3(response);
|
|
4154
4689
|
}
|
|
4155
4690
|
async function deleteImage(code, imageId) {
|
|
4156
4691
|
const data = { code, id: imageId };
|
|
@@ -4162,7 +4697,7 @@ async function deleteImage(code, imageId) {
|
|
|
4162
4697
|
},
|
|
4163
4698
|
body: JSON.stringify(data)
|
|
4164
4699
|
});
|
|
4165
|
-
return
|
|
4700
|
+
return parseJsonResponse3(response);
|
|
4166
4701
|
}
|
|
4167
4702
|
async function addDraft(code, title, body, tags, meta) {
|
|
4168
4703
|
const data = { code, title, body, tags, meta };
|
|
@@ -4174,7 +4709,7 @@ async function addDraft(code, title, body, tags, meta) {
|
|
|
4174
4709
|
},
|
|
4175
4710
|
body: JSON.stringify(data)
|
|
4176
4711
|
});
|
|
4177
|
-
return
|
|
4712
|
+
return parseJsonResponse3(response);
|
|
4178
4713
|
}
|
|
4179
4714
|
async function updateDraft(code, draftId, title, body, tags, meta) {
|
|
4180
4715
|
const data = { code, id: draftId, title, body, tags, meta };
|
|
@@ -4186,7 +4721,7 @@ async function updateDraft(code, draftId, title, body, tags, meta) {
|
|
|
4186
4721
|
},
|
|
4187
4722
|
body: JSON.stringify(data)
|
|
4188
4723
|
});
|
|
4189
|
-
return
|
|
4724
|
+
return parseJsonResponse3(response);
|
|
4190
4725
|
}
|
|
4191
4726
|
async function deleteDraft(code, draftId) {
|
|
4192
4727
|
const data = { code, id: draftId };
|
|
@@ -4198,7 +4733,7 @@ async function deleteDraft(code, draftId) {
|
|
|
4198
4733
|
},
|
|
4199
4734
|
body: JSON.stringify(data)
|
|
4200
4735
|
});
|
|
4201
|
-
return
|
|
4736
|
+
return parseJsonResponse3(response);
|
|
4202
4737
|
}
|
|
4203
4738
|
async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
|
|
4204
4739
|
const data = {
|
|
@@ -4221,7 +4756,7 @@ async function addSchedule(code, permlink, title, body, meta, options, schedule,
|
|
|
4221
4756
|
},
|
|
4222
4757
|
body: JSON.stringify(data)
|
|
4223
4758
|
});
|
|
4224
|
-
return
|
|
4759
|
+
return parseJsonResponse3(response);
|
|
4225
4760
|
}
|
|
4226
4761
|
async function deleteSchedule(code, id) {
|
|
4227
4762
|
const data = { code, id };
|
|
@@ -4233,7 +4768,7 @@ async function deleteSchedule(code, id) {
|
|
|
4233
4768
|
},
|
|
4234
4769
|
body: JSON.stringify(data)
|
|
4235
4770
|
});
|
|
4236
|
-
return
|
|
4771
|
+
return parseJsonResponse3(response);
|
|
4237
4772
|
}
|
|
4238
4773
|
async function moveSchedule(code, id) {
|
|
4239
4774
|
const data = { code, id };
|
|
@@ -4245,7 +4780,7 @@ async function moveSchedule(code, id) {
|
|
|
4245
4780
|
},
|
|
4246
4781
|
body: JSON.stringify(data)
|
|
4247
4782
|
});
|
|
4248
|
-
return
|
|
4783
|
+
return parseJsonResponse3(response);
|
|
4249
4784
|
}
|
|
4250
4785
|
async function getPromotedPost(code, author, permlink) {
|
|
4251
4786
|
const data = { code, author, permlink };
|
|
@@ -4257,7 +4792,7 @@ async function getPromotedPost(code, author, permlink) {
|
|
|
4257
4792
|
},
|
|
4258
4793
|
body: JSON.stringify(data)
|
|
4259
4794
|
});
|
|
4260
|
-
return
|
|
4795
|
+
return parseJsonResponse3(response);
|
|
4261
4796
|
}
|
|
4262
4797
|
async function onboardEmail(username, email, friend) {
|
|
4263
4798
|
const dataBody = {
|
|
@@ -4276,7 +4811,7 @@ async function onboardEmail(username, email, friend) {
|
|
|
4276
4811
|
body: JSON.stringify(dataBody)
|
|
4277
4812
|
}
|
|
4278
4813
|
);
|
|
4279
|
-
return
|
|
4814
|
+
return parseJsonResponse3(response);
|
|
4280
4815
|
}
|
|
4281
4816
|
|
|
4282
4817
|
// src/modules/auth/requests.ts
|
|
@@ -4305,13 +4840,285 @@ async function hsTokenRenew(code) {
|
|
|
4305
4840
|
return data;
|
|
4306
4841
|
}
|
|
4307
4842
|
|
|
4843
|
+
// src/modules/hive-engine/requests.ts
|
|
4844
|
+
var ENGINE_RPC_HEADERS = { "Content-type": "application/json" };
|
|
4845
|
+
async function engineRpc(payload) {
|
|
4846
|
+
const fetchApi = getBoundFetch();
|
|
4847
|
+
const response = await fetchApi(`${CONFIG.privateApiHost}/private-api/engine-api`, {
|
|
4848
|
+
method: "POST",
|
|
4849
|
+
body: JSON.stringify(payload),
|
|
4850
|
+
headers: ENGINE_RPC_HEADERS
|
|
4851
|
+
});
|
|
4852
|
+
if (!response.ok) {
|
|
4853
|
+
throw new Error(
|
|
4854
|
+
`[SDK][HiveEngine] \u2013 request failed with ${response.status}`
|
|
4855
|
+
);
|
|
4856
|
+
}
|
|
4857
|
+
const data = await response.json();
|
|
4858
|
+
return data.result;
|
|
4859
|
+
}
|
|
4860
|
+
async function engineRpcSafe(payload, fallback) {
|
|
4861
|
+
try {
|
|
4862
|
+
return await engineRpc(payload);
|
|
4863
|
+
} catch (e) {
|
|
4864
|
+
return fallback;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
async function getHiveEngineOrderBook(symbol, limit = 50) {
|
|
4868
|
+
const baseParams = {
|
|
4869
|
+
jsonrpc: "2.0",
|
|
4870
|
+
method: "find",
|
|
4871
|
+
params: {
|
|
4872
|
+
contract: "market",
|
|
4873
|
+
query: { symbol },
|
|
4874
|
+
limit,
|
|
4875
|
+
offset: 0
|
|
4876
|
+
},
|
|
4877
|
+
id: 1
|
|
4878
|
+
};
|
|
4879
|
+
const [buy, sell] = await Promise.all([
|
|
4880
|
+
engineRpcSafe(
|
|
4881
|
+
{
|
|
4882
|
+
...baseParams,
|
|
4883
|
+
params: {
|
|
4884
|
+
...baseParams.params,
|
|
4885
|
+
table: "buyBook",
|
|
4886
|
+
indexes: [{ index: "price", descending: true }]
|
|
4887
|
+
}
|
|
4888
|
+
},
|
|
4889
|
+
[]
|
|
4890
|
+
),
|
|
4891
|
+
engineRpcSafe(
|
|
4892
|
+
{
|
|
4893
|
+
...baseParams,
|
|
4894
|
+
params: {
|
|
4895
|
+
...baseParams.params,
|
|
4896
|
+
table: "sellBook",
|
|
4897
|
+
indexes: [{ index: "price", descending: false }]
|
|
4898
|
+
}
|
|
4899
|
+
},
|
|
4900
|
+
[]
|
|
4901
|
+
)
|
|
4902
|
+
]);
|
|
4903
|
+
const sortByPriceDesc = (items) => items.sort((a, b) => {
|
|
4904
|
+
const left = Number(a.price ?? 0);
|
|
4905
|
+
const right = Number(b.price ?? 0);
|
|
4906
|
+
return right - left;
|
|
4907
|
+
});
|
|
4908
|
+
const sortByPriceAsc = (items) => items.sort((a, b) => {
|
|
4909
|
+
const left = Number(a.price ?? 0);
|
|
4910
|
+
const right = Number(b.price ?? 0);
|
|
4911
|
+
return left - right;
|
|
4912
|
+
});
|
|
4913
|
+
return {
|
|
4914
|
+
buy: sortByPriceDesc(buy),
|
|
4915
|
+
sell: sortByPriceAsc(sell)
|
|
4916
|
+
};
|
|
4917
|
+
}
|
|
4918
|
+
async function getHiveEngineTradeHistory(symbol, limit = 50) {
|
|
4919
|
+
return engineRpcSafe(
|
|
4920
|
+
{
|
|
4921
|
+
jsonrpc: "2.0",
|
|
4922
|
+
method: "find",
|
|
4923
|
+
params: {
|
|
4924
|
+
contract: "market",
|
|
4925
|
+
table: "tradesHistory",
|
|
4926
|
+
query: { symbol },
|
|
4927
|
+
limit,
|
|
4928
|
+
offset: 0,
|
|
4929
|
+
indexes: [{ index: "timestamp", descending: true }]
|
|
4930
|
+
},
|
|
4931
|
+
id: 1
|
|
4932
|
+
},
|
|
4933
|
+
[]
|
|
4934
|
+
);
|
|
4935
|
+
}
|
|
4936
|
+
async function getHiveEngineOpenOrders(account, symbol, limit = 100) {
|
|
4937
|
+
const baseParams = {
|
|
4938
|
+
jsonrpc: "2.0",
|
|
4939
|
+
method: "find",
|
|
4940
|
+
params: {
|
|
4941
|
+
contract: "market",
|
|
4942
|
+
query: { symbol, account },
|
|
4943
|
+
limit,
|
|
4944
|
+
offset: 0
|
|
4945
|
+
},
|
|
4946
|
+
id: 1
|
|
4947
|
+
};
|
|
4948
|
+
const [buyRaw, sellRaw] = await Promise.all([
|
|
4949
|
+
engineRpcSafe(
|
|
4950
|
+
{
|
|
4951
|
+
...baseParams,
|
|
4952
|
+
params: {
|
|
4953
|
+
...baseParams.params,
|
|
4954
|
+
table: "buyBook",
|
|
4955
|
+
indexes: [{ index: "timestamp", descending: true }]
|
|
4956
|
+
}
|
|
4957
|
+
},
|
|
4958
|
+
[]
|
|
4959
|
+
),
|
|
4960
|
+
engineRpcSafe(
|
|
4961
|
+
{
|
|
4962
|
+
...baseParams,
|
|
4963
|
+
params: {
|
|
4964
|
+
...baseParams.params,
|
|
4965
|
+
table: "sellBook",
|
|
4966
|
+
indexes: [{ index: "timestamp", descending: true }]
|
|
4967
|
+
}
|
|
4968
|
+
},
|
|
4969
|
+
[]
|
|
4970
|
+
)
|
|
4971
|
+
]);
|
|
4972
|
+
const formatTotal = (quantity, price) => (Number(quantity || 0) * Number(price || 0)).toFixed(8);
|
|
4973
|
+
const buy = buyRaw.map((order) => ({
|
|
4974
|
+
id: order.txId,
|
|
4975
|
+
type: "buy",
|
|
4976
|
+
account: order.account,
|
|
4977
|
+
symbol: order.symbol,
|
|
4978
|
+
quantity: order.quantity,
|
|
4979
|
+
price: order.price,
|
|
4980
|
+
total: order.tokensLocked ?? formatTotal(order.quantity, order.price),
|
|
4981
|
+
timestamp: Number(order.timestamp ?? 0)
|
|
4982
|
+
}));
|
|
4983
|
+
const sell = sellRaw.map((order) => ({
|
|
4984
|
+
id: order.txId,
|
|
4985
|
+
type: "sell",
|
|
4986
|
+
account: order.account,
|
|
4987
|
+
symbol: order.symbol,
|
|
4988
|
+
quantity: order.quantity,
|
|
4989
|
+
price: order.price,
|
|
4990
|
+
total: formatTotal(order.quantity, order.price),
|
|
4991
|
+
timestamp: Number(order.timestamp ?? 0)
|
|
4992
|
+
}));
|
|
4993
|
+
return [...buy, ...sell].sort((a, b) => b.timestamp - a.timestamp);
|
|
4994
|
+
}
|
|
4995
|
+
async function getHiveEngineMetrics(symbol, account) {
|
|
4996
|
+
return engineRpcSafe(
|
|
4997
|
+
{
|
|
4998
|
+
jsonrpc: "2.0",
|
|
4999
|
+
method: "find",
|
|
5000
|
+
params: {
|
|
5001
|
+
contract: "market",
|
|
5002
|
+
table: "metrics",
|
|
5003
|
+
query: {
|
|
5004
|
+
...symbol ? { symbol } : {},
|
|
5005
|
+
...account ? { account } : {}
|
|
5006
|
+
}
|
|
5007
|
+
},
|
|
5008
|
+
id: 1
|
|
5009
|
+
},
|
|
5010
|
+
[]
|
|
5011
|
+
);
|
|
5012
|
+
}
|
|
5013
|
+
async function getHiveEngineTokensMarket(account, symbol) {
|
|
5014
|
+
return getHiveEngineMetrics(symbol, account);
|
|
5015
|
+
}
|
|
5016
|
+
async function getHiveEngineTokensBalances(username) {
|
|
5017
|
+
return engineRpcSafe(
|
|
5018
|
+
{
|
|
5019
|
+
jsonrpc: "2.0",
|
|
5020
|
+
method: "find",
|
|
5021
|
+
params: {
|
|
5022
|
+
contract: "tokens",
|
|
5023
|
+
table: "balances",
|
|
5024
|
+
query: {
|
|
5025
|
+
account: username
|
|
5026
|
+
}
|
|
5027
|
+
},
|
|
5028
|
+
id: 1
|
|
5029
|
+
},
|
|
5030
|
+
[]
|
|
5031
|
+
);
|
|
5032
|
+
}
|
|
5033
|
+
async function getHiveEngineTokensMetadata(tokens) {
|
|
5034
|
+
return engineRpcSafe(
|
|
5035
|
+
{
|
|
5036
|
+
jsonrpc: "2.0",
|
|
5037
|
+
method: "find",
|
|
5038
|
+
params: {
|
|
5039
|
+
contract: "tokens",
|
|
5040
|
+
table: "tokens",
|
|
5041
|
+
query: {
|
|
5042
|
+
symbol: { $in: tokens }
|
|
5043
|
+
}
|
|
5044
|
+
},
|
|
5045
|
+
id: 2
|
|
5046
|
+
},
|
|
5047
|
+
[]
|
|
5048
|
+
);
|
|
5049
|
+
}
|
|
5050
|
+
async function getHiveEngineTokenTransactions(username, symbol, limit, offset) {
|
|
5051
|
+
const fetchApi = getBoundFetch();
|
|
5052
|
+
const url = new URL(
|
|
5053
|
+
`${CONFIG.privateApiHost}/private-api/engine-account-history`
|
|
5054
|
+
);
|
|
5055
|
+
url.searchParams.set("account", username);
|
|
5056
|
+
url.searchParams.set("symbol", symbol);
|
|
5057
|
+
url.searchParams.set("limit", limit.toString());
|
|
5058
|
+
url.searchParams.set("offset", offset.toString());
|
|
5059
|
+
const response = await fetchApi(url.toString(), {
|
|
5060
|
+
method: "GET",
|
|
5061
|
+
headers: { "Content-type": "application/json" }
|
|
5062
|
+
});
|
|
5063
|
+
if (!response.ok) {
|
|
5064
|
+
throw new Error(
|
|
5065
|
+
`[SDK][HiveEngine] \u2013 account history failed with ${response.status}`
|
|
5066
|
+
);
|
|
5067
|
+
}
|
|
5068
|
+
return await response.json();
|
|
5069
|
+
}
|
|
5070
|
+
async function getHiveEngineTokenMetrics(symbol, interval = "daily") {
|
|
5071
|
+
const fetchApi = getBoundFetch();
|
|
5072
|
+
const url = new URL(`${CONFIG.privateApiHost}/private-api/engine-chart-api`);
|
|
5073
|
+
url.searchParams.set("symbol", symbol);
|
|
5074
|
+
url.searchParams.set("interval", interval);
|
|
5075
|
+
const response = await fetchApi(url.toString(), {
|
|
5076
|
+
headers: { "Content-type": "application/json" }
|
|
5077
|
+
});
|
|
5078
|
+
if (!response.ok) {
|
|
5079
|
+
throw new Error(
|
|
5080
|
+
`[SDK][HiveEngine] \u2013 chart failed with ${response.status}`
|
|
5081
|
+
);
|
|
5082
|
+
}
|
|
5083
|
+
return await response.json();
|
|
5084
|
+
}
|
|
5085
|
+
async function getHiveEngineUnclaimedRewards(username) {
|
|
5086
|
+
const fetchApi = getBoundFetch();
|
|
5087
|
+
const response = await fetchApi(
|
|
5088
|
+
`${CONFIG.privateApiHost}/private-api/engine-reward-api/${username}?hive=1`
|
|
5089
|
+
);
|
|
5090
|
+
if (!response.ok) {
|
|
5091
|
+
throw new Error(
|
|
5092
|
+
`[SDK][HiveEngine] \u2013 rewards failed with ${response.status}`
|
|
5093
|
+
);
|
|
5094
|
+
}
|
|
5095
|
+
return await response.json();
|
|
5096
|
+
}
|
|
5097
|
+
|
|
5098
|
+
// src/modules/spk/requests.ts
|
|
5099
|
+
async function getSpkWallet(username) {
|
|
5100
|
+
const fetchApi = getBoundFetch();
|
|
5101
|
+
const response = await fetchApi(`${CONFIG.spkNode}/@${username}`);
|
|
5102
|
+
if (!response.ok) {
|
|
5103
|
+
throw new Error(`[SDK][SPK] \u2013 wallet failed with ${response.status}`);
|
|
5104
|
+
}
|
|
5105
|
+
return await response.json();
|
|
5106
|
+
}
|
|
5107
|
+
async function getSpkMarkets() {
|
|
5108
|
+
const fetchApi = getBoundFetch();
|
|
5109
|
+
const response = await fetchApi(`${CONFIG.spkNode}/markets`);
|
|
5110
|
+
if (!response.ok) {
|
|
5111
|
+
throw new Error(`[SDK][SPK] \u2013 markets failed with ${response.status}`);
|
|
5112
|
+
}
|
|
5113
|
+
return await response.json();
|
|
5114
|
+
}
|
|
5115
|
+
|
|
4308
5116
|
exports.ACCOUNT_OPERATION_GROUPS = ACCOUNT_OPERATION_GROUPS;
|
|
4309
5117
|
exports.ALL_ACCOUNT_OPERATIONS = ALL_ACCOUNT_OPERATIONS;
|
|
4310
5118
|
exports.ALL_NOTIFY_TYPES = ALL_NOTIFY_TYPES;
|
|
4311
5119
|
exports.CONFIG = CONFIG;
|
|
4312
5120
|
exports.EcencyAnalytics = mutations_exports;
|
|
4313
5121
|
exports.HiveSignerIntegration = HiveSignerIntegration;
|
|
4314
|
-
exports.Keychain = keychain_exports;
|
|
4315
5122
|
exports.NaiMap = NaiMap;
|
|
4316
5123
|
exports.NotificationFilter = NotificationFilter;
|
|
4317
5124
|
exports.NotificationViewType = NotificationViewType;
|
|
@@ -4323,6 +5130,7 @@ exports.ThreeSpeakIntegration = ThreeSpeakIntegration;
|
|
|
4323
5130
|
exports.addDraft = addDraft;
|
|
4324
5131
|
exports.addImage = addImage;
|
|
4325
5132
|
exports.addSchedule = addSchedule;
|
|
5133
|
+
exports.bridgeApiCall = bridgeApiCall;
|
|
4326
5134
|
exports.broadcastJson = broadcastJson;
|
|
4327
5135
|
exports.buildProfileMetadata = buildProfileMetadata;
|
|
4328
5136
|
exports.checkUsernameWalletsPendingQueryOptions = checkUsernameWalletsPendingQueryOptions;
|
|
@@ -4331,15 +5139,18 @@ exports.dedupeAndSortKeyAuths = dedupeAndSortKeyAuths;
|
|
|
4331
5139
|
exports.deleteDraft = deleteDraft;
|
|
4332
5140
|
exports.deleteImage = deleteImage;
|
|
4333
5141
|
exports.deleteSchedule = deleteSchedule;
|
|
5142
|
+
exports.downVotingPower = downVotingPower;
|
|
4334
5143
|
exports.encodeObj = encodeObj;
|
|
4335
5144
|
exports.extractAccountProfile = extractAccountProfile;
|
|
4336
|
-
exports.getAccessToken = getAccessToken;
|
|
4337
5145
|
exports.getAccountFullQueryOptions = getAccountFullQueryOptions;
|
|
4338
5146
|
exports.getAccountNotificationsInfiniteQueryOptions = getAccountNotificationsInfiniteQueryOptions;
|
|
4339
5147
|
exports.getAccountPendingRecoveryQueryOptions = getAccountPendingRecoveryQueryOptions;
|
|
5148
|
+
exports.getAccountPosts = getAccountPosts;
|
|
4340
5149
|
exports.getAccountPostsInfiniteQueryOptions = getAccountPostsInfiniteQueryOptions;
|
|
5150
|
+
exports.getAccountPostsQueryOptions = getAccountPostsQueryOptions;
|
|
4341
5151
|
exports.getAccountRcQueryOptions = getAccountRcQueryOptions;
|
|
4342
5152
|
exports.getAccountRecoveriesQueryOptions = getAccountRecoveriesQueryOptions;
|
|
5153
|
+
exports.getAccountReputationsQueryOptions = getAccountReputationsQueryOptions;
|
|
4343
5154
|
exports.getAccountSubscriptionsQueryOptions = getAccountSubscriptionsQueryOptions;
|
|
4344
5155
|
exports.getAccountVoteHistoryInfiniteQueryOptions = getAccountVoteHistoryInfiniteQueryOptions;
|
|
4345
5156
|
exports.getAccountsQueryOptions = getAccountsQueryOptions;
|
|
@@ -4353,11 +5164,16 @@ exports.getBoundFetch = getBoundFetch;
|
|
|
4353
5164
|
exports.getChainPropertiesQueryOptions = getChainPropertiesQueryOptions;
|
|
4354
5165
|
exports.getCollateralizedConversionRequestsQueryOptions = getCollateralizedConversionRequestsQueryOptions;
|
|
4355
5166
|
exports.getCommentHistoryQueryOptions = getCommentHistoryQueryOptions;
|
|
5167
|
+
exports.getCommunities = getCommunities;
|
|
4356
5168
|
exports.getCommunitiesQueryOptions = getCommunitiesQueryOptions;
|
|
5169
|
+
exports.getCommunity = getCommunity;
|
|
4357
5170
|
exports.getCommunityContextQueryOptions = getCommunityContextQueryOptions;
|
|
4358
5171
|
exports.getCommunityPermissions = getCommunityPermissions;
|
|
5172
|
+
exports.getCommunityQueryOptions = getCommunityQueryOptions;
|
|
4359
5173
|
exports.getCommunitySubscribersQueryOptions = getCommunitySubscribersQueryOptions;
|
|
4360
5174
|
exports.getCommunityType = getCommunityType;
|
|
5175
|
+
exports.getContentQueryOptions = getContentQueryOptions;
|
|
5176
|
+
exports.getContentRepliesQueryOptions = getContentRepliesQueryOptions;
|
|
4361
5177
|
exports.getControversialRisingInfiniteQueryOptions = getControversialRisingInfiniteQueryOptions;
|
|
4362
5178
|
exports.getConversionRequestsQueryOptions = getConversionRequestsQueryOptions;
|
|
4363
5179
|
exports.getCurrencyRate = getCurrencyRate;
|
|
@@ -4366,6 +5182,8 @@ exports.getCurrencyTokenRate = getCurrencyTokenRate;
|
|
|
4366
5182
|
exports.getDeletedEntryQueryOptions = getDeletedEntryQueryOptions;
|
|
4367
5183
|
exports.getDiscoverCurationQueryOptions = getDiscoverCurationQueryOptions;
|
|
4368
5184
|
exports.getDiscoverLeaderboardQueryOptions = getDiscoverLeaderboardQueryOptions;
|
|
5185
|
+
exports.getDiscussion = getDiscussion;
|
|
5186
|
+
exports.getDiscussionQueryOptions = getDiscussionQueryOptions;
|
|
4369
5187
|
exports.getDiscussionsQueryOptions = getDiscussionsQueryOptions;
|
|
4370
5188
|
exports.getDraftsQueryOptions = getDraftsQueryOptions;
|
|
4371
5189
|
exports.getDynamicPropsQueryOptions = getDynamicPropsQueryOptions;
|
|
@@ -4376,15 +5194,27 @@ exports.getFragmentsQueryOptions = getFragmentsQueryOptions;
|
|
|
4376
5194
|
exports.getFriendsInfiniteQueryOptions = getFriendsInfiniteQueryOptions;
|
|
4377
5195
|
exports.getGalleryImagesQueryOptions = getGalleryImagesQueryOptions;
|
|
4378
5196
|
exports.getGameStatusCheckQueryOptions = getGameStatusCheckQueryOptions;
|
|
5197
|
+
exports.getHiveEngineMetrics = getHiveEngineMetrics;
|
|
5198
|
+
exports.getHiveEngineOpenOrders = getHiveEngineOpenOrders;
|
|
5199
|
+
exports.getHiveEngineOrderBook = getHiveEngineOrderBook;
|
|
5200
|
+
exports.getHiveEngineTokenMetrics = getHiveEngineTokenMetrics;
|
|
5201
|
+
exports.getHiveEngineTokenTransactions = getHiveEngineTokenTransactions;
|
|
5202
|
+
exports.getHiveEngineTokensBalances = getHiveEngineTokensBalances;
|
|
5203
|
+
exports.getHiveEngineTokensMarket = getHiveEngineTokensMarket;
|
|
5204
|
+
exports.getHiveEngineTokensMetadata = getHiveEngineTokensMetadata;
|
|
5205
|
+
exports.getHiveEngineTradeHistory = getHiveEngineTradeHistory;
|
|
5206
|
+
exports.getHiveEngineUnclaimedRewards = getHiveEngineUnclaimedRewards;
|
|
4379
5207
|
exports.getHiveHbdStatsQueryOptions = getHiveHbdStatsQueryOptions;
|
|
4380
5208
|
exports.getHivePoshLinksQueryOptions = getHivePoshLinksQueryOptions;
|
|
5209
|
+
exports.getHivePrice = getHivePrice;
|
|
4381
5210
|
exports.getImagesQueryOptions = getImagesQueryOptions;
|
|
4382
|
-
exports.
|
|
5211
|
+
exports.getIncomingRcQueryOptions = getIncomingRcQueryOptions;
|
|
4383
5212
|
exports.getMarketData = getMarketData;
|
|
4384
5213
|
exports.getMarketDataQueryOptions = getMarketDataQueryOptions;
|
|
4385
5214
|
exports.getMarketHistoryQueryOptions = getMarketHistoryQueryOptions;
|
|
4386
5215
|
exports.getMarketStatisticsQueryOptions = getMarketStatisticsQueryOptions;
|
|
4387
5216
|
exports.getMutedUsersQueryOptions = getMutedUsersQueryOptions;
|
|
5217
|
+
exports.getNormalizePostQueryOptions = getNormalizePostQueryOptions;
|
|
4388
5218
|
exports.getNotificationSetting = getNotificationSetting;
|
|
4389
5219
|
exports.getNotifications = getNotifications;
|
|
4390
5220
|
exports.getNotificationsInfiniteQueryOptions = getNotificationsInfiniteQueryOptions;
|
|
@@ -4395,11 +5225,16 @@ exports.getOrderBookQueryOptions = getOrderBookQueryOptions;
|
|
|
4395
5225
|
exports.getOutgoingRcDelegationsInfiniteQueryOptions = getOutgoingRcDelegationsInfiniteQueryOptions;
|
|
4396
5226
|
exports.getPageStatsQueryOptions = getPageStatsQueryOptions;
|
|
4397
5227
|
exports.getPointsQueryOptions = getPointsQueryOptions;
|
|
5228
|
+
exports.getPost = getPost;
|
|
5229
|
+
exports.getPostHeader = getPostHeader;
|
|
4398
5230
|
exports.getPostHeaderQueryOptions = getPostHeaderQueryOptions;
|
|
4399
5231
|
exports.getPostQueryOptions = getPostQueryOptions;
|
|
4400
5232
|
exports.getPostTipsQueryOptions = getPostTipsQueryOptions;
|
|
4401
|
-
exports.
|
|
5233
|
+
exports.getPostsRanked = getPostsRanked;
|
|
4402
5234
|
exports.getPostsRankedInfiniteQueryOptions = getPostsRankedInfiniteQueryOptions;
|
|
5235
|
+
exports.getPostsRankedQueryOptions = getPostsRankedQueryOptions;
|
|
5236
|
+
exports.getProfiles = getProfiles;
|
|
5237
|
+
exports.getProfilesQueryOptions = getProfilesQueryOptions;
|
|
4403
5238
|
exports.getPromotePriceQueryOptions = getPromotePriceQueryOptions;
|
|
4404
5239
|
exports.getPromotedPost = getPromotedPost;
|
|
4405
5240
|
exports.getPromotedPostsQuery = getPromotedPostsQuery;
|
|
@@ -4412,7 +5247,7 @@ exports.getReblogsQueryOptions = getReblogsQueryOptions;
|
|
|
4412
5247
|
exports.getReceivedVestingSharesQueryOptions = getReceivedVestingSharesQueryOptions;
|
|
4413
5248
|
exports.getReferralsInfiniteQueryOptions = getReferralsInfiniteQueryOptions;
|
|
4414
5249
|
exports.getReferralsStatsQueryOptions = getReferralsStatsQueryOptions;
|
|
4415
|
-
exports.
|
|
5250
|
+
exports.getRelationshipBetweenAccounts = getRelationshipBetweenAccounts;
|
|
4416
5251
|
exports.getRelationshipBetweenAccountsQueryOptions = getRelationshipBetweenAccountsQueryOptions;
|
|
4417
5252
|
exports.getRewardedCommunitiesQueryOptions = getRewardedCommunitiesQueryOptions;
|
|
4418
5253
|
exports.getSavingsWithdrawFromQueryOptions = getSavingsWithdrawFromQueryOptions;
|
|
@@ -4424,11 +5259,15 @@ exports.getSearchFriendsQueryOptions = getSearchFriendsQueryOptions;
|
|
|
4424
5259
|
exports.getSearchPathQueryOptions = getSearchPathQueryOptions;
|
|
4425
5260
|
exports.getSearchTopicsQueryOptions = getSearchTopicsQueryOptions;
|
|
4426
5261
|
exports.getSimilarEntriesQueryOptions = getSimilarEntriesQueryOptions;
|
|
5262
|
+
exports.getSpkMarkets = getSpkMarkets;
|
|
5263
|
+
exports.getSpkWallet = getSpkWallet;
|
|
4427
5264
|
exports.getStatsQueryOptions = getStatsQueryOptions;
|
|
5265
|
+
exports.getSubscribers = getSubscribers;
|
|
5266
|
+
exports.getSubscriptions = getSubscriptions;
|
|
5267
|
+
exports.getTradeHistoryQueryOptions = getTradeHistoryQueryOptions;
|
|
4428
5268
|
exports.getTransactionsInfiniteQueryOptions = getTransactionsInfiniteQueryOptions;
|
|
4429
5269
|
exports.getTrendingTagsQueryOptions = getTrendingTagsQueryOptions;
|
|
4430
5270
|
exports.getTrendingTagsWithStatsQueryOptions = getTrendingTagsWithStatsQueryOptions;
|
|
4431
|
-
exports.getUser = getUser;
|
|
4432
5271
|
exports.getUserProposalVotesQueryOptions = getUserProposalVotesQueryOptions;
|
|
4433
5272
|
exports.getVestingDelegationsQueryOptions = getVestingDelegationsQueryOptions;
|
|
4434
5273
|
exports.getVisibleFirstLevelThreadItems = getVisibleFirstLevelThreadItems;
|
|
@@ -4445,14 +5284,22 @@ exports.makeQueryClient = makeQueryClient;
|
|
|
4445
5284
|
exports.mapThreadItemsToWaveEntries = mapThreadItemsToWaveEntries;
|
|
4446
5285
|
exports.markNotifications = markNotifications;
|
|
4447
5286
|
exports.moveSchedule = moveSchedule;
|
|
5287
|
+
exports.normalizePost = normalizePost;
|
|
4448
5288
|
exports.normalizeWaveEntryFromApi = normalizeWaveEntryFromApi;
|
|
4449
5289
|
exports.onboardEmail = onboardEmail;
|
|
4450
5290
|
exports.parseAccounts = parseAccounts;
|
|
4451
5291
|
exports.parseAsset = parseAsset;
|
|
4452
5292
|
exports.parseProfileMetadata = parseProfileMetadata;
|
|
5293
|
+
exports.powerRechargeTime = powerRechargeTime;
|
|
5294
|
+
exports.rcPower = rcPower;
|
|
5295
|
+
exports.resolvePost = resolvePost;
|
|
4453
5296
|
exports.roleMap = roleMap;
|
|
4454
5297
|
exports.saveNotificationSetting = saveNotificationSetting;
|
|
5298
|
+
exports.search = search;
|
|
5299
|
+
exports.searchAccount = searchAccount;
|
|
5300
|
+
exports.searchPath = searchPath;
|
|
4455
5301
|
exports.searchQueryOptions = searchQueryOptions;
|
|
5302
|
+
exports.searchTag = searchTag;
|
|
4456
5303
|
exports.signUp = signUp;
|
|
4457
5304
|
exports.sortDiscussions = sortDiscussions;
|
|
4458
5305
|
exports.subscribeEmail = subscribeEmail;
|
|
@@ -4480,5 +5327,8 @@ exports.useSignOperationByHivesigner = useSignOperationByHivesigner;
|
|
|
4480
5327
|
exports.useSignOperationByKey = useSignOperationByKey;
|
|
4481
5328
|
exports.useSignOperationByKeychain = useSignOperationByKeychain;
|
|
4482
5329
|
exports.usrActivity = usrActivity;
|
|
5330
|
+
exports.validatePostCreating = validatePostCreating;
|
|
5331
|
+
exports.votingPower = votingPower;
|
|
5332
|
+
exports.votingValue = votingValue;
|
|
4483
5333
|
//# sourceMappingURL=index.cjs.map
|
|
4484
5334
|
//# sourceMappingURL=index.cjs.map
|