@ecency/wallets 1.3.4 → 1.3.6
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 +313 -249
- package/dist/modules/assets/hive/mutations/claim-rewards.d.ts +1 -0
- package/dist/modules/assets/hive/mutations/index.d.ts +1 -0
- package/dist/modules/assets/hive/queries/get-hive-power-delegates-query-options.d.ts +9 -0
- package/dist/modules/assets/hive/queries/get-hive-power-delegatings-query-options.d.ts +9 -0
- package/dist/modules/assets/hive/queries/index.d.ts +2 -0
- package/dist/modules/assets/hive/types/delegated-vesting-share.d.ts +7 -0
- package/dist/modules/assets/hive/types/index.d.ts +3 -1
- package/dist/modules/assets/hive/types/received-vesting-share.d.ts +6 -0
- package/package.json +1 -1
package/dist/ecency-sdk.es.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { CONFIG as y, getQueryClient as i, getDynamicPropsQueryOptions as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import
|
|
4
|
-
import { LRUCache as
|
|
1
|
+
import { CONFIG as y, getQueryClient as i, getDynamicPropsQueryOptions as K, 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 H } 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 O = (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 O ? parseInt(O.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 $(e, t) {
|
|
176
176
|
return e / 1e6 * t;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function Oe(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)
|
|
@@ -194,19 +194,19 @@ function be(e, t) {
|
|
|
194
194
|
return (l * (1 + _ / 365) - l) * w;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function S(e) {
|
|
198
198
|
return h({
|
|
199
199
|
queryKey: ["assets", "hive", "general-info", e],
|
|
200
200
|
staleTime: 6e4,
|
|
201
201
|
refetchInterval: 9e4,
|
|
202
202
|
queryFn: async () => {
|
|
203
|
-
await i().prefetchQuery(
|
|
204
|
-
|
|
203
|
+
await i().prefetchQuery(K()), await i().prefetchQuery(
|
|
204
|
+
b(e)
|
|
205
205
|
);
|
|
206
206
|
const t = i().getQueryData(
|
|
207
|
-
|
|
207
|
+
K().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 Se(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
|
-
await i().prefetchQuery(
|
|
233
|
-
|
|
232
|
+
await i().prefetchQuery(K()), await i().prefetchQuery(
|
|
233
|
+
b(e)
|
|
234
234
|
);
|
|
235
235
|
const t = i().getQueryData(
|
|
236
|
-
|
|
236
|
+
K().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: +$(
|
|
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: Se(t),
|
|
257
257
|
parts: [
|
|
258
258
|
{
|
|
259
259
|
name: "delegating",
|
|
260
|
-
balance:
|
|
260
|
+
balance: +$(
|
|
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: +$(
|
|
268
268
|
p(n.received_vesting_shares).amount,
|
|
269
269
|
t.hivePerMVests
|
|
270
270
|
).toFixed(3)
|
|
@@ -274,19 +274,19 @@ 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
|
-
await i().prefetchQuery(
|
|
284
|
-
|
|
283
|
+
await i().prefetchQuery(K()), await i().prefetchQuery(
|
|
284
|
+
b(e)
|
|
285
285
|
);
|
|
286
286
|
const t = i().getQueryData(
|
|
287
|
-
|
|
287
|
+
b(e).queryKey
|
|
288
288
|
), n = i().getQueryData(
|
|
289
|
-
|
|
289
|
+
K().queryKey
|
|
290
290
|
);
|
|
291
291
|
return t ? {
|
|
292
292
|
name: "HBD",
|
|
@@ -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 Ot(e) {
|
|
559
559
|
return h({
|
|
560
560
|
queryKey: ["assets", "hive", "withdrawal-routes", e],
|
|
561
561
|
queryFn: () => y.hiveClient.database.call("get_withdraw_routes", [
|
|
@@ -564,6 +564,33 @@ function qt(e) {
|
|
|
564
564
|
])
|
|
565
565
|
});
|
|
566
566
|
}
|
|
567
|
+
function St(e, t = 50) {
|
|
568
|
+
return h({
|
|
569
|
+
queryKey: ["assets", "hive-power", "delegates", e],
|
|
570
|
+
enabled: !!e,
|
|
571
|
+
queryFn: () => y.hiveClient.database.call("get_vesting_delegations", [
|
|
572
|
+
e,
|
|
573
|
+
"",
|
|
574
|
+
t
|
|
575
|
+
])
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
function Tt(e) {
|
|
579
|
+
return h({
|
|
580
|
+
queryKey: ["assets", "hive-power", "delegatings", e],
|
|
581
|
+
queryFn: async () => (await (await fetch(
|
|
582
|
+
y.privateApiHost + `/private-api/received-vesting/${e}`,
|
|
583
|
+
{
|
|
584
|
+
headers: {
|
|
585
|
+
"Content-Type": "application/json"
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
)).json()).list,
|
|
589
|
+
select: (t) => t.sort(
|
|
590
|
+
(n, r) => p(r.vesting_shares).amount - p(n.vesting_shares).amount
|
|
591
|
+
)
|
|
592
|
+
});
|
|
593
|
+
}
|
|
567
594
|
async function V(e) {
|
|
568
595
|
const n = p(e.amount).symbol;
|
|
569
596
|
if (e.type === "key" && "key" in e) {
|
|
@@ -615,7 +642,7 @@ async function G(e) {
|
|
|
615
642
|
[["transfer_to_savings", r]],
|
|
616
643
|
t
|
|
617
644
|
);
|
|
618
|
-
} else return e.type === "keychain" ?
|
|
645
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
619
646
|
e.from,
|
|
620
647
|
[["transfer_to_savings", e]],
|
|
621
648
|
"Active"
|
|
@@ -626,14 +653,14 @@ async function G(e) {
|
|
|
626
653
|
}
|
|
627
654
|
);
|
|
628
655
|
}
|
|
629
|
-
async function
|
|
656
|
+
async function Ae(e) {
|
|
630
657
|
if (e.type === "key" && "key" in e) {
|
|
631
658
|
const { key: t, type: n, ...r } = e;
|
|
632
659
|
return y.hiveClient.broadcast.sendOperations(
|
|
633
660
|
[["transfer_to_vesting", r]],
|
|
634
661
|
t
|
|
635
662
|
);
|
|
636
|
-
} else return e.type === "keychain" ?
|
|
663
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
637
664
|
e.from,
|
|
638
665
|
[["transfer_to_vesting", e]],
|
|
639
666
|
"Active"
|
|
@@ -644,14 +671,14 @@ async function Oe(e) {
|
|
|
644
671
|
}
|
|
645
672
|
);
|
|
646
673
|
}
|
|
647
|
-
async function
|
|
674
|
+
async function Ne(e) {
|
|
648
675
|
if (e.type === "key" && "key" in e) {
|
|
649
676
|
const { key: t, type: n, ...r } = e;
|
|
650
677
|
return y.hiveClient.broadcast.sendOperations(
|
|
651
678
|
[["delegate_vesting_shares", r]],
|
|
652
679
|
t
|
|
653
680
|
);
|
|
654
|
-
} else return e.type === "keychain" ?
|
|
681
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
655
682
|
e.from,
|
|
656
683
|
[["delegate_vesting_shares", e]],
|
|
657
684
|
"Active"
|
|
@@ -662,14 +689,14 @@ async function Te(e) {
|
|
|
662
689
|
}
|
|
663
690
|
);
|
|
664
691
|
}
|
|
665
|
-
async function
|
|
692
|
+
async function He(e) {
|
|
666
693
|
if (e.type === "key" && "key" in e) {
|
|
667
694
|
const { key: t, type: n, ...r } = e;
|
|
668
695
|
return y.hiveClient.broadcast.sendOperations(
|
|
669
696
|
[["withdraw_vesting", r]],
|
|
670
697
|
t
|
|
671
698
|
);
|
|
672
|
-
} else return e.type === "keychain" ?
|
|
699
|
+
} else return e.type === "keychain" ? q.broadcast(
|
|
673
700
|
e.from,
|
|
674
701
|
[["withdraw_vesting", e]],
|
|
675
702
|
"Active"
|
|
@@ -680,7 +707,7 @@ async function Ae(e) {
|
|
|
680
707
|
}
|
|
681
708
|
);
|
|
682
709
|
}
|
|
683
|
-
async function
|
|
710
|
+
async function Ke(e) {
|
|
684
711
|
if (e.type === "key" && "key" in e) {
|
|
685
712
|
const { key: r, type: s, ...a } = e;
|
|
686
713
|
return y.hiveClient.broadcast.sendOperations(
|
|
@@ -690,7 +717,7 @@ async function Ne(e) {
|
|
|
690
717
|
}
|
|
691
718
|
if (e.type === "keychain") {
|
|
692
719
|
const { type: r, ...s } = e;
|
|
693
|
-
return
|
|
720
|
+
return q.broadcast(
|
|
694
721
|
s.from_account,
|
|
695
722
|
[["set_withdraw_vesting_route", s]],
|
|
696
723
|
"Active"
|
|
@@ -704,8 +731,65 @@ async function Ne(e) {
|
|
|
704
731
|
}
|
|
705
732
|
);
|
|
706
733
|
}
|
|
734
|
+
function se(e) {
|
|
735
|
+
return new Promise((t) => setTimeout(t, e));
|
|
736
|
+
}
|
|
737
|
+
function ae(e) {
|
|
738
|
+
switch (e) {
|
|
739
|
+
case f.BTC:
|
|
740
|
+
return new me();
|
|
741
|
+
case f.ETH:
|
|
742
|
+
return new pe();
|
|
743
|
+
case f.TRON:
|
|
744
|
+
return new he();
|
|
745
|
+
case f.TON:
|
|
746
|
+
return new ge();
|
|
747
|
+
case f.SOL:
|
|
748
|
+
return new we();
|
|
749
|
+
case f.ATOM:
|
|
750
|
+
return new de();
|
|
751
|
+
case f.APT:
|
|
752
|
+
return new _e();
|
|
753
|
+
default:
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function At(e, t) {
|
|
758
|
+
const { data: n } = N(b(e)), r = M();
|
|
759
|
+
return ce(
|
|
760
|
+
["assets", "hive", "claim-rewards", n == null ? void 0 : n.name],
|
|
761
|
+
e,
|
|
762
|
+
() => {
|
|
763
|
+
if (!n)
|
|
764
|
+
throw new Error("Failed to fetch account while claiming balance");
|
|
765
|
+
const {
|
|
766
|
+
reward_hive_balance: s,
|
|
767
|
+
reward_hbd_balance: a,
|
|
768
|
+
reward_vesting_balance: o
|
|
769
|
+
} = n;
|
|
770
|
+
return [
|
|
771
|
+
[
|
|
772
|
+
"claim_reward_balance",
|
|
773
|
+
{
|
|
774
|
+
account: e,
|
|
775
|
+
reward_hive: s,
|
|
776
|
+
reward_hbd: a,
|
|
777
|
+
reward_vests: o
|
|
778
|
+
}
|
|
779
|
+
]
|
|
780
|
+
];
|
|
781
|
+
},
|
|
782
|
+
async () => {
|
|
783
|
+
t(), await se(1e3), r.invalidateQueries({
|
|
784
|
+
queryKey: b(e).queryKey
|
|
785
|
+
}), r.invalidateQueries({
|
|
786
|
+
queryKey: ne(e).queryKey
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
);
|
|
790
|
+
}
|
|
707
791
|
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
|
|
792
|
+
async function Qe(e) {
|
|
709
793
|
const t = JSON.stringify({
|
|
710
794
|
to: e.to,
|
|
711
795
|
amount: +e.amount * 1e3,
|
|
@@ -721,7 +805,7 @@ async function He(e) {
|
|
|
721
805
|
return y.hiveClient.broadcast.json(n, r);
|
|
722
806
|
} else {
|
|
723
807
|
if (e.type === "keychain")
|
|
724
|
-
return
|
|
808
|
+
return q.customJson(
|
|
725
809
|
e.from,
|
|
726
810
|
e.id,
|
|
727
811
|
"Active",
|
|
@@ -748,7 +832,7 @@ async function He(e) {
|
|
|
748
832
|
}
|
|
749
833
|
}
|
|
750
834
|
}
|
|
751
|
-
const
|
|
835
|
+
const De = async (e) => {
|
|
752
836
|
const t = JSON.stringify({ amount: +e.amount * 1e3 }), n = {
|
|
753
837
|
id: e.mode === "lock" ? "spkcc_gov_up" : "spkcc_gov_down",
|
|
754
838
|
json: t,
|
|
@@ -760,7 +844,7 @@ const Ke = async (e) => {
|
|
|
760
844
|
return y.hiveClient.broadcast.json(n, r);
|
|
761
845
|
} else {
|
|
762
846
|
if (e.type === "keychain")
|
|
763
|
-
return
|
|
847
|
+
return q.customJson(
|
|
764
848
|
e.from,
|
|
765
849
|
n.id,
|
|
766
850
|
"Active",
|
|
@@ -783,7 +867,7 @@ const Ke = async (e) => {
|
|
|
783
867
|
}
|
|
784
868
|
}
|
|
785
869
|
};
|
|
786
|
-
async function
|
|
870
|
+
async function Ce(e) {
|
|
787
871
|
const t = JSON.stringify({ amount: +e.amount * 1e3 }), n = {
|
|
788
872
|
id: `spkcc_power_${e.mode}`,
|
|
789
873
|
json: t,
|
|
@@ -795,7 +879,7 @@ async function Qe(e) {
|
|
|
795
879
|
return y.hiveClient.broadcast.json(n, r);
|
|
796
880
|
} else {
|
|
797
881
|
if (e.type === "keychain")
|
|
798
|
-
return
|
|
882
|
+
return q.customJson(
|
|
799
883
|
e.from,
|
|
800
884
|
`spkcc_power_${e.mode}`,
|
|
801
885
|
"Active",
|
|
@@ -818,7 +902,7 @@ async function Qe(e) {
|
|
|
818
902
|
}
|
|
819
903
|
}
|
|
820
904
|
}
|
|
821
|
-
function
|
|
905
|
+
function Q() {
|
|
822
906
|
return h({
|
|
823
907
|
queryKey: ["assets", "spk", "markets"],
|
|
824
908
|
staleTime: 6e4,
|
|
@@ -835,7 +919,7 @@ function K() {
|
|
|
835
919
|
}
|
|
836
920
|
});
|
|
837
921
|
}
|
|
838
|
-
function
|
|
922
|
+
function D(e) {
|
|
839
923
|
return h({
|
|
840
924
|
queryKey: ["assets", "spk", "wallet", e],
|
|
841
925
|
queryFn: async () => (await fetch(y.spkNode + `/@${e}`)).json(),
|
|
@@ -847,21 +931,21 @@ function Q(e) {
|
|
|
847
931
|
function W(e) {
|
|
848
932
|
return e.toFixed(3);
|
|
849
933
|
}
|
|
850
|
-
function
|
|
934
|
+
function Ee(e) {
|
|
851
935
|
return h({
|
|
852
936
|
queryKey: ["assets", "larynx", "general-info", e],
|
|
853
937
|
staleTime: 6e4,
|
|
854
938
|
refetchInterval: 9e4,
|
|
855
939
|
queryFn: async () => {
|
|
856
|
-
await i().prefetchQuery(
|
|
857
|
-
|
|
940
|
+
await i().prefetchQuery(D(e)), await i().prefetchQuery(Q()), await i().prefetchQuery(
|
|
941
|
+
S(e)
|
|
858
942
|
);
|
|
859
943
|
const t = i().getQueryData(
|
|
860
|
-
|
|
944
|
+
D(e).queryKey
|
|
861
945
|
), n = i().getQueryData(
|
|
862
|
-
|
|
946
|
+
Q().queryKey
|
|
863
947
|
), r = i().getQueryData(
|
|
864
|
-
|
|
948
|
+
S(e).queryKey
|
|
865
949
|
);
|
|
866
950
|
if (!t || !n)
|
|
867
951
|
return {
|
|
@@ -886,21 +970,21 @@ function De(e) {
|
|
|
886
970
|
function j(e) {
|
|
887
971
|
return e.toFixed(3);
|
|
888
972
|
}
|
|
889
|
-
function
|
|
973
|
+
function Re(e) {
|
|
890
974
|
return h({
|
|
891
975
|
queryKey: ["assets", "spk", "general-info", e],
|
|
892
976
|
staleTime: 6e4,
|
|
893
977
|
refetchInterval: 9e4,
|
|
894
978
|
queryFn: async () => {
|
|
895
|
-
await i().prefetchQuery(
|
|
896
|
-
|
|
979
|
+
await i().prefetchQuery(D(e)), await i().prefetchQuery(Q()), await i().prefetchQuery(
|
|
980
|
+
S(e)
|
|
897
981
|
);
|
|
898
982
|
const t = i().getQueryData(
|
|
899
|
-
|
|
983
|
+
D(e).queryKey
|
|
900
984
|
), n = i().getQueryData(
|
|
901
|
-
|
|
985
|
+
Q().queryKey
|
|
902
986
|
), r = i().getQueryData(
|
|
903
|
-
|
|
987
|
+
S(e).queryKey
|
|
904
988
|
);
|
|
905
989
|
if (!t || !n)
|
|
906
990
|
return {
|
|
@@ -912,7 +996,7 @@ function Ce(e) {
|
|
|
912
996
|
const s = +j(
|
|
913
997
|
(t.gov + t.spk) / 1e3 * +t.tick * ((r == null ? void 0 : r.price) ?? 0)
|
|
914
998
|
), a = +j(
|
|
915
|
-
(t.spk +
|
|
999
|
+
(t.spk + Oe(
|
|
916
1000
|
t,
|
|
917
1001
|
n.raw.stats || {
|
|
918
1002
|
spk_rate_lgov: "0.001",
|
|
@@ -937,22 +1021,22 @@ function Ce(e) {
|
|
|
937
1021
|
function F(e) {
|
|
938
1022
|
return e.toFixed(3);
|
|
939
1023
|
}
|
|
940
|
-
function
|
|
1024
|
+
function Ie(e) {
|
|
941
1025
|
return h({
|
|
942
1026
|
queryKey: ["assets", "larynx-power", "general-info", e],
|
|
943
1027
|
staleTime: 6e4,
|
|
944
1028
|
refetchInterval: 9e4,
|
|
945
1029
|
queryFn: async () => {
|
|
946
1030
|
var o, c;
|
|
947
|
-
await i().prefetchQuery(
|
|
948
|
-
|
|
1031
|
+
await i().prefetchQuery(D(e)), await i().prefetchQuery(Q()), await i().prefetchQuery(
|
|
1032
|
+
S(e)
|
|
949
1033
|
);
|
|
950
1034
|
const t = i().getQueryData(
|
|
951
|
-
|
|
1035
|
+
D(e).queryKey
|
|
952
1036
|
), n = i().getQueryData(
|
|
953
|
-
|
|
1037
|
+
Q().queryKey
|
|
954
1038
|
), r = i().getQueryData(
|
|
955
|
-
|
|
1039
|
+
S(e).queryKey
|
|
956
1040
|
);
|
|
957
1041
|
if (!t || !n)
|
|
958
1042
|
return {
|
|
@@ -1062,7 +1146,7 @@ function U(e) {
|
|
|
1062
1146
|
)).json()).result
|
|
1063
1147
|
});
|
|
1064
1148
|
}
|
|
1065
|
-
function
|
|
1149
|
+
function je() {
|
|
1066
1150
|
return h({
|
|
1067
1151
|
queryKey: ["assets", "hive-engine", "markets"],
|
|
1068
1152
|
staleTime: 6e4,
|
|
@@ -1086,7 +1170,7 @@ function Re() {
|
|
|
1086
1170
|
)).json()).result
|
|
1087
1171
|
});
|
|
1088
1172
|
}
|
|
1089
|
-
function
|
|
1173
|
+
function Fe(e, t) {
|
|
1090
1174
|
return h({
|
|
1091
1175
|
queryKey: ["assets", "hive-engine", t, "general-info", e],
|
|
1092
1176
|
enabled: !!t && !!e,
|
|
@@ -1097,7 +1181,7 @@ function Ie(e, t) {
|
|
|
1097
1181
|
throw new Error(
|
|
1098
1182
|
"[SDK][Wallets] – hive engine token or username missed"
|
|
1099
1183
|
);
|
|
1100
|
-
const n =
|
|
1184
|
+
const n = S(e);
|
|
1101
1185
|
await i().prefetchQuery(n);
|
|
1102
1186
|
const r = i().getQueryData(
|
|
1103
1187
|
n.queryKey
|
|
@@ -1105,9 +1189,9 @@ function Ie(e, t) {
|
|
|
1105
1189
|
await i().prefetchQuery(s);
|
|
1106
1190
|
const a = i().getQueryData(s.queryKey), o = U(e);
|
|
1107
1191
|
await i().prefetchQuery(o);
|
|
1108
|
-
const c = i().getQueryData(o.queryKey), l =
|
|
1192
|
+
const c = i().getQueryData(o.queryKey), l = je();
|
|
1109
1193
|
await i().prefetchQuery(l);
|
|
1110
|
-
const w = i().getQueryData(l.queryKey), _ = a == null ? void 0 : a.find((
|
|
1194
|
+
const w = i().getQueryData(l.queryKey), _ = a == null ? void 0 : a.find((O) => O.symbol === t), v = c == null ? void 0 : c.find((O) => O.symbol === t), P = w == null ? void 0 : w.find((O) => O.symbol === t), k = +((P == null ? void 0 : P.lastPrice) ?? "0");
|
|
1111
1195
|
return {
|
|
1112
1196
|
name: t,
|
|
1113
1197
|
title: (_ == null ? void 0 : _.name) ?? "",
|
|
@@ -1118,7 +1202,7 @@ function Ie(e, t) {
|
|
|
1118
1202
|
}
|
|
1119
1203
|
});
|
|
1120
1204
|
}
|
|
1121
|
-
function
|
|
1205
|
+
function Nt(e, t, n = 20) {
|
|
1122
1206
|
return R({
|
|
1123
1207
|
queryKey: ["assets", "hive-engine", t, "transactions", e],
|
|
1124
1208
|
enabled: !!t && !!e,
|
|
@@ -1139,7 +1223,7 @@ function St(e, t, n = 20) {
|
|
|
1139
1223
|
}
|
|
1140
1224
|
});
|
|
1141
1225
|
}
|
|
1142
|
-
function
|
|
1226
|
+
function Ht(e, t = "daily") {
|
|
1143
1227
|
return h({
|
|
1144
1228
|
queryKey: ["assets", "hive-engine", e],
|
|
1145
1229
|
staleTime: 6e4,
|
|
@@ -1154,7 +1238,7 @@ function Ot(e, t = "daily") {
|
|
|
1154
1238
|
}
|
|
1155
1239
|
});
|
|
1156
1240
|
}
|
|
1157
|
-
async function
|
|
1241
|
+
async function Le(e) {
|
|
1158
1242
|
const n = p(e.amount).amount.toString();
|
|
1159
1243
|
if (e.type === "key" && "key" in e) {
|
|
1160
1244
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1217,7 +1301,7 @@ async function je(e) {
|
|
|
1217
1301
|
}
|
|
1218
1302
|
);
|
|
1219
1303
|
}
|
|
1220
|
-
async function
|
|
1304
|
+
async function Be(e) {
|
|
1221
1305
|
const n = p(e.amount).amount.toString();
|
|
1222
1306
|
if (e.type === "key" && "key" in e) {
|
|
1223
1307
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1280,7 +1364,7 @@ async function Fe(e) {
|
|
|
1280
1364
|
}
|
|
1281
1365
|
);
|
|
1282
1366
|
}
|
|
1283
|
-
async function
|
|
1367
|
+
async function Me(e) {
|
|
1284
1368
|
const n = p(e.amount).amount.toString();
|
|
1285
1369
|
if (e.type === "key" && "key" in e) {
|
|
1286
1370
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1343,7 +1427,7 @@ async function Le(e) {
|
|
|
1343
1427
|
}
|
|
1344
1428
|
);
|
|
1345
1429
|
}
|
|
1346
|
-
async function
|
|
1430
|
+
async function $e(e) {
|
|
1347
1431
|
const n = p(e.amount).amount.toString();
|
|
1348
1432
|
if (e.type === "key" && "key" in e) {
|
|
1349
1433
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1406,7 +1490,7 @@ async function Be(e) {
|
|
|
1406
1490
|
}
|
|
1407
1491
|
);
|
|
1408
1492
|
}
|
|
1409
|
-
async function
|
|
1493
|
+
async function Je(e) {
|
|
1410
1494
|
const n = p(e.amount).amount.toString();
|
|
1411
1495
|
if (e.type === "key" && "key" in e) {
|
|
1412
1496
|
const { key: r, type: s, ...a } = e, o = {
|
|
@@ -1501,7 +1585,7 @@ function J(e) {
|
|
|
1501
1585
|
enabled: !!e
|
|
1502
1586
|
});
|
|
1503
1587
|
}
|
|
1504
|
-
function
|
|
1588
|
+
function xe(e) {
|
|
1505
1589
|
return h({
|
|
1506
1590
|
queryKey: ["assets", "points", "general-info", e],
|
|
1507
1591
|
staleTime: 6e4,
|
|
@@ -1520,7 +1604,7 @@ function Je(e) {
|
|
|
1520
1604
|
}
|
|
1521
1605
|
});
|
|
1522
1606
|
}
|
|
1523
|
-
function
|
|
1607
|
+
function Kt(e, t) {
|
|
1524
1608
|
return h({
|
|
1525
1609
|
queryKey: ["assets", "points", "transactions", e, t],
|
|
1526
1610
|
queryFn: async () => (await (await fetch(
|
|
@@ -1545,12 +1629,12 @@ function Tt(e, t) {
|
|
|
1545
1629
|
}))
|
|
1546
1630
|
});
|
|
1547
1631
|
}
|
|
1548
|
-
function
|
|
1632
|
+
function Qt(e, t, n) {
|
|
1549
1633
|
const { mutateAsync: r } = X.useRecordActivity(
|
|
1550
1634
|
e,
|
|
1551
1635
|
"points-claimed"
|
|
1552
1636
|
);
|
|
1553
|
-
return
|
|
1637
|
+
return H({
|
|
1554
1638
|
mutationFn: async () => {
|
|
1555
1639
|
if (!e)
|
|
1556
1640
|
throw new Error(
|
|
@@ -1561,7 +1645,7 @@ function At(e, t, n) {
|
|
|
1561
1645
|
headers: {
|
|
1562
1646
|
"Content-Type": "application/json"
|
|
1563
1647
|
},
|
|
1564
|
-
body: JSON.stringify({ code:
|
|
1648
|
+
body: JSON.stringify({ code: ue(e) })
|
|
1565
1649
|
});
|
|
1566
1650
|
},
|
|
1567
1651
|
onError: n,
|
|
@@ -1576,7 +1660,7 @@ function At(e, t, n) {
|
|
|
1576
1660
|
}
|
|
1577
1661
|
});
|
|
1578
1662
|
}
|
|
1579
|
-
async function
|
|
1663
|
+
async function Ue({
|
|
1580
1664
|
from: e,
|
|
1581
1665
|
to: t,
|
|
1582
1666
|
amount: n,
|
|
@@ -1602,15 +1686,15 @@ async function $e({
|
|
|
1602
1686
|
const { key: c } = a;
|
|
1603
1687
|
return y.hiveClient.broadcast.sendOperations([o], c);
|
|
1604
1688
|
}
|
|
1605
|
-
return s === "keychain" ?
|
|
1689
|
+
return s === "keychain" ? q.broadcast(e, [o], "Active") : d.sendOperation(
|
|
1606
1690
|
o,
|
|
1607
1691
|
{ callback: `https://ecency.com/@${e}/wallet` },
|
|
1608
1692
|
() => {
|
|
1609
1693
|
}
|
|
1610
1694
|
);
|
|
1611
1695
|
}
|
|
1612
|
-
var
|
|
1613
|
-
function
|
|
1696
|
+
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 || {});
|
|
1697
|
+
function Dt(e) {
|
|
1614
1698
|
return h({
|
|
1615
1699
|
queryKey: ["ecency-wallets", "all-tokens-list", e],
|
|
1616
1700
|
queryFn: async () => {
|
|
@@ -1634,13 +1718,13 @@ function Nt(e) {
|
|
|
1634
1718
|
}
|
|
1635
1719
|
});
|
|
1636
1720
|
}
|
|
1637
|
-
function
|
|
1721
|
+
function Ge(e) {
|
|
1638
1722
|
return h({
|
|
1639
1723
|
queryKey: ["ecency-wallets", "list", e],
|
|
1640
1724
|
enabled: !!e,
|
|
1641
1725
|
queryFn: async () => {
|
|
1642
1726
|
var r;
|
|
1643
|
-
const t =
|
|
1727
|
+
const t = b(e);
|
|
1644
1728
|
await i().fetchQuery({
|
|
1645
1729
|
queryKey: t.queryKey
|
|
1646
1730
|
});
|
|
@@ -1667,7 +1751,7 @@ function Ue(e) {
|
|
|
1667
1751
|
}
|
|
1668
1752
|
});
|
|
1669
1753
|
}
|
|
1670
|
-
function
|
|
1754
|
+
function We(e, t, n = { refetch: !1 }) {
|
|
1671
1755
|
const r = async (s) => (n.refetch ? await i().fetchQuery(s) : await i().prefetchQuery(s), i().getQueryData(
|
|
1672
1756
|
s.queryKey
|
|
1673
1757
|
));
|
|
@@ -1675,22 +1759,22 @@ function Ve(e, t, n = { refetch: !1 }) {
|
|
|
1675
1759
|
queryKey: ["ecency-wallets", "asset-info", e, t],
|
|
1676
1760
|
queryFn: async () => {
|
|
1677
1761
|
if (t === "HIVE")
|
|
1678
|
-
return r(
|
|
1762
|
+
return r(S(e));
|
|
1679
1763
|
if (t === "HP")
|
|
1680
|
-
return r(
|
|
1764
|
+
return r(ne(e));
|
|
1681
1765
|
if (t === "HBD")
|
|
1682
|
-
return r(
|
|
1766
|
+
return r(Te(e));
|
|
1683
1767
|
if (t === "SPK")
|
|
1684
|
-
return r(
|
|
1768
|
+
return r(Re(e));
|
|
1685
1769
|
if (t === "LARYNX")
|
|
1686
|
-
return r(De(e));
|
|
1687
|
-
if (t === "LP")
|
|
1688
1770
|
return r(Ee(e));
|
|
1771
|
+
if (t === "LP")
|
|
1772
|
+
return r(Ie(e));
|
|
1689
1773
|
if (t === "POINTS")
|
|
1690
|
-
return r(
|
|
1774
|
+
return r(xe(e));
|
|
1691
1775
|
if (B.includes(t))
|
|
1692
1776
|
return await r(
|
|
1693
|
-
|
|
1777
|
+
Fe(e, t)
|
|
1694
1778
|
);
|
|
1695
1779
|
throw new Error(
|
|
1696
1780
|
"[SDK][Wallets] – has requested unrecognized asset info"
|
|
@@ -1698,7 +1782,7 @@ function Ve(e, t, n = { refetch: !1 }) {
|
|
|
1698
1782
|
}
|
|
1699
1783
|
});
|
|
1700
1784
|
}
|
|
1701
|
-
function
|
|
1785
|
+
function Ct(e, t, n = !1) {
|
|
1702
1786
|
return h({
|
|
1703
1787
|
queryKey: ["wallets", "token-operations", e, t, n],
|
|
1704
1788
|
queryFn: async () => {
|
|
@@ -1752,41 +1836,18 @@ function Ht(e, t, n = !1) {
|
|
|
1752
1836
|
(s == null ? void 0 : s.map((k) => k.symbol)) ?? []
|
|
1753
1837
|
);
|
|
1754
1838
|
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),
|
|
1839
|
+
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
1840
|
return [
|
|
1757
1841
|
u.Transfer,
|
|
1758
1842
|
...w ? [u.Delegate] : [],
|
|
1759
1843
|
..._ ? [u.Undelegate] : [],
|
|
1760
1844
|
...v ? [u.Stake] : [],
|
|
1761
|
-
...
|
|
1845
|
+
...P ? [u.Unstake] : []
|
|
1762
1846
|
];
|
|
1763
1847
|
}
|
|
1764
1848
|
});
|
|
1765
1849
|
}
|
|
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 = {
|
|
1850
|
+
const Ye = {
|
|
1790
1851
|
[f.BTC]: "m/44'/0'/0'/0/0",
|
|
1791
1852
|
// Bitcoin (BIP44)
|
|
1792
1853
|
[f.ETH]: "m/44'/60'/0'/0/0",
|
|
@@ -1802,17 +1863,17 @@ const We = {
|
|
|
1802
1863
|
[f.ATOM]: "m/44'/118'/0'/0/0"
|
|
1803
1864
|
// Cosmos (BIP44)
|
|
1804
1865
|
};
|
|
1805
|
-
function
|
|
1806
|
-
const { data: n } = z(e), r =
|
|
1866
|
+
function Et(e, t) {
|
|
1867
|
+
const { data: n } = z(e), r = M(), s = H({
|
|
1807
1868
|
mutationKey: ["ecency-wallets", "create-wallet", e, t],
|
|
1808
1869
|
mutationFn: async () => {
|
|
1809
1870
|
if (!n)
|
|
1810
1871
|
throw new Error("[Ecency][Wallets] - No seed to create a wallet");
|
|
1811
|
-
const o =
|
|
1872
|
+
const o = ae(t), c = await (o == null ? void 0 : o.getDerivedPrivateKey({
|
|
1812
1873
|
mnemonic: n,
|
|
1813
|
-
hdPath:
|
|
1874
|
+
hdPath: Ye[t]
|
|
1814
1875
|
}));
|
|
1815
|
-
await
|
|
1876
|
+
await se(1e3);
|
|
1816
1877
|
const l = await (o == null ? void 0 : o.getNewAddress({
|
|
1817
1878
|
privateKey: c
|
|
1818
1879
|
}));
|
|
@@ -1833,18 +1894,18 @@ function Kt(e, t) {
|
|
|
1833
1894
|
)
|
|
1834
1895
|
);
|
|
1835
1896
|
}
|
|
1836
|
-
}), a =
|
|
1897
|
+
}), a = ve(() => {
|
|
1837
1898
|
}, []);
|
|
1838
1899
|
return {
|
|
1839
1900
|
createWallet: s,
|
|
1840
1901
|
importWallet: a
|
|
1841
1902
|
};
|
|
1842
1903
|
}
|
|
1843
|
-
function
|
|
1844
|
-
const { data: t } =
|
|
1904
|
+
function Xe(e) {
|
|
1905
|
+
const { data: t } = N({
|
|
1845
1906
|
queryKey: ["ecency-wallets", "wallets", e]
|
|
1846
|
-
}), { data: n } =
|
|
1847
|
-
return
|
|
1907
|
+
}), { data: n } = qe(e);
|
|
1908
|
+
return H({
|
|
1848
1909
|
mutationKey: ["ecency-wallets", "create-account-with-wallets", e],
|
|
1849
1910
|
mutationFn: ({ currency: r, address: s }) => fetch(y.privateApiHost + "/private-api/wallets-add", {
|
|
1850
1911
|
method: "POST",
|
|
@@ -1872,8 +1933,8 @@ function Ye(e) {
|
|
|
1872
1933
|
})
|
|
1873
1934
|
});
|
|
1874
1935
|
}
|
|
1875
|
-
function
|
|
1876
|
-
return
|
|
1936
|
+
function oe() {
|
|
1937
|
+
return H({
|
|
1877
1938
|
mutationKey: ["ecency-wallets", "check-wallet-existence"],
|
|
1878
1939
|
mutationFn: async ({ address: e, currency: t }) => (await (await fetch(
|
|
1879
1940
|
y.privateApiHost + "/private-api/wallets-exist",
|
|
@@ -1890,11 +1951,11 @@ function se() {
|
|
|
1890
1951
|
)).json()).length === 0
|
|
1891
1952
|
});
|
|
1892
1953
|
}
|
|
1893
|
-
const
|
|
1954
|
+
const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1894
1955
|
__proto__: null,
|
|
1895
|
-
useCheckWalletExistence:
|
|
1896
|
-
useCreateAccountWithWallets:
|
|
1897
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1956
|
+
useCheckWalletExistence: oe,
|
|
1957
|
+
useCreateAccountWithWallets: Xe
|
|
1958
|
+
}, Symbol.toStringTag, { value: "Module" })), ze = {
|
|
1898
1959
|
[f.BTC]: ["m/84'/0'/0'/0/0"],
|
|
1899
1960
|
[f.ETH]: ["m/84'/60'/0'/0/0"],
|
|
1900
1961
|
// its not working for Trust, Exodus, todo: check others below
|
|
@@ -1905,8 +1966,8 @@ const Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1905
1966
|
// Disabled
|
|
1906
1967
|
[f.ATOM]: ["m/84'/118'/0'/0'/0"]
|
|
1907
1968
|
};
|
|
1908
|
-
async function
|
|
1909
|
-
for (const r of
|
|
1969
|
+
async function Ze(e, t, n) {
|
|
1970
|
+
for (const r of ze[n] || [])
|
|
1910
1971
|
try {
|
|
1911
1972
|
const s = await t.getDerivedPrivateKey({
|
|
1912
1973
|
mnemonic: e,
|
|
@@ -1921,17 +1982,17 @@ async function ze(e, t, n) {
|
|
|
1921
1982
|
}
|
|
1922
1983
|
return [];
|
|
1923
1984
|
}
|
|
1924
|
-
function
|
|
1925
|
-
const n =
|
|
1926
|
-
return
|
|
1985
|
+
function It(e, t) {
|
|
1986
|
+
const n = M(), { mutateAsync: r } = oe();
|
|
1987
|
+
return H({
|
|
1927
1988
|
mutationKey: ["ecency-wallets", "import-wallet", e, t],
|
|
1928
1989
|
mutationFn: async ({ privateKeyOrSeed: s }) => {
|
|
1929
|
-
const a =
|
|
1990
|
+
const a = ae(t);
|
|
1930
1991
|
if (!a)
|
|
1931
1992
|
throw new Error("Cannot find token for this currency");
|
|
1932
1993
|
const o = s.split(" ").length === 12;
|
|
1933
1994
|
let c, l = s;
|
|
1934
|
-
if (o ? [l, c] = await
|
|
1995
|
+
if (o ? [l, c] = await Ze(
|
|
1935
1996
|
s,
|
|
1936
1997
|
a,
|
|
1937
1998
|
t
|
|
@@ -1978,9 +2039,9 @@ function Y(e, t = !1) {
|
|
|
1978
2039
|
A.groupByProp("symbol")
|
|
1979
2040
|
) : {};
|
|
1980
2041
|
}
|
|
1981
|
-
function
|
|
1982
|
-
const t =
|
|
1983
|
-
return
|
|
2042
|
+
function jt(e) {
|
|
2043
|
+
const t = M(), { data: n } = N(b(e)), { mutateAsync: r } = le(e);
|
|
2044
|
+
return H({
|
|
1984
2045
|
mutationKey: ["ecency-wallets", "save-wallet-to-metadata", n],
|
|
1985
2046
|
mutationFn: async (s) => {
|
|
1986
2047
|
var _;
|
|
@@ -1988,9 +2049,9 @@ function Ct(e) {
|
|
|
1988
2049
|
throw new Error("[SDK][Wallets] – no account data to save wallets");
|
|
1989
2050
|
const a = Y(
|
|
1990
2051
|
(_ = n.profile) == null ? void 0 : _.tokens
|
|
1991
|
-
), o = s.map(({ currency: v, type:
|
|
2052
|
+
), o = s.map(({ currency: v, type: P, ...k }) => ({
|
|
1992
2053
|
symbol: v,
|
|
1993
|
-
type:
|
|
2054
|
+
type: P,
|
|
1994
2055
|
meta: k
|
|
1995
2056
|
})) ?? [], c = Y(o, !0), l = o.filter(
|
|
1996
2057
|
({ type: v }) => v !== "CHAIN"
|
|
@@ -2007,51 +2068,51 @@ function Ct(e) {
|
|
|
2007
2068
|
});
|
|
2008
2069
|
},
|
|
2009
2070
|
onSuccess: () => t.invalidateQueries({
|
|
2010
|
-
queryKey:
|
|
2071
|
+
queryKey: Ge(e).queryKey
|
|
2011
2072
|
})
|
|
2012
2073
|
});
|
|
2013
2074
|
}
|
|
2014
|
-
const
|
|
2075
|
+
const et = {
|
|
2015
2076
|
HIVE: {
|
|
2016
2077
|
[u.Transfer]: V,
|
|
2017
2078
|
[u.TransferToSavings]: G,
|
|
2018
|
-
[u.PowerUp]:
|
|
2079
|
+
[u.PowerUp]: Ae
|
|
2019
2080
|
},
|
|
2020
2081
|
HBD: {
|
|
2021
2082
|
[u.Transfer]: V,
|
|
2022
2083
|
[u.TransferToSavings]: G
|
|
2023
2084
|
},
|
|
2024
2085
|
HP: {
|
|
2025
|
-
[u.PowerDown]:
|
|
2026
|
-
[u.Delegate]:
|
|
2027
|
-
[u.WithdrawRoutes]:
|
|
2086
|
+
[u.PowerDown]: He,
|
|
2087
|
+
[u.Delegate]: Ne,
|
|
2088
|
+
[u.WithdrawRoutes]: Ke
|
|
2028
2089
|
},
|
|
2029
2090
|
POINTS: {
|
|
2030
|
-
[u.Gift]:
|
|
2091
|
+
[u.Gift]: Ue
|
|
2031
2092
|
},
|
|
2032
2093
|
SPK: {
|
|
2033
|
-
[u.Transfer]:
|
|
2094
|
+
[u.Transfer]: Qe
|
|
2034
2095
|
},
|
|
2035
2096
|
LARYNX: {
|
|
2036
|
-
[u.LockLiquidity]:
|
|
2037
|
-
[u.PowerUp]:
|
|
2097
|
+
[u.LockLiquidity]: De,
|
|
2098
|
+
[u.PowerUp]: Ce
|
|
2038
2099
|
}
|
|
2039
|
-
},
|
|
2040
|
-
[u.Transfer]:
|
|
2041
|
-
[u.Stake]:
|
|
2042
|
-
[u.Unstake]:
|
|
2043
|
-
[u.Delegate]:
|
|
2044
|
-
[u.Undelegate]:
|
|
2100
|
+
}, tt = {
|
|
2101
|
+
[u.Transfer]: Je,
|
|
2102
|
+
[u.Stake]: Me,
|
|
2103
|
+
[u.Unstake]: $e,
|
|
2104
|
+
[u.Delegate]: Le,
|
|
2105
|
+
[u.Undelegate]: Be
|
|
2045
2106
|
};
|
|
2046
|
-
function
|
|
2107
|
+
function Ft(e, t, n) {
|
|
2047
2108
|
const { mutateAsync: r } = X.useRecordActivity(
|
|
2048
2109
|
e,
|
|
2049
2110
|
n
|
|
2050
2111
|
);
|
|
2051
|
-
return
|
|
2112
|
+
return H({
|
|
2052
2113
|
mutationKey: ["ecency-wallets", t, n],
|
|
2053
2114
|
mutationFn: async (s) => {
|
|
2054
|
-
const a =
|
|
2115
|
+
const a = et[t][n];
|
|
2055
2116
|
if (a)
|
|
2056
2117
|
return a(s);
|
|
2057
2118
|
const o = U(e);
|
|
@@ -2060,7 +2121,7 @@ function Et(e, t, n) {
|
|
|
2060
2121
|
o.queryKey
|
|
2061
2122
|
);
|
|
2062
2123
|
if (c != null && c.some((l) => l.symbol === t)) {
|
|
2063
|
-
const l =
|
|
2124
|
+
const l = tt[n];
|
|
2064
2125
|
if (l)
|
|
2065
2126
|
return l({ ...s, asset: t });
|
|
2066
2127
|
}
|
|
@@ -2068,7 +2129,7 @@ function Et(e, t, n) {
|
|
|
2068
2129
|
},
|
|
2069
2130
|
onSuccess: () => {
|
|
2070
2131
|
r();
|
|
2071
|
-
const s =
|
|
2132
|
+
const s = We(e, t, {
|
|
2072
2133
|
refetch: !0
|
|
2073
2134
|
});
|
|
2074
2135
|
setTimeout(
|
|
@@ -2084,61 +2145,64 @@ export {
|
|
|
2084
2145
|
u as AssetOperation,
|
|
2085
2146
|
g as EcencyWalletBasicTokens,
|
|
2086
2147
|
f as EcencyWalletCurrency,
|
|
2087
|
-
|
|
2148
|
+
Rt as EcencyWalletsPrivateApi,
|
|
2088
2149
|
te as NaiMap,
|
|
2089
|
-
|
|
2150
|
+
Ve as PointTransactionType,
|
|
2090
2151
|
ee as Symbol,
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2152
|
+
Le as delegateEngineToken,
|
|
2153
|
+
Ne as delegateHive,
|
|
2154
|
+
We as getAccountWalletAssetInfoQueryOptions,
|
|
2155
|
+
Ge as getAccountWalletListQueryOptions,
|
|
2156
|
+
Dt as getAllTokensListQueryOptions,
|
|
2157
|
+
Te as getHbdAssetGeneralInfoQueryOptions,
|
|
2158
|
+
Pt as getHbdAssetTransactionsQueryOptions,
|
|
2159
|
+
S as getHiveAssetGeneralInfoQueryOptions,
|
|
2160
|
+
qt as getHiveAssetMetricQueryOptions,
|
|
2161
|
+
re as getHiveAssetTransactionsQueryOptions,
|
|
2162
|
+
Ot as getHiveAssetWithdrawalRoutesQueryOptions,
|
|
2163
|
+
Fe as getHiveEngineTokenGeneralInfoQueryOptions,
|
|
2164
|
+
Nt as getHiveEngineTokenTransactionsQueryOptions,
|
|
2104
2165
|
U as getHiveEngineTokensBalancesQueryOptions,
|
|
2105
|
-
|
|
2166
|
+
je as getHiveEngineTokensMarketQueryOptions,
|
|
2106
2167
|
L as getHiveEngineTokensMetadataQueryOptions,
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2168
|
+
Ht as getHiveEngineTokensMetricsQueryOptions,
|
|
2169
|
+
ne as getHivePowerAssetGeneralInfoQueryOptions,
|
|
2170
|
+
bt as getHivePowerAssetTransactionsQueryOptions,
|
|
2171
|
+
St as getHivePowerDelegatesInfiniteQueryOptions,
|
|
2172
|
+
Tt as getHivePowerDelegatingsQueryOptions,
|
|
2173
|
+
Ee as getLarynxAssetGeneralInfoQueryOptions,
|
|
2174
|
+
Ie as getLarynxPowerAssetGeneralInfoQueryOptions,
|
|
2175
|
+
xe as getPointsAssetGeneralInfoQueryOptions,
|
|
2176
|
+
Kt as getPointsAssetTransactionsQueryOptions,
|
|
2114
2177
|
J as getPointsQueryOptions,
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2178
|
+
Re as getSpkAssetGeneralInfoQueryOptions,
|
|
2179
|
+
Q as getSpkMarketsQueryOptions,
|
|
2180
|
+
Ct as getTokenOperationsQueryOptions,
|
|
2181
|
+
kt as isEmptyDate,
|
|
2182
|
+
De as lockLarynx,
|
|
2120
2183
|
p as parseAsset,
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2184
|
+
He as powerDownHive,
|
|
2185
|
+
Ae as powerUpHive,
|
|
2186
|
+
Ce as powerUpLarynx,
|
|
2187
|
+
Oe as rewardSpk,
|
|
2188
|
+
Me as stakeEngineToken,
|
|
2189
|
+
Je as transferEngineToken,
|
|
2127
2190
|
V as transferHive,
|
|
2128
|
-
|
|
2129
|
-
|
|
2191
|
+
Ue as transferPoint,
|
|
2192
|
+
Qe as transferSpk,
|
|
2130
2193
|
G as transferToSavingsHive,
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2194
|
+
Be as undelegateEngineToken,
|
|
2195
|
+
$e as unstakeEngineToken,
|
|
2196
|
+
Qt as useClaimPoints,
|
|
2197
|
+
At as useClaimRewards,
|
|
2198
|
+
vt as useCoinGeckoPriceQuery,
|
|
2199
|
+
_t as useGetExternalWalletBalanceQuery,
|
|
2200
|
+
qe as useHiveKeysQuery,
|
|
2201
|
+
It as useImportWallet,
|
|
2202
|
+
jt as useSaveWalletInformationToMetadata,
|
|
2139
2203
|
z as useSeedPhrase,
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2204
|
+
Et as useWalletCreate,
|
|
2205
|
+
Ft as useWalletOperation,
|
|
2206
|
+
$ as vestsToHp,
|
|
2207
|
+
Ke as withdrawVestingRouteHive
|
|
2144
2208
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useClaimRewards(username: string, onSuccess: () => void): import('@tanstack/react-query').UseMutationResult<unknown, Error, unknown, unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DelegatedVestingShare } from '../types';
|
|
2
|
+
export declare function getHivePowerDelegatesInfiniteQueryOptions(username: string, limit?: number): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<DelegatedVestingShare[], Error, DelegatedVestingShare[], string[]>, "queryFn"> & {
|
|
3
|
+
queryFn?: import('@tanstack/query-core').QueryFunction<DelegatedVestingShare[], string[], never> | undefined;
|
|
4
|
+
} & {
|
|
5
|
+
queryKey: string[] & {
|
|
6
|
+
[dataTagSymbol]: DelegatedVestingShare[];
|
|
7
|
+
[dataTagErrorSymbol]: Error;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReceivedVestingShare } from '../types';
|
|
2
|
+
export declare function getHivePowerDelegatingsQueryOptions(username: string): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<ReceivedVestingShare[], Error, ReceivedVestingShare[], string[]>, "queryFn"> & {
|
|
3
|
+
queryFn?: import('@tanstack/query-core').QueryFunction<ReceivedVestingShare[], string[], never> | undefined;
|
|
4
|
+
} & {
|
|
5
|
+
queryKey: string[] & {
|
|
6
|
+
[dataTagSymbol]: ReceivedVestingShare[];
|
|
7
|
+
[dataTagErrorSymbol]: Error;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -6,3 +6,5 @@ export * from './get-hive-power-asset-transactions-query-options';
|
|
|
6
6
|
export * from './get-hbd-asset-transactions-query-options';
|
|
7
7
|
export * from './get-hive-asset-metric-query-options';
|
|
8
8
|
export * from './get-hive-asset-withdrawal-routes-query-options.ts';
|
|
9
|
+
export * from './get-hive-power-delegates-query-options.ts';
|
|
10
|
+
export * from './get-hive-power-delegatings-query-options.ts';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './hive-operation-group';
|
|
2
2
|
export * from './hive-transaction';
|
|
3
3
|
export * from './hive-market-metric';
|
|
4
|
-
export * from './hive-withdraw-route
|
|
4
|
+
export * from './hive-withdraw-route';
|
|
5
|
+
export * from './delegated-vesting-share';
|
|
6
|
+
export * from './received-vesting-share';
|