@ecency/sdk 1.0.23 → 1.0.25

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.
@@ -1,48 +1,68 @@
1
- import { useMemo as K, useCallback as R } from "react";
2
- import { useQuery as h, queryOptions as g, useQueryClient as v, useMutation as u } from "@tanstack/react-query";
3
- import { BtcWallet as C } from "@okxweb3/coin-bitcoin";
4
- import { EthWallet as H } from "@okxweb3/coin-ethereum";
5
- import { TrxWallet as N } from "@okxweb3/coin-tron";
6
- import { TonWallet as j } from "@okxweb3/coin-ton";
7
- import { SolWallet as D } from "@okxweb3/coin-solana";
8
- import { AtomWallet as x } from "@okxweb3/coin-cosmos";
9
- import { AptosWallet as L } from "@okxweb3/coin-aptos";
10
- import _, { mnemonicToSeedSync as F } from "bip39";
11
- import { Client as B, PrivateKey as l, cryptoUtils as E } from "@hiveio/dhive";
12
- import { LRUCache as q } from "lru-cache";
13
- import b from "hivesigner";
14
- var a = /* @__PURE__ */ ((e) => (e.BTC = "BTC", e.ETH = "ETH", e.APT = "APT", e.ATOM = "ATOM", e.TON = "TON", e.TRON = "TRX", e.SOL = "SOL", e))(a || {}), m = /* @__PURE__ */ ((e) => (e.Points = "POINTS", e.HivePower = "HP", e.Hive = "HIVE", e.HiveDollar = "HBD", e.Spk = "SPK", e))(m || {});
15
- function M(e) {
1
+ var C = Object.defineProperty;
2
+ var R = (e, t, n) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var v = (e, t, n) => R(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { useMemo as H, useCallback as N } from "react";
5
+ import { useQuery as w, queryOptions as f, useQueryClient as b, useMutation as l } from "@tanstack/react-query";
6
+ import { BtcWallet as _ } from "@okxweb3/coin-bitcoin";
7
+ import { EthWallet as j } from "@okxweb3/coin-ethereum";
8
+ import { TrxWallet as D } from "@okxweb3/coin-tron";
9
+ import { TonWallet as F } from "@okxweb3/coin-ton";
10
+ import { SolWallet as E } from "@okxweb3/coin-solana";
11
+ import { AtomWallet as L } from "@okxweb3/coin-cosmos";
12
+ import { AptosWallet as x } from "@okxweb3/coin-aptos";
13
+ import q from "bip39";
14
+ import { Client as M, PrivateKey as u, cryptoUtils as B } from "@hiveio/dhive";
15
+ import { LRUCache as I } from "lru-cache";
16
+ import T from "hivesigner";
17
+ var a = /* @__PURE__ */ ((e) => (e.BTC = "BTC", e.ETH = "ETH", e.APT = "APT", e.ATOM = "ATOM", e.TON = "TON", e.TRON = "TRX", e.SOL = "SOL", e))(a || {}), d = /* @__PURE__ */ ((e) => (e.Points = "POINTS", e.HivePower = "HP", e.Hive = "HIVE", e.HiveDollar = "HBD", e.Spk = "SPK", e))(d || {});
18
+ function Q(e) {
16
19
  return new Promise((t) => setTimeout(t, e));
17
20
  }
18
- function T(e) {
21
+ function P(e) {
19
22
  switch (e) {
20
23
  case a.BTC:
21
- return new C();
24
+ return new _();
22
25
  case a.ETH:
23
- return new H();
26
+ return new j();
24
27
  case a.TRON:
25
- return new N();
28
+ return new D();
26
29
  case a.TON:
27
- return new j();
30
+ return new F();
28
31
  case a.SOL:
29
- return new D();
32
+ return new E();
30
33
  case a.ATOM:
31
- return new x();
32
- case a.APT:
33
34
  return new L();
35
+ case a.APT:
36
+ return new x();
34
37
  default:
35
38
  return;
36
39
  }
37
40
  }
38
- function Pe(e) {
39
- return F(e).toString("hex");
41
+ class W {
42
+ constructor() {
43
+ v(this, "length", 0);
44
+ }
45
+ clear() {
46
+ throw new Error("Method not implemented.");
47
+ }
48
+ getItem(t) {
49
+ return this[t];
50
+ }
51
+ key(t) {
52
+ return Object.keys(this)[t];
53
+ }
54
+ removeItem(t) {
55
+ delete this[t];
56
+ }
57
+ setItem(t, n) {
58
+ this[t] = n;
59
+ }
40
60
  }
41
61
  const p = {
42
62
  privateApiHost: "https://ecency.com",
43
- storage: localStorage,
63
+ storage: typeof window > "u" ? new W() : window.localStorage,
44
64
  storagePrefix: "ecency",
45
- hiveClient: new B(
65
+ hiveClient: new M(
46
66
  [
47
67
  "https://api.hive.blog",
48
68
  "https://api.deathwing.me",
@@ -64,8 +84,8 @@ const p = {
64
84
  ),
65
85
  heliusApiKey: "fb1e2935-f911-4b1d-8e1c-3863f6879d42"
66
86
  };
67
- function Se(e, t) {
68
- return h({
87
+ function ke(e, t) {
88
+ return w({
69
89
  queryKey: ["ecency-wallets", "external-wallet-balance", e, t],
70
90
  queryFn: async () => {
71
91
  switch (e) {
@@ -103,12 +123,12 @@ function Se(e, t) {
103
123
  `https://tonapi.io/v1/blockchain/getAccount?account=${t}`
104
124
  )).json()).balance / 1e9;
105
125
  case a.APT:
106
- const f = (await (await fetch(
126
+ const g = (await (await fetch(
107
127
  `https://fullnode.mainnet.aptoslabs.com/v1/accounts/${t}/resources`
108
128
  )).json()).find(
109
- (k) => k.type.includes("coin::CoinStore")
129
+ (K) => K.type.includes("coin::CoinStore")
110
130
  );
111
- return f ? parseInt(f.data.coin.value) / 1e8 : 0;
131
+ return g ? parseInt(g.data.coin.value) / 1e8 : 0;
112
132
  case a.ATOM:
113
133
  return +(await (await fetch(
114
134
  `https://rest.cosmos.directory/cosmoshub/auth/accounts/${t}`
@@ -117,13 +137,13 @@ function Se(e, t) {
117
137
  }
118
138
  });
119
139
  }
120
- function P(e) {
121
- return h({
140
+ function O(e) {
141
+ return w({
122
142
  queryKey: ["ecency-wallets", "seed", e],
123
- queryFn: async () => _.generateMnemonic(128)
143
+ queryFn: async () => q.generateMnemonic(128)
124
144
  });
125
145
  }
126
- const W = {
146
+ const J = {
127
147
  max: 500,
128
148
  // how long to live in ms
129
149
  ttl: 1e3 * 60 * 5,
@@ -131,12 +151,12 @@ const W = {
131
151
  allowStale: !1,
132
152
  updateAgeOnGet: !1,
133
153
  updateAgeOnHas: !1
134
- }, S = new q(W), w = Symbol("undefined"), I = (e, t) => S.set(e, t === void 0 ? w : t), Q = (e) => {
154
+ }, S = new I(J), m = Symbol("undefined"), $ = (e, t) => S.set(e, t === void 0 ? m : t), G = (e) => {
135
155
  const t = S.get(e);
136
- return t === w ? void 0 : t;
156
+ return t === m ? void 0 : t;
137
157
  };
138
- function Oe(e) {
139
- return h({
158
+ function Ke(e) {
159
+ return w({
140
160
  queryKey: ["ecency-wallets", "coingecko-price", e],
141
161
  queryFn: async () => {
142
162
  let t = e;
@@ -156,11 +176,11 @@ function Oe(e) {
156
176
  default:
157
177
  t = e;
158
178
  }
159
- let n = Q("gecko"), o;
179
+ let n = G("gecko"), o;
160
180
  if (n)
161
181
  o = n;
162
182
  else {
163
- const i = await (await fetch(
183
+ const r = await (await fetch(
164
184
  "https://api.coingecko.com/api/v3/simple/price",
165
185
  {
166
186
  method: "POST",
@@ -172,37 +192,37 @@ function Oe(e) {
172
192
  })
173
193
  }
174
194
  )).json();
175
- I("gecko", i === void 0 ? w : i), o = i;
195
+ $("gecko", r === void 0 ? m : r), o = r;
176
196
  }
177
197
  return 1 / +o[Object.keys(o)[0]].usd;
178
198
  },
179
199
  enabled: !!e
180
200
  });
181
201
  }
182
- function J(e) {
183
- const { data: t } = P(e);
184
- return h({
202
+ function U(e) {
203
+ const { data: t } = O(e);
204
+ return w({
185
205
  queryKey: ["ecencу-wallets", "hive-keys", e, t],
186
206
  queryFn: async () => {
187
207
  if (!t)
188
208
  throw new Error("[Ecency][Wallets] - no seed to create Hive account");
189
- const n = l.fromLogin(e, t, "owner"), o = l.fromLogin(e, t, "active"), s = l.fromLogin(e, t, "posting"), r = l.fromLogin(e, t, "memo");
209
+ const n = u.fromLogin(e, t, "owner"), o = u.fromLogin(e, t, "active"), s = u.fromLogin(e, t, "posting"), i = u.fromLogin(e, t, "memo");
190
210
  return {
191
211
  username: e,
192
212
  owner: n.toString(),
193
213
  active: o.toString(),
194
214
  posting: s.toString(),
195
- memo: r.toString(),
215
+ memo: i.toString(),
196
216
  ownerPubkey: n.createPublic().toString(),
197
217
  activePubkey: o.createPublic().toString(),
198
218
  postingPubkey: s.createPublic().toString(),
199
- memoPubkey: r.createPublic().toString()
219
+ memoPubkey: i.createPublic().toString()
200
220
  };
201
221
  }
202
222
  });
203
223
  }
204
- function Ae(e, t) {
205
- return g({
224
+ function Ce(e, t) {
225
+ return f({
206
226
  queryKey: ["ecency-wallets", "points", e, t],
207
227
  queryFn: async () => await (await fetch(
208
228
  `${p.privateApiHost}/private-api/points`,
@@ -218,8 +238,8 @@ function Ae(e, t) {
218
238
  enabled: !!e
219
239
  });
220
240
  }
221
- function $(e, t) {
222
- return g({
241
+ function V(e, t) {
242
+ return f({
223
243
  queryKey: ["hive-engine", "tokens-list", e, t],
224
244
  queryFn: async () => (await (await fetch(
225
245
  `${p.privateApiHost}/private-api/engine-api`,
@@ -243,18 +263,18 @@ function $(e, t) {
243
263
  )).json()).result
244
264
  });
245
265
  }
246
- function ke(e) {
247
- const { data: t } = h($());
248
- return K(
266
+ function Re(e) {
267
+ const { data: t } = w(V());
268
+ return H(
249
269
  () => {
250
270
  var n;
251
271
  return {
252
272
  basic: [
253
- m.Points,
254
- m.Hive,
255
- m.HivePower,
256
- m.HiveDollar,
257
- m.Spk
273
+ d.Points,
274
+ d.Hive,
275
+ d.HivePower,
276
+ d.HiveDollar,
277
+ d.Spk
258
278
  ].filter((o) => o.toLowerCase().includes(e.toLowerCase())),
259
279
  external: Object.values(a).filter(
260
280
  (o) => o.toLowerCase().includes(e.toLowerCase())
@@ -267,7 +287,7 @@ function ke(e) {
267
287
  [t, e]
268
288
  );
269
289
  }
270
- const G = {
290
+ const z = {
271
291
  [a.BTC]: "m/44'/0'/0'/0/0",
272
292
  // Bitcoin (BIP44)
273
293
  [a.ETH]: "m/44'/60'/0'/0/0",
@@ -283,46 +303,46 @@ const G = {
283
303
  [a.ATOM]: "m/44'/118'/0'/0/0"
284
304
  // Cosmos (BIP44)
285
305
  };
286
- function Ke(e, t) {
287
- const { data: n } = P(e), o = v(), s = u({
306
+ function He(e, t) {
307
+ const { data: n } = O(e), o = b(), s = l({
288
308
  mutationKey: ["ecency-wallets", "create-wallet", e, t],
289
309
  mutationFn: async () => {
290
310
  if (!n)
291
311
  throw new Error("[Ecency][Wallets] - No seed to create a wallet");
292
- const i = T(t), c = await (i == null ? void 0 : i.getDerivedPrivateKey({
312
+ const r = P(t), c = await (r == null ? void 0 : r.getDerivedPrivateKey({
293
313
  mnemonic: n,
294
- hdPath: G[t]
314
+ hdPath: z[t]
295
315
  }));
296
- await M(1e3);
297
- const d = await (i == null ? void 0 : i.getNewAddress({
316
+ await Q(1e3);
317
+ const h = await (r == null ? void 0 : r.getNewAddress({
298
318
  privateKey: c
299
319
  }));
300
320
  return {
301
321
  privateKey: c,
302
- address: d.address,
303
- publicKey: d.publicKey,
322
+ address: h.address,
323
+ publicKey: h.publicKey,
304
324
  username: e,
305
325
  currency: t
306
326
  };
307
327
  },
308
- onSuccess: (i) => {
328
+ onSuccess: (r) => {
309
329
  o.setQueryData(
310
- ["ecency-wallets", "wallets", i.username],
311
- (c) => new Map(c ? Array.from(c.entries()) : []).set(i.currency, i)
330
+ ["ecency-wallets", "wallets", r.username],
331
+ (c) => new Map(c ? Array.from(c.entries()) : []).set(r.currency, r)
312
332
  );
313
333
  }
314
- }), r = R(() => {
334
+ }), i = N(() => {
315
335
  }, []);
316
336
  return {
317
337
  createWallet: s,
318
- importWallet: r
338
+ importWallet: i
319
339
  };
320
340
  }
321
- function V(e) {
322
- const { data: t } = h({
341
+ function X(e) {
342
+ const { data: t } = w({
323
343
  queryKey: ["ecency-wallets", "wallets", e]
324
- }), { data: n } = J(e);
325
- return u({
344
+ }), { data: n } = U(e);
345
+ return l({
326
346
  mutationKey: ["ecency-wallets", "create-account-with-wallets", e],
327
347
  mutationFn: ({ currency: o, address: s }) => fetch(p.privateApiHost + "/private-api/wallets-add", {
328
348
  method: "POST",
@@ -339,9 +359,9 @@ function V(e) {
339
359
  postingPublicKey: n == null ? void 0 : n.postingPubkey,
340
360
  memoPublicKey: n == null ? void 0 : n.memoPubkey,
341
361
  ...Array.from((t == null ? void 0 : t.entries()) ?? []).reduce(
342
- (r, [i, c]) => ({
343
- ...r,
344
- [i]: c.address
362
+ (i, [r, c]) => ({
363
+ ...i,
364
+ [r]: c.address
345
365
  }),
346
366
  {}
347
367
  )
@@ -350,8 +370,8 @@ function V(e) {
350
370
  })
351
371
  });
352
372
  }
353
- function O() {
354
- return u({
373
+ function A() {
374
+ return l({
355
375
  mutationKey: ["ecency-wallets", "check-wallet-existence"],
356
376
  mutationFn: async ({ address: e, currency: t }) => (await (await fetch(
357
377
  p.privateApiHost + "/private-api/wallets-exist",
@@ -368,11 +388,11 @@ function O() {
368
388
  )).json()).length === 0
369
389
  });
370
390
  }
371
- const Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
391
+ const Ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
372
392
  __proto__: null,
373
- useCheckWalletExistence: O,
374
- useCreateAccountWithWallets: V
375
- }, Symbol.toStringTag, { value: "Module" })), U = {
393
+ useCheckWalletExistence: A,
394
+ useCreateAccountWithWallets: X
395
+ }, Symbol.toStringTag, { value: "Module" })), Y = {
376
396
  [a.BTC]: ["m/84'/0'/0'/0/0"],
377
397
  [a.ETH]: ["m/84'/60'/0'/0/0"],
378
398
  // its not working for Trust, Exodus, todo: check others below
@@ -383,37 +403,37 @@ const Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
383
403
  // Disabled
384
404
  [a.ATOM]: ["m/84'/118'/0'/0'/0"]
385
405
  };
386
- async function z(e, t, n) {
387
- for (const o of U[n] || [])
406
+ async function Z(e, t, n) {
407
+ for (const o of Y[n] || [])
388
408
  try {
389
409
  const s = await t.getDerivedPrivateKey({
390
410
  mnemonic: e,
391
411
  hdPath: o
392
- }), r = await t.getNewAddress({
412
+ }), i = await t.getNewAddress({
393
413
  privateKey: s,
394
414
  addressType: n === a.BTC ? "segwit_native" : void 0
395
415
  });
396
- return [s.toString(), r.address];
416
+ return [s.toString(), i.address];
397
417
  } catch {
398
418
  return [];
399
419
  }
400
420
  return [];
401
421
  }
402
- function Ce(e, t) {
403
- const n = v(), { mutateAsync: o } = O();
404
- return u({
422
+ function _e(e, t) {
423
+ const n = b(), { mutateAsync: o } = A();
424
+ return l({
405
425
  mutationKey: ["ecency-wallets", "import-wallet", e, t],
406
426
  mutationFn: async ({ privateKeyOrSeed: s }) => {
407
- const r = T(t);
408
- if (!r)
427
+ const i = P(t);
428
+ if (!i)
409
429
  throw new Error("Cannot find token for this currency");
410
- const i = s.split(" ").length === 12;
411
- let c, d = s;
412
- if (i ? [d, c] = await z(
430
+ const r = s.split(" ").length === 12;
431
+ let c, h = s;
432
+ if (r ? [h, c] = await Z(
413
433
  s,
414
- r,
434
+ i,
415
435
  t
416
- ) : c = (await r.getNewAddress({
436
+ ) : c = (await i.getNewAddress({
417
437
  privateKey: s
418
438
  })).address, !c || !s)
419
439
  throw new Error(
@@ -427,18 +447,18 @@ function Ce(e, t) {
427
447
  "This wallet has already in use by Hive account. Please, try another one"
428
448
  );
429
449
  return {
430
- privateKey: d,
450
+ privateKey: h,
431
451
  address: c,
432
452
  publicKey: ""
433
453
  };
434
454
  },
435
- onSuccess: ({ privateKey: s, publicKey: r, address: i }) => {
455
+ onSuccess: ({ privateKey: s, publicKey: i, address: r }) => {
436
456
  n.setQueryData(
437
457
  ["ecency-wallets", "wallets", e],
438
458
  (c) => new Map(c ? Array.from(c.entries()) : []).set(t, {
439
459
  privateKey: s,
440
- publicKey: r,
441
- address: i,
460
+ publicKey: i,
461
+ address: r,
442
462
  username: e,
443
463
  currency: t,
444
464
  custom: !0
@@ -447,7 +467,7 @@ function Ce(e, t) {
447
467
  }
448
468
  });
449
469
  }
450
- function X(e) {
470
+ function ee(e) {
451
471
  let t = atob(e);
452
472
  if (t[0] === "{")
453
473
  return JSON.parse(t);
@@ -457,32 +477,32 @@ const y = (e) => {
457
477
  const t = p.storage.getItem(
458
478
  p.storagePrefix + "_user_" + e
459
479
  );
460
- return X(JSON.parse(t));
480
+ return ee(JSON.parse(t));
461
481
  } catch (t) {
462
482
  console.error(t);
463
483
  return;
464
484
  }
465
- }, Y = (e) => y(e) && y(e).accessToken, Z = (e) => y(e) && y(e).postingKey;
466
- function ee(e = [], t, n) {
467
- return u({
485
+ }, te = (e) => y(e) && y(e).accessToken, ne = (e) => y(e) && y(e).postingKey;
486
+ function oe(e = [], t, n) {
487
+ return l({
468
488
  mutationKey: [...e, t],
469
489
  mutationFn: async (o) => {
470
490
  if (!t)
471
491
  throw new Error(
472
492
  "[Core][Broadcast] Attempted to call broadcast API with anon user"
473
493
  );
474
- const s = Z(t);
494
+ const s = ne(t);
475
495
  if (s) {
476
- const i = l.fromString(s);
496
+ const r = u.fromString(s);
477
497
  return p.hiveClient.broadcast.sendOperations(
478
498
  n(o),
479
- i
499
+ r
480
500
  );
481
501
  }
482
- let r = Y(t);
483
- if (r)
484
- return (await new b.Client({
485
- accessToken: r
502
+ let i = te(t);
503
+ if (i)
504
+ return (await new T.Client({
505
+ accessToken: i
486
506
  }).broadcast(n(o))).result;
487
507
  throw new Error(
488
508
  "[SDK][Broadcast] – cannot broadcast w/o posting key or token"
@@ -490,8 +510,8 @@ function ee(e = [], t, n) {
490
510
  }
491
511
  });
492
512
  }
493
- function te(e) {
494
- return ee(
513
+ function ae(e) {
514
+ return oe(
495
515
  ["accounts", "update"],
496
516
  e,
497
517
  ({
@@ -513,9 +533,58 @@ function te(e) {
513
533
  ]
514
534
  );
515
535
  }
516
- function He(e) {
517
- const { mutateAsync: t } = te(e);
518
- return u({
536
+ function je(e) {
537
+ return f({
538
+ queryKey: ["get-account-full", e],
539
+ queryFn: async () => {
540
+ if (!e)
541
+ throw new Error("[SDK] Username is empty");
542
+ const t = await p.hiveClient.database.getAccounts([e]);
543
+ if (!t[0])
544
+ throw new Error("[SDK] No account with given username");
545
+ const n = JSON.parse(t[0].posting_json_metadata).profile;
546
+ let o;
547
+ try {
548
+ o = await p.hiveClient.database.call(
549
+ "get_follow_count",
550
+ [e]
551
+ );
552
+ } catch {
553
+ }
554
+ const s = await p.hiveClient.call(
555
+ "condenser_api",
556
+ "get_account_reputations",
557
+ [e, 1]
558
+ );
559
+ return {
560
+ ...t,
561
+ follow_stats: o,
562
+ reputation: s[0].reputation,
563
+ profile: {
564
+ ...n,
565
+ reputation: s[0].reputation
566
+ }
567
+ };
568
+ },
569
+ enabled: !!e,
570
+ staleTime: 6e4
571
+ });
572
+ }
573
+ function De(e, t = 5, n = []) {
574
+ return f({
575
+ queryKey: ["accounts", "search", e, n],
576
+ enabled: !!e,
577
+ queryFn: async () => (await p.hiveClient.database.call(
578
+ "lookup_accounts",
579
+ [e, t]
580
+ )).filter(
581
+ (s) => n.length > 0 ? !n.includes(s) : !0
582
+ )
583
+ });
584
+ }
585
+ function Fe(e) {
586
+ const { mutateAsync: t } = ae(e);
587
+ return l({
519
588
  mutationKey: ["ecency-wallets", "save-wallet-to-metadata", e],
520
589
  mutationFn: ({
521
590
  wallets: n
@@ -531,8 +600,8 @@ function He(e) {
531
600
  })
532
601
  });
533
602
  }
534
- function Ne(e) {
535
- return u({
603
+ function Ee(e) {
604
+ return l({
536
605
  mutationKey: ["operations", "sign", e],
537
606
  mutationFn: ({
538
607
  operation: t,
@@ -541,62 +610,61 @@ function Ne(e) {
541
610
  if (!e)
542
611
  throw new Error("[Operations][Sign] – cannot sign op with anon user");
543
612
  let o;
544
- return n.split(" ").length === 12 ? o = l.fromLogin(e, n, "active") : E.isWif(n) ? o = l.fromString(n) : o = l.from(n), p.hiveClient.broadcast.sendOperations(
613
+ return n.split(" ").length === 12 ? o = u.fromLogin(e, n, "active") : B.isWif(n) ? o = u.fromString(n) : o = u.from(n), p.hiveClient.broadcast.sendOperations(
545
614
  [t],
546
615
  o
547
616
  );
548
617
  }
549
618
  });
550
619
  }
551
- const ne = (e, t, n, o = null) => new Promise((s, r) => {
552
- var i;
553
- (i = window.hive_keychain) == null || i.requestBroadcast(
620
+ const se = (e, t, n, o = null) => new Promise((s, i) => {
621
+ var r;
622
+ (r = window.hive_keychain) == null || r.requestBroadcast(
554
623
  e,
555
624
  t,
556
625
  n,
557
626
  (c) => {
558
- c.success || r({ message: "Operation cancelled" }), s(c);
627
+ c.success || i({ message: "Operation cancelled" }), s(c);
559
628
  },
560
629
  o
561
630
  );
562
631
  });
563
- function je(e, t = "Active") {
564
- return u({
632
+ function Le(e, t = "Active") {
633
+ return l({
565
634
  mutationKey: ["operations", "sign-keychain", e],
566
635
  mutationFn: ({ operation: n }) => {
567
636
  if (!e)
568
637
  throw new Error(
569
638
  "[SDK][Keychain] – cannot sign operation with anon user"
570
639
  );
571
- return ne(e, [n], t);
640
+ return se(e, [n], t);
572
641
  }
573
642
  });
574
643
  }
575
- function De(e = "/") {
576
- return u({
644
+ function xe(e = "/") {
645
+ return l({
577
646
  mutationKey: ["operations", "sign-hivesigner", e],
578
- mutationFn: async ({ operation: t }) => b.sendOperation(t, { callback: e }, () => {
647
+ mutationFn: async ({ operation: t }) => T.sendOperation(t, { callback: e }, () => {
579
648
  })
580
649
  });
581
650
  }
582
651
  export {
583
- m as EcencyWalletBasicTokens,
652
+ d as EcencyWalletBasicTokens,
584
653
  a as EcencyWalletCurrency,
585
- Re as EcencyWalletsPrivateApi,
586
- M as delay,
587
- Ae as getAccountPointsQueryOptions,
588
- T as getWallet,
589
- Pe as mnemonicToSeedBip39,
590
- te as useAccountUpdate,
591
- Oe as useCoinGeckoPriceQuery,
592
- ke as useGetAllTokensListQuery,
593
- Se as useGetExternalWalletBalanceQuery,
594
- J as useHiveKeysQuery,
595
- Ce as useImportWallet,
596
- He as useSaveWalletInformationToMetadata,
597
- P as useSeedPhrase,
598
- De as useSignOperationByHivesigner,
599
- Ne as useSignOperationByKey,
600
- je as useSignOperationByKeychain,
601
- Ke as useWalletCreate
654
+ Ne as EcencyWalletsPrivateApi,
655
+ je as getAccountFullQueryOptions,
656
+ Ce as getAccountPointsQueryOptions,
657
+ De as getSearchAccountsByUsernameQueryOptions,
658
+ ae as useAccountUpdate,
659
+ Ke as useCoinGeckoPriceQuery,
660
+ Re as useGetAllTokensListQuery,
661
+ ke as useGetExternalWalletBalanceQuery,
662
+ U as useHiveKeysQuery,
663
+ _e as useImportWallet,
664
+ Fe as useSaveWalletInformationToMetadata,
665
+ O as useSeedPhrase,
666
+ xe as useSignOperationByHivesigner,
667
+ Ee as useSignOperationByKey,
668
+ Le as useSignOperationByKeychain,
669
+ He as useWalletCreate
602
670
  };
@@ -1 +1,2 @@
1
1
  export * from './mutations';
2
+ export * from './queries';
@@ -1 +1,2 @@
1
1
  export * from './get-account-full-query-options';
2
+ export * from './search-accounts-by-username-query-options';
@@ -1,5 +1,4 @@
1
1
  export * from './enums';
2
2
  export * from './mutations';
3
- export * from './utils';
4
3
  export * from './queries';
5
4
  export * from './types';
@@ -0,0 +1,9 @@
1
+ export declare class MockStorage implements Storage {
2
+ [name: string]: any;
3
+ length: number;
4
+ clear(): void;
5
+ getItem(key: string): string | null;
6
+ key(index: number): string | null;
7
+ removeItem(key: string): void;
8
+ setItem(key: string, value: string): void;
9
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "1.0.23",
4
+ "version": "1.0.25",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",