@ecency/sdk 1.1.10 → 1.1.12
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 +35 -33
- 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 m from "hivesigner";
|
7
|
+
import * as C from "remeda";
|
8
8
|
class Z {
|
9
9
|
constructor() {
|
10
10
|
K(this, "length", 0);
|
@@ -102,7 +102,7 @@ function ee() {
|
|
102
102
|
});
|
103
103
|
});
|
104
104
|
}
|
105
|
-
const
|
105
|
+
const b = (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,
|
@@ -128,7 +128,7 @@ const C = (e, t, n, o = null) => new Promise((r, c) => {
|
|
128
128
|
);
|
129
129
|
}), ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
130
130
|
__proto__: null,
|
131
|
-
broadcast:
|
131
|
+
broadcast: b,
|
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 b(
|
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 m.Client({
|
163
163
|
accessToken: a
|
164
164
|
}).broadcast(n(r))).result;
|
165
165
|
throw new Error(
|
@@ -188,10 +188,10 @@ async function oe(e, t, n) {
|
|
188
188
|
}
|
189
189
|
const c = E(e);
|
190
190
|
if (c && c == "keychain")
|
191
|
-
return
|
191
|
+
return b(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 m.Client({
|
195
195
|
accessToken: s
|
196
196
|
}).customJson([], [e], t, JSON.stringify(n))).result;
|
197
197
|
throw new Error(
|
@@ -269,7 +269,7 @@ function ve() {
|
|
269
269
|
), o = await i.hiveClient.database.call(
|
270
270
|
"get_reward_fund",
|
271
271
|
["post"]
|
272
|
-
), r = g(e.total_vesting_fund_hive).amount / g(e.total_vesting_shares).amount * 1e6, c = g(t.current_median_history.base).amount, s = g(t.current_median_history.quote).amount, a = parseFloat(o.recent_claims), l = g(o.reward_balance).amount, w = e.hbd_print_rate,
|
272
|
+
), r = g(e.total_vesting_fund_hive).amount / g(e.total_vesting_shares).amount * 1e6, c = g(t.current_median_history.base).amount, s = g(t.current_median_history.quote).amount, a = parseFloat(o.recent_claims), l = g(o.reward_balance).amount, w = e.hbd_print_rate, B = e.hbd_interest_rate, H = e.head_block_number, I = g(
|
273
273
|
e.total_vesting_fund_hive
|
274
274
|
).amount, J = g(
|
275
275
|
e.total_vesting_shares
|
@@ -281,9 +281,9 @@ function ve() {
|
|
281
281
|
fundRecentClaims: a,
|
282
282
|
fundRewardBalance: l,
|
283
283
|
hbdPrintRate: w,
|
284
|
-
hbdInterestRate:
|
285
|
-
headBlock:
|
286
|
-
totalVestingFund:
|
284
|
+
hbdInterestRate: B,
|
285
|
+
headBlock: H,
|
286
|
+
totalVestingFund: I,
|
287
287
|
totalVestingShares: J,
|
288
288
|
virtualSupply: N,
|
289
289
|
vestingRewardPercent: x,
|
@@ -465,19 +465,21 @@ function Se(e) {
|
|
465
465
|
});
|
466
466
|
}
|
467
467
|
function ie(e) {
|
468
|
-
return e == null ? void 0 : e.map(({ meta: t, ...n }) =>
|
469
|
-
|
470
|
-
|
471
|
-
|
468
|
+
return e == null ? void 0 : e.map(({ meta: t, ...n }) => {
|
469
|
+
if (!t || typeof t != "object")
|
470
|
+
return { ...n, meta: t };
|
471
|
+
const { privateKey: o, username: r, ...c } = t;
|
472
|
+
return { ...n, meta: c };
|
473
|
+
});
|
472
474
|
}
|
473
475
|
function Q({
|
474
476
|
profile: e,
|
475
477
|
tokens: t,
|
476
478
|
data: n
|
477
479
|
}) {
|
478
|
-
const o =
|
480
|
+
const o = C.pipe(
|
479
481
|
JSON.parse((n == null ? void 0 : n.posting_json_metadata) || "{}"),
|
480
|
-
|
482
|
+
C.mergeDeep(e ?? {})
|
481
483
|
);
|
482
484
|
return t && t.length > 0 && (o.tokens = t), o.tokens = ie(o.tokens), o;
|
483
485
|
}
|
@@ -508,7 +510,7 @@ function Oe(e) {
|
|
508
510
|
(c) => {
|
509
511
|
if (!c)
|
510
512
|
return c;
|
511
|
-
const s =
|
513
|
+
const s = C.clone(c);
|
512
514
|
return s.profile = Q({ ...r, data: c }), s;
|
513
515
|
}
|
514
516
|
)
|
@@ -689,14 +691,14 @@ function je(e, t = "Active") {
|
|
689
691
|
throw new Error(
|
690
692
|
"[SDK][Keychain] – cannot sign operation with anon user"
|
691
693
|
);
|
692
|
-
return
|
694
|
+
return b(e, [n], t);
|
693
695
|
}
|
694
696
|
});
|
695
697
|
}
|
696
698
|
function De(e = "/") {
|
697
699
|
return d({
|
698
700
|
mutationKey: ["operations", "sign-hivesigner", e],
|
699
|
-
mutationFn: async ({ operation: t }) =>
|
701
|
+
mutationFn: async ({ operation: t }) => m.sendOperation(t, { callback: e }, () => {
|
700
702
|
})
|
701
703
|
});
|
702
704
|
}
|
@@ -754,7 +756,7 @@ function Ee(e = "feed") {
|
|
754
756
|
}
|
755
757
|
});
|
756
758
|
}
|
757
|
-
function
|
759
|
+
function Me(e) {
|
758
760
|
return d({
|
759
761
|
mutationKey: ["posts", "add-fragment", e],
|
760
762
|
mutationFn: async ({ title: t, body: n }) => (await fetch(
|
@@ -779,7 +781,7 @@ function Be(e) {
|
|
779
781
|
}
|
780
782
|
});
|
781
783
|
}
|
782
|
-
function
|
784
|
+
function Be(e, t) {
|
783
785
|
return d({
|
784
786
|
mutationKey: ["posts", "edit-fragment", e, t],
|
785
787
|
mutationFn: async ({ title: n, body: o }) => (await fetch(
|
@@ -810,7 +812,7 @@ function He(e, t) {
|
|
810
812
|
}
|
811
813
|
});
|
812
814
|
}
|
813
|
-
function
|
815
|
+
function He(e, t) {
|
814
816
|
return d({
|
815
817
|
mutationKey: ["posts", "remove-fragment", e],
|
816
818
|
mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
|
@@ -831,7 +833,7 @@ function Ie(e, t) {
|
|
831
833
|
}
|
832
834
|
});
|
833
835
|
}
|
834
|
-
function
|
836
|
+
function M(e, t) {
|
835
837
|
return d({
|
836
838
|
mutationKey: ["analytics", t],
|
837
839
|
mutationFn: async () => {
|
@@ -854,9 +856,9 @@ function B(e, t) {
|
|
854
856
|
}
|
855
857
|
});
|
856
858
|
}
|
857
|
-
const
|
859
|
+
const Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
858
860
|
__proto__: null,
|
859
|
-
useRecordActivity:
|
861
|
+
useRecordActivity: M
|
860
862
|
}, Symbol.toStringTag, { value: "Module" }));
|
861
863
|
function se(e, t) {
|
862
864
|
return p({
|
@@ -864,7 +866,7 @@ function se(e, t) {
|
|
864
866
|
queryFn: async () => {
|
865
867
|
const n = y(e);
|
866
868
|
if (n)
|
867
|
-
return new
|
869
|
+
return new m.Client({
|
868
870
|
accessToken: n
|
869
871
|
}).decode(t);
|
870
872
|
}
|
@@ -998,7 +1000,7 @@ function Ve(e, t) {
|
|
998
1000
|
});
|
999
1001
|
}
|
1000
1002
|
function We(e, t, n) {
|
1001
|
-
const { mutateAsync: o } =
|
1003
|
+
const { mutateAsync: o } = M(
|
1002
1004
|
e,
|
1003
1005
|
"spin-rolled"
|
1004
1006
|
);
|
@@ -1121,7 +1123,7 @@ function Xe({
|
|
1121
1123
|
export {
|
1122
1124
|
i as CONFIG,
|
1123
1125
|
k as ConfigManager,
|
1124
|
-
|
1126
|
+
Ie as EcencyAnalytics,
|
1125
1127
|
q as EcencyQueriesManager,
|
1126
1128
|
ce as HiveSignerIntegration,
|
1127
1129
|
ge as Keychain,
|
@@ -1160,13 +1162,13 @@ export {
|
|
1160
1162
|
Qe as useAccountFavouriteDelete,
|
1161
1163
|
Ke as useAccountRelationsUpdate,
|
1162
1164
|
Oe as useAccountUpdate,
|
1163
|
-
|
1165
|
+
Me as useAddFragment,
|
1164
1166
|
ke as useBookmarkAdd,
|
1165
1167
|
qe as useBookmarkDelete,
|
1166
1168
|
ne as useBroadcastMutation,
|
1167
|
-
|
1169
|
+
Be as useEditFragment,
|
1168
1170
|
We as useGameClaim,
|
1169
|
-
|
1171
|
+
He as useRemoveFragment,
|
1170
1172
|
De as useSignOperationByHivesigner,
|
1171
1173
|
Ae as useSignOperationByKey,
|
1172
1174
|
je as useSignOperationByKeychain
|