@ecency/wallets 1.3.2 → 1.3.5
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,22 +1,22 @@
|
|
|
1
|
-
import { CONFIG as y, getQueryClient as i, getDynamicPropsQueryOptions as H, getAccountFullQueryOptions as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import
|
|
4
|
-
import { LRUCache as
|
|
1
|
+
import { CONFIG as y, getQueryClient as i, getDynamicPropsQueryOptions as H, getAccountFullQueryOptions as b, Keychain as q, useBroadcastMutation as ce, EcencyAnalytics as X, getAccessToken as ue, useAccountUpdate as le } from "@ecency/sdk";
|
|
2
|
+
import { useQuery as N, queryOptions as h, infiniteQueryOptions as R, useQueryClient as M, useMutation as K } from "@tanstack/react-query";
|
|
3
|
+
import fe from "bip39";
|
|
4
|
+
import { LRUCache as ye } from "lru-cache";
|
|
5
5
|
import { PrivateKey as I, utils as T } from "@hiveio/dhive";
|
|
6
6
|
import C from "dayjs";
|
|
7
7
|
import d from "hivesigner";
|
|
8
|
-
import { BtcWallet as
|
|
9
|
-
import { EthWallet as
|
|
10
|
-
import { TrxWallet as
|
|
11
|
-
import { TonWallet as
|
|
12
|
-
import { SolWallet as
|
|
13
|
-
import { AtomWallet as
|
|
14
|
-
import { AptosWallet as
|
|
15
|
-
import { useCallback as
|
|
8
|
+
import { BtcWallet as me } from "@okxweb3/coin-bitcoin";
|
|
9
|
+
import { EthWallet as pe } from "@okxweb3/coin-ethereum";
|
|
10
|
+
import { TrxWallet as he } from "@okxweb3/coin-tron";
|
|
11
|
+
import { TonWallet as ge } from "@okxweb3/coin-ton";
|
|
12
|
+
import { SolWallet as we } from "@okxweb3/coin-solana";
|
|
13
|
+
import { AtomWallet as de } from "@okxweb3/coin-cosmos";
|
|
14
|
+
import { AptosWallet as _e } from "@okxweb3/coin-aptos";
|
|
15
|
+
import { useCallback as ve } from "react";
|
|
16
16
|
import * as A from "remeda";
|
|
17
17
|
var f = /* @__PURE__ */ ((e) => (e.BTC = "BTC", e.ETH = "ETH", e.APT = "APT", e.ATOM = "ATOM", e.TON = "TON", e.TRON = "TRX", e.SOL = "SOL", e))(f || {}), g = /* @__PURE__ */ ((e) => (e.Points = "POINTS", e.HivePower = "HP", e.Hive = "HIVE", e.HiveDollar = "HBD", e.Spk = "SPK", e))(g || {});
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function _t(e, t) {
|
|
19
|
+
return N({
|
|
20
20
|
queryKey: ["ecency-wallets", "external-wallet-balance", e, t],
|
|
21
21
|
queryFn: async () => {
|
|
22
22
|
switch (e) {
|
|
@@ -54,12 +54,12 @@ function dt(e, t) {
|
|
|
54
54
|
`https://tonapi.io/v1/blockchain/getAccount?account=${t}`
|
|
55
55
|
)).json()).balance / 1e9;
|
|
56
56
|
case f.APT:
|
|
57
|
-
const
|
|
57
|
+
const S = (await (await fetch(
|
|
58
58
|
`https://fullnode.mainnet.aptoslabs.com/v1/accounts/${t}/resources`
|
|
59
59
|
)).json()).find(
|
|
60
|
-
(
|
|
60
|
+
(ie) => ie.type.includes("coin::CoinStore")
|
|
61
61
|
);
|
|
62
|
-
return
|
|
62
|
+
return S ? parseInt(S.data.coin.value) / 1e8 : 0;
|
|
63
63
|
case f.ATOM:
|
|
64
64
|
return +(await (await fetch(
|
|
65
65
|
`https://rest.cosmos.directory/cosmoshub/auth/accounts/${t}`
|
|
@@ -69,12 +69,12 @@ function dt(e, t) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
function z(e) {
|
|
72
|
-
return
|
|
72
|
+
return N({
|
|
73
73
|
queryKey: ["ecency-wallets", "seed", e],
|
|
74
|
-
queryFn: async () =>
|
|
74
|
+
queryFn: async () => fe.generateMnemonic(128)
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const ke = {
|
|
78
78
|
max: 500,
|
|
79
79
|
// how long to live in ms
|
|
80
80
|
ttl: 1e3 * 60 * 5,
|
|
@@ -82,12 +82,12 @@ const de = {
|
|
|
82
82
|
allowStale: !1,
|
|
83
83
|
updateAgeOnGet: !1,
|
|
84
84
|
updateAgeOnHas: !1
|
|
85
|
-
}, Z = new
|
|
85
|
+
}, Z = new ye(ke), x = Symbol("undefined"), be = (e, t) => Z.set(e, t === void 0 ? x : t), Pe = (e) => {
|
|
86
86
|
const t = Z.get(e);
|
|
87
87
|
return t === x ? void 0 : t;
|
|
88
88
|
};
|
|
89
|
-
function
|
|
90
|
-
return
|
|
89
|
+
function vt(e) {
|
|
90
|
+
return N({
|
|
91
91
|
queryKey: ["ecency-wallets", "coingecko-price", e],
|
|
92
92
|
queryFn: async () => {
|
|
93
93
|
let t = e;
|
|
@@ -107,7 +107,7 @@ function _t(e) {
|
|
|
107
107
|
default:
|
|
108
108
|
t = e;
|
|
109
109
|
}
|
|
110
|
-
let n =
|
|
110
|
+
let n = Pe("gecko"), r;
|
|
111
111
|
if (n)
|
|
112
112
|
r = n;
|
|
113
113
|
else {
|
|
@@ -123,16 +123,16 @@ function _t(e) {
|
|
|
123
123
|
})
|
|
124
124
|
}
|
|
125
125
|
)).json();
|
|
126
|
-
|
|
126
|
+
be("gecko", o === void 0 ? x : o), r = o;
|
|
127
127
|
}
|
|
128
128
|
return 1 / +r[Object.keys(r)[0]].usd;
|
|
129
129
|
},
|
|
130
130
|
enabled: !!e
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function qe(e) {
|
|
134
134
|
const { data: t } = z(e);
|
|
135
|
-
return
|
|
135
|
+
return N({
|
|
136
136
|
queryKey: ["ecencу-wallets", "hive-keys", e, t],
|
|
137
137
|
staleTime: 1 / 0,
|
|
138
138
|
queryFn: async () => {
|
|
@@ -169,13 +169,13 @@ function p(e) {
|
|
|
169
169
|
symbol: te[e.nai]
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function kt(e) {
|
|
173
173
|
return e === void 0 ? !0 : parseInt(e.split("-")[0], 10) < 1980;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function J(e, t) {
|
|
176
176
|
return e / 1e6 * t;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function Se(e, t) {
|
|
179
179
|
let n = 0, r = 0, s = 0, a = 0, o = e.head_block - e.spk_block;
|
|
180
180
|
if (e.spk_block) {
|
|
181
181
|
if (o < 28800)
|
|
@@ -201,12 +201,12 @@ function O(e) {
|
|
|
201
201
|
refetchInterval: 9e4,
|
|
202
202
|
queryFn: async () => {
|
|
203
203
|
await i().prefetchQuery(H()), await i().prefetchQuery(
|
|
204
|
-
|
|
204
|
+
b(e)
|
|
205
205
|
);
|
|
206
206
|
const t = i().getQueryData(
|
|
207
207
|
H().queryKey
|
|
208
208
|
), n = i().getQueryData(
|
|
209
|
-
|
|
209
|
+
b(e).queryKey
|
|
210
210
|
);
|
|
211
211
|
return {
|
|
212
212
|
name: "HIVE",
|
|
@@ -217,25 +217,25 @@ function O(e) {
|
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Oe(e) {
|
|
221
221
|
let l = 9.5 - (e.headBlock - 7e6) / 25e4 * 0.01;
|
|
222
222
|
l < 0.95 && (l = 0.95);
|
|
223
223
|
const w = e.vestingRewardPercent / 1e4, _ = e.virtualSupply, v = e.totalVestingFund;
|
|
224
224
|
return (_ * l * w / v).toFixed(3);
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ne(e) {
|
|
227
227
|
return h({
|
|
228
228
|
queryKey: ["assets", "hive-power", "general-info", e],
|
|
229
229
|
staleTime: 6e4,
|
|
230
230
|
refetchInterval: 9e4,
|
|
231
231
|
queryFn: async () => {
|
|
232
232
|
await i().prefetchQuery(H()), await i().prefetchQuery(
|
|
233
|
-
|
|
233
|
+
b(e)
|
|
234
234
|
);
|
|
235
235
|
const t = i().getQueryData(
|
|
236
236
|
H().queryKey
|
|
237
237
|
), n = i().getQueryData(
|
|
238
|
-
|
|
238
|
+
b(e).queryKey
|
|
239
239
|
);
|
|
240
240
|
return !t || !n ? {
|
|
241
241
|
name: "HP",
|
|
@@ -246,25 +246,25 @@ function qe(e) {
|
|
|
246
246
|
name: "HP",
|
|
247
247
|
title: "Hive Power",
|
|
248
248
|
price: t ? t.base / t.quote : 0,
|
|
249
|
-
accountBalance: +
|
|
249
|
+
accountBalance: +J(
|
|
250
250
|
p(n.vesting_shares).amount,
|
|
251
251
|
// parseAsset(accountData.delegated_vesting_shares).amount +
|
|
252
252
|
// parseAsset(accountData.received_vesting_shares).amount -
|
|
253
253
|
// nextVestingSharesWithdrawal,
|
|
254
254
|
t.hivePerMVests
|
|
255
255
|
).toFixed(3),
|
|
256
|
-
apr:
|
|
256
|
+
apr: Oe(t),
|
|
257
257
|
parts: [
|
|
258
258
|
{
|
|
259
259
|
name: "delegating",
|
|
260
|
-
balance: +
|
|
260
|
+
balance: +J(
|
|
261
261
|
p(n.delegated_vesting_shares).amount,
|
|
262
262
|
t.hivePerMVests
|
|
263
263
|
).toFixed(3)
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
name: "received",
|
|
267
|
-
balance: +
|
|
267
|
+
balance: +J(
|
|
268
268
|
p(n.received_vesting_shares).amount,
|
|
269
269
|
t.hivePerMVests
|
|
270
270
|
).toFixed(3)
|
|
@@ -274,17 +274,17 @@ function qe(e) {
|
|
|
274
274
|
}
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Te(e) {
|
|
278
278
|
return h({
|
|
279
279
|
queryKey: ["assets", "hbd", "general-info", e],
|
|
280
280
|
staleTime: 6e4,
|
|
281
281
|
refetchInterval: 9e4,
|
|
282
282
|
queryFn: async () => {
|
|
283
283
|
await i().prefetchQuery(H()), await i().prefetchQuery(
|
|
284
|
-
|
|
284
|
+
b(e)
|
|
285
285
|
);
|
|
286
286
|
const t = i().getQueryData(
|
|
287
|
-
|
|
287
|
+
b(e).queryKey
|
|
288
288
|
), n = i().getQueryData(
|
|
289
289
|
H().queryKey
|
|
290
290
|
);
|
|
@@ -353,7 +353,7 @@ const m = T.operationOrders, E = {
|
|
|
353
353
|
m.proposal_pay
|
|
354
354
|
]
|
|
355
355
|
};
|
|
356
|
-
function
|
|
356
|
+
function re(e, t = 20, n) {
|
|
357
357
|
return R({
|
|
358
358
|
queryKey: ["assets", "hive", "transactions", e, t, n],
|
|
359
359
|
initialData: { pages: [], pageParams: [] },
|
|
@@ -448,9 +448,9 @@ function ne(e, t = 20, n) {
|
|
|
448
448
|
})
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function bt(e, t = 20, n) {
|
|
452
452
|
return R({
|
|
453
|
-
...
|
|
453
|
+
...re(e, t, n),
|
|
454
454
|
queryKey: ["assets", "hive-power", "transactions", e, t, n],
|
|
455
455
|
select: ({ pages: r, pageParams: s }) => ({
|
|
456
456
|
pageParams: s,
|
|
@@ -490,9 +490,9 @@ function kt(e, t = 20, n) {
|
|
|
490
490
|
})
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Pt(e, t = 20, n) {
|
|
494
494
|
return R({
|
|
495
|
-
...
|
|
495
|
+
...re(e, t, n),
|
|
496
496
|
queryKey: ["assets", "hbd", "transactions", e, t, n],
|
|
497
497
|
select: ({ pages: r, pageParams: s }) => ({
|
|
498
498
|
pageParams: s,
|
|
@@ -525,7 +525,7 @@ function bt(e, t = 20, n) {
|
|
|
525
525
|
})
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function qt(e = 86400) {
|
|
529
529
|
return R({
|
|
530
530
|
queryKey: ["assets", "hive", "metrics", e],
|
|
531
531
|
queryFn: async ({ pageParam: [t, n] }) => (await y.hiveClient.call(
|
|
@@ -555,7 +555,7 @@ function Pt(e = 86400) {
|
|
|
555
555
|
]
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function St(e) {
|
|
559
559
|
return h({
|
|
560
560
|
queryKey: ["assets", "hive", "withdrawal-routes", e],
|
|
561
561
|
queryFn: () => y.hiveClient.database.call("get_withdraw_routes", [
|
|
@@ -615,7 +615,7 @@ async function G(e) {
|
|
|
615
615
|
[["transfer_to_savings", r]],
|
|
616
616
|
t
|
|
617
617
|
);
|
|
618
|
-
} else return e.type === "keychain" ?
|
|
618
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
619
619
|
e.from,
|
|
620
620
|
[["transfer_to_savings", e]],
|
|
621
621
|
"Active"
|
|
@@ -626,14 +626,14 @@ async function G(e) {
|
|
|
626
626
|
}
|
|
627
627
|
);
|
|
628
628
|
}
|
|
629
|
-
async function
|
|
629
|
+
async function Ae(e) {
|
|
630
630
|
if (e.type === "key" && "key" in e) {
|
|
631
631
|
const { key: t, type: n, ...r } = e;
|
|
632
632
|
return y.hiveClient.broadcast.sendOperations(
|
|
633
633
|
[["transfer_to_vesting", r]],
|
|
634
634
|
t
|
|
635
635
|
);
|
|
636
|
-
} else return e.type === "keychain" ?
|
|
636
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
637
637
|
e.from,
|
|
638
638
|
[["transfer_to_vesting", e]],
|
|
639
639
|
"Active"
|
|
@@ -644,14 +644,14 @@ async function Oe(e) {
|
|
|
644
644
|
}
|
|
645
645
|
);
|
|
646
646
|
}
|
|
647
|
-
async function
|
|
647
|
+
async function Ne(e) {
|
|
648
648
|
if (e.type === "key" && "key" in e) {
|
|
649
649
|
const { key: t, type: n, ...r } = e;
|
|
650
650
|
return y.hiveClient.broadcast.sendOperations(
|
|
651
651
|
[["delegate_vesting_shares", r]],
|
|
652
652
|
t
|
|
653
653
|
);
|
|
654
|
-
} else return e.type === "keychain" ?
|
|
654
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
655
655
|
e.from,
|
|
656
656
|
[["delegate_vesting_shares", e]],
|
|
657
657
|
"Active"
|
|
@@ -662,14 +662,14 @@ async function Te(e) {
|
|
|
662
662
|
}
|
|
663
663
|
);
|
|
664
664
|
}
|
|
665
|
-
async function
|
|
665
|
+
async function Ke(e) {
|
|
666
666
|
if (e.type === "key" && "key" in e) {
|
|
667
667
|
const { key: t, type: n, ...r } = e;
|
|
668
668
|
return y.hiveClient.broadcast.sendOperations(
|
|
669
669
|
[["withdraw_vesting", r]],
|
|
670
670
|
t
|
|
671
671
|
);
|
|
672
|
-
} else return e.type === "keychain" ?
|
|
672
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
673
673
|
e.from,
|
|
674
674
|
[["withdraw_vesting", e]],
|
|
675
675
|
"Active"
|
|
@@ -680,7 +680,7 @@ async function Ae(e) {
|
|
|
680
680
|
}
|
|
681
681
|
);
|
|
682
682
|
}
|
|
683
|
-
async function
|
|
683
|
+
async function He(e) {
|
|
684
684
|
if (e.type === "key" && "key" in e) {
|
|
685
685
|
const { key: r, type: s, ...a } = e;
|
|
686
686
|
return y.hiveClient.broadcast.sendOperations(
|
|
@@ -690,7 +690,7 @@ async function Ne(e) {
|
|
|
690
690
|
}
|
|
691
691
|
if (e.type === "keychain") {
|
|
692
692
|
const { type: r, ...s } = e;
|
|
693
|
-
return
|
|
693
|
+
return q.broadcast(
|
|
694
694
|
s.from_account,
|
|
695
695
|
[["set_withdraw_vesting_route", s]],
|
|
696
696
|
"Active"
|
|
@@ -704,8 +704,65 @@ async function Ne(e) {
|
|
|
704
704
|
}
|
|
705
705
|
);
|
|
706
706
|
}
|
|
707
|
+
function se(e) {
|
|
708
|
+
return new Promise((t) => setTimeout(t, e));
|
|
709
|
+
}
|
|
710
|
+
function ae(e) {
|
|
711
|
+
switch (e) {
|
|
712
|
+
case f.BTC:
|
|
713
|
+
return new me();
|
|
714
|
+
case f.ETH:
|
|
715
|
+
return new pe();
|
|
716
|
+
case f.TRON:
|
|
717
|
+
return new he();
|
|
718
|
+
case f.TON:
|
|
719
|
+
return new ge();
|
|
720
|
+
case f.SOL:
|
|
721
|
+
return new we();
|
|
722
|
+
case f.ATOM:
|
|
723
|
+
return new de();
|
|
724
|
+
case f.APT:
|
|
725
|
+
return new _e();
|
|
726
|
+
default:
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
function Ot(e, t) {
|
|
731
|
+
const { data: n } = N(b(e)), r = M();
|
|
732
|
+
return ce(
|
|
733
|
+
["assets", "hive", "claim-rewards", n == null ? void 0 : n.name],
|
|
734
|
+
e,
|
|
735
|
+
() => {
|
|
736
|
+
if (!n)
|
|
737
|
+
throw new Error("Failed to fetch account while claiming balance");
|
|
738
|
+
const {
|
|
739
|
+
reward_hive_balance: s,
|
|
740
|
+
reward_hbd_balance: a,
|
|
741
|
+
reward_vesting_balance: o
|
|
742
|
+
} = n;
|
|
743
|
+
return [
|
|
744
|
+
[
|
|
745
|
+
"claim_reward_balance",
|
|
746
|
+
{
|
|
747
|
+
account: e,
|
|
748
|
+
reward_hive: s,
|
|
749
|
+
reward_hbd: a,
|
|
750
|
+
reward_vests: o
|
|
751
|
+
}
|
|
752
|
+
]
|
|
753
|
+
];
|
|
754
|
+
},
|
|
755
|
+
async () => {
|
|
756
|
+
t(), await se(1e3), r.invalidateQueries({
|
|
757
|
+
queryKey: b(e).queryKey
|
|
758
|
+
}), r.invalidateQueries({
|
|
759
|
+
queryKey: ne(e).queryKey
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
);
|
|
763
|
+
}
|
|
707
764
|
var u = /* @__PURE__ */ ((e) => (e.Transfer = "transfer", e.TransferToSavings = "transfer-saving", e.Delegate = "delegate", e.PowerUp = "power-up", e.PowerDown = "power-down", e.WithdrawRoutes = "withdraw-saving", e.Swap = "swap", e.Gift = "gift", e.Promote = "promote", e.Claim = "claim", e.Buy = "buy", e.LockLiquidity = "lock", e.Stake = "stake", e.Unstake = "unstake", e.Undelegate = "undelegate", e))(u || {});
|
|
708
|
-
async function
|
|
765
|
+
async function Qe(e) {
|
|
709
766
|
const t = JSON.stringify({
|
|
710
767
|
to: e.to,
|
|
711
768
|
amount: +e.amount * 1e3,
|
|
@@ -721,7 +778,7 @@ async function He(e) {
|
|
|
721
778
|
return y.hiveClient.broadcast.json(n, r);
|
|
722
779
|
} else {
|
|
723
780
|
if (e.type === "keychain")
|
|
724
|
-
return
|
|
781
|
+
return q.customJson(
|
|
725
782
|
e.from,
|
|
726
783
|
e.id,
|
|
727
784
|
"Active",
|
|
@@ -748,7 +805,7 @@ async function He(e) {
|
|
|
748
805
|
}
|
|
749
806
|
}
|
|
750
807
|
}
|
|
751
|
-
const
|
|
808
|
+
const De = async (e) => {
|
|
752
809
|
const t = JSON.stringify({ amount: +e.amount * 1e3 }), n = {
|
|
753
810
|
id: e.mode === "lock" ? "spkcc_gov_up" : "spkcc_gov_down",
|
|
754
811
|
json: t,
|
|
@@ -760,7 +817,7 @@ const Ke = async (e) => {
|
|
|
760
817
|
return y.hiveClient.broadcast.json(n, r);
|
|
761
818
|
} else {
|
|
762
819
|
if (e.type === "keychain")
|
|
763
|
-
return
|
|
820
|
+
return q.customJson(
|
|
764
821
|
e.from,
|
|
765
822
|
n.id,
|
|
766
823
|
"Active",
|
|
@@ -783,7 +840,7 @@ const Ke = async (e) => {
|
|
|
783
840
|
}
|
|
784
841
|
}
|
|
785
842
|
};
|
|
786
|
-
async function
|
|
843
|
+
async function Ce(e) {
|
|
787
844
|
const t = JSON.stringify({ amount: +e.amount * 1e3 }), n = {
|
|
788
845
|
id: `spkcc_power_${e.mode}`,
|
|
789
846
|
json: t,
|
|
@@ -795,7 +852,7 @@ async function Qe(e) {
|
|
|
795
852
|
return y.hiveClient.broadcast.json(n, r);
|
|
796
853
|
} else {
|
|
797
854
|
if (e.type === "keychain")
|
|
798
|
-
return
|
|
855
|
+
return q.customJson(
|
|
799
856
|
e.from,
|
|
800
857
|
`spkcc_power_${e.mode}`,
|
|
801
858
|
"Active",
|
|
@@ -818,7 +875,7 @@ async function Qe(e) {
|
|
|
818
875
|
}
|
|
819
876
|
}
|
|
820
877
|
}
|
|
821
|
-
function
|
|
878
|
+
function Q() {
|
|
822
879
|
return h({
|
|
823
880
|
queryKey: ["assets", "spk", "markets"],
|
|
824
881
|
staleTime: 6e4,
|
|
@@ -835,7 +892,7 @@ function K() {
|
|
|
835
892
|
}
|
|
836
893
|
});
|
|
837
894
|
}
|
|
838
|
-
function
|
|
895
|
+
function D(e) {
|
|
839
896
|
return h({
|
|
840
897
|
queryKey: ["assets", "spk", "wallet", e],
|
|
841
898
|
queryFn: async () => (await fetch(y.spkNode + `/@${e}`)).json(),
|
|
@@ -847,19 +904,19 @@ function Q(e) {
|
|
|
847
904
|
function W(e) {
|
|
848
905
|
return e.toFixed(3);
|
|
849
906
|
}
|
|
850
|
-
function
|
|
907
|
+
function Ee(e) {
|
|
851
908
|
return h({
|
|
852
909
|
queryKey: ["assets", "larynx", "general-info", e],
|
|
853
910
|
staleTime: 6e4,
|
|
854
911
|
refetchInterval: 9e4,
|
|
855
912
|
queryFn: async () => {
|
|
856
|
-
await i().prefetchQuery(
|
|
913
|
+
await i().prefetchQuery(D(e)), await i().prefetchQuery(Q()), await i().prefetchQuery(
|
|
857
914
|
O(e)
|
|
858
915
|
);
|
|
859
916
|
const t = i().getQueryData(
|
|
860
|
-
|
|
917
|
+
D(e).queryKey
|
|
861
918
|
), n = i().getQueryData(
|
|
862
|
-
|
|
919
|
+
Q().queryKey
|
|
863
920
|
), r = i().getQueryData(
|
|
864
921
|
O(e).queryKey
|
|
865
922
|
);
|
|
@@ -886,19 +943,19 @@ function De(e) {
|
|
|
886
943
|
function j(e) {
|
|
887
944
|
return e.toFixed(3);
|
|
888
945
|
}
|
|
889
|
-
function
|
|
946
|
+
function Re(e) {
|
|
890
947
|
return h({
|
|
891
948
|
queryKey: ["assets", "spk", "general-info", e],
|
|
892
949
|
staleTime: 6e4,
|
|
893
950
|
refetchInterval: 9e4,
|
|
894
951
|
queryFn: async () => {
|
|
895
|
-
await i().prefetchQuery(
|
|
952
|
+
await i().prefetchQuery(D(e)), await i().prefetchQuery(Q()), await i().prefetchQuery(
|
|
896
953
|
O(e)
|
|
897
954
|
);
|
|
898
955
|
const t = i().getQueryData(
|
|
899
|
-
|
|
956
|
+
D(e).queryKey
|
|
900
957
|
), n = i().getQueryData(
|
|
901
|
-
|
|
958
|
+
Q().queryKey
|
|
902
959
|
), r = i().getQueryData(
|
|
903
960
|
O(e).queryKey
|
|
904
961
|
);
|
|
@@ -912,7 +969,7 @@ function Ce(e) {
|
|
|
912
969
|
const s = +j(
|
|
913
970
|
(t.gov + t.spk) / 1e3 * +t.tick * ((r == null ? void 0 : r.price) ?? 0)
|
|
914
971
|
), a = +j(
|
|
915
|
-
(t.spk +
|
|
972
|
+
(t.spk + Se(
|
|
916
973
|
t,
|
|
917
974
|
n.raw.stats || {
|
|
918
975
|
spk_rate_lgov: "0.001",
|
|
@@ -937,20 +994,20 @@ function Ce(e) {
|
|
|
937
994
|
function F(e) {
|
|
938
995
|
return e.toFixed(3);
|
|
939
996
|
}
|
|
940
|
-
function
|
|
997
|
+
function Ie(e) {
|
|
941
998
|
return h({
|
|
942
999
|
queryKey: ["assets", "larynx-power", "general-info", e],
|
|
943
1000
|
staleTime: 6e4,
|
|
944
1001
|
refetchInterval: 9e4,
|
|
945
1002
|
queryFn: async () => {
|
|
946
1003
|
var o, c;
|
|
947
|
-
await i().prefetchQuery(
|
|
1004
|
+
await i().prefetchQuery(D(e)), await i().prefetchQuery(Q()), await i().prefetchQuery(
|
|
948
1005
|
O(e)
|
|
949
1006
|
);
|
|
950
1007
|
const t = i().getQueryData(
|
|
951
|
-
|
|
1008
|
+
D(e).queryKey
|
|
952
1009
|
), n = i().getQueryData(
|
|
953
|
-
|
|
1010
|
+
Q().queryKey
|
|
954
1011
|
), r = i().getQueryData(
|
|
955
1012
|
O(e).queryKey
|
|
956
1013
|
);
|
|
@@ -1062,7 +1119,7 @@ function U(e) {
|
|
|
1062
1119
|
)).json()).result
|
|
1063
1120
|
});
|
|
1064
1121
|
}
|
|
1065
|
-
function
|
|
1122
|
+
function je() {
|
|
1066
1123
|
return h({
|
|
1067
1124
|
queryKey: ["assets", "hive-engine", "markets"],
|
|
1068
1125
|
staleTime: 6e4,
|
|
@@ -1086,7 +1143,7 @@ function Re() {
|
|
|
1086
1143
|
)).json()).result
|
|
1087
1144
|
});
|
|
1088
1145
|
}
|
|
1089
|
-
function
|
|
1146
|
+
function Fe(e, t) {
|
|
1090
1147
|
return h({
|
|
1091
1148
|
queryKey: ["assets", "hive-engine", t, "general-info", e],
|
|
1092
1149
|
enabled: !!t && !!e,
|
|
@@ -1105,9 +1162,9 @@ function Ie(e, t) {
|
|
|
1105
1162
|
await i().prefetchQuery(s);
|
|
1106
1163
|
const a = i().getQueryData(s.queryKey), o = U(e);
|
|
1107
1164
|
await i().prefetchQuery(o);
|
|
1108
|
-
const c = i().getQueryData(o.queryKey), l =
|
|
1165
|
+
const c = i().getQueryData(o.queryKey), l = je();
|
|
1109
1166
|
await i().prefetchQuery(l);
|
|
1110
|
-
const w = i().getQueryData(l.queryKey), _ = a == null ? void 0 : a.find((
|
|
1167
|
+
const w = i().getQueryData(l.queryKey), _ = a == null ? void 0 : a.find((S) => S.symbol === t), v = c == null ? void 0 : c.find((S) => S.symbol === t), P = w == null ? void 0 : w.find((S) => S.symbol === t), k = +((P == null ? void 0 : P.lastPrice) ?? "0");
|
|
1111
1168
|
return {
|
|
1112
1169
|
name: t,
|
|
1113
1170
|
title: (_ == null ? void 0 : _.name) ?? "",
|
|
@@ -1118,7 +1175,7 @@ function Ie(e, t) {
|
|
|
1118
1175
|
}
|
|
1119
1176
|
});
|
|
1120
1177
|
}
|
|
1121
|
-
function
|
|
1178
|
+
function Tt(e, t, n = 20) {
|
|
1122
1179
|
return R({
|
|
1123
1180
|
queryKey: ["assets", "hive-engine", t, "transactions", e],
|
|
1124
1181
|
enabled: !!t && !!e,
|
|
@@ -1139,7 +1196,7 @@ function St(e, t, n = 20) {
|
|
|
1139
1196
|
}
|
|
1140
1197
|
});
|
|
1141
1198
|
}
|
|
1142
|
-
function
|
|
1199
|
+
function At(e, t = "daily") {
|
|
1143
1200
|
return h({
|
|
1144
1201
|
queryKey: ["assets", "hive-engine", e],
|
|
1145
1202
|
staleTime: 6e4,
|
|
@@ -1154,7 +1211,7 @@ function Ot(e, t = "daily") {
|
|
|
1154
1211
|
}
|
|
1155
1212
|
});
|
|
1156
1213
|
}
|
|
1157
|
-
async function
|
|
1214
|
+
async function Le(e) {
|
|
1158
1215
|
const n = p(e.amount).amount.toString();
|
|
1159
1216
|
if (e.type === "key" && "key" in e) {
|
|
1160
1217
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1217,7 +1274,7 @@ async function je(e) {
|
|
|
1217
1274
|
}
|
|
1218
1275
|
);
|
|
1219
1276
|
}
|
|
1220
|
-
async function
|
|
1277
|
+
async function Be(e) {
|
|
1221
1278
|
const n = p(e.amount).amount.toString();
|
|
1222
1279
|
if (e.type === "key" && "key" in e) {
|
|
1223
1280
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1280,7 +1337,7 @@ async function Fe(e) {
|
|
|
1280
1337
|
}
|
|
1281
1338
|
);
|
|
1282
1339
|
}
|
|
1283
|
-
async function
|
|
1340
|
+
async function Me(e) {
|
|
1284
1341
|
const n = p(e.amount).amount.toString();
|
|
1285
1342
|
if (e.type === "key" && "key" in e) {
|
|
1286
1343
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1343,7 +1400,7 @@ async function Le(e) {
|
|
|
1343
1400
|
}
|
|
1344
1401
|
);
|
|
1345
1402
|
}
|
|
1346
|
-
async function
|
|
1403
|
+
async function Je(e) {
|
|
1347
1404
|
const n = p(e.amount).amount.toString();
|
|
1348
1405
|
if (e.type === "key" && "key" in e) {
|
|
1349
1406
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1406,7 +1463,7 @@ async function Be(e) {
|
|
|
1406
1463
|
}
|
|
1407
1464
|
);
|
|
1408
1465
|
}
|
|
1409
|
-
async function
|
|
1466
|
+
async function $e(e) {
|
|
1410
1467
|
const n = p(e.amount).amount.toString();
|
|
1411
1468
|
if (e.type === "key" && "key" in e) {
|
|
1412
1469
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1472,7 +1529,7 @@ async function Me(e) {
|
|
|
1472
1529
|
}
|
|
1473
1530
|
);
|
|
1474
1531
|
}
|
|
1475
|
-
function
|
|
1532
|
+
function $(e) {
|
|
1476
1533
|
return h({
|
|
1477
1534
|
queryKey: ["assets", "points", e],
|
|
1478
1535
|
queryFn: async () => {
|
|
@@ -1501,15 +1558,15 @@ function J(e) {
|
|
|
1501
1558
|
enabled: !!e
|
|
1502
1559
|
});
|
|
1503
1560
|
}
|
|
1504
|
-
function
|
|
1561
|
+
function xe(e) {
|
|
1505
1562
|
return h({
|
|
1506
1563
|
queryKey: ["assets", "points", "general-info", e],
|
|
1507
1564
|
staleTime: 6e4,
|
|
1508
1565
|
refetchInterval: 9e4,
|
|
1509
1566
|
queryFn: async () => {
|
|
1510
|
-
await i().prefetchQuery(
|
|
1567
|
+
await i().prefetchQuery($(e));
|
|
1511
1568
|
const t = i().getQueryData(
|
|
1512
|
-
|
|
1569
|
+
$(e).queryKey
|
|
1513
1570
|
);
|
|
1514
1571
|
return {
|
|
1515
1572
|
name: "POINTS",
|
|
@@ -1520,9 +1577,9 @@ function Je(e) {
|
|
|
1520
1577
|
}
|
|
1521
1578
|
});
|
|
1522
1579
|
}
|
|
1523
|
-
function
|
|
1580
|
+
function Nt(e, t) {
|
|
1524
1581
|
return h({
|
|
1525
|
-
queryKey: ["assets", "points", "transactions", e],
|
|
1582
|
+
queryKey: ["assets", "points", "transactions", e, t],
|
|
1526
1583
|
queryFn: async () => (await (await fetch(
|
|
1527
1584
|
`${y.privateApiHost}/private-api/point-list`,
|
|
1528
1585
|
{
|
|
@@ -1545,12 +1602,12 @@ function Tt(e, t) {
|
|
|
1545
1602
|
}))
|
|
1546
1603
|
});
|
|
1547
1604
|
}
|
|
1548
|
-
function
|
|
1605
|
+
function Kt(e, t, n) {
|
|
1549
1606
|
const { mutateAsync: r } = X.useRecordActivity(
|
|
1550
1607
|
e,
|
|
1551
1608
|
"points-claimed"
|
|
1552
1609
|
);
|
|
1553
|
-
return
|
|
1610
|
+
return K({
|
|
1554
1611
|
mutationFn: async () => {
|
|
1555
1612
|
if (!e)
|
|
1556
1613
|
throw new Error(
|
|
@@ -1561,13 +1618,13 @@ function At(e, t, n) {
|
|
|
1561
1618
|
headers: {
|
|
1562
1619
|
"Content-Type": "application/json"
|
|
1563
1620
|
},
|
|
1564
|
-
body: JSON.stringify({ code:
|
|
1621
|
+
body: JSON.stringify({ code: ue(e) })
|
|
1565
1622
|
});
|
|
1566
1623
|
},
|
|
1567
1624
|
onError: n,
|
|
1568
1625
|
onSuccess: () => {
|
|
1569
1626
|
r(), y.queryClient.setQueryData(
|
|
1570
|
-
|
|
1627
|
+
$(e).queryKey,
|
|
1571
1628
|
(s) => s && {
|
|
1572
1629
|
points: (parseFloat(s.points) + parseFloat(s.uPoints)).toFixed(3),
|
|
1573
1630
|
uPoints: "0"
|
|
@@ -1576,7 +1633,7 @@ function At(e, t, n) {
|
|
|
1576
1633
|
}
|
|
1577
1634
|
});
|
|
1578
1635
|
}
|
|
1579
|
-
async function
|
|
1636
|
+
async function Ue({
|
|
1580
1637
|
from: e,
|
|
1581
1638
|
to: t,
|
|
1582
1639
|
amount: n,
|
|
@@ -1602,15 +1659,15 @@ async function $e({
|
|
|
1602
1659
|
const { key: c } = a;
|
|
1603
1660
|
return y.hiveClient.broadcast.sendOperations([o], c);
|
|
1604
1661
|
}
|
|
1605
|
-
return s === "keychain" ?
|
|
1662
|
+
return s === "keychain" ? q.broadcast(e, [o], "Active") : d.sendOperation(
|
|
1606
1663
|
o,
|
|
1607
1664
|
{ callback: `https://ecency.com/@${e}/wallet` },
|
|
1608
1665
|
() => {
|
|
1609
1666
|
}
|
|
1610
1667
|
);
|
|
1611
1668
|
}
|
|
1612
|
-
var
|
|
1613
|
-
function
|
|
1669
|
+
var Ve = /* @__PURE__ */ ((e) => (e[e.CHECKIN = 10] = "CHECKIN", e[e.LOGIN = 20] = "LOGIN", e[e.CHECKIN_EXTRA = 30] = "CHECKIN_EXTRA", e[e.POST = 100] = "POST", e[e.COMMENT = 110] = "COMMENT", e[e.VOTE = 120] = "VOTE", e[e.REBLOG = 130] = "REBLOG", e[e.DELEGATION = 150] = "DELEGATION", e[e.REFERRAL = 160] = "REFERRAL", e[e.COMMUNITY = 170] = "COMMUNITY", e[e.TRANSFER_SENT = 998] = "TRANSFER_SENT", e[e.TRANSFER_INCOMING = 999] = "TRANSFER_INCOMING", e[e.MINTED = 991] = "MINTED", e))(Ve || {});
|
|
1670
|
+
function Ht(e) {
|
|
1614
1671
|
return h({
|
|
1615
1672
|
queryKey: ["ecency-wallets", "all-tokens-list", e],
|
|
1616
1673
|
queryFn: async () => {
|
|
@@ -1634,13 +1691,13 @@ function Nt(e) {
|
|
|
1634
1691
|
}
|
|
1635
1692
|
});
|
|
1636
1693
|
}
|
|
1637
|
-
function
|
|
1694
|
+
function Ge(e) {
|
|
1638
1695
|
return h({
|
|
1639
1696
|
queryKey: ["ecency-wallets", "list", e],
|
|
1640
1697
|
enabled: !!e,
|
|
1641
1698
|
queryFn: async () => {
|
|
1642
1699
|
var r;
|
|
1643
|
-
const t =
|
|
1700
|
+
const t = b(e);
|
|
1644
1701
|
await i().fetchQuery({
|
|
1645
1702
|
queryKey: t.queryKey
|
|
1646
1703
|
});
|
|
@@ -1667,7 +1724,7 @@ function Ue(e) {
|
|
|
1667
1724
|
}
|
|
1668
1725
|
});
|
|
1669
1726
|
}
|
|
1670
|
-
function
|
|
1727
|
+
function We(e, t, n = { refetch: !1 }) {
|
|
1671
1728
|
const r = async (s) => (n.refetch ? await i().fetchQuery(s) : await i().prefetchQuery(s), i().getQueryData(
|
|
1672
1729
|
s.queryKey
|
|
1673
1730
|
));
|
|
@@ -1677,20 +1734,20 @@ function Ve(e, t, n = { refetch: !1 }) {
|
|
|
1677
1734
|
if (t === "HIVE")
|
|
1678
1735
|
return r(O(e));
|
|
1679
1736
|
if (t === "HP")
|
|
1680
|
-
return r(
|
|
1737
|
+
return r(ne(e));
|
|
1681
1738
|
if (t === "HBD")
|
|
1682
|
-
return r(
|
|
1739
|
+
return r(Te(e));
|
|
1683
1740
|
if (t === "SPK")
|
|
1684
|
-
return r(
|
|
1741
|
+
return r(Re(e));
|
|
1685
1742
|
if (t === "LARYNX")
|
|
1686
|
-
return r(De(e));
|
|
1687
|
-
if (t === "LP")
|
|
1688
1743
|
return r(Ee(e));
|
|
1744
|
+
if (t === "LP")
|
|
1745
|
+
return r(Ie(e));
|
|
1689
1746
|
if (t === "POINTS")
|
|
1690
|
-
return r(
|
|
1747
|
+
return r(xe(e));
|
|
1691
1748
|
if (B.includes(t))
|
|
1692
1749
|
return await r(
|
|
1693
|
-
|
|
1750
|
+
Fe(e, t)
|
|
1694
1751
|
);
|
|
1695
1752
|
throw new Error(
|
|
1696
1753
|
"[SDK][Wallets] – has requested unrecognized asset info"
|
|
@@ -1698,7 +1755,7 @@ function Ve(e, t, n = { refetch: !1 }) {
|
|
|
1698
1755
|
}
|
|
1699
1756
|
});
|
|
1700
1757
|
}
|
|
1701
|
-
function
|
|
1758
|
+
function Qt(e, t, n = !1) {
|
|
1702
1759
|
return h({
|
|
1703
1760
|
queryKey: ["wallets", "token-operations", e, t, n],
|
|
1704
1761
|
queryFn: async () => {
|
|
@@ -1752,41 +1809,18 @@ function Ht(e, t, n = !1) {
|
|
|
1752
1809
|
(s == null ? void 0 : s.map((k) => k.symbol)) ?? []
|
|
1753
1810
|
);
|
|
1754
1811
|
await i().prefetchQuery(a);
|
|
1755
|
-
const o = i().getQueryData(a.queryKey), c = s == null ? void 0 : s.find((k) => k.symbol === e), l = o == null ? void 0 : o.find((k) => k.symbol === e), w = n && (l == null ? void 0 : l.delegationEnabled) && c && parseFloat(c.delegationsOut) !== parseFloat(c.balance), _ = n && parseFloat((c == null ? void 0 : c.delegationsOut) ?? "0") > 0, v = n && (l == null ? void 0 : l.stakingEnabled),
|
|
1812
|
+
const o = i().getQueryData(a.queryKey), c = s == null ? void 0 : s.find((k) => k.symbol === e), l = o == null ? void 0 : o.find((k) => k.symbol === e), w = n && (l == null ? void 0 : l.delegationEnabled) && c && parseFloat(c.delegationsOut) !== parseFloat(c.balance), _ = n && parseFloat((c == null ? void 0 : c.delegationsOut) ?? "0") > 0, v = n && (l == null ? void 0 : l.stakingEnabled), P = n && parseFloat((c == null ? void 0 : c.stake) ?? "0") > 0;
|
|
1756
1813
|
return [
|
|
1757
1814
|
u.Transfer,
|
|
1758
1815
|
...w ? [u.Delegate] : [],
|
|
1759
1816
|
..._ ? [u.Undelegate] : [],
|
|
1760
1817
|
...v ? [u.Stake] : [],
|
|
1761
|
-
...
|
|
1818
|
+
...P ? [u.Unstake] : []
|
|
1762
1819
|
];
|
|
1763
1820
|
}
|
|
1764
1821
|
});
|
|
1765
1822
|
}
|
|
1766
|
-
|
|
1767
|
-
return new Promise((t) => setTimeout(t, e));
|
|
1768
|
-
}
|
|
1769
|
-
function re(e) {
|
|
1770
|
-
switch (e) {
|
|
1771
|
-
case f.BTC:
|
|
1772
|
-
return new le();
|
|
1773
|
-
case f.ETH:
|
|
1774
|
-
return new fe();
|
|
1775
|
-
case f.TRON:
|
|
1776
|
-
return new ye();
|
|
1777
|
-
case f.TON:
|
|
1778
|
-
return new me();
|
|
1779
|
-
case f.SOL:
|
|
1780
|
-
return new pe();
|
|
1781
|
-
case f.ATOM:
|
|
1782
|
-
return new he();
|
|
1783
|
-
case f.APT:
|
|
1784
|
-
return new ge();
|
|
1785
|
-
default:
|
|
1786
|
-
return;
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
const We = {
|
|
1823
|
+
const Ye = {
|
|
1790
1824
|
[f.BTC]: "m/44'/0'/0'/0/0",
|
|
1791
1825
|
// Bitcoin (BIP44)
|
|
1792
1826
|
[f.ETH]: "m/44'/60'/0'/0/0",
|
|
@@ -1802,17 +1836,17 @@ const We = {
|
|
|
1802
1836
|
[f.ATOM]: "m/44'/118'/0'/0/0"
|
|
1803
1837
|
// Cosmos (BIP44)
|
|
1804
1838
|
};
|
|
1805
|
-
function
|
|
1806
|
-
const { data: n } = z(e), r =
|
|
1839
|
+
function Dt(e, t) {
|
|
1840
|
+
const { data: n } = z(e), r = M(), s = K({
|
|
1807
1841
|
mutationKey: ["ecency-wallets", "create-wallet", e, t],
|
|
1808
1842
|
mutationFn: async () => {
|
|
1809
1843
|
if (!n)
|
|
1810
1844
|
throw new Error("[Ecency][Wallets] - No seed to create a wallet");
|
|
1811
|
-
const o =
|
|
1845
|
+
const o = ae(t), c = await (o == null ? void 0 : o.getDerivedPrivateKey({
|
|
1812
1846
|
mnemonic: n,
|
|
1813
|
-
hdPath:
|
|
1847
|
+
hdPath: Ye[t]
|
|
1814
1848
|
}));
|
|
1815
|
-
await
|
|
1849
|
+
await se(1e3);
|
|
1816
1850
|
const l = await (o == null ? void 0 : o.getNewAddress({
|
|
1817
1851
|
privateKey: c
|
|
1818
1852
|
}));
|
|
@@ -1833,18 +1867,18 @@ function Kt(e, t) {
|
|
|
1833
1867
|
)
|
|
1834
1868
|
);
|
|
1835
1869
|
}
|
|
1836
|
-
}), a =
|
|
1870
|
+
}), a = ve(() => {
|
|
1837
1871
|
}, []);
|
|
1838
1872
|
return {
|
|
1839
1873
|
createWallet: s,
|
|
1840
1874
|
importWallet: a
|
|
1841
1875
|
};
|
|
1842
1876
|
}
|
|
1843
|
-
function
|
|
1844
|
-
const { data: t } =
|
|
1877
|
+
function Xe(e) {
|
|
1878
|
+
const { data: t } = N({
|
|
1845
1879
|
queryKey: ["ecency-wallets", "wallets", e]
|
|
1846
|
-
}), { data: n } =
|
|
1847
|
-
return
|
|
1880
|
+
}), { data: n } = qe(e);
|
|
1881
|
+
return K({
|
|
1848
1882
|
mutationKey: ["ecency-wallets", "create-account-with-wallets", e],
|
|
1849
1883
|
mutationFn: ({ currency: r, address: s }) => fetch(y.privateApiHost + "/private-api/wallets-add", {
|
|
1850
1884
|
method: "POST",
|
|
@@ -1872,8 +1906,8 @@ function Ye(e) {
|
|
|
1872
1906
|
})
|
|
1873
1907
|
});
|
|
1874
1908
|
}
|
|
1875
|
-
function
|
|
1876
|
-
return
|
|
1909
|
+
function oe() {
|
|
1910
|
+
return K({
|
|
1877
1911
|
mutationKey: ["ecency-wallets", "check-wallet-existence"],
|
|
1878
1912
|
mutationFn: async ({ address: e, currency: t }) => (await (await fetch(
|
|
1879
1913
|
y.privateApiHost + "/private-api/wallets-exist",
|
|
@@ -1890,11 +1924,11 @@ function se() {
|
|
|
1890
1924
|
)).json()).length === 0
|
|
1891
1925
|
});
|
|
1892
1926
|
}
|
|
1893
|
-
const
|
|
1927
|
+
const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1894
1928
|
__proto__: null,
|
|
1895
|
-
useCheckWalletExistence:
|
|
1896
|
-
useCreateAccountWithWallets:
|
|
1897
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1929
|
+
useCheckWalletExistence: oe,
|
|
1930
|
+
useCreateAccountWithWallets: Xe
|
|
1931
|
+
}, Symbol.toStringTag, { value: "Module" })), ze = {
|
|
1898
1932
|
[f.BTC]: ["m/84'/0'/0'/0/0"],
|
|
1899
1933
|
[f.ETH]: ["m/84'/60'/0'/0/0"],
|
|
1900
1934
|
// its not working for Trust, Exodus, todo: check others below
|
|
@@ -1905,8 +1939,8 @@ const Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1905
1939
|
// Disabled
|
|
1906
1940
|
[f.ATOM]: ["m/84'/118'/0'/0'/0"]
|
|
1907
1941
|
};
|
|
1908
|
-
async function
|
|
1909
|
-
for (const r of
|
|
1942
|
+
async function Ze(e, t, n) {
|
|
1943
|
+
for (const r of ze[n] || [])
|
|
1910
1944
|
try {
|
|
1911
1945
|
const s = await t.getDerivedPrivateKey({
|
|
1912
1946
|
mnemonic: e,
|
|
@@ -1921,17 +1955,17 @@ async function ze(e, t, n) {
|
|
|
1921
1955
|
}
|
|
1922
1956
|
return [];
|
|
1923
1957
|
}
|
|
1924
|
-
function
|
|
1925
|
-
const n =
|
|
1926
|
-
return
|
|
1958
|
+
function Et(e, t) {
|
|
1959
|
+
const n = M(), { mutateAsync: r } = oe();
|
|
1960
|
+
return K({
|
|
1927
1961
|
mutationKey: ["ecency-wallets", "import-wallet", e, t],
|
|
1928
1962
|
mutationFn: async ({ privateKeyOrSeed: s }) => {
|
|
1929
|
-
const a =
|
|
1963
|
+
const a = ae(t);
|
|
1930
1964
|
if (!a)
|
|
1931
1965
|
throw new Error("Cannot find token for this currency");
|
|
1932
1966
|
const o = s.split(" ").length === 12;
|
|
1933
1967
|
let c, l = s;
|
|
1934
|
-
if (o ? [l, c] = await
|
|
1968
|
+
if (o ? [l, c] = await Ze(
|
|
1935
1969
|
s,
|
|
1936
1970
|
a,
|
|
1937
1971
|
t
|
|
@@ -1978,9 +2012,9 @@ function Y(e, t = !1) {
|
|
|
1978
2012
|
A.groupByProp("symbol")
|
|
1979
2013
|
) : {};
|
|
1980
2014
|
}
|
|
1981
|
-
function
|
|
1982
|
-
const t =
|
|
1983
|
-
return
|
|
2015
|
+
function Rt(e) {
|
|
2016
|
+
const t = M(), { data: n } = N(b(e)), { mutateAsync: r } = le(e);
|
|
2017
|
+
return K({
|
|
1984
2018
|
mutationKey: ["ecency-wallets", "save-wallet-to-metadata", n],
|
|
1985
2019
|
mutationFn: async (s) => {
|
|
1986
2020
|
var _;
|
|
@@ -1988,9 +2022,9 @@ function Ct(e) {
|
|
|
1988
2022
|
throw new Error("[SDK][Wallets] – no account data to save wallets");
|
|
1989
2023
|
const a = Y(
|
|
1990
2024
|
(_ = n.profile) == null ? void 0 : _.tokens
|
|
1991
|
-
), o = s.map(({ currency: v, type:
|
|
2025
|
+
), o = s.map(({ currency: v, type: P, ...k }) => ({
|
|
1992
2026
|
symbol: v,
|
|
1993
|
-
type:
|
|
2027
|
+
type: P,
|
|
1994
2028
|
meta: k
|
|
1995
2029
|
})) ?? [], c = Y(o, !0), l = o.filter(
|
|
1996
2030
|
({ type: v }) => v !== "CHAIN"
|
|
@@ -2007,51 +2041,51 @@ function Ct(e) {
|
|
|
2007
2041
|
});
|
|
2008
2042
|
},
|
|
2009
2043
|
onSuccess: () => t.invalidateQueries({
|
|
2010
|
-
queryKey:
|
|
2044
|
+
queryKey: Ge(e).queryKey
|
|
2011
2045
|
})
|
|
2012
2046
|
});
|
|
2013
2047
|
}
|
|
2014
|
-
const
|
|
2048
|
+
const et = {
|
|
2015
2049
|
HIVE: {
|
|
2016
2050
|
[u.Transfer]: V,
|
|
2017
2051
|
[u.TransferToSavings]: G,
|
|
2018
|
-
[u.PowerUp]:
|
|
2052
|
+
[u.PowerUp]: Ae
|
|
2019
2053
|
},
|
|
2020
2054
|
HBD: {
|
|
2021
2055
|
[u.Transfer]: V,
|
|
2022
2056
|
[u.TransferToSavings]: G
|
|
2023
2057
|
},
|
|
2024
2058
|
HP: {
|
|
2025
|
-
[u.PowerDown]:
|
|
2026
|
-
[u.Delegate]:
|
|
2027
|
-
[u.WithdrawRoutes]:
|
|
2059
|
+
[u.PowerDown]: Ke,
|
|
2060
|
+
[u.Delegate]: Ne,
|
|
2061
|
+
[u.WithdrawRoutes]: He
|
|
2028
2062
|
},
|
|
2029
2063
|
POINTS: {
|
|
2030
|
-
[u.Gift]:
|
|
2064
|
+
[u.Gift]: Ue
|
|
2031
2065
|
},
|
|
2032
2066
|
SPK: {
|
|
2033
|
-
[u.Transfer]:
|
|
2067
|
+
[u.Transfer]: Qe
|
|
2034
2068
|
},
|
|
2035
2069
|
LARYNX: {
|
|
2036
|
-
[u.LockLiquidity]:
|
|
2037
|
-
[u.PowerUp]:
|
|
2070
|
+
[u.LockLiquidity]: De,
|
|
2071
|
+
[u.PowerUp]: Ce
|
|
2038
2072
|
}
|
|
2039
|
-
},
|
|
2040
|
-
[u.Transfer]:
|
|
2041
|
-
[u.Stake]:
|
|
2042
|
-
[u.Unstake]:
|
|
2043
|
-
[u.Delegate]:
|
|
2044
|
-
[u.Undelegate]:
|
|
2073
|
+
}, tt = {
|
|
2074
|
+
[u.Transfer]: $e,
|
|
2075
|
+
[u.Stake]: Me,
|
|
2076
|
+
[u.Unstake]: Je,
|
|
2077
|
+
[u.Delegate]: Le,
|
|
2078
|
+
[u.Undelegate]: Be
|
|
2045
2079
|
};
|
|
2046
|
-
function
|
|
2080
|
+
function It(e, t, n) {
|
|
2047
2081
|
const { mutateAsync: r } = X.useRecordActivity(
|
|
2048
2082
|
e,
|
|
2049
2083
|
n
|
|
2050
2084
|
);
|
|
2051
|
-
return
|
|
2085
|
+
return K({
|
|
2052
2086
|
mutationKey: ["ecency-wallets", t, n],
|
|
2053
2087
|
mutationFn: async (s) => {
|
|
2054
|
-
const a =
|
|
2088
|
+
const a = et[t][n];
|
|
2055
2089
|
if (a)
|
|
2056
2090
|
return a(s);
|
|
2057
2091
|
const o = U(e);
|
|
@@ -2060,7 +2094,7 @@ function Et(e, t, n) {
|
|
|
2060
2094
|
o.queryKey
|
|
2061
2095
|
);
|
|
2062
2096
|
if (c != null && c.some((l) => l.symbol === t)) {
|
|
2063
|
-
const l =
|
|
2097
|
+
const l = tt[n];
|
|
2064
2098
|
if (l)
|
|
2065
2099
|
return l({ ...s, asset: t });
|
|
2066
2100
|
}
|
|
@@ -2068,7 +2102,7 @@ function Et(e, t, n) {
|
|
|
2068
2102
|
},
|
|
2069
2103
|
onSuccess: () => {
|
|
2070
2104
|
r();
|
|
2071
|
-
const s =
|
|
2105
|
+
const s = We(e, t, {
|
|
2072
2106
|
refetch: !0
|
|
2073
2107
|
});
|
|
2074
2108
|
setTimeout(
|
|
@@ -2084,61 +2118,62 @@ export {
|
|
|
2084
2118
|
u as AssetOperation,
|
|
2085
2119
|
g as EcencyWalletBasicTokens,
|
|
2086
2120
|
f as EcencyWalletCurrency,
|
|
2087
|
-
|
|
2121
|
+
Ct as EcencyWalletsPrivateApi,
|
|
2088
2122
|
te as NaiMap,
|
|
2089
|
-
|
|
2123
|
+
Ve as PointTransactionType,
|
|
2090
2124
|
ee as Symbol,
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2125
|
+
Le as delegateEngineToken,
|
|
2126
|
+
Ne as delegateHive,
|
|
2127
|
+
We as getAccountWalletAssetInfoQueryOptions,
|
|
2128
|
+
Ge as getAccountWalletListQueryOptions,
|
|
2129
|
+
Ht as getAllTokensListQueryOptions,
|
|
2130
|
+
Te as getHbdAssetGeneralInfoQueryOptions,
|
|
2131
|
+
Pt as getHbdAssetTransactionsQueryOptions,
|
|
2098
2132
|
O as getHiveAssetGeneralInfoQueryOptions,
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2133
|
+
qt as getHiveAssetMetricQueryOptions,
|
|
2134
|
+
re as getHiveAssetTransactionsQueryOptions,
|
|
2135
|
+
St as getHiveAssetWithdrawalRoutesQueryOptions,
|
|
2136
|
+
Fe as getHiveEngineTokenGeneralInfoQueryOptions,
|
|
2137
|
+
Tt as getHiveEngineTokenTransactionsQueryOptions,
|
|
2104
2138
|
U as getHiveEngineTokensBalancesQueryOptions,
|
|
2105
|
-
|
|
2139
|
+
je as getHiveEngineTokensMarketQueryOptions,
|
|
2106
2140
|
L as getHiveEngineTokensMetadataQueryOptions,
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2141
|
+
At as getHiveEngineTokensMetricsQueryOptions,
|
|
2142
|
+
ne as getHivePowerAssetGeneralInfoQueryOptions,
|
|
2143
|
+
bt as getHivePowerAssetTransactionsQueryOptions,
|
|
2144
|
+
Ee as getLarynxAssetGeneralInfoQueryOptions,
|
|
2145
|
+
Ie as getLarynxPowerAssetGeneralInfoQueryOptions,
|
|
2146
|
+
xe as getPointsAssetGeneralInfoQueryOptions,
|
|
2147
|
+
Nt as getPointsAssetTransactionsQueryOptions,
|
|
2148
|
+
$ as getPointsQueryOptions,
|
|
2149
|
+
Re as getSpkAssetGeneralInfoQueryOptions,
|
|
2150
|
+
Q as getSpkMarketsQueryOptions,
|
|
2151
|
+
Qt as getTokenOperationsQueryOptions,
|
|
2152
|
+
kt as isEmptyDate,
|
|
2153
|
+
De as lockLarynx,
|
|
2120
2154
|
p as parseAsset,
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2155
|
+
Ke as powerDownHive,
|
|
2156
|
+
Ae as powerUpHive,
|
|
2157
|
+
Ce as powerUpLarynx,
|
|
2158
|
+
Se as rewardSpk,
|
|
2159
|
+
Me as stakeEngineToken,
|
|
2160
|
+
$e as transferEngineToken,
|
|
2127
2161
|
V as transferHive,
|
|
2128
|
-
|
|
2129
|
-
|
|
2162
|
+
Ue as transferPoint,
|
|
2163
|
+
Qe as transferSpk,
|
|
2130
2164
|
G as transferToSavingsHive,
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2165
|
+
Be as undelegateEngineToken,
|
|
2166
|
+
Je as unstakeEngineToken,
|
|
2167
|
+
Kt as useClaimPoints,
|
|
2168
|
+
Ot as useClaimRewards,
|
|
2169
|
+
vt as useCoinGeckoPriceQuery,
|
|
2170
|
+
_t as useGetExternalWalletBalanceQuery,
|
|
2171
|
+
qe as useHiveKeysQuery,
|
|
2172
|
+
Et as useImportWallet,
|
|
2173
|
+
Rt as useSaveWalletInformationToMetadata,
|
|
2139
2174
|
z as useSeedPhrase,
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2175
|
+
Dt as useWalletCreate,
|
|
2176
|
+
It as useWalletOperation,
|
|
2177
|
+
J as vestsToHp,
|
|
2178
|
+
He as withdrawVestingRouteHive
|
|
2144
2179
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useClaimRewards(username: string, onSuccess: () => void): import('@tanstack/react-query').UseMutationResult<unknown, Error, unknown, unknown>;
|
|
@@ -15,7 +15,7 @@ export declare function getPointsAssetTransactionsQueryOptions(username: string
|
|
|
15
15
|
asset: string;
|
|
16
16
|
}[];
|
|
17
17
|
id: number;
|
|
18
|
-
}[], (string | undefined)[]>, "queryFn"> & {
|
|
18
|
+
}[], (string | PointTransactionType | undefined)[]>, "queryFn"> & {
|
|
19
19
|
queryFn?: import('@tanstack/query-core').QueryFunction<{
|
|
20
20
|
created: Date;
|
|
21
21
|
type: PointTransactionType;
|
|
@@ -24,9 +24,9 @@ export declare function getPointsAssetTransactionsQueryOptions(username: string
|
|
|
24
24
|
asset: string;
|
|
25
25
|
}[];
|
|
26
26
|
id: number;
|
|
27
|
-
}[], (string | undefined)[], never> | undefined;
|
|
27
|
+
}[], (string | PointTransactionType | undefined)[], never> | undefined;
|
|
28
28
|
} & {
|
|
29
|
-
queryKey: (string | undefined)[] & {
|
|
29
|
+
queryKey: (string | PointTransactionType | undefined)[] & {
|
|
30
30
|
[dataTagSymbol]: {
|
|
31
31
|
created: Date;
|
|
32
32
|
type: PointTransactionType;
|