@ecency/sdk 1.0.41 → 1.0.42
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,10 +1,10 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var v = (e, t, n) =>
|
4
|
-
import { QueryClient as S, useMutation as p, useQuery as
|
5
|
-
import { Client as
|
1
|
+
var b = Object.defineProperty;
|
2
|
+
var Q = (e, t, n) => t in e ? b(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
3
|
+
var v = (e, t, n) => Q(e, typeof t != "symbol" ? t + "" : t, n);
|
4
|
+
import { QueryClient as S, useMutation as p, useQuery as _, useInfiniteQuery as k, queryOptions as c, infiniteQueryOptions as T } from "@tanstack/react-query";
|
5
|
+
import { Client as j, PrivateKey as h, cryptoUtils as A, RCAPI as F } from "@hiveio/dhive";
|
6
6
|
import w from "hivesigner";
|
7
|
-
class
|
7
|
+
class D {
|
8
8
|
constructor() {
|
9
9
|
v(this, "length", 0);
|
10
10
|
}
|
@@ -26,9 +26,9 @@ class F {
|
|
26
26
|
}
|
27
27
|
const i = {
|
28
28
|
privateApiHost: "https://ecency.com",
|
29
|
-
storage: typeof window > "u" ? new
|
29
|
+
storage: typeof window > "u" ? new D() : window.localStorage,
|
30
30
|
storagePrefix: "ecency",
|
31
|
-
hiveClient: new
|
31
|
+
hiveClient: new j(
|
32
32
|
[
|
33
33
|
"https://api.hive.blog",
|
34
34
|
"https://api.deathwing.me",
|
@@ -59,7 +59,7 @@ var O;
|
|
59
59
|
}
|
60
60
|
e.setQueryClient = t;
|
61
61
|
})(O || (O = {}));
|
62
|
-
function
|
62
|
+
function P(e) {
|
63
63
|
let t = atob(e);
|
64
64
|
if (t[0] === "{")
|
65
65
|
return JSON.parse(t);
|
@@ -69,13 +69,13 @@ const f = (e) => {
|
|
69
69
|
const t = i.storage.getItem(
|
70
70
|
i.storagePrefix + "_user_" + e
|
71
71
|
);
|
72
|
-
return
|
72
|
+
return P(JSON.parse(t));
|
73
73
|
} catch (t) {
|
74
74
|
console.error(t);
|
75
75
|
return;
|
76
76
|
}
|
77
|
-
}, y = (e) => f(e) && f(e).accessToken,
|
78
|
-
function
|
77
|
+
}, y = (e) => f(e) && f(e).accessToken, I = (e) => f(e) && f(e).postingKey, W = (e) => f(e) && f(e).refreshToken;
|
78
|
+
function N(e = [], t, n) {
|
79
79
|
return p({
|
80
80
|
mutationKey: [...e, t],
|
81
81
|
mutationFn: async (r) => {
|
@@ -83,7 +83,7 @@ function I(e = [], t, n) {
|
|
83
83
|
throw new Error(
|
84
84
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
85
85
|
);
|
86
|
-
const a =
|
86
|
+
const a = I(t);
|
87
87
|
if (a) {
|
88
88
|
const l = h.fromString(a);
|
89
89
|
return i.hiveClient.broadcast.sendOperations(
|
@@ -138,7 +138,7 @@ var C;
|
|
138
138
|
return {
|
139
139
|
prefetch: () => r(o),
|
140
140
|
getData: () => t(o.queryKey),
|
141
|
-
useClientQuery: () =>
|
141
|
+
useClientQuery: () => _(o),
|
142
142
|
fetchAndGet: () => s().fetchQuery(o)
|
143
143
|
};
|
144
144
|
}
|
@@ -147,14 +147,14 @@ var C;
|
|
147
147
|
return {
|
148
148
|
prefetch: () => a(o),
|
149
149
|
getData: () => n(o.queryKey),
|
150
|
-
useClientQuery: () =>
|
150
|
+
useClientQuery: () => k(o),
|
151
151
|
fetchAndGet: () => s().fetchInfiniteQuery(o)
|
152
152
|
};
|
153
153
|
}
|
154
154
|
e.generateClientServerInfiniteQuery = l;
|
155
155
|
})(C || (C = {}));
|
156
156
|
function V(e) {
|
157
|
-
return
|
157
|
+
return N(
|
158
158
|
["accounts", "update"],
|
159
159
|
e,
|
160
160
|
({
|
@@ -254,14 +254,14 @@ function Z(e) {
|
|
254
254
|
if (!e)
|
255
255
|
throw new Error("[Operations][Sign] – cannot sign op with anon user");
|
256
256
|
let r;
|
257
|
-
return n.split(" ").length === 12 ? r = h.fromLogin(e, n, "active") :
|
257
|
+
return n.split(" ").length === 12 ? r = h.fromLogin(e, n, "active") : A.isWif(n) ? r = h.fromString(n) : r = h.from(n), i.hiveClient.broadcast.sendOperations(
|
258
258
|
[t],
|
259
259
|
r
|
260
260
|
);
|
261
261
|
}
|
262
262
|
});
|
263
263
|
}
|
264
|
-
function
|
264
|
+
function H() {
|
265
265
|
return new Promise((e) => {
|
266
266
|
var t;
|
267
267
|
(t = window.hive_keychain) == null || t.requestHandshake(() => {
|
@@ -283,7 +283,7 @@ const q = (e, t, n, r = null) => new Promise((a, u) => {
|
|
283
283
|
}), ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
284
284
|
__proto__: null,
|
285
285
|
broadcast: q,
|
286
|
-
handshake:
|
286
|
+
handshake: H
|
287
287
|
}, Symbol.toStringTag, { value: "Module" }));
|
288
288
|
function te(e, t = "Active") {
|
289
289
|
return p({
|
@@ -330,7 +330,7 @@ function re(e, t) {
|
|
330
330
|
});
|
331
331
|
}
|
332
332
|
function oe(e = 20) {
|
333
|
-
return
|
333
|
+
return T({
|
334
334
|
queryKey: ["posts", "trending-tags"],
|
335
335
|
queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
|
336
336
|
(n) => n.filter((r) => r.name !== "").filter((r) => !r.name.startsWith("hive-")).map((r) => r.name)
|
@@ -438,7 +438,7 @@ function se(e, t) {
|
|
438
438
|
}
|
439
439
|
});
|
440
440
|
}
|
441
|
-
function
|
441
|
+
function K(e, t) {
|
442
442
|
return p({
|
443
443
|
mutationKey: ["analytics", t],
|
444
444
|
mutationFn: async () => {
|
@@ -463,7 +463,7 @@ function H(e, t) {
|
|
463
463
|
}
|
464
464
|
const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
465
465
|
__proto__: null,
|
466
|
-
useRecordActivity:
|
466
|
+
useRecordActivity: K
|
467
467
|
}, Symbol.toStringTag, { value: "Module" }));
|
468
468
|
function J(e, t) {
|
469
469
|
return c({
|
@@ -552,7 +552,7 @@ function pe() {
|
|
552
552
|
function ye(e) {
|
553
553
|
return c({
|
554
554
|
queryKey: ["resource-credits", "account", e],
|
555
|
-
queryFn: async () => new
|
555
|
+
queryFn: async () => new F(i.hiveClient).findRCAccounts([e]),
|
556
556
|
enabled: !!e
|
557
557
|
});
|
558
558
|
}
|
@@ -580,6 +580,10 @@ function le(e, t) {
|
|
580
580
|
});
|
581
581
|
}
|
582
582
|
function fe(e, t, n) {
|
583
|
+
const { mutateAsync: r } = K(
|
584
|
+
e,
|
585
|
+
"spin-rolled"
|
586
|
+
);
|
583
587
|
return p({
|
584
588
|
mutationKey: ["games", "post", t, e],
|
585
589
|
mutationFn: async () => {
|
@@ -599,6 +603,9 @@ function fe(e, t, n) {
|
|
599
603
|
}
|
600
604
|
}
|
601
605
|
)).json();
|
606
|
+
},
|
607
|
+
onSuccess() {
|
608
|
+
r();
|
602
609
|
}
|
603
610
|
});
|
604
611
|
}
|
@@ -617,7 +624,7 @@ export {
|
|
617
624
|
m as getFragmentsQueryOptions,
|
618
625
|
le as getGameStatusCheckQueryOptions,
|
619
626
|
re as getHiveEngineTokensListQueryOptions,
|
620
|
-
|
627
|
+
I as getPostingKey,
|
621
628
|
s as getQueryClient,
|
622
629
|
pe as getRcStatsQueryOptions,
|
623
630
|
W as getRefreshToken,
|
@@ -627,7 +634,7 @@ export {
|
|
627
634
|
$ as makeQueryClient,
|
628
635
|
V as useAccountUpdate,
|
629
636
|
ie as useAddFragment,
|
630
|
-
|
637
|
+
N as useBroadcastMutation,
|
631
638
|
ae as useEditFragment,
|
632
639
|
fe as useGameClaim,
|
633
640
|
se as useRemoveFragment,
|
@@ -1,3 +1,3 @@
|
|
1
|
-
type ActivityType = "post-created" | "post-updated" | "post-scheduled" | "draft-created" | "video-published" | "legacy-post-created" | "legacy-post-updated" | "legacy-post-scheduled" | "legacy-draft-created" | "legacy-video-published" | "perks-points-by-qr" | "perks-account-boost" | "perks-promote" | "perks-boost-plus" | "points-claimed" | "signed-up-with-wallets" | "signed-up-with-email";
|
1
|
+
type ActivityType = "post-created" | "post-updated" | "post-scheduled" | "draft-created" | "video-published" | "legacy-post-created" | "legacy-post-updated" | "legacy-post-scheduled" | "legacy-draft-created" | "legacy-video-published" | "perks-points-by-qr" | "perks-account-boost" | "perks-promote" | "perks-boost-plus" | "points-claimed" | "spin-rolled" | "signed-up-with-wallets" | "signed-up-with-email";
|
2
2
|
export declare function useRecordActivity(username: string | undefined, activityType: ActivityType): import('@tanstack/react-query').UseMutationResult<void, Error, void, unknown>;
|
3
3
|
export {};
|