@ecency/sdk 1.0.21 → 1.0.23

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,5 +1,5 @@
1
1
  import { useMemo as K, useCallback as R } from "react";
2
- import { useQuery as m, queryOptions as g, useQueryClient as v, useMutation as u } from "@tanstack/react-query";
2
+ import { useQuery as h, queryOptions as g, useQueryClient as v, useMutation as u } from "@tanstack/react-query";
3
3
  import { BtcWallet as C } from "@okxweb3/coin-bitcoin";
4
4
  import { EthWallet as H } from "@okxweb3/coin-ethereum";
5
5
  import { TrxWallet as N } from "@okxweb3/coin-tron";
@@ -11,7 +11,7 @@ import _, { mnemonicToSeedSync as F } from "bip39";
11
11
  import { Client as B, PrivateKey as l, cryptoUtils as E } from "@hiveio/dhive";
12
12
  import { LRUCache as q } from "lru-cache";
13
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 || {}), h = /* @__PURE__ */ ((e) => (e.Points = "POINTS", e.HivePower = "HP", e.Hive = "HIVE", e.HiveDollar = "HBD", e.Spk = "SPK", e))(h || {});
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
15
  function M(e) {
16
16
  return new Promise((t) => setTimeout(t, e));
17
17
  }
@@ -65,7 +65,7 @@ const p = {
65
65
  heliusApiKey: "fb1e2935-f911-4b1d-8e1c-3863f6879d42"
66
66
  };
67
67
  function Se(e, t) {
68
- return m({
68
+ return h({
69
69
  queryKey: ["ecency-wallets", "external-wallet-balance", e, t],
70
70
  queryFn: async () => {
71
71
  switch (e) {
@@ -118,7 +118,7 @@ function Se(e, t) {
118
118
  });
119
119
  }
120
120
  function P(e) {
121
- return m({
121
+ return h({
122
122
  queryKey: ["ecency-wallets", "seed", e],
123
123
  queryFn: async () => _.generateMnemonic(128)
124
124
  });
@@ -131,12 +131,12 @@ const W = {
131
131
  allowStale: !1,
132
132
  updateAgeOnGet: !1,
133
133
  updateAgeOnHas: !1
134
- }, S = new q(W), y = Symbol("undefined"), Q = (e, t) => S.set(e, t === void 0 ? y : t), I = (e) => {
134
+ }, S = new q(W), w = Symbol("undefined"), I = (e, t) => S.set(e, t === void 0 ? w : t), Q = (e) => {
135
135
  const t = S.get(e);
136
- return t === y ? void 0 : t;
136
+ return t === w ? void 0 : t;
137
137
  };
138
138
  function Oe(e) {
139
- return m({
139
+ return h({
140
140
  queryKey: ["ecency-wallets", "coingecko-price", e],
141
141
  queryFn: async () => {
142
142
  let t = e;
@@ -156,7 +156,7 @@ function Oe(e) {
156
156
  default:
157
157
  t = e;
158
158
  }
159
- let n = I("gecko"), o;
159
+ let n = Q("gecko"), o;
160
160
  if (n)
161
161
  o = n;
162
162
  else {
@@ -172,7 +172,7 @@ function Oe(e) {
172
172
  })
173
173
  }
174
174
  )).json();
175
- Q("gecko", i === void 0 ? y : i), o = i;
175
+ I("gecko", i === void 0 ? w : i), o = i;
176
176
  }
177
177
  return 1 / +o[Object.keys(o)[0]].usd;
178
178
  },
@@ -181,7 +181,7 @@ function Oe(e) {
181
181
  }
182
182
  function J(e) {
183
183
  const { data: t } = P(e);
184
- return m({
184
+ return h({
185
185
  queryKey: ["ecencу-wallets", "hive-keys", e, t],
186
186
  queryFn: async () => {
187
187
  if (!t)
@@ -244,17 +244,17 @@ function $(e, t) {
244
244
  });
245
245
  }
246
246
  function ke(e) {
247
- const { data: t } = m($());
247
+ const { data: t } = h($());
248
248
  return K(
249
249
  () => {
250
250
  var n;
251
251
  return {
252
252
  basic: [
253
- h.Points,
254
- h.Hive,
255
- h.HivePower,
256
- h.HiveDollar,
257
- h.Spk
253
+ m.Points,
254
+ m.Hive,
255
+ m.HivePower,
256
+ m.HiveDollar,
257
+ m.Spk
258
258
  ].filter((o) => o.toLowerCase().includes(e.toLowerCase())),
259
259
  external: Object.values(a).filter(
260
260
  (o) => o.toLowerCase().includes(e.toLowerCase())
@@ -319,7 +319,7 @@ function Ke(e, t) {
319
319
  };
320
320
  }
321
321
  function V(e) {
322
- const { data: t } = m({
322
+ const { data: t } = h({
323
323
  queryKey: ["ecency-wallets", "wallets", e]
324
324
  }), { data: n } = J(e);
325
325
  return u({
@@ -452,7 +452,7 @@ function X(e) {
452
452
  if (t[0] === "{")
453
453
  return JSON.parse(t);
454
454
  }
455
- const w = (e) => {
455
+ const y = (e) => {
456
456
  try {
457
457
  const t = p.storage.getItem(
458
458
  p.storagePrefix + "_user_" + e
@@ -462,7 +462,7 @@ const w = (e) => {
462
462
  console.error(t);
463
463
  return;
464
464
  }
465
- }, Y = (e) => w(e) && w(e).accessToken, Z = (e) => w(e) && w(e).postingKey;
465
+ }, Y = (e) => y(e) && y(e).accessToken, Z = (e) => y(e) && y(e).postingKey;
466
466
  function ee(e = [], t, n) {
467
467
  return u({
468
468
  mutationKey: [...e, t],
@@ -494,14 +494,18 @@ function te(e) {
494
494
  return ee(
495
495
  ["accounts", "update"],
496
496
  e,
497
- (t) => [
497
+ ({
498
+ profile: t,
499
+ tokens: n
500
+ }) => [
498
501
  [
499
502
  "account_update2",
500
503
  {
501
504
  account: e,
502
505
  json_metadata: "",
503
506
  posting_json_metadata: JSON.stringify({
504
- profile: { ...t, version: 2 }
507
+ profile: { ...t, version: 2 },
508
+ tokens: n
505
509
  }),
506
510
  extensions: []
507
511
  }
@@ -515,15 +519,16 @@ function He(e) {
515
519
  mutationKey: ["ecency-wallets", "save-wallet-to-metadata", e],
516
520
  mutationFn: ({
517
521
  wallets: n
518
- }) => t(
519
- Array.from(n.entries() ?? []).reduce(
520
- (o, [s, r]) => ({
521
- ...o,
522
- [s]: r.address
523
- }),
524
- {}
525
- )
526
- )
522
+ }) => t({
523
+ profile: {},
524
+ tokens: Array.from(n.entries() ?? []).map(([o, s]) => ({
525
+ symbol: o,
526
+ type: "CHAIN",
527
+ meta: {
528
+ address: s.address
529
+ }
530
+ }))
531
+ })
527
532
  });
528
533
  }
529
534
  function Ne(e) {
@@ -575,7 +580,7 @@ function De(e = "/") {
575
580
  });
576
581
  }
577
582
  export {
578
- h as EcencyWalletBasicTokens,
583
+ m as EcencyWalletBasicTokens,
579
584
  a as EcencyWalletCurrency,
580
585
  Re as EcencyWalletsPrivateApi,
581
586
  M as delay,
@@ -1 +1,9 @@
1
- export declare function useAccountUpdate(username: string): import('@tanstack/react-query').UseMutationResult<any, Error, any, unknown>;
1
+ export declare function useAccountUpdate(username: string): import('@tanstack/react-query').UseMutationResult<any, Error, {
2
+ profile: Record<string, any>;
3
+ tokens: {
4
+ symbol: string;
5
+ meta: {
6
+ address: string;
7
+ };
8
+ }[];
9
+ }, unknown>;
@@ -1,2 +1,9 @@
1
1
  import { EcencyWalletBasicTokens } from '../enums';
2
- export declare function useGetAccountWalletListQuery(username: string): import('@tanstack/react-query').UseQueryResult<EcencyWalletBasicTokens[], Error>;
2
+ export declare function getAccountWalletListQueryOptions(username: string): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<EcencyWalletBasicTokens[], Error, EcencyWalletBasicTokens[], string[]>, "queryFn"> & {
3
+ queryFn?: import('@tanstack/query-core').QueryFunction<EcencyWalletBasicTokens[], string[], never> | undefined;
4
+ } & {
5
+ queryKey: string[] & {
6
+ [dataTagSymbol]: EcencyWalletBasicTokens[];
7
+ [dataTagErrorSymbol]: Error;
8
+ };
9
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "1.0.21",
4
+ "version": "1.0.23",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",