@ecency/sdk 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +305 -95
- package/dist/browser/index.js +1261 -248
- package/dist/browser/index.js.map +1 -1
- package/dist/index.browser.mjs +41 -30
- package/dist/index.cjs +41 -30
- package/dist/index.d.ts +16 -7
- package/dist/index.mjs +41 -30
- package/dist/node/index.cjs +1318 -247
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +1261 -248
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -9,6 +9,107 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/modules/keychain/keychain.ts
|
|
13
|
+
var keychain_exports = {};
|
|
14
|
+
__export(keychain_exports, {
|
|
15
|
+
broadcast: () => broadcast,
|
|
16
|
+
customJson: () => customJson,
|
|
17
|
+
handshake: () => handshake
|
|
18
|
+
});
|
|
19
|
+
function handshake() {
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
window.hive_keychain?.requestHandshake(() => {
|
|
22
|
+
resolve();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
|
|
27
|
+
window.hive_keychain?.requestBroadcast(
|
|
28
|
+
account,
|
|
29
|
+
operations,
|
|
30
|
+
key,
|
|
31
|
+
(resp) => {
|
|
32
|
+
if (!resp.success) {
|
|
33
|
+
reject({ message: "Operation cancelled" });
|
|
34
|
+
}
|
|
35
|
+
resolve(resp);
|
|
36
|
+
},
|
|
37
|
+
rpc
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
|
|
41
|
+
window.hive_keychain?.requestCustomJson(
|
|
42
|
+
account,
|
|
43
|
+
id,
|
|
44
|
+
key,
|
|
45
|
+
json,
|
|
46
|
+
display_msg,
|
|
47
|
+
(resp) => {
|
|
48
|
+
if (!resp.success) {
|
|
49
|
+
reject({ message: "Operation cancelled" });
|
|
50
|
+
}
|
|
51
|
+
resolve(resp);
|
|
52
|
+
},
|
|
53
|
+
rpc
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// src/modules/core/mutations/use-broadcast-mutation.ts
|
|
58
|
+
function useBroadcastMutation(mutationKey = [], username, accessToken, operations, onSuccess = () => {
|
|
59
|
+
}, auth) {
|
|
60
|
+
return useMutation({
|
|
61
|
+
onSuccess,
|
|
62
|
+
mutationKey: [...mutationKey, username],
|
|
63
|
+
mutationFn: async (payload) => {
|
|
64
|
+
if (!username) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
const postingKey = auth?.postingKey;
|
|
70
|
+
if (postingKey) {
|
|
71
|
+
const privateKey = PrivateKey.fromString(postingKey);
|
|
72
|
+
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
73
|
+
operations(payload),
|
|
74
|
+
privateKey
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
const loginType = auth?.loginType;
|
|
78
|
+
if (loginType && loginType == "keychain") {
|
|
79
|
+
return keychain_exports.broadcast(
|
|
80
|
+
username,
|
|
81
|
+
operations(payload),
|
|
82
|
+
"Posting"
|
|
83
|
+
).then((r) => r.result);
|
|
84
|
+
}
|
|
85
|
+
if (accessToken) {
|
|
86
|
+
const f = getBoundFetch();
|
|
87
|
+
const res = await f("https://hivesigner.com/api/broadcast", {
|
|
88
|
+
method: "POST",
|
|
89
|
+
headers: {
|
|
90
|
+
Authorization: accessToken,
|
|
91
|
+
"Content-Type": "application/json",
|
|
92
|
+
Accept: "application/json"
|
|
93
|
+
},
|
|
94
|
+
body: JSON.stringify({ operations: operations(payload) })
|
|
95
|
+
});
|
|
96
|
+
if (!res.ok) {
|
|
97
|
+
const txt = await res.text().catch(() => "");
|
|
98
|
+
throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
|
|
99
|
+
}
|
|
100
|
+
const json = await res.json();
|
|
101
|
+
if (json?.errors) {
|
|
102
|
+
throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
|
|
103
|
+
}
|
|
104
|
+
return json.result;
|
|
105
|
+
}
|
|
106
|
+
throw new Error(
|
|
107
|
+
"[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
12
113
|
// src/modules/core/mock-storage.ts
|
|
13
114
|
var MockStorage = class {
|
|
14
115
|
length = 0;
|
|
@@ -30,6 +131,7 @@ var MockStorage = class {
|
|
|
30
131
|
};
|
|
31
132
|
var CONFIG = {
|
|
32
133
|
privateApiHost: "https://ecency.com",
|
|
134
|
+
imageHost: "https://images.ecency.com",
|
|
33
135
|
storage: typeof window === "undefined" ? new MockStorage() : window.localStorage,
|
|
34
136
|
storagePrefix: "ecency",
|
|
35
137
|
hiveClient: new Client(
|
|
@@ -76,6 +178,10 @@ var ConfigManager;
|
|
|
76
178
|
CONFIG.privateApiHost = host;
|
|
77
179
|
}
|
|
78
180
|
ConfigManager2.setPrivateApiHost = setPrivateApiHost;
|
|
181
|
+
function setImageHost(host) {
|
|
182
|
+
CONFIG.imageHost = host;
|
|
183
|
+
}
|
|
184
|
+
ConfigManager2.setImageHost = setImageHost;
|
|
79
185
|
function analyzeRedosRisk(pattern) {
|
|
80
186
|
if (/(\([^)]*[*+{][^)]*\))[*+{]/.test(pattern)) {
|
|
81
187
|
return { safe: false, reason: "nested quantifiers detected" };
|
|
@@ -182,6 +288,40 @@ var ConfigManager;
|
|
|
182
288
|
}
|
|
183
289
|
ConfigManager2.setDmcaLists = setDmcaLists;
|
|
184
290
|
})(ConfigManager || (ConfigManager = {}));
|
|
291
|
+
async function broadcastJson(username, id, payload, accessToken, auth) {
|
|
292
|
+
if (!username) {
|
|
293
|
+
throw new Error(
|
|
294
|
+
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
const jjson = {
|
|
298
|
+
id,
|
|
299
|
+
required_auths: [],
|
|
300
|
+
required_posting_auths: [username],
|
|
301
|
+
json: JSON.stringify(payload)
|
|
302
|
+
};
|
|
303
|
+
const postingKey = auth?.postingKey;
|
|
304
|
+
if (postingKey) {
|
|
305
|
+
const privateKey = PrivateKey.fromString(postingKey);
|
|
306
|
+
return CONFIG.hiveClient.broadcast.json(
|
|
307
|
+
jjson,
|
|
308
|
+
privateKey
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
const loginType = auth?.loginType;
|
|
312
|
+
if (loginType && loginType == "keychain") {
|
|
313
|
+
return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
|
|
314
|
+
}
|
|
315
|
+
if (accessToken) {
|
|
316
|
+
const response = await new hs.Client({
|
|
317
|
+
accessToken
|
|
318
|
+
}).customJson([], [username], id, JSON.stringify(payload));
|
|
319
|
+
return response.result;
|
|
320
|
+
}
|
|
321
|
+
throw new Error(
|
|
322
|
+
"[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
|
|
323
|
+
);
|
|
324
|
+
}
|
|
185
325
|
|
|
186
326
|
// src/modules/core/utils/decoder-encoder.ts
|
|
187
327
|
function encodeObj(o) {
|
|
@@ -259,143 +399,6 @@ var getAccessToken = (username) => getUser(username) && getUser(username).access
|
|
|
259
399
|
var getPostingKey = (username) => getUser(username) && getUser(username).postingKey;
|
|
260
400
|
var getLoginType = (username) => getUser(username) && getUser(username).loginType;
|
|
261
401
|
var getRefreshToken = (username) => getUser(username) && getUser(username).refreshToken;
|
|
262
|
-
|
|
263
|
-
// src/modules/keychain/keychain.ts
|
|
264
|
-
var keychain_exports = {};
|
|
265
|
-
__export(keychain_exports, {
|
|
266
|
-
broadcast: () => broadcast,
|
|
267
|
-
customJson: () => customJson,
|
|
268
|
-
handshake: () => handshake
|
|
269
|
-
});
|
|
270
|
-
function handshake() {
|
|
271
|
-
return new Promise((resolve) => {
|
|
272
|
-
window.hive_keychain?.requestHandshake(() => {
|
|
273
|
-
resolve();
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
var broadcast = (account, operations, key, rpc = null) => new Promise((resolve, reject) => {
|
|
278
|
-
window.hive_keychain?.requestBroadcast(
|
|
279
|
-
account,
|
|
280
|
-
operations,
|
|
281
|
-
key,
|
|
282
|
-
(resp) => {
|
|
283
|
-
if (!resp.success) {
|
|
284
|
-
reject({ message: "Operation cancelled" });
|
|
285
|
-
}
|
|
286
|
-
resolve(resp);
|
|
287
|
-
},
|
|
288
|
-
rpc
|
|
289
|
-
);
|
|
290
|
-
});
|
|
291
|
-
var customJson = (account, id, key, json, display_msg, rpc = null) => new Promise((resolve, reject) => {
|
|
292
|
-
window.hive_keychain?.requestCustomJson(
|
|
293
|
-
account,
|
|
294
|
-
id,
|
|
295
|
-
key,
|
|
296
|
-
json,
|
|
297
|
-
display_msg,
|
|
298
|
-
(resp) => {
|
|
299
|
-
if (!resp.success) {
|
|
300
|
-
reject({ message: "Operation cancelled" });
|
|
301
|
-
}
|
|
302
|
-
resolve(resp);
|
|
303
|
-
},
|
|
304
|
-
rpc
|
|
305
|
-
);
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
// src/modules/core/mutations/use-broadcast-mutation.ts
|
|
309
|
-
function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
|
|
310
|
-
}) {
|
|
311
|
-
return useMutation({
|
|
312
|
-
onSuccess,
|
|
313
|
-
mutationKey: [...mutationKey, username],
|
|
314
|
-
mutationFn: async (payload) => {
|
|
315
|
-
if (!username) {
|
|
316
|
-
throw new Error(
|
|
317
|
-
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
const postingKey = getPostingKey(username);
|
|
321
|
-
if (postingKey) {
|
|
322
|
-
const privateKey = PrivateKey.fromString(postingKey);
|
|
323
|
-
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
324
|
-
operations(payload),
|
|
325
|
-
privateKey
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
const loginType = getLoginType(username);
|
|
329
|
-
if (loginType && loginType == "keychain") {
|
|
330
|
-
return keychain_exports.broadcast(
|
|
331
|
-
username,
|
|
332
|
-
operations(payload),
|
|
333
|
-
"Posting"
|
|
334
|
-
).then((r) => r.result);
|
|
335
|
-
}
|
|
336
|
-
let token = getAccessToken(username);
|
|
337
|
-
if (token) {
|
|
338
|
-
const f = getBoundFetch();
|
|
339
|
-
const res = await f("https://hivesigner.com/api/broadcast", {
|
|
340
|
-
method: "POST",
|
|
341
|
-
headers: {
|
|
342
|
-
Authorization: token,
|
|
343
|
-
"Content-Type": "application/json",
|
|
344
|
-
Accept: "application/json"
|
|
345
|
-
},
|
|
346
|
-
body: JSON.stringify({ operations: operations(payload) })
|
|
347
|
-
});
|
|
348
|
-
if (!res.ok) {
|
|
349
|
-
const txt = await res.text().catch(() => "");
|
|
350
|
-
throw new Error(`[Hivesigner] ${res.status} ${res.statusText} ${txt}`);
|
|
351
|
-
}
|
|
352
|
-
const json = await res.json();
|
|
353
|
-
if (json?.errors) {
|
|
354
|
-
throw new Error(`[Hivesigner] ${JSON.stringify(json.errors)}`);
|
|
355
|
-
}
|
|
356
|
-
return json.result;
|
|
357
|
-
}
|
|
358
|
-
throw new Error(
|
|
359
|
-
"[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
async function broadcastJson(username, id, payload) {
|
|
365
|
-
if (!username) {
|
|
366
|
-
throw new Error(
|
|
367
|
-
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
const jjson = {
|
|
371
|
-
id,
|
|
372
|
-
required_auths: [],
|
|
373
|
-
required_posting_auths: [username],
|
|
374
|
-
json: JSON.stringify(payload)
|
|
375
|
-
};
|
|
376
|
-
const postingKey = getPostingKey(username);
|
|
377
|
-
if (postingKey) {
|
|
378
|
-
const privateKey = PrivateKey.fromString(postingKey);
|
|
379
|
-
return CONFIG.hiveClient.broadcast.json(
|
|
380
|
-
jjson,
|
|
381
|
-
privateKey
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
const loginType = getLoginType(username);
|
|
385
|
-
if (loginType && loginType == "keychain") {
|
|
386
|
-
return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
|
|
387
|
-
}
|
|
388
|
-
let token = getAccessToken(username);
|
|
389
|
-
if (token) {
|
|
390
|
-
const response = await new hs.Client({
|
|
391
|
-
accessToken: token
|
|
392
|
-
}).customJson([], [username], id, JSON.stringify(payload));
|
|
393
|
-
return response.result;
|
|
394
|
-
}
|
|
395
|
-
throw new Error(
|
|
396
|
-
"[SDK][Broadcast] \u2013 cannot broadcast w/o posting key or token"
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
402
|
function makeQueryClient() {
|
|
400
403
|
return new QueryClient({
|
|
401
404
|
defaultOptions: {
|
|
@@ -707,12 +710,14 @@ function parseAccounts(rawAccounts) {
|
|
|
707
710
|
// src/modules/accounts/queries/get-accounts-query-options.ts
|
|
708
711
|
function getAccountsQueryOptions(usernames) {
|
|
709
712
|
return queryOptions({
|
|
710
|
-
queryKey: ["accounts", "
|
|
713
|
+
queryKey: ["accounts", "list", ...usernames],
|
|
714
|
+
enabled: usernames.length > 0,
|
|
711
715
|
queryFn: async () => {
|
|
712
|
-
const response = await CONFIG.hiveClient.database.getAccounts(
|
|
716
|
+
const response = await CONFIG.hiveClient.database.getAccounts(
|
|
717
|
+
usernames
|
|
718
|
+
);
|
|
713
719
|
return parseAccounts(response);
|
|
714
|
-
}
|
|
715
|
-
enabled: usernames.length > 0
|
|
720
|
+
}
|
|
716
721
|
});
|
|
717
722
|
}
|
|
718
723
|
function getFollowCountQueryOptions(username) {
|
|
@@ -903,13 +908,13 @@ function getAccountSubscriptionsQueryOptions(username) {
|
|
|
903
908
|
}
|
|
904
909
|
});
|
|
905
910
|
}
|
|
906
|
-
function getActiveAccountBookmarksQueryOptions(activeUsername) {
|
|
911
|
+
function getActiveAccountBookmarksQueryOptions(activeUsername, code) {
|
|
907
912
|
return queryOptions({
|
|
908
913
|
queryKey: ["accounts", "bookmarks", activeUsername],
|
|
909
|
-
enabled: !!activeUsername,
|
|
914
|
+
enabled: !!activeUsername && !!code,
|
|
910
915
|
queryFn: async () => {
|
|
911
|
-
if (!activeUsername) {
|
|
912
|
-
throw new Error("[SDK][Accounts][Bookmarks] \u2013
|
|
916
|
+
if (!activeUsername || !code) {
|
|
917
|
+
throw new Error("[SDK][Accounts][Bookmarks] \u2013 missing auth");
|
|
913
918
|
}
|
|
914
919
|
const fetchApi = getBoundFetch();
|
|
915
920
|
const response = await fetchApi(
|
|
@@ -919,20 +924,20 @@ function getActiveAccountBookmarksQueryOptions(activeUsername) {
|
|
|
919
924
|
headers: {
|
|
920
925
|
"Content-Type": "application/json"
|
|
921
926
|
},
|
|
922
|
-
body: JSON.stringify({ code
|
|
927
|
+
body: JSON.stringify({ code })
|
|
923
928
|
}
|
|
924
929
|
);
|
|
925
930
|
return await response.json();
|
|
926
931
|
}
|
|
927
932
|
});
|
|
928
933
|
}
|
|
929
|
-
function getActiveAccountFavouritesQueryOptions(activeUsername) {
|
|
934
|
+
function getActiveAccountFavouritesQueryOptions(activeUsername, code) {
|
|
930
935
|
return queryOptions({
|
|
931
936
|
queryKey: ["accounts", "favourites", activeUsername],
|
|
932
|
-
enabled: !!activeUsername,
|
|
937
|
+
enabled: !!activeUsername && !!code,
|
|
933
938
|
queryFn: async () => {
|
|
934
|
-
if (!activeUsername) {
|
|
935
|
-
throw new Error("[SDK][Accounts][Favourites] \u2013
|
|
939
|
+
if (!activeUsername || !code) {
|
|
940
|
+
throw new Error("[SDK][Accounts][Favourites] \u2013 missing auth");
|
|
936
941
|
}
|
|
937
942
|
const fetchApi = getBoundFetch();
|
|
938
943
|
const response = await fetchApi(
|
|
@@ -942,18 +947,21 @@ function getActiveAccountFavouritesQueryOptions(activeUsername) {
|
|
|
942
947
|
headers: {
|
|
943
948
|
"Content-Type": "application/json"
|
|
944
949
|
},
|
|
945
|
-
body: JSON.stringify({ code
|
|
950
|
+
body: JSON.stringify({ code })
|
|
946
951
|
}
|
|
947
952
|
);
|
|
948
953
|
return await response.json();
|
|
949
954
|
}
|
|
950
955
|
});
|
|
951
956
|
}
|
|
952
|
-
function getAccountRecoveriesQueryOptions(username) {
|
|
957
|
+
function getAccountRecoveriesQueryOptions(username, code) {
|
|
953
958
|
return queryOptions({
|
|
954
|
-
enabled: !!username,
|
|
959
|
+
enabled: !!username && !!code,
|
|
955
960
|
queryKey: ["accounts", "recoveries", username],
|
|
956
961
|
queryFn: async () => {
|
|
962
|
+
if (!username || !code) {
|
|
963
|
+
throw new Error("[SDK][Accounts] Missing username or access token");
|
|
964
|
+
}
|
|
957
965
|
const fetchApi = getBoundFetch();
|
|
958
966
|
const response = await fetchApi(
|
|
959
967
|
CONFIG.privateApiHost + "/private-api/recoveries",
|
|
@@ -962,7 +970,7 @@ function getAccountRecoveriesQueryOptions(username) {
|
|
|
962
970
|
headers: {
|
|
963
971
|
"Content-Type": "application/json"
|
|
964
972
|
},
|
|
965
|
-
body: JSON.stringify({ code
|
|
973
|
+
body: JSON.stringify({ code })
|
|
966
974
|
}
|
|
967
975
|
);
|
|
968
976
|
return response.json();
|
|
@@ -980,6 +988,22 @@ function getAccountPendingRecoveryQueryOptions(username) {
|
|
|
980
988
|
)
|
|
981
989
|
});
|
|
982
990
|
}
|
|
991
|
+
function getAccountReputationsQueryOptions(query, limit = 50) {
|
|
992
|
+
return queryOptions({
|
|
993
|
+
queryKey: ["accounts", "reputations", query, limit],
|
|
994
|
+
enabled: !!query,
|
|
995
|
+
queryFn: async () => {
|
|
996
|
+
if (!query) {
|
|
997
|
+
return [];
|
|
998
|
+
}
|
|
999
|
+
return CONFIG.hiveClient.call(
|
|
1000
|
+
"condenser_api",
|
|
1001
|
+
"get_account_reputations",
|
|
1002
|
+
[query, limit]
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
983
1007
|
var ops = utils.operationOrders;
|
|
984
1008
|
var ACCOUNT_OPERATION_GROUPS = {
|
|
985
1009
|
transfers: [
|
|
@@ -1237,17 +1261,20 @@ function getTrendingTagsWithStatsQueryOptions(limit = 250) {
|
|
|
1237
1261
|
refetchOnMount: true
|
|
1238
1262
|
});
|
|
1239
1263
|
}
|
|
1240
|
-
function getFragmentsQueryOptions(username) {
|
|
1264
|
+
function getFragmentsQueryOptions(username, code) {
|
|
1241
1265
|
return queryOptions({
|
|
1242
1266
|
queryKey: ["posts", "fragments", username],
|
|
1243
1267
|
queryFn: async () => {
|
|
1268
|
+
if (!code) {
|
|
1269
|
+
return [];
|
|
1270
|
+
}
|
|
1244
1271
|
const fetchApi = getBoundFetch();
|
|
1245
1272
|
const response = await fetchApi(
|
|
1246
1273
|
CONFIG.privateApiHost + "/private-api/fragments",
|
|
1247
1274
|
{
|
|
1248
1275
|
method: "POST",
|
|
1249
1276
|
body: JSON.stringify({
|
|
1250
|
-
code
|
|
1277
|
+
code
|
|
1251
1278
|
}),
|
|
1252
1279
|
headers: {
|
|
1253
1280
|
"Content-Type": "application/json"
|
|
@@ -1256,7 +1283,7 @@ function getFragmentsQueryOptions(username) {
|
|
|
1256
1283
|
);
|
|
1257
1284
|
return response.json();
|
|
1258
1285
|
},
|
|
1259
|
-
enabled: !!username
|
|
1286
|
+
enabled: !!username && !!code
|
|
1260
1287
|
});
|
|
1261
1288
|
}
|
|
1262
1289
|
function getPromotedPostsQuery(type = "feed") {
|
|
@@ -1293,6 +1320,26 @@ function getEntryActiveVotesQueryOptions(entry) {
|
|
|
1293
1320
|
enabled: !!entry
|
|
1294
1321
|
});
|
|
1295
1322
|
}
|
|
1323
|
+
function getContentQueryOptions(author, permlink) {
|
|
1324
|
+
return queryOptions({
|
|
1325
|
+
queryKey: ["posts", "content", author, permlink],
|
|
1326
|
+
enabled: !!author && !!permlink,
|
|
1327
|
+
queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content", [
|
|
1328
|
+
author,
|
|
1329
|
+
permlink
|
|
1330
|
+
])
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
function getContentRepliesQueryOptions(author, permlink) {
|
|
1334
|
+
return queryOptions({
|
|
1335
|
+
queryKey: ["posts", "content-replies", author, permlink],
|
|
1336
|
+
enabled: !!author && !!permlink,
|
|
1337
|
+
queryFn: async () => CONFIG.hiveClient.call("condenser_api", "get_content_replies", {
|
|
1338
|
+
author,
|
|
1339
|
+
permlink
|
|
1340
|
+
})
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1296
1343
|
function getPostHeaderQueryOptions(author, permlink) {
|
|
1297
1344
|
return queryOptions({
|
|
1298
1345
|
queryKey: ["posts", "post-header", author, permlink],
|
|
@@ -1354,6 +1401,212 @@ function getPostQueryOptions(author, permlink, observer = "", num) {
|
|
|
1354
1401
|
enabled: !!author && !!permlink && permlink.trim() !== "" && permlink.trim() !== "undefined"
|
|
1355
1402
|
});
|
|
1356
1403
|
}
|
|
1404
|
+
|
|
1405
|
+
// src/modules/bridge/requests.ts
|
|
1406
|
+
function bridgeApiCall(endpoint, params) {
|
|
1407
|
+
return CONFIG.hiveClient.call("bridge", endpoint, params);
|
|
1408
|
+
}
|
|
1409
|
+
async function resolvePost(post, observer, num) {
|
|
1410
|
+
const { json_metadata: json } = post;
|
|
1411
|
+
if (json?.original_author && json?.original_permlink && json.tags?.[0] === "cross-post") {
|
|
1412
|
+
try {
|
|
1413
|
+
const resp = await getPost(
|
|
1414
|
+
json.original_author,
|
|
1415
|
+
json.original_permlink,
|
|
1416
|
+
observer,
|
|
1417
|
+
num
|
|
1418
|
+
);
|
|
1419
|
+
if (resp) {
|
|
1420
|
+
return {
|
|
1421
|
+
...post,
|
|
1422
|
+
original_entry: resp,
|
|
1423
|
+
num
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
return post;
|
|
1427
|
+
} catch {
|
|
1428
|
+
return post;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
return { ...post, num };
|
|
1432
|
+
}
|
|
1433
|
+
async function resolvePosts(posts, observer) {
|
|
1434
|
+
const validatedPosts = posts.map(validateEntry);
|
|
1435
|
+
const resolved = await Promise.all(validatedPosts.map((p) => resolvePost(p, observer)));
|
|
1436
|
+
return filterDmcaEntry(resolved);
|
|
1437
|
+
}
|
|
1438
|
+
async function getPostsRanked(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "") {
|
|
1439
|
+
const resp = await bridgeApiCall("get_ranked_posts", {
|
|
1440
|
+
sort,
|
|
1441
|
+
start_author,
|
|
1442
|
+
start_permlink,
|
|
1443
|
+
limit,
|
|
1444
|
+
tag,
|
|
1445
|
+
observer
|
|
1446
|
+
});
|
|
1447
|
+
if (resp) {
|
|
1448
|
+
return resolvePosts(resp, observer);
|
|
1449
|
+
}
|
|
1450
|
+
return resp;
|
|
1451
|
+
}
|
|
1452
|
+
async function getAccountPosts(sort, account, start_author = "", start_permlink = "", limit = 20, observer = "") {
|
|
1453
|
+
if (CONFIG.dmcaAccounts.includes(account)) {
|
|
1454
|
+
return [];
|
|
1455
|
+
}
|
|
1456
|
+
const resp = await bridgeApiCall("get_account_posts", {
|
|
1457
|
+
sort,
|
|
1458
|
+
account,
|
|
1459
|
+
start_author,
|
|
1460
|
+
start_permlink,
|
|
1461
|
+
limit,
|
|
1462
|
+
observer
|
|
1463
|
+
});
|
|
1464
|
+
if (resp) {
|
|
1465
|
+
return resolvePosts(resp, observer);
|
|
1466
|
+
}
|
|
1467
|
+
return resp;
|
|
1468
|
+
}
|
|
1469
|
+
function validateEntry(entry) {
|
|
1470
|
+
const newEntry = {
|
|
1471
|
+
...entry,
|
|
1472
|
+
active_votes: Array.isArray(entry.active_votes) ? [...entry.active_votes] : [],
|
|
1473
|
+
beneficiaries: Array.isArray(entry.beneficiaries) ? [...entry.beneficiaries] : [],
|
|
1474
|
+
blacklists: Array.isArray(entry.blacklists) ? [...entry.blacklists] : [],
|
|
1475
|
+
replies: Array.isArray(entry.replies) ? [...entry.replies] : [],
|
|
1476
|
+
stats: entry.stats ? { ...entry.stats } : null
|
|
1477
|
+
};
|
|
1478
|
+
const requiredStringProps = [
|
|
1479
|
+
"author",
|
|
1480
|
+
"title",
|
|
1481
|
+
"body",
|
|
1482
|
+
"created",
|
|
1483
|
+
"category",
|
|
1484
|
+
"permlink",
|
|
1485
|
+
"url",
|
|
1486
|
+
"updated"
|
|
1487
|
+
];
|
|
1488
|
+
for (const prop of requiredStringProps) {
|
|
1489
|
+
if (newEntry[prop] == null) {
|
|
1490
|
+
newEntry[prop] = "";
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
if (newEntry.author_reputation == null) {
|
|
1494
|
+
newEntry.author_reputation = 0;
|
|
1495
|
+
}
|
|
1496
|
+
if (newEntry.children == null) {
|
|
1497
|
+
newEntry.children = 0;
|
|
1498
|
+
}
|
|
1499
|
+
if (newEntry.depth == null) {
|
|
1500
|
+
newEntry.depth = 0;
|
|
1501
|
+
}
|
|
1502
|
+
if (newEntry.net_rshares == null) {
|
|
1503
|
+
newEntry.net_rshares = 0;
|
|
1504
|
+
}
|
|
1505
|
+
if (newEntry.payout == null) {
|
|
1506
|
+
newEntry.payout = 0;
|
|
1507
|
+
}
|
|
1508
|
+
if (newEntry.percent_hbd == null) {
|
|
1509
|
+
newEntry.percent_hbd = 0;
|
|
1510
|
+
}
|
|
1511
|
+
if (!newEntry.stats) {
|
|
1512
|
+
newEntry.stats = {
|
|
1513
|
+
flag_weight: 0,
|
|
1514
|
+
gray: false,
|
|
1515
|
+
hide: false,
|
|
1516
|
+
total_votes: 0
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
if (newEntry.author_payout_value == null) {
|
|
1520
|
+
newEntry.author_payout_value = "0.000 HBD";
|
|
1521
|
+
}
|
|
1522
|
+
if (newEntry.curator_payout_value == null) {
|
|
1523
|
+
newEntry.curator_payout_value = "0.000 HBD";
|
|
1524
|
+
}
|
|
1525
|
+
if (newEntry.max_accepted_payout == null) {
|
|
1526
|
+
newEntry.max_accepted_payout = "1000000.000 HBD";
|
|
1527
|
+
}
|
|
1528
|
+
if (newEntry.payout_at == null) {
|
|
1529
|
+
newEntry.payout_at = "";
|
|
1530
|
+
}
|
|
1531
|
+
if (newEntry.pending_payout_value == null) {
|
|
1532
|
+
newEntry.pending_payout_value = "0.000 HBD";
|
|
1533
|
+
}
|
|
1534
|
+
if (newEntry.promoted == null) {
|
|
1535
|
+
newEntry.promoted = "0.000 HBD";
|
|
1536
|
+
}
|
|
1537
|
+
if (newEntry.is_paidout == null) {
|
|
1538
|
+
newEntry.is_paidout = false;
|
|
1539
|
+
}
|
|
1540
|
+
return newEntry;
|
|
1541
|
+
}
|
|
1542
|
+
async function getPost(author = "", permlink = "", observer = "", num) {
|
|
1543
|
+
const resp = await bridgeApiCall("get_post", {
|
|
1544
|
+
author,
|
|
1545
|
+
permlink,
|
|
1546
|
+
observer
|
|
1547
|
+
});
|
|
1548
|
+
if (resp) {
|
|
1549
|
+
const validatedEntry = validateEntry(resp);
|
|
1550
|
+
const post = await resolvePost(validatedEntry, observer, num);
|
|
1551
|
+
return filterDmcaEntry(post);
|
|
1552
|
+
}
|
|
1553
|
+
return void 0;
|
|
1554
|
+
}
|
|
1555
|
+
async function getPostHeader(author = "", permlink = "") {
|
|
1556
|
+
const resp = await bridgeApiCall("get_post_header", {
|
|
1557
|
+
author,
|
|
1558
|
+
permlink
|
|
1559
|
+
});
|
|
1560
|
+
return resp ? validateEntry(resp) : resp;
|
|
1561
|
+
}
|
|
1562
|
+
async function getDiscussion(author, permlink, observer) {
|
|
1563
|
+
const resp = await bridgeApiCall("get_discussion", {
|
|
1564
|
+
author,
|
|
1565
|
+
permlink,
|
|
1566
|
+
observer: observer || author
|
|
1567
|
+
});
|
|
1568
|
+
if (resp) {
|
|
1569
|
+
const validatedResp = {};
|
|
1570
|
+
for (const [key, entry] of Object.entries(resp)) {
|
|
1571
|
+
validatedResp[key] = validateEntry(entry);
|
|
1572
|
+
}
|
|
1573
|
+
return validatedResp;
|
|
1574
|
+
}
|
|
1575
|
+
return resp;
|
|
1576
|
+
}
|
|
1577
|
+
async function getCommunity(name, observer = "") {
|
|
1578
|
+
return bridgeApiCall("get_community", { name, observer });
|
|
1579
|
+
}
|
|
1580
|
+
async function getCommunities(last = "", limit = 100, query, sort = "rank", observer = "") {
|
|
1581
|
+
return bridgeApiCall("list_communities", {
|
|
1582
|
+
last,
|
|
1583
|
+
limit,
|
|
1584
|
+
query,
|
|
1585
|
+
sort,
|
|
1586
|
+
observer
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
async function normalizePost(post) {
|
|
1590
|
+
const resp = await bridgeApiCall("normalize_post", { post });
|
|
1591
|
+
return resp ? validateEntry(resp) : resp;
|
|
1592
|
+
}
|
|
1593
|
+
async function getSubscriptions(account) {
|
|
1594
|
+
return bridgeApiCall("list_all_subscriptions", { account });
|
|
1595
|
+
}
|
|
1596
|
+
async function getSubscribers(community) {
|
|
1597
|
+
return bridgeApiCall("list_subscribers", { community });
|
|
1598
|
+
}
|
|
1599
|
+
async function getRelationshipBetweenAccounts(follower, following) {
|
|
1600
|
+
return bridgeApiCall("get_relationship_between_accounts", [
|
|
1601
|
+
follower,
|
|
1602
|
+
following
|
|
1603
|
+
]);
|
|
1604
|
+
}
|
|
1605
|
+
async function getProfiles(accounts, observer) {
|
|
1606
|
+
return bridgeApiCall("get_profiles", { accounts, observer });
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
// src/modules/posts/queries/get-discussions-query-options.ts
|
|
1357
1610
|
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
1358
1611
|
SortOrder2["trending"] = "trending";
|
|
1359
1612
|
SortOrder2["author_reputation"] = "author_reputation";
|
|
@@ -1451,6 +1704,13 @@ function getDiscussionsQueryOptions(entry, order = "created" /* created */, enab
|
|
|
1451
1704
|
select: (data) => sortDiscussions(entry, data, order)
|
|
1452
1705
|
});
|
|
1453
1706
|
}
|
|
1707
|
+
function getDiscussionQueryOptions(author, permlink, observer, enabled = true) {
|
|
1708
|
+
return queryOptions({
|
|
1709
|
+
queryKey: ["posts", "discussion", author, permlink, observer || author],
|
|
1710
|
+
enabled: enabled && !!author && !!permlink,
|
|
1711
|
+
queryFn: async () => getDiscussion(author, permlink, observer)
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1454
1714
|
function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit = 20, observer = "", enabled = true) {
|
|
1455
1715
|
return infiniteQueryOptions({
|
|
1456
1716
|
queryKey: ["posts", "account-posts", username ?? "", filter, limit, observer],
|
|
@@ -1500,6 +1760,35 @@ function getAccountPostsInfiniteQueryOptions(username, filter = "posts", limit =
|
|
|
1500
1760
|
}
|
|
1501
1761
|
});
|
|
1502
1762
|
}
|
|
1763
|
+
function getAccountPostsQueryOptions(username, filter = "posts", start_author = "", start_permlink = "", limit = 20, observer = "", enabled = true) {
|
|
1764
|
+
return queryOptions({
|
|
1765
|
+
queryKey: [
|
|
1766
|
+
"posts",
|
|
1767
|
+
"account-posts-page",
|
|
1768
|
+
username ?? "",
|
|
1769
|
+
filter,
|
|
1770
|
+
start_author,
|
|
1771
|
+
start_permlink,
|
|
1772
|
+
limit,
|
|
1773
|
+
observer
|
|
1774
|
+
],
|
|
1775
|
+
enabled: !!username && enabled,
|
|
1776
|
+
queryFn: async () => {
|
|
1777
|
+
if (!username) {
|
|
1778
|
+
return [];
|
|
1779
|
+
}
|
|
1780
|
+
const response = await getAccountPosts(
|
|
1781
|
+
filter,
|
|
1782
|
+
username,
|
|
1783
|
+
start_author,
|
|
1784
|
+
start_permlink,
|
|
1785
|
+
limit,
|
|
1786
|
+
observer
|
|
1787
|
+
);
|
|
1788
|
+
return filterDmcaEntry(response ?? []);
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1503
1792
|
function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = "", enabled = true, _options = {}) {
|
|
1504
1793
|
return infiniteQueryOptions({
|
|
1505
1794
|
queryKey: ["posts", "posts-ranked", sort, tag, limit, observer],
|
|
@@ -1547,6 +1836,36 @@ function getPostsRankedInfiniteQueryOptions(sort, tag, limit = 20, observer = ""
|
|
|
1547
1836
|
}
|
|
1548
1837
|
});
|
|
1549
1838
|
}
|
|
1839
|
+
function getPostsRankedQueryOptions(sort, start_author = "", start_permlink = "", limit = 20, tag = "", observer = "", enabled = true) {
|
|
1840
|
+
return queryOptions({
|
|
1841
|
+
queryKey: [
|
|
1842
|
+
"posts",
|
|
1843
|
+
"posts-ranked-page",
|
|
1844
|
+
sort,
|
|
1845
|
+
start_author,
|
|
1846
|
+
start_permlink,
|
|
1847
|
+
limit,
|
|
1848
|
+
tag,
|
|
1849
|
+
observer
|
|
1850
|
+
],
|
|
1851
|
+
enabled,
|
|
1852
|
+
queryFn: async () => {
|
|
1853
|
+
let sanitizedTag = tag;
|
|
1854
|
+
if (CONFIG.dmcaTagRegexes.some((regex) => regex.test(tag))) {
|
|
1855
|
+
sanitizedTag = "";
|
|
1856
|
+
}
|
|
1857
|
+
const response = await getPostsRanked(
|
|
1858
|
+
sort,
|
|
1859
|
+
start_author,
|
|
1860
|
+
start_permlink,
|
|
1861
|
+
limit,
|
|
1862
|
+
sanitizedTag,
|
|
1863
|
+
observer
|
|
1864
|
+
);
|
|
1865
|
+
return filterDmcaEntry(response ?? []);
|
|
1866
|
+
}
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1550
1869
|
function getReblogsQueryOptions(username, activeUsername, limit = 200) {
|
|
1551
1870
|
return queryOptions({
|
|
1552
1871
|
queryKey: ["posts", "reblogs", username ?? "", limit],
|
|
@@ -1563,20 +1882,21 @@ function getReblogsQueryOptions(username, activeUsername, limit = 200) {
|
|
|
1563
1882
|
enabled: !!username
|
|
1564
1883
|
});
|
|
1565
1884
|
}
|
|
1566
|
-
function getSchedulesQueryOptions(activeUsername) {
|
|
1885
|
+
function getSchedulesQueryOptions(activeUsername, code) {
|
|
1567
1886
|
return queryOptions({
|
|
1568
1887
|
queryKey: ["posts", "schedules", activeUsername],
|
|
1569
1888
|
queryFn: async () => {
|
|
1570
|
-
if (!activeUsername) {
|
|
1889
|
+
if (!activeUsername || !code) {
|
|
1571
1890
|
return [];
|
|
1572
1891
|
}
|
|
1573
|
-
const
|
|
1892
|
+
const fetchApi = getBoundFetch();
|
|
1893
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules", {
|
|
1574
1894
|
method: "POST",
|
|
1575
1895
|
headers: {
|
|
1576
1896
|
"Content-Type": "application/json"
|
|
1577
1897
|
},
|
|
1578
1898
|
body: JSON.stringify({
|
|
1579
|
-
code
|
|
1899
|
+
code
|
|
1580
1900
|
})
|
|
1581
1901
|
});
|
|
1582
1902
|
if (!response.ok) {
|
|
@@ -1584,23 +1904,24 @@ function getSchedulesQueryOptions(activeUsername) {
|
|
|
1584
1904
|
}
|
|
1585
1905
|
return response.json();
|
|
1586
1906
|
},
|
|
1587
|
-
enabled: !!activeUsername
|
|
1907
|
+
enabled: !!activeUsername && !!code
|
|
1588
1908
|
});
|
|
1589
1909
|
}
|
|
1590
|
-
function getDraftsQueryOptions(activeUsername) {
|
|
1910
|
+
function getDraftsQueryOptions(activeUsername, code) {
|
|
1591
1911
|
return queryOptions({
|
|
1592
1912
|
queryKey: ["posts", "drafts", activeUsername],
|
|
1593
1913
|
queryFn: async () => {
|
|
1594
|
-
if (!activeUsername) {
|
|
1914
|
+
if (!activeUsername || !code) {
|
|
1595
1915
|
return [];
|
|
1596
1916
|
}
|
|
1597
|
-
const
|
|
1917
|
+
const fetchApi = getBoundFetch();
|
|
1918
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts", {
|
|
1598
1919
|
method: "POST",
|
|
1599
1920
|
headers: {
|
|
1600
1921
|
"Content-Type": "application/json"
|
|
1601
1922
|
},
|
|
1602
1923
|
body: JSON.stringify({
|
|
1603
|
-
code
|
|
1924
|
+
code
|
|
1604
1925
|
})
|
|
1605
1926
|
});
|
|
1606
1927
|
if (!response.ok) {
|
|
@@ -1608,17 +1929,18 @@ function getDraftsQueryOptions(activeUsername) {
|
|
|
1608
1929
|
}
|
|
1609
1930
|
return response.json();
|
|
1610
1931
|
},
|
|
1611
|
-
enabled: !!activeUsername
|
|
1932
|
+
enabled: !!activeUsername && !!code
|
|
1612
1933
|
});
|
|
1613
1934
|
}
|
|
1614
|
-
async function fetchUserImages(
|
|
1615
|
-
const
|
|
1935
|
+
async function fetchUserImages(code) {
|
|
1936
|
+
const fetchApi = getBoundFetch();
|
|
1937
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images", {
|
|
1616
1938
|
method: "POST",
|
|
1617
1939
|
headers: {
|
|
1618
1940
|
"Content-Type": "application/json"
|
|
1619
1941
|
},
|
|
1620
1942
|
body: JSON.stringify({
|
|
1621
|
-
code
|
|
1943
|
+
code
|
|
1622
1944
|
})
|
|
1623
1945
|
});
|
|
1624
1946
|
if (!response.ok) {
|
|
@@ -1626,28 +1948,28 @@ async function fetchUserImages(username) {
|
|
|
1626
1948
|
}
|
|
1627
1949
|
return response.json();
|
|
1628
1950
|
}
|
|
1629
|
-
function getImagesQueryOptions(username) {
|
|
1951
|
+
function getImagesQueryOptions(username, code) {
|
|
1630
1952
|
return queryOptions({
|
|
1631
1953
|
queryKey: ["posts", "images", username],
|
|
1632
1954
|
queryFn: async () => {
|
|
1633
|
-
if (!username) {
|
|
1955
|
+
if (!username || !code) {
|
|
1634
1956
|
return [];
|
|
1635
1957
|
}
|
|
1636
|
-
return fetchUserImages(
|
|
1958
|
+
return fetchUserImages(code);
|
|
1637
1959
|
},
|
|
1638
|
-
enabled: !!username
|
|
1960
|
+
enabled: !!username && !!code
|
|
1639
1961
|
});
|
|
1640
1962
|
}
|
|
1641
|
-
function getGalleryImagesQueryOptions(activeUsername) {
|
|
1963
|
+
function getGalleryImagesQueryOptions(activeUsername, code) {
|
|
1642
1964
|
return queryOptions({
|
|
1643
1965
|
queryKey: ["posts", "gallery-images", activeUsername],
|
|
1644
1966
|
queryFn: async () => {
|
|
1645
|
-
if (!activeUsername) {
|
|
1967
|
+
if (!activeUsername || !code) {
|
|
1646
1968
|
return [];
|
|
1647
1969
|
}
|
|
1648
|
-
return fetchUserImages(
|
|
1970
|
+
return fetchUserImages(code);
|
|
1649
1971
|
},
|
|
1650
|
-
enabled: !!activeUsername
|
|
1972
|
+
enabled: !!activeUsername && !!code
|
|
1651
1973
|
});
|
|
1652
1974
|
}
|
|
1653
1975
|
function getCommentHistoryQueryOptions(author, permlink, onlyMeta = false) {
|
|
@@ -1781,8 +2103,8 @@ function toEntryArray(x) {
|
|
|
1781
2103
|
return Array.isArray(x) ? x : [];
|
|
1782
2104
|
}
|
|
1783
2105
|
async function getVisibleFirstLevelThreadItems(container) {
|
|
1784
|
-
const
|
|
1785
|
-
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(
|
|
2106
|
+
const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
|
|
2107
|
+
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
|
|
1786
2108
|
const discussionItems = toEntryArray(discussionItemsRaw);
|
|
1787
2109
|
if (discussionItems.length <= 1) {
|
|
1788
2110
|
return [];
|
|
@@ -1991,6 +2313,18 @@ function getWavesTrendingTagsQueryOptions(host, hours = 24) {
|
|
|
1991
2313
|
}
|
|
1992
2314
|
});
|
|
1993
2315
|
}
|
|
2316
|
+
function getNormalizePostQueryOptions(post, enabled = true) {
|
|
2317
|
+
return queryOptions({
|
|
2318
|
+
queryKey: [
|
|
2319
|
+
"posts",
|
|
2320
|
+
"normalize",
|
|
2321
|
+
post?.author ?? "",
|
|
2322
|
+
post?.permlink ?? ""
|
|
2323
|
+
],
|
|
2324
|
+
enabled: enabled && !!post,
|
|
2325
|
+
queryFn: async () => normalizePost(post)
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
1994
2328
|
|
|
1995
2329
|
// src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts
|
|
1996
2330
|
function isEntry(x) {
|
|
@@ -2041,14 +2375,22 @@ function getAccountVoteHistoryInfiniteQueryOptions(username, options) {
|
|
|
2041
2375
|
})
|
|
2042
2376
|
});
|
|
2043
2377
|
}
|
|
2378
|
+
function getProfilesQueryOptions(accounts, observer, enabled = true) {
|
|
2379
|
+
return queryOptions({
|
|
2380
|
+
queryKey: ["accounts", "profiles", accounts, observer ?? ""],
|
|
2381
|
+
enabled: enabled && accounts.length > 0,
|
|
2382
|
+
queryFn: async () => getProfiles(accounts, observer)
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2044
2385
|
|
|
2045
2386
|
// src/modules/accounts/mutations/use-account-update.ts
|
|
2046
|
-
function useAccountUpdate(username) {
|
|
2387
|
+
function useAccountUpdate(username, accessToken, auth) {
|
|
2047
2388
|
const queryClient = useQueryClient();
|
|
2048
2389
|
const { data } = useQuery(getAccountFullQueryOptions(username));
|
|
2049
2390
|
return useBroadcastMutation(
|
|
2050
2391
|
["accounts", "update"],
|
|
2051
2392
|
username,
|
|
2393
|
+
accessToken,
|
|
2052
2394
|
(payload) => {
|
|
2053
2395
|
if (!data) {
|
|
2054
2396
|
throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
|
|
@@ -2072,7 +2414,7 @@ function useAccountUpdate(username) {
|
|
|
2072
2414
|
]
|
|
2073
2415
|
];
|
|
2074
2416
|
},
|
|
2075
|
-
(
|
|
2417
|
+
(_data, variables) => queryClient.setQueryData(
|
|
2076
2418
|
getAccountFullQueryOptions(username).queryKey,
|
|
2077
2419
|
(data2) => {
|
|
2078
2420
|
if (!data2) {
|
|
@@ -2086,7 +2428,8 @@ function useAccountUpdate(username) {
|
|
|
2086
2428
|
});
|
|
2087
2429
|
return obj;
|
|
2088
2430
|
}
|
|
2089
|
-
)
|
|
2431
|
+
),
|
|
2432
|
+
auth
|
|
2090
2433
|
);
|
|
2091
2434
|
}
|
|
2092
2435
|
function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
|
|
@@ -2128,12 +2471,12 @@ function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
|
|
|
2128
2471
|
}
|
|
2129
2472
|
});
|
|
2130
2473
|
}
|
|
2131
|
-
function useBookmarkAdd(username, onSuccess, onError) {
|
|
2474
|
+
function useBookmarkAdd(username, code, onSuccess, onError) {
|
|
2132
2475
|
return useMutation({
|
|
2133
2476
|
mutationKey: ["accounts", "bookmarks", "add", username],
|
|
2134
2477
|
mutationFn: async ({ author, permlink }) => {
|
|
2135
|
-
if (!username) {
|
|
2136
|
-
throw new Error("[SDK][Account][Bookmarks] \u2013
|
|
2478
|
+
if (!username || !code) {
|
|
2479
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
2137
2480
|
}
|
|
2138
2481
|
const fetchApi = getBoundFetch();
|
|
2139
2482
|
const response = await fetchApi(
|
|
@@ -2146,7 +2489,7 @@ function useBookmarkAdd(username, onSuccess, onError) {
|
|
|
2146
2489
|
body: JSON.stringify({
|
|
2147
2490
|
author,
|
|
2148
2491
|
permlink,
|
|
2149
|
-
code
|
|
2492
|
+
code
|
|
2150
2493
|
})
|
|
2151
2494
|
}
|
|
2152
2495
|
);
|
|
@@ -2161,12 +2504,12 @@ function useBookmarkAdd(username, onSuccess, onError) {
|
|
|
2161
2504
|
onError
|
|
2162
2505
|
});
|
|
2163
2506
|
}
|
|
2164
|
-
function useBookmarkDelete(username, onSuccess, onError) {
|
|
2507
|
+
function useBookmarkDelete(username, code, onSuccess, onError) {
|
|
2165
2508
|
return useMutation({
|
|
2166
2509
|
mutationKey: ["accounts", "bookmarks", "delete", username],
|
|
2167
2510
|
mutationFn: async (bookmarkId) => {
|
|
2168
|
-
if (!username) {
|
|
2169
|
-
throw new Error("[SDK][Account][Bookmarks] \u2013
|
|
2511
|
+
if (!username || !code) {
|
|
2512
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
2170
2513
|
}
|
|
2171
2514
|
const fetchApi = getBoundFetch();
|
|
2172
2515
|
const response = await fetchApi(
|
|
@@ -2178,7 +2521,7 @@ function useBookmarkDelete(username, onSuccess, onError) {
|
|
|
2178
2521
|
},
|
|
2179
2522
|
body: JSON.stringify({
|
|
2180
2523
|
id: bookmarkId,
|
|
2181
|
-
code
|
|
2524
|
+
code
|
|
2182
2525
|
})
|
|
2183
2526
|
}
|
|
2184
2527
|
);
|
|
@@ -2193,12 +2536,12 @@ function useBookmarkDelete(username, onSuccess, onError) {
|
|
|
2193
2536
|
onError
|
|
2194
2537
|
});
|
|
2195
2538
|
}
|
|
2196
|
-
function useAccountFavouriteAdd(username, onSuccess, onError) {
|
|
2539
|
+
function useAccountFavouriteAdd(username, code, onSuccess, onError) {
|
|
2197
2540
|
return useMutation({
|
|
2198
2541
|
mutationKey: ["accounts", "favourites", "add", username],
|
|
2199
2542
|
mutationFn: async (account) => {
|
|
2200
|
-
if (!username) {
|
|
2201
|
-
throw new Error("[SDK][Account][Bookmarks] \u2013
|
|
2543
|
+
if (!username || !code) {
|
|
2544
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
2202
2545
|
}
|
|
2203
2546
|
const fetchApi = getBoundFetch();
|
|
2204
2547
|
const response = await fetchApi(
|
|
@@ -2210,7 +2553,7 @@ function useAccountFavouriteAdd(username, onSuccess, onError) {
|
|
|
2210
2553
|
},
|
|
2211
2554
|
body: JSON.stringify({
|
|
2212
2555
|
account,
|
|
2213
|
-
code
|
|
2556
|
+
code
|
|
2214
2557
|
})
|
|
2215
2558
|
}
|
|
2216
2559
|
);
|
|
@@ -2225,12 +2568,12 @@ function useAccountFavouriteAdd(username, onSuccess, onError) {
|
|
|
2225
2568
|
onError
|
|
2226
2569
|
});
|
|
2227
2570
|
}
|
|
2228
|
-
function useAccountFavouriteDelete(username, onSuccess, onError) {
|
|
2571
|
+
function useAccountFavouriteDelete(username, code, onSuccess, onError) {
|
|
2229
2572
|
return useMutation({
|
|
2230
2573
|
mutationKey: ["accounts", "favourites", "add", username],
|
|
2231
2574
|
mutationFn: async (account) => {
|
|
2232
|
-
if (!username) {
|
|
2233
|
-
throw new Error("[SDK][Account][Bookmarks] \u2013
|
|
2575
|
+
if (!username || !code) {
|
|
2576
|
+
throw new Error("[SDK][Account][Bookmarks] \u2013 missing auth");
|
|
2234
2577
|
}
|
|
2235
2578
|
const fetchApi = getBoundFetch();
|
|
2236
2579
|
const response = await fetchApi(
|
|
@@ -2242,7 +2585,7 @@ function useAccountFavouriteDelete(username, onSuccess, onError) {
|
|
|
2242
2585
|
},
|
|
2243
2586
|
body: JSON.stringify({
|
|
2244
2587
|
account,
|
|
2245
|
-
code
|
|
2588
|
+
code
|
|
2246
2589
|
})
|
|
2247
2590
|
}
|
|
2248
2591
|
);
|
|
@@ -2400,7 +2743,7 @@ function useAccountRevokePosting(username, options) {
|
|
|
2400
2743
|
}
|
|
2401
2744
|
});
|
|
2402
2745
|
}
|
|
2403
|
-
function useAccountUpdateRecovery(username, options) {
|
|
2746
|
+
function useAccountUpdateRecovery(username, code, options) {
|
|
2404
2747
|
const { data } = useQuery(getAccountFullQueryOptions(username));
|
|
2405
2748
|
return useMutation({
|
|
2406
2749
|
mutationKey: ["accounts", "recovery", data?.name],
|
|
@@ -2416,11 +2759,14 @@ function useAccountUpdateRecovery(username, options) {
|
|
|
2416
2759
|
extensions: []
|
|
2417
2760
|
};
|
|
2418
2761
|
if (type === "ecency") {
|
|
2762
|
+
if (!code) {
|
|
2763
|
+
throw new Error("[SDK][Accounts] \u2013 missing access token");
|
|
2764
|
+
}
|
|
2419
2765
|
const fetchApi = getBoundFetch();
|
|
2420
2766
|
return fetchApi(CONFIG.privateApiHost + "/private-api/recoveries-add", {
|
|
2421
2767
|
method: "POST",
|
|
2422
2768
|
body: JSON.stringify({
|
|
2423
|
-
code
|
|
2769
|
+
code,
|
|
2424
2770
|
email,
|
|
2425
2771
|
publicKeys: [
|
|
2426
2772
|
...data.owner.key_auths,
|
|
@@ -2489,6 +2835,152 @@ function useAccountRevokeKey(username, options) {
|
|
|
2489
2835
|
...options
|
|
2490
2836
|
});
|
|
2491
2837
|
}
|
|
2838
|
+
|
|
2839
|
+
// src/modules/accounts/utils/account-power.ts
|
|
2840
|
+
var HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24;
|
|
2841
|
+
function vestsToRshares(vests, votingPowerValue, votePerc) {
|
|
2842
|
+
const vestingShares = vests * 1e6;
|
|
2843
|
+
const power = votingPowerValue * votePerc / 1e4 / 50 + 1;
|
|
2844
|
+
return power * vestingShares / 1e4;
|
|
2845
|
+
}
|
|
2846
|
+
function toDhiveAccountForVotingMana(account) {
|
|
2847
|
+
return {
|
|
2848
|
+
id: 0,
|
|
2849
|
+
name: account.name,
|
|
2850
|
+
owner: account.owner,
|
|
2851
|
+
active: account.active,
|
|
2852
|
+
posting: account.posting,
|
|
2853
|
+
memo_key: account.memo_key,
|
|
2854
|
+
json_metadata: account.json_metadata,
|
|
2855
|
+
posting_json_metadata: account.posting_json_metadata,
|
|
2856
|
+
proxy: account.proxy ?? "",
|
|
2857
|
+
last_owner_update: "",
|
|
2858
|
+
last_account_update: "",
|
|
2859
|
+
created: account.created,
|
|
2860
|
+
mined: false,
|
|
2861
|
+
owner_challenged: false,
|
|
2862
|
+
active_challenged: false,
|
|
2863
|
+
last_owner_proved: "",
|
|
2864
|
+
last_active_proved: "",
|
|
2865
|
+
recovery_account: account.recovery_account ?? "",
|
|
2866
|
+
reset_account: "",
|
|
2867
|
+
last_account_recovery: "",
|
|
2868
|
+
comment_count: 0,
|
|
2869
|
+
lifetime_vote_count: 0,
|
|
2870
|
+
post_count: account.post_count,
|
|
2871
|
+
can_vote: true,
|
|
2872
|
+
voting_power: account.voting_power,
|
|
2873
|
+
last_vote_time: account.last_vote_time,
|
|
2874
|
+
voting_manabar: account.voting_manabar,
|
|
2875
|
+
balance: account.balance,
|
|
2876
|
+
savings_balance: account.savings_balance,
|
|
2877
|
+
hbd_balance: account.hbd_balance,
|
|
2878
|
+
hbd_seconds: "0",
|
|
2879
|
+
hbd_seconds_last_update: "",
|
|
2880
|
+
hbd_last_interest_payment: "",
|
|
2881
|
+
savings_hbd_balance: account.savings_hbd_balance,
|
|
2882
|
+
savings_hbd_seconds: account.savings_hbd_seconds,
|
|
2883
|
+
savings_hbd_seconds_last_update: account.savings_hbd_seconds_last_update,
|
|
2884
|
+
savings_hbd_last_interest_payment: account.savings_hbd_last_interest_payment,
|
|
2885
|
+
savings_withdraw_requests: 0,
|
|
2886
|
+
reward_hbd_balance: account.reward_hbd_balance,
|
|
2887
|
+
reward_hive_balance: account.reward_hive_balance,
|
|
2888
|
+
reward_vesting_balance: account.reward_vesting_balance,
|
|
2889
|
+
reward_vesting_hive: account.reward_vesting_hive,
|
|
2890
|
+
curation_rewards: 0,
|
|
2891
|
+
posting_rewards: 0,
|
|
2892
|
+
vesting_shares: account.vesting_shares,
|
|
2893
|
+
delegated_vesting_shares: account.delegated_vesting_shares,
|
|
2894
|
+
received_vesting_shares: account.received_vesting_shares,
|
|
2895
|
+
vesting_withdraw_rate: account.vesting_withdraw_rate,
|
|
2896
|
+
next_vesting_withdrawal: account.next_vesting_withdrawal,
|
|
2897
|
+
withdrawn: account.withdrawn,
|
|
2898
|
+
to_withdraw: account.to_withdraw,
|
|
2899
|
+
withdraw_routes: 0,
|
|
2900
|
+
proxied_vsf_votes: account.proxied_vsf_votes ?? [],
|
|
2901
|
+
witnesses_voted_for: 0,
|
|
2902
|
+
average_bandwidth: 0,
|
|
2903
|
+
lifetime_bandwidth: 0,
|
|
2904
|
+
last_bandwidth_update: "",
|
|
2905
|
+
average_market_bandwidth: 0,
|
|
2906
|
+
lifetime_market_bandwidth: 0,
|
|
2907
|
+
last_market_bandwidth_update: "",
|
|
2908
|
+
last_post: account.last_post,
|
|
2909
|
+
last_root_post: ""
|
|
2910
|
+
};
|
|
2911
|
+
}
|
|
2912
|
+
function votingPower(account) {
|
|
2913
|
+
const calc = CONFIG.hiveClient.rc.calculateVPMana(
|
|
2914
|
+
toDhiveAccountForVotingMana(account)
|
|
2915
|
+
);
|
|
2916
|
+
return calc.percentage / 100;
|
|
2917
|
+
}
|
|
2918
|
+
function powerRechargeTime(power) {
|
|
2919
|
+
if (!Number.isFinite(power)) {
|
|
2920
|
+
throw new TypeError("Voting power must be a finite number");
|
|
2921
|
+
}
|
|
2922
|
+
if (power < 0 || power > 100) {
|
|
2923
|
+
throw new RangeError("Voting power must be between 0 and 100");
|
|
2924
|
+
}
|
|
2925
|
+
const missingPower = 100 - power;
|
|
2926
|
+
return missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS / 1e4;
|
|
2927
|
+
}
|
|
2928
|
+
function downVotingPower(account) {
|
|
2929
|
+
const totalShares = parseFloat(account.vesting_shares) + parseFloat(account.received_vesting_shares) - parseFloat(account.delegated_vesting_shares);
|
|
2930
|
+
const elapsed = Math.floor(Date.now() / 1e3) - account.downvote_manabar.last_update_time;
|
|
2931
|
+
const maxMana = totalShares * 1e6 / 4;
|
|
2932
|
+
if (maxMana <= 0) {
|
|
2933
|
+
return 0;
|
|
2934
|
+
}
|
|
2935
|
+
let currentMana = parseFloat(account.downvote_manabar.current_mana.toString()) + elapsed * maxMana / HIVE_VOTING_MANA_REGENERATION_SECONDS;
|
|
2936
|
+
if (currentMana > maxMana) {
|
|
2937
|
+
currentMana = maxMana;
|
|
2938
|
+
}
|
|
2939
|
+
const currentManaPerc = currentMana * 100 / maxMana;
|
|
2940
|
+
if (isNaN(currentManaPerc)) {
|
|
2941
|
+
return 0;
|
|
2942
|
+
}
|
|
2943
|
+
if (currentManaPerc > 100) {
|
|
2944
|
+
return 100;
|
|
2945
|
+
}
|
|
2946
|
+
return currentManaPerc;
|
|
2947
|
+
}
|
|
2948
|
+
function rcPower(account) {
|
|
2949
|
+
const calc = CONFIG.hiveClient.rc.calculateRCMana(account);
|
|
2950
|
+
return calc.percentage / 100;
|
|
2951
|
+
}
|
|
2952
|
+
function votingValue(account, dynamicProps, votingPowerValue, weight = 1e4) {
|
|
2953
|
+
if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {
|
|
2954
|
+
return 0;
|
|
2955
|
+
}
|
|
2956
|
+
const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;
|
|
2957
|
+
if (!Number.isFinite(fundRecentClaims) || !Number.isFinite(fundRewardBalance) || !Number.isFinite(base) || !Number.isFinite(quote)) {
|
|
2958
|
+
return 0;
|
|
2959
|
+
}
|
|
2960
|
+
if (fundRecentClaims === 0 || quote === 0) {
|
|
2961
|
+
return 0;
|
|
2962
|
+
}
|
|
2963
|
+
let totalVests = 0;
|
|
2964
|
+
try {
|
|
2965
|
+
const vesting = parseAsset(account.vesting_shares).amount;
|
|
2966
|
+
const received = parseAsset(account.received_vesting_shares).amount;
|
|
2967
|
+
const delegated = parseAsset(account.delegated_vesting_shares).amount;
|
|
2968
|
+
if (![vesting, received, delegated].every(Number.isFinite)) {
|
|
2969
|
+
return 0;
|
|
2970
|
+
}
|
|
2971
|
+
totalVests = vesting + received - delegated;
|
|
2972
|
+
} catch {
|
|
2973
|
+
return 0;
|
|
2974
|
+
}
|
|
2975
|
+
if (!Number.isFinite(totalVests)) {
|
|
2976
|
+
return 0;
|
|
2977
|
+
}
|
|
2978
|
+
const rShares = vestsToRshares(totalVests, votingPowerValue, weight);
|
|
2979
|
+
if (!Number.isFinite(rShares)) {
|
|
2980
|
+
return 0;
|
|
2981
|
+
}
|
|
2982
|
+
return rShares / fundRecentClaims * fundRewardBalance * (base / quote);
|
|
2983
|
+
}
|
|
2492
2984
|
function useSignOperationByKey(username) {
|
|
2493
2985
|
return useMutation({
|
|
2494
2986
|
mutationKey: ["operations", "sign", username],
|
|
@@ -2544,17 +3036,20 @@ function getChainPropertiesQueryOptions() {
|
|
|
2544
3036
|
}
|
|
2545
3037
|
});
|
|
2546
3038
|
}
|
|
2547
|
-
function useAddFragment(username) {
|
|
3039
|
+
function useAddFragment(username, code) {
|
|
2548
3040
|
return useMutation({
|
|
2549
3041
|
mutationKey: ["posts", "add-fragment", username],
|
|
2550
3042
|
mutationFn: async ({ title, body }) => {
|
|
3043
|
+
if (!code) {
|
|
3044
|
+
throw new Error("[SDK][Posts] Missing access token");
|
|
3045
|
+
}
|
|
2551
3046
|
const fetchApi = getBoundFetch();
|
|
2552
3047
|
const response = await fetchApi(
|
|
2553
3048
|
CONFIG.privateApiHost + "/private-api/fragments-add",
|
|
2554
3049
|
{
|
|
2555
3050
|
method: "POST",
|
|
2556
3051
|
body: JSON.stringify({
|
|
2557
|
-
code
|
|
3052
|
+
code,
|
|
2558
3053
|
title,
|
|
2559
3054
|
body
|
|
2560
3055
|
}),
|
|
@@ -2567,23 +3062,26 @@ function useAddFragment(username) {
|
|
|
2567
3062
|
},
|
|
2568
3063
|
onSuccess(response) {
|
|
2569
3064
|
getQueryClient().setQueryData(
|
|
2570
|
-
getFragmentsQueryOptions(username).queryKey,
|
|
3065
|
+
getFragmentsQueryOptions(username, code).queryKey,
|
|
2571
3066
|
(data) => [response, ...data ?? []]
|
|
2572
3067
|
);
|
|
2573
3068
|
}
|
|
2574
3069
|
});
|
|
2575
3070
|
}
|
|
2576
|
-
function useEditFragment(username, fragmentId) {
|
|
3071
|
+
function useEditFragment(username, fragmentId, code) {
|
|
2577
3072
|
return useMutation({
|
|
2578
3073
|
mutationKey: ["posts", "edit-fragment", username, fragmentId],
|
|
2579
3074
|
mutationFn: async ({ title, body }) => {
|
|
3075
|
+
if (!code) {
|
|
3076
|
+
throw new Error("[SDK][Posts] Missing access token");
|
|
3077
|
+
}
|
|
2580
3078
|
const fetchApi = getBoundFetch();
|
|
2581
3079
|
const response = await fetchApi(
|
|
2582
3080
|
CONFIG.privateApiHost + "/private-api/fragments-update",
|
|
2583
3081
|
{
|
|
2584
3082
|
method: "POST",
|
|
2585
3083
|
body: JSON.stringify({
|
|
2586
|
-
code
|
|
3084
|
+
code,
|
|
2587
3085
|
id: fragmentId,
|
|
2588
3086
|
title,
|
|
2589
3087
|
body
|
|
@@ -2597,7 +3095,7 @@ function useEditFragment(username, fragmentId) {
|
|
|
2597
3095
|
},
|
|
2598
3096
|
onSuccess(response) {
|
|
2599
3097
|
getQueryClient().setQueryData(
|
|
2600
|
-
getFragmentsQueryOptions(username).queryKey,
|
|
3098
|
+
getFragmentsQueryOptions(username, code).queryKey,
|
|
2601
3099
|
(data) => {
|
|
2602
3100
|
if (!data) {
|
|
2603
3101
|
return [];
|
|
@@ -2612,15 +3110,18 @@ function useEditFragment(username, fragmentId) {
|
|
|
2612
3110
|
}
|
|
2613
3111
|
});
|
|
2614
3112
|
}
|
|
2615
|
-
function useRemoveFragment(username, fragmentId) {
|
|
3113
|
+
function useRemoveFragment(username, fragmentId, code) {
|
|
2616
3114
|
return useMutation({
|
|
2617
3115
|
mutationKey: ["posts", "remove-fragment", username],
|
|
2618
3116
|
mutationFn: async () => {
|
|
3117
|
+
if (!code) {
|
|
3118
|
+
throw new Error("[SDK][Posts] Missing access token");
|
|
3119
|
+
}
|
|
2619
3120
|
const fetchApi = getBoundFetch();
|
|
2620
3121
|
return fetchApi(CONFIG.privateApiHost + "/private-api/fragments-delete", {
|
|
2621
3122
|
method: "POST",
|
|
2622
3123
|
body: JSON.stringify({
|
|
2623
|
-
code
|
|
3124
|
+
code,
|
|
2624
3125
|
id: fragmentId
|
|
2625
3126
|
}),
|
|
2626
3127
|
headers: {
|
|
@@ -2630,13 +3131,40 @@ function useRemoveFragment(username, fragmentId) {
|
|
|
2630
3131
|
},
|
|
2631
3132
|
onSuccess() {
|
|
2632
3133
|
getQueryClient().setQueryData(
|
|
2633
|
-
getFragmentsQueryOptions(username).queryKey,
|
|
3134
|
+
getFragmentsQueryOptions(username, code).queryKey,
|
|
2634
3135
|
(data) => [...data ?? []].filter(({ id }) => id !== fragmentId)
|
|
2635
3136
|
);
|
|
2636
3137
|
}
|
|
2637
3138
|
});
|
|
2638
3139
|
}
|
|
2639
3140
|
|
|
3141
|
+
// src/modules/posts/utils/validate-post-creating.ts
|
|
3142
|
+
var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
|
|
3143
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3144
|
+
async function getContent(author, permlink) {
|
|
3145
|
+
return CONFIG.hiveClient.call("condenser_api", "get_content", [
|
|
3146
|
+
author,
|
|
3147
|
+
permlink
|
|
3148
|
+
]);
|
|
3149
|
+
}
|
|
3150
|
+
async function validatePostCreating(author, permlink, attempts = 0, options) {
|
|
3151
|
+
const delays = options?.delays ?? DEFAULT_VALIDATE_POST_DELAYS;
|
|
3152
|
+
let response;
|
|
3153
|
+
try {
|
|
3154
|
+
response = await getContent(author, permlink);
|
|
3155
|
+
} catch (e) {
|
|
3156
|
+
response = void 0;
|
|
3157
|
+
}
|
|
3158
|
+
if (response || attempts >= delays.length) {
|
|
3159
|
+
return;
|
|
3160
|
+
}
|
|
3161
|
+
const waitMs = delays[attempts];
|
|
3162
|
+
if (waitMs > 0) {
|
|
3163
|
+
await delay(waitMs);
|
|
3164
|
+
}
|
|
3165
|
+
return validatePostCreating(author, permlink, attempts + 1, options);
|
|
3166
|
+
}
|
|
3167
|
+
|
|
2640
3168
|
// src/modules/analytics/mutations/index.ts
|
|
2641
3169
|
var mutations_exports = {};
|
|
2642
3170
|
__export(mutations_exports, {
|
|
@@ -2749,11 +3277,10 @@ var queries_exports = {};
|
|
|
2749
3277
|
__export(queries_exports, {
|
|
2750
3278
|
getDecodeMemoQueryOptions: () => getDecodeMemoQueryOptions
|
|
2751
3279
|
});
|
|
2752
|
-
function getDecodeMemoQueryOptions(username, memo) {
|
|
3280
|
+
function getDecodeMemoQueryOptions(username, memo, accessToken) {
|
|
2753
3281
|
return queryOptions({
|
|
2754
3282
|
queryKey: ["integrations", "hivesigner", "decode-memo", username],
|
|
2755
3283
|
queryFn: async () => {
|
|
2756
|
-
const accessToken = getAccessToken(username);
|
|
2757
3284
|
if (accessToken) {
|
|
2758
3285
|
const hsClient = new hs.Client({
|
|
2759
3286
|
accessToken
|
|
@@ -2770,12 +3297,12 @@ var HiveSignerIntegration = {
|
|
|
2770
3297
|
};
|
|
2771
3298
|
|
|
2772
3299
|
// src/modules/integrations/3speak/queries/get-account-token-query-options.ts
|
|
2773
|
-
function getAccountTokenQueryOptions(username) {
|
|
3300
|
+
function getAccountTokenQueryOptions(username, accessToken) {
|
|
2774
3301
|
return queryOptions({
|
|
2775
3302
|
queryKey: ["integrations", "3speak", "authenticate", username],
|
|
2776
|
-
enabled: !!username,
|
|
3303
|
+
enabled: !!username && !!accessToken,
|
|
2777
3304
|
queryFn: async () => {
|
|
2778
|
-
if (!username) {
|
|
3305
|
+
if (!username || !accessToken) {
|
|
2779
3306
|
throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
|
|
2780
3307
|
}
|
|
2781
3308
|
const fetchApi = getBoundFetch();
|
|
@@ -2789,7 +3316,8 @@ function getAccountTokenQueryOptions(username) {
|
|
|
2789
3316
|
);
|
|
2790
3317
|
const memoQueryOptions = HiveSignerIntegration.queries.getDecodeMemoQueryOptions(
|
|
2791
3318
|
username,
|
|
2792
|
-
(await response.json()).memo
|
|
3319
|
+
(await response.json()).memo,
|
|
3320
|
+
accessToken
|
|
2793
3321
|
);
|
|
2794
3322
|
await getQueryClient().prefetchQuery(memoQueryOptions);
|
|
2795
3323
|
const { memoDecoded } = getQueryClient().getQueryData(
|
|
@@ -2799,17 +3327,23 @@ function getAccountTokenQueryOptions(username) {
|
|
|
2799
3327
|
}
|
|
2800
3328
|
});
|
|
2801
3329
|
}
|
|
2802
|
-
function getAccountVideosQueryOptions(username) {
|
|
3330
|
+
function getAccountVideosQueryOptions(username, accessToken) {
|
|
2803
3331
|
return queryOptions({
|
|
2804
3332
|
queryKey: ["integrations", "3speak", "videos", username],
|
|
2805
|
-
enabled: !!username,
|
|
3333
|
+
enabled: !!username && !!accessToken,
|
|
2806
3334
|
queryFn: async () => {
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
const
|
|
2811
|
-
|
|
3335
|
+
if (!username || !accessToken) {
|
|
3336
|
+
throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
|
|
3337
|
+
}
|
|
3338
|
+
const tokenQueryOptions = getAccountTokenQueryOptions(
|
|
3339
|
+
username,
|
|
3340
|
+
accessToken
|
|
2812
3341
|
);
|
|
3342
|
+
await getQueryClient().prefetchQuery(tokenQueryOptions);
|
|
3343
|
+
const token = getQueryClient().getQueryData(tokenQueryOptions.queryKey);
|
|
3344
|
+
if (!token) {
|
|
3345
|
+
throw new Error("[SDK][Integrations][3Speak] \u2013 missing account token");
|
|
3346
|
+
}
|
|
2813
3347
|
const fetchApi = getBoundFetch();
|
|
2814
3348
|
const response = await fetchApi(
|
|
2815
3349
|
`https://studio.3speak.tv/mobile/api/my-videos`,
|
|
@@ -2920,13 +3454,13 @@ function getAccountRcQueryOptions(username) {
|
|
|
2920
3454
|
enabled: !!username
|
|
2921
3455
|
});
|
|
2922
3456
|
}
|
|
2923
|
-
function getGameStatusCheckQueryOptions(username, gameType) {
|
|
3457
|
+
function getGameStatusCheckQueryOptions(username, code, gameType) {
|
|
2924
3458
|
return queryOptions({
|
|
2925
3459
|
queryKey: ["games", "status-check", gameType, username],
|
|
2926
|
-
enabled: !!username,
|
|
3460
|
+
enabled: !!username && !!code,
|
|
2927
3461
|
queryFn: async () => {
|
|
2928
|
-
if (!username) {
|
|
2929
|
-
throw new Error("[SDK][Games] \u2013
|
|
3462
|
+
if (!username || !code) {
|
|
3463
|
+
throw new Error("[SDK][Games] \u2013 missing auth");
|
|
2930
3464
|
}
|
|
2931
3465
|
const fetchApi = getBoundFetch();
|
|
2932
3466
|
const response = await fetchApi(
|
|
@@ -2935,7 +3469,7 @@ function getGameStatusCheckQueryOptions(username, gameType) {
|
|
|
2935
3469
|
method: "POST",
|
|
2936
3470
|
body: JSON.stringify({
|
|
2937
3471
|
game_type: gameType,
|
|
2938
|
-
code
|
|
3472
|
+
code
|
|
2939
3473
|
}),
|
|
2940
3474
|
headers: {
|
|
2941
3475
|
"Content-Type": "application/json"
|
|
@@ -2946,7 +3480,7 @@ function getGameStatusCheckQueryOptions(username, gameType) {
|
|
|
2946
3480
|
}
|
|
2947
3481
|
});
|
|
2948
3482
|
}
|
|
2949
|
-
function useGameClaim(username, gameType, key) {
|
|
3483
|
+
function useGameClaim(username, code, gameType, key) {
|
|
2950
3484
|
const { mutateAsync: recordActivity } = useRecordActivity(
|
|
2951
3485
|
username,
|
|
2952
3486
|
"spin-rolled"
|
|
@@ -2954,8 +3488,8 @@ function useGameClaim(username, gameType, key) {
|
|
|
2954
3488
|
return useMutation({
|
|
2955
3489
|
mutationKey: ["games", "post", gameType, username],
|
|
2956
3490
|
mutationFn: async () => {
|
|
2957
|
-
if (!username) {
|
|
2958
|
-
throw new Error("[SDK][Games] \u2013
|
|
3491
|
+
if (!username || !code) {
|
|
3492
|
+
throw new Error("[SDK][Games] \u2013 missing auth");
|
|
2959
3493
|
}
|
|
2960
3494
|
const fetchApi = getBoundFetch();
|
|
2961
3495
|
const response = await fetchApi(
|
|
@@ -2964,7 +3498,7 @@ function useGameClaim(username, gameType, key) {
|
|
|
2964
3498
|
method: "POST",
|
|
2965
3499
|
body: JSON.stringify({
|
|
2966
3500
|
game_type: gameType,
|
|
2967
|
-
code
|
|
3501
|
+
code,
|
|
2968
3502
|
key
|
|
2969
3503
|
}),
|
|
2970
3504
|
headers: {
|
|
@@ -3019,6 +3553,13 @@ function getCommunityContextQueryOptions(username, communityName) {
|
|
|
3019
3553
|
}
|
|
3020
3554
|
});
|
|
3021
3555
|
}
|
|
3556
|
+
function getCommunityQueryOptions(name, observer = "", enabled = true) {
|
|
3557
|
+
return queryOptions({
|
|
3558
|
+
queryKey: ["community", "single", name, observer],
|
|
3559
|
+
enabled: enabled && !!name,
|
|
3560
|
+
queryFn: async () => getCommunity(name ?? "", observer)
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3022
3563
|
function getCommunitySubscribersQueryOptions(communityName) {
|
|
3023
3564
|
return queryOptions({
|
|
3024
3565
|
queryKey: ["communities", "subscribers", communityName],
|
|
@@ -3129,15 +3670,18 @@ function getCommunityPermissions({
|
|
|
3129
3670
|
isModerator
|
|
3130
3671
|
};
|
|
3131
3672
|
}
|
|
3132
|
-
function getNotificationsUnreadCountQueryOptions(activeUsername) {
|
|
3673
|
+
function getNotificationsUnreadCountQueryOptions(activeUsername, code) {
|
|
3133
3674
|
return queryOptions({
|
|
3134
3675
|
queryKey: ["notifications", "unread", activeUsername],
|
|
3135
3676
|
queryFn: async () => {
|
|
3677
|
+
if (!code) {
|
|
3678
|
+
return 0;
|
|
3679
|
+
}
|
|
3136
3680
|
const response = await fetch(
|
|
3137
3681
|
`${CONFIG.privateApiHost}/private-api/notifications/unread`,
|
|
3138
3682
|
{
|
|
3139
3683
|
method: "POST",
|
|
3140
|
-
body: JSON.stringify({ code
|
|
3684
|
+
body: JSON.stringify({ code }),
|
|
3141
3685
|
headers: {
|
|
3142
3686
|
"Content-Type": "application/json"
|
|
3143
3687
|
}
|
|
@@ -3146,17 +3690,20 @@ function getNotificationsUnreadCountQueryOptions(activeUsername) {
|
|
|
3146
3690
|
const data = await response.json();
|
|
3147
3691
|
return data.count;
|
|
3148
3692
|
},
|
|
3149
|
-
enabled: !!activeUsername,
|
|
3693
|
+
enabled: !!activeUsername && !!code,
|
|
3150
3694
|
initialData: 0,
|
|
3151
3695
|
refetchInterval: 6e4
|
|
3152
3696
|
});
|
|
3153
3697
|
}
|
|
3154
|
-
function getNotificationsInfiniteQueryOptions(activeUsername, filter = void 0) {
|
|
3698
|
+
function getNotificationsInfiniteQueryOptions(activeUsername, code, filter = void 0) {
|
|
3155
3699
|
return infiniteQueryOptions({
|
|
3156
3700
|
queryKey: ["notifications", activeUsername, filter],
|
|
3157
3701
|
queryFn: async ({ pageParam }) => {
|
|
3702
|
+
if (!code) {
|
|
3703
|
+
return [];
|
|
3704
|
+
}
|
|
3158
3705
|
const data = {
|
|
3159
|
-
code
|
|
3706
|
+
code,
|
|
3160
3707
|
filter,
|
|
3161
3708
|
since: pageParam,
|
|
3162
3709
|
user: void 0
|
|
@@ -3173,7 +3720,7 @@ function getNotificationsInfiniteQueryOptions(activeUsername, filter = void 0) {
|
|
|
3173
3720
|
);
|
|
3174
3721
|
return response.json();
|
|
3175
3722
|
},
|
|
3176
|
-
enabled: !!activeUsername,
|
|
3723
|
+
enabled: !!activeUsername && !!code,
|
|
3177
3724
|
initialData: { pages: [], pageParams: [] },
|
|
3178
3725
|
initialPageParam: "",
|
|
3179
3726
|
getNextPageParam: (lastPage) => lastPage?.[lastPage.length - 1]?.id ?? "",
|
|
@@ -3226,16 +3773,19 @@ var NotificationViewType = /* @__PURE__ */ ((NotificationViewType2) => {
|
|
|
3226
3773
|
})(NotificationViewType || {});
|
|
3227
3774
|
|
|
3228
3775
|
// src/modules/notifications/queries/get-notifications-settings-query-options.ts
|
|
3229
|
-
function getNotificationsSettingsQueryOptions(activeUsername) {
|
|
3776
|
+
function getNotificationsSettingsQueryOptions(activeUsername, code) {
|
|
3230
3777
|
return queryOptions({
|
|
3231
3778
|
queryKey: ["notifications", "settings", activeUsername],
|
|
3232
3779
|
queryFn: async () => {
|
|
3233
3780
|
let token = activeUsername + "-web";
|
|
3781
|
+
if (!code) {
|
|
3782
|
+
throw new Error("Missing access token");
|
|
3783
|
+
}
|
|
3234
3784
|
const response = await fetch(
|
|
3235
3785
|
CONFIG.privateApiHost + "/private-api/detail-device",
|
|
3236
3786
|
{
|
|
3237
3787
|
body: JSON.stringify({
|
|
3238
|
-
code
|
|
3788
|
+
code,
|
|
3239
3789
|
username: activeUsername,
|
|
3240
3790
|
token
|
|
3241
3791
|
}),
|
|
@@ -3250,7 +3800,7 @@ function getNotificationsSettingsQueryOptions(activeUsername) {
|
|
|
3250
3800
|
}
|
|
3251
3801
|
return response.json();
|
|
3252
3802
|
},
|
|
3253
|
-
enabled: !!activeUsername,
|
|
3803
|
+
enabled: !!activeUsername && !!code,
|
|
3254
3804
|
refetchOnMount: false,
|
|
3255
3805
|
initialData: () => {
|
|
3256
3806
|
const wasMutedPreviously = typeof window !== "undefined" ? localStorage.getItem("notifications") !== "true" : false;
|
|
@@ -3452,6 +4002,25 @@ function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
|
|
|
3452
4002
|
getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
|
|
3453
4003
|
});
|
|
3454
4004
|
}
|
|
4005
|
+
function getIncomingRcQueryOptions(username) {
|
|
4006
|
+
return queryOptions({
|
|
4007
|
+
queryKey: ["wallet", "incoming-rc", username],
|
|
4008
|
+
enabled: !!username,
|
|
4009
|
+
queryFn: async () => {
|
|
4010
|
+
if (!username) {
|
|
4011
|
+
throw new Error("[SDK][Wallet] - Missing username for incoming RC");
|
|
4012
|
+
}
|
|
4013
|
+
const fetchApi = getBoundFetch();
|
|
4014
|
+
const response = await fetchApi(
|
|
4015
|
+
`${CONFIG.privateApiHost}/private-api/received-rc/${username}`
|
|
4016
|
+
);
|
|
4017
|
+
if (!response.ok) {
|
|
4018
|
+
throw new Error(`Failed to fetch incoming RC: ${response.status}`);
|
|
4019
|
+
}
|
|
4020
|
+
return response.json();
|
|
4021
|
+
}
|
|
4022
|
+
});
|
|
4023
|
+
}
|
|
3455
4024
|
function getReceivedVestingSharesQueryOptions(username) {
|
|
3456
4025
|
return queryOptions({
|
|
3457
4026
|
queryKey: ["wallet", "received-vesting-shares", username],
|
|
@@ -3496,15 +4065,15 @@ function getMarketStatisticsQueryOptions() {
|
|
|
3496
4065
|
});
|
|
3497
4066
|
}
|
|
3498
4067
|
function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
|
|
3499
|
-
const
|
|
4068
|
+
const formatDate2 = (date) => {
|
|
3500
4069
|
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
3501
4070
|
};
|
|
3502
4071
|
return queryOptions({
|
|
3503
4072
|
queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
|
|
3504
4073
|
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
|
|
3505
4074
|
seconds,
|
|
3506
|
-
|
|
3507
|
-
|
|
4075
|
+
formatDate2(startDate),
|
|
4076
|
+
formatDate2(endDate)
|
|
3508
4077
|
])
|
|
3509
4078
|
});
|
|
3510
4079
|
}
|
|
@@ -3519,13 +4088,13 @@ function getHiveHbdStatsQueryOptions() {
|
|
|
3519
4088
|
);
|
|
3520
4089
|
const now = /* @__PURE__ */ new Date();
|
|
3521
4090
|
const oneDayAgo = new Date(now.getTime() - 864e5);
|
|
3522
|
-
const
|
|
4091
|
+
const formatDate2 = (date) => {
|
|
3523
4092
|
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
3524
4093
|
};
|
|
3525
4094
|
const dayChange = await CONFIG.hiveClient.call(
|
|
3526
4095
|
"condenser_api",
|
|
3527
4096
|
"get_market_history",
|
|
3528
|
-
[86400,
|
|
4097
|
+
[86400, formatDate2(oneDayAgo), formatDate2(now)]
|
|
3529
4098
|
);
|
|
3530
4099
|
const result = {
|
|
3531
4100
|
price: +stats.latest,
|
|
@@ -3544,8 +4113,9 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
|
|
|
3544
4113
|
return queryOptions({
|
|
3545
4114
|
queryKey: ["market", "data", coin, vsCurrency, fromTs, toTs],
|
|
3546
4115
|
queryFn: async ({ signal }) => {
|
|
4116
|
+
const fetchApi = getBoundFetch();
|
|
3547
4117
|
const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
|
|
3548
|
-
const response = await
|
|
4118
|
+
const response = await fetchApi(url, { signal });
|
|
3549
4119
|
if (!response.ok) {
|
|
3550
4120
|
throw new Error(`Failed to fetch market data: ${response.status}`);
|
|
3551
4121
|
}
|
|
@@ -3553,6 +4123,61 @@ function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
|
|
|
3553
4123
|
}
|
|
3554
4124
|
});
|
|
3555
4125
|
}
|
|
4126
|
+
function formatDate(date) {
|
|
4127
|
+
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4128
|
+
}
|
|
4129
|
+
function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
|
|
4130
|
+
const end = endDate ?? /* @__PURE__ */ new Date();
|
|
4131
|
+
const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
|
|
4132
|
+
return queryOptions({
|
|
4133
|
+
queryKey: ["market", "trade-history", limit, start.getTime(), end.getTime()],
|
|
4134
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_trade_history", [
|
|
4135
|
+
formatDate(start),
|
|
4136
|
+
formatDate(end),
|
|
4137
|
+
limit
|
|
4138
|
+
])
|
|
4139
|
+
});
|
|
4140
|
+
}
|
|
4141
|
+
|
|
4142
|
+
// src/modules/market/requests.ts
|
|
4143
|
+
async function parseJsonResponse(response) {
|
|
4144
|
+
const data = await response.json();
|
|
4145
|
+
if (!response.ok) {
|
|
4146
|
+
const error = new Error(`Request failed with status ${response.status}`);
|
|
4147
|
+
error.status = response.status;
|
|
4148
|
+
error.data = data;
|
|
4149
|
+
throw error;
|
|
4150
|
+
}
|
|
4151
|
+
return data;
|
|
4152
|
+
}
|
|
4153
|
+
async function getMarketData(coin, vsCurrency, fromTs, toTs) {
|
|
4154
|
+
const fetchApi = getBoundFetch();
|
|
4155
|
+
const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
|
|
4156
|
+
const response = await fetchApi(url);
|
|
4157
|
+
return parseJsonResponse(response);
|
|
4158
|
+
}
|
|
4159
|
+
async function getCurrencyRate(cur) {
|
|
4160
|
+
if (cur === "hbd") {
|
|
4161
|
+
return 1;
|
|
4162
|
+
}
|
|
4163
|
+
const fetchApi = getBoundFetch();
|
|
4164
|
+
const url = `https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=${cur}`;
|
|
4165
|
+
const response = await fetchApi(url);
|
|
4166
|
+
const data = await parseJsonResponse(response);
|
|
4167
|
+
return data.hive_dollar[cur];
|
|
4168
|
+
}
|
|
4169
|
+
async function getCurrencyTokenRate(currency, token) {
|
|
4170
|
+
const fetchApi = getBoundFetch();
|
|
4171
|
+
const response = await fetchApi(
|
|
4172
|
+
CONFIG.privateApiHost + `/private-api/market-data/${currency === "hbd" ? "usd" : currency}/${token}`
|
|
4173
|
+
);
|
|
4174
|
+
return parseJsonResponse(response);
|
|
4175
|
+
}
|
|
4176
|
+
async function getCurrencyRates() {
|
|
4177
|
+
const fetchApi = getBoundFetch();
|
|
4178
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
|
|
4179
|
+
return parseJsonResponse(response);
|
|
4180
|
+
}
|
|
3556
4181
|
function getPointsQueryOptions(username, filter = 0) {
|
|
3557
4182
|
return queryOptions({
|
|
3558
4183
|
queryKey: ["points", username, filter],
|
|
@@ -3823,6 +4448,89 @@ function getSearchPathQueryOptions(q) {
|
|
|
3823
4448
|
}
|
|
3824
4449
|
});
|
|
3825
4450
|
}
|
|
4451
|
+
|
|
4452
|
+
// src/modules/search/requests.ts
|
|
4453
|
+
async function parseJsonResponse2(response) {
|
|
4454
|
+
const parseBody = async () => {
|
|
4455
|
+
try {
|
|
4456
|
+
return await response.json();
|
|
4457
|
+
} catch {
|
|
4458
|
+
try {
|
|
4459
|
+
return await response.text();
|
|
4460
|
+
} catch {
|
|
4461
|
+
return void 0;
|
|
4462
|
+
}
|
|
4463
|
+
}
|
|
4464
|
+
};
|
|
4465
|
+
const data = await parseBody();
|
|
4466
|
+
if (!response.ok) {
|
|
4467
|
+
const error = new Error(`Request failed with status ${response.status}`);
|
|
4468
|
+
error.status = response.status;
|
|
4469
|
+
error.data = data;
|
|
4470
|
+
throw error;
|
|
4471
|
+
}
|
|
4472
|
+
if (data === void 0) {
|
|
4473
|
+
throw new Error("Response body was empty or invalid JSON");
|
|
4474
|
+
}
|
|
4475
|
+
return data;
|
|
4476
|
+
}
|
|
4477
|
+
async function search(q, sort, hideLow, since, scroll_id, votes) {
|
|
4478
|
+
const data = { q, sort, hide_low: hideLow };
|
|
4479
|
+
if (since) {
|
|
4480
|
+
data.since = since;
|
|
4481
|
+
}
|
|
4482
|
+
if (scroll_id) {
|
|
4483
|
+
data.scroll_id = scroll_id;
|
|
4484
|
+
}
|
|
4485
|
+
if (votes) {
|
|
4486
|
+
data.votes = votes;
|
|
4487
|
+
}
|
|
4488
|
+
const fetchApi = getBoundFetch();
|
|
4489
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search", {
|
|
4490
|
+
method: "POST",
|
|
4491
|
+
headers: {
|
|
4492
|
+
"Content-Type": "application/json"
|
|
4493
|
+
},
|
|
4494
|
+
body: JSON.stringify(data)
|
|
4495
|
+
});
|
|
4496
|
+
return parseJsonResponse2(response);
|
|
4497
|
+
}
|
|
4498
|
+
async function searchAccount(q = "", limit = 20, random = 1) {
|
|
4499
|
+
const data = { q, limit, random };
|
|
4500
|
+
const fetchApi = getBoundFetch();
|
|
4501
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-account", {
|
|
4502
|
+
method: "POST",
|
|
4503
|
+
headers: {
|
|
4504
|
+
"Content-Type": "application/json"
|
|
4505
|
+
},
|
|
4506
|
+
body: JSON.stringify(data)
|
|
4507
|
+
});
|
|
4508
|
+
return parseJsonResponse2(response);
|
|
4509
|
+
}
|
|
4510
|
+
async function searchTag(q = "", limit = 20, random = 0) {
|
|
4511
|
+
const data = { q, limit, random };
|
|
4512
|
+
const fetchApi = getBoundFetch();
|
|
4513
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-tag", {
|
|
4514
|
+
method: "POST",
|
|
4515
|
+
headers: {
|
|
4516
|
+
"Content-Type": "application/json"
|
|
4517
|
+
},
|
|
4518
|
+
body: JSON.stringify(data)
|
|
4519
|
+
});
|
|
4520
|
+
return parseJsonResponse2(response);
|
|
4521
|
+
}
|
|
4522
|
+
async function searchPath(q) {
|
|
4523
|
+
const fetchApi = getBoundFetch();
|
|
4524
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-path", {
|
|
4525
|
+
method: "POST",
|
|
4526
|
+
headers: {
|
|
4527
|
+
"Content-Type": "application/json"
|
|
4528
|
+
},
|
|
4529
|
+
body: JSON.stringify({ q })
|
|
4530
|
+
});
|
|
4531
|
+
const data = await parseJsonResponse2(response);
|
|
4532
|
+
return data?.length > 0 ? data : [q];
|
|
4533
|
+
}
|
|
3826
4534
|
function getBoostPlusPricesQueryOptions(accessToken) {
|
|
3827
4535
|
return queryOptions({
|
|
3828
4536
|
queryKey: ["promotions", "boost-plus-prices"],
|
|
@@ -3893,6 +4601,311 @@ function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
|
|
|
3893
4601
|
});
|
|
3894
4602
|
}
|
|
3895
4603
|
|
|
3896
|
-
|
|
4604
|
+
// src/modules/private-api/requests.ts
|
|
4605
|
+
async function parseJsonResponse3(response) {
|
|
4606
|
+
if (!response.ok) {
|
|
4607
|
+
let errorData = void 0;
|
|
4608
|
+
try {
|
|
4609
|
+
errorData = await response.json();
|
|
4610
|
+
} catch {
|
|
4611
|
+
errorData = void 0;
|
|
4612
|
+
}
|
|
4613
|
+
const error = new Error(`Request failed with status ${response.status}`);
|
|
4614
|
+
error.status = response.status;
|
|
4615
|
+
error.data = errorData;
|
|
4616
|
+
throw error;
|
|
4617
|
+
}
|
|
4618
|
+
return await response.json();
|
|
4619
|
+
}
|
|
4620
|
+
async function signUp(username, email, referral) {
|
|
4621
|
+
const fetchApi = getBoundFetch();
|
|
4622
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/account-create", {
|
|
4623
|
+
method: "POST",
|
|
4624
|
+
headers: {
|
|
4625
|
+
"Content-Type": "application/json"
|
|
4626
|
+
},
|
|
4627
|
+
body: JSON.stringify({ username, email, referral })
|
|
4628
|
+
});
|
|
4629
|
+
const data = await parseJsonResponse3(response);
|
|
4630
|
+
return { status: response.status, data };
|
|
4631
|
+
}
|
|
4632
|
+
async function subscribeEmail(email) {
|
|
4633
|
+
const fetchApi = getBoundFetch();
|
|
4634
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/subscribe", {
|
|
4635
|
+
method: "POST",
|
|
4636
|
+
headers: {
|
|
4637
|
+
"Content-Type": "application/json"
|
|
4638
|
+
},
|
|
4639
|
+
body: JSON.stringify({ email })
|
|
4640
|
+
});
|
|
4641
|
+
const data = await parseJsonResponse3(response);
|
|
4642
|
+
return { status: response.status, data };
|
|
4643
|
+
}
|
|
4644
|
+
async function usrActivity(code, ty, bl = "", tx = "") {
|
|
4645
|
+
const params = { code, ty };
|
|
4646
|
+
if (bl) {
|
|
4647
|
+
params.bl = bl;
|
|
4648
|
+
}
|
|
4649
|
+
if (tx) {
|
|
4650
|
+
params.tx = tx;
|
|
4651
|
+
}
|
|
4652
|
+
const fetchApi = getBoundFetch();
|
|
4653
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/usr-activity", {
|
|
4654
|
+
method: "POST",
|
|
4655
|
+
headers: {
|
|
4656
|
+
"Content-Type": "application/json"
|
|
4657
|
+
},
|
|
4658
|
+
body: JSON.stringify(params)
|
|
4659
|
+
});
|
|
4660
|
+
await parseJsonResponse3(response);
|
|
4661
|
+
}
|
|
4662
|
+
async function getNotifications(code, filter, since = null, user = null) {
|
|
4663
|
+
const data = {
|
|
4664
|
+
code
|
|
4665
|
+
};
|
|
4666
|
+
if (filter) {
|
|
4667
|
+
data.filter = filter;
|
|
4668
|
+
}
|
|
4669
|
+
if (since) {
|
|
4670
|
+
data.since = since;
|
|
4671
|
+
}
|
|
4672
|
+
if (user) {
|
|
4673
|
+
data.user = user;
|
|
4674
|
+
}
|
|
4675
|
+
const fetchApi = getBoundFetch();
|
|
4676
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications", {
|
|
4677
|
+
method: "POST",
|
|
4678
|
+
headers: {
|
|
4679
|
+
"Content-Type": "application/json"
|
|
4680
|
+
},
|
|
4681
|
+
body: JSON.stringify(data)
|
|
4682
|
+
});
|
|
4683
|
+
return parseJsonResponse3(response);
|
|
4684
|
+
}
|
|
4685
|
+
async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
|
|
4686
|
+
const data = {
|
|
4687
|
+
code,
|
|
4688
|
+
username,
|
|
4689
|
+
token,
|
|
4690
|
+
system,
|
|
4691
|
+
allows_notify,
|
|
4692
|
+
notify_types
|
|
4693
|
+
};
|
|
4694
|
+
const fetchApi = getBoundFetch();
|
|
4695
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/register-device", {
|
|
4696
|
+
method: "POST",
|
|
4697
|
+
headers: {
|
|
4698
|
+
"Content-Type": "application/json"
|
|
4699
|
+
},
|
|
4700
|
+
body: JSON.stringify(data)
|
|
4701
|
+
});
|
|
4702
|
+
return parseJsonResponse3(response);
|
|
4703
|
+
}
|
|
4704
|
+
async function getNotificationSetting(code, username, token) {
|
|
4705
|
+
const data = { code, username, token };
|
|
4706
|
+
const fetchApi = getBoundFetch();
|
|
4707
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/detail-device", {
|
|
4708
|
+
method: "POST",
|
|
4709
|
+
headers: {
|
|
4710
|
+
"Content-Type": "application/json"
|
|
4711
|
+
},
|
|
4712
|
+
body: JSON.stringify(data)
|
|
4713
|
+
});
|
|
4714
|
+
return parseJsonResponse3(response);
|
|
4715
|
+
}
|
|
4716
|
+
async function markNotifications(code, id) {
|
|
4717
|
+
const data = {
|
|
4718
|
+
code
|
|
4719
|
+
};
|
|
4720
|
+
if (id) {
|
|
4721
|
+
data.id = id;
|
|
4722
|
+
}
|
|
4723
|
+
const fetchApi = getBoundFetch();
|
|
4724
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications/mark", {
|
|
4725
|
+
method: "POST",
|
|
4726
|
+
headers: {
|
|
4727
|
+
"Content-Type": "application/json"
|
|
4728
|
+
},
|
|
4729
|
+
body: JSON.stringify(data)
|
|
4730
|
+
});
|
|
4731
|
+
return parseJsonResponse3(response);
|
|
4732
|
+
}
|
|
4733
|
+
async function addImage(code, url) {
|
|
4734
|
+
const data = { code, url };
|
|
4735
|
+
const fetchApi = getBoundFetch();
|
|
4736
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-add", {
|
|
4737
|
+
method: "POST",
|
|
4738
|
+
headers: {
|
|
4739
|
+
"Content-Type": "application/json"
|
|
4740
|
+
},
|
|
4741
|
+
body: JSON.stringify(data)
|
|
4742
|
+
});
|
|
4743
|
+
return parseJsonResponse3(response);
|
|
4744
|
+
}
|
|
4745
|
+
async function uploadImage(file, token, signal) {
|
|
4746
|
+
const fetchApi = getBoundFetch();
|
|
4747
|
+
const formData = new FormData();
|
|
4748
|
+
formData.append("file", file);
|
|
4749
|
+
const response = await fetchApi(`${CONFIG.imageHost}/hs/${token}`, {
|
|
4750
|
+
method: "POST",
|
|
4751
|
+
body: formData,
|
|
4752
|
+
signal
|
|
4753
|
+
});
|
|
4754
|
+
return parseJsonResponse3(response);
|
|
4755
|
+
}
|
|
4756
|
+
async function deleteImage(code, imageId) {
|
|
4757
|
+
const data = { code, id: imageId };
|
|
4758
|
+
const fetchApi = getBoundFetch();
|
|
4759
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-delete", {
|
|
4760
|
+
method: "POST",
|
|
4761
|
+
headers: {
|
|
4762
|
+
"Content-Type": "application/json"
|
|
4763
|
+
},
|
|
4764
|
+
body: JSON.stringify(data)
|
|
4765
|
+
});
|
|
4766
|
+
return parseJsonResponse3(response);
|
|
4767
|
+
}
|
|
4768
|
+
async function addDraft(code, title, body, tags, meta) {
|
|
4769
|
+
const data = { code, title, body, tags, meta };
|
|
4770
|
+
const fetchApi = getBoundFetch();
|
|
4771
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-add", {
|
|
4772
|
+
method: "POST",
|
|
4773
|
+
headers: {
|
|
4774
|
+
"Content-Type": "application/json"
|
|
4775
|
+
},
|
|
4776
|
+
body: JSON.stringify(data)
|
|
4777
|
+
});
|
|
4778
|
+
return parseJsonResponse3(response);
|
|
4779
|
+
}
|
|
4780
|
+
async function updateDraft(code, draftId, title, body, tags, meta) {
|
|
4781
|
+
const data = { code, id: draftId, title, body, tags, meta };
|
|
4782
|
+
const fetchApi = getBoundFetch();
|
|
4783
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-update", {
|
|
4784
|
+
method: "POST",
|
|
4785
|
+
headers: {
|
|
4786
|
+
"Content-Type": "application/json"
|
|
4787
|
+
},
|
|
4788
|
+
body: JSON.stringify(data)
|
|
4789
|
+
});
|
|
4790
|
+
return parseJsonResponse3(response);
|
|
4791
|
+
}
|
|
4792
|
+
async function deleteDraft(code, draftId) {
|
|
4793
|
+
const data = { code, id: draftId };
|
|
4794
|
+
const fetchApi = getBoundFetch();
|
|
4795
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-delete", {
|
|
4796
|
+
method: "POST",
|
|
4797
|
+
headers: {
|
|
4798
|
+
"Content-Type": "application/json"
|
|
4799
|
+
},
|
|
4800
|
+
body: JSON.stringify(data)
|
|
4801
|
+
});
|
|
4802
|
+
return parseJsonResponse3(response);
|
|
4803
|
+
}
|
|
4804
|
+
async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
|
|
4805
|
+
const data = {
|
|
4806
|
+
code,
|
|
4807
|
+
permlink,
|
|
4808
|
+
title,
|
|
4809
|
+
body,
|
|
4810
|
+
meta,
|
|
4811
|
+
schedule,
|
|
4812
|
+
reblog
|
|
4813
|
+
};
|
|
4814
|
+
if (options) {
|
|
4815
|
+
data.options = options;
|
|
4816
|
+
}
|
|
4817
|
+
const fetchApi = getBoundFetch();
|
|
4818
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-add", {
|
|
4819
|
+
method: "POST",
|
|
4820
|
+
headers: {
|
|
4821
|
+
"Content-Type": "application/json"
|
|
4822
|
+
},
|
|
4823
|
+
body: JSON.stringify(data)
|
|
4824
|
+
});
|
|
4825
|
+
return parseJsonResponse3(response);
|
|
4826
|
+
}
|
|
4827
|
+
async function deleteSchedule(code, id) {
|
|
4828
|
+
const data = { code, id };
|
|
4829
|
+
const fetchApi = getBoundFetch();
|
|
4830
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-delete", {
|
|
4831
|
+
method: "POST",
|
|
4832
|
+
headers: {
|
|
4833
|
+
"Content-Type": "application/json"
|
|
4834
|
+
},
|
|
4835
|
+
body: JSON.stringify(data)
|
|
4836
|
+
});
|
|
4837
|
+
return parseJsonResponse3(response);
|
|
4838
|
+
}
|
|
4839
|
+
async function moveSchedule(code, id) {
|
|
4840
|
+
const data = { code, id };
|
|
4841
|
+
const fetchApi = getBoundFetch();
|
|
4842
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-move", {
|
|
4843
|
+
method: "POST",
|
|
4844
|
+
headers: {
|
|
4845
|
+
"Content-Type": "application/json"
|
|
4846
|
+
},
|
|
4847
|
+
body: JSON.stringify(data)
|
|
4848
|
+
});
|
|
4849
|
+
return parseJsonResponse3(response);
|
|
4850
|
+
}
|
|
4851
|
+
async function getPromotedPost(code, author, permlink) {
|
|
4852
|
+
const data = { code, author, permlink };
|
|
4853
|
+
const fetchApi = getBoundFetch();
|
|
4854
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/promoted-post", {
|
|
4855
|
+
method: "POST",
|
|
4856
|
+
headers: {
|
|
4857
|
+
"Content-Type": "application/json"
|
|
4858
|
+
},
|
|
4859
|
+
body: JSON.stringify(data)
|
|
4860
|
+
});
|
|
4861
|
+
return parseJsonResponse3(response);
|
|
4862
|
+
}
|
|
4863
|
+
async function onboardEmail(username, email, friend) {
|
|
4864
|
+
const dataBody = {
|
|
4865
|
+
username,
|
|
4866
|
+
email,
|
|
4867
|
+
friend
|
|
4868
|
+
};
|
|
4869
|
+
const fetchApi = getBoundFetch();
|
|
4870
|
+
const response = await fetchApi(
|
|
4871
|
+
CONFIG.privateApiHost + "/private-api/account-create-friend",
|
|
4872
|
+
{
|
|
4873
|
+
method: "POST",
|
|
4874
|
+
headers: {
|
|
4875
|
+
"Content-Type": "application/json"
|
|
4876
|
+
},
|
|
4877
|
+
body: JSON.stringify(dataBody)
|
|
4878
|
+
}
|
|
4879
|
+
);
|
|
4880
|
+
return parseJsonResponse3(response);
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4883
|
+
// src/modules/auth/requests.ts
|
|
4884
|
+
async function hsTokenRenew(code) {
|
|
4885
|
+
const fetchApi = getBoundFetch();
|
|
4886
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/auth-api/hs-token-refresh", {
|
|
4887
|
+
method: "POST",
|
|
4888
|
+
headers: {
|
|
4889
|
+
"Content-Type": "application/json"
|
|
4890
|
+
},
|
|
4891
|
+
body: JSON.stringify({ code })
|
|
4892
|
+
});
|
|
4893
|
+
if (!response.ok) {
|
|
4894
|
+
let data2 = void 0;
|
|
4895
|
+
try {
|
|
4896
|
+
data2 = await response.json();
|
|
4897
|
+
} catch {
|
|
4898
|
+
data2 = void 0;
|
|
4899
|
+
}
|
|
4900
|
+
const error = new Error(`Failed to refresh token: ${response.status}`);
|
|
4901
|
+
error.status = response.status;
|
|
4902
|
+
error.data = data2;
|
|
4903
|
+
throw error;
|
|
4904
|
+
}
|
|
4905
|
+
const data = await response.json();
|
|
4906
|
+
return data;
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, keychain_exports as Keychain, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, getAccessToken, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getActiveAccountBookmarksQueryOptions, getActiveAccountFavouritesQueryOptions, getAnnouncementsQueryOptions, getBoostPlusAccountPricesQueryOptions, getBoostPlusPricesQueryOptions, getBotsQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCollateralizedConversionRequestsQueryOptions, getCommentHistoryQueryOptions, getCommunities, getCommunitiesQueryOptions, getCommunity, getCommunityContextQueryOptions, getCommunityPermissions, getCommunityQueryOptions, getCommunitySubscribersQueryOptions, getCommunityType, getContentQueryOptions, getContentRepliesQueryOptions, getControversialRisingInfiniteQueryOptions, getConversionRequestsQueryOptions, getCurrencyRate, getCurrencyRates, getCurrencyTokenRate, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussion, getDiscussionQueryOptions, getDiscussionsQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFollowCountQueryOptions, getFollowingQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getLoginType, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostingKey, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRefreshToken, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUser, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseProfileMetadata, powerRechargeTime, rcPower, resolvePost, roleMap, saveNotificationSetting, search, searchAccount, searchPath, searchQueryOptions, searchTag, signUp, sortDiscussions, subscribeEmail, toEntryArray, updateDraft, uploadImage, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddFragment, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useEditFragment, useGameClaim, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, usrActivity, validatePostCreating, votingPower, votingValue };
|
|
3897
4910
|
//# sourceMappingURL=index.mjs.map
|
|
3898
4911
|
//# sourceMappingURL=index.mjs.map
|