@ecency/sdk 1.1.20 → 1.1.22
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/ecency-sdk.es.js +78 -59
- package/dist/modules/core/config.d.ts +0 -4
- package/dist/modules/integrations/index.d.ts +1 -0
- package/dist/modules/integrations/plausible/index.d.ts +1 -0
- package/dist/modules/integrations/plausible/queries/get-stats-query-options.d.ts +29 -0
- package/dist/modules/integrations/plausible/queries/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/ecency-sdk.es.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
var V = Object.defineProperty;
|
2
2
|
var W = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
3
3
|
var T = (e, t, n) => W(e, typeof t != "symbol" ? t + "" : t, n);
|
4
|
-
import { QueryClient as F, useMutation as d, useQuery as
|
5
|
-
import { Client as
|
4
|
+
import { QueryClient as F, useMutation as d, useQuery as S, useInfiniteQuery as z, queryOptions as p, useQueryClient as P, infiniteQueryOptions as R } from "@tanstack/react-query";
|
5
|
+
import { Client as $, PrivateKey as _, cryptoUtils as L, RCAPI as X } from "@hiveio/dhive";
|
6
6
|
import K from "hivesigner";
|
7
7
|
import * as f from "remeda";
|
8
8
|
class Y {
|
@@ -29,7 +29,7 @@ const c = {
|
|
29
29
|
privateApiHost: "https://ecency.com",
|
30
30
|
storage: typeof window > "u" ? new Y() : window.localStorage,
|
31
31
|
storagePrefix: "ecency",
|
32
|
-
hiveClient: new
|
32
|
+
hiveClient: new $(
|
33
33
|
[
|
34
34
|
"https://api.hive.blog",
|
35
35
|
"https://api.deathwing.me",
|
@@ -50,10 +50,6 @@ const c = {
|
|
50
50
|
}
|
51
51
|
),
|
52
52
|
heliusApiKey: void 0,
|
53
|
-
bitqueryApiUrl: "https://graphql.bitquery.io",
|
54
|
-
bitqueryApiKey: void 0,
|
55
|
-
chainstackApiUrl: "https://api.chainstack.com/v1",
|
56
|
-
chainstackApiKey: void 0,
|
57
53
|
queryClient: new F(),
|
58
54
|
plausibleHost: "https://pl.ecency.com",
|
59
55
|
spkNode: "https://spk.good-karma.xyz"
|
@@ -237,7 +233,7 @@ var Q;
|
|
237
233
|
return {
|
238
234
|
prefetch: () => o(i),
|
239
235
|
getData: () => t(i.queryKey),
|
240
|
-
useClientQuery: () =>
|
236
|
+
useClientQuery: () => S(i),
|
241
237
|
fetchAndGet: () => y().fetchQuery(i)
|
242
238
|
};
|
243
239
|
}
|
@@ -272,9 +268,9 @@ function we() {
|
|
272
268
|
), o = await c.hiveClient.database.call(
|
273
269
|
"get_reward_fund",
|
274
270
|
["post"]
|
275
|
-
), r = m(e.total_vesting_fund_hive).amount / m(e.total_vesting_shares).amount * 1e6, a = m(t.current_median_history.base).amount, s = m(t.current_median_history.quote).amount, i = parseFloat(o.recent_claims), u = m(o.reward_balance).amount, h = e.hbd_print_rate,
|
271
|
+
), r = m(e.total_vesting_fund_hive).amount / m(e.total_vesting_shares).amount * 1e6, a = m(t.current_median_history.base).amount, s = m(t.current_median_history.quote).amount, i = parseFloat(o.recent_claims), u = m(o.reward_balance).amount, h = e.hbd_print_rate, k = e.hbd_interest_rate, O = e.head_block_number, I = m(
|
276
272
|
e.total_vesting_fund_hive
|
277
|
-
).amount,
|
273
|
+
).amount, M = m(
|
278
274
|
e.total_vesting_shares
|
279
275
|
).amount, x = m(e.virtual_supply).amount, U = e.vesting_reward_percent, G = n.account_creation_fee;
|
280
276
|
return {
|
@@ -284,10 +280,10 @@ function we() {
|
|
284
280
|
fundRecentClaims: i,
|
285
281
|
fundRewardBalance: u,
|
286
282
|
hbdPrintRate: h,
|
287
|
-
hbdInterestRate:
|
283
|
+
hbdInterestRate: k,
|
288
284
|
headBlock: O,
|
289
|
-
totalVestingFund:
|
290
|
-
totalVestingShares:
|
285
|
+
totalVestingFund: I,
|
286
|
+
totalVestingShares: M,
|
291
287
|
virtualSupply: x,
|
292
288
|
vestingRewardPercent: U,
|
293
289
|
accountCreationFee: G
|
@@ -382,7 +378,7 @@ function be(e, t = 5, n = []) {
|
|
382
378
|
)
|
383
379
|
});
|
384
380
|
}
|
385
|
-
function
|
381
|
+
function Se(e) {
|
386
382
|
return p({
|
387
383
|
queryKey: ["accounts", "check-wallet-pending", e],
|
388
384
|
queryFn: async () => await (await fetch(
|
@@ -414,7 +410,7 @@ function re(e, t) {
|
|
414
410
|
)
|
415
411
|
});
|
416
412
|
}
|
417
|
-
function
|
413
|
+
function ke(e) {
|
418
414
|
return p({
|
419
415
|
queryKey: ["accounts", "subscriptions", e],
|
420
416
|
enabled: !!e,
|
@@ -514,9 +510,9 @@ function D({
|
|
514
510
|
return t && t.length > 0 && (o.tokens = t), o.tokens = ie(o.tokens), o;
|
515
511
|
}
|
516
512
|
function Ae(e) {
|
517
|
-
const t = P(), { data: n } =
|
513
|
+
const t = P(), { data: n } = S(b(e));
|
518
514
|
return ne(
|
519
|
-
["accounts", "update"
|
515
|
+
["accounts", "update"],
|
520
516
|
e,
|
521
517
|
(o) => {
|
522
518
|
if (!n)
|
@@ -708,7 +704,7 @@ function se(e, t) {
|
|
708
704
|
);
|
709
705
|
}
|
710
706
|
function ae(e, t) {
|
711
|
-
const { data: n } =
|
707
|
+
const { data: n } = S(b(e));
|
712
708
|
return d({
|
713
709
|
mutationKey: ["accounts", "keys-update", e],
|
714
710
|
mutationFn: async ({ keys: o, keepCurrent: r = !1, currentKey: a }) => {
|
@@ -721,7 +717,7 @@ function ae(e, t) {
|
|
721
717
|
return u.key_auths = se(
|
722
718
|
r ? u.key_auths : [],
|
723
719
|
o.map(
|
724
|
-
(h,
|
720
|
+
(h, k) => [h[i].createPublic().toString(), k + 1]
|
725
721
|
)
|
726
722
|
), u;
|
727
723
|
};
|
@@ -741,7 +737,7 @@ function ae(e, t) {
|
|
741
737
|
});
|
742
738
|
}
|
743
739
|
function Pe(e, t) {
|
744
|
-
const { data: n } =
|
740
|
+
const { data: n } = S(b(e)), { mutateAsync: o } = ae(e);
|
745
741
|
return d({
|
746
742
|
mutationKey: ["accounts", "password-update", e],
|
747
743
|
mutationFn: async ({
|
@@ -775,7 +771,7 @@ function Pe(e, t) {
|
|
775
771
|
});
|
776
772
|
}
|
777
773
|
function Ee(e, t) {
|
778
|
-
const n = P(), { data: o } =
|
774
|
+
const n = P(), { data: o } = S(b(e));
|
779
775
|
return d({
|
780
776
|
mutationKey: ["accounts", "revoke-posting", o == null ? void 0 : o.name],
|
781
777
|
mutationFn: async ({ accountName: r, type: a, key: s }) => {
|
@@ -822,12 +818,12 @@ function Ee(e, t) {
|
|
822
818
|
(i = t.onSuccess) == null || i.call(t, r, a, s), n.setQueryData(
|
823
819
|
b(e).queryKey,
|
824
820
|
(u) => {
|
825
|
-
var h,
|
821
|
+
var h, k;
|
826
822
|
return {
|
827
823
|
...u,
|
828
824
|
posting: {
|
829
825
|
...u == null ? void 0 : u.posting,
|
830
|
-
account_auths: ((
|
826
|
+
account_auths: ((k = (h = u == null ? void 0 : u.posting) == null ? void 0 : h.account_auths) == null ? void 0 : k.filter(
|
831
827
|
([O]) => O !== a.accountName
|
832
828
|
)) ?? []
|
833
829
|
}
|
@@ -838,7 +834,7 @@ function Ee(e, t) {
|
|
838
834
|
});
|
839
835
|
}
|
840
836
|
function Be(e, t) {
|
841
|
-
const { data: n } =
|
837
|
+
const { data: n } = S(b(e));
|
842
838
|
return d({
|
843
839
|
mutationKey: ["accounts", "recovery", n == null ? void 0 : n.name],
|
844
840
|
mutationFn: async ({ accountName: o, type: r, key: a, email: s }) => {
|
@@ -893,7 +889,7 @@ function Be(e, t) {
|
|
893
889
|
});
|
894
890
|
}
|
895
891
|
function He(e, t) {
|
896
|
-
const { data: n } =
|
892
|
+
const { data: n } = S(b(e));
|
897
893
|
return d({
|
898
894
|
mutationKey: ["accounts", "revoke-key", n == null ? void 0 : n.name],
|
899
895
|
mutationFn: async ({ currentKey: o, revokingKey: r }) => {
|
@@ -939,7 +935,7 @@ function Je(e) {
|
|
939
935
|
}
|
940
936
|
});
|
941
937
|
}
|
942
|
-
function
|
938
|
+
function Ne(e, t = "Active") {
|
943
939
|
return d({
|
944
940
|
mutationKey: ["operations", "sign-keychain", e],
|
945
941
|
mutationFn: ({ operation: n }) => {
|
@@ -951,21 +947,21 @@ function Me(e, t = "Active") {
|
|
951
947
|
}
|
952
948
|
});
|
953
949
|
}
|
954
|
-
function
|
950
|
+
function Ie(e = "/") {
|
955
951
|
return d({
|
956
952
|
mutationKey: ["operations", "sign-hivesigner", e],
|
957
953
|
mutationFn: async ({ operation: t }) => K.sendOperation(t, { callback: e }, () => {
|
958
954
|
})
|
959
955
|
});
|
960
956
|
}
|
961
|
-
function
|
957
|
+
function Me() {
|
962
958
|
return p({
|
963
959
|
queryKey: ["operations", "chain-properties"],
|
964
960
|
queryFn: async () => await c.hiveClient.database.getChainProperties()
|
965
961
|
});
|
966
962
|
}
|
967
963
|
function xe(e = 20) {
|
968
|
-
return
|
964
|
+
return R({
|
969
965
|
queryKey: ["posts", "trending-tags"],
|
970
966
|
queryFn: async ({ pageParam: { afterTag: t } }) => c.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
971
967
|
(n) => n.filter((o) => o.name !== "").filter((o) => !o.name.startsWith("hive-")).map((o) => o.name)
|
@@ -1089,7 +1085,7 @@ function We(e, t) {
|
|
1089
1085
|
}
|
1090
1086
|
});
|
1091
1087
|
}
|
1092
|
-
function
|
1088
|
+
function N(e, t) {
|
1093
1089
|
return d({
|
1094
1090
|
mutationKey: ["analytics", t],
|
1095
1091
|
mutationFn: async () => {
|
@@ -1114,7 +1110,7 @@ function M(e, t) {
|
|
1114
1110
|
}
|
1115
1111
|
const ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
1116
1112
|
__proto__: null,
|
1117
|
-
useRecordActivity:
|
1113
|
+
useRecordActivity: N
|
1118
1114
|
}, Symbol.toStringTag, { value: "Module" }));
|
1119
1115
|
function ce(e, t) {
|
1120
1116
|
return p({
|
@@ -1187,10 +1183,10 @@ const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1187
1183
|
__proto__: null,
|
1188
1184
|
getAccountTokenQueryOptions: q,
|
1189
1185
|
getAccountVideosQueryOptions: ye
|
1190
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
1186
|
+
}, Symbol.toStringTag, { value: "Module" })), Re = {
|
1191
1187
|
queries: de
|
1192
1188
|
};
|
1193
|
-
function
|
1189
|
+
function $e(e) {
|
1194
1190
|
return p({
|
1195
1191
|
queryKey: ["integrations", "hiveposh", "links", e],
|
1196
1192
|
queryFn: async () => {
|
@@ -1215,7 +1211,29 @@ function Re(e) {
|
|
1215
1211
|
}
|
1216
1212
|
});
|
1217
1213
|
}
|
1218
|
-
function Le(
|
1214
|
+
function Le({
|
1215
|
+
url: e,
|
1216
|
+
dimensions: t = [],
|
1217
|
+
metrics: n = ["visitors", "pageviews", "visit_duration"],
|
1218
|
+
enabled: o = !0
|
1219
|
+
}) {
|
1220
|
+
return p({
|
1221
|
+
queryKey: ["integrations", "plausible", e, t, n],
|
1222
|
+
queryFn: async () => await (await fetch("https://ecency.com/api/stats", {
|
1223
|
+
method: "POST",
|
1224
|
+
body: JSON.stringify({
|
1225
|
+
metrics: n,
|
1226
|
+
url: encodeURIComponent(e),
|
1227
|
+
dimensions: t
|
1228
|
+
}),
|
1229
|
+
headers: {
|
1230
|
+
"Content-Type": "application/json"
|
1231
|
+
}
|
1232
|
+
})).json(),
|
1233
|
+
enabled: !!e && o
|
1234
|
+
});
|
1235
|
+
}
|
1236
|
+
function Xe() {
|
1219
1237
|
return p({
|
1220
1238
|
queryKey: ["resource-credits", "stats"],
|
1221
1239
|
queryFn: async () => (await c.hiveClient.call(
|
@@ -1225,14 +1243,14 @@ function Le() {
|
|
1225
1243
|
)).rc_stats
|
1226
1244
|
});
|
1227
1245
|
}
|
1228
|
-
function
|
1246
|
+
function Ye(e) {
|
1229
1247
|
return p({
|
1230
1248
|
queryKey: ["resource-credits", "account", e],
|
1231
1249
|
queryFn: async () => new X(c.hiveClient).findRCAccounts([e]),
|
1232
1250
|
enabled: !!e
|
1233
1251
|
});
|
1234
1252
|
}
|
1235
|
-
function
|
1253
|
+
function Ze(e, t) {
|
1236
1254
|
return p({
|
1237
1255
|
queryKey: ["games", "status-check", t, e],
|
1238
1256
|
enabled: !!e,
|
@@ -1255,8 +1273,8 @@ function Ye(e, t) {
|
|
1255
1273
|
}
|
1256
1274
|
});
|
1257
1275
|
}
|
1258
|
-
function
|
1259
|
-
const { mutateAsync: o } =
|
1276
|
+
function et(e, t, n) {
|
1277
|
+
const { mutateAsync: o } = N(
|
1260
1278
|
e,
|
1261
1279
|
"spin-rolled"
|
1262
1280
|
);
|
@@ -1285,7 +1303,7 @@ function Ze(e, t, n) {
|
|
1285
1303
|
}
|
1286
1304
|
});
|
1287
1305
|
}
|
1288
|
-
function
|
1306
|
+
function tt(e, t, n = 100, o = void 0, r = !0) {
|
1289
1307
|
return p({
|
1290
1308
|
queryKey: ["communities", "list", e, t, n],
|
1291
1309
|
enabled: r,
|
@@ -1305,7 +1323,7 @@ function et(e, t, n = 100, o = void 0, r = !0) {
|
|
1305
1323
|
}
|
1306
1324
|
});
|
1307
1325
|
}
|
1308
|
-
function
|
1326
|
+
function nt(e, t) {
|
1309
1327
|
return p({
|
1310
1328
|
queryKey: ["community", "context", e, t],
|
1311
1329
|
enabled: !!e && !!t,
|
@@ -1326,7 +1344,7 @@ function tt(e, t) {
|
|
1326
1344
|
});
|
1327
1345
|
}
|
1328
1346
|
var g = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(g || {});
|
1329
|
-
const
|
1347
|
+
const ot = {
|
1330
1348
|
owner: [
|
1331
1349
|
"admin",
|
1332
1350
|
"mod",
|
@@ -1349,10 +1367,10 @@ const nt = {
|
|
1349
1367
|
/* MUTED */
|
1350
1368
|
]
|
1351
1369
|
};
|
1352
|
-
function
|
1370
|
+
function rt(e, t) {
|
1353
1371
|
return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
|
1354
1372
|
}
|
1355
|
-
function
|
1373
|
+
function it({
|
1356
1374
|
communityType: e,
|
1357
1375
|
userRole: t,
|
1358
1376
|
subscribed: n
|
@@ -1384,39 +1402,40 @@ export {
|
|
1384
1402
|
pe as HiveSignerIntegration,
|
1385
1403
|
ve as Keychain,
|
1386
1404
|
g as ROLES,
|
1387
|
-
|
1405
|
+
Re as ThreeSpeakIntegration,
|
1388
1406
|
oe as broadcastJson,
|
1389
|
-
|
1407
|
+
Se as checkUsernameWalletsPendingQueryOptions,
|
1390
1408
|
se as dedupeAndSortKeyAuths,
|
1391
1409
|
l as getAccessToken,
|
1392
1410
|
b as getAccountFullQueryOptions,
|
1393
1411
|
qe as getAccountPendingRecoveryQueryOptions,
|
1394
|
-
|
1412
|
+
Ye as getAccountRcQueryOptions,
|
1395
1413
|
Oe as getAccountRecoveriesQueryOptions,
|
1396
|
-
|
1414
|
+
ke as getAccountSubscriptionsQueryOptions,
|
1397
1415
|
Ke as getActiveAccountBookmarksQueryOptions,
|
1398
1416
|
Ce as getActiveAccountFavouritesQueryOptions,
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1417
|
+
Me as getChainPropertiesQueryOptions,
|
1418
|
+
tt as getCommunitiesQueryOptions,
|
1419
|
+
nt as getCommunityContextQueryOptions,
|
1420
|
+
it as getCommunityPermissions,
|
1421
|
+
rt as getCommunityType,
|
1404
1422
|
we as getDynamicPropsQueryOptions,
|
1405
1423
|
A as getFragmentsQueryOptions,
|
1406
|
-
|
1407
|
-
|
1424
|
+
Ze as getGameStatusCheckQueryOptions,
|
1425
|
+
$e as getHivePoshLinksQueryOptions,
|
1408
1426
|
J as getLoginType,
|
1409
1427
|
H as getPostingKey,
|
1410
1428
|
Ue as getPromotedPostsQuery,
|
1411
1429
|
y as getQueryClient,
|
1412
|
-
|
1430
|
+
Xe as getRcStatsQueryOptions,
|
1413
1431
|
_e as getRefreshToken,
|
1414
1432
|
re as getRelationshipBetweenAccountsQueryOptions,
|
1415
1433
|
be as getSearchAccountsByUsernameQueryOptions,
|
1434
|
+
Le as getStatsQueryOptions,
|
1416
1435
|
xe as getTrendingTagsQueryOptions,
|
1417
1436
|
w as getUser,
|
1418
1437
|
me as makeQueryClient,
|
1419
|
-
|
1438
|
+
ot as roleMap,
|
1420
1439
|
De as useAccountFavouriteAdd,
|
1421
1440
|
Fe as useAccountFavouriteDelete,
|
1422
1441
|
Te as useAccountRelationsUpdate,
|
@@ -1431,9 +1450,9 @@ export {
|
|
1431
1450
|
Qe as useBookmarkDelete,
|
1432
1451
|
ne as useBroadcastMutation,
|
1433
1452
|
Ve as useEditFragment,
|
1434
|
-
|
1453
|
+
et as useGameClaim,
|
1435
1454
|
We as useRemoveFragment,
|
1436
|
-
|
1455
|
+
Ie as useSignOperationByHivesigner,
|
1437
1456
|
Je as useSignOperationByKey,
|
1438
|
-
|
1457
|
+
Ne as useSignOperationByKeychain
|
1439
1458
|
};
|
@@ -6,10 +6,6 @@ export declare const CONFIG: {
|
|
6
6
|
storagePrefix: string;
|
7
7
|
hiveClient: Client;
|
8
8
|
heliusApiKey: any;
|
9
|
-
bitqueryApiUrl: string;
|
10
|
-
bitqueryApiKey: any;
|
11
|
-
chainstackApiUrl: string;
|
12
|
-
chainstackApiKey: any;
|
13
9
|
queryClient: QueryClient;
|
14
10
|
plausibleHost: string;
|
15
11
|
spkNode: string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './queries';
|
@@ -0,0 +1,29 @@
|
|
1
|
+
export interface StatsResponse {
|
2
|
+
results: [
|
3
|
+
{
|
4
|
+
metrics: number[];
|
5
|
+
dimensions: string[];
|
6
|
+
}
|
7
|
+
];
|
8
|
+
query: {
|
9
|
+
site_id: string;
|
10
|
+
metrics: string[];
|
11
|
+
date_range: string[];
|
12
|
+
filters: unknown[];
|
13
|
+
};
|
14
|
+
}
|
15
|
+
interface UseStatsQueryOptions {
|
16
|
+
url: string;
|
17
|
+
dimensions?: string[];
|
18
|
+
metrics?: string[];
|
19
|
+
enabled?: boolean;
|
20
|
+
}
|
21
|
+
export declare function getStatsQueryOptions({ url, dimensions, metrics, enabled, }: UseStatsQueryOptions): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<StatsResponse, Error, StatsResponse, (string | string[])[]>, "queryFn"> & {
|
22
|
+
queryFn?: import('@tanstack/query-core').QueryFunction<StatsResponse, (string | string[])[], never> | undefined;
|
23
|
+
} & {
|
24
|
+
queryKey: (string | string[])[] & {
|
25
|
+
[dataTagSymbol]: StatsResponse;
|
26
|
+
[dataTagErrorSymbol]: Error;
|
27
|
+
};
|
28
|
+
};
|
29
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './get-stats-query-options';
|