@ecency/wallets 1.3.0 → 1.3.2
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 +421 -398
- package/dist/modules/wallets/mutations/index.d.ts +0 -1
- package/dist/modules/wallets/mutations/private-api/create-account-with-wallets.d.ts +1 -2
- package/dist/modules/wallets/mutations/save-wallet-information-to-metadata.d.ts +8 -5
- package/dist/modules/wallets/mutations/use-import-wallet.d.ts +5 -0
- package/dist/modules/wallets/mutations/use-wallet-create.d.ts +7 -2
- package/dist/modules/wallets/queries/get-all-tokens-list-query-options.d.ts +9 -5
- package/dist/modules/wallets/queries/use-get-account-wallet-list-query.d.ts +3 -3
- package/dist/modules/wallets/types/ecency-create-wallet-information.d.ts +11 -7
- package/package.json +6 -5
- package/dist/modules/wallets/mutations/change-assets-list.d.ts +0 -1
package/dist/ecency-sdk.es.js
CHANGED
|
@@ -1,59 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useQuery as D, queryOptions as h, infiniteQueryOptions as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { SolWallet as le } from "@okxweb3/coin-solana";
|
|
8
|
-
import { AtomWallet as fe } from "@okxweb3/coin-cosmos";
|
|
9
|
-
import { AptosWallet as me } from "@okxweb3/coin-aptos";
|
|
10
|
-
import ye from "bip39";
|
|
11
|
-
import { CONFIG as l, getQueryClient as i, getDynamicPropsQueryOptions as N, getAccountFullQueryOptions as T, Keychain as b, EcencyAnalytics as X, getAccessToken as pe, useAccountUpdate as he } from "@ecency/sdk";
|
|
12
|
-
import { LRUCache as ge } from "lru-cache";
|
|
13
|
-
import { PrivateKey as R, utils as A } from "@hiveio/dhive";
|
|
14
|
-
import { addSeconds as L, formatISO as x } from "date-fns";
|
|
1
|
+
import { CONFIG as y, getQueryClient as i, getDynamicPropsQueryOptions as H, getAccountFullQueryOptions as S, Keychain as P, EcencyAnalytics as X, getAccessToken as oe, useAccountUpdate as ie } from "@ecency/sdk";
|
|
2
|
+
import { useQuery as D, queryOptions as h, infiniteQueryOptions as R, useMutation as N, useQueryClient as $ } from "@tanstack/react-query";
|
|
3
|
+
import ce from "bip39";
|
|
4
|
+
import { LRUCache as ue } from "lru-cache";
|
|
5
|
+
import { PrivateKey as I, utils as T } from "@hiveio/dhive";
|
|
6
|
+
import C from "dayjs";
|
|
15
7
|
import d from "hivesigner";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return new ce();
|
|
28
|
-
case m.TON:
|
|
29
|
-
return new ue();
|
|
30
|
-
case m.SOL:
|
|
31
|
-
return new le();
|
|
32
|
-
case m.ATOM:
|
|
33
|
-
return new fe();
|
|
34
|
-
case m.APT:
|
|
35
|
-
return new me();
|
|
36
|
-
default:
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function wt(e, t) {
|
|
8
|
+
import { BtcWallet as le } from "@okxweb3/coin-bitcoin";
|
|
9
|
+
import { EthWallet as fe } from "@okxweb3/coin-ethereum";
|
|
10
|
+
import { TrxWallet as ye } from "@okxweb3/coin-tron";
|
|
11
|
+
import { TonWallet as me } from "@okxweb3/coin-ton";
|
|
12
|
+
import { SolWallet as pe } from "@okxweb3/coin-solana";
|
|
13
|
+
import { AtomWallet as he } from "@okxweb3/coin-cosmos";
|
|
14
|
+
import { AptosWallet as ge } from "@okxweb3/coin-aptos";
|
|
15
|
+
import { useCallback as we } from "react";
|
|
16
|
+
import * as A from "remeda";
|
|
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 dt(e, t) {
|
|
41
19
|
return D({
|
|
42
20
|
queryKey: ["ecency-wallets", "external-wallet-balance", e, t],
|
|
43
21
|
queryFn: async () => {
|
|
44
22
|
switch (e) {
|
|
45
|
-
case
|
|
23
|
+
case f.BTC:
|
|
46
24
|
const r = await (await fetch(
|
|
47
25
|
`https://mempool.space/api/address/${t}`
|
|
48
26
|
)).json();
|
|
49
27
|
return (r.chain_stats.funded_txo_sum - r.chain_stats.spent_txo_sum) / 1e8;
|
|
50
|
-
case
|
|
28
|
+
case f.ETH:
|
|
51
29
|
return +(await (await fetch(
|
|
52
30
|
`https://api.ethplorer.io/getAddressInfo/${t}?apiKey=freekey`
|
|
53
31
|
)).json()).ETH.balance;
|
|
54
|
-
case
|
|
32
|
+
case f.SOL:
|
|
55
33
|
return (await (await fetch(
|
|
56
|
-
`https://rpc.helius.xyz/?api-key=${
|
|
34
|
+
`https://rpc.helius.xyz/?api-key=${y.heliusApiKey}`,
|
|
57
35
|
{
|
|
58
36
|
method: "POST",
|
|
59
37
|
body: JSON.stringify({
|
|
@@ -67,22 +45,22 @@ function wt(e, t) {
|
|
|
67
45
|
}
|
|
68
46
|
}
|
|
69
47
|
)).json()).result.value / 1e9;
|
|
70
|
-
case
|
|
48
|
+
case f.TRON:
|
|
71
49
|
return (await (await fetch(
|
|
72
50
|
`https://api.trongrid.io/v1/accounts/${t}`
|
|
73
51
|
)).json()).data[0].balance / 1e6;
|
|
74
|
-
case
|
|
52
|
+
case f.TON:
|
|
75
53
|
return (await (await fetch(
|
|
76
54
|
`https://tonapi.io/v1/blockchain/getAccount?account=${t}`
|
|
77
55
|
)).json()).balance / 1e9;
|
|
78
|
-
case
|
|
79
|
-
const
|
|
56
|
+
case f.APT:
|
|
57
|
+
const q = (await (await fetch(
|
|
80
58
|
`https://fullnode.mainnet.aptoslabs.com/v1/accounts/${t}/resources`
|
|
81
59
|
)).json()).find(
|
|
82
|
-
(
|
|
60
|
+
(ae) => ae.type.includes("coin::CoinStore")
|
|
83
61
|
);
|
|
84
|
-
return
|
|
85
|
-
case
|
|
62
|
+
return q ? parseInt(q.data.coin.value) / 1e8 : 0;
|
|
63
|
+
case f.ATOM:
|
|
86
64
|
return +(await (await fetch(
|
|
87
65
|
`https://rest.cosmos.directory/cosmoshub/auth/accounts/${t}`
|
|
88
66
|
)).json()).result.value.coins[0].amount / 1e6;
|
|
@@ -93,7 +71,7 @@ function wt(e, t) {
|
|
|
93
71
|
function z(e) {
|
|
94
72
|
return D({
|
|
95
73
|
queryKey: ["ecency-wallets", "seed", e],
|
|
96
|
-
queryFn: async () =>
|
|
74
|
+
queryFn: async () => ce.generateMnemonic(128)
|
|
97
75
|
});
|
|
98
76
|
}
|
|
99
77
|
const de = {
|
|
@@ -104,26 +82,26 @@ const de = {
|
|
|
104
82
|
allowStale: !1,
|
|
105
83
|
updateAgeOnGet: !1,
|
|
106
84
|
updateAgeOnHas: !1
|
|
107
|
-
}, Z = new
|
|
85
|
+
}, Z = new ue(de), x = Symbol("undefined"), _e = (e, t) => Z.set(e, t === void 0 ? x : t), ve = (e) => {
|
|
108
86
|
const t = Z.get(e);
|
|
109
|
-
return t ===
|
|
87
|
+
return t === x ? void 0 : t;
|
|
110
88
|
};
|
|
111
|
-
function
|
|
89
|
+
function _t(e) {
|
|
112
90
|
return D({
|
|
113
91
|
queryKey: ["ecency-wallets", "coingecko-price", e],
|
|
114
92
|
queryFn: async () => {
|
|
115
93
|
let t = e;
|
|
116
94
|
switch (e) {
|
|
117
|
-
case
|
|
95
|
+
case f.BTC:
|
|
118
96
|
t = "binance-wrapped-btc";
|
|
119
97
|
break;
|
|
120
|
-
case
|
|
98
|
+
case f.ETH:
|
|
121
99
|
t = "ethereum";
|
|
122
100
|
break;
|
|
123
|
-
case
|
|
101
|
+
case f.SOL:
|
|
124
102
|
t = "solana";
|
|
125
103
|
break;
|
|
126
|
-
case
|
|
104
|
+
case f.TON:
|
|
127
105
|
t = "trx";
|
|
128
106
|
break;
|
|
129
107
|
default:
|
|
@@ -145,7 +123,7 @@ function dt(e) {
|
|
|
145
123
|
})
|
|
146
124
|
}
|
|
147
125
|
)).json();
|
|
148
|
-
_e("gecko", o === void 0 ?
|
|
126
|
+
_e("gecko", o === void 0 ? x : o), r = o;
|
|
149
127
|
}
|
|
150
128
|
return 1 / +r[Object.keys(r)[0]].usd;
|
|
151
129
|
},
|
|
@@ -160,7 +138,7 @@ function ke(e) {
|
|
|
160
138
|
queryFn: async () => {
|
|
161
139
|
if (!t)
|
|
162
140
|
throw new Error("[Ecency][Wallets] - no seed to create Hive account");
|
|
163
|
-
const n =
|
|
141
|
+
const n = I.fromLogin(e, t, "owner"), r = I.fromLogin(e, t, "active"), s = I.fromLogin(e, t, "posting"), a = I.fromLogin(e, t, "memo");
|
|
164
142
|
return {
|
|
165
143
|
username: e,
|
|
166
144
|
owner: n.toString(),
|
|
@@ -191,10 +169,10 @@ function p(e) {
|
|
|
191
169
|
symbol: te[e.nai]
|
|
192
170
|
};
|
|
193
171
|
}
|
|
194
|
-
function
|
|
172
|
+
function vt(e) {
|
|
195
173
|
return e === void 0 ? !0 : parseInt(e.split("-")[0], 10) < 1980;
|
|
196
174
|
}
|
|
197
|
-
function
|
|
175
|
+
function M(e, t) {
|
|
198
176
|
return e / 1e6 * t;
|
|
199
177
|
}
|
|
200
178
|
function be(e, t) {
|
|
@@ -208,27 +186,27 @@ function be(e, t) {
|
|
|
208
186
|
a,
|
|
209
187
|
t.spk_rate_ldel
|
|
210
188
|
);
|
|
211
|
-
const
|
|
212
|
-
return
|
|
189
|
+
const l = n + r + s;
|
|
190
|
+
return l || 0;
|
|
213
191
|
}
|
|
214
192
|
} else return 0;
|
|
215
|
-
function c(
|
|
216
|
-
return (
|
|
193
|
+
function c(l, w, _) {
|
|
194
|
+
return (l * (1 + _ / 365) - l) * w;
|
|
217
195
|
}
|
|
218
196
|
}
|
|
219
|
-
function
|
|
197
|
+
function O(e) {
|
|
220
198
|
return h({
|
|
221
199
|
queryKey: ["assets", "hive", "general-info", e],
|
|
222
200
|
staleTime: 6e4,
|
|
223
201
|
refetchInterval: 9e4,
|
|
224
202
|
queryFn: async () => {
|
|
225
|
-
await i().prefetchQuery(
|
|
226
|
-
|
|
203
|
+
await i().prefetchQuery(H()), await i().prefetchQuery(
|
|
204
|
+
S(e)
|
|
227
205
|
);
|
|
228
206
|
const t = i().getQueryData(
|
|
229
|
-
|
|
207
|
+
H().queryKey
|
|
230
208
|
), n = i().getQueryData(
|
|
231
|
-
|
|
209
|
+
S(e).queryKey
|
|
232
210
|
);
|
|
233
211
|
return {
|
|
234
212
|
name: "HIVE",
|
|
@@ -240,10 +218,10 @@ function q(e) {
|
|
|
240
218
|
});
|
|
241
219
|
}
|
|
242
220
|
function Pe(e) {
|
|
243
|
-
let
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
return (_ *
|
|
221
|
+
let l = 9.5 - (e.headBlock - 7e6) / 25e4 * 0.01;
|
|
222
|
+
l < 0.95 && (l = 0.95);
|
|
223
|
+
const w = e.vestingRewardPercent / 1e4, _ = e.virtualSupply, v = e.totalVestingFund;
|
|
224
|
+
return (_ * l * w / v).toFixed(3);
|
|
247
225
|
}
|
|
248
226
|
function qe(e) {
|
|
249
227
|
return h({
|
|
@@ -251,13 +229,13 @@ function qe(e) {
|
|
|
251
229
|
staleTime: 6e4,
|
|
252
230
|
refetchInterval: 9e4,
|
|
253
231
|
queryFn: async () => {
|
|
254
|
-
await i().prefetchQuery(
|
|
255
|
-
|
|
232
|
+
await i().prefetchQuery(H()), await i().prefetchQuery(
|
|
233
|
+
S(e)
|
|
256
234
|
);
|
|
257
235
|
const t = i().getQueryData(
|
|
258
|
-
|
|
236
|
+
H().queryKey
|
|
259
237
|
), n = i().getQueryData(
|
|
260
|
-
|
|
238
|
+
S(e).queryKey
|
|
261
239
|
);
|
|
262
240
|
return !t || !n ? {
|
|
263
241
|
name: "HP",
|
|
@@ -268,7 +246,7 @@ function qe(e) {
|
|
|
268
246
|
name: "HP",
|
|
269
247
|
title: "Hive Power",
|
|
270
248
|
price: t ? t.base / t.quote : 0,
|
|
271
|
-
accountBalance: +
|
|
249
|
+
accountBalance: +M(
|
|
272
250
|
p(n.vesting_shares).amount,
|
|
273
251
|
// parseAsset(accountData.delegated_vesting_shares).amount +
|
|
274
252
|
// parseAsset(accountData.received_vesting_shares).amount -
|
|
@@ -279,14 +257,14 @@ function qe(e) {
|
|
|
279
257
|
parts: [
|
|
280
258
|
{
|
|
281
259
|
name: "delegating",
|
|
282
|
-
balance: +
|
|
260
|
+
balance: +M(
|
|
283
261
|
p(n.delegated_vesting_shares).amount,
|
|
284
262
|
t.hivePerMVests
|
|
285
263
|
).toFixed(3)
|
|
286
264
|
},
|
|
287
265
|
{
|
|
288
266
|
name: "received",
|
|
289
|
-
balance: +
|
|
267
|
+
balance: +M(
|
|
290
268
|
p(n.received_vesting_shares).amount,
|
|
291
269
|
t.hivePerMVests
|
|
292
270
|
).toFixed(3)
|
|
@@ -302,13 +280,13 @@ function Se(e) {
|
|
|
302
280
|
staleTime: 6e4,
|
|
303
281
|
refetchInterval: 9e4,
|
|
304
282
|
queryFn: async () => {
|
|
305
|
-
await i().prefetchQuery(
|
|
306
|
-
|
|
283
|
+
await i().prefetchQuery(H()), await i().prefetchQuery(
|
|
284
|
+
S(e)
|
|
307
285
|
);
|
|
308
286
|
const t = i().getQueryData(
|
|
309
|
-
|
|
287
|
+
S(e).queryKey
|
|
310
288
|
), n = i().getQueryData(
|
|
311
|
-
|
|
289
|
+
H().queryKey
|
|
312
290
|
);
|
|
313
291
|
return t ? {
|
|
314
292
|
name: "HBD",
|
|
@@ -335,48 +313,48 @@ function Se(e) {
|
|
|
335
313
|
}
|
|
336
314
|
});
|
|
337
315
|
}
|
|
338
|
-
const
|
|
316
|
+
const m = T.operationOrders, E = {
|
|
339
317
|
transfers: [
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
318
|
+
m.transfer,
|
|
319
|
+
m.transfer_to_savings,
|
|
320
|
+
m.transfer_from_savings,
|
|
321
|
+
m.cancel_transfer_from_savings,
|
|
322
|
+
m.recurrent_transfer,
|
|
323
|
+
m.fill_recurrent_transfer,
|
|
324
|
+
m.escrow_transfer,
|
|
325
|
+
m.fill_recurrent_transfer
|
|
348
326
|
],
|
|
349
327
|
"market-orders": [
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
328
|
+
m.fill_convert_request,
|
|
329
|
+
m.fill_order,
|
|
330
|
+
m.fill_collateralized_convert_request,
|
|
331
|
+
m.limit_order_create2,
|
|
332
|
+
m.limit_order_create,
|
|
333
|
+
m.limit_order_cancel
|
|
356
334
|
],
|
|
357
|
-
interests: [
|
|
335
|
+
interests: [m.interest],
|
|
358
336
|
"stake-operations": [
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
337
|
+
m.return_vesting_delegation,
|
|
338
|
+
m.withdraw_vesting,
|
|
339
|
+
m.transfer_to_vesting,
|
|
340
|
+
m.set_withdraw_vesting_route,
|
|
341
|
+
m.update_proposal_votes,
|
|
342
|
+
m.fill_vesting_withdraw,
|
|
343
|
+
m.account_witness_proxy,
|
|
344
|
+
m.delegate_vesting_shares
|
|
367
345
|
],
|
|
368
346
|
rewards: [
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
347
|
+
m.author_reward,
|
|
348
|
+
m.curation_reward,
|
|
349
|
+
m.producer_reward,
|
|
350
|
+
m.claim_reward_balance,
|
|
351
|
+
m.comment_benefactor_reward,
|
|
352
|
+
m.liquidity_reward,
|
|
353
|
+
m.proposal_pay
|
|
376
354
|
]
|
|
377
355
|
};
|
|
378
356
|
function ne(e, t = 20, n) {
|
|
379
|
-
return
|
|
357
|
+
return R({
|
|
380
358
|
queryKey: ["assets", "hive", "transactions", e, t, n],
|
|
381
359
|
initialData: { pages: [], pageParams: [] },
|
|
382
360
|
initialPageParam: -1,
|
|
@@ -388,34 +366,34 @@ function ne(e, t = 20, n) {
|
|
|
388
366
|
let s = [];
|
|
389
367
|
switch (n) {
|
|
390
368
|
case "transfers":
|
|
391
|
-
s =
|
|
392
|
-
|
|
369
|
+
s = T.makeBitMaskFilter(
|
|
370
|
+
E.transfers
|
|
393
371
|
);
|
|
394
372
|
break;
|
|
395
373
|
case "market-orders":
|
|
396
|
-
s =
|
|
397
|
-
|
|
374
|
+
s = T.makeBitMaskFilter(
|
|
375
|
+
E["market-orders"]
|
|
398
376
|
);
|
|
399
377
|
break;
|
|
400
378
|
case "interests":
|
|
401
|
-
s =
|
|
402
|
-
|
|
379
|
+
s = T.makeBitMaskFilter(
|
|
380
|
+
E.interests
|
|
403
381
|
);
|
|
404
382
|
break;
|
|
405
383
|
case "stake-operations":
|
|
406
|
-
s =
|
|
407
|
-
|
|
384
|
+
s = T.makeBitMaskFilter(
|
|
385
|
+
E["stake-operations"]
|
|
408
386
|
);
|
|
409
387
|
break;
|
|
410
388
|
case "rewards":
|
|
411
|
-
s =
|
|
412
|
-
|
|
389
|
+
s = T.makeBitMaskFilter(
|
|
390
|
+
E.rewards
|
|
413
391
|
);
|
|
414
392
|
break;
|
|
415
393
|
default:
|
|
416
|
-
s =
|
|
394
|
+
s = T.makeBitMaskFilter([]);
|
|
417
395
|
}
|
|
418
|
-
return (await
|
|
396
|
+
return (await y.hiveClient.call(
|
|
419
397
|
"condenser_api",
|
|
420
398
|
"get_account_history",
|
|
421
399
|
[e, r, t, ...s]
|
|
@@ -443,8 +421,8 @@ function ne(e, t = 20, n) {
|
|
|
443
421
|
case "recurrent_transfer":
|
|
444
422
|
return ["HIVE"].includes(o.amount);
|
|
445
423
|
case "fill_recurrent_transfer":
|
|
446
|
-
const
|
|
447
|
-
return ["HIVE"].includes(
|
|
424
|
+
const l = p(o.amount);
|
|
425
|
+
return ["HIVE"].includes(l.symbol);
|
|
448
426
|
case "claim_reward_balance":
|
|
449
427
|
return p(
|
|
450
428
|
o.reward_hive
|
|
@@ -470,8 +448,8 @@ function ne(e, t = 20, n) {
|
|
|
470
448
|
})
|
|
471
449
|
});
|
|
472
450
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
451
|
+
function kt(e, t = 20, n) {
|
|
452
|
+
return R({
|
|
475
453
|
...ne(e, t, n),
|
|
476
454
|
queryKey: ["assets", "hive-power", "transactions", e, t, n],
|
|
477
455
|
select: ({ pages: r, pageParams: s }) => ({
|
|
@@ -494,8 +472,8 @@ function vt(e, t = 20, n) {
|
|
|
494
472
|
case "recurrent_transfer":
|
|
495
473
|
return ["VESTS", "HP"].includes(o.amount);
|
|
496
474
|
case "fill_recurrent_transfer":
|
|
497
|
-
const
|
|
498
|
-
return ["VESTS", "HP"].includes(
|
|
475
|
+
const w = p(o.amount);
|
|
476
|
+
return ["VESTS", "HP"].includes(w.symbol);
|
|
499
477
|
case "curation_reward":
|
|
500
478
|
case "withdraw_vesting":
|
|
501
479
|
case "delegate_vesting_shares":
|
|
@@ -512,8 +490,8 @@ function vt(e, t = 20, n) {
|
|
|
512
490
|
})
|
|
513
491
|
});
|
|
514
492
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
493
|
+
function bt(e, t = 20, n) {
|
|
494
|
+
return R({
|
|
517
495
|
...ne(e, t, n),
|
|
518
496
|
queryKey: ["assets", "hbd", "transactions", e, t, n],
|
|
519
497
|
select: ({ pages: r, pageParams: s }) => ({
|
|
@@ -534,8 +512,8 @@ function kt(e, t = 20, n) {
|
|
|
534
512
|
case "recurrent_transfer":
|
|
535
513
|
return ["HBD"].includes(o.amount);
|
|
536
514
|
case "fill_recurrent_transfer":
|
|
537
|
-
const
|
|
538
|
-
return ["HBD"].includes(
|
|
515
|
+
const w = p(o.amount);
|
|
516
|
+
return ["HBD"].includes(w.symbol);
|
|
539
517
|
case "comment_reward":
|
|
540
518
|
case "effective_comment_vote":
|
|
541
519
|
return !0;
|
|
@@ -547,16 +525,16 @@ function kt(e, t = 20, n) {
|
|
|
547
525
|
})
|
|
548
526
|
});
|
|
549
527
|
}
|
|
550
|
-
function
|
|
551
|
-
return
|
|
528
|
+
function Pt(e = 86400) {
|
|
529
|
+
return R({
|
|
552
530
|
queryKey: ["assets", "hive", "metrics", e],
|
|
553
|
-
queryFn: async ({ pageParam: [t, n] }) => (await
|
|
531
|
+
queryFn: async ({ pageParam: [t, n] }) => (await y.hiveClient.call(
|
|
554
532
|
"condenser_api",
|
|
555
533
|
"get_market_history",
|
|
556
534
|
[
|
|
557
535
|
e,
|
|
558
|
-
|
|
559
|
-
|
|
536
|
+
C(t).format("YYYY-MM-DDTHH:mm:ss"),
|
|
537
|
+
C(n).format("YYYY-MM-DDTHH:mm:ss")
|
|
560
538
|
]
|
|
561
539
|
)).map(({ hive: s, non_hive: a, open: o }) => ({
|
|
562
540
|
close: a.close / s.close,
|
|
@@ -568,32 +546,29 @@ function bt(e = 86400) {
|
|
|
568
546
|
})),
|
|
569
547
|
initialPageParam: [
|
|
570
548
|
// Fetch at least 8 hours or given interval
|
|
571
|
-
|
|
549
|
+
C().subtract(Math.max(100 * e, 28800), "second").toDate(),
|
|
572
550
|
/* @__PURE__ */ new Date()
|
|
573
551
|
],
|
|
574
552
|
getNextPageParam: (t, n, [r]) => [
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
-Math.max(100 * e, 28800)
|
|
578
|
-
),
|
|
579
|
-
L(new Date(r.getTime()), -e)
|
|
553
|
+
C(r.getTime()).subtract(Math.max(100 * e, 28800), "second").toDate(),
|
|
554
|
+
C(r.getTime()).subtract(e, "second").toDate()
|
|
580
555
|
]
|
|
581
556
|
});
|
|
582
557
|
}
|
|
583
|
-
function
|
|
558
|
+
function qt(e) {
|
|
584
559
|
return h({
|
|
585
560
|
queryKey: ["assets", "hive", "withdrawal-routes", e],
|
|
586
|
-
queryFn: () =>
|
|
561
|
+
queryFn: () => y.hiveClient.database.call("get_withdraw_routes", [
|
|
587
562
|
e,
|
|
588
563
|
"outgoing"
|
|
589
564
|
])
|
|
590
565
|
});
|
|
591
566
|
}
|
|
592
|
-
async function
|
|
567
|
+
async function V(e) {
|
|
593
568
|
const n = p(e.amount).symbol;
|
|
594
569
|
if (e.type === "key" && "key" in e) {
|
|
595
570
|
const { key: r, type: s, ...a } = e;
|
|
596
|
-
return
|
|
571
|
+
return y.hiveClient.broadcast.transfer(
|
|
597
572
|
{
|
|
598
573
|
from: a.from,
|
|
599
574
|
to: a.to,
|
|
@@ -633,14 +608,14 @@ async function U(e) {
|
|
|
633
608
|
}
|
|
634
609
|
);
|
|
635
610
|
}
|
|
636
|
-
async function
|
|
611
|
+
async function G(e) {
|
|
637
612
|
if (e.type === "key" && "key" in e) {
|
|
638
613
|
const { key: t, type: n, ...r } = e;
|
|
639
|
-
return
|
|
614
|
+
return y.hiveClient.broadcast.sendOperations(
|
|
640
615
|
[["transfer_to_savings", r]],
|
|
641
616
|
t
|
|
642
617
|
);
|
|
643
|
-
} else return e.type === "keychain" ?
|
|
618
|
+
} else return e.type === "keychain" ? P.broadcast(
|
|
644
619
|
e.from,
|
|
645
620
|
[["transfer_to_savings", e]],
|
|
646
621
|
"Active"
|
|
@@ -654,11 +629,11 @@ async function V(e) {
|
|
|
654
629
|
async function Oe(e) {
|
|
655
630
|
if (e.type === "key" && "key" in e) {
|
|
656
631
|
const { key: t, type: n, ...r } = e;
|
|
657
|
-
return
|
|
632
|
+
return y.hiveClient.broadcast.sendOperations(
|
|
658
633
|
[["transfer_to_vesting", r]],
|
|
659
634
|
t
|
|
660
635
|
);
|
|
661
|
-
} else return e.type === "keychain" ?
|
|
636
|
+
} else return e.type === "keychain" ? P.broadcast(
|
|
662
637
|
e.from,
|
|
663
638
|
[["transfer_to_vesting", e]],
|
|
664
639
|
"Active"
|
|
@@ -669,14 +644,14 @@ async function Oe(e) {
|
|
|
669
644
|
}
|
|
670
645
|
);
|
|
671
646
|
}
|
|
672
|
-
async function
|
|
647
|
+
async function Te(e) {
|
|
673
648
|
if (e.type === "key" && "key" in e) {
|
|
674
649
|
const { key: t, type: n, ...r } = e;
|
|
675
|
-
return
|
|
650
|
+
return y.hiveClient.broadcast.sendOperations(
|
|
676
651
|
[["delegate_vesting_shares", r]],
|
|
677
652
|
t
|
|
678
653
|
);
|
|
679
|
-
} else return e.type === "keychain" ?
|
|
654
|
+
} else return e.type === "keychain" ? P.broadcast(
|
|
680
655
|
e.from,
|
|
681
656
|
[["delegate_vesting_shares", e]],
|
|
682
657
|
"Active"
|
|
@@ -687,14 +662,14 @@ async function Ae(e) {
|
|
|
687
662
|
}
|
|
688
663
|
);
|
|
689
664
|
}
|
|
690
|
-
async function
|
|
665
|
+
async function Ae(e) {
|
|
691
666
|
if (e.type === "key" && "key" in e) {
|
|
692
667
|
const { key: t, type: n, ...r } = e;
|
|
693
|
-
return
|
|
668
|
+
return y.hiveClient.broadcast.sendOperations(
|
|
694
669
|
[["withdraw_vesting", r]],
|
|
695
670
|
t
|
|
696
671
|
);
|
|
697
|
-
} else return e.type === "keychain" ?
|
|
672
|
+
} else return e.type === "keychain" ? P.broadcast(
|
|
698
673
|
e.from,
|
|
699
674
|
[["withdraw_vesting", e]],
|
|
700
675
|
"Active"
|
|
@@ -705,17 +680,17 @@ async function Ne(e) {
|
|
|
705
680
|
}
|
|
706
681
|
);
|
|
707
682
|
}
|
|
708
|
-
async function
|
|
683
|
+
async function Ne(e) {
|
|
709
684
|
if (e.type === "key" && "key" in e) {
|
|
710
685
|
const { key: r, type: s, ...a } = e;
|
|
711
|
-
return
|
|
686
|
+
return y.hiveClient.broadcast.sendOperations(
|
|
712
687
|
[["set_withdraw_vesting_route", a]],
|
|
713
688
|
r
|
|
714
689
|
);
|
|
715
690
|
}
|
|
716
691
|
if (e.type === "keychain") {
|
|
717
692
|
const { type: r, ...s } = e;
|
|
718
|
-
return
|
|
693
|
+
return P.broadcast(
|
|
719
694
|
s.from_account,
|
|
720
695
|
[["set_withdraw_vesting_route", s]],
|
|
721
696
|
"Active"
|
|
@@ -730,7 +705,7 @@ async function Te(e) {
|
|
|
730
705
|
);
|
|
731
706
|
}
|
|
732
707
|
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 || {});
|
|
733
|
-
async function
|
|
708
|
+
async function He(e) {
|
|
734
709
|
const t = JSON.stringify({
|
|
735
710
|
to: e.to,
|
|
736
711
|
amount: +e.amount * 1e3,
|
|
@@ -743,10 +718,10 @@ async function Ke(e) {
|
|
|
743
718
|
};
|
|
744
719
|
if (e.type === "key" && "key" in e) {
|
|
745
720
|
const { key: r } = e;
|
|
746
|
-
return
|
|
721
|
+
return y.hiveClient.broadcast.json(n, r);
|
|
747
722
|
} else {
|
|
748
723
|
if (e.type === "keychain")
|
|
749
|
-
return
|
|
724
|
+
return P.customJson(
|
|
750
725
|
e.from,
|
|
751
726
|
e.id,
|
|
752
727
|
"Active",
|
|
@@ -773,7 +748,7 @@ async function Ke(e) {
|
|
|
773
748
|
}
|
|
774
749
|
}
|
|
775
750
|
}
|
|
776
|
-
const
|
|
751
|
+
const Ke = async (e) => {
|
|
777
752
|
const t = JSON.stringify({ amount: +e.amount * 1e3 }), n = {
|
|
778
753
|
id: e.mode === "lock" ? "spkcc_gov_up" : "spkcc_gov_down",
|
|
779
754
|
json: t,
|
|
@@ -782,10 +757,10 @@ const He = async (e) => {
|
|
|
782
757
|
};
|
|
783
758
|
if (e.type === "key" && "key" in e) {
|
|
784
759
|
const { key: r } = e;
|
|
785
|
-
return
|
|
760
|
+
return y.hiveClient.broadcast.json(n, r);
|
|
786
761
|
} else {
|
|
787
762
|
if (e.type === "keychain")
|
|
788
|
-
return
|
|
763
|
+
return P.customJson(
|
|
789
764
|
e.from,
|
|
790
765
|
n.id,
|
|
791
766
|
"Active",
|
|
@@ -817,10 +792,10 @@ async function Qe(e) {
|
|
|
817
792
|
};
|
|
818
793
|
if (e.type === "key" && "key" in e) {
|
|
819
794
|
const { key: r } = e;
|
|
820
|
-
return
|
|
795
|
+
return y.hiveClient.broadcast.json(n, r);
|
|
821
796
|
} else {
|
|
822
797
|
if (e.type === "keychain")
|
|
823
|
-
return
|
|
798
|
+
return P.customJson(
|
|
824
799
|
e.from,
|
|
825
800
|
`spkcc_power_${e.mode}`,
|
|
826
801
|
"Active",
|
|
@@ -849,7 +824,7 @@ function K() {
|
|
|
849
824
|
staleTime: 6e4,
|
|
850
825
|
refetchInterval: 9e4,
|
|
851
826
|
queryFn: async () => {
|
|
852
|
-
const t = await (await fetch(`${
|
|
827
|
+
const t = await (await fetch(`${y.spkNode}/markets`)).json();
|
|
853
828
|
return {
|
|
854
829
|
list: Object.entries(t.markets.node).map(([n, r]) => ({
|
|
855
830
|
name: n,
|
|
@@ -860,16 +835,16 @@ function K() {
|
|
|
860
835
|
}
|
|
861
836
|
});
|
|
862
837
|
}
|
|
863
|
-
function
|
|
838
|
+
function Q(e) {
|
|
864
839
|
return h({
|
|
865
840
|
queryKey: ["assets", "spk", "wallet", e],
|
|
866
|
-
queryFn: async () => (await fetch(
|
|
841
|
+
queryFn: async () => (await fetch(y.spkNode + `/@${e}`)).json(),
|
|
867
842
|
enabled: !!e,
|
|
868
843
|
staleTime: 6e4,
|
|
869
844
|
refetchInterval: 9e4
|
|
870
845
|
});
|
|
871
846
|
}
|
|
872
|
-
function
|
|
847
|
+
function W(e) {
|
|
873
848
|
return e.toFixed(3);
|
|
874
849
|
}
|
|
875
850
|
function De(e) {
|
|
@@ -878,15 +853,15 @@ function De(e) {
|
|
|
878
853
|
staleTime: 6e4,
|
|
879
854
|
refetchInterval: 9e4,
|
|
880
855
|
queryFn: async () => {
|
|
881
|
-
await i().prefetchQuery(
|
|
882
|
-
|
|
856
|
+
await i().prefetchQuery(Q(e)), await i().prefetchQuery(K()), await i().prefetchQuery(
|
|
857
|
+
O(e)
|
|
883
858
|
);
|
|
884
859
|
const t = i().getQueryData(
|
|
885
|
-
|
|
860
|
+
Q(e).queryKey
|
|
886
861
|
), n = i().getQueryData(
|
|
887
862
|
K().queryKey
|
|
888
863
|
), r = i().getQueryData(
|
|
889
|
-
|
|
864
|
+
O(e).queryKey
|
|
890
865
|
);
|
|
891
866
|
if (!t || !n)
|
|
892
867
|
return {
|
|
@@ -895,9 +870,9 @@ function De(e) {
|
|
|
895
870
|
price: 1,
|
|
896
871
|
accountBalance: 0
|
|
897
872
|
};
|
|
898
|
-
const s = +
|
|
873
|
+
const s = +W(
|
|
899
874
|
t.balance / 1e3 * +t.tick * ((r == null ? void 0 : r.price) ?? 0)
|
|
900
|
-
), a = +
|
|
875
|
+
), a = +W(t.balance / 1e3);
|
|
901
876
|
return {
|
|
902
877
|
name: "LARYNX",
|
|
903
878
|
layer: "SPK",
|
|
@@ -908,24 +883,24 @@ function De(e) {
|
|
|
908
883
|
}
|
|
909
884
|
});
|
|
910
885
|
}
|
|
911
|
-
function
|
|
886
|
+
function j(e) {
|
|
912
887
|
return e.toFixed(3);
|
|
913
888
|
}
|
|
914
|
-
function
|
|
889
|
+
function Ce(e) {
|
|
915
890
|
return h({
|
|
916
891
|
queryKey: ["assets", "spk", "general-info", e],
|
|
917
892
|
staleTime: 6e4,
|
|
918
893
|
refetchInterval: 9e4,
|
|
919
894
|
queryFn: async () => {
|
|
920
|
-
await i().prefetchQuery(
|
|
921
|
-
|
|
895
|
+
await i().prefetchQuery(Q(e)), await i().prefetchQuery(K()), await i().prefetchQuery(
|
|
896
|
+
O(e)
|
|
922
897
|
);
|
|
923
898
|
const t = i().getQueryData(
|
|
924
|
-
|
|
899
|
+
Q(e).queryKey
|
|
925
900
|
), n = i().getQueryData(
|
|
926
901
|
K().queryKey
|
|
927
902
|
), r = i().getQueryData(
|
|
928
|
-
|
|
903
|
+
O(e).queryKey
|
|
929
904
|
);
|
|
930
905
|
if (!t || !n)
|
|
931
906
|
return {
|
|
@@ -934,17 +909,17 @@ function Ee(e) {
|
|
|
934
909
|
price: 1,
|
|
935
910
|
accountBalance: 0
|
|
936
911
|
};
|
|
937
|
-
const s = +
|
|
912
|
+
const s = +j(
|
|
938
913
|
(t.gov + t.spk) / 1e3 * +t.tick * ((r == null ? void 0 : r.price) ?? 0)
|
|
939
|
-
), a = +
|
|
914
|
+
), a = +j(
|
|
940
915
|
(t.spk + be(
|
|
941
916
|
t,
|
|
942
917
|
n.raw.stats || {
|
|
943
918
|
spk_rate_lgov: "0.001",
|
|
944
|
-
spk_rate_lpow:
|
|
919
|
+
spk_rate_lpow: j(
|
|
945
920
|
parseFloat(n.raw.stats.spk_rate_lpow) * 100
|
|
946
921
|
),
|
|
947
|
-
spk_rate_ldel:
|
|
922
|
+
spk_rate_ldel: j(
|
|
948
923
|
parseFloat(n.raw.stats.spk_rate_ldel) * 100
|
|
949
924
|
)
|
|
950
925
|
}
|
|
@@ -959,25 +934,25 @@ function Ee(e) {
|
|
|
959
934
|
}
|
|
960
935
|
});
|
|
961
936
|
}
|
|
962
|
-
function
|
|
937
|
+
function F(e) {
|
|
963
938
|
return e.toFixed(3);
|
|
964
939
|
}
|
|
965
|
-
function
|
|
940
|
+
function Ee(e) {
|
|
966
941
|
return h({
|
|
967
942
|
queryKey: ["assets", "larynx-power", "general-info", e],
|
|
968
943
|
staleTime: 6e4,
|
|
969
944
|
refetchInterval: 9e4,
|
|
970
945
|
queryFn: async () => {
|
|
971
946
|
var o, c;
|
|
972
|
-
await i().prefetchQuery(
|
|
973
|
-
|
|
947
|
+
await i().prefetchQuery(Q(e)), await i().prefetchQuery(K()), await i().prefetchQuery(
|
|
948
|
+
O(e)
|
|
974
949
|
);
|
|
975
950
|
const t = i().getQueryData(
|
|
976
|
-
|
|
951
|
+
Q(e).queryKey
|
|
977
952
|
), n = i().getQueryData(
|
|
978
953
|
K().queryKey
|
|
979
954
|
), r = i().getQueryData(
|
|
980
|
-
|
|
955
|
+
O(e).queryKey
|
|
981
956
|
);
|
|
982
957
|
if (!t || !n)
|
|
983
958
|
return {
|
|
@@ -986,9 +961,9 @@ function Re(e) {
|
|
|
986
961
|
price: 1,
|
|
987
962
|
accountBalance: 0
|
|
988
963
|
};
|
|
989
|
-
const s = +
|
|
964
|
+
const s = +F(
|
|
990
965
|
t.poweredUp / 1e3 * +t.tick * ((r == null ? void 0 : r.price) ?? 0)
|
|
991
|
-
), a = +
|
|
966
|
+
), a = +F(t.poweredUp / 1e3);
|
|
992
967
|
return {
|
|
993
968
|
name: "LP",
|
|
994
969
|
title: "LARYNX Power",
|
|
@@ -998,24 +973,24 @@ function Re(e) {
|
|
|
998
973
|
parts: [
|
|
999
974
|
{
|
|
1000
975
|
name: "delegating",
|
|
1001
|
-
balance: (o = t.granting) != null && o.t ? +
|
|
976
|
+
balance: (o = t.granting) != null && o.t ? +F(t.granting.t / 1e3) : 0
|
|
1002
977
|
},
|
|
1003
978
|
{
|
|
1004
979
|
name: "recieved",
|
|
1005
|
-
balance: (c = t.granted) != null && c.t ? +
|
|
980
|
+
balance: (c = t.granted) != null && c.t ? +F(t.granted.t / 1e3) : 0
|
|
1006
981
|
}
|
|
1007
982
|
]
|
|
1008
983
|
};
|
|
1009
984
|
}
|
|
1010
985
|
});
|
|
1011
986
|
}
|
|
1012
|
-
function
|
|
987
|
+
function L(e) {
|
|
1013
988
|
return h({
|
|
1014
989
|
queryKey: ["assets", "hive-engine", "metadata-list", e],
|
|
1015
990
|
staleTime: 6e4,
|
|
1016
991
|
refetchInterval: 9e4,
|
|
1017
992
|
queryFn: async () => (await (await fetch(
|
|
1018
|
-
`${
|
|
993
|
+
`${y.privateApiHost}/private-api/engine-api`,
|
|
1019
994
|
{
|
|
1020
995
|
method: "POST",
|
|
1021
996
|
body: JSON.stringify({
|
|
@@ -1035,7 +1010,7 @@ function j(e) {
|
|
|
1035
1010
|
)).json()).result
|
|
1036
1011
|
});
|
|
1037
1012
|
}
|
|
1038
|
-
const
|
|
1013
|
+
const B = [
|
|
1039
1014
|
"LEO",
|
|
1040
1015
|
"ARCHON",
|
|
1041
1016
|
"WAIV",
|
|
@@ -1061,13 +1036,13 @@ const F = [
|
|
|
1061
1036
|
"SPORTS",
|
|
1062
1037
|
"CURE"
|
|
1063
1038
|
];
|
|
1064
|
-
function
|
|
1039
|
+
function U(e) {
|
|
1065
1040
|
return h({
|
|
1066
1041
|
queryKey: ["assets", "hive-engine", "balances", e],
|
|
1067
1042
|
staleTime: 6e4,
|
|
1068
1043
|
refetchInterval: 9e4,
|
|
1069
1044
|
queryFn: async () => (await (await fetch(
|
|
1070
|
-
`${
|
|
1045
|
+
`${y.privateApiHost}/private-api/engine-api`,
|
|
1071
1046
|
{
|
|
1072
1047
|
method: "POST",
|
|
1073
1048
|
body: JSON.stringify({
|
|
@@ -1087,13 +1062,13 @@ function $(e) {
|
|
|
1087
1062
|
)).json()).result
|
|
1088
1063
|
});
|
|
1089
1064
|
}
|
|
1090
|
-
function
|
|
1065
|
+
function Re() {
|
|
1091
1066
|
return h({
|
|
1092
1067
|
queryKey: ["assets", "hive-engine", "markets"],
|
|
1093
1068
|
staleTime: 6e4,
|
|
1094
1069
|
refetchInterval: 9e4,
|
|
1095
1070
|
queryFn: async () => (await (await fetch(
|
|
1096
|
-
`${
|
|
1071
|
+
`${y.privateApiHost}/private-api/engine-api`,
|
|
1097
1072
|
{
|
|
1098
1073
|
method: "POST",
|
|
1099
1074
|
body: JSON.stringify({
|
|
@@ -1122,17 +1097,17 @@ function Ie(e, t) {
|
|
|
1122
1097
|
throw new Error(
|
|
1123
1098
|
"[SDK][Wallets] – hive engine token or username missed"
|
|
1124
1099
|
);
|
|
1125
|
-
const n =
|
|
1100
|
+
const n = O(e);
|
|
1126
1101
|
await i().prefetchQuery(n);
|
|
1127
1102
|
const r = i().getQueryData(
|
|
1128
1103
|
n.queryKey
|
|
1129
|
-
), s =
|
|
1104
|
+
), s = L(B);
|
|
1130
1105
|
await i().prefetchQuery(s);
|
|
1131
|
-
const a = i().getQueryData(s.queryKey), o =
|
|
1106
|
+
const a = i().getQueryData(s.queryKey), o = U(e);
|
|
1132
1107
|
await i().prefetchQuery(o);
|
|
1133
|
-
const c = i().getQueryData(o.queryKey),
|
|
1134
|
-
await i().prefetchQuery(
|
|
1135
|
-
const
|
|
1108
|
+
const c = i().getQueryData(o.queryKey), l = Re();
|
|
1109
|
+
await i().prefetchQuery(l);
|
|
1110
|
+
const w = i().getQueryData(l.queryKey), _ = a == null ? void 0 : a.find((q) => q.symbol === t), v = c == null ? void 0 : c.find((q) => q.symbol === t), b = w == null ? void 0 : w.find((q) => q.symbol === t), k = +((b == null ? void 0 : b.lastPrice) ?? "0");
|
|
1136
1111
|
return {
|
|
1137
1112
|
name: t,
|
|
1138
1113
|
title: (_ == null ? void 0 : _.name) ?? "",
|
|
@@ -1143,8 +1118,8 @@ function Ie(e, t) {
|
|
|
1143
1118
|
}
|
|
1144
1119
|
});
|
|
1145
1120
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return
|
|
1121
|
+
function St(e, t, n = 20) {
|
|
1122
|
+
return R({
|
|
1148
1123
|
queryKey: ["assets", "hive-engine", t, "transactions", e],
|
|
1149
1124
|
enabled: !!t && !!e,
|
|
1150
1125
|
initialPageParam: 0,
|
|
@@ -1155,7 +1130,7 @@ function qt(e, t, n = 20) {
|
|
|
1155
1130
|
"[SDK][Wallets] – hive engine token or username missed"
|
|
1156
1131
|
);
|
|
1157
1132
|
const s = new URL(
|
|
1158
|
-
`${
|
|
1133
|
+
`${y.privateApiHost}/private-api/engine-account-history`
|
|
1159
1134
|
);
|
|
1160
1135
|
return s.searchParams.set("account", e), s.searchParams.set("symbol", t), s.searchParams.set("limit", n.toString()), s.searchParams.set("offset", r.toString()), await (await fetch(s, {
|
|
1161
1136
|
method: "GET",
|
|
@@ -1164,14 +1139,14 @@ function qt(e, t, n = 20) {
|
|
|
1164
1139
|
}
|
|
1165
1140
|
});
|
|
1166
1141
|
}
|
|
1167
|
-
function
|
|
1142
|
+
function Ot(e, t = "daily") {
|
|
1168
1143
|
return h({
|
|
1169
1144
|
queryKey: ["assets", "hive-engine", e],
|
|
1170
1145
|
staleTime: 6e4,
|
|
1171
1146
|
refetchInterval: 9e4,
|
|
1172
1147
|
queryFn: async () => {
|
|
1173
1148
|
const n = new URL(
|
|
1174
|
-
`${
|
|
1149
|
+
`${y.privateApiHost}/private-api/engine-chart-api`
|
|
1175
1150
|
);
|
|
1176
1151
|
return n.searchParams.set("symbol", e), n.searchParams.set("interval", t), await (await fetch(n, {
|
|
1177
1152
|
headers: { "Content-type": "application/json" }
|
|
@@ -1196,7 +1171,7 @@ async function je(e) {
|
|
|
1196
1171
|
required_auths: [a.from],
|
|
1197
1172
|
required_posting_auths: []
|
|
1198
1173
|
};
|
|
1199
|
-
return
|
|
1174
|
+
return y.hiveClient.broadcast.json(o, r);
|
|
1200
1175
|
} else return e.type === "keychain" ? new Promise(
|
|
1201
1176
|
(r, s) => {
|
|
1202
1177
|
var a;
|
|
@@ -1259,7 +1234,7 @@ async function Fe(e) {
|
|
|
1259
1234
|
required_auths: [a.from],
|
|
1260
1235
|
required_posting_auths: []
|
|
1261
1236
|
};
|
|
1262
|
-
return
|
|
1237
|
+
return y.hiveClient.broadcast.json(o, r);
|
|
1263
1238
|
} else return e.type === "keychain" ? new Promise(
|
|
1264
1239
|
(r, s) => {
|
|
1265
1240
|
var a;
|
|
@@ -1322,7 +1297,7 @@ async function Le(e) {
|
|
|
1322
1297
|
required_auths: [a.from],
|
|
1323
1298
|
required_posting_auths: []
|
|
1324
1299
|
};
|
|
1325
|
-
return
|
|
1300
|
+
return y.hiveClient.broadcast.json(o, r);
|
|
1326
1301
|
} else return e.type === "keychain" ? new Promise(
|
|
1327
1302
|
(r, s) => {
|
|
1328
1303
|
var a;
|
|
@@ -1385,7 +1360,7 @@ async function Be(e) {
|
|
|
1385
1360
|
required_auths: [a.from],
|
|
1386
1361
|
required_posting_auths: []
|
|
1387
1362
|
};
|
|
1388
|
-
return
|
|
1363
|
+
return y.hiveClient.broadcast.json(o, r);
|
|
1389
1364
|
} else return e.type === "keychain" ? new Promise(
|
|
1390
1365
|
(r, s) => {
|
|
1391
1366
|
var a;
|
|
@@ -1449,7 +1424,7 @@ async function Me(e) {
|
|
|
1449
1424
|
required_auths: [a.from],
|
|
1450
1425
|
required_posting_auths: []
|
|
1451
1426
|
};
|
|
1452
|
-
return
|
|
1427
|
+
return y.hiveClient.broadcast.json(o, r);
|
|
1453
1428
|
} else return e.type === "keychain" ? new Promise(
|
|
1454
1429
|
(r, s) => {
|
|
1455
1430
|
var a;
|
|
@@ -1497,7 +1472,7 @@ async function Me(e) {
|
|
|
1497
1472
|
}
|
|
1498
1473
|
);
|
|
1499
1474
|
}
|
|
1500
|
-
function
|
|
1475
|
+
function J(e) {
|
|
1501
1476
|
return h({
|
|
1502
1477
|
queryKey: ["assets", "points", e],
|
|
1503
1478
|
queryFn: async () => {
|
|
@@ -1506,7 +1481,7 @@ function M(e) {
|
|
|
1506
1481
|
"[SDK][Wallets][Assets][Points][Query] – username wasn`t provided"
|
|
1507
1482
|
);
|
|
1508
1483
|
const n = await (await fetch(
|
|
1509
|
-
|
|
1484
|
+
y.privateApiHost + "/private-api/points",
|
|
1510
1485
|
{
|
|
1511
1486
|
method: "POST",
|
|
1512
1487
|
headers: {
|
|
@@ -1532,9 +1507,9 @@ function Je(e) {
|
|
|
1532
1507
|
staleTime: 6e4,
|
|
1533
1508
|
refetchInterval: 9e4,
|
|
1534
1509
|
queryFn: async () => {
|
|
1535
|
-
await i().prefetchQuery(
|
|
1510
|
+
await i().prefetchQuery(J(e));
|
|
1536
1511
|
const t = i().getQueryData(
|
|
1537
|
-
|
|
1512
|
+
J(e).queryKey
|
|
1538
1513
|
);
|
|
1539
1514
|
return {
|
|
1540
1515
|
name: "POINTS",
|
|
@@ -1545,11 +1520,11 @@ function Je(e) {
|
|
|
1545
1520
|
}
|
|
1546
1521
|
});
|
|
1547
1522
|
}
|
|
1548
|
-
function
|
|
1523
|
+
function Tt(e, t) {
|
|
1549
1524
|
return h({
|
|
1550
1525
|
queryKey: ["assets", "points", "transactions", e],
|
|
1551
1526
|
queryFn: async () => (await (await fetch(
|
|
1552
|
-
`${
|
|
1527
|
+
`${y.privateApiHost}/private-api/point-list`,
|
|
1553
1528
|
{
|
|
1554
1529
|
method: "POST",
|
|
1555
1530
|
body: JSON.stringify({
|
|
@@ -1575,24 +1550,24 @@ function At(e, t, n) {
|
|
|
1575
1550
|
e,
|
|
1576
1551
|
"points-claimed"
|
|
1577
1552
|
);
|
|
1578
|
-
return
|
|
1553
|
+
return N({
|
|
1579
1554
|
mutationFn: async () => {
|
|
1580
1555
|
if (!e)
|
|
1581
1556
|
throw new Error(
|
|
1582
1557
|
"[SDK][Wallets][Assets][Points][Claim] – username wasn`t provided"
|
|
1583
1558
|
);
|
|
1584
|
-
return fetch(
|
|
1559
|
+
return fetch(y.privateApiHost + "/private-api/points-claim", {
|
|
1585
1560
|
method: "POST",
|
|
1586
1561
|
headers: {
|
|
1587
1562
|
"Content-Type": "application/json"
|
|
1588
1563
|
},
|
|
1589
|
-
body: JSON.stringify({ code:
|
|
1564
|
+
body: JSON.stringify({ code: oe(e) })
|
|
1590
1565
|
});
|
|
1591
1566
|
},
|
|
1592
1567
|
onError: n,
|
|
1593
1568
|
onSuccess: () => {
|
|
1594
|
-
r(),
|
|
1595
|
-
|
|
1569
|
+
r(), y.queryClient.setQueryData(
|
|
1570
|
+
J(e).queryKey,
|
|
1596
1571
|
(s) => s && {
|
|
1597
1572
|
points: (parseFloat(s.points) + parseFloat(s.uPoints)).toFixed(3),
|
|
1598
1573
|
uPoints: "0"
|
|
@@ -1625,9 +1600,9 @@ async function $e({
|
|
|
1625
1600
|
];
|
|
1626
1601
|
if (s === "key" && "key" in a) {
|
|
1627
1602
|
const { key: c } = a;
|
|
1628
|
-
return
|
|
1603
|
+
return y.hiveClient.broadcast.sendOperations([o], c);
|
|
1629
1604
|
}
|
|
1630
|
-
return s === "keychain" ?
|
|
1605
|
+
return s === "keychain" ? P.broadcast(e, [o], "Active") : d.sendOperation(
|
|
1631
1606
|
o,
|
|
1632
1607
|
{ callback: `https://ecency.com/@${e}/wallet` },
|
|
1633
1608
|
() => {
|
|
@@ -1640,22 +1615,20 @@ function Nt(e) {
|
|
|
1640
1615
|
queryKey: ["ecency-wallets", "all-tokens-list", e],
|
|
1641
1616
|
queryFn: async () => {
|
|
1642
1617
|
await i().prefetchQuery(
|
|
1643
|
-
|
|
1618
|
+
L(B)
|
|
1644
1619
|
);
|
|
1645
|
-
const t = i().getQueryData(
|
|
1620
|
+
const t = i().getQueryData(L(B).queryKey);
|
|
1646
1621
|
return {
|
|
1647
1622
|
basic: [
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
w.Spk,
|
|
1653
|
-
"LARYNX",
|
|
1654
|
-
"LP"
|
|
1623
|
+
g.Points,
|
|
1624
|
+
g.Hive,
|
|
1625
|
+
g.HivePower,
|
|
1626
|
+
g.HiveDollar
|
|
1655
1627
|
].filter((n) => n.toLowerCase().includes(e.toLowerCase())),
|
|
1656
|
-
external: Object.values(
|
|
1628
|
+
external: Object.values(f).filter(
|
|
1657
1629
|
(n) => n.toLowerCase().includes(e.toLowerCase())
|
|
1658
1630
|
),
|
|
1631
|
+
spk: [g.Spk, "LARYNX", "LP"],
|
|
1659
1632
|
layer2: t
|
|
1660
1633
|
};
|
|
1661
1634
|
}
|
|
@@ -1666,15 +1639,30 @@ function Ue(e) {
|
|
|
1666
1639
|
queryKey: ["ecency-wallets", "list", e],
|
|
1667
1640
|
enabled: !!e,
|
|
1668
1641
|
queryFn: async () => {
|
|
1669
|
-
|
|
1670
|
-
|
|
1642
|
+
var r;
|
|
1643
|
+
const t = S(e);
|
|
1644
|
+
await i().fetchQuery({
|
|
1645
|
+
queryKey: t.queryKey
|
|
1646
|
+
});
|
|
1647
|
+
const n = i().getQueryData(
|
|
1648
|
+
t.queryKey
|
|
1671
1649
|
);
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1650
|
+
if (((r = n == null ? void 0 : n.profile) == null ? void 0 : r.tokens) instanceof Array) {
|
|
1651
|
+
const s = [
|
|
1652
|
+
g.Points,
|
|
1653
|
+
g.Hive,
|
|
1654
|
+
g.HivePower,
|
|
1655
|
+
g.HiveDollar,
|
|
1656
|
+
...n.profile.tokens.map((a) => a.symbol)
|
|
1657
|
+
];
|
|
1658
|
+
return Array.from(new Set(s).values());
|
|
1659
|
+
}
|
|
1660
|
+
return [
|
|
1661
|
+
g.Points,
|
|
1662
|
+
g.Hive,
|
|
1663
|
+
g.HivePower,
|
|
1664
|
+
g.HiveDollar,
|
|
1665
|
+
g.Spk
|
|
1678
1666
|
];
|
|
1679
1667
|
}
|
|
1680
1668
|
});
|
|
@@ -1687,20 +1675,20 @@ function Ve(e, t, n = { refetch: !1 }) {
|
|
|
1687
1675
|
queryKey: ["ecency-wallets", "asset-info", e, t],
|
|
1688
1676
|
queryFn: async () => {
|
|
1689
1677
|
if (t === "HIVE")
|
|
1690
|
-
return r(
|
|
1678
|
+
return r(O(e));
|
|
1691
1679
|
if (t === "HP")
|
|
1692
1680
|
return r(qe(e));
|
|
1693
1681
|
if (t === "HBD")
|
|
1694
1682
|
return r(Se(e));
|
|
1695
1683
|
if (t === "SPK")
|
|
1696
|
-
return r(
|
|
1684
|
+
return r(Ce(e));
|
|
1697
1685
|
if (t === "LARYNX")
|
|
1698
1686
|
return r(De(e));
|
|
1699
1687
|
if (t === "LP")
|
|
1700
|
-
return r(
|
|
1688
|
+
return r(Ee(e));
|
|
1701
1689
|
if (t === "POINTS")
|
|
1702
1690
|
return r(Je(e));
|
|
1703
|
-
if (
|
|
1691
|
+
if (B.includes(t))
|
|
1704
1692
|
return await r(
|
|
1705
1693
|
Ie(e, t)
|
|
1706
1694
|
);
|
|
@@ -1710,12 +1698,12 @@ function Ve(e, t, n = { refetch: !1 }) {
|
|
|
1710
1698
|
}
|
|
1711
1699
|
});
|
|
1712
1700
|
}
|
|
1713
|
-
function
|
|
1701
|
+
function Ht(e, t, n = !1) {
|
|
1714
1702
|
return h({
|
|
1715
1703
|
queryKey: ["wallets", "token-operations", e, t, n],
|
|
1716
1704
|
queryFn: async () => {
|
|
1717
1705
|
switch (e) {
|
|
1718
|
-
case
|
|
1706
|
+
case g.Hive:
|
|
1719
1707
|
return [
|
|
1720
1708
|
u.Transfer,
|
|
1721
1709
|
...n ? [
|
|
@@ -1724,17 +1712,17 @@ function Tt(e, t, n = !1) {
|
|
|
1724
1712
|
u.Swap
|
|
1725
1713
|
] : []
|
|
1726
1714
|
];
|
|
1727
|
-
case
|
|
1715
|
+
case g.HivePower:
|
|
1728
1716
|
return [
|
|
1729
1717
|
u.Delegate,
|
|
1730
1718
|
...n ? [u.PowerDown, u.WithdrawRoutes] : [u.PowerUp]
|
|
1731
1719
|
];
|
|
1732
|
-
case
|
|
1720
|
+
case g.HiveDollar:
|
|
1733
1721
|
return [
|
|
1734
1722
|
u.Transfer,
|
|
1735
1723
|
...n ? [u.TransferToSavings, u.Swap] : []
|
|
1736
1724
|
];
|
|
1737
|
-
case
|
|
1725
|
+
case g.Points:
|
|
1738
1726
|
return [
|
|
1739
1727
|
u.Gift,
|
|
1740
1728
|
...n ? [
|
|
@@ -1743,7 +1731,7 @@ function Tt(e, t, n = !1) {
|
|
|
1743
1731
|
u.Buy
|
|
1744
1732
|
] : []
|
|
1745
1733
|
];
|
|
1746
|
-
case
|
|
1734
|
+
case g.Spk:
|
|
1747
1735
|
return [u.Transfer];
|
|
1748
1736
|
case "LARYNX":
|
|
1749
1737
|
return [
|
|
@@ -1756,59 +1744,82 @@ function Tt(e, t, n = !1) {
|
|
|
1756
1744
|
...n ? [u.PowerDown] : []
|
|
1757
1745
|
];
|
|
1758
1746
|
}
|
|
1759
|
-
const r =
|
|
1747
|
+
const r = U(t);
|
|
1760
1748
|
await i().prefetchQuery(r);
|
|
1761
1749
|
const s = i().getQueryData(
|
|
1762
1750
|
r.queryKey
|
|
1763
|
-
), a =
|
|
1751
|
+
), a = L(
|
|
1764
1752
|
(s == null ? void 0 : s.map((k) => k.symbol)) ?? []
|
|
1765
1753
|
);
|
|
1766
1754
|
await i().prefetchQuery(a);
|
|
1767
|
-
const o = i().getQueryData(a.queryKey), c = s == null ? void 0 : s.find((k) => k.symbol === e),
|
|
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), b = n && parseFloat((c == null ? void 0 : c.stake) ?? "0") > 0;
|
|
1768
1756
|
return [
|
|
1769
1757
|
u.Transfer,
|
|
1770
|
-
...
|
|
1758
|
+
...w ? [u.Delegate] : [],
|
|
1771
1759
|
..._ ? [u.Undelegate] : [],
|
|
1772
1760
|
...v ? [u.Stake] : [],
|
|
1773
|
-
...
|
|
1761
|
+
...b ? [u.Unstake] : []
|
|
1774
1762
|
];
|
|
1775
1763
|
}
|
|
1776
1764
|
});
|
|
1777
1765
|
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1766
|
+
function Ge(e) {
|
|
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 = {
|
|
1790
|
+
[f.BTC]: "m/44'/0'/0'/0/0",
|
|
1780
1791
|
// Bitcoin (BIP44)
|
|
1781
|
-
[
|
|
1792
|
+
[f.ETH]: "m/44'/60'/0'/0/0",
|
|
1782
1793
|
// Ethereum (BIP44)
|
|
1783
|
-
[
|
|
1794
|
+
[f.SOL]: "m/44'/501'/0'/0'",
|
|
1784
1795
|
// Solana (BIP44)
|
|
1785
|
-
[
|
|
1796
|
+
[f.TON]: "m/44'/607'/0'",
|
|
1786
1797
|
// TON (BIP44)
|
|
1787
|
-
[
|
|
1798
|
+
[f.TRON]: "m/44'/195'/0'/0/0",
|
|
1788
1799
|
// Tron (BIP44)
|
|
1789
|
-
[
|
|
1800
|
+
[f.APT]: "m/44'/637'/0'/0'/0'",
|
|
1790
1801
|
// Aptos (BIP44)
|
|
1791
|
-
[
|
|
1802
|
+
[f.ATOM]: "m/44'/118'/0'/0/0"
|
|
1792
1803
|
// Cosmos (BIP44)
|
|
1793
1804
|
};
|
|
1794
1805
|
function Kt(e, t) {
|
|
1795
|
-
const { data: n } = z(e), r =
|
|
1806
|
+
const { data: n } = z(e), r = $(), s = N({
|
|
1796
1807
|
mutationKey: ["ecency-wallets", "create-wallet", e, t],
|
|
1797
1808
|
mutationFn: async () => {
|
|
1798
1809
|
if (!n)
|
|
1799
1810
|
throw new Error("[Ecency][Wallets] - No seed to create a wallet");
|
|
1800
|
-
const o =
|
|
1811
|
+
const o = re(t), c = await (o == null ? void 0 : o.getDerivedPrivateKey({
|
|
1801
1812
|
mnemonic: n,
|
|
1802
|
-
hdPath:
|
|
1813
|
+
hdPath: We[t]
|
|
1803
1814
|
}));
|
|
1804
|
-
await
|
|
1805
|
-
const
|
|
1815
|
+
await Ge(1e3);
|
|
1816
|
+
const l = await (o == null ? void 0 : o.getNewAddress({
|
|
1806
1817
|
privateKey: c
|
|
1807
1818
|
}));
|
|
1808
1819
|
return {
|
|
1809
1820
|
privateKey: c,
|
|
1810
|
-
address:
|
|
1811
|
-
publicKey:
|
|
1821
|
+
address: l.address,
|
|
1822
|
+
publicKey: l.publicKey,
|
|
1812
1823
|
username: e,
|
|
1813
1824
|
currency: t
|
|
1814
1825
|
};
|
|
@@ -1816,23 +1827,26 @@ function Kt(e, t) {
|
|
|
1816
1827
|
onSuccess: (o) => {
|
|
1817
1828
|
r.setQueryData(
|
|
1818
1829
|
["ecency-wallets", "wallets", o.username],
|
|
1819
|
-
(c) => new Map(c ? Array.from(c.entries()) : []).set(
|
|
1830
|
+
(c) => new Map(c ? Array.from(c.entries()) : []).set(
|
|
1831
|
+
o.currency,
|
|
1832
|
+
o
|
|
1833
|
+
)
|
|
1820
1834
|
);
|
|
1821
1835
|
}
|
|
1822
|
-
}), a =
|
|
1836
|
+
}), a = we(() => {
|
|
1823
1837
|
}, []);
|
|
1824
1838
|
return {
|
|
1825
1839
|
createWallet: s,
|
|
1826
1840
|
importWallet: a
|
|
1827
1841
|
};
|
|
1828
1842
|
}
|
|
1829
|
-
function
|
|
1843
|
+
function Ye(e) {
|
|
1830
1844
|
const { data: t } = D({
|
|
1831
1845
|
queryKey: ["ecency-wallets", "wallets", e]
|
|
1832
1846
|
}), { data: n } = ke(e);
|
|
1833
|
-
return
|
|
1847
|
+
return N({
|
|
1834
1848
|
mutationKey: ["ecency-wallets", "create-account-with-wallets", e],
|
|
1835
|
-
mutationFn: ({ currency: r, address: s }) => fetch(
|
|
1849
|
+
mutationFn: ({ currency: r, address: s }) => fetch(y.privateApiHost + "/private-api/wallets-add", {
|
|
1836
1850
|
method: "POST",
|
|
1837
1851
|
headers: {
|
|
1838
1852
|
"Content-Type": "application/json"
|
|
@@ -1858,11 +1872,11 @@ function We(e) {
|
|
|
1858
1872
|
})
|
|
1859
1873
|
});
|
|
1860
1874
|
}
|
|
1861
|
-
function
|
|
1862
|
-
return
|
|
1875
|
+
function se() {
|
|
1876
|
+
return N({
|
|
1863
1877
|
mutationKey: ["ecency-wallets", "check-wallet-existence"],
|
|
1864
1878
|
mutationFn: async ({ address: e, currency: t }) => (await (await fetch(
|
|
1865
|
-
|
|
1879
|
+
y.privateApiHost + "/private-api/wallets-exist",
|
|
1866
1880
|
{
|
|
1867
1881
|
method: "POST",
|
|
1868
1882
|
headers: {
|
|
@@ -1876,22 +1890,22 @@ function re() {
|
|
|
1876
1890
|
)).json()).length === 0
|
|
1877
1891
|
});
|
|
1878
1892
|
}
|
|
1879
|
-
const
|
|
1893
|
+
const Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1880
1894
|
__proto__: null,
|
|
1881
|
-
useCheckWalletExistence:
|
|
1882
|
-
useCreateAccountWithWallets:
|
|
1895
|
+
useCheckWalletExistence: se,
|
|
1896
|
+
useCreateAccountWithWallets: Ye
|
|
1883
1897
|
}, Symbol.toStringTag, { value: "Module" })), Xe = {
|
|
1884
|
-
[
|
|
1885
|
-
[
|
|
1898
|
+
[f.BTC]: ["m/84'/0'/0'/0/0"],
|
|
1899
|
+
[f.ETH]: ["m/84'/60'/0'/0/0"],
|
|
1886
1900
|
// its not working for Trust, Exodus, todo: check others below
|
|
1887
|
-
[
|
|
1888
|
-
[
|
|
1889
|
-
[
|
|
1890
|
-
[
|
|
1901
|
+
[f.SOL]: ["m/84'/501'/0'/0/0"],
|
|
1902
|
+
[f.TRON]: ["m/44'/195'/0'/0'/0'"],
|
|
1903
|
+
[f.APT]: ["m/84'/637'/0'/0/0"],
|
|
1904
|
+
[f.TON]: [],
|
|
1891
1905
|
// Disabled
|
|
1892
|
-
[
|
|
1906
|
+
[f.ATOM]: ["m/84'/118'/0'/0'/0"]
|
|
1893
1907
|
};
|
|
1894
|
-
async function
|
|
1908
|
+
async function ze(e, t, n) {
|
|
1895
1909
|
for (const r of Xe[n] || [])
|
|
1896
1910
|
try {
|
|
1897
1911
|
const s = await t.getDerivedPrivateKey({
|
|
@@ -1899,7 +1913,7 @@ async function Ye(e, t, n) {
|
|
|
1899
1913
|
hdPath: r
|
|
1900
1914
|
}), a = await t.getNewAddress({
|
|
1901
1915
|
privateKey: s,
|
|
1902
|
-
addressType: n ===
|
|
1916
|
+
addressType: n === f.BTC ? "segwit_native" : void 0
|
|
1903
1917
|
});
|
|
1904
1918
|
return [s.toString(), a.address];
|
|
1905
1919
|
} catch {
|
|
@@ -1907,17 +1921,17 @@ async function Ye(e, t, n) {
|
|
|
1907
1921
|
}
|
|
1908
1922
|
return [];
|
|
1909
1923
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const n =
|
|
1912
|
-
return
|
|
1924
|
+
function Dt(e, t) {
|
|
1925
|
+
const n = $(), { mutateAsync: r } = se();
|
|
1926
|
+
return N({
|
|
1913
1927
|
mutationKey: ["ecency-wallets", "import-wallet", e, t],
|
|
1914
1928
|
mutationFn: async ({ privateKeyOrSeed: s }) => {
|
|
1915
|
-
const a =
|
|
1929
|
+
const a = re(t);
|
|
1916
1930
|
if (!a)
|
|
1917
1931
|
throw new Error("Cannot find token for this currency");
|
|
1918
1932
|
const o = s.split(" ").length === 12;
|
|
1919
|
-
let c,
|
|
1920
|
-
if (o ? [
|
|
1933
|
+
let c, l = s;
|
|
1934
|
+
if (o ? [l, c] = await ze(
|
|
1921
1935
|
s,
|
|
1922
1936
|
a,
|
|
1923
1937
|
t
|
|
@@ -1935,7 +1949,7 @@ function Qt(e, t) {
|
|
|
1935
1949
|
"This wallet has already in use by Hive account. Please, try another one"
|
|
1936
1950
|
);
|
|
1937
1951
|
return {
|
|
1938
|
-
privateKey:
|
|
1952
|
+
privateKey: l,
|
|
1939
1953
|
address: c,
|
|
1940
1954
|
publicKey: ""
|
|
1941
1955
|
};
|
|
@@ -1949,96 +1963,106 @@ function Qt(e, t) {
|
|
|
1949
1963
|
address: o,
|
|
1950
1964
|
username: e,
|
|
1951
1965
|
currency: t,
|
|
1966
|
+
type: "CHAIN",
|
|
1952
1967
|
custom: !0
|
|
1953
1968
|
})
|
|
1954
1969
|
);
|
|
1955
1970
|
}
|
|
1956
1971
|
});
|
|
1957
1972
|
}
|
|
1958
|
-
function
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
profile: {},
|
|
1966
|
-
tokens: Array.from(n.entries() ?? []).map(([r, s]) => ({
|
|
1967
|
-
symbol: r,
|
|
1968
|
-
type: "CHAIN",
|
|
1969
|
-
meta: {
|
|
1970
|
-
address: s.address
|
|
1971
|
-
}
|
|
1972
|
-
}))
|
|
1973
|
-
})
|
|
1974
|
-
});
|
|
1973
|
+
function Y(e, t = !1) {
|
|
1974
|
+
return e ? A.pipe(
|
|
1975
|
+
e,
|
|
1976
|
+
A.filter(({ type: n }) => n === "CHAIN"),
|
|
1977
|
+
A.map((n) => (n.meta.show = t, n)),
|
|
1978
|
+
A.groupByProp("symbol")
|
|
1979
|
+
) : {};
|
|
1975
1980
|
}
|
|
1976
|
-
function
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1981
|
+
function Ct(e) {
|
|
1982
|
+
const t = $(), { data: n } = D(S(e)), { mutateAsync: r } = ie(e);
|
|
1983
|
+
return N({
|
|
1984
|
+
mutationKey: ["ecency-wallets", "save-wallet-to-metadata", n],
|
|
1985
|
+
mutationFn: async (s) => {
|
|
1986
|
+
var _;
|
|
1987
|
+
if (!n)
|
|
1988
|
+
throw new Error("[SDK][Wallets] – no account data to save wallets");
|
|
1989
|
+
const a = Y(
|
|
1990
|
+
(_ = n.profile) == null ? void 0 : _.tokens
|
|
1991
|
+
), o = s.map(({ currency: v, type: b, ...k }) => ({
|
|
1992
|
+
symbol: v,
|
|
1993
|
+
type: b,
|
|
1994
|
+
meta: k
|
|
1995
|
+
})) ?? [], c = Y(o, !0), l = o.filter(
|
|
1996
|
+
({ type: v }) => v !== "CHAIN"
|
|
1997
|
+
), w = A.pipe(
|
|
1998
|
+
a,
|
|
1999
|
+
A.mergeDeep(c),
|
|
2000
|
+
A.values()
|
|
2001
|
+
);
|
|
2002
|
+
return r({
|
|
2003
|
+
tokens: [
|
|
2004
|
+
...l,
|
|
2005
|
+
...w
|
|
2006
|
+
]
|
|
1986
2007
|
});
|
|
1987
|
-
}
|
|
2008
|
+
},
|
|
2009
|
+
onSuccess: () => t.invalidateQueries({
|
|
2010
|
+
queryKey: Ue(e).queryKey
|
|
2011
|
+
})
|
|
1988
2012
|
});
|
|
1989
2013
|
}
|
|
1990
|
-
const
|
|
2014
|
+
const Ze = {
|
|
1991
2015
|
HIVE: {
|
|
1992
|
-
[u.Transfer]:
|
|
1993
|
-
[u.TransferToSavings]:
|
|
2016
|
+
[u.Transfer]: V,
|
|
2017
|
+
[u.TransferToSavings]: G,
|
|
1994
2018
|
[u.PowerUp]: Oe
|
|
1995
2019
|
},
|
|
1996
2020
|
HBD: {
|
|
1997
|
-
[u.Transfer]:
|
|
1998
|
-
[u.TransferToSavings]:
|
|
2021
|
+
[u.Transfer]: V,
|
|
2022
|
+
[u.TransferToSavings]: G
|
|
1999
2023
|
},
|
|
2000
2024
|
HP: {
|
|
2001
|
-
[u.PowerDown]:
|
|
2002
|
-
[u.Delegate]:
|
|
2003
|
-
[u.WithdrawRoutes]:
|
|
2025
|
+
[u.PowerDown]: Ae,
|
|
2026
|
+
[u.Delegate]: Te,
|
|
2027
|
+
[u.WithdrawRoutes]: Ne
|
|
2004
2028
|
},
|
|
2005
2029
|
POINTS: {
|
|
2006
2030
|
[u.Gift]: $e
|
|
2007
2031
|
},
|
|
2008
2032
|
SPK: {
|
|
2009
|
-
[u.Transfer]:
|
|
2033
|
+
[u.Transfer]: He
|
|
2010
2034
|
},
|
|
2011
2035
|
LARYNX: {
|
|
2012
|
-
[u.LockLiquidity]:
|
|
2036
|
+
[u.LockLiquidity]: Ke,
|
|
2013
2037
|
[u.PowerUp]: Qe
|
|
2014
2038
|
}
|
|
2015
|
-
},
|
|
2039
|
+
}, et = {
|
|
2016
2040
|
[u.Transfer]: Me,
|
|
2017
2041
|
[u.Stake]: Le,
|
|
2018
2042
|
[u.Unstake]: Be,
|
|
2019
2043
|
[u.Delegate]: je,
|
|
2020
2044
|
[u.Undelegate]: Fe
|
|
2021
2045
|
};
|
|
2022
|
-
function
|
|
2046
|
+
function Et(e, t, n) {
|
|
2023
2047
|
const { mutateAsync: r } = X.useRecordActivity(
|
|
2024
2048
|
e,
|
|
2025
2049
|
n
|
|
2026
2050
|
);
|
|
2027
|
-
return
|
|
2051
|
+
return N({
|
|
2028
2052
|
mutationKey: ["ecency-wallets", t, n],
|
|
2029
2053
|
mutationFn: async (s) => {
|
|
2030
|
-
const a =
|
|
2054
|
+
const a = Ze[t][n];
|
|
2031
2055
|
if (a)
|
|
2032
2056
|
return a(s);
|
|
2033
|
-
const o =
|
|
2057
|
+
const o = U(e);
|
|
2034
2058
|
await i().prefetchQuery(o);
|
|
2035
2059
|
const c = i().getQueryData(
|
|
2036
2060
|
o.queryKey
|
|
2037
2061
|
);
|
|
2038
|
-
if (c != null && c.some((
|
|
2039
|
-
const
|
|
2040
|
-
if (
|
|
2041
|
-
return
|
|
2062
|
+
if (c != null && c.some((l) => l.symbol === t)) {
|
|
2063
|
+
const l = et[n];
|
|
2064
|
+
if (l)
|
|
2065
|
+
return l({ ...s, asset: t });
|
|
2042
2066
|
}
|
|
2043
2067
|
throw new Error("[SDK][Wallets] – no operation for given asset");
|
|
2044
2068
|
},
|
|
@@ -2058,64 +2082,63 @@ function Rt(e, t, n) {
|
|
|
2058
2082
|
}
|
|
2059
2083
|
export {
|
|
2060
2084
|
u as AssetOperation,
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2085
|
+
g as EcencyWalletBasicTokens,
|
|
2086
|
+
f as EcencyWalletCurrency,
|
|
2087
|
+
Qt as EcencyWalletsPrivateApi,
|
|
2064
2088
|
te as NaiMap,
|
|
2065
2089
|
xe as PointTransactionType,
|
|
2066
2090
|
ee as Symbol,
|
|
2067
2091
|
je as delegateEngineToken,
|
|
2068
|
-
|
|
2092
|
+
Te as delegateHive,
|
|
2069
2093
|
Ve as getAccountWalletAssetInfoQueryOptions,
|
|
2070
2094
|
Ue as getAccountWalletListQueryOptions,
|
|
2071
2095
|
Nt as getAllTokensListQueryOptions,
|
|
2072
2096
|
Se as getHbdAssetGeneralInfoQueryOptions,
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2097
|
+
bt as getHbdAssetTransactionsQueryOptions,
|
|
2098
|
+
O as getHiveAssetGeneralInfoQueryOptions,
|
|
2099
|
+
Pt as getHiveAssetMetricQueryOptions,
|
|
2076
2100
|
ne as getHiveAssetTransactionsQueryOptions,
|
|
2077
|
-
|
|
2101
|
+
qt as getHiveAssetWithdrawalRoutesQueryOptions,
|
|
2078
2102
|
Ie as getHiveEngineTokenGeneralInfoQueryOptions,
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2103
|
+
St as getHiveEngineTokenTransactionsQueryOptions,
|
|
2104
|
+
U as getHiveEngineTokensBalancesQueryOptions,
|
|
2105
|
+
Re as getHiveEngineTokensMarketQueryOptions,
|
|
2106
|
+
L as getHiveEngineTokensMetadataQueryOptions,
|
|
2107
|
+
Ot as getHiveEngineTokensMetricsQueryOptions,
|
|
2084
2108
|
qe as getHivePowerAssetGeneralInfoQueryOptions,
|
|
2085
|
-
|
|
2109
|
+
kt as getHivePowerAssetTransactionsQueryOptions,
|
|
2086
2110
|
De as getLarynxAssetGeneralInfoQueryOptions,
|
|
2087
|
-
|
|
2111
|
+
Ee as getLarynxPowerAssetGeneralInfoQueryOptions,
|
|
2088
2112
|
Je as getPointsAssetGeneralInfoQueryOptions,
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2113
|
+
Tt as getPointsAssetTransactionsQueryOptions,
|
|
2114
|
+
J as getPointsQueryOptions,
|
|
2115
|
+
Ce as getSpkAssetGeneralInfoQueryOptions,
|
|
2092
2116
|
K as getSpkMarketsQueryOptions,
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2117
|
+
Ht as getTokenOperationsQueryOptions,
|
|
2118
|
+
vt as isEmptyDate,
|
|
2119
|
+
Ke as lockLarynx,
|
|
2096
2120
|
p as parseAsset,
|
|
2097
|
-
|
|
2121
|
+
Ae as powerDownHive,
|
|
2098
2122
|
Oe as powerUpHive,
|
|
2099
2123
|
Qe as powerUpLarynx,
|
|
2100
2124
|
be as rewardSpk,
|
|
2101
2125
|
Le as stakeEngineToken,
|
|
2102
2126
|
Me as transferEngineToken,
|
|
2103
|
-
|
|
2127
|
+
V as transferHive,
|
|
2104
2128
|
$e as transferPoint,
|
|
2105
|
-
|
|
2106
|
-
|
|
2129
|
+
He as transferSpk,
|
|
2130
|
+
G as transferToSavingsHive,
|
|
2107
2131
|
Fe as undelegateEngineToken,
|
|
2108
2132
|
Be as unstakeEngineToken,
|
|
2109
|
-
Et as useChangeAssetsList,
|
|
2110
2133
|
At as useClaimPoints,
|
|
2111
|
-
|
|
2112
|
-
|
|
2134
|
+
_t as useCoinGeckoPriceQuery,
|
|
2135
|
+
dt as useGetExternalWalletBalanceQuery,
|
|
2113
2136
|
ke as useHiveKeysQuery,
|
|
2114
|
-
|
|
2115
|
-
|
|
2137
|
+
Dt as useImportWallet,
|
|
2138
|
+
Ct as useSaveWalletInformationToMetadata,
|
|
2116
2139
|
z as useSeedPhrase,
|
|
2117
2140
|
Kt as useWalletCreate,
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2141
|
+
Et as useWalletOperation,
|
|
2142
|
+
M as vestsToHp,
|
|
2143
|
+
Ne as withdrawVestingRouteHive
|
|
2121
2144
|
};
|