@ecency/sdk 1.1.9 → 1.1.10
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 +104 -98
- package/package.json +1 -1
package/dist/ecency-sdk.es.js
CHANGED
@@ -3,8 +3,8 @@ var W = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writab
|
|
3
3
|
var K = (e, t, n) => W(e, typeof t != "symbol" ? t + "" : t, n);
|
4
4
|
import { QueryClient as A, useMutation as d, useQuery as j, useInfiniteQuery as z, queryOptions as p, useQueryClient as U, infiniteQueryOptions as $ } from "@tanstack/react-query";
|
5
5
|
import { Client as R, PrivateKey as v, cryptoUtils as X, RCAPI as Y } from "@hiveio/dhive";
|
6
|
-
import
|
7
|
-
import * as
|
6
|
+
import b from "hivesigner";
|
7
|
+
import * as m from "remeda";
|
8
8
|
class Z {
|
9
9
|
constructor() {
|
10
10
|
K(this, "length", 0);
|
@@ -93,7 +93,7 @@ const _ = (e) => {
|
|
93
93
|
console.error(t);
|
94
94
|
return;
|
95
95
|
}
|
96
|
-
}, y = (e) => _(e) && _(e).accessToken, P = (e) => _(e) && _(e).postingKey, E = (e) => _(e) && _(e).loginType,
|
96
|
+
}, y = (e) => _(e) && _(e).accessToken, P = (e) => _(e) && _(e).postingKey, E = (e) => _(e) && _(e).loginType, fe = (e) => _(e) && _(e).refreshToken;
|
97
97
|
function ee() {
|
98
98
|
return new Promise((e) => {
|
99
99
|
var t;
|
@@ -102,7 +102,7 @@ function ee() {
|
|
102
102
|
});
|
103
103
|
});
|
104
104
|
}
|
105
|
-
const
|
105
|
+
const C = (e, t, n, o = null) => new Promise((r, c) => {
|
106
106
|
var s;
|
107
107
|
(s = window.hive_keychain) == null || s.requestBroadcast(
|
108
108
|
e,
|
@@ -126,9 +126,9 @@ const b = (e, t, n, o = null) => new Promise((r, c) => {
|
|
126
126
|
},
|
127
127
|
c
|
128
128
|
);
|
129
|
-
}),
|
129
|
+
}), ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
130
130
|
__proto__: null,
|
131
|
-
broadcast:
|
131
|
+
broadcast: C,
|
132
132
|
customJson: te,
|
133
133
|
handshake: ee
|
134
134
|
}, Symbol.toStringTag, { value: "Module" }));
|
@@ -152,14 +152,14 @@ function ne(e = [], t, n, o = () => {
|
|
152
152
|
}
|
153
153
|
const s = E(t);
|
154
154
|
if (s && s == "keychain")
|
155
|
-
return
|
155
|
+
return C(
|
156
156
|
t,
|
157
157
|
n(r),
|
158
158
|
"Posting"
|
159
159
|
).then((l) => l.result);
|
160
160
|
let a = y(t);
|
161
161
|
if (a)
|
162
|
-
return (await new
|
162
|
+
return (await new b.Client({
|
163
163
|
accessToken: a
|
164
164
|
}).broadcast(n(r))).result;
|
165
165
|
throw new Error(
|
@@ -188,17 +188,17 @@ async function oe(e, t, n) {
|
|
188
188
|
}
|
189
189
|
const c = E(e);
|
190
190
|
if (c && c == "keychain")
|
191
|
-
return
|
191
|
+
return C(e, [["custom_json", o]], "Posting").then((a) => a.result);
|
192
192
|
let s = y(e);
|
193
193
|
if (s)
|
194
|
-
return (await new
|
194
|
+
return (await new b.Client({
|
195
195
|
accessToken: s
|
196
196
|
}).customJson([], [e], t, JSON.stringify(n))).result;
|
197
197
|
throw new Error(
|
198
198
|
"[SDK][Broadcast] – cannot broadcast w/o posting key or token"
|
199
199
|
);
|
200
200
|
}
|
201
|
-
function
|
201
|
+
function _e() {
|
202
202
|
return new A({
|
203
203
|
defaultOptions: {
|
204
204
|
queries: {
|
@@ -249,7 +249,7 @@ var q;
|
|
249
249
|
}
|
250
250
|
e.generateClientServerInfiniteQuery = s;
|
251
251
|
})(q || (q = {}));
|
252
|
-
function
|
252
|
+
function ve() {
|
253
253
|
return p({
|
254
254
|
queryKey: ["core", "dynamic-props"],
|
255
255
|
refetchInterval: 6e4,
|
@@ -367,7 +367,7 @@ function T(e) {
|
|
367
367
|
staleTime: 6e4
|
368
368
|
});
|
369
369
|
}
|
370
|
-
function
|
370
|
+
function we(e, t = 5, n = []) {
|
371
371
|
return p({
|
372
372
|
queryKey: ["accounts", "search", e, n],
|
373
373
|
enabled: !!e,
|
@@ -379,7 +379,7 @@ function ve(e, t = 5, n = []) {
|
|
379
379
|
)
|
380
380
|
});
|
381
381
|
}
|
382
|
-
function
|
382
|
+
function me(e) {
|
383
383
|
return p({
|
384
384
|
queryKey: ["accounts", "check-wallet-pending", e],
|
385
385
|
queryFn: async () => await (await fetch(
|
@@ -411,7 +411,7 @@ function re(e, t) {
|
|
411
411
|
)
|
412
412
|
});
|
413
413
|
}
|
414
|
-
function
|
414
|
+
function be(e) {
|
415
415
|
return p({
|
416
416
|
queryKey: ["accounts", "subscriptions", e],
|
417
417
|
enabled: !!e,
|
@@ -424,7 +424,7 @@ function me(e) {
|
|
424
424
|
) ?? []
|
425
425
|
});
|
426
426
|
}
|
427
|
-
function
|
427
|
+
function Ce(e) {
|
428
428
|
return p({
|
429
429
|
queryKey: ["accounts", "bookmarks", e],
|
430
430
|
enabled: !!e,
|
@@ -444,7 +444,7 @@ function be(e) {
|
|
444
444
|
}
|
445
445
|
});
|
446
446
|
}
|
447
|
-
function
|
447
|
+
function Se(e) {
|
448
448
|
return p({
|
449
449
|
queryKey: ["accounts", "favourites", e],
|
450
450
|
enabled: !!e,
|
@@ -464,18 +464,24 @@ function Ce(e) {
|
|
464
464
|
}
|
465
465
|
});
|
466
466
|
}
|
467
|
+
function ie(e) {
|
468
|
+
return e == null ? void 0 : e.map(({ meta: t, ...n }) => ({
|
469
|
+
...n,
|
470
|
+
meta: m.omit(t, ["privateKey"])
|
471
|
+
}));
|
472
|
+
}
|
467
473
|
function Q({
|
468
474
|
profile: e,
|
469
475
|
tokens: t,
|
470
476
|
data: n
|
471
477
|
}) {
|
472
|
-
const o =
|
478
|
+
const o = m.pipe(
|
473
479
|
JSON.parse((n == null ? void 0 : n.posting_json_metadata) || "{}"),
|
474
|
-
|
480
|
+
m.mergeDeep(e ?? {})
|
475
481
|
);
|
476
|
-
return t && t.length > 0 && (o.tokens = t), o;
|
482
|
+
return t && t.length > 0 && (o.tokens = t), o.tokens = ie(o.tokens), o;
|
477
483
|
}
|
478
|
-
function
|
484
|
+
function Oe(e) {
|
479
485
|
const t = U(), { data: n } = j(T(e));
|
480
486
|
return ne(
|
481
487
|
["accounts", "update", n == null ? void 0 : n.name],
|
@@ -502,13 +508,13 @@ function Se(e) {
|
|
502
508
|
(c) => {
|
503
509
|
if (!c)
|
504
510
|
return c;
|
505
|
-
const s =
|
511
|
+
const s = m.clone(c);
|
506
512
|
return s.profile = Q({ ...r, data: c }), s;
|
507
513
|
}
|
508
514
|
)
|
509
515
|
);
|
510
516
|
}
|
511
|
-
function
|
517
|
+
function Ke(e, t, n, o) {
|
512
518
|
return d({
|
513
519
|
mutationKey: [],
|
514
520
|
mutationFn: async (r) => {
|
@@ -545,7 +551,7 @@ function Oe(e, t, n, o) {
|
|
545
551
|
}
|
546
552
|
});
|
547
553
|
}
|
548
|
-
function
|
554
|
+
function ke(e, t, n) {
|
549
555
|
return d({
|
550
556
|
mutationKey: ["accounts", "bookmarks", "add", e],
|
551
557
|
mutationFn: async ({ author: o, permlink: r }) => {
|
@@ -574,7 +580,7 @@ function Ke(e, t, n) {
|
|
574
580
|
onError: n
|
575
581
|
});
|
576
582
|
}
|
577
|
-
function
|
583
|
+
function qe(e, t, n) {
|
578
584
|
return d({
|
579
585
|
mutationKey: ["accounts", "bookmarks", "delete", e],
|
580
586
|
mutationFn: async (o) => {
|
@@ -602,7 +608,7 @@ function ke(e, t, n) {
|
|
602
608
|
onError: n
|
603
609
|
});
|
604
610
|
}
|
605
|
-
function
|
611
|
+
function Te(e, t, n) {
|
606
612
|
return d({
|
607
613
|
mutationKey: ["accounts", "favourites", "add", e],
|
608
614
|
mutationFn: async (o) => {
|
@@ -630,7 +636,7 @@ function qe(e, t, n) {
|
|
630
636
|
onError: n
|
631
637
|
});
|
632
638
|
}
|
633
|
-
function
|
639
|
+
function Qe(e, t, n) {
|
634
640
|
return d({
|
635
641
|
mutationKey: ["accounts", "favourites", "add", e],
|
636
642
|
mutationFn: async (o) => {
|
@@ -658,7 +664,7 @@ function Te(e, t, n) {
|
|
658
664
|
onError: n
|
659
665
|
});
|
660
666
|
}
|
661
|
-
function
|
667
|
+
function Ae(e) {
|
662
668
|
return d({
|
663
669
|
mutationKey: ["operations", "sign", e],
|
664
670
|
mutationFn: ({
|
@@ -675,7 +681,7 @@ function Qe(e) {
|
|
675
681
|
}
|
676
682
|
});
|
677
683
|
}
|
678
|
-
function
|
684
|
+
function je(e, t = "Active") {
|
679
685
|
return d({
|
680
686
|
mutationKey: ["operations", "sign-keychain", e],
|
681
687
|
mutationFn: ({ operation: n }) => {
|
@@ -683,24 +689,24 @@ function Ae(e, t = "Active") {
|
|
683
689
|
throw new Error(
|
684
690
|
"[SDK][Keychain] – cannot sign operation with anon user"
|
685
691
|
);
|
686
|
-
return
|
692
|
+
return C(e, [n], t);
|
687
693
|
}
|
688
694
|
});
|
689
695
|
}
|
690
|
-
function
|
696
|
+
function De(e = "/") {
|
691
697
|
return d({
|
692
698
|
mutationKey: ["operations", "sign-hivesigner", e],
|
693
|
-
mutationFn: async ({ operation: t }) =>
|
699
|
+
mutationFn: async ({ operation: t }) => b.sendOperation(t, { callback: e }, () => {
|
694
700
|
})
|
695
701
|
});
|
696
702
|
}
|
697
|
-
function
|
703
|
+
function Fe() {
|
698
704
|
return p({
|
699
705
|
queryKey: ["operations", "chain-properties"],
|
700
706
|
queryFn: async () => await i.hiveClient.database.getChainProperties()
|
701
707
|
});
|
702
708
|
}
|
703
|
-
function
|
709
|
+
function Pe(e = 20) {
|
704
710
|
return $({
|
705
711
|
queryKey: ["posts", "trending-tags"],
|
706
712
|
queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
@@ -732,7 +738,7 @@ function O(e) {
|
|
732
738
|
enabled: !!e
|
733
739
|
});
|
734
740
|
}
|
735
|
-
function
|
741
|
+
function Ee(e = "feed") {
|
736
742
|
return p({
|
737
743
|
queryKey: ["posts", "promoted", e],
|
738
744
|
queryFn: async () => {
|
@@ -748,7 +754,7 @@ function Pe(e = "feed") {
|
|
748
754
|
}
|
749
755
|
});
|
750
756
|
}
|
751
|
-
function
|
757
|
+
function Be(e) {
|
752
758
|
return d({
|
753
759
|
mutationKey: ["posts", "add-fragment", e],
|
754
760
|
mutationFn: async ({ title: t, body: n }) => (await fetch(
|
@@ -773,7 +779,7 @@ function Ee(e) {
|
|
773
779
|
}
|
774
780
|
});
|
775
781
|
}
|
776
|
-
function
|
782
|
+
function He(e, t) {
|
777
783
|
return d({
|
778
784
|
mutationKey: ["posts", "edit-fragment", e, t],
|
779
785
|
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
@@ -804,7 +810,7 @@ function Be(e, t) {
|
|
804
810
|
}
|
805
811
|
});
|
806
812
|
}
|
807
|
-
function
|
813
|
+
function Ie(e, t) {
|
808
814
|
return d({
|
809
815
|
mutationKey: ["posts", "remove-fragment", e],
|
810
816
|
mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
|
@@ -848,27 +854,27 @@ function B(e, t) {
|
|
848
854
|
}
|
849
855
|
});
|
850
856
|
}
|
851
|
-
const
|
857
|
+
const Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
852
858
|
__proto__: null,
|
853
859
|
useRecordActivity: B
|
854
860
|
}, Symbol.toStringTag, { value: "Module" }));
|
855
|
-
function
|
861
|
+
function se(e, t) {
|
856
862
|
return p({
|
857
863
|
queryKey: ["integrations", "hivesigner", "decode-memo", e],
|
858
864
|
queryFn: async () => {
|
859
865
|
const n = y(e);
|
860
866
|
if (n)
|
861
|
-
return new
|
867
|
+
return new b.Client({
|
862
868
|
accessToken: n
|
863
869
|
}).decode(t);
|
864
870
|
}
|
865
871
|
});
|
866
872
|
}
|
867
|
-
const
|
873
|
+
const ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
868
874
|
__proto__: null,
|
869
|
-
getDecodeMemoQueryOptions:
|
870
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
871
|
-
queries:
|
875
|
+
getDecodeMemoQueryOptions: se
|
876
|
+
}, Symbol.toStringTag, { value: "Module" })), ce = {
|
877
|
+
queries: ae
|
872
878
|
};
|
873
879
|
function S(e) {
|
874
880
|
return p({
|
@@ -884,7 +890,7 @@ function S(e) {
|
|
884
890
|
"Content-Type": "application/json"
|
885
891
|
}
|
886
892
|
}
|
887
|
-
), n =
|
893
|
+
), n = ce.queries.getDecodeMemoQueryOptions(
|
888
894
|
e,
|
889
895
|
(await t.json()).memo
|
890
896
|
);
|
@@ -896,7 +902,7 @@ function S(e) {
|
|
896
902
|
}
|
897
903
|
});
|
898
904
|
}
|
899
|
-
function
|
905
|
+
function ue(e) {
|
900
906
|
return p({
|
901
907
|
queryKey: ["integrations", "3speak", "videos", e],
|
902
908
|
enabled: !!e,
|
@@ -919,14 +925,14 @@ function ce(e) {
|
|
919
925
|
}
|
920
926
|
});
|
921
927
|
}
|
922
|
-
const
|
928
|
+
const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
923
929
|
__proto__: null,
|
924
930
|
getAccountTokenQueryOptions: S,
|
925
|
-
getAccountVideosQueryOptions:
|
926
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
927
|
-
queries:
|
931
|
+
getAccountVideosQueryOptions: ue
|
932
|
+
}, Symbol.toStringTag, { value: "Module" })), Je = {
|
933
|
+
queries: pe
|
928
934
|
};
|
929
|
-
function
|
935
|
+
function Ne(e) {
|
930
936
|
return p({
|
931
937
|
queryKey: ["integrations", "hiveposh", "links", e],
|
932
938
|
queryFn: async () => {
|
@@ -951,7 +957,7 @@ function Je(e) {
|
|
951
957
|
}
|
952
958
|
});
|
953
959
|
}
|
954
|
-
function
|
960
|
+
function xe() {
|
955
961
|
return p({
|
956
962
|
queryKey: ["resource-credits", "stats"],
|
957
963
|
queryFn: async () => (await i.hiveClient.call(
|
@@ -961,14 +967,14 @@ function Ne() {
|
|
961
967
|
)).rc_stats
|
962
968
|
});
|
963
969
|
}
|
964
|
-
function
|
970
|
+
function Ge(e) {
|
965
971
|
return p({
|
966
972
|
queryKey: ["resource-credits", "account", e],
|
967
973
|
queryFn: async () => new Y(i.hiveClient).findRCAccounts([e]),
|
968
974
|
enabled: !!e
|
969
975
|
});
|
970
976
|
}
|
971
|
-
function
|
977
|
+
function Ve(e, t) {
|
972
978
|
return p({
|
973
979
|
queryKey: ["games", "status-check", t, e],
|
974
980
|
enabled: !!e,
|
@@ -991,7 +997,7 @@ function Ge(e, t) {
|
|
991
997
|
}
|
992
998
|
});
|
993
999
|
}
|
994
|
-
function
|
1000
|
+
function We(e, t, n) {
|
995
1001
|
const { mutateAsync: o } = B(
|
996
1002
|
e,
|
997
1003
|
"spin-rolled"
|
@@ -1021,7 +1027,7 @@ function Ve(e, t, n) {
|
|
1021
1027
|
}
|
1022
1028
|
});
|
1023
1029
|
}
|
1024
|
-
function
|
1030
|
+
function ze(e, t, n = 100, o = void 0, r = !0) {
|
1025
1031
|
return p({
|
1026
1032
|
queryKey: ["communities", "list", e, t, n],
|
1027
1033
|
enabled: r,
|
@@ -1041,7 +1047,7 @@ function We(e, t, n = 100, o = void 0, r = !0) {
|
|
1041
1047
|
}
|
1042
1048
|
});
|
1043
1049
|
}
|
1044
|
-
function
|
1050
|
+
function Ue(e, t) {
|
1045
1051
|
return p({
|
1046
1052
|
queryKey: ["community", "context", e, t],
|
1047
1053
|
enabled: !!e && !!t,
|
@@ -1062,7 +1068,7 @@ function ze(e, t) {
|
|
1062
1068
|
});
|
1063
1069
|
}
|
1064
1070
|
var h = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(h || {});
|
1065
|
-
const
|
1071
|
+
const $e = {
|
1066
1072
|
owner: [
|
1067
1073
|
"admin",
|
1068
1074
|
"mod",
|
@@ -1085,10 +1091,10 @@ const Ue = {
|
|
1085
1091
|
/* MUTED */
|
1086
1092
|
]
|
1087
1093
|
};
|
1088
|
-
function
|
1094
|
+
function Re(e, t) {
|
1089
1095
|
return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
|
1090
1096
|
}
|
1091
|
-
function
|
1097
|
+
function Xe({
|
1092
1098
|
communityType: e,
|
1093
1099
|
userRole: t,
|
1094
1100
|
subscribed: n
|
@@ -1115,53 +1121,53 @@ function Re({
|
|
1115
1121
|
export {
|
1116
1122
|
i as CONFIG,
|
1117
1123
|
k as ConfigManager,
|
1118
|
-
|
1124
|
+
Me as EcencyAnalytics,
|
1119
1125
|
q as EcencyQueriesManager,
|
1120
|
-
|
1121
|
-
|
1126
|
+
ce as HiveSignerIntegration,
|
1127
|
+
ge as Keychain,
|
1122
1128
|
h as ROLES,
|
1123
|
-
|
1129
|
+
Je as ThreeSpeakIntegration,
|
1124
1130
|
oe as broadcastJson,
|
1125
|
-
|
1131
|
+
me as checkUsernameWalletsPendingQueryOptions,
|
1126
1132
|
y as getAccessToken,
|
1127
1133
|
T as getAccountFullQueryOptions,
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1134
|
+
Ge as getAccountRcQueryOptions,
|
1135
|
+
be as getAccountSubscriptionsQueryOptions,
|
1136
|
+
Ce as getActiveAccountBookmarksQueryOptions,
|
1137
|
+
Se as getActiveAccountFavouritesQueryOptions,
|
1138
|
+
Fe as getChainPropertiesQueryOptions,
|
1139
|
+
ze as getCommunitiesQueryOptions,
|
1140
|
+
Ue as getCommunityContextQueryOptions,
|
1141
|
+
Xe as getCommunityPermissions,
|
1142
|
+
Re as getCommunityType,
|
1143
|
+
ve as getDynamicPropsQueryOptions,
|
1138
1144
|
O as getFragmentsQueryOptions,
|
1139
|
-
|
1140
|
-
|
1145
|
+
Ve as getGameStatusCheckQueryOptions,
|
1146
|
+
Ne as getHivePoshLinksQueryOptions,
|
1141
1147
|
E as getLoginType,
|
1142
1148
|
P as getPostingKey,
|
1143
|
-
|
1149
|
+
Ee as getPromotedPostsQuery,
|
1144
1150
|
u as getQueryClient,
|
1145
|
-
|
1146
|
-
|
1151
|
+
xe as getRcStatsQueryOptions,
|
1152
|
+
fe as getRefreshToken,
|
1147
1153
|
re as getRelationshipBetweenAccountsQueryOptions,
|
1148
|
-
|
1149
|
-
|
1154
|
+
we as getSearchAccountsByUsernameQueryOptions,
|
1155
|
+
Pe as getTrendingTagsQueryOptions,
|
1150
1156
|
_ as getUser,
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1157
|
+
_e as makeQueryClient,
|
1158
|
+
$e as roleMap,
|
1159
|
+
Te as useAccountFavouriteAdd,
|
1160
|
+
Qe as useAccountFavouriteDelete,
|
1161
|
+
Ke as useAccountRelationsUpdate,
|
1162
|
+
Oe as useAccountUpdate,
|
1163
|
+
Be as useAddFragment,
|
1164
|
+
ke as useBookmarkAdd,
|
1165
|
+
qe as useBookmarkDelete,
|
1160
1166
|
ne as useBroadcastMutation,
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
+
He as useEditFragment,
|
1168
|
+
We as useGameClaim,
|
1169
|
+
Ie as useRemoveFragment,
|
1170
|
+
De as useSignOperationByHivesigner,
|
1171
|
+
Ae as useSignOperationByKey,
|
1172
|
+
je as useSignOperationByKeychain
|
1167
1173
|
};
|