@ecency/sdk 1.1.13 → 1.1.14
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
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
4
|
+
import { QueryClient as F, useMutation as d, useQuery as S, useInfiniteQuery as z, queryOptions as p, useQueryClient as P, infiniteQueryOptions as $ } from "@tanstack/react-query";
|
5
5
|
import { Client as R, PrivateKey as _, cryptoUtils as L, RCAPI as X } from "@hiveio/dhive";
|
6
6
|
import K from "hivesigner";
|
7
7
|
import * as f from "remeda";
|
@@ -55,13 +55,13 @@ const c = {
|
|
55
55
|
plausibleHost: "https://pl.ecency.com",
|
56
56
|
spkNode: "https://spk.good-karma.xyz"
|
57
57
|
};
|
58
|
-
var
|
58
|
+
var j;
|
59
59
|
((e) => {
|
60
60
|
function t(n) {
|
61
61
|
c.queryClient = n;
|
62
62
|
}
|
63
63
|
e.setQueryClient = t;
|
64
|
-
})(
|
64
|
+
})(j || (j = {}));
|
65
65
|
function Z(e) {
|
66
66
|
let t = atob(e);
|
67
67
|
if (t[0] === "{")
|
@@ -103,17 +103,17 @@ function ee() {
|
|
103
103
|
});
|
104
104
|
}
|
105
105
|
const C = (e, t, n, o = null) => new Promise((r, a) => {
|
106
|
-
var
|
107
|
-
(
|
106
|
+
var s;
|
107
|
+
(s = window.hive_keychain) == null || s.requestBroadcast(
|
108
108
|
e,
|
109
109
|
t,
|
110
110
|
n,
|
111
|
-
(
|
112
|
-
|
111
|
+
(i) => {
|
112
|
+
i.success || a({ message: "Operation cancelled" }), r(i);
|
113
113
|
},
|
114
114
|
o
|
115
115
|
);
|
116
|
-
}), te = (e, t, n, o, r, a = null) => new Promise((
|
116
|
+
}), te = (e, t, n, o, r, a = null) => new Promise((s, i) => {
|
117
117
|
var u;
|
118
118
|
(u = window.hive_keychain) == null || u.requestCustomJson(
|
119
119
|
e,
|
@@ -122,7 +122,7 @@ const C = (e, t, n, o = null) => new Promise((r, a) => {
|
|
122
122
|
o,
|
123
123
|
r,
|
124
124
|
(h) => {
|
125
|
-
h.success ||
|
125
|
+
h.success || i({ message: "Operation cancelled" }), s(h);
|
126
126
|
},
|
127
127
|
a
|
128
128
|
);
|
@@ -150,17 +150,17 @@ function ne(e = [], t, n, o = () => {
|
|
150
150
|
u
|
151
151
|
);
|
152
152
|
}
|
153
|
-
const
|
154
|
-
if (
|
153
|
+
const s = J(t);
|
154
|
+
if (s && s == "keychain")
|
155
155
|
return C(
|
156
156
|
t,
|
157
157
|
n(r),
|
158
158
|
"Posting"
|
159
159
|
).then((u) => u.result);
|
160
|
-
let
|
161
|
-
if (
|
160
|
+
let i = l(t);
|
161
|
+
if (i)
|
162
162
|
return (await new K.Client({
|
163
|
-
accessToken:
|
163
|
+
accessToken: i
|
164
164
|
}).broadcast(n(r))).result;
|
165
165
|
throw new Error(
|
166
166
|
"[SDK][Broadcast] – cannot broadcast w/o posting key or token"
|
@@ -180,19 +180,19 @@ async function oe(e, t, n) {
|
|
180
180
|
json: JSON.stringify(n)
|
181
181
|
}, r = H(e);
|
182
182
|
if (r) {
|
183
|
-
const
|
183
|
+
const i = _.fromString(r);
|
184
184
|
return c.hiveClient.broadcast.json(
|
185
185
|
o,
|
186
|
-
|
186
|
+
i
|
187
187
|
);
|
188
188
|
}
|
189
189
|
const a = J(e);
|
190
190
|
if (a && a == "keychain")
|
191
|
-
return C(e, [["custom_json", o]], "Posting").then((
|
192
|
-
let
|
193
|
-
if (
|
191
|
+
return C(e, [["custom_json", o]], "Posting").then((i) => i.result);
|
192
|
+
let s = l(e);
|
193
|
+
if (s)
|
194
194
|
return (await new K.Client({
|
195
|
-
accessToken:
|
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"
|
@@ -212,43 +212,43 @@ function me() {
|
|
212
212
|
});
|
213
213
|
}
|
214
214
|
const y = () => c.queryClient;
|
215
|
-
var
|
215
|
+
var Q;
|
216
216
|
((e) => {
|
217
|
-
function t(
|
218
|
-
return y().getQueryData(
|
217
|
+
function t(i) {
|
218
|
+
return y().getQueryData(i);
|
219
219
|
}
|
220
220
|
e.getQueryData = t;
|
221
|
-
function n(
|
222
|
-
return y().getQueryData(
|
221
|
+
function n(i) {
|
222
|
+
return y().getQueryData(i);
|
223
223
|
}
|
224
224
|
e.getInfiniteQueryData = n;
|
225
|
-
async function o(
|
226
|
-
return await y().prefetchQuery(
|
225
|
+
async function o(i) {
|
226
|
+
return await y().prefetchQuery(i), t(i.queryKey);
|
227
227
|
}
|
228
228
|
e.prefetchQuery = o;
|
229
|
-
async function r(
|
230
|
-
return await y().prefetchInfiniteQuery(
|
229
|
+
async function r(i) {
|
230
|
+
return await y().prefetchInfiniteQuery(i), n(i.queryKey);
|
231
231
|
}
|
232
232
|
e.prefetchInfiniteQuery = r;
|
233
|
-
function a(
|
233
|
+
function a(i) {
|
234
234
|
return {
|
235
|
-
prefetch: () => o(
|
236
|
-
getData: () => t(
|
237
|
-
useClientQuery: () =>
|
238
|
-
fetchAndGet: () => y().fetchQuery(
|
235
|
+
prefetch: () => o(i),
|
236
|
+
getData: () => t(i.queryKey),
|
237
|
+
useClientQuery: () => S(i),
|
238
|
+
fetchAndGet: () => y().fetchQuery(i)
|
239
239
|
};
|
240
240
|
}
|
241
241
|
e.generateClientServerQuery = a;
|
242
|
-
function i
|
242
|
+
function s(i) {
|
243
243
|
return {
|
244
|
-
prefetch: () => r(
|
245
|
-
getData: () => n(
|
246
|
-
useClientQuery: () => z(
|
247
|
-
fetchAndGet: () => y().fetchInfiniteQuery(
|
244
|
+
prefetch: () => r(i),
|
245
|
+
getData: () => n(i.queryKey),
|
246
|
+
useClientQuery: () => z(i),
|
247
|
+
fetchAndGet: () => y().fetchInfiniteQuery(i)
|
248
248
|
};
|
249
249
|
}
|
250
|
-
e.generateClientServerInfiniteQuery =
|
251
|
-
})(
|
250
|
+
e.generateClientServerInfiniteQuery = s;
|
251
|
+
})(Q || (Q = {}));
|
252
252
|
function we() {
|
253
253
|
return p({
|
254
254
|
queryKey: ["core", "dynamic-props"],
|
@@ -269,25 +269,25 @@ function we() {
|
|
269
269
|
), o = await c.hiveClient.database.call(
|
270
270
|
"get_reward_fund",
|
271
271
|
["post"]
|
272
|
-
), r = m(e.total_vesting_fund_hive).amount / m(e.total_vesting_shares).amount * 1e6, a = m(t.current_median_history.base).amount,
|
272
|
+
), 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, N = m(
|
273
273
|
e.total_vesting_fund_hive
|
274
274
|
).amount, I = m(
|
275
275
|
e.total_vesting_shares
|
276
|
-
).amount, x = m(e.virtual_supply).amount,
|
276
|
+
).amount, x = m(e.virtual_supply).amount, U = e.vesting_reward_percent, G = n.account_creation_fee;
|
277
277
|
return {
|
278
278
|
hivePerMVests: r,
|
279
279
|
base: a,
|
280
|
-
quote:
|
281
|
-
fundRecentClaims:
|
280
|
+
quote: s,
|
281
|
+
fundRecentClaims: i,
|
282
282
|
fundRewardBalance: u,
|
283
283
|
hbdPrintRate: h,
|
284
|
-
hbdInterestRate:
|
284
|
+
hbdInterestRate: k,
|
285
285
|
headBlock: O,
|
286
286
|
totalVestingFund: N,
|
287
287
|
totalVestingShares: I,
|
288
288
|
virtualSupply: x,
|
289
|
-
vestingRewardPercent:
|
290
|
-
accountCreationFee:
|
289
|
+
vestingRewardPercent: U,
|
290
|
+
accountCreationFee: G
|
291
291
|
};
|
292
292
|
}
|
293
293
|
});
|
@@ -511,7 +511,7 @@ function D({
|
|
511
511
|
return t && t.length > 0 && (o.tokens = t), o.tokens = ie(o.tokens), o;
|
512
512
|
}
|
513
513
|
function Ae(e) {
|
514
|
-
const t = P(), { data: n } =
|
514
|
+
const t = P(), { data: n } = S(b(e));
|
515
515
|
return ne(
|
516
516
|
["accounts", "update", n == null ? void 0 : n.name],
|
517
517
|
e,
|
@@ -537,8 +537,8 @@ function Ae(e) {
|
|
537
537
|
(a) => {
|
538
538
|
if (!a)
|
539
539
|
return a;
|
540
|
-
const
|
541
|
-
return
|
540
|
+
const s = f.clone(a);
|
541
|
+
return s.profile = D({ ...r, data: a }), s;
|
542
542
|
}
|
543
543
|
)
|
544
544
|
);
|
@@ -552,7 +552,7 @@ function Te(e, t, n, o) {
|
|
552
552
|
t
|
553
553
|
);
|
554
554
|
await y().prefetchQuery(a);
|
555
|
-
const
|
555
|
+
const s = y().getQueryData(
|
556
556
|
a.queryKey
|
557
557
|
);
|
558
558
|
return await oe(e, "follow", [
|
@@ -561,14 +561,14 @@ function Te(e, t, n, o) {
|
|
561
561
|
follower: e,
|
562
562
|
following: t,
|
563
563
|
what: [
|
564
|
-
...r === "toggle-ignore" && !(
|
565
|
-
...r === "toggle-follow" && !(
|
564
|
+
...r === "toggle-ignore" && !(s != null && s.ignores) ? ["ignore"] : [],
|
565
|
+
...r === "toggle-follow" && !(s != null && s.follows) ? ["blog"] : []
|
566
566
|
]
|
567
567
|
}
|
568
568
|
]), {
|
569
|
-
...
|
570
|
-
ignores: r === "toggle-ignore" ? !(
|
571
|
-
follows: r === "toggle-follow" ? !(
|
569
|
+
...s,
|
570
|
+
ignores: r === "toggle-ignore" ? !(s != null && s.ignores) : s == null ? void 0 : s.ignores,
|
571
|
+
follows: r === "toggle-follow" ? !(s != null && s.follows) : s == null ? void 0 : s.follows
|
572
572
|
};
|
573
573
|
},
|
574
574
|
onError: o,
|
@@ -580,7 +580,7 @@ function Te(e, t, n, o) {
|
|
580
580
|
}
|
581
581
|
});
|
582
582
|
}
|
583
|
-
function
|
583
|
+
function je(e, t, n) {
|
584
584
|
return d({
|
585
585
|
mutationKey: ["accounts", "bookmarks", "add", e],
|
586
586
|
mutationFn: async ({ author: o, permlink: r }) => {
|
@@ -609,7 +609,7 @@ function Qe(e, t, n) {
|
|
609
609
|
onError: n
|
610
610
|
});
|
611
611
|
}
|
612
|
-
function
|
612
|
+
function Qe(e, t, n) {
|
613
613
|
return d({
|
614
614
|
mutationKey: ["accounts", "bookmarks", "delete", e],
|
615
615
|
mutationFn: async (o) => {
|
@@ -705,7 +705,7 @@ function se(e, t) {
|
|
705
705
|
);
|
706
706
|
}
|
707
707
|
function ae(e, t) {
|
708
|
-
const { data: n } =
|
708
|
+
const { data: n } = S(b(e));
|
709
709
|
return d({
|
710
710
|
mutationKey: ["accounts", "keys-update", e],
|
711
711
|
mutationFn: async ({ keys: o, keepCurrent: r = !1, currentKey: a }) => {
|
@@ -713,12 +713,12 @@ function ae(e, t) {
|
|
713
713
|
throw new Error(
|
714
714
|
"[SDK][Update password] – cannot update keys for anon user"
|
715
715
|
);
|
716
|
-
const
|
717
|
-
const u = f.clone(n[
|
716
|
+
const s = (i) => {
|
717
|
+
const u = f.clone(n[i]);
|
718
718
|
return u.key_auths = se(
|
719
719
|
r ? u.key_auths : [],
|
720
720
|
o.map(
|
721
|
-
(h,
|
721
|
+
(h, k) => [h[i].createPublic().toString(), k + 1]
|
722
722
|
)
|
723
723
|
), u;
|
724
724
|
};
|
@@ -726,9 +726,9 @@ function ae(e, t) {
|
|
726
726
|
{
|
727
727
|
account: e,
|
728
728
|
json_metadata: n.json_metadata,
|
729
|
-
owner:
|
730
|
-
active:
|
731
|
-
posting:
|
729
|
+
owner: s("owner"),
|
730
|
+
active: s("active"),
|
731
|
+
posting: s("posting"),
|
732
732
|
memo_key: r ? n.memo_key : o[0].memo_key.createPublic().toString()
|
733
733
|
},
|
734
734
|
a
|
@@ -738,26 +738,26 @@ function ae(e, t) {
|
|
738
738
|
});
|
739
739
|
}
|
740
740
|
function Pe(e, t) {
|
741
|
-
const { data: n } =
|
741
|
+
const { data: n } = S(b(e)), { mutateAsync: o } = ae(e);
|
742
742
|
return d({
|
743
743
|
mutationKey: ["accounts", "password-update", e],
|
744
744
|
mutationFn: async ({
|
745
745
|
newPassword: r,
|
746
746
|
currentPassword: a,
|
747
|
-
keepCurrent:
|
747
|
+
keepCurrent: s
|
748
748
|
}) => {
|
749
749
|
if (!n)
|
750
750
|
throw new Error(
|
751
751
|
"[SDK][Update password] – cannot update password for anon user"
|
752
752
|
);
|
753
|
-
const
|
753
|
+
const i = _.fromLogin(
|
754
754
|
e,
|
755
755
|
a,
|
756
756
|
"owner"
|
757
757
|
);
|
758
758
|
return o({
|
759
|
-
currentKey:
|
760
|
-
keepCurrent:
|
759
|
+
currentKey: i,
|
760
|
+
keepCurrent: s,
|
761
761
|
keys: [
|
762
762
|
{
|
763
763
|
owner: _.fromLogin(e, r, "owner"),
|
@@ -772,29 +772,29 @@ function Pe(e, t) {
|
|
772
772
|
});
|
773
773
|
}
|
774
774
|
function Ee(e, t) {
|
775
|
-
const n = P(), { data: o } =
|
775
|
+
const n = P(), { data: o } = S(b(e));
|
776
776
|
return d({
|
777
777
|
mutationKey: ["accounts", "revoke-posting", o == null ? void 0 : o.name],
|
778
|
-
mutationFn: async ({ accountName: r, type: a, key:
|
778
|
+
mutationFn: async ({ accountName: r, type: a, key: s }) => {
|
779
779
|
if (!o)
|
780
780
|
throw new Error(
|
781
781
|
"[SDK][Accounts] – cannot revoke posting for anonymous user"
|
782
782
|
);
|
783
|
-
const
|
783
|
+
const i = f.pipe(
|
784
784
|
{},
|
785
785
|
f.mergeDeep(o.posting)
|
786
786
|
);
|
787
|
-
|
787
|
+
i.account_auths = i.account_auths.filter(
|
788
788
|
([h]) => h !== r
|
789
789
|
);
|
790
790
|
const u = {
|
791
791
|
account: o.name,
|
792
|
-
posting:
|
792
|
+
posting: i,
|
793
793
|
memo_key: o.memo_key,
|
794
794
|
json_metadata: o.json_metadata
|
795
795
|
};
|
796
|
-
if (a === "key" &&
|
797
|
-
return c.hiveClient.broadcast.updateAccount(u,
|
796
|
+
if (a === "key" && s)
|
797
|
+
return c.hiveClient.broadcast.updateAccount(u, s);
|
798
798
|
if (a === "keychain")
|
799
799
|
return C(
|
800
800
|
o.name,
|
@@ -814,17 +814,17 @@ function Ee(e, t) {
|
|
814
814
|
}
|
815
815
|
},
|
816
816
|
onError: t.onError,
|
817
|
-
onSuccess: (r, a,
|
818
|
-
var
|
819
|
-
(
|
817
|
+
onSuccess: (r, a, s) => {
|
818
|
+
var i;
|
819
|
+
(i = t.onSuccess) == null || i.call(t, r, a, s), n.setQueryData(
|
820
820
|
b(e).queryKey,
|
821
821
|
(u) => {
|
822
|
-
var h,
|
822
|
+
var h, k;
|
823
823
|
return {
|
824
824
|
...u,
|
825
825
|
posting: {
|
826
826
|
...u == null ? void 0 : u.posting,
|
827
|
-
account_auths: ((
|
827
|
+
account_auths: ((k = (h = u == null ? void 0 : u.posting) == null ? void 0 : h.account_auths) == null ? void 0 : k.filter(
|
828
828
|
([O]) => O !== a.accountName
|
829
829
|
)) ?? []
|
830
830
|
}
|
@@ -835,15 +835,15 @@ function Ee(e, t) {
|
|
835
835
|
});
|
836
836
|
}
|
837
837
|
function Be(e, t) {
|
838
|
-
const { data: n } =
|
838
|
+
const { data: n } = S(b(e));
|
839
839
|
return d({
|
840
840
|
mutationKey: ["accounts", "recovery", n == null ? void 0 : n.name],
|
841
|
-
mutationFn: async ({ accountName: o, type: r, key: a, email:
|
841
|
+
mutationFn: async ({ accountName: o, type: r, key: a, email: s }) => {
|
842
842
|
if (!n)
|
843
843
|
throw new Error(
|
844
844
|
"[SDK][Accounts] – cannot change recovery for anonymous user"
|
845
845
|
);
|
846
|
-
const
|
846
|
+
const i = {
|
847
847
|
account_to_recover: n.name,
|
848
848
|
new_recovery_account: o,
|
849
849
|
extensions: []
|
@@ -853,7 +853,7 @@ function Be(e, t) {
|
|
853
853
|
method: "POST",
|
854
854
|
body: JSON.stringify({
|
855
855
|
code: l(n.name),
|
856
|
-
email:
|
856
|
+
email: s,
|
857
857
|
publicKeys: [
|
858
858
|
...n.owner.key_auths,
|
859
859
|
...n.active.key_auths,
|
@@ -864,13 +864,13 @@ function Be(e, t) {
|
|
864
864
|
});
|
865
865
|
if (r === "key" && a)
|
866
866
|
return c.hiveClient.broadcast.sendOperations(
|
867
|
-
[["change_recovery_account",
|
867
|
+
[["change_recovery_account", i]],
|
868
868
|
a
|
869
869
|
);
|
870
870
|
if (r === "keychain")
|
871
871
|
return C(
|
872
872
|
n.name,
|
873
|
-
[["change_recovery_account",
|
873
|
+
[["change_recovery_account", i]],
|
874
874
|
"Active"
|
875
875
|
);
|
876
876
|
{
|
@@ -878,7 +878,7 @@ function Be(e, t) {
|
|
878
878
|
callback: `https://ecency.com/@${n.name}/permissions`
|
879
879
|
};
|
880
880
|
return K.sendOperation(
|
881
|
-
["change_recovery_account",
|
881
|
+
["change_recovery_account", i],
|
882
882
|
u,
|
883
883
|
() => {
|
884
884
|
}
|
@@ -889,7 +889,37 @@ function Be(e, t) {
|
|
889
889
|
onSuccess: t.onSuccess
|
890
890
|
});
|
891
891
|
}
|
892
|
-
function He(e) {
|
892
|
+
function He(e, t) {
|
893
|
+
const { data: n } = S(b(e));
|
894
|
+
return d({
|
895
|
+
mutationKey: ["accounts", "revoke-key", n == null ? void 0 : n.name],
|
896
|
+
mutationFn: async ({ currentKey: o, revokingKey: r }) => {
|
897
|
+
if (!n)
|
898
|
+
throw new Error(
|
899
|
+
"[SDK][Update password] – cannot update keys for anon user"
|
900
|
+
);
|
901
|
+
const a = (s) => {
|
902
|
+
const i = f.clone(n[s]);
|
903
|
+
return i.key_auths = i.key_auths.filter(
|
904
|
+
([u]) => u !== r.toString()
|
905
|
+
), i;
|
906
|
+
};
|
907
|
+
return c.hiveClient.broadcast.updateAccount(
|
908
|
+
{
|
909
|
+
account: n.name,
|
910
|
+
json_metadata: n.json_metadata,
|
911
|
+
owner: a("owner"),
|
912
|
+
active: a("active"),
|
913
|
+
posting: a("posting"),
|
914
|
+
memo_key: n.memo_key
|
915
|
+
},
|
916
|
+
o
|
917
|
+
);
|
918
|
+
},
|
919
|
+
...t
|
920
|
+
});
|
921
|
+
}
|
922
|
+
function Je(e) {
|
893
923
|
return d({
|
894
924
|
mutationKey: ["operations", "sign", e],
|
895
925
|
mutationFn: ({
|
@@ -906,7 +936,7 @@ function He(e) {
|
|
906
936
|
}
|
907
937
|
});
|
908
938
|
}
|
909
|
-
function
|
939
|
+
function Me(e, t = "Active") {
|
910
940
|
return d({
|
911
941
|
mutationKey: ["operations", "sign-keychain", e],
|
912
942
|
mutationFn: ({ operation: n }) => {
|
@@ -918,20 +948,20 @@ function Je(e, t = "Active") {
|
|
918
948
|
}
|
919
949
|
});
|
920
950
|
}
|
921
|
-
function
|
951
|
+
function Ne(e = "/") {
|
922
952
|
return d({
|
923
953
|
mutationKey: ["operations", "sign-hivesigner", e],
|
924
954
|
mutationFn: async ({ operation: t }) => K.sendOperation(t, { callback: e }, () => {
|
925
955
|
})
|
926
956
|
});
|
927
957
|
}
|
928
|
-
function
|
958
|
+
function Ie() {
|
929
959
|
return p({
|
930
960
|
queryKey: ["operations", "chain-properties"],
|
931
961
|
queryFn: async () => await c.hiveClient.database.getChainProperties()
|
932
962
|
});
|
933
963
|
}
|
934
|
-
function
|
964
|
+
function xe(e = 20) {
|
935
965
|
return $({
|
936
966
|
queryKey: ["posts", "trending-tags"],
|
937
967
|
queryFn: async ({ pageParam: { afterTag: t } }) => c.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
@@ -963,7 +993,7 @@ function A(e) {
|
|
963
993
|
enabled: !!e
|
964
994
|
});
|
965
995
|
}
|
966
|
-
function
|
996
|
+
function Ue(e = "feed") {
|
967
997
|
return p({
|
968
998
|
queryKey: ["posts", "promoted", e],
|
969
999
|
queryFn: async () => {
|
@@ -1004,7 +1034,7 @@ function Ge(e) {
|
|
1004
1034
|
}
|
1005
1035
|
});
|
1006
1036
|
}
|
1007
|
-
function
|
1037
|
+
function Ve(e, t) {
|
1008
1038
|
return d({
|
1009
1039
|
mutationKey: ["posts", "edit-fragment", e, t],
|
1010
1040
|
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
@@ -1035,7 +1065,7 @@ function Ue(e, t) {
|
|
1035
1065
|
}
|
1036
1066
|
});
|
1037
1067
|
}
|
1038
|
-
function
|
1068
|
+
function We(e, t) {
|
1039
1069
|
return d({
|
1040
1070
|
mutationKey: ["posts", "remove-fragment", e],
|
1041
1071
|
mutationFn: async () => fetch(c.privateApiHost + "/private-api/fragments-delete", {
|
@@ -1079,7 +1109,7 @@ function M(e, t) {
|
|
1079
1109
|
}
|
1080
1110
|
});
|
1081
1111
|
}
|
1082
|
-
const
|
1112
|
+
const ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
1083
1113
|
__proto__: null,
|
1084
1114
|
useRecordActivity: M
|
1085
1115
|
}, Symbol.toStringTag, { value: "Module" }));
|
@@ -1154,10 +1184,10 @@ const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1154
1184
|
__proto__: null,
|
1155
1185
|
getAccountTokenQueryOptions: q,
|
1156
1186
|
getAccountVideosQueryOptions: ye
|
1157
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
1187
|
+
}, Symbol.toStringTag, { value: "Module" })), $e = {
|
1158
1188
|
queries: de
|
1159
1189
|
};
|
1160
|
-
function
|
1190
|
+
function Re(e) {
|
1161
1191
|
return p({
|
1162
1192
|
queryKey: ["integrations", "hiveposh", "links", e],
|
1163
1193
|
queryFn: async () => {
|
@@ -1182,7 +1212,7 @@ function $e(e) {
|
|
1182
1212
|
}
|
1183
1213
|
});
|
1184
1214
|
}
|
1185
|
-
function
|
1215
|
+
function Le() {
|
1186
1216
|
return p({
|
1187
1217
|
queryKey: ["resource-credits", "stats"],
|
1188
1218
|
queryFn: async () => (await c.hiveClient.call(
|
@@ -1192,14 +1222,14 @@ function Re() {
|
|
1192
1222
|
)).rc_stats
|
1193
1223
|
});
|
1194
1224
|
}
|
1195
|
-
function
|
1225
|
+
function Xe(e) {
|
1196
1226
|
return p({
|
1197
1227
|
queryKey: ["resource-credits", "account", e],
|
1198
1228
|
queryFn: async () => new X(c.hiveClient).findRCAccounts([e]),
|
1199
1229
|
enabled: !!e
|
1200
1230
|
});
|
1201
1231
|
}
|
1202
|
-
function
|
1232
|
+
function Ye(e, t) {
|
1203
1233
|
return p({
|
1204
1234
|
queryKey: ["games", "status-check", t, e],
|
1205
1235
|
enabled: !!e,
|
@@ -1222,7 +1252,7 @@ function Xe(e, t) {
|
|
1222
1252
|
}
|
1223
1253
|
});
|
1224
1254
|
}
|
1225
|
-
function
|
1255
|
+
function Ze(e, t, n) {
|
1226
1256
|
const { mutateAsync: o } = M(
|
1227
1257
|
e,
|
1228
1258
|
"spin-rolled"
|
@@ -1252,7 +1282,7 @@ function Ye(e, t, n) {
|
|
1252
1282
|
}
|
1253
1283
|
});
|
1254
1284
|
}
|
1255
|
-
function
|
1285
|
+
function et(e, t, n = 100, o = void 0, r = !0) {
|
1256
1286
|
return p({
|
1257
1287
|
queryKey: ["communities", "list", e, t, n],
|
1258
1288
|
enabled: r,
|
@@ -1272,7 +1302,7 @@ function Ze(e, t, n = 100, o = void 0, r = !0) {
|
|
1272
1302
|
}
|
1273
1303
|
});
|
1274
1304
|
}
|
1275
|
-
function
|
1305
|
+
function tt(e, t) {
|
1276
1306
|
return p({
|
1277
1307
|
queryKey: ["community", "context", e, t],
|
1278
1308
|
enabled: !!e && !!t,
|
@@ -1293,7 +1323,7 @@ function et(e, t) {
|
|
1293
1323
|
});
|
1294
1324
|
}
|
1295
1325
|
var g = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(g || {});
|
1296
|
-
const
|
1326
|
+
const nt = {
|
1297
1327
|
owner: [
|
1298
1328
|
"admin",
|
1299
1329
|
"mod",
|
@@ -1316,10 +1346,10 @@ const tt = {
|
|
1316
1346
|
/* MUTED */
|
1317
1347
|
]
|
1318
1348
|
};
|
1319
|
-
function
|
1349
|
+
function ot(e, t) {
|
1320
1350
|
return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
|
1321
1351
|
}
|
1322
|
-
function
|
1352
|
+
function rt({
|
1323
1353
|
communityType: e,
|
1324
1354
|
userRole: t,
|
1325
1355
|
subscribed: n
|
@@ -1345,60 +1375,62 @@ function ot({
|
|
1345
1375
|
}
|
1346
1376
|
export {
|
1347
1377
|
c as CONFIG,
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1378
|
+
j as ConfigManager,
|
1379
|
+
ze as EcencyAnalytics,
|
1380
|
+
Q as EcencyQueriesManager,
|
1351
1381
|
pe as HiveSignerIntegration,
|
1352
1382
|
ve as Keychain,
|
1353
1383
|
g as ROLES,
|
1354
|
-
|
1384
|
+
$e as ThreeSpeakIntegration,
|
1355
1385
|
oe as broadcastJson,
|
1356
1386
|
Se as checkUsernameWalletsPendingQueryOptions,
|
1387
|
+
se as dedupeAndSortKeyAuths,
|
1357
1388
|
l as getAccessToken,
|
1358
1389
|
b as getAccountFullQueryOptions,
|
1359
1390
|
qe as getAccountPendingRecoveryQueryOptions,
|
1360
|
-
|
1391
|
+
Xe as getAccountRcQueryOptions,
|
1361
1392
|
Oe as getAccountRecoveriesQueryOptions,
|
1362
1393
|
ke as getAccountSubscriptionsQueryOptions,
|
1363
1394
|
Ke as getActiveAccountBookmarksQueryOptions,
|
1364
1395
|
Ce as getActiveAccountFavouritesQueryOptions,
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1396
|
+
Ie as getChainPropertiesQueryOptions,
|
1397
|
+
et as getCommunitiesQueryOptions,
|
1398
|
+
tt as getCommunityContextQueryOptions,
|
1399
|
+
rt as getCommunityPermissions,
|
1400
|
+
ot as getCommunityType,
|
1370
1401
|
we as getDynamicPropsQueryOptions,
|
1371
1402
|
A as getFragmentsQueryOptions,
|
1372
|
-
|
1373
|
-
|
1403
|
+
Ye as getGameStatusCheckQueryOptions,
|
1404
|
+
Re as getHivePoshLinksQueryOptions,
|
1374
1405
|
J as getLoginType,
|
1375
1406
|
H as getPostingKey,
|
1376
|
-
|
1407
|
+
Ue as getPromotedPostsQuery,
|
1377
1408
|
y as getQueryClient,
|
1378
|
-
|
1409
|
+
Le as getRcStatsQueryOptions,
|
1379
1410
|
_e as getRefreshToken,
|
1380
1411
|
re as getRelationshipBetweenAccountsQueryOptions,
|
1381
1412
|
be as getSearchAccountsByUsernameQueryOptions,
|
1382
|
-
|
1413
|
+
xe as getTrendingTagsQueryOptions,
|
1383
1414
|
w as getUser,
|
1384
1415
|
me as makeQueryClient,
|
1385
|
-
|
1416
|
+
nt as roleMap,
|
1386
1417
|
De as useAccountFavouriteAdd,
|
1387
1418
|
Fe as useAccountFavouriteDelete,
|
1388
1419
|
Te as useAccountRelationsUpdate,
|
1420
|
+
He as useAccountRevokeKey,
|
1389
1421
|
Ee as useAccountRevokePosting,
|
1390
1422
|
Ae as useAccountUpdate,
|
1391
1423
|
ae as useAccountUpdateKeyAuths,
|
1392
1424
|
Pe as useAccountUpdatePassword,
|
1393
1425
|
Be as useAccountUpdateRecovery,
|
1394
1426
|
Ge as useAddFragment,
|
1395
|
-
|
1396
|
-
|
1427
|
+
je as useBookmarkAdd,
|
1428
|
+
Qe as useBookmarkDelete,
|
1397
1429
|
ne as useBroadcastMutation,
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1430
|
+
Ve as useEditFragment,
|
1431
|
+
Ze as useGameClaim,
|
1432
|
+
We as useRemoveFragment,
|
1433
|
+
Ne as useSignOperationByHivesigner,
|
1434
|
+
Je as useSignOperationByKey,
|
1435
|
+
Me as useSignOperationByKeychain
|
1404
1436
|
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { PrivateKey, PublicKey } from '@hiveio/dhive';
|
2
|
+
import { useMutation } from '@tanstack/react-query';
|
3
|
+
interface Payload {
|
4
|
+
currentKey: PrivateKey;
|
5
|
+
revokingKey: PublicKey;
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* This hook provides functionality to revoke a key from an account on the Hive blockchain.
|
9
|
+
* It leverages React Query's `useMutation` for managing the mutation state and executing
|
10
|
+
* the operation efficiently.
|
11
|
+
*
|
12
|
+
* @param username The username of the Hive account from which the key should be revoked.
|
13
|
+
* Pass `undefined` if the username is unknown or not set yet.
|
14
|
+
*
|
15
|
+
* @returns The mutation object from `useMutation`, including methods to trigger the key
|
16
|
+
* revocation and access its state (e.g., loading, success, error).
|
17
|
+
*/
|
18
|
+
export declare function useAccountRevokeKey(username: string | undefined, options?: Pick<Parameters<typeof useMutation>[0], "onSuccess" | "onError">): import('@tanstack/react-query').UseMutationResult<import('@hiveio/dhive').TransactionConfirmation, unknown, Payload, unknown>;
|
19
|
+
export {};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { PrivateKey } from '@hiveio/dhive';
|
1
|
+
import { AuthorityType, PrivateKey } from '@hiveio/dhive';
|
2
2
|
import { useMutation } from '@tanstack/react-query';
|
3
|
-
interface Keys {
|
3
|
+
export interface Keys {
|
4
4
|
owner: PrivateKey;
|
5
5
|
active: PrivateKey;
|
6
6
|
posting: PrivateKey;
|
@@ -11,5 +11,9 @@ interface Payload {
|
|
11
11
|
currentKey: PrivateKey;
|
12
12
|
keys: Keys[];
|
13
13
|
}
|
14
|
+
export declare function dedupeAndSortKeyAuths(existing: AuthorityType["key_auths"], additions: [string, number][]): import('type-fest').ValueOf<{
|
15
|
+
[x: string]: [key: string, value: number];
|
16
|
+
[x: number]: [key: `${number}`, value: number];
|
17
|
+
}>[];
|
14
18
|
export declare function useAccountUpdateKeyAuths(username: string, options?: Pick<Parameters<typeof useMutation>[0], "onSuccess" | "onError">): import('@tanstack/react-query').UseMutationResult<import('@hiveio/dhive').TransactionConfirmation, unknown, Payload, unknown>;
|
15
19
|
export {};
|