@ecency/sdk 1.0.17 → 1.0.19
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/config.d.ts +8 -0
- package/dist/ecency-sdk.es.js +173 -112
- package/dist/index.d.ts +3 -0
- package/dist/modules/accounts/index.d.ts +1 -0
- package/dist/modules/accounts/mutations/index.d.ts +1 -0
- package/dist/modules/accounts/mutations/use-account-update.d.ts +1 -0
- package/dist/modules/accounts/queries/get-account-full-query-options.d.ts +353 -0
- package/dist/modules/accounts/queries/index.d.ts +1 -0
- package/dist/modules/accounts/queries/search-accounts-by-username-query-options.d.ts +8 -0
- package/dist/modules/accounts/types/account-follow-stats.d.ts +5 -0
- package/dist/modules/accounts/types/account-reputation.d.ts +4 -0
- package/dist/modules/accounts/types/index.d.ts +2 -0
- package/dist/modules/core/entities/index.d.ts +1 -0
- package/dist/modules/core/entities/user.d.ts +8 -0
- package/dist/modules/core/index.d.ts +3 -0
- package/dist/modules/core/mutations/index.d.ts +1 -0
- package/dist/modules/core/mutations/use-broadcast-mutation.d.ts +3 -0
- package/dist/modules/core/queries-manager.d.ts +21 -0
- package/dist/modules/core/storage.d.ts +5 -0
- package/dist/modules/core/utils/decoder-encoder.d.ts +2 -0
- package/dist/modules/core/utils/index.d.ts +1 -0
- package/dist/modules/hive-engine/index.d.ts +1 -0
- package/dist/modules/hive-engine/queries/index.d.ts +1 -0
- package/dist/modules/hive-engine/queries/use-get-hive-engine-tokens-list-query-options.d.ts +8 -0
- package/dist/modules/hive-engine/types/hive-engine-list-response.d.ts +18 -0
- package/dist/modules/hive-engine/types/index.d.ts +1 -0
- package/dist/modules/keychain/index.d.ts +2 -0
- package/dist/modules/keychain/keychain.d.ts +9 -0
- package/dist/modules/operations/index.d.ts +1 -0
- package/dist/modules/operations/mutations/index.d.ts +3 -0
- package/dist/modules/operations/mutations/sign-operation-by-hivesigner.d.ts +4 -0
- package/dist/modules/operations/mutations/sign-operation-by-key.d.ts +5 -0
- package/dist/modules/operations/mutations/sign-operation-by-keychain.d.ts +5 -0
- package/dist/modules/wallets/enums/ecency-wallet-basic-tokens.d.ts +8 -0
- package/dist/modules/wallets/enums/ecency-wallet-currency.d.ts +9 -0
- package/dist/modules/wallets/enums/index.d.ts +2 -0
- package/dist/modules/wallets/functions/get-keys-from-seed.d.ts +3 -0
- package/dist/modules/wallets/functions/index.d.ts +1 -0
- package/dist/modules/wallets/index.d.ts +5 -0
- package/dist/modules/wallets/mutations/index.d.ts +4 -0
- package/dist/modules/wallets/mutations/private-api/check-wallet-existence.d.ts +7 -0
- package/dist/modules/wallets/mutations/private-api/create-account-with-wallets.d.ts +7 -0
- package/dist/modules/wallets/mutations/private-api/index.d.ts +2 -0
- package/dist/modules/wallets/mutations/private-api-namespace.d.ts +2 -0
- package/dist/modules/wallets/mutations/save-wallet-information-to-metadata.d.ts +5 -0
- package/dist/modules/wallets/mutations/use-import-wallet.d.ts +10 -0
- package/dist/modules/wallets/mutations/use-wallet-create.d.ts +6 -0
- package/dist/modules/wallets/queries/get-account-points-query-options.d.ts +9 -0
- package/dist/modules/wallets/queries/index.d.ts +6 -0
- package/dist/modules/wallets/queries/use-coingecko-price-query.d.ts +2 -0
- package/dist/modules/wallets/queries/use-get-account-wallet-list-query.d.ts +2 -0
- package/dist/modules/wallets/queries/use-get-all-tokens-list-query.d.ts +2 -0
- package/dist/modules/wallets/queries/use-get-external-wallet-query.d.ts +10 -0
- package/dist/modules/wallets/queries/use-hive-keys-query.d.ts +2 -0
- package/dist/modules/wallets/queries/use-seed-phrase.d.ts +1 -0
- package/dist/modules/wallets/types/account-points-response.d.ts +4 -0
- package/dist/modules/wallets/types/ecency-create-wallet-information.d.ts +9 -0
- package/dist/modules/wallets/types/ecency-hive-keys.d.ts +12 -0
- package/dist/modules/wallets/types/index.d.ts +3 -0
- package/dist/modules/wallets/utils/delay.d.ts +1 -0
- package/dist/modules/wallets/utils/get-wallet.d.ts +3 -0
- package/dist/modules/wallets/utils/index.d.ts +3 -0
- package/dist/modules/wallets/utils/mnemonic-to-seed-bip-39.d.ts +1 -0
- package/package.json +5 -5
- package/dist/ecency-sdk.es.d.ts +0 -136
package/dist/config.d.ts
ADDED
package/dist/ecency-sdk.es.js
CHANGED
@@ -1,48 +1,48 @@
|
|
1
|
-
import { useCallback as
|
2
|
-
import { useQuery as
|
3
|
-
import { BtcWallet as
|
4
|
-
import { EthWallet as
|
5
|
-
import { TrxWallet as
|
6
|
-
import { TonWallet as
|
7
|
-
import { SolWallet as
|
8
|
-
import { AtomWallet as
|
9
|
-
import { AptosWallet as
|
10
|
-
import _, { mnemonicToSeedSync as
|
11
|
-
import { Client as
|
12
|
-
import { LRUCache as
|
13
|
-
import
|
14
|
-
var o = /* @__PURE__ */ ((t) => (t.BTC = "BTC", t.ETH = "ETH", t.APT = "APT", t.ATOM = "ATOM", t.TON = "TON", t.TRON = "TRX", t.SOL = "SOL", t))(o || {});
|
15
|
-
function
|
1
|
+
import { useCallback as g } from "react";
|
2
|
+
import { useQuery as m, queryOptions as v, useQueryClient as b, useMutation as u } from "@tanstack/react-query";
|
3
|
+
import { BtcWallet as R } from "@okxweb3/coin-bitcoin";
|
4
|
+
import { EthWallet as H } from "@okxweb3/coin-ethereum";
|
5
|
+
import { TrxWallet as C } from "@okxweb3/coin-tron";
|
6
|
+
import { TonWallet as N } from "@okxweb3/coin-ton";
|
7
|
+
import { SolWallet as j } from "@okxweb3/coin-solana";
|
8
|
+
import { AtomWallet as D } from "@okxweb3/coin-cosmos";
|
9
|
+
import { AptosWallet as x } from "@okxweb3/coin-aptos";
|
10
|
+
import _, { mnemonicToSeedSync as q } from "bip39";
|
11
|
+
import { Client as F, PrivateKey as l, cryptoUtils as L } from "@hiveio/dhive";
|
12
|
+
import { LRUCache as M } from "lru-cache";
|
13
|
+
import P from "hivesigner";
|
14
|
+
var o = /* @__PURE__ */ ((t) => (t.BTC = "BTC", t.ETH = "ETH", t.APT = "APT", t.ATOM = "ATOM", t.TON = "TON", t.TRON = "TRX", t.SOL = "SOL", t))(o || {}), d = /* @__PURE__ */ ((t) => (t[t.Points = 0] = "Points", t[t.HivePower = 1] = "HivePower", t[t.Hive = 2] = "Hive", t[t.HiveDollar = 3] = "HiveDollar", t[t.Leo = 4] = "Leo", t[t.Spk = 5] = "Spk", t))(d || {});
|
15
|
+
function Q(t) {
|
16
16
|
return new Promise((e) => setTimeout(e, t));
|
17
17
|
}
|
18
18
|
function T(t) {
|
19
19
|
switch (t) {
|
20
20
|
case o.BTC:
|
21
|
-
return new
|
21
|
+
return new R();
|
22
22
|
case o.ETH:
|
23
|
-
return new
|
23
|
+
return new H();
|
24
24
|
case o.TRON:
|
25
|
-
return new R();
|
26
|
-
case o.TON:
|
27
25
|
return new C();
|
28
|
-
case o.
|
26
|
+
case o.TON:
|
29
27
|
return new N();
|
28
|
+
case o.SOL:
|
29
|
+
return new j();
|
30
30
|
case o.ATOM:
|
31
|
-
return new x();
|
32
|
-
case o.APT:
|
33
31
|
return new D();
|
32
|
+
case o.APT:
|
33
|
+
return new x();
|
34
34
|
default:
|
35
35
|
return;
|
36
36
|
}
|
37
37
|
}
|
38
|
-
function
|
39
|
-
return
|
38
|
+
function Pt(t) {
|
39
|
+
return q(t).toString("hex");
|
40
40
|
}
|
41
|
-
const
|
41
|
+
const p = {
|
42
42
|
privateApiHost: "https://ecency.com",
|
43
43
|
storage: localStorage,
|
44
44
|
storagePrefix: "ecency",
|
45
|
-
hiveClient: new
|
45
|
+
hiveClient: new F(
|
46
46
|
[
|
47
47
|
"https://api.hive.blog",
|
48
48
|
"https://api.deathwing.me",
|
@@ -65,7 +65,7 @@ const u = {
|
|
65
65
|
heliusApiKey: "fb1e2935-f911-4b1d-8e1c-3863f6879d42"
|
66
66
|
};
|
67
67
|
function Tt(t, e) {
|
68
|
-
return
|
68
|
+
return m({
|
69
69
|
queryKey: ["ecency-wallets", "external-wallet-balance", t, e],
|
70
70
|
queryFn: async () => {
|
71
71
|
switch (t) {
|
@@ -80,7 +80,7 @@ function Tt(t, e) {
|
|
80
80
|
)).json()).ETH.balance;
|
81
81
|
case o.SOL:
|
82
82
|
return (await (await fetch(
|
83
|
-
`https://rpc.helius.xyz/?api-key=${
|
83
|
+
`https://rpc.helius.xyz/?api-key=${p.heliusApiKey}`,
|
84
84
|
{
|
85
85
|
method: "POST",
|
86
86
|
body: JSON.stringify({
|
@@ -106,7 +106,7 @@ function Tt(t, e) {
|
|
106
106
|
const y = (await (await fetch(
|
107
107
|
`https://fullnode.mainnet.aptoslabs.com/v1/accounts/${e}/resources`
|
108
108
|
)).json()).find(
|
109
|
-
(
|
109
|
+
(k) => k.type.includes("coin::CoinStore")
|
110
110
|
);
|
111
111
|
return y ? parseInt(y.data.coin.value) / 1e8 : 0;
|
112
112
|
case o.ATOM:
|
@@ -117,13 +117,13 @@ function Tt(t, e) {
|
|
117
117
|
}
|
118
118
|
});
|
119
119
|
}
|
120
|
-
function
|
121
|
-
return
|
120
|
+
function S(t) {
|
121
|
+
return m({
|
122
122
|
queryKey: ["ecency-wallets", "seed", t],
|
123
123
|
queryFn: async () => _.generateMnemonic(128)
|
124
124
|
});
|
125
125
|
}
|
126
|
-
const
|
126
|
+
const J = {
|
127
127
|
max: 500,
|
128
128
|
// how long to live in ms
|
129
129
|
ttl: 1e3 * 60 * 5,
|
@@ -131,12 +131,12 @@ const W = {
|
|
131
131
|
allowStale: !1,
|
132
132
|
updateAgeOnGet: !1,
|
133
133
|
updateAgeOnHas: !1
|
134
|
-
},
|
135
|
-
const e =
|
134
|
+
}, O = new M(J), w = Symbol("undefined"), $ = (t, e) => O.set(t, e === void 0 ? w : e), B = (t) => {
|
135
|
+
const e = O.get(t);
|
136
136
|
return e === w ? void 0 : e;
|
137
137
|
};
|
138
|
-
function
|
139
|
-
return
|
138
|
+
function St(t) {
|
139
|
+
return m({
|
140
140
|
queryKey: ["ecency-wallets", "coingecko-price", t],
|
141
141
|
queryFn: async () => {
|
142
142
|
let e = t;
|
@@ -156,7 +156,7 @@ function bt(t) {
|
|
156
156
|
default:
|
157
157
|
e = t;
|
158
158
|
}
|
159
|
-
let n =
|
159
|
+
let n = B("gecko"), a;
|
160
160
|
if (n)
|
161
161
|
a = n;
|
162
162
|
else {
|
@@ -172,21 +172,21 @@ function bt(t) {
|
|
172
172
|
})
|
173
173
|
}
|
174
174
|
)).json();
|
175
|
-
|
175
|
+
$("gecko", i === void 0 ? w : i), a = i;
|
176
176
|
}
|
177
177
|
return 1 / +a[Object.keys(a)[0]].usd;
|
178
178
|
},
|
179
179
|
enabled: !!t
|
180
180
|
});
|
181
181
|
}
|
182
|
-
function
|
183
|
-
const { data: e } =
|
184
|
-
return
|
182
|
+
function E(t) {
|
183
|
+
const { data: e } = S(t);
|
184
|
+
return m({
|
185
185
|
queryKey: ["ecencу-wallets", "hive-keys", t, e],
|
186
186
|
queryFn: async () => {
|
187
187
|
if (!e)
|
188
188
|
throw new Error("[Ecency][Wallets] - no seed to create Hive account");
|
189
|
-
const n =
|
189
|
+
const n = l.fromLogin(t, e, "owner"), a = l.fromLogin(t, e, "active"), s = l.fromLogin(t, e, "posting"), r = l.fromLogin(t, e, "memo");
|
190
190
|
return {
|
191
191
|
username: t,
|
192
192
|
owner: n.toString(),
|
@@ -201,7 +201,65 @@ function q(t) {
|
|
201
201
|
}
|
202
202
|
});
|
203
203
|
}
|
204
|
-
|
204
|
+
function Ot(t, e) {
|
205
|
+
return v({
|
206
|
+
queryKey: ["ecency-wallets", "points", t, e],
|
207
|
+
queryFn: async () => await (await fetch(
|
208
|
+
`${p.privateApiHost}/private-api/points`,
|
209
|
+
{
|
210
|
+
method: "POST",
|
211
|
+
body: JSON.stringify({
|
212
|
+
username: t.replace("@", "")
|
213
|
+
})
|
214
|
+
}
|
215
|
+
)).json(),
|
216
|
+
staleTime: 3e4,
|
217
|
+
refetchOnMount: !0,
|
218
|
+
enabled: !!t
|
219
|
+
});
|
220
|
+
}
|
221
|
+
function I(t, e) {
|
222
|
+
return v({
|
223
|
+
queryKey: ["hive-engine", "tokens-list", t, e],
|
224
|
+
queryFn: async () => (await (await fetch(
|
225
|
+
`${p.privateApiHost}/private-api/engine-api`,
|
226
|
+
{
|
227
|
+
method: "POST",
|
228
|
+
body: JSON.stringify({
|
229
|
+
jsonrpc: "2.0",
|
230
|
+
method: "find",
|
231
|
+
params: {
|
232
|
+
contract: "market",
|
233
|
+
table: "metrics",
|
234
|
+
query: {
|
235
|
+
symbol: e,
|
236
|
+
account: t
|
237
|
+
}
|
238
|
+
},
|
239
|
+
id: 1
|
240
|
+
}),
|
241
|
+
headers: { "Content-type": "application/json" }
|
242
|
+
}
|
243
|
+
)).json()).result
|
244
|
+
});
|
245
|
+
}
|
246
|
+
function At() {
|
247
|
+
const { data: t } = m(I());
|
248
|
+
return g(
|
249
|
+
() => [
|
250
|
+
d.Points,
|
251
|
+
d.Hive,
|
252
|
+
d.HivePower,
|
253
|
+
d.HiveDollar,
|
254
|
+
d.Leo,
|
255
|
+
d.Spk,
|
256
|
+
...Object.keys(o),
|
257
|
+
...(t == null ? void 0 : t.map(({ symbol: e }) => e)) ?? []
|
258
|
+
],
|
259
|
+
[t]
|
260
|
+
);
|
261
|
+
}
|
262
|
+
const G = {
|
205
263
|
[o.BTC]: "m/44'/0'/0'/0/0",
|
206
264
|
// Bitcoin (BIP44)
|
207
265
|
[o.ETH]: "m/44'/60'/0'/0/0",
|
@@ -217,24 +275,24 @@ const I = {
|
|
217
275
|
[o.ATOM]: "m/44'/118'/0'/0/0"
|
218
276
|
// Cosmos (BIP44)
|
219
277
|
};
|
220
|
-
function
|
221
|
-
const { data: n } =
|
278
|
+
function Kt(t, e) {
|
279
|
+
const { data: n } = S(t), a = b(), s = u({
|
222
280
|
mutationKey: ["ecency-wallets", "create-wallet", t, e],
|
223
281
|
mutationFn: async () => {
|
224
282
|
if (!n)
|
225
283
|
throw new Error("[Ecency][Wallets] - No seed to create a wallet");
|
226
284
|
const i = T(e), c = await (i == null ? void 0 : i.getDerivedPrivateKey({
|
227
285
|
mnemonic: n,
|
228
|
-
hdPath:
|
286
|
+
hdPath: G[e]
|
229
287
|
}));
|
230
|
-
await
|
231
|
-
const
|
288
|
+
await Q(1e3);
|
289
|
+
const h = await (i == null ? void 0 : i.getNewAddress({
|
232
290
|
privateKey: c
|
233
291
|
}));
|
234
292
|
return {
|
235
293
|
privateKey: c,
|
236
|
-
address:
|
237
|
-
publicKey:
|
294
|
+
address: h.address,
|
295
|
+
publicKey: h.publicKey,
|
238
296
|
username: t,
|
239
297
|
currency: e
|
240
298
|
};
|
@@ -245,20 +303,20 @@ function vt(t, e) {
|
|
245
303
|
(c) => new Map(c ? Array.from(c.entries()) : []).set(i.currency, i)
|
246
304
|
);
|
247
305
|
}
|
248
|
-
}), r =
|
306
|
+
}), r = g(() => {
|
249
307
|
}, []);
|
250
308
|
return {
|
251
309
|
createWallet: s,
|
252
310
|
importWallet: r
|
253
311
|
};
|
254
312
|
}
|
255
|
-
function
|
256
|
-
const { data: e } =
|
313
|
+
function W(t) {
|
314
|
+
const { data: e } = m({
|
257
315
|
queryKey: ["ecency-wallets", "wallets", t]
|
258
|
-
}), { data: n } =
|
259
|
-
return
|
316
|
+
}), { data: n } = E(t);
|
317
|
+
return u({
|
260
318
|
mutationKey: ["ecency-wallets", "create-account-with-wallets", t],
|
261
|
-
mutationFn: ({ currency: a, address: s }) => fetch(
|
319
|
+
mutationFn: ({ currency: a, address: s }) => fetch(p.privateApiHost + "/private-api/wallets-add", {
|
262
320
|
method: "POST",
|
263
321
|
headers: {
|
264
322
|
"Content-Type": "application/json"
|
@@ -284,11 +342,11 @@ function J(t) {
|
|
284
342
|
})
|
285
343
|
});
|
286
344
|
}
|
287
|
-
function
|
288
|
-
return
|
345
|
+
function A() {
|
346
|
+
return u({
|
289
347
|
mutationKey: ["ecency-wallets", "check-wallet-existence"],
|
290
348
|
mutationFn: async ({ address: t, currency: e }) => (await (await fetch(
|
291
|
-
|
349
|
+
p.privateApiHost + "/private-api/wallets-exist",
|
292
350
|
{
|
293
351
|
method: "POST",
|
294
352
|
headers: {
|
@@ -302,11 +360,11 @@ function P() {
|
|
302
360
|
)).json()).length === 0
|
303
361
|
});
|
304
362
|
}
|
305
|
-
const
|
363
|
+
const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
306
364
|
__proto__: null,
|
307
|
-
useCheckWalletExistence:
|
308
|
-
useCreateAccountWithWallets:
|
309
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
365
|
+
useCheckWalletExistence: A,
|
366
|
+
useCreateAccountWithWallets: W
|
367
|
+
}, Symbol.toStringTag, { value: "Module" })), U = {
|
310
368
|
[o.BTC]: ["m/84'/0'/0'/0/0"],
|
311
369
|
[o.ETH]: ["m/84'/60'/0'/0/0"],
|
312
370
|
// its not working for Trust, Exodus, todo: check others below
|
@@ -317,8 +375,8 @@ const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
317
375
|
// Disabled
|
318
376
|
[o.ATOM]: ["m/84'/118'/0'/0'/0"]
|
319
377
|
};
|
320
|
-
async function
|
321
|
-
for (const a of
|
378
|
+
async function V(t, e, n) {
|
379
|
+
for (const a of U[n] || [])
|
322
380
|
try {
|
323
381
|
const s = await e.getDerivedPrivateKey({
|
324
382
|
mnemonic: t,
|
@@ -333,17 +391,17 @@ async function $(t, e, n) {
|
|
333
391
|
}
|
334
392
|
return [];
|
335
393
|
}
|
336
|
-
function
|
337
|
-
const n =
|
338
|
-
return
|
394
|
+
function Rt(t, e) {
|
395
|
+
const n = b(), { mutateAsync: a } = A();
|
396
|
+
return u({
|
339
397
|
mutationKey: ["ecency-wallets", "import-wallet", t, e],
|
340
398
|
mutationFn: async ({ privateKeyOrSeed: s }) => {
|
341
399
|
const r = T(e);
|
342
400
|
if (!r)
|
343
401
|
throw new Error("Cannot find token for this currency");
|
344
402
|
const i = s.split(" ").length === 12;
|
345
|
-
let c,
|
346
|
-
if (i ? [
|
403
|
+
let c, h = s;
|
404
|
+
if (i ? [h, c] = await V(
|
347
405
|
s,
|
348
406
|
r,
|
349
407
|
e
|
@@ -361,7 +419,7 @@ function St(t, e) {
|
|
361
419
|
"This wallet has already in use by Hive account. Please, try another one"
|
362
420
|
);
|
363
421
|
return {
|
364
|
-
privateKey:
|
422
|
+
privateKey: h,
|
365
423
|
address: c,
|
366
424
|
publicKey: ""
|
367
425
|
};
|
@@ -381,41 +439,41 @@ function St(t, e) {
|
|
381
439
|
}
|
382
440
|
});
|
383
441
|
}
|
384
|
-
function
|
442
|
+
function z(t) {
|
385
443
|
let e = atob(t);
|
386
444
|
if (e[0] === "{")
|
387
445
|
return JSON.parse(e);
|
388
446
|
}
|
389
|
-
const
|
447
|
+
const f = (t) => {
|
390
448
|
try {
|
391
|
-
const e =
|
392
|
-
|
449
|
+
const e = p.storage.getItem(
|
450
|
+
p.storagePrefix + "_user_" + t
|
393
451
|
);
|
394
|
-
return
|
452
|
+
return z(JSON.parse(e));
|
395
453
|
} catch (e) {
|
396
454
|
console.error(e);
|
397
455
|
return;
|
398
456
|
}
|
399
|
-
},
|
400
|
-
function
|
401
|
-
return
|
457
|
+
}, X = (t) => f(t) && f(t).accessToken, Y = (t) => f(t) && f(t).postingKey;
|
458
|
+
function Z(t = [], e, n) {
|
459
|
+
return u({
|
402
460
|
mutationKey: [...t, e],
|
403
461
|
mutationFn: async (a) => {
|
404
462
|
if (!e)
|
405
463
|
throw new Error(
|
406
464
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
407
465
|
);
|
408
|
-
const s =
|
466
|
+
const s = Y(e);
|
409
467
|
if (s) {
|
410
|
-
const i =
|
411
|
-
return
|
468
|
+
const i = l.fromString(s);
|
469
|
+
return p.hiveClient.broadcast.sendOperations(
|
412
470
|
n(a),
|
413
471
|
i
|
414
472
|
);
|
415
473
|
}
|
416
|
-
let r =
|
474
|
+
let r = X(e);
|
417
475
|
if (r)
|
418
|
-
return (await new
|
476
|
+
return (await new P.Client({
|
419
477
|
accessToken: r
|
420
478
|
}).broadcast(n(a))).result;
|
421
479
|
throw new Error(
|
@@ -424,8 +482,8 @@ function z(t = [], e, n) {
|
|
424
482
|
}
|
425
483
|
});
|
426
484
|
}
|
427
|
-
function
|
428
|
-
return
|
485
|
+
function tt(t) {
|
486
|
+
return Z(
|
429
487
|
["accounts", "update"],
|
430
488
|
t,
|
431
489
|
(e) => [
|
@@ -443,9 +501,9 @@ function X(t) {
|
|
443
501
|
]
|
444
502
|
);
|
445
503
|
}
|
446
|
-
function
|
447
|
-
const { mutateAsync: e } =
|
448
|
-
return
|
504
|
+
function Ht(t) {
|
505
|
+
const { mutateAsync: e } = tt(t);
|
506
|
+
return u({
|
449
507
|
mutationKey: ["ecency-wallets", "save-wallet-to-metadata", t],
|
450
508
|
mutationFn: ({
|
451
509
|
wallets: n
|
@@ -460,8 +518,8 @@ function Ot(t) {
|
|
460
518
|
)
|
461
519
|
});
|
462
520
|
}
|
463
|
-
function
|
464
|
-
return
|
521
|
+
function Ct(t) {
|
522
|
+
return u({
|
465
523
|
mutationKey: ["operations", "sign", t],
|
466
524
|
mutationFn: ({
|
467
525
|
operation: e,
|
@@ -470,14 +528,14 @@ function kt(t) {
|
|
470
528
|
if (!t)
|
471
529
|
throw new Error("[Operations][Sign] – cannot sign op with anon user");
|
472
530
|
let a;
|
473
|
-
return n.split(" ").length === 12 ? a =
|
531
|
+
return n.split(" ").length === 12 ? a = l.fromLogin(t, n, "active") : L.isWif(n) ? a = l.fromString(n) : a = l.from(n), p.hiveClient.broadcast.sendOperations(
|
474
532
|
[e],
|
475
533
|
a
|
476
534
|
);
|
477
535
|
}
|
478
536
|
});
|
479
537
|
}
|
480
|
-
const
|
538
|
+
const et = (t, e, n, a = null) => new Promise((s, r) => {
|
481
539
|
var i;
|
482
540
|
(i = window.hive_keychain) == null || i.requestBroadcast(
|
483
541
|
t,
|
@@ -489,40 +547,43 @@ const Y = (t, e, n, a = null) => new Promise((s, r) => {
|
|
489
547
|
a
|
490
548
|
);
|
491
549
|
});
|
492
|
-
function
|
493
|
-
return
|
550
|
+
function Nt(t, e = "Active") {
|
551
|
+
return u({
|
494
552
|
mutationKey: ["operations", "sign-keychain", t],
|
495
553
|
mutationFn: ({ operation: n }) => {
|
496
554
|
if (!t)
|
497
555
|
throw new Error(
|
498
556
|
"[SDK][Keychain] – cannot sign operation with anon user"
|
499
557
|
);
|
500
|
-
return
|
558
|
+
return et(t, [n], e);
|
501
559
|
}
|
502
560
|
});
|
503
561
|
}
|
504
|
-
function
|
505
|
-
return
|
562
|
+
function jt(t = "/") {
|
563
|
+
return u({
|
506
564
|
mutationKey: ["operations", "sign-hivesigner", t],
|
507
|
-
mutationFn: async ({ operation: e }) =>
|
565
|
+
mutationFn: async ({ operation: e }) => P.sendOperation(e, { callback: t }, () => {
|
508
566
|
})
|
509
567
|
});
|
510
568
|
}
|
511
569
|
export {
|
570
|
+
d as EcencyWalletBasicTokens,
|
512
571
|
o as EcencyWalletCurrency,
|
513
|
-
|
514
|
-
|
572
|
+
kt as EcencyWalletsPrivateApi,
|
573
|
+
Q as delay,
|
574
|
+
Ot as getAccountPointsQueryOptions,
|
515
575
|
T as getWallet,
|
516
|
-
|
517
|
-
|
518
|
-
|
576
|
+
Pt as mnemonicToSeedBip39,
|
577
|
+
tt as useAccountUpdate,
|
578
|
+
St as useCoinGeckoPriceQuery,
|
579
|
+
At as useGetAllTokensListQuery,
|
519
580
|
Tt as useGetExternalWalletBalanceQuery,
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
581
|
+
E as useHiveKeysQuery,
|
582
|
+
Rt as useImportWallet,
|
583
|
+
Ht as useSaveWalletInformationToMetadata,
|
584
|
+
S as useSeedPhrase,
|
585
|
+
jt as useSignOperationByHivesigner,
|
586
|
+
Ct as useSignOperationByKey,
|
587
|
+
Nt as useSignOperationByKeychain,
|
588
|
+
Kt as useWalletCreate
|
528
589
|
};
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './mutations';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './use-account-update';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function useAccountUpdate(username: string): import('@tanstack/react-query').UseMutationResult<any, Error, any, unknown>;
|