@ecency/sdk 1.5.13 → 1.5.15
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 +170 -9
- package/dist/browser/index.js +1304 -1020
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +1315 -1019
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +1304 -1020
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -680,6 +680,18 @@ function getFollowCountQueryOptions(username) {
|
|
|
680
680
|
])
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
|
+
function getFollowersQueryOptions(following, startFollower, followType = "blog", limit = 100) {
|
|
684
|
+
return queryOptions({
|
|
685
|
+
queryKey: ["accounts", "followers", following, startFollower, followType, limit],
|
|
686
|
+
queryFn: () => CONFIG.hiveClient.database.call("get_followers", [
|
|
687
|
+
following,
|
|
688
|
+
startFollower,
|
|
689
|
+
followType,
|
|
690
|
+
limit
|
|
691
|
+
]),
|
|
692
|
+
enabled: !!following
|
|
693
|
+
});
|
|
694
|
+
}
|
|
683
695
|
function getFollowingQueryOptions(follower, startFollowing, followType = "blog", limit = 100) {
|
|
684
696
|
return queryOptions({
|
|
685
697
|
queryKey: ["accounts", "following", follower, startFollowing, followType, limit],
|
|
@@ -1400,6 +1412,20 @@ function getEntryActiveVotesQueryOptions(entry) {
|
|
|
1400
1412
|
enabled: !!entry
|
|
1401
1413
|
});
|
|
1402
1414
|
}
|
|
1415
|
+
function getUserPostVoteQueryOptions(username, author, permlink) {
|
|
1416
|
+
return queryOptions({
|
|
1417
|
+
queryKey: ["posts", "user-vote", username, author, permlink],
|
|
1418
|
+
queryFn: async () => {
|
|
1419
|
+
const result = await CONFIG.hiveClient.call("database_api", "list_votes", {
|
|
1420
|
+
start: [username, author, permlink],
|
|
1421
|
+
limit: 1,
|
|
1422
|
+
order: "by_voter_comment"
|
|
1423
|
+
});
|
|
1424
|
+
return result?.votes?.[0] || null;
|
|
1425
|
+
},
|
|
1426
|
+
enabled: !!username && !!author && !!permlink
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1403
1429
|
function getContentQueryOptions(author, permlink) {
|
|
1404
1430
|
return queryOptions({
|
|
1405
1431
|
queryKey: ["posts", "content", author, permlink],
|
|
@@ -2315,8 +2341,8 @@ function toEntryArray(x) {
|
|
|
2315
2341
|
return Array.isArray(x) ? x : [];
|
|
2316
2342
|
}
|
|
2317
2343
|
async function getVisibleFirstLevelThreadItems(container) {
|
|
2318
|
-
const
|
|
2319
|
-
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(
|
|
2344
|
+
const queryOptions88 = getDiscussionsQueryOptions(container, "created" /* created */, true);
|
|
2345
|
+
const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions88);
|
|
2320
2346
|
const discussionItems = toEntryArray(discussionItemsRaw);
|
|
2321
2347
|
if (discussionItems.length <= 1) {
|
|
2322
2348
|
return [];
|
|
@@ -3288,10 +3314,14 @@ function useAddFragment(username, code) {
|
|
|
3288
3314
|
}
|
|
3289
3315
|
});
|
|
3290
3316
|
}
|
|
3291
|
-
function useEditFragment(username,
|
|
3317
|
+
function useEditFragment(username, code) {
|
|
3292
3318
|
return useMutation({
|
|
3293
|
-
mutationKey: ["posts", "edit-fragment", username
|
|
3294
|
-
mutationFn: async ({
|
|
3319
|
+
mutationKey: ["posts", "edit-fragment", username],
|
|
3320
|
+
mutationFn: async ({
|
|
3321
|
+
fragmentId,
|
|
3322
|
+
title,
|
|
3323
|
+
body
|
|
3324
|
+
}) => {
|
|
3295
3325
|
if (!code) {
|
|
3296
3326
|
throw new Error("[SDK][Posts] Missing access token");
|
|
3297
3327
|
}
|
|
@@ -3313,14 +3343,14 @@ function useEditFragment(username, fragmentId, code) {
|
|
|
3313
3343
|
);
|
|
3314
3344
|
return response.json();
|
|
3315
3345
|
},
|
|
3316
|
-
onSuccess(response) {
|
|
3346
|
+
onSuccess(response, variables) {
|
|
3317
3347
|
getQueryClient().setQueryData(
|
|
3318
3348
|
getFragmentsQueryOptions(username, code).queryKey,
|
|
3319
3349
|
(data) => {
|
|
3320
3350
|
if (!data) {
|
|
3321
3351
|
return [];
|
|
3322
3352
|
}
|
|
3323
|
-
const index = data.findIndex(({ id }) => id === fragmentId);
|
|
3353
|
+
const index = data.findIndex(({ id }) => id === variables.fragmentId);
|
|
3324
3354
|
if (index >= 0) {
|
|
3325
3355
|
data[index] = response;
|
|
3326
3356
|
}
|
|
@@ -3330,10 +3360,10 @@ function useEditFragment(username, fragmentId, code) {
|
|
|
3330
3360
|
}
|
|
3331
3361
|
});
|
|
3332
3362
|
}
|
|
3333
|
-
function useRemoveFragment(username,
|
|
3363
|
+
function useRemoveFragment(username, code) {
|
|
3334
3364
|
return useMutation({
|
|
3335
3365
|
mutationKey: ["posts", "remove-fragment", username],
|
|
3336
|
-
mutationFn: async () => {
|
|
3366
|
+
mutationFn: async ({ fragmentId }) => {
|
|
3337
3367
|
if (!code) {
|
|
3338
3368
|
throw new Error("[SDK][Posts] Missing access token");
|
|
3339
3369
|
}
|
|
@@ -3349,173 +3379,643 @@ function useRemoveFragment(username, fragmentId, code) {
|
|
|
3349
3379
|
}
|
|
3350
3380
|
});
|
|
3351
3381
|
},
|
|
3352
|
-
onSuccess() {
|
|
3382
|
+
onSuccess(_data, variables) {
|
|
3353
3383
|
getQueryClient().setQueryData(
|
|
3354
3384
|
getFragmentsQueryOptions(username, code).queryKey,
|
|
3355
|
-
(data) => [...data ?? []].filter(({ id }) => id !== fragmentId)
|
|
3385
|
+
(data) => [...data ?? []].filter(({ id }) => id !== variables.fragmentId)
|
|
3356
3386
|
);
|
|
3357
3387
|
}
|
|
3358
3388
|
});
|
|
3359
3389
|
}
|
|
3360
3390
|
|
|
3361
|
-
// src/modules/
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
response = await getContent(author, permlink);
|
|
3375
|
-
} catch (e) {
|
|
3376
|
-
response = void 0;
|
|
3391
|
+
// src/modules/private-api/requests.ts
|
|
3392
|
+
async function parseJsonResponse(response) {
|
|
3393
|
+
if (!response.ok) {
|
|
3394
|
+
let errorData = void 0;
|
|
3395
|
+
try {
|
|
3396
|
+
errorData = await response.json();
|
|
3397
|
+
} catch {
|
|
3398
|
+
errorData = void 0;
|
|
3399
|
+
}
|
|
3400
|
+
const error = new Error(`Request failed with status ${response.status}`);
|
|
3401
|
+
error.status = response.status;
|
|
3402
|
+
error.data = errorData;
|
|
3403
|
+
throw error;
|
|
3377
3404
|
}
|
|
3378
|
-
|
|
3379
|
-
|
|
3405
|
+
const text = await response.text();
|
|
3406
|
+
if (!text || text.trim() === "") {
|
|
3407
|
+
return "";
|
|
3380
3408
|
}
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3409
|
+
try {
|
|
3410
|
+
return JSON.parse(text);
|
|
3411
|
+
} catch (e) {
|
|
3412
|
+
console.warn("[SDK] Failed to parse JSON response:", e, "Response:", text);
|
|
3413
|
+
return "";
|
|
3384
3414
|
}
|
|
3385
|
-
return validatePostCreating(author, permlink, attempts + 1, options);
|
|
3386
3415
|
}
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
};
|
|
3399
|
-
}
|
|
3400
|
-
return { url: "", domain: "" };
|
|
3416
|
+
async function signUp(username, email, referral) {
|
|
3417
|
+
const fetchApi = getBoundFetch();
|
|
3418
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/account-create", {
|
|
3419
|
+
method: "POST",
|
|
3420
|
+
headers: {
|
|
3421
|
+
"Content-Type": "application/json"
|
|
3422
|
+
},
|
|
3423
|
+
body: JSON.stringify({ username, email, referral })
|
|
3424
|
+
});
|
|
3425
|
+
const data = await parseJsonResponse(response);
|
|
3426
|
+
return { status: response.status, data };
|
|
3401
3427
|
}
|
|
3402
|
-
function
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
const locationInfo = getLocationInfo();
|
|
3411
|
-
const url = options?.url ?? locationInfo.url;
|
|
3412
|
-
const domain = options?.domain ?? locationInfo.domain;
|
|
3413
|
-
await fetchApi(CONFIG.plausibleHost + "/api/event", {
|
|
3414
|
-
method: "POST",
|
|
3415
|
-
headers: {
|
|
3416
|
-
"Content-Type": "application/json"
|
|
3417
|
-
},
|
|
3418
|
-
body: JSON.stringify({
|
|
3419
|
-
name: activityType,
|
|
3420
|
-
url,
|
|
3421
|
-
domain,
|
|
3422
|
-
props: {
|
|
3423
|
-
username
|
|
3424
|
-
}
|
|
3425
|
-
})
|
|
3426
|
-
});
|
|
3427
|
-
}
|
|
3428
|
+
async function subscribeEmail(email) {
|
|
3429
|
+
const fetchApi = getBoundFetch();
|
|
3430
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/subscribe", {
|
|
3431
|
+
method: "POST",
|
|
3432
|
+
headers: {
|
|
3433
|
+
"Content-Type": "application/json"
|
|
3434
|
+
},
|
|
3435
|
+
body: JSON.stringify({ email })
|
|
3428
3436
|
});
|
|
3437
|
+
const data = await parseJsonResponse(response);
|
|
3438
|
+
return { status: response.status, data };
|
|
3429
3439
|
}
|
|
3430
|
-
function
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3440
|
+
async function usrActivity(code, ty, bl = "", tx = "") {
|
|
3441
|
+
const params = { code, ty };
|
|
3442
|
+
if (bl) {
|
|
3443
|
+
params.bl = bl;
|
|
3444
|
+
}
|
|
3445
|
+
if (tx) {
|
|
3446
|
+
params.tx = tx;
|
|
3447
|
+
}
|
|
3448
|
+
const fetchApi = getBoundFetch();
|
|
3449
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/usr-activity", {
|
|
3450
|
+
method: "POST",
|
|
3451
|
+
headers: {
|
|
3452
|
+
"Content-Type": "application/json"
|
|
3453
|
+
},
|
|
3454
|
+
body: JSON.stringify(params)
|
|
3443
3455
|
});
|
|
3456
|
+
await parseJsonResponse(response);
|
|
3444
3457
|
}
|
|
3445
|
-
function
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
const vestingWithdrawRate = typeof element.vesting_withdraw_rate === "string" ? element.vesting_withdraw_rate : element.vesting_withdraw_rate.toString();
|
|
3466
|
-
const effectiveVest = parseFloat(vestingShares) + parseFloat(receivedVestingShares) - parseFloat(delegatedVestingShares) - parseFloat(vestingWithdrawRate);
|
|
3467
|
-
curator.efficiency = curator.vests / effectiveVest;
|
|
3468
|
-
}
|
|
3469
|
-
data.sort((a, b) => b.efficiency - a.efficiency);
|
|
3470
|
-
return data;
|
|
3471
|
-
}
|
|
3458
|
+
async function getNotifications(code, filter, since = null, user = null) {
|
|
3459
|
+
const data = {
|
|
3460
|
+
code
|
|
3461
|
+
};
|
|
3462
|
+
if (filter) {
|
|
3463
|
+
data.filter = filter;
|
|
3464
|
+
}
|
|
3465
|
+
if (since) {
|
|
3466
|
+
data.since = since;
|
|
3467
|
+
}
|
|
3468
|
+
if (user) {
|
|
3469
|
+
data.user = user;
|
|
3470
|
+
}
|
|
3471
|
+
const fetchApi = getBoundFetch();
|
|
3472
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications", {
|
|
3473
|
+
method: "POST",
|
|
3474
|
+
headers: {
|
|
3475
|
+
"Content-Type": "application/json"
|
|
3476
|
+
},
|
|
3477
|
+
body: JSON.stringify(data)
|
|
3472
3478
|
});
|
|
3479
|
+
return parseJsonResponse(response);
|
|
3473
3480
|
}
|
|
3474
|
-
function
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
}),
|
|
3489
|
-
signal
|
|
3490
|
-
});
|
|
3491
|
-
if (!response.ok) {
|
|
3492
|
-
throw new Error(`Failed to fetch page stats: ${response.status}`);
|
|
3493
|
-
}
|
|
3494
|
-
return response.json();
|
|
3481
|
+
async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
|
|
3482
|
+
const data = {
|
|
3483
|
+
code,
|
|
3484
|
+
username,
|
|
3485
|
+
token,
|
|
3486
|
+
system,
|
|
3487
|
+
allows_notify,
|
|
3488
|
+
notify_types
|
|
3489
|
+
};
|
|
3490
|
+
const fetchApi = getBoundFetch();
|
|
3491
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/register-device", {
|
|
3492
|
+
method: "POST",
|
|
3493
|
+
headers: {
|
|
3494
|
+
"Content-Type": "application/json"
|
|
3495
3495
|
},
|
|
3496
|
-
|
|
3496
|
+
body: JSON.stringify(data)
|
|
3497
3497
|
});
|
|
3498
|
+
return parseJsonResponse(response);
|
|
3498
3499
|
}
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3500
|
+
async function getNotificationSetting(code, username, token) {
|
|
3501
|
+
const data = { code, username, token };
|
|
3502
|
+
const fetchApi = getBoundFetch();
|
|
3503
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/detail-device", {
|
|
3504
|
+
method: "POST",
|
|
3505
|
+
headers: {
|
|
3506
|
+
"Content-Type": "application/json"
|
|
3507
|
+
},
|
|
3508
|
+
body: JSON.stringify(data)
|
|
3509
|
+
});
|
|
3510
|
+
return parseJsonResponse(response);
|
|
3511
|
+
}
|
|
3512
|
+
async function markNotifications(code, id) {
|
|
3513
|
+
const data = {
|
|
3514
|
+
code
|
|
3515
|
+
};
|
|
3516
|
+
if (id) {
|
|
3517
|
+
data.id = id;
|
|
3518
|
+
}
|
|
3519
|
+
const fetchApi = getBoundFetch();
|
|
3520
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications/mark", {
|
|
3521
|
+
method: "POST",
|
|
3522
|
+
headers: {
|
|
3523
|
+
"Content-Type": "application/json"
|
|
3524
|
+
},
|
|
3525
|
+
body: JSON.stringify(data)
|
|
3526
|
+
});
|
|
3527
|
+
return parseJsonResponse(response);
|
|
3528
|
+
}
|
|
3529
|
+
async function addImage(code, url) {
|
|
3530
|
+
const data = { code, url };
|
|
3531
|
+
const fetchApi = getBoundFetch();
|
|
3532
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-add", {
|
|
3533
|
+
method: "POST",
|
|
3534
|
+
headers: {
|
|
3535
|
+
"Content-Type": "application/json"
|
|
3536
|
+
},
|
|
3537
|
+
body: JSON.stringify(data)
|
|
3538
|
+
});
|
|
3539
|
+
return parseJsonResponse(response);
|
|
3540
|
+
}
|
|
3541
|
+
async function uploadImage(file, token, signal) {
|
|
3542
|
+
const fetchApi = getBoundFetch();
|
|
3543
|
+
const formData = new FormData();
|
|
3544
|
+
formData.append("file", file);
|
|
3545
|
+
const response = await fetchApi(`${CONFIG.imageHost}/hs/${token}`, {
|
|
3546
|
+
method: "POST",
|
|
3547
|
+
body: formData,
|
|
3548
|
+
signal
|
|
3549
|
+
});
|
|
3550
|
+
return parseJsonResponse(response);
|
|
3551
|
+
}
|
|
3552
|
+
async function deleteImage(code, imageId) {
|
|
3553
|
+
const data = { code, id: imageId };
|
|
3554
|
+
const fetchApi = getBoundFetch();
|
|
3555
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/images-delete", {
|
|
3556
|
+
method: "POST",
|
|
3557
|
+
headers: {
|
|
3558
|
+
"Content-Type": "application/json"
|
|
3559
|
+
},
|
|
3560
|
+
body: JSON.stringify(data)
|
|
3561
|
+
});
|
|
3562
|
+
return parseJsonResponse(response);
|
|
3563
|
+
}
|
|
3564
|
+
async function addDraft(code, title, body, tags, meta) {
|
|
3565
|
+
const data = { code, title, body, tags, meta };
|
|
3566
|
+
const fetchApi = getBoundFetch();
|
|
3567
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-add", {
|
|
3568
|
+
method: "POST",
|
|
3569
|
+
headers: {
|
|
3570
|
+
"Content-Type": "application/json"
|
|
3571
|
+
},
|
|
3572
|
+
body: JSON.stringify(data)
|
|
3573
|
+
});
|
|
3574
|
+
return parseJsonResponse(response);
|
|
3575
|
+
}
|
|
3576
|
+
async function updateDraft(code, draftId, title, body, tags, meta) {
|
|
3577
|
+
const data = { code, id: draftId, title, body, tags, meta };
|
|
3578
|
+
const fetchApi = getBoundFetch();
|
|
3579
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-update", {
|
|
3580
|
+
method: "POST",
|
|
3581
|
+
headers: {
|
|
3582
|
+
"Content-Type": "application/json"
|
|
3583
|
+
},
|
|
3584
|
+
body: JSON.stringify(data)
|
|
3585
|
+
});
|
|
3586
|
+
return parseJsonResponse(response);
|
|
3587
|
+
}
|
|
3588
|
+
async function deleteDraft(code, draftId) {
|
|
3589
|
+
const data = { code, id: draftId };
|
|
3590
|
+
const fetchApi = getBoundFetch();
|
|
3591
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/drafts-delete", {
|
|
3592
|
+
method: "POST",
|
|
3593
|
+
headers: {
|
|
3594
|
+
"Content-Type": "application/json"
|
|
3595
|
+
},
|
|
3596
|
+
body: JSON.stringify(data)
|
|
3597
|
+
});
|
|
3598
|
+
return parseJsonResponse(response);
|
|
3599
|
+
}
|
|
3600
|
+
async function addSchedule(code, permlink, title, body, meta, options, schedule, reblog) {
|
|
3601
|
+
const data = {
|
|
3602
|
+
code,
|
|
3603
|
+
permlink,
|
|
3604
|
+
title,
|
|
3605
|
+
body,
|
|
3606
|
+
meta,
|
|
3607
|
+
schedule,
|
|
3608
|
+
reblog
|
|
3609
|
+
};
|
|
3610
|
+
if (options) {
|
|
3611
|
+
data.options = options;
|
|
3612
|
+
}
|
|
3613
|
+
const fetchApi = getBoundFetch();
|
|
3614
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-add", {
|
|
3615
|
+
method: "POST",
|
|
3616
|
+
headers: {
|
|
3617
|
+
"Content-Type": "application/json"
|
|
3618
|
+
},
|
|
3619
|
+
body: JSON.stringify(data)
|
|
3620
|
+
});
|
|
3621
|
+
return parseJsonResponse(response);
|
|
3622
|
+
}
|
|
3623
|
+
async function deleteSchedule(code, id) {
|
|
3624
|
+
const data = { code, id };
|
|
3625
|
+
const fetchApi = getBoundFetch();
|
|
3626
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-delete", {
|
|
3627
|
+
method: "POST",
|
|
3628
|
+
headers: {
|
|
3629
|
+
"Content-Type": "application/json"
|
|
3630
|
+
},
|
|
3631
|
+
body: JSON.stringify(data)
|
|
3632
|
+
});
|
|
3633
|
+
return parseJsonResponse(response);
|
|
3634
|
+
}
|
|
3635
|
+
async function moveSchedule(code, id) {
|
|
3636
|
+
const data = { code, id };
|
|
3637
|
+
const fetchApi = getBoundFetch();
|
|
3638
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/schedules-move", {
|
|
3639
|
+
method: "POST",
|
|
3640
|
+
headers: {
|
|
3641
|
+
"Content-Type": "application/json"
|
|
3642
|
+
},
|
|
3643
|
+
body: JSON.stringify(data)
|
|
3644
|
+
});
|
|
3645
|
+
return parseJsonResponse(response);
|
|
3646
|
+
}
|
|
3647
|
+
async function getPromotedPost(code, author, permlink) {
|
|
3648
|
+
const data = { code, author, permlink };
|
|
3649
|
+
const fetchApi = getBoundFetch();
|
|
3650
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/promoted-post", {
|
|
3651
|
+
method: "POST",
|
|
3652
|
+
headers: {
|
|
3653
|
+
"Content-Type": "application/json"
|
|
3654
|
+
},
|
|
3655
|
+
body: JSON.stringify(data)
|
|
3656
|
+
});
|
|
3657
|
+
return parseJsonResponse(response);
|
|
3658
|
+
}
|
|
3659
|
+
async function onboardEmail(username, email, friend) {
|
|
3660
|
+
const dataBody = {
|
|
3661
|
+
username,
|
|
3662
|
+
email,
|
|
3663
|
+
friend
|
|
3664
|
+
};
|
|
3665
|
+
const fetchApi = getBoundFetch();
|
|
3666
|
+
const response = await fetchApi(
|
|
3667
|
+
CONFIG.privateApiHost + "/private-api/account-create-friend",
|
|
3668
|
+
{
|
|
3669
|
+
method: "POST",
|
|
3670
|
+
headers: {
|
|
3671
|
+
"Content-Type": "application/json"
|
|
3672
|
+
},
|
|
3673
|
+
body: JSON.stringify(dataBody)
|
|
3674
|
+
}
|
|
3675
|
+
);
|
|
3676
|
+
return parseJsonResponse(response);
|
|
3677
|
+
}
|
|
3678
|
+
|
|
3679
|
+
// src/modules/posts/mutations/use-add-draft.ts
|
|
3680
|
+
function useAddDraft(username, code, onSuccess, onError) {
|
|
3681
|
+
return useMutation({
|
|
3682
|
+
mutationKey: ["posts", "drafts", "add", username],
|
|
3683
|
+
mutationFn: async ({
|
|
3684
|
+
title,
|
|
3685
|
+
body,
|
|
3686
|
+
tags,
|
|
3687
|
+
meta
|
|
3688
|
+
}) => {
|
|
3689
|
+
if (!username || !code) {
|
|
3690
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for addDraft");
|
|
3691
|
+
}
|
|
3692
|
+
return addDraft(code, title, body, tags, meta);
|
|
3693
|
+
},
|
|
3694
|
+
onSuccess: () => {
|
|
3695
|
+
onSuccess?.();
|
|
3696
|
+
getQueryClient().invalidateQueries({
|
|
3697
|
+
queryKey: ["posts", "drafts", username]
|
|
3698
|
+
});
|
|
3699
|
+
},
|
|
3700
|
+
onError
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
function useUpdateDraft(username, code, onSuccess, onError) {
|
|
3704
|
+
return useMutation({
|
|
3705
|
+
mutationKey: ["posts", "drafts", "update", username],
|
|
3706
|
+
mutationFn: async ({
|
|
3707
|
+
draftId,
|
|
3708
|
+
title,
|
|
3709
|
+
body,
|
|
3710
|
+
tags,
|
|
3711
|
+
meta
|
|
3712
|
+
}) => {
|
|
3713
|
+
if (!username || !code) {
|
|
3714
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for updateDraft");
|
|
3715
|
+
}
|
|
3716
|
+
return updateDraft(code, draftId, title, body, tags, meta);
|
|
3717
|
+
},
|
|
3718
|
+
onSuccess: () => {
|
|
3719
|
+
onSuccess?.();
|
|
3720
|
+
getQueryClient().invalidateQueries({
|
|
3721
|
+
queryKey: ["posts", "drafts", username]
|
|
3722
|
+
});
|
|
3723
|
+
},
|
|
3724
|
+
onError
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
function useDeleteDraft(username, code, onSuccess, onError) {
|
|
3728
|
+
return useMutation({
|
|
3729
|
+
mutationKey: ["posts", "drafts", "delete", username],
|
|
3730
|
+
mutationFn: async ({ draftId }) => {
|
|
3731
|
+
if (!username || !code) {
|
|
3732
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for deleteDraft");
|
|
3733
|
+
}
|
|
3734
|
+
return deleteDraft(code, draftId);
|
|
3735
|
+
},
|
|
3736
|
+
onSuccess: () => {
|
|
3737
|
+
onSuccess?.();
|
|
3738
|
+
getQueryClient().invalidateQueries({
|
|
3739
|
+
queryKey: ["posts", "drafts", username]
|
|
3740
|
+
});
|
|
3741
|
+
},
|
|
3742
|
+
onError
|
|
3743
|
+
});
|
|
3744
|
+
}
|
|
3745
|
+
function useAddSchedule(username, code, onSuccess, onError) {
|
|
3746
|
+
return useMutation({
|
|
3747
|
+
mutationKey: ["posts", "schedules", "add", username],
|
|
3748
|
+
mutationFn: async ({
|
|
3749
|
+
permlink,
|
|
3750
|
+
title,
|
|
3751
|
+
body,
|
|
3752
|
+
meta,
|
|
3753
|
+
options,
|
|
3754
|
+
schedule,
|
|
3755
|
+
reblog
|
|
3756
|
+
}) => {
|
|
3757
|
+
if (!username || !code) {
|
|
3758
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for addSchedule");
|
|
3759
|
+
}
|
|
3760
|
+
return addSchedule(code, permlink, title, body, meta, options, schedule, reblog);
|
|
3761
|
+
},
|
|
3762
|
+
onSuccess: () => {
|
|
3763
|
+
onSuccess?.();
|
|
3764
|
+
getQueryClient().invalidateQueries({
|
|
3765
|
+
queryKey: ["posts", "schedules", username]
|
|
3766
|
+
});
|
|
3767
|
+
},
|
|
3768
|
+
onError
|
|
3769
|
+
});
|
|
3770
|
+
}
|
|
3771
|
+
function useDeleteSchedule(username, code, onSuccess, onError) {
|
|
3772
|
+
return useMutation({
|
|
3773
|
+
mutationKey: ["posts", "schedules", "delete", username],
|
|
3774
|
+
mutationFn: async ({ id }) => {
|
|
3775
|
+
if (!username || !code) {
|
|
3776
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for deleteSchedule");
|
|
3777
|
+
}
|
|
3778
|
+
return deleteSchedule(code, id);
|
|
3779
|
+
},
|
|
3780
|
+
onSuccess: () => {
|
|
3781
|
+
onSuccess?.();
|
|
3782
|
+
getQueryClient().invalidateQueries({
|
|
3783
|
+
queryKey: ["posts", "schedules", username]
|
|
3784
|
+
});
|
|
3785
|
+
},
|
|
3786
|
+
onError
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
function useMoveSchedule(username, code, onSuccess, onError) {
|
|
3790
|
+
return useMutation({
|
|
3791
|
+
mutationKey: ["posts", "schedules", "move", username],
|
|
3792
|
+
mutationFn: async ({ id }) => {
|
|
3793
|
+
if (!username || !code) {
|
|
3794
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for moveSchedule");
|
|
3795
|
+
}
|
|
3796
|
+
return moveSchedule(code, id);
|
|
3797
|
+
},
|
|
3798
|
+
onSuccess: () => {
|
|
3799
|
+
onSuccess?.();
|
|
3800
|
+
getQueryClient().invalidateQueries({
|
|
3801
|
+
queryKey: ["posts", "schedules", username]
|
|
3802
|
+
});
|
|
3803
|
+
getQueryClient().invalidateQueries({
|
|
3804
|
+
queryKey: ["posts", "drafts", username]
|
|
3805
|
+
});
|
|
3806
|
+
},
|
|
3807
|
+
onError
|
|
3808
|
+
});
|
|
3809
|
+
}
|
|
3810
|
+
function useAddImage(username, code, onSuccess, onError) {
|
|
3811
|
+
return useMutation({
|
|
3812
|
+
mutationKey: ["posts", "images", "add", username],
|
|
3813
|
+
mutationFn: async ({ url }) => {
|
|
3814
|
+
if (!username || !code) {
|
|
3815
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for addImage");
|
|
3816
|
+
}
|
|
3817
|
+
return addImage(code, url);
|
|
3818
|
+
},
|
|
3819
|
+
onSuccess: () => {
|
|
3820
|
+
onSuccess?.();
|
|
3821
|
+
getQueryClient().invalidateQueries({
|
|
3822
|
+
queryKey: ["posts", "images", username]
|
|
3823
|
+
});
|
|
3824
|
+
},
|
|
3825
|
+
onError
|
|
3826
|
+
});
|
|
3827
|
+
}
|
|
3828
|
+
function useDeleteImage(username, code, onSuccess, onError) {
|
|
3829
|
+
return useMutation({
|
|
3830
|
+
mutationKey: ["posts", "images", "delete", username],
|
|
3831
|
+
mutationFn: async ({ imageId }) => {
|
|
3832
|
+
if (!username || !code) {
|
|
3833
|
+
throw new Error("[SDK][Posts] \u2013 missing auth for deleteImage");
|
|
3834
|
+
}
|
|
3835
|
+
return deleteImage(code, imageId);
|
|
3836
|
+
},
|
|
3837
|
+
onSuccess: () => {
|
|
3838
|
+
onSuccess?.();
|
|
3839
|
+
getQueryClient().invalidateQueries({
|
|
3840
|
+
queryKey: ["posts", "images", username]
|
|
3841
|
+
});
|
|
3842
|
+
},
|
|
3843
|
+
onError
|
|
3844
|
+
});
|
|
3845
|
+
}
|
|
3846
|
+
function useUploadImage(onSuccess, onError) {
|
|
3847
|
+
return useMutation({
|
|
3848
|
+
mutationKey: ["posts", "images", "upload"],
|
|
3849
|
+
mutationFn: async ({
|
|
3850
|
+
file,
|
|
3851
|
+
token,
|
|
3852
|
+
signal
|
|
3853
|
+
}) => {
|
|
3854
|
+
return uploadImage(file, token, signal);
|
|
3855
|
+
},
|
|
3856
|
+
onSuccess,
|
|
3857
|
+
onError
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
// src/modules/posts/utils/validate-post-creating.ts
|
|
3862
|
+
var DEFAULT_VALIDATE_POST_DELAYS = [3e3, 3e3, 3e3];
|
|
3863
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3864
|
+
async function getContent(author, permlink) {
|
|
3865
|
+
return CONFIG.hiveClient.call("condenser_api", "get_content", [
|
|
3866
|
+
author,
|
|
3867
|
+
permlink
|
|
3868
|
+
]);
|
|
3869
|
+
}
|
|
3870
|
+
async function validatePostCreating(author, permlink, attempts = 0, options) {
|
|
3871
|
+
const delays = options?.delays ?? DEFAULT_VALIDATE_POST_DELAYS;
|
|
3872
|
+
let response;
|
|
3873
|
+
try {
|
|
3874
|
+
response = await getContent(author, permlink);
|
|
3875
|
+
} catch (e) {
|
|
3876
|
+
response = void 0;
|
|
3877
|
+
}
|
|
3878
|
+
if (response || attempts >= delays.length) {
|
|
3879
|
+
return;
|
|
3880
|
+
}
|
|
3881
|
+
const waitMs = delays[attempts];
|
|
3882
|
+
if (waitMs > 0) {
|
|
3883
|
+
await delay(waitMs);
|
|
3884
|
+
}
|
|
3885
|
+
return validatePostCreating(author, permlink, attempts + 1, options);
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
// src/modules/analytics/mutations/index.ts
|
|
3889
|
+
var mutations_exports = {};
|
|
3890
|
+
__export(mutations_exports, {
|
|
3891
|
+
useRecordActivity: () => useRecordActivity
|
|
3892
|
+
});
|
|
3893
|
+
function getLocationInfo() {
|
|
3894
|
+
if (typeof window !== "undefined" && window.location) {
|
|
3895
|
+
return {
|
|
3896
|
+
url: window.location.href,
|
|
3897
|
+
domain: window.location.host
|
|
3898
|
+
};
|
|
3899
|
+
}
|
|
3900
|
+
return { url: "", domain: "" };
|
|
3901
|
+
}
|
|
3902
|
+
function useRecordActivity(username, activityType, options) {
|
|
3903
|
+
return useMutation({
|
|
3904
|
+
mutationKey: ["analytics", activityType],
|
|
3905
|
+
mutationFn: async () => {
|
|
3906
|
+
if (!activityType) {
|
|
3907
|
+
throw new Error("[SDK][Analytics] \u2013 no activity type provided");
|
|
3908
|
+
}
|
|
3909
|
+
const fetchApi = getBoundFetch();
|
|
3910
|
+
const locationInfo = getLocationInfo();
|
|
3911
|
+
const url = options?.url ?? locationInfo.url;
|
|
3912
|
+
const domain = options?.domain ?? locationInfo.domain;
|
|
3913
|
+
await fetchApi(CONFIG.plausibleHost + "/api/event", {
|
|
3914
|
+
method: "POST",
|
|
3915
|
+
headers: {
|
|
3916
|
+
"Content-Type": "application/json"
|
|
3917
|
+
},
|
|
3918
|
+
body: JSON.stringify({
|
|
3919
|
+
name: activityType,
|
|
3920
|
+
url,
|
|
3921
|
+
domain,
|
|
3922
|
+
props: {
|
|
3923
|
+
username
|
|
3924
|
+
}
|
|
3925
|
+
})
|
|
3926
|
+
});
|
|
3927
|
+
}
|
|
3928
|
+
});
|
|
3929
|
+
}
|
|
3930
|
+
function getDiscoverLeaderboardQueryOptions(duration) {
|
|
3931
|
+
return queryOptions({
|
|
3932
|
+
queryKey: ["analytics", "discover-leaderboard", duration],
|
|
3933
|
+
queryFn: async ({ signal }) => {
|
|
3934
|
+
const response = await fetch(
|
|
3935
|
+
CONFIG.privateApiHost + `/private-api/leaderboard/${duration}`,
|
|
3936
|
+
{ signal }
|
|
3937
|
+
);
|
|
3938
|
+
if (!response.ok) {
|
|
3939
|
+
throw new Error(`Failed to fetch leaderboard: ${response.status}`);
|
|
3940
|
+
}
|
|
3941
|
+
return response.json();
|
|
3942
|
+
}
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
function getDiscoverCurationQueryOptions(duration) {
|
|
3946
|
+
return queryOptions({
|
|
3947
|
+
queryKey: ["analytics", "discover-curation", duration],
|
|
3948
|
+
queryFn: async ({ signal }) => {
|
|
3949
|
+
const response = await fetch(
|
|
3950
|
+
CONFIG.privateApiHost + `/private-api/curation/${duration}`,
|
|
3951
|
+
{ signal }
|
|
3952
|
+
);
|
|
3953
|
+
if (!response.ok) {
|
|
3954
|
+
throw new Error(`Failed to fetch curation data: ${response.status}`);
|
|
3955
|
+
}
|
|
3956
|
+
const data = await response.json();
|
|
3957
|
+
const accounts = data.map((item) => item.account);
|
|
3958
|
+
const accountsResponse = await CONFIG.hiveClient.database.getAccounts(accounts);
|
|
3959
|
+
for (let index = 0; index < accountsResponse.length; index++) {
|
|
3960
|
+
const element = accountsResponse[index];
|
|
3961
|
+
const curator = data[index];
|
|
3962
|
+
const vestingShares = typeof element.vesting_shares === "string" ? element.vesting_shares : element.vesting_shares.toString();
|
|
3963
|
+
const receivedVestingShares = typeof element.received_vesting_shares === "string" ? element.received_vesting_shares : element.received_vesting_shares.toString();
|
|
3964
|
+
const delegatedVestingShares = typeof element.delegated_vesting_shares === "string" ? element.delegated_vesting_shares : element.delegated_vesting_shares.toString();
|
|
3965
|
+
const vestingWithdrawRate = typeof element.vesting_withdraw_rate === "string" ? element.vesting_withdraw_rate : element.vesting_withdraw_rate.toString();
|
|
3966
|
+
const effectiveVest = parseFloat(vestingShares) + parseFloat(receivedVestingShares) - parseFloat(delegatedVestingShares) - parseFloat(vestingWithdrawRate);
|
|
3967
|
+
curator.efficiency = curator.vests / effectiveVest;
|
|
3968
|
+
}
|
|
3969
|
+
data.sort((a, b) => b.efficiency - a.efficiency);
|
|
3970
|
+
return data;
|
|
3971
|
+
}
|
|
3972
|
+
});
|
|
3973
|
+
}
|
|
3974
|
+
function getPageStatsQueryOptions(url, dimensions = [], metrics = ["visitors", "pageviews", "visit_duration"], dateRange) {
|
|
3975
|
+
return queryOptions({
|
|
3976
|
+
queryKey: ["analytics", "page-stats", url, dimensions, metrics, dateRange],
|
|
3977
|
+
queryFn: async ({ signal }) => {
|
|
3978
|
+
const response = await fetch(CONFIG.privateApiHost + "/api/stats", {
|
|
3979
|
+
method: "POST",
|
|
3980
|
+
headers: {
|
|
3981
|
+
"Content-Type": "application/json"
|
|
3982
|
+
},
|
|
3983
|
+
body: JSON.stringify({
|
|
3984
|
+
metrics,
|
|
3985
|
+
url: encodeURIComponent(url),
|
|
3986
|
+
dimensions,
|
|
3987
|
+
date_range: dateRange
|
|
3988
|
+
}),
|
|
3989
|
+
signal
|
|
3990
|
+
});
|
|
3991
|
+
if (!response.ok) {
|
|
3992
|
+
throw new Error(`Failed to fetch page stats: ${response.status}`);
|
|
3993
|
+
}
|
|
3994
|
+
return response.json();
|
|
3995
|
+
},
|
|
3996
|
+
enabled: !!url
|
|
3997
|
+
});
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
// src/modules/integrations/3speak/queries/index.ts
|
|
4001
|
+
var queries_exports2 = {};
|
|
4002
|
+
__export(queries_exports2, {
|
|
4003
|
+
getAccountTokenQueryOptions: () => getAccountTokenQueryOptions,
|
|
4004
|
+
getAccountVideosQueryOptions: () => getAccountVideosQueryOptions
|
|
4005
|
+
});
|
|
4006
|
+
|
|
4007
|
+
// src/modules/integrations/hivesigner/queries/index.ts
|
|
4008
|
+
var queries_exports = {};
|
|
4009
|
+
__export(queries_exports, {
|
|
4010
|
+
getDecodeMemoQueryOptions: () => getDecodeMemoQueryOptions
|
|
4011
|
+
});
|
|
4012
|
+
function getDecodeMemoQueryOptions(username, memo, accessToken) {
|
|
4013
|
+
return queryOptions({
|
|
4014
|
+
queryKey: ["integrations", "hivesigner", "decode-memo", username],
|
|
4015
|
+
queryFn: async () => {
|
|
4016
|
+
if (accessToken) {
|
|
4017
|
+
const hsClient = new hs.Client({
|
|
4018
|
+
accessToken
|
|
3519
4019
|
});
|
|
3520
4020
|
return hsClient.decode(memo);
|
|
3521
4021
|
}
|
|
@@ -4072,6 +4572,63 @@ function getAnnouncementsQueryOptions() {
|
|
|
4072
4572
|
staleTime: 36e5
|
|
4073
4573
|
});
|
|
4074
4574
|
}
|
|
4575
|
+
function useMarkNotificationsRead(username, code, onSuccess, onError) {
|
|
4576
|
+
const queryClient = getQueryClient();
|
|
4577
|
+
return useMutation({
|
|
4578
|
+
mutationKey: ["notifications", "mark-read", username],
|
|
4579
|
+
mutationFn: async ({ id }) => {
|
|
4580
|
+
if (!username || !code) {
|
|
4581
|
+
throw new Error("[SDK][Notifications] \u2013 missing auth for markNotifications");
|
|
4582
|
+
}
|
|
4583
|
+
return markNotifications(code, id);
|
|
4584
|
+
},
|
|
4585
|
+
// Optimistic update: Immediately mark notifications as read in cache
|
|
4586
|
+
onMutate: async ({ id }) => {
|
|
4587
|
+
await queryClient.cancelQueries({ queryKey: ["notifications"] });
|
|
4588
|
+
const previousNotifications = [];
|
|
4589
|
+
const queriesData = queryClient.getQueriesData({
|
|
4590
|
+
queryKey: ["notifications"]
|
|
4591
|
+
});
|
|
4592
|
+
queriesData.forEach(([queryKey, data]) => {
|
|
4593
|
+
if (data) {
|
|
4594
|
+
previousNotifications.push([queryKey, data]);
|
|
4595
|
+
const updatedData = data.map((item) => ({
|
|
4596
|
+
...item,
|
|
4597
|
+
// If specific ID provided: mark only that notification
|
|
4598
|
+
// If no ID (mark all): mark ALL notifications
|
|
4599
|
+
read: !id || id === item.id ? 1 : item.read
|
|
4600
|
+
}));
|
|
4601
|
+
queryClient.setQueryData(queryKey, updatedData);
|
|
4602
|
+
}
|
|
4603
|
+
});
|
|
4604
|
+
return { previousNotifications };
|
|
4605
|
+
},
|
|
4606
|
+
onSuccess: (response, variables) => {
|
|
4607
|
+
const unreadCount = typeof response === "object" && response !== null ? response.unread : void 0;
|
|
4608
|
+
onSuccess?.(unreadCount);
|
|
4609
|
+
if (!variables.id) {
|
|
4610
|
+
queryClient.invalidateQueries({
|
|
4611
|
+
queryKey: ["notifications"]
|
|
4612
|
+
});
|
|
4613
|
+
}
|
|
4614
|
+
},
|
|
4615
|
+
// Rollback optimistic update on error
|
|
4616
|
+
onError: (error, _variables, context) => {
|
|
4617
|
+
if (context?.previousNotifications) {
|
|
4618
|
+
context.previousNotifications.forEach(([queryKey, data]) => {
|
|
4619
|
+
queryClient.setQueryData(queryKey, data);
|
|
4620
|
+
});
|
|
4621
|
+
}
|
|
4622
|
+
onError?.(error);
|
|
4623
|
+
},
|
|
4624
|
+
// Always refetch after mutation settles
|
|
4625
|
+
onSettled: () => {
|
|
4626
|
+
queryClient.invalidateQueries({
|
|
4627
|
+
queryKey: ["notifications"]
|
|
4628
|
+
});
|
|
4629
|
+
}
|
|
4630
|
+
});
|
|
4631
|
+
}
|
|
4075
4632
|
function getProposalQueryOptions(id) {
|
|
4076
4633
|
return queryOptions({
|
|
4077
4634
|
queryKey: ["proposals", "proposal", id],
|
|
@@ -4101,930 +4658,654 @@ function getProposalsQueryOptions() {
|
|
|
4101
4658
|
status: "all"
|
|
4102
4659
|
});
|
|
4103
4660
|
const proposals = response.proposals;
|
|
4104
|
-
const expired = proposals.filter((x) => x.status === "expired");
|
|
4105
|
-
const others = proposals.filter((x) => x.status !== "expired");
|
|
4106
|
-
return [...others, ...expired];
|
|
4107
|
-
}
|
|
4108
|
-
});
|
|
4109
|
-
}
|
|
4110
|
-
function getProposalVotesInfiniteQueryOptions(proposalId, voter, limit) {
|
|
4111
|
-
return infiniteQueryOptions({
|
|
4112
|
-
queryKey: ["proposals", "votes", proposalId, voter, limit],
|
|
4113
|
-
initialPageParam: voter,
|
|
4114
|
-
refetchOnMount: true,
|
|
4115
|
-
staleTime: 0,
|
|
4116
|
-
// Always refetch on mount
|
|
4117
|
-
queryFn: async ({ pageParam }) => {
|
|
4118
|
-
const startParam = pageParam ?? voter;
|
|
4119
|
-
const response = await CONFIG.hiveClient.call("condenser_api", "list_proposal_votes", [
|
|
4120
|
-
[proposalId, startParam],
|
|
4121
|
-
limit,
|
|
4122
|
-
"by_proposal_voter"
|
|
4123
|
-
]);
|
|
4124
|
-
const list = response.filter((x) => x.proposal?.proposal_id === proposalId).map((x) => ({ id: x.id, voter: x.voter }));
|
|
4125
|
-
const rawAccounts = await CONFIG.hiveClient.database.getAccounts(list.map((l) => l.voter));
|
|
4126
|
-
const accounts = parseAccounts(rawAccounts);
|
|
4127
|
-
const page = list.map((i) => ({
|
|
4128
|
-
...i,
|
|
4129
|
-
voterAccount: accounts.find((a) => i.voter === a.name)
|
|
4130
|
-
}));
|
|
4131
|
-
return page;
|
|
4132
|
-
},
|
|
4133
|
-
getNextPageParam: (lastPage) => {
|
|
4134
|
-
const last = lastPage?.[lastPage.length - 1];
|
|
4135
|
-
return last?.voter ?? void 0;
|
|
4136
|
-
}
|
|
4137
|
-
});
|
|
4138
|
-
}
|
|
4139
|
-
function getUserProposalVotesQueryOptions(voter) {
|
|
4140
|
-
return queryOptions({
|
|
4141
|
-
queryKey: ["proposals", "votes", "by-user", voter],
|
|
4142
|
-
enabled: !!voter && voter !== "",
|
|
4143
|
-
staleTime: 60 * 1e3,
|
|
4144
|
-
// Cache for 1 minute
|
|
4145
|
-
queryFn: async () => {
|
|
4146
|
-
if (!voter || voter === "") {
|
|
4147
|
-
return [];
|
|
4148
|
-
}
|
|
4149
|
-
const response = await CONFIG.hiveClient.call("database_api", "list_proposal_votes", {
|
|
4150
|
-
start: [voter],
|
|
4151
|
-
limit: 1e3,
|
|
4152
|
-
order: "by_voter_proposal",
|
|
4153
|
-
order_direction: "ascending",
|
|
4154
|
-
status: "votable"
|
|
4155
|
-
});
|
|
4156
|
-
const userVotes = (response.proposal_votes || []).filter((vote) => vote.voter === voter);
|
|
4157
|
-
return userVotes;
|
|
4158
|
-
}
|
|
4159
|
-
});
|
|
4160
|
-
}
|
|
4161
|
-
function getVestingDelegationsQueryOptions(username, from, limit = 50) {
|
|
4162
|
-
return queryOptions({
|
|
4163
|
-
queryKey: ["wallet", "vesting-delegations", username, from, limit],
|
|
4164
|
-
queryFn: () => CONFIG.hiveClient.database.call("get_vesting_delegations", [
|
|
4165
|
-
username,
|
|
4166
|
-
from,
|
|
4167
|
-
limit
|
|
4168
|
-
]),
|
|
4169
|
-
enabled: !!username
|
|
4170
|
-
});
|
|
4171
|
-
}
|
|
4172
|
-
function getConversionRequestsQueryOptions(account) {
|
|
4173
|
-
return queryOptions({
|
|
4174
|
-
queryKey: ["wallet", "conversion-requests", account],
|
|
4175
|
-
queryFn: () => CONFIG.hiveClient.database.call("get_conversion_requests", [
|
|
4176
|
-
account
|
|
4177
|
-
]),
|
|
4178
|
-
select: (data) => data.sort((a, b) => a.requestid - b.requestid)
|
|
4179
|
-
});
|
|
4180
|
-
}
|
|
4181
|
-
function getCollateralizedConversionRequestsQueryOptions(account) {
|
|
4182
|
-
return queryOptions({
|
|
4183
|
-
queryKey: ["wallet", "collateralized-conversion-requests", account],
|
|
4184
|
-
queryFn: () => CONFIG.hiveClient.database.call("get_collateralized_conversion_requests", [
|
|
4185
|
-
account
|
|
4186
|
-
]),
|
|
4187
|
-
select: (data) => data.sort((a, b) => a.requestid - b.requestid)
|
|
4188
|
-
});
|
|
4189
|
-
}
|
|
4190
|
-
function getSavingsWithdrawFromQueryOptions(account) {
|
|
4191
|
-
return queryOptions({
|
|
4192
|
-
queryKey: ["wallet", "savings-withdraw", account],
|
|
4193
|
-
queryFn: () => CONFIG.hiveClient.database.call("get_savings_withdraw_from", [
|
|
4194
|
-
account
|
|
4195
|
-
]),
|
|
4196
|
-
select: (data) => data.sort((a, b) => a.request_id - b.request_id)
|
|
4197
|
-
});
|
|
4198
|
-
}
|
|
4199
|
-
function getWithdrawRoutesQueryOptions(account) {
|
|
4200
|
-
return queryOptions({
|
|
4201
|
-
queryKey: ["wallet", "withdraw-routes", account],
|
|
4202
|
-
queryFn: () => CONFIG.hiveClient.database.call("get_withdraw_routes", [
|
|
4203
|
-
account,
|
|
4204
|
-
"outgoing"
|
|
4205
|
-
])
|
|
4206
|
-
});
|
|
4207
|
-
}
|
|
4208
|
-
function getOpenOrdersQueryOptions(user) {
|
|
4209
|
-
return queryOptions({
|
|
4210
|
-
queryKey: ["wallet", "open-orders", user],
|
|
4211
|
-
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_open_orders", [
|
|
4212
|
-
user
|
|
4213
|
-
]),
|
|
4214
|
-
select: (data) => data.sort((a, b) => a.orderid - b.orderid),
|
|
4215
|
-
enabled: !!user
|
|
4216
|
-
});
|
|
4217
|
-
}
|
|
4218
|
-
function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
|
|
4219
|
-
return infiniteQueryOptions({
|
|
4220
|
-
queryKey: ["wallet", "outgoing-rc-delegations", username, limit],
|
|
4221
|
-
initialPageParam: null,
|
|
4222
|
-
queryFn: async ({ pageParam }) => {
|
|
4223
|
-
const response = await CONFIG.hiveClient.call("rc_api", "list_rc_direct_delegations", {
|
|
4224
|
-
start: [username, pageParam ?? ""],
|
|
4225
|
-
limit
|
|
4226
|
-
}).then((r) => r);
|
|
4227
|
-
let delegations = response.rc_direct_delegations || [];
|
|
4228
|
-
if (pageParam) {
|
|
4229
|
-
delegations = delegations.filter((delegation) => delegation.to !== pageParam);
|
|
4230
|
-
}
|
|
4231
|
-
return delegations;
|
|
4232
|
-
},
|
|
4233
|
-
getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
|
|
4234
|
-
});
|
|
4235
|
-
}
|
|
4236
|
-
function getIncomingRcQueryOptions(username) {
|
|
4237
|
-
return queryOptions({
|
|
4238
|
-
queryKey: ["wallet", "incoming-rc", username],
|
|
4239
|
-
enabled: !!username,
|
|
4240
|
-
queryFn: async () => {
|
|
4241
|
-
if (!username) {
|
|
4242
|
-
throw new Error("[SDK][Wallet] - Missing username for incoming RC");
|
|
4243
|
-
}
|
|
4244
|
-
const fetchApi = getBoundFetch();
|
|
4245
|
-
const response = await fetchApi(
|
|
4246
|
-
`${CONFIG.privateApiHost}/private-api/received-rc/${username}`
|
|
4247
|
-
);
|
|
4248
|
-
if (!response.ok) {
|
|
4249
|
-
throw new Error(`Failed to fetch incoming RC: ${response.status}`);
|
|
4250
|
-
}
|
|
4251
|
-
return response.json();
|
|
4252
|
-
}
|
|
4253
|
-
});
|
|
4254
|
-
}
|
|
4255
|
-
function getReceivedVestingSharesQueryOptions(username) {
|
|
4256
|
-
return queryOptions({
|
|
4257
|
-
queryKey: ["wallet", "received-vesting-shares", username],
|
|
4258
|
-
queryFn: async () => {
|
|
4259
|
-
const response = await fetch(
|
|
4260
|
-
CONFIG.privateApiHost + `/private-api/received-vesting/${username}`
|
|
4261
|
-
);
|
|
4262
|
-
if (!response.ok) {
|
|
4263
|
-
throw new Error(`Failed to fetch received vesting shares: ${response.status}`);
|
|
4264
|
-
}
|
|
4265
|
-
const data = await response.json();
|
|
4266
|
-
return data.list;
|
|
4661
|
+
const expired = proposals.filter((x) => x.status === "expired");
|
|
4662
|
+
const others = proposals.filter((x) => x.status !== "expired");
|
|
4663
|
+
return [...others, ...expired];
|
|
4267
4664
|
}
|
|
4268
4665
|
});
|
|
4269
4666
|
}
|
|
4270
|
-
function
|
|
4271
|
-
return queryOptions({
|
|
4272
|
-
queryKey: ["wallet", "recurrent-transfers", username],
|
|
4273
|
-
queryFn: () => CONFIG.hiveClient.call("condenser_api", "find_recurrent_transfers", [
|
|
4274
|
-
username
|
|
4275
|
-
]),
|
|
4276
|
-
enabled: !!username
|
|
4277
|
-
});
|
|
4278
|
-
}
|
|
4279
|
-
function getWitnessesInfiniteQueryOptions(limit) {
|
|
4667
|
+
function getProposalVotesInfiniteQueryOptions(proposalId, voter, limit) {
|
|
4280
4668
|
return infiniteQueryOptions({
|
|
4281
|
-
queryKey: ["
|
|
4282
|
-
initialPageParam:
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4669
|
+
queryKey: ["proposals", "votes", proposalId, voter, limit],
|
|
4670
|
+
initialPageParam: voter,
|
|
4671
|
+
refetchOnMount: true,
|
|
4672
|
+
staleTime: 0,
|
|
4673
|
+
// Always refetch on mount
|
|
4674
|
+
queryFn: async ({ pageParam }) => {
|
|
4675
|
+
const startParam = pageParam ?? voter;
|
|
4676
|
+
const response = await CONFIG.hiveClient.call("condenser_api", "list_proposal_votes", [
|
|
4677
|
+
[proposalId, startParam],
|
|
4678
|
+
limit,
|
|
4679
|
+
"by_proposal_voter"
|
|
4680
|
+
]);
|
|
4681
|
+
const list = response.filter((x) => x.proposal?.proposal_id === proposalId).map((x) => ({ id: x.id, voter: x.voter }));
|
|
4682
|
+
const rawAccounts = await CONFIG.hiveClient.database.getAccounts(list.map((l) => l.voter));
|
|
4683
|
+
const accounts = parseAccounts(rawAccounts);
|
|
4684
|
+
const page = list.map((i) => ({
|
|
4685
|
+
...i,
|
|
4686
|
+
voterAccount: accounts.find((a) => i.voter === a.name)
|
|
4687
|
+
}));
|
|
4688
|
+
return page;
|
|
4689
|
+
},
|
|
4287
4690
|
getNextPageParam: (lastPage) => {
|
|
4288
4691
|
const last = lastPage?.[lastPage.length - 1];
|
|
4289
|
-
return last
|
|
4692
|
+
return last?.voter ?? void 0;
|
|
4290
4693
|
}
|
|
4291
4694
|
});
|
|
4292
4695
|
}
|
|
4293
|
-
function
|
|
4294
|
-
return queryOptions({
|
|
4295
|
-
queryKey: ["market", "order-book", limit],
|
|
4296
|
-
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_order_book", [
|
|
4297
|
-
limit
|
|
4298
|
-
])
|
|
4299
|
-
});
|
|
4300
|
-
}
|
|
4301
|
-
function getMarketStatisticsQueryOptions() {
|
|
4696
|
+
function getUserProposalVotesQueryOptions(voter) {
|
|
4302
4697
|
return queryOptions({
|
|
4303
|
-
queryKey: ["
|
|
4304
|
-
|
|
4698
|
+
queryKey: ["proposals", "votes", "by-user", voter],
|
|
4699
|
+
enabled: !!voter && voter !== "",
|
|
4700
|
+
staleTime: 60 * 1e3,
|
|
4701
|
+
// Cache for 1 minute
|
|
4702
|
+
queryFn: async () => {
|
|
4703
|
+
if (!voter || voter === "") {
|
|
4704
|
+
return [];
|
|
4705
|
+
}
|
|
4706
|
+
const response = await CONFIG.hiveClient.call("database_api", "list_proposal_votes", {
|
|
4707
|
+
start: [voter],
|
|
4708
|
+
limit: 1e3,
|
|
4709
|
+
order: "by_voter_proposal",
|
|
4710
|
+
order_direction: "ascending",
|
|
4711
|
+
status: "votable"
|
|
4712
|
+
});
|
|
4713
|
+
const userVotes = (response.proposal_votes || []).filter((vote) => vote.voter === voter);
|
|
4714
|
+
return userVotes;
|
|
4715
|
+
}
|
|
4305
4716
|
});
|
|
4306
4717
|
}
|
|
4307
|
-
function
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4718
|
+
function getVestingDelegationsQueryOptions(username, limit = 50) {
|
|
4719
|
+
return infiniteQueryOptions({
|
|
4720
|
+
queryKey: ["wallet", "vesting-delegations", username, limit],
|
|
4721
|
+
initialPageParam: "",
|
|
4722
|
+
queryFn: async ({ pageParam }) => {
|
|
4723
|
+
const fetchLimit = pageParam ? limit + 1 : limit;
|
|
4724
|
+
const result = await CONFIG.hiveClient.database.call("get_vesting_delegations", [
|
|
4725
|
+
username,
|
|
4726
|
+
pageParam || "",
|
|
4727
|
+
fetchLimit
|
|
4728
|
+
]);
|
|
4729
|
+
if (pageParam && result.length > 0 && result[0]?.delegatee === pageParam) {
|
|
4730
|
+
return result.slice(1, limit + 1);
|
|
4731
|
+
}
|
|
4732
|
+
return result;
|
|
4733
|
+
},
|
|
4734
|
+
getNextPageParam: (lastPage) => {
|
|
4735
|
+
if (!lastPage || lastPage.length < limit) {
|
|
4736
|
+
return void 0;
|
|
4737
|
+
}
|
|
4738
|
+
const lastDelegation = lastPage[lastPage.length - 1];
|
|
4739
|
+
return lastDelegation?.delegatee;
|
|
4740
|
+
},
|
|
4741
|
+
enabled: !!username
|
|
4318
4742
|
});
|
|
4319
4743
|
}
|
|
4320
|
-
function
|
|
4744
|
+
function getConversionRequestsQueryOptions(account) {
|
|
4321
4745
|
return queryOptions({
|
|
4322
|
-
queryKey: ["
|
|
4323
|
-
queryFn:
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
[]
|
|
4328
|
-
);
|
|
4329
|
-
const now = /* @__PURE__ */ new Date();
|
|
4330
|
-
const oneDayAgo = new Date(now.getTime() - 864e5);
|
|
4331
|
-
const formatDate2 = (date) => {
|
|
4332
|
-
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4333
|
-
};
|
|
4334
|
-
const dayChange = await CONFIG.hiveClient.call(
|
|
4335
|
-
"condenser_api",
|
|
4336
|
-
"get_market_history",
|
|
4337
|
-
[86400, formatDate2(oneDayAgo), formatDate2(now)]
|
|
4338
|
-
);
|
|
4339
|
-
const result = {
|
|
4340
|
-
price: +stats.latest,
|
|
4341
|
-
close: dayChange[0] ? dayChange[0].non_hive.open / dayChange[0].hive.open : 0,
|
|
4342
|
-
high: dayChange[0] ? dayChange[0].non_hive.high / dayChange[0].hive.high : 0,
|
|
4343
|
-
low: dayChange[0] ? dayChange[0].non_hive.low / dayChange[0].hive.low : 0,
|
|
4344
|
-
percent: dayChange[0] ? 100 - dayChange[0].non_hive.open / dayChange[0].hive.open * 100 / +stats.latest : 0,
|
|
4345
|
-
totalFromAsset: stats.hive_volume.split(" ")[0],
|
|
4346
|
-
totalToAsset: stats.hbd_volume.split(" ")[0]
|
|
4347
|
-
};
|
|
4348
|
-
return result;
|
|
4349
|
-
}
|
|
4746
|
+
queryKey: ["wallet", "conversion-requests", account],
|
|
4747
|
+
queryFn: () => CONFIG.hiveClient.database.call("get_conversion_requests", [
|
|
4748
|
+
account
|
|
4749
|
+
]),
|
|
4750
|
+
select: (data) => data.sort((a, b) => a.requestid - b.requestid)
|
|
4350
4751
|
});
|
|
4351
4752
|
}
|
|
4352
|
-
function
|
|
4753
|
+
function getCollateralizedConversionRequestsQueryOptions(account) {
|
|
4353
4754
|
return queryOptions({
|
|
4354
|
-
queryKey: ["
|
|
4355
|
-
queryFn:
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
if (!response.ok) {
|
|
4360
|
-
throw new Error(`Failed to fetch market data: ${response.status}`);
|
|
4361
|
-
}
|
|
4362
|
-
return response.json();
|
|
4363
|
-
}
|
|
4755
|
+
queryKey: ["wallet", "collateralized-conversion-requests", account],
|
|
4756
|
+
queryFn: () => CONFIG.hiveClient.database.call("get_collateralized_conversion_requests", [
|
|
4757
|
+
account
|
|
4758
|
+
]),
|
|
4759
|
+
select: (data) => data.sort((a, b) => a.requestid - b.requestid)
|
|
4364
4760
|
});
|
|
4365
4761
|
}
|
|
4366
|
-
function
|
|
4367
|
-
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4368
|
-
}
|
|
4369
|
-
function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
|
|
4370
|
-
const end = endDate ?? /* @__PURE__ */ new Date();
|
|
4371
|
-
const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
|
|
4762
|
+
function getSavingsWithdrawFromQueryOptions(account) {
|
|
4372
4763
|
return queryOptions({
|
|
4373
|
-
queryKey: ["
|
|
4374
|
-
queryFn: () => CONFIG.hiveClient.call("
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
])
|
|
4764
|
+
queryKey: ["wallet", "savings-withdraw", account],
|
|
4765
|
+
queryFn: () => CONFIG.hiveClient.database.call("get_savings_withdraw_from", [
|
|
4766
|
+
account
|
|
4767
|
+
]),
|
|
4768
|
+
select: (data) => data.sort((a, b) => a.request_id - b.request_id)
|
|
4379
4769
|
});
|
|
4380
4770
|
}
|
|
4381
|
-
|
|
4382
|
-
// src/modules/market/requests.ts
|
|
4383
|
-
async function parseJsonResponse(response) {
|
|
4384
|
-
const data = await response.json();
|
|
4385
|
-
if (!response.ok) {
|
|
4386
|
-
const error = new Error(`Request failed with status ${response.status}`);
|
|
4387
|
-
error.status = response.status;
|
|
4388
|
-
error.data = data;
|
|
4389
|
-
throw error;
|
|
4390
|
-
}
|
|
4391
|
-
return data;
|
|
4392
|
-
}
|
|
4393
|
-
async function getMarketData(coin, vsCurrency, fromTs, toTs) {
|
|
4394
|
-
const fetchApi = getBoundFetch();
|
|
4395
|
-
const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
|
|
4396
|
-
const response = await fetchApi(url);
|
|
4397
|
-
return parseJsonResponse(response);
|
|
4398
|
-
}
|
|
4399
|
-
async function getCurrencyRate(cur) {
|
|
4400
|
-
if (cur === "hbd") {
|
|
4401
|
-
return 1;
|
|
4402
|
-
}
|
|
4403
|
-
const fetchApi = getBoundFetch();
|
|
4404
|
-
const url = `https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=${cur}`;
|
|
4405
|
-
const response = await fetchApi(url);
|
|
4406
|
-
const data = await parseJsonResponse(response);
|
|
4407
|
-
return data.hive_dollar[cur];
|
|
4408
|
-
}
|
|
4409
|
-
async function getCurrencyTokenRate(currency, token) {
|
|
4410
|
-
const fetchApi = getBoundFetch();
|
|
4411
|
-
const response = await fetchApi(
|
|
4412
|
-
CONFIG.privateApiHost + `/private-api/market-data/${currency === "hbd" ? "usd" : currency}/${token}`
|
|
4413
|
-
);
|
|
4414
|
-
return parseJsonResponse(response);
|
|
4415
|
-
}
|
|
4416
|
-
async function getCurrencyRates() {
|
|
4417
|
-
const fetchApi = getBoundFetch();
|
|
4418
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
|
|
4419
|
-
return parseJsonResponse(response);
|
|
4420
|
-
}
|
|
4421
|
-
async function getHivePrice() {
|
|
4422
|
-
const fetchApi = getBoundFetch();
|
|
4423
|
-
const response = await fetchApi(
|
|
4424
|
-
"https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd"
|
|
4425
|
-
);
|
|
4426
|
-
return parseJsonResponse(response);
|
|
4427
|
-
}
|
|
4428
|
-
function getPointsQueryOptions(username, filter = 0) {
|
|
4771
|
+
function getWithdrawRoutesQueryOptions(account) {
|
|
4429
4772
|
return queryOptions({
|
|
4430
|
-
queryKey: ["
|
|
4431
|
-
queryFn:
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
const name = username.replace("@", "");
|
|
4436
|
-
const pointsResponse = await fetch(CONFIG.privateApiHost + "/private-api/points", {
|
|
4437
|
-
method: "POST",
|
|
4438
|
-
headers: {
|
|
4439
|
-
"Content-Type": "application/json"
|
|
4440
|
-
},
|
|
4441
|
-
body: JSON.stringify({ username: name })
|
|
4442
|
-
});
|
|
4443
|
-
if (!pointsResponse.ok) {
|
|
4444
|
-
throw new Error(`Failed to fetch points: ${pointsResponse.status}`);
|
|
4445
|
-
}
|
|
4446
|
-
const points = await pointsResponse.json();
|
|
4447
|
-
const transactionsResponse = await fetch(
|
|
4448
|
-
CONFIG.privateApiHost + "/private-api/point-list",
|
|
4449
|
-
{
|
|
4450
|
-
method: "POST",
|
|
4451
|
-
headers: {
|
|
4452
|
-
"Content-Type": "application/json"
|
|
4453
|
-
},
|
|
4454
|
-
body: JSON.stringify({ username: name, type: filter })
|
|
4455
|
-
}
|
|
4456
|
-
);
|
|
4457
|
-
if (!transactionsResponse.ok) {
|
|
4458
|
-
throw new Error(`Failed to fetch point transactions: ${transactionsResponse.status}`);
|
|
4459
|
-
}
|
|
4460
|
-
const transactions = await transactionsResponse.json();
|
|
4461
|
-
return {
|
|
4462
|
-
points: points.points,
|
|
4463
|
-
uPoints: points.unclaimed_points,
|
|
4464
|
-
transactions
|
|
4465
|
-
};
|
|
4466
|
-
},
|
|
4467
|
-
staleTime: 3e4,
|
|
4468
|
-
refetchOnMount: true,
|
|
4469
|
-
enabled: !!username
|
|
4773
|
+
queryKey: ["wallet", "withdraw-routes", account],
|
|
4774
|
+
queryFn: () => CONFIG.hiveClient.database.call("get_withdraw_routes", [
|
|
4775
|
+
account,
|
|
4776
|
+
"outgoing"
|
|
4777
|
+
])
|
|
4470
4778
|
});
|
|
4471
4779
|
}
|
|
4472
|
-
function
|
|
4780
|
+
function getOpenOrdersQueryOptions(user) {
|
|
4473
4781
|
return queryOptions({
|
|
4474
|
-
queryKey: ["
|
|
4475
|
-
queryFn:
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
4481
|
-
method: "POST",
|
|
4482
|
-
headers: {
|
|
4483
|
-
"Content-Type": "application/json"
|
|
4484
|
-
},
|
|
4485
|
-
body: JSON.stringify(data)
|
|
4486
|
-
});
|
|
4487
|
-
if (!response.ok) {
|
|
4488
|
-
throw new Error(`Search failed: ${response.status}`);
|
|
4489
|
-
}
|
|
4490
|
-
return response.json();
|
|
4491
|
-
}
|
|
4782
|
+
queryKey: ["wallet", "open-orders", user],
|
|
4783
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_open_orders", [
|
|
4784
|
+
user
|
|
4785
|
+
]),
|
|
4786
|
+
select: (data) => data.sort((a, b) => a.orderid - b.orderid),
|
|
4787
|
+
enabled: !!user
|
|
4492
4788
|
});
|
|
4493
4789
|
}
|
|
4494
|
-
function
|
|
4790
|
+
function getOutgoingRcDelegationsInfiniteQueryOptions(username, limit = 100) {
|
|
4495
4791
|
return infiniteQueryOptions({
|
|
4496
|
-
queryKey: ["
|
|
4497
|
-
initialPageParam:
|
|
4792
|
+
queryKey: ["wallet", "outgoing-rc-delegations", username, limit],
|
|
4793
|
+
initialPageParam: null,
|
|
4498
4794
|
queryFn: async ({ pageParam }) => {
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
let sinceDate;
|
|
4507
|
-
const now = /* @__PURE__ */ new Date();
|
|
4508
|
-
switch (tag) {
|
|
4509
|
-
case "today":
|
|
4510
|
-
sinceDate = new Date(now.getTime() - 24 * 60 * 60 * 1e3);
|
|
4511
|
-
break;
|
|
4512
|
-
case "week":
|
|
4513
|
-
sinceDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1e3);
|
|
4514
|
-
break;
|
|
4515
|
-
case "month":
|
|
4516
|
-
sinceDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3);
|
|
4517
|
-
break;
|
|
4518
|
-
case "year":
|
|
4519
|
-
sinceDate = new Date(now.getTime() - 365 * 24 * 60 * 60 * 1e3);
|
|
4520
|
-
break;
|
|
4521
|
-
default:
|
|
4522
|
-
sinceDate = void 0;
|
|
4523
|
-
}
|
|
4524
|
-
const q = "* type:post";
|
|
4525
|
-
const sort = what === "rising" ? "children" : what;
|
|
4526
|
-
const since = sinceDate ? sinceDate.toISOString().split(".")[0] : void 0;
|
|
4527
|
-
const hideLow = "0";
|
|
4528
|
-
const votes = tag === "today" ? 50 : 200;
|
|
4529
|
-
const data = { q, sort, hide_low: hideLow };
|
|
4530
|
-
if (since) data.since = since;
|
|
4531
|
-
if (pageParam.sid) data.scroll_id = pageParam.sid;
|
|
4532
|
-
data.votes = votes;
|
|
4533
|
-
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
4534
|
-
method: "POST",
|
|
4535
|
-
headers: {
|
|
4536
|
-
"Content-Type": "application/json"
|
|
4537
|
-
},
|
|
4538
|
-
body: JSON.stringify(data)
|
|
4539
|
-
});
|
|
4540
|
-
if (!response.ok) {
|
|
4541
|
-
throw new Error(`Search failed: ${response.status}`);
|
|
4795
|
+
const response = await CONFIG.hiveClient.call("rc_api", "list_rc_direct_delegations", {
|
|
4796
|
+
start: [username, pageParam ?? ""],
|
|
4797
|
+
limit
|
|
4798
|
+
}).then((r) => r);
|
|
4799
|
+
let delegations = response.rc_direct_delegations || [];
|
|
4800
|
+
if (pageParam) {
|
|
4801
|
+
delegations = delegations.filter((delegation) => delegation.to !== pageParam);
|
|
4542
4802
|
}
|
|
4543
|
-
return
|
|
4544
|
-
},
|
|
4545
|
-
getNextPageParam: (resp) => {
|
|
4546
|
-
return {
|
|
4547
|
-
sid: resp?.scroll_id,
|
|
4548
|
-
hasNextPage: resp.results.length > 0
|
|
4549
|
-
};
|
|
4803
|
+
return delegations;
|
|
4550
4804
|
},
|
|
4551
|
-
|
|
4805
|
+
getNextPageParam: (lastPage) => lastPage.length === limit ? lastPage[lastPage.length - 1].to : null
|
|
4552
4806
|
});
|
|
4553
4807
|
}
|
|
4554
|
-
function
|
|
4555
|
-
const { json_metadata, permlink } = entry;
|
|
4556
|
-
let q = "*";
|
|
4557
|
-
q += ` -dporn type:post`;
|
|
4558
|
-
let tags;
|
|
4559
|
-
if (json_metadata && json_metadata.tags && Array.isArray(json_metadata.tags)) {
|
|
4560
|
-
tags = json_metadata.tags.filter((tag) => tag && tag !== "" && typeof tag === "string").filter((tag) => !tag.startsWith("hive-")).filter((_tag, ind) => ind < +retry).join(",");
|
|
4561
|
-
}
|
|
4562
|
-
if (tags && tags.length > 0) {
|
|
4563
|
-
q += ` tag:${tags}`;
|
|
4564
|
-
} else {
|
|
4565
|
-
const fperm = permlink.split("-");
|
|
4566
|
-
tags = fperm.filter((part) => part !== "").filter((part) => !/^-?\d+$/.test(part)).filter((part) => part.length > 2).join(",");
|
|
4567
|
-
q += ` tag:${tags}`;
|
|
4568
|
-
}
|
|
4569
|
-
return q;
|
|
4570
|
-
}
|
|
4571
|
-
function getSimilarEntriesQueryOptions(entry) {
|
|
4572
|
-
const query = buildQuery(entry);
|
|
4808
|
+
function getIncomingRcQueryOptions(username) {
|
|
4573
4809
|
return queryOptions({
|
|
4574
|
-
queryKey: ["
|
|
4810
|
+
queryKey: ["wallet", "incoming-rc", username],
|
|
4811
|
+
enabled: !!username,
|
|
4575
4812
|
queryFn: async () => {
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
sort: "newest",
|
|
4579
|
-
hide_low: "0"
|
|
4580
|
-
};
|
|
4581
|
-
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
4582
|
-
method: "POST",
|
|
4583
|
-
headers: {
|
|
4584
|
-
"Content-Type": "application/json"
|
|
4585
|
-
},
|
|
4586
|
-
body: JSON.stringify(data)
|
|
4587
|
-
});
|
|
4588
|
-
if (!response.ok) {
|
|
4589
|
-
throw new Error(`Search failed: ${response.status}`);
|
|
4813
|
+
if (!username) {
|
|
4814
|
+
throw new Error("[SDK][Wallet] - Missing username for incoming RC");
|
|
4590
4815
|
}
|
|
4591
|
-
const
|
|
4592
|
-
const
|
|
4593
|
-
|
|
4816
|
+
const fetchApi = getBoundFetch();
|
|
4817
|
+
const response = await fetchApi(
|
|
4818
|
+
`${CONFIG.privateApiHost}/private-api/received-rc/${username}`
|
|
4594
4819
|
);
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
if (entries.find((y) => y.author === result.author) === void 0) {
|
|
4598
|
-
entries.push(result);
|
|
4599
|
-
}
|
|
4820
|
+
if (!response.ok) {
|
|
4821
|
+
throw new Error(`Failed to fetch incoming RC: ${response.status}`);
|
|
4600
4822
|
}
|
|
4601
|
-
return
|
|
4823
|
+
return response.json();
|
|
4602
4824
|
}
|
|
4603
4825
|
});
|
|
4604
4826
|
}
|
|
4605
|
-
function
|
|
4827
|
+
function getReceivedVestingSharesQueryOptions(username) {
|
|
4606
4828
|
return queryOptions({
|
|
4607
|
-
queryKey: ["
|
|
4829
|
+
queryKey: ["wallet", "received-vesting-shares", username],
|
|
4608
4830
|
queryFn: async () => {
|
|
4609
|
-
const
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
headers: {
|
|
4613
|
-
"Content-Type": "application/json"
|
|
4614
|
-
},
|
|
4615
|
-
body: JSON.stringify(data)
|
|
4616
|
-
});
|
|
4831
|
+
const response = await fetch(
|
|
4832
|
+
CONFIG.privateApiHost + `/private-api/received-vesting/${username}`
|
|
4833
|
+
);
|
|
4617
4834
|
if (!response.ok) {
|
|
4618
|
-
throw new Error(`Failed to
|
|
4835
|
+
throw new Error(`Failed to fetch received vesting shares: ${response.status}`);
|
|
4619
4836
|
}
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4837
|
+
const data = await response.json();
|
|
4838
|
+
return data.list;
|
|
4839
|
+
}
|
|
4623
4840
|
});
|
|
4624
4841
|
}
|
|
4625
|
-
function
|
|
4842
|
+
function getRecurrentTransfersQueryOptions(username) {
|
|
4626
4843
|
return queryOptions({
|
|
4627
|
-
queryKey: ["
|
|
4844
|
+
queryKey: ["wallet", "recurrent-transfers", username],
|
|
4845
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "find_recurrent_transfers", [
|
|
4846
|
+
username
|
|
4847
|
+
]),
|
|
4848
|
+
enabled: !!username
|
|
4849
|
+
});
|
|
4850
|
+
}
|
|
4851
|
+
function getWitnessesInfiniteQueryOptions(limit) {
|
|
4852
|
+
return infiniteQueryOptions({
|
|
4853
|
+
queryKey: ["witnesses", "list", limit],
|
|
4854
|
+
initialPageParam: "",
|
|
4855
|
+
queryFn: async ({ pageParam }) => CONFIG.hiveClient.call("condenser_api", "get_witnesses_by_vote", [
|
|
4856
|
+
pageParam,
|
|
4857
|
+
limit
|
|
4858
|
+
]),
|
|
4859
|
+
getNextPageParam: (lastPage) => {
|
|
4860
|
+
const last = lastPage?.[lastPage.length - 1];
|
|
4861
|
+
return last ? last.owner : void 0;
|
|
4862
|
+
}
|
|
4863
|
+
});
|
|
4864
|
+
}
|
|
4865
|
+
function getOrderBookQueryOptions(limit = 500) {
|
|
4866
|
+
return queryOptions({
|
|
4867
|
+
queryKey: ["market", "order-book", limit],
|
|
4868
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_order_book", [
|
|
4869
|
+
limit
|
|
4870
|
+
])
|
|
4871
|
+
});
|
|
4872
|
+
}
|
|
4873
|
+
function getMarketStatisticsQueryOptions() {
|
|
4874
|
+
return queryOptions({
|
|
4875
|
+
queryKey: ["market", "statistics"],
|
|
4876
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_ticker", [])
|
|
4877
|
+
});
|
|
4878
|
+
}
|
|
4879
|
+
function getMarketHistoryQueryOptions(seconds, startDate, endDate) {
|
|
4880
|
+
const formatDate2 = (date) => {
|
|
4881
|
+
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4882
|
+
};
|
|
4883
|
+
return queryOptions({
|
|
4884
|
+
queryKey: ["market", "history", seconds, startDate.getTime(), endDate.getTime()],
|
|
4885
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_market_history", [
|
|
4886
|
+
seconds,
|
|
4887
|
+
formatDate2(startDate),
|
|
4888
|
+
formatDate2(endDate)
|
|
4889
|
+
])
|
|
4890
|
+
});
|
|
4891
|
+
}
|
|
4892
|
+
function getHiveHbdStatsQueryOptions() {
|
|
4893
|
+
return queryOptions({
|
|
4894
|
+
queryKey: ["market", "hive-hbd-stats"],
|
|
4628
4895
|
queryFn: async () => {
|
|
4629
|
-
const
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4896
|
+
const stats = await CONFIG.hiveClient.call(
|
|
4897
|
+
"condenser_api",
|
|
4898
|
+
"get_ticker",
|
|
4899
|
+
[]
|
|
4900
|
+
);
|
|
4901
|
+
const now = /* @__PURE__ */ new Date();
|
|
4902
|
+
const oneDayAgo = new Date(now.getTime() - 864e5);
|
|
4903
|
+
const formatDate2 = (date) => {
|
|
4904
|
+
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4905
|
+
};
|
|
4906
|
+
const dayChange = await CONFIG.hiveClient.call(
|
|
4907
|
+
"condenser_api",
|
|
4908
|
+
"get_market_history",
|
|
4909
|
+
[86400, formatDate2(oneDayAgo), formatDate2(now)]
|
|
4910
|
+
);
|
|
4911
|
+
const result = {
|
|
4912
|
+
price: +stats.latest,
|
|
4913
|
+
close: dayChange[0] ? dayChange[0].non_hive.open / dayChange[0].hive.open : 0,
|
|
4914
|
+
high: dayChange[0] ? dayChange[0].non_hive.high / dayChange[0].hive.high : 0,
|
|
4915
|
+
low: dayChange[0] ? dayChange[0].non_hive.low / dayChange[0].hive.low : 0,
|
|
4916
|
+
percent: dayChange[0] ? 100 - dayChange[0].non_hive.open / dayChange[0].hive.open * 100 / +stats.latest : 0,
|
|
4917
|
+
totalFromAsset: stats.hive_volume.split(" ")[0],
|
|
4918
|
+
totalToAsset: stats.hbd_volume.split(" ")[0]
|
|
4919
|
+
};
|
|
4920
|
+
return result;
|
|
4921
|
+
}
|
|
4643
4922
|
});
|
|
4644
4923
|
}
|
|
4645
|
-
function
|
|
4646
|
-
return
|
|
4647
|
-
queryKey: ["
|
|
4648
|
-
queryFn: async ({
|
|
4649
|
-
const
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
}
|
|
4653
|
-
if (pageParam) {
|
|
4654
|
-
payload.scroll_id = pageParam;
|
|
4655
|
-
}
|
|
4656
|
-
if (votes !== void 0) {
|
|
4657
|
-
payload.votes = votes;
|
|
4658
|
-
}
|
|
4659
|
-
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
4660
|
-
method: "POST",
|
|
4661
|
-
headers: {
|
|
4662
|
-
"Content-Type": "application/json"
|
|
4663
|
-
},
|
|
4664
|
-
body: JSON.stringify(payload)
|
|
4665
|
-
});
|
|
4924
|
+
function getMarketDataQueryOptions(coin, vsCurrency, fromTs, toTs) {
|
|
4925
|
+
return queryOptions({
|
|
4926
|
+
queryKey: ["market", "data", coin, vsCurrency, fromTs, toTs],
|
|
4927
|
+
queryFn: async ({ signal }) => {
|
|
4928
|
+
const fetchApi = getBoundFetch();
|
|
4929
|
+
const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
|
|
4930
|
+
const response = await fetchApi(url, { signal });
|
|
4666
4931
|
if (!response.ok) {
|
|
4667
|
-
throw new Error(`
|
|
4932
|
+
throw new Error(`Failed to fetch market data: ${response.status}`);
|
|
4668
4933
|
}
|
|
4669
4934
|
return response.json();
|
|
4670
|
-
}
|
|
4671
|
-
initialPageParam: void 0,
|
|
4672
|
-
getNextPageParam: (lastPage) => lastPage?.scroll_id,
|
|
4673
|
-
enabled: !!q
|
|
4935
|
+
}
|
|
4674
4936
|
});
|
|
4675
4937
|
}
|
|
4676
|
-
function
|
|
4938
|
+
function formatDate(date) {
|
|
4939
|
+
return date.toISOString().replace(/\.\d{3}Z$/, "");
|
|
4940
|
+
}
|
|
4941
|
+
function getTradeHistoryQueryOptions(limit = 1e3, startDate, endDate) {
|
|
4942
|
+
const end = endDate ?? /* @__PURE__ */ new Date();
|
|
4943
|
+
const start = startDate ?? new Date(end.getTime() - 10 * 60 * 60 * 1e3);
|
|
4677
4944
|
return queryOptions({
|
|
4678
|
-
queryKey: ["
|
|
4679
|
-
queryFn:
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
},
|
|
4685
|
-
body: JSON.stringify({ q })
|
|
4686
|
-
});
|
|
4687
|
-
if (!response.ok) {
|
|
4688
|
-
throw new Error(`Search path failed: ${response.status}`);
|
|
4689
|
-
}
|
|
4690
|
-
const data = await response.json();
|
|
4691
|
-
if (data?.length > 0) {
|
|
4692
|
-
return data;
|
|
4693
|
-
}
|
|
4694
|
-
return [q];
|
|
4695
|
-
}
|
|
4945
|
+
queryKey: ["market", "trade-history", limit, start.getTime(), end.getTime()],
|
|
4946
|
+
queryFn: () => CONFIG.hiveClient.call("condenser_api", "get_trade_history", [
|
|
4947
|
+
formatDate(start),
|
|
4948
|
+
formatDate(end),
|
|
4949
|
+
limit
|
|
4950
|
+
])
|
|
4696
4951
|
});
|
|
4697
4952
|
}
|
|
4698
4953
|
|
|
4699
|
-
// src/modules/
|
|
4954
|
+
// src/modules/market/requests.ts
|
|
4700
4955
|
async function parseJsonResponse2(response) {
|
|
4701
|
-
const
|
|
4702
|
-
try {
|
|
4703
|
-
return await response.json();
|
|
4704
|
-
} catch {
|
|
4705
|
-
try {
|
|
4706
|
-
return await response.text();
|
|
4707
|
-
} catch {
|
|
4708
|
-
return void 0;
|
|
4709
|
-
}
|
|
4710
|
-
}
|
|
4711
|
-
};
|
|
4712
|
-
const data = await parseBody();
|
|
4956
|
+
const data = await response.json();
|
|
4713
4957
|
if (!response.ok) {
|
|
4714
4958
|
const error = new Error(`Request failed with status ${response.status}`);
|
|
4715
4959
|
error.status = response.status;
|
|
4716
4960
|
error.data = data;
|
|
4717
4961
|
throw error;
|
|
4718
4962
|
}
|
|
4719
|
-
if (data === void 0) {
|
|
4720
|
-
throw new Error("Response body was empty or invalid JSON");
|
|
4721
|
-
}
|
|
4722
4963
|
return data;
|
|
4723
4964
|
}
|
|
4724
|
-
async function
|
|
4725
|
-
const data = { q, sort, hide_low: hideLow };
|
|
4726
|
-
if (since) {
|
|
4727
|
-
data.since = since;
|
|
4728
|
-
}
|
|
4729
|
-
if (scroll_id) {
|
|
4730
|
-
data.scroll_id = scroll_id;
|
|
4731
|
-
}
|
|
4732
|
-
if (votes) {
|
|
4733
|
-
data.votes = votes;
|
|
4734
|
-
}
|
|
4965
|
+
async function getMarketData(coin, vsCurrency, fromTs, toTs) {
|
|
4735
4966
|
const fetchApi = getBoundFetch();
|
|
4736
|
-
const
|
|
4737
|
-
|
|
4738
|
-
headers: {
|
|
4739
|
-
"Content-Type": "application/json"
|
|
4740
|
-
},
|
|
4741
|
-
body: JSON.stringify(data)
|
|
4742
|
-
});
|
|
4967
|
+
const url = `https://api.coingecko.com/api/v3/coins/${coin}/market_chart/range?vs_currency=${vsCurrency}&from=${fromTs}&to=${toTs}`;
|
|
4968
|
+
const response = await fetchApi(url);
|
|
4743
4969
|
return parseJsonResponse2(response);
|
|
4744
4970
|
}
|
|
4745
|
-
async function
|
|
4746
|
-
|
|
4971
|
+
async function getCurrencyRate(cur) {
|
|
4972
|
+
if (cur === "hbd") {
|
|
4973
|
+
return 1;
|
|
4974
|
+
}
|
|
4747
4975
|
const fetchApi = getBoundFetch();
|
|
4748
|
-
const
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4976
|
+
const url = `https://api.coingecko.com/api/v3/simple/price?ids=hive_dollar&vs_currencies=${cur}`;
|
|
4977
|
+
const response = await fetchApi(url);
|
|
4978
|
+
const data = await parseJsonResponse2(response);
|
|
4979
|
+
return data.hive_dollar[cur];
|
|
4980
|
+
}
|
|
4981
|
+
async function getCurrencyTokenRate(currency, token) {
|
|
4982
|
+
const fetchApi = getBoundFetch();
|
|
4983
|
+
const response = await fetchApi(
|
|
4984
|
+
CONFIG.privateApiHost + `/private-api/market-data/${currency === "hbd" ? "usd" : currency}/${token}`
|
|
4985
|
+
);
|
|
4755
4986
|
return parseJsonResponse2(response);
|
|
4756
4987
|
}
|
|
4757
|
-
async function
|
|
4758
|
-
const data = { q, limit, random };
|
|
4988
|
+
async function getCurrencyRates() {
|
|
4759
4989
|
const fetchApi = getBoundFetch();
|
|
4760
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/
|
|
4761
|
-
method: "POST",
|
|
4762
|
-
headers: {
|
|
4763
|
-
"Content-Type": "application/json"
|
|
4764
|
-
},
|
|
4765
|
-
body: JSON.stringify(data)
|
|
4766
|
-
});
|
|
4990
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/market-data/latest");
|
|
4767
4991
|
return parseJsonResponse2(response);
|
|
4768
4992
|
}
|
|
4769
|
-
async function
|
|
4993
|
+
async function getHivePrice() {
|
|
4770
4994
|
const fetchApi = getBoundFetch();
|
|
4771
|
-
const response = await fetchApi(
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4995
|
+
const response = await fetchApi(
|
|
4996
|
+
"https://api.coingecko.com/api/v3/simple/price?ids=hive&vs_currencies=usd"
|
|
4997
|
+
);
|
|
4998
|
+
return parseJsonResponse2(response);
|
|
4999
|
+
}
|
|
5000
|
+
function getPointsQueryOptions(username, filter = 0) {
|
|
5001
|
+
return queryOptions({
|
|
5002
|
+
queryKey: ["points", username, filter],
|
|
5003
|
+
queryFn: async () => {
|
|
5004
|
+
if (!username) {
|
|
5005
|
+
throw new Error("Get points query \u2013 username wasn't provided");
|
|
5006
|
+
}
|
|
5007
|
+
const name = username.replace("@", "");
|
|
5008
|
+
const pointsResponse = await fetch(CONFIG.privateApiHost + "/private-api/points", {
|
|
5009
|
+
method: "POST",
|
|
5010
|
+
headers: {
|
|
5011
|
+
"Content-Type": "application/json"
|
|
5012
|
+
},
|
|
5013
|
+
body: JSON.stringify({ username: name })
|
|
5014
|
+
});
|
|
5015
|
+
if (!pointsResponse.ok) {
|
|
5016
|
+
throw new Error(`Failed to fetch points: ${pointsResponse.status}`);
|
|
5017
|
+
}
|
|
5018
|
+
const points = await pointsResponse.json();
|
|
5019
|
+
const transactionsResponse = await fetch(
|
|
5020
|
+
CONFIG.privateApiHost + "/private-api/point-list",
|
|
5021
|
+
{
|
|
5022
|
+
method: "POST",
|
|
5023
|
+
headers: {
|
|
5024
|
+
"Content-Type": "application/json"
|
|
5025
|
+
},
|
|
5026
|
+
body: JSON.stringify({ username: name, type: filter })
|
|
5027
|
+
}
|
|
5028
|
+
);
|
|
5029
|
+
if (!transactionsResponse.ok) {
|
|
5030
|
+
throw new Error(`Failed to fetch point transactions: ${transactionsResponse.status}`);
|
|
5031
|
+
}
|
|
5032
|
+
const transactions = await transactionsResponse.json();
|
|
5033
|
+
return {
|
|
5034
|
+
points: points.points,
|
|
5035
|
+
uPoints: points.unclaimed_points,
|
|
5036
|
+
transactions
|
|
5037
|
+
};
|
|
4775
5038
|
},
|
|
4776
|
-
|
|
5039
|
+
staleTime: 3e4,
|
|
5040
|
+
refetchOnMount: true,
|
|
5041
|
+
enabled: !!username
|
|
4777
5042
|
});
|
|
4778
|
-
const data = await parseJsonResponse2(response);
|
|
4779
|
-
return data?.length > 0 ? data : [q];
|
|
4780
5043
|
}
|
|
4781
|
-
function
|
|
5044
|
+
function searchQueryOptions(q, sort, hideLow, since, scroll_id, votes) {
|
|
4782
5045
|
return queryOptions({
|
|
4783
|
-
queryKey: ["
|
|
5046
|
+
queryKey: ["search", q, sort, hideLow, since, scroll_id, votes],
|
|
4784
5047
|
queryFn: async () => {
|
|
4785
|
-
|
|
4786
|
-
|
|
5048
|
+
const data = { q, sort, hide_low: hideLow };
|
|
5049
|
+
if (since) data.since = since;
|
|
5050
|
+
if (scroll_id) data.scroll_id = scroll_id;
|
|
5051
|
+
if (votes) data.votes = votes;
|
|
5052
|
+
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
5053
|
+
method: "POST",
|
|
5054
|
+
headers: {
|
|
5055
|
+
"Content-Type": "application/json"
|
|
5056
|
+
},
|
|
5057
|
+
body: JSON.stringify(data)
|
|
5058
|
+
});
|
|
5059
|
+
if (!response.ok) {
|
|
5060
|
+
throw new Error(`Search failed: ${response.status}`);
|
|
5061
|
+
}
|
|
5062
|
+
return response.json();
|
|
5063
|
+
}
|
|
5064
|
+
});
|
|
5065
|
+
}
|
|
5066
|
+
function getControversialRisingInfiniteQueryOptions(what, tag, enabled = true) {
|
|
5067
|
+
return infiniteQueryOptions({
|
|
5068
|
+
queryKey: ["search", "controversial-rising", what, tag],
|
|
5069
|
+
initialPageParam: { sid: void 0, hasNextPage: true },
|
|
5070
|
+
queryFn: async ({ pageParam }) => {
|
|
5071
|
+
if (!pageParam.hasNextPage) {
|
|
5072
|
+
return {
|
|
5073
|
+
hits: 0,
|
|
5074
|
+
took: 0,
|
|
5075
|
+
results: []
|
|
5076
|
+
};
|
|
5077
|
+
}
|
|
5078
|
+
let sinceDate;
|
|
5079
|
+
const now = /* @__PURE__ */ new Date();
|
|
5080
|
+
switch (tag) {
|
|
5081
|
+
case "today":
|
|
5082
|
+
sinceDate = new Date(now.getTime() - 24 * 60 * 60 * 1e3);
|
|
5083
|
+
break;
|
|
5084
|
+
case "week":
|
|
5085
|
+
sinceDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1e3);
|
|
5086
|
+
break;
|
|
5087
|
+
case "month":
|
|
5088
|
+
sinceDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3);
|
|
5089
|
+
break;
|
|
5090
|
+
case "year":
|
|
5091
|
+
sinceDate = new Date(now.getTime() - 365 * 24 * 60 * 60 * 1e3);
|
|
5092
|
+
break;
|
|
5093
|
+
default:
|
|
5094
|
+
sinceDate = void 0;
|
|
4787
5095
|
}
|
|
4788
|
-
const
|
|
5096
|
+
const q = "* type:post";
|
|
5097
|
+
const sort = what === "rising" ? "children" : what;
|
|
5098
|
+
const since = sinceDate ? sinceDate.toISOString().split(".")[0] : void 0;
|
|
5099
|
+
const hideLow = "0";
|
|
5100
|
+
const votes = tag === "today" ? 50 : 200;
|
|
5101
|
+
const data = { q, sort, hide_low: hideLow };
|
|
5102
|
+
if (since) data.since = since;
|
|
5103
|
+
if (pageParam.sid) data.scroll_id = pageParam.sid;
|
|
5104
|
+
data.votes = votes;
|
|
5105
|
+
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
4789
5106
|
method: "POST",
|
|
4790
5107
|
headers: {
|
|
4791
5108
|
"Content-Type": "application/json"
|
|
4792
5109
|
},
|
|
4793
|
-
body: JSON.stringify(
|
|
5110
|
+
body: JSON.stringify(data)
|
|
4794
5111
|
});
|
|
4795
5112
|
if (!response.ok) {
|
|
4796
|
-
throw new Error(`
|
|
5113
|
+
throw new Error(`Search failed: ${response.status}`);
|
|
4797
5114
|
}
|
|
4798
|
-
return
|
|
5115
|
+
return response.json();
|
|
4799
5116
|
},
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
5117
|
+
getNextPageParam: (resp) => {
|
|
5118
|
+
return {
|
|
5119
|
+
sid: resp?.scroll_id,
|
|
5120
|
+
hasNextPage: resp.results.length > 0
|
|
5121
|
+
};
|
|
5122
|
+
},
|
|
5123
|
+
enabled
|
|
4803
5124
|
});
|
|
4804
5125
|
}
|
|
4805
|
-
function
|
|
5126
|
+
function buildQuery(entry, retry = 3) {
|
|
5127
|
+
const { json_metadata, permlink } = entry;
|
|
5128
|
+
let q = "*";
|
|
5129
|
+
q += ` -dporn type:post`;
|
|
5130
|
+
let tags;
|
|
5131
|
+
if (json_metadata && json_metadata.tags && Array.isArray(json_metadata.tags)) {
|
|
5132
|
+
tags = json_metadata.tags.filter((tag) => tag && tag !== "" && typeof tag === "string").filter((tag) => !tag.startsWith("hive-")).filter((_tag, ind) => ind < +retry).join(",");
|
|
5133
|
+
}
|
|
5134
|
+
if (tags && tags.length > 0) {
|
|
5135
|
+
q += ` tag:${tags}`;
|
|
5136
|
+
} else {
|
|
5137
|
+
const fperm = permlink.split("-");
|
|
5138
|
+
tags = fperm.filter((part) => part !== "").filter((part) => !/^-?\d+$/.test(part)).filter((part) => part.length > 2).join(",");
|
|
5139
|
+
q += ` tag:${tags}`;
|
|
5140
|
+
}
|
|
5141
|
+
return q;
|
|
5142
|
+
}
|
|
5143
|
+
function getSimilarEntriesQueryOptions(entry) {
|
|
5144
|
+
const query = buildQuery(entry);
|
|
4806
5145
|
return queryOptions({
|
|
4807
|
-
queryKey: ["
|
|
5146
|
+
queryKey: ["search", "similar-entries", entry.author, entry.permlink, query],
|
|
4808
5147
|
queryFn: async () => {
|
|
4809
|
-
const
|
|
5148
|
+
const data = {
|
|
5149
|
+
q: query,
|
|
5150
|
+
sort: "newest",
|
|
5151
|
+
hide_low: "0"
|
|
5152
|
+
};
|
|
5153
|
+
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
4810
5154
|
method: "POST",
|
|
4811
5155
|
headers: {
|
|
4812
5156
|
"Content-Type": "application/json"
|
|
4813
5157
|
},
|
|
4814
|
-
body: JSON.stringify(
|
|
5158
|
+
body: JSON.stringify(data)
|
|
4815
5159
|
});
|
|
4816
5160
|
if (!response.ok) {
|
|
4817
|
-
throw new Error(`
|
|
5161
|
+
throw new Error(`Search failed: ${response.status}`);
|
|
4818
5162
|
}
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
5163
|
+
const searchResponse = await response.json();
|
|
5164
|
+
const rawEntries = searchResponse.results.filter(
|
|
5165
|
+
(r) => r.permlink !== entry.permlink && r.tags.indexOf("nsfw") === -1
|
|
5166
|
+
);
|
|
5167
|
+
const entries = [];
|
|
5168
|
+
for (const result of rawEntries) {
|
|
5169
|
+
if (entries.find((y) => y.author === result.author) === void 0) {
|
|
5170
|
+
entries.push(result);
|
|
5171
|
+
}
|
|
5172
|
+
}
|
|
5173
|
+
return entries.slice(0, 3);
|
|
5174
|
+
}
|
|
4822
5175
|
});
|
|
4823
5176
|
}
|
|
4824
|
-
function
|
|
5177
|
+
function getSearchAccountQueryOptions(q, limit = 5, random = false) {
|
|
4825
5178
|
return queryOptions({
|
|
4826
|
-
queryKey: ["
|
|
5179
|
+
queryKey: ["search", "account", q, limit],
|
|
4827
5180
|
queryFn: async () => {
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
}
|
|
4831
|
-
const response = await fetch(CONFIG.privateApiHost + "/private-api/boosted-plus-account", {
|
|
5181
|
+
const data = { q, limit, random: +random };
|
|
5182
|
+
const response = await fetch(CONFIG.privateApiHost + "/search-api/search-account", {
|
|
4832
5183
|
method: "POST",
|
|
4833
5184
|
headers: {
|
|
4834
5185
|
"Content-Type": "application/json"
|
|
4835
5186
|
},
|
|
4836
|
-
body: JSON.stringify(
|
|
5187
|
+
body: JSON.stringify(data)
|
|
4837
5188
|
});
|
|
4838
5189
|
if (!response.ok) {
|
|
4839
|
-
throw new Error(`Failed to
|
|
5190
|
+
throw new Error(`Failed to search accounts: ${response.status}`);
|
|
4840
5191
|
}
|
|
4841
|
-
|
|
4842
|
-
return responseData ? {
|
|
4843
|
-
account: responseData.account,
|
|
4844
|
-
expires: new Date(responseData.expires)
|
|
4845
|
-
} : null;
|
|
4846
|
-
},
|
|
4847
|
-
enabled: !!account && !!accessToken
|
|
4848
|
-
});
|
|
4849
|
-
}
|
|
4850
|
-
|
|
4851
|
-
// src/modules/private-api/requests.ts
|
|
4852
|
-
async function parseJsonResponse3(response) {
|
|
4853
|
-
if (!response.ok) {
|
|
4854
|
-
let errorData = void 0;
|
|
4855
|
-
try {
|
|
4856
|
-
errorData = await response.json();
|
|
4857
|
-
} catch {
|
|
4858
|
-
errorData = void 0;
|
|
4859
|
-
}
|
|
4860
|
-
const error = new Error(`Request failed with status ${response.status}`);
|
|
4861
|
-
error.status = response.status;
|
|
4862
|
-
error.data = errorData;
|
|
4863
|
-
throw error;
|
|
4864
|
-
}
|
|
4865
|
-
const text = await response.text();
|
|
4866
|
-
if (!text || text.trim() === "") {
|
|
4867
|
-
return "";
|
|
4868
|
-
}
|
|
4869
|
-
try {
|
|
4870
|
-
return JSON.parse(text);
|
|
4871
|
-
} catch (e) {
|
|
4872
|
-
console.warn("[SDK] Failed to parse JSON response:", e, "Response:", text);
|
|
4873
|
-
return "";
|
|
4874
|
-
}
|
|
4875
|
-
}
|
|
4876
|
-
async function signUp(username, email, referral) {
|
|
4877
|
-
const fetchApi = getBoundFetch();
|
|
4878
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/account-create", {
|
|
4879
|
-
method: "POST",
|
|
4880
|
-
headers: {
|
|
4881
|
-
"Content-Type": "application/json"
|
|
4882
|
-
},
|
|
4883
|
-
body: JSON.stringify({ username, email, referral })
|
|
4884
|
-
});
|
|
4885
|
-
const data = await parseJsonResponse3(response);
|
|
4886
|
-
return { status: response.status, data };
|
|
4887
|
-
}
|
|
4888
|
-
async function subscribeEmail(email) {
|
|
4889
|
-
const fetchApi = getBoundFetch();
|
|
4890
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/subscribe", {
|
|
4891
|
-
method: "POST",
|
|
4892
|
-
headers: {
|
|
4893
|
-
"Content-Type": "application/json"
|
|
4894
|
-
},
|
|
4895
|
-
body: JSON.stringify({ email })
|
|
4896
|
-
});
|
|
4897
|
-
const data = await parseJsonResponse3(response);
|
|
4898
|
-
return { status: response.status, data };
|
|
4899
|
-
}
|
|
4900
|
-
async function usrActivity(code, ty, bl = "", tx = "") {
|
|
4901
|
-
const params = { code, ty };
|
|
4902
|
-
if (bl) {
|
|
4903
|
-
params.bl = bl;
|
|
4904
|
-
}
|
|
4905
|
-
if (tx) {
|
|
4906
|
-
params.tx = tx;
|
|
4907
|
-
}
|
|
4908
|
-
const fetchApi = getBoundFetch();
|
|
4909
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/usr-activity", {
|
|
4910
|
-
method: "POST",
|
|
4911
|
-
headers: {
|
|
4912
|
-
"Content-Type": "application/json"
|
|
4913
|
-
},
|
|
4914
|
-
body: JSON.stringify(params)
|
|
4915
|
-
});
|
|
4916
|
-
await parseJsonResponse3(response);
|
|
4917
|
-
}
|
|
4918
|
-
async function getNotifications(code, filter, since = null, user = null) {
|
|
4919
|
-
const data = {
|
|
4920
|
-
code
|
|
4921
|
-
};
|
|
4922
|
-
if (filter) {
|
|
4923
|
-
data.filter = filter;
|
|
4924
|
-
}
|
|
4925
|
-
if (since) {
|
|
4926
|
-
data.since = since;
|
|
4927
|
-
}
|
|
4928
|
-
if (user) {
|
|
4929
|
-
data.user = user;
|
|
4930
|
-
}
|
|
4931
|
-
const fetchApi = getBoundFetch();
|
|
4932
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications", {
|
|
4933
|
-
method: "POST",
|
|
4934
|
-
headers: {
|
|
4935
|
-
"Content-Type": "application/json"
|
|
4936
|
-
},
|
|
4937
|
-
body: JSON.stringify(data)
|
|
4938
|
-
});
|
|
4939
|
-
return parseJsonResponse3(response);
|
|
4940
|
-
}
|
|
4941
|
-
async function saveNotificationSetting(code, username, system, allows_notify, notify_types, token) {
|
|
4942
|
-
const data = {
|
|
4943
|
-
code,
|
|
4944
|
-
username,
|
|
4945
|
-
token,
|
|
4946
|
-
system,
|
|
4947
|
-
allows_notify,
|
|
4948
|
-
notify_types
|
|
4949
|
-
};
|
|
4950
|
-
const fetchApi = getBoundFetch();
|
|
4951
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/register-device", {
|
|
4952
|
-
method: "POST",
|
|
4953
|
-
headers: {
|
|
4954
|
-
"Content-Type": "application/json"
|
|
4955
|
-
},
|
|
4956
|
-
body: JSON.stringify(data)
|
|
4957
|
-
});
|
|
4958
|
-
return parseJsonResponse3(response);
|
|
4959
|
-
}
|
|
4960
|
-
async function getNotificationSetting(code, username, token) {
|
|
4961
|
-
const data = { code, username, token };
|
|
4962
|
-
const fetchApi = getBoundFetch();
|
|
4963
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/detail-device", {
|
|
4964
|
-
method: "POST",
|
|
4965
|
-
headers: {
|
|
4966
|
-
"Content-Type": "application/json"
|
|
4967
|
-
},
|
|
4968
|
-
body: JSON.stringify(data)
|
|
4969
|
-
});
|
|
4970
|
-
return parseJsonResponse3(response);
|
|
4971
|
-
}
|
|
4972
|
-
async function markNotifications(code, id) {
|
|
4973
|
-
const data = {
|
|
4974
|
-
code
|
|
4975
|
-
};
|
|
4976
|
-
if (id) {
|
|
4977
|
-
data.id = id;
|
|
4978
|
-
}
|
|
4979
|
-
const fetchApi = getBoundFetch();
|
|
4980
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/private-api/notifications/mark", {
|
|
4981
|
-
method: "POST",
|
|
4982
|
-
headers: {
|
|
4983
|
-
"Content-Type": "application/json"
|
|
5192
|
+
return response.json();
|
|
4984
5193
|
},
|
|
4985
|
-
|
|
5194
|
+
enabled: !!q
|
|
4986
5195
|
});
|
|
4987
|
-
return parseJsonResponse3(response);
|
|
4988
5196
|
}
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
5197
|
+
function getSearchTopicsQueryOptions(q, limit = 20, random = false) {
|
|
5198
|
+
return queryOptions({
|
|
5199
|
+
queryKey: ["search", "topics", q],
|
|
5200
|
+
queryFn: async () => {
|
|
5201
|
+
const data = { q, limit, random: +random };
|
|
5202
|
+
const response = await fetch(CONFIG.privateApiHost + "/search-api/search-tag", {
|
|
5203
|
+
method: "POST",
|
|
5204
|
+
headers: {
|
|
5205
|
+
"Content-Type": "application/json"
|
|
5206
|
+
},
|
|
5207
|
+
body: JSON.stringify(data)
|
|
5208
|
+
});
|
|
5209
|
+
if (!response.ok) {
|
|
5210
|
+
throw new Error(`Failed to search topics: ${response.status}`);
|
|
5211
|
+
}
|
|
5212
|
+
return response.json();
|
|
4996
5213
|
},
|
|
4997
|
-
|
|
5214
|
+
enabled: !!q
|
|
4998
5215
|
});
|
|
4999
|
-
return parseJsonResponse3(response);
|
|
5000
5216
|
}
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5217
|
+
function getSearchApiInfiniteQueryOptions(q, sort, hideLow, since, votes) {
|
|
5218
|
+
return infiniteQueryOptions({
|
|
5219
|
+
queryKey: ["search", "api", q, sort, hideLow, since, votes],
|
|
5220
|
+
queryFn: async ({ pageParam }) => {
|
|
5221
|
+
const payload = { q, sort, hide_low: hideLow };
|
|
5222
|
+
if (since) {
|
|
5223
|
+
payload.since = since;
|
|
5224
|
+
}
|
|
5225
|
+
if (pageParam) {
|
|
5226
|
+
payload.scroll_id = pageParam;
|
|
5227
|
+
}
|
|
5228
|
+
if (votes !== void 0) {
|
|
5229
|
+
payload.votes = votes;
|
|
5230
|
+
}
|
|
5231
|
+
const response = await fetch(CONFIG.privateApiHost + "/search-api/search", {
|
|
5232
|
+
method: "POST",
|
|
5233
|
+
headers: {
|
|
5234
|
+
"Content-Type": "application/json"
|
|
5235
|
+
},
|
|
5236
|
+
body: JSON.stringify(payload)
|
|
5237
|
+
});
|
|
5238
|
+
if (!response.ok) {
|
|
5239
|
+
throw new Error(`Search failed: ${response.status}`);
|
|
5240
|
+
}
|
|
5241
|
+
return response.json();
|
|
5242
|
+
},
|
|
5243
|
+
initialPageParam: void 0,
|
|
5244
|
+
getNextPageParam: (lastPage) => lastPage?.scroll_id,
|
|
5245
|
+
enabled: !!q
|
|
5009
5246
|
});
|
|
5010
|
-
return parseJsonResponse3(response);
|
|
5011
5247
|
}
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5248
|
+
function getSearchPathQueryOptions(q) {
|
|
5249
|
+
return queryOptions({
|
|
5250
|
+
queryKey: ["search", "path", q],
|
|
5251
|
+
queryFn: async () => {
|
|
5252
|
+
const response = await fetch(CONFIG.privateApiHost + "/search-api/search-path", {
|
|
5253
|
+
method: "POST",
|
|
5254
|
+
headers: {
|
|
5255
|
+
"Content-Type": "application/json"
|
|
5256
|
+
},
|
|
5257
|
+
body: JSON.stringify({ q })
|
|
5258
|
+
});
|
|
5259
|
+
if (!response.ok) {
|
|
5260
|
+
throw new Error(`Search path failed: ${response.status}`);
|
|
5261
|
+
}
|
|
5262
|
+
const data = await response.json();
|
|
5263
|
+
if (data?.length > 0) {
|
|
5264
|
+
return data;
|
|
5265
|
+
}
|
|
5266
|
+
return [q];
|
|
5267
|
+
}
|
|
5021
5268
|
});
|
|
5022
|
-
return parseJsonResponse3(response);
|
|
5023
5269
|
}
|
|
5024
|
-
|
|
5025
|
-
|
|
5270
|
+
|
|
5271
|
+
// src/modules/search/requests.ts
|
|
5272
|
+
async function parseJsonResponse3(response) {
|
|
5273
|
+
const parseBody = async () => {
|
|
5274
|
+
try {
|
|
5275
|
+
return await response.json();
|
|
5276
|
+
} catch {
|
|
5277
|
+
try {
|
|
5278
|
+
return await response.text();
|
|
5279
|
+
} catch {
|
|
5280
|
+
return void 0;
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5283
|
+
};
|
|
5284
|
+
const data = await parseBody();
|
|
5285
|
+
if (!response.ok) {
|
|
5286
|
+
const error = new Error(`Request failed with status ${response.status}`);
|
|
5287
|
+
error.status = response.status;
|
|
5288
|
+
error.data = data;
|
|
5289
|
+
throw error;
|
|
5290
|
+
}
|
|
5291
|
+
if (data === void 0) {
|
|
5292
|
+
throw new Error("Response body was empty or invalid JSON");
|
|
5293
|
+
}
|
|
5294
|
+
return data;
|
|
5295
|
+
}
|
|
5296
|
+
async function search(q, sort, hideLow, since, scroll_id, votes) {
|
|
5297
|
+
const data = { q, sort, hide_low: hideLow };
|
|
5298
|
+
if (since) {
|
|
5299
|
+
data.since = since;
|
|
5300
|
+
}
|
|
5301
|
+
if (scroll_id) {
|
|
5302
|
+
data.scroll_id = scroll_id;
|
|
5303
|
+
}
|
|
5304
|
+
if (votes) {
|
|
5305
|
+
data.votes = votes;
|
|
5306
|
+
}
|
|
5026
5307
|
const fetchApi = getBoundFetch();
|
|
5027
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/
|
|
5308
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search", {
|
|
5028
5309
|
method: "POST",
|
|
5029
5310
|
headers: {
|
|
5030
5311
|
"Content-Type": "application/json"
|
|
@@ -5033,10 +5314,10 @@ async function addDraft(code, title, body, tags, meta) {
|
|
|
5033
5314
|
});
|
|
5034
5315
|
return parseJsonResponse3(response);
|
|
5035
5316
|
}
|
|
5036
|
-
async function
|
|
5037
|
-
const data = {
|
|
5317
|
+
async function searchAccount(q = "", limit = 20, random = 1) {
|
|
5318
|
+
const data = { q, limit, random };
|
|
5038
5319
|
const fetchApi = getBoundFetch();
|
|
5039
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/
|
|
5320
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-account", {
|
|
5040
5321
|
method: "POST",
|
|
5041
5322
|
headers: {
|
|
5042
5323
|
"Content-Type": "application/json"
|
|
@@ -5045,10 +5326,10 @@ async function updateDraft(code, draftId, title, body, tags, meta) {
|
|
|
5045
5326
|
});
|
|
5046
5327
|
return parseJsonResponse3(response);
|
|
5047
5328
|
}
|
|
5048
|
-
async function
|
|
5049
|
-
const data = {
|
|
5329
|
+
async function searchTag(q = "", limit = 20, random = 0) {
|
|
5330
|
+
const data = { q, limit, random };
|
|
5050
5331
|
const fetchApi = getBoundFetch();
|
|
5051
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/
|
|
5332
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-tag", {
|
|
5052
5333
|
method: "POST",
|
|
5053
5334
|
headers: {
|
|
5054
5335
|
"Content-Type": "application/json"
|
|
@@ -5057,83 +5338,86 @@ async function deleteDraft(code, draftId) {
|
|
|
5057
5338
|
});
|
|
5058
5339
|
return parseJsonResponse3(response);
|
|
5059
5340
|
}
|
|
5060
|
-
async function
|
|
5061
|
-
const data = {
|
|
5062
|
-
code,
|
|
5063
|
-
permlink,
|
|
5064
|
-
title,
|
|
5065
|
-
body,
|
|
5066
|
-
meta,
|
|
5067
|
-
schedule,
|
|
5068
|
-
reblog
|
|
5069
|
-
};
|
|
5070
|
-
if (options) {
|
|
5071
|
-
data.options = options;
|
|
5072
|
-
}
|
|
5341
|
+
async function searchPath(q) {
|
|
5073
5342
|
const fetchApi = getBoundFetch();
|
|
5074
|
-
const response = await fetchApi(CONFIG.privateApiHost + "/
|
|
5343
|
+
const response = await fetchApi(CONFIG.privateApiHost + "/search-api/search-path", {
|
|
5075
5344
|
method: "POST",
|
|
5076
5345
|
headers: {
|
|
5077
5346
|
"Content-Type": "application/json"
|
|
5078
5347
|
},
|
|
5079
|
-
body: JSON.stringify(
|
|
5348
|
+
body: JSON.stringify({ q })
|
|
5080
5349
|
});
|
|
5081
|
-
|
|
5350
|
+
const data = await parseJsonResponse3(response);
|
|
5351
|
+
return data?.length > 0 ? data : [q];
|
|
5082
5352
|
}
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5353
|
+
function getBoostPlusPricesQueryOptions(accessToken) {
|
|
5354
|
+
return queryOptions({
|
|
5355
|
+
queryKey: ["promotions", "boost-plus-prices"],
|
|
5356
|
+
queryFn: async () => {
|
|
5357
|
+
if (!accessToken) {
|
|
5358
|
+
return [];
|
|
5359
|
+
}
|
|
5360
|
+
const response = await fetch(CONFIG.privateApiHost + "/private-api/boost-plus-price", {
|
|
5361
|
+
method: "POST",
|
|
5362
|
+
headers: {
|
|
5363
|
+
"Content-Type": "application/json"
|
|
5364
|
+
},
|
|
5365
|
+
body: JSON.stringify({ code: accessToken })
|
|
5366
|
+
});
|
|
5367
|
+
if (!response.ok) {
|
|
5368
|
+
throw new Error(`Failed to fetch boost plus prices: ${response.status}`);
|
|
5369
|
+
}
|
|
5370
|
+
return await response.json();
|
|
5090
5371
|
},
|
|
5091
|
-
|
|
5372
|
+
staleTime: Infinity,
|
|
5373
|
+
refetchOnMount: true,
|
|
5374
|
+
enabled: !!accessToken
|
|
5092
5375
|
});
|
|
5093
|
-
return parseJsonResponse3(response);
|
|
5094
5376
|
}
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5377
|
+
function getPromotePriceQueryOptions(accessToken) {
|
|
5378
|
+
return queryOptions({
|
|
5379
|
+
queryKey: ["promotions", "promote-price"],
|
|
5380
|
+
queryFn: async () => {
|
|
5381
|
+
const response = await fetch(CONFIG.privateApiHost + "/private-api/promote-price", {
|
|
5382
|
+
method: "POST",
|
|
5383
|
+
headers: {
|
|
5384
|
+
"Content-Type": "application/json"
|
|
5385
|
+
},
|
|
5386
|
+
body: JSON.stringify({ code: accessToken })
|
|
5387
|
+
});
|
|
5388
|
+
if (!response.ok) {
|
|
5389
|
+
throw new Error(`Failed to fetch promote prices: ${response.status}`);
|
|
5390
|
+
}
|
|
5391
|
+
return await response.json();
|
|
5102
5392
|
},
|
|
5103
|
-
|
|
5393
|
+
enabled: !!accessToken
|
|
5104
5394
|
});
|
|
5105
|
-
return parseJsonResponse3(response);
|
|
5106
5395
|
}
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5396
|
+
function getBoostPlusAccountPricesQueryOptions(account, accessToken) {
|
|
5397
|
+
return queryOptions({
|
|
5398
|
+
queryKey: ["promotions", "boost-plus-accounts", account],
|
|
5399
|
+
queryFn: async () => {
|
|
5400
|
+
if (!accessToken || !account) {
|
|
5401
|
+
return null;
|
|
5402
|
+
}
|
|
5403
|
+
const response = await fetch(CONFIG.privateApiHost + "/private-api/boosted-plus-account", {
|
|
5404
|
+
method: "POST",
|
|
5405
|
+
headers: {
|
|
5406
|
+
"Content-Type": "application/json"
|
|
5407
|
+
},
|
|
5408
|
+
body: JSON.stringify({ code: accessToken, account })
|
|
5409
|
+
});
|
|
5410
|
+
if (!response.ok) {
|
|
5411
|
+
throw new Error(`Failed to fetch boost plus account prices: ${response.status}`);
|
|
5412
|
+
}
|
|
5413
|
+
const responseData = await response.json();
|
|
5414
|
+
return responseData ? {
|
|
5415
|
+
account: responseData.account,
|
|
5416
|
+
expires: new Date(responseData.expires)
|
|
5417
|
+
} : null;
|
|
5114
5418
|
},
|
|
5115
|
-
|
|
5419
|
+
enabled: !!account && !!accessToken
|
|
5116
5420
|
});
|
|
5117
|
-
return parseJsonResponse3(response);
|
|
5118
|
-
}
|
|
5119
|
-
async function onboardEmail(username, email, friend) {
|
|
5120
|
-
const dataBody = {
|
|
5121
|
-
username,
|
|
5122
|
-
email,
|
|
5123
|
-
friend
|
|
5124
|
-
};
|
|
5125
|
-
const fetchApi = getBoundFetch();
|
|
5126
|
-
const response = await fetchApi(
|
|
5127
|
-
CONFIG.privateApiHost + "/private-api/account-create-friend",
|
|
5128
|
-
{
|
|
5129
|
-
method: "POST",
|
|
5130
|
-
headers: {
|
|
5131
|
-
"Content-Type": "application/json"
|
|
5132
|
-
},
|
|
5133
|
-
body: JSON.stringify(dataBody)
|
|
5134
|
-
}
|
|
5135
|
-
);
|
|
5136
|
-
return parseJsonResponse3(response);
|
|
5137
5421
|
}
|
|
5138
5422
|
|
|
5139
5423
|
// src/modules/auth/requests.ts
|
|
@@ -5437,6 +5721,6 @@ async function getSpkMarkets() {
|
|
|
5437
5721
|
return await response.json();
|
|
5438
5722
|
}
|
|
5439
5723
|
|
|
5440
|
-
export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getAnnouncementsQueryOptions, getBookmarksInfiniteQueryOptions, getBookmarksQueryOptions, 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, getDraftsInfiniteQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFavouritesInfiniteQueryOptions, getFavouritesQueryOptions, getFollowCountQueryOptions, getFollowingQueryOptions, getFragmentsInfiniteQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveEngineMetrics, getHiveEngineOpenOrders, getHiveEngineOrderBook, getHiveEngineTokenMetrics, getHiveEngineTokenTransactions, getHiveEngineTokensBalances, getHiveEngineTokensMarket, getHiveEngineTokensMetadata, getHiveEngineTradeHistory, getHiveEngineUnclaimedRewards, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getHivePrice, getImagesInfiniteQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getRecurrentTransfersQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesInfiniteQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getSpkMarkets, getSpkWallet, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, isWrappedResponse, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeToWrappedResponse, 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 };
|
|
5724
|
+
export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getAnnouncementsQueryOptions, getBookmarksInfiniteQueryOptions, getBookmarksQueryOptions, 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, getDraftsInfiniteQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFavouritesInfiniteQueryOptions, getFavouritesQueryOptions, getFollowCountQueryOptions, getFollowersQueryOptions, getFollowingQueryOptions, getFragmentsInfiniteQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveEngineMetrics, getHiveEngineOpenOrders, getHiveEngineOrderBook, getHiveEngineTokenMetrics, getHiveEngineTokenTransactions, getHiveEngineTokensBalances, getHiveEngineTokensMarket, getHiveEngineTokensMetadata, getHiveEngineTradeHistory, getHiveEngineUnclaimedRewards, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getHivePrice, getImagesInfiniteQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getRecurrentTransfersQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesInfiniteQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getSpkMarkets, getSpkWallet, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUserPostVoteQueryOptions, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, isWrappedResponse, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeToWrappedResponse, 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, useAddDraft, useAddFragment, useAddImage, useAddSchedule, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useDeleteDraft, useDeleteImage, useDeleteSchedule, useEditFragment, useGameClaim, useMarkNotificationsRead, useMoveSchedule, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, useUpdateDraft, useUploadImage, usrActivity, validatePostCreating, votingPower, votingValue };
|
|
5441
5725
|
//# sourceMappingURL=index.js.map
|
|
5442
5726
|
//# sourceMappingURL=index.js.map
|