@ecency/wallets 1.4.12 → 1.4.15

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.
@@ -818,7 +818,6 @@ declare function vestsToHp(vests: number, hivePerMVests: number): number;
818
818
  declare function rewardSpk(data: SpkApiWallet, sstats: any): number;
819
819
 
820
820
  interface SpkTransferPayload<T extends HiveBasedAssetSignType> {
821
- id: string;
822
821
  from: string;
823
822
  to: string;
824
823
  amount: string;
@@ -849,6 +848,17 @@ declare function powerUpLarynx<T extends HiveBasedAssetSignType>(payload: T exte
849
848
  key: PrivateKey;
850
849
  } : SpkPowerPayload<T>): Promise<unknown>;
851
850
 
851
+ interface LarynxTransferPayload<T extends HiveBasedAssetSignType> {
852
+ from: string;
853
+ to: string;
854
+ amount: string;
855
+ memo?: string;
856
+ type: T;
857
+ }
858
+ declare function transferLarynx<T extends HiveBasedAssetSignType>(payload: T extends "key" ? LarynxTransferPayload<T> & {
859
+ key: PrivateKey;
860
+ } : LarynxTransferPayload<T>): Promise<unknown>;
861
+
852
862
  declare function getLarynxAssetGeneralInfoQueryOptions(username: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<{
853
863
  name: string;
854
864
  title: string;
@@ -1660,4 +1670,4 @@ declare function buildExternalTx(currency: EcencyWalletCurrency, tx: ExternalTxP
1660
1670
 
1661
1671
  declare function getBoundFetch(): typeof fetch;
1662
1672
 
1663
- export { type AccountPointsResponse, type Asset, AssetOperation, type DelegateEnginePayload, type EcencyHiveKeys, type EcencyTokenMetadata, EcencyWalletBasicTokens, EcencyWalletCurrency, index as EcencyWalletsPrivateApi, type ExternalTxParams, type ExternalWalletBalance, type GeneralAssetInfo, type GeneralAssetTransaction, type HiveBasedAssetSignType, type HiveEngineMarketResponse, type HiveEngineMetric, type HiveEngineTokenBalance, type HiveEngineTokenMetadataResponse, type HiveEngineTransaction, type HiveKeyDerivation, type HiveRole, NaiMap, type PointTransaction, PointTransactionType, type Points, type PointsResponse, type SpkApiWallet, type SpkMarkets, type StakeEnginePayload, Symbol, type TransferEnginePayload, type TransferPayload, type TransformedSpkMarkets, type UndelegateEnginePayload, type UnstakeEnginePayload, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferHive, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
1673
+ export { type AccountPointsResponse, type Asset, AssetOperation, type DelegateEnginePayload, type EcencyHiveKeys, type EcencyTokenMetadata, EcencyWalletBasicTokens, EcencyWalletCurrency, index as EcencyWalletsPrivateApi, type ExternalTxParams, type ExternalWalletBalance, type GeneralAssetInfo, type GeneralAssetTransaction, type HiveBasedAssetSignType, type HiveEngineMarketResponse, type HiveEngineMetric, type HiveEngineTokenBalance, type HiveEngineTokenMetadataResponse, type HiveEngineTransaction, type HiveKeyDerivation, type HiveRole, NaiMap, type PointTransaction, PointTransactionType, type Points, type PointsResponse, type SpkApiWallet, type SpkMarkets, type StakeEnginePayload, Symbol, type TransferEnginePayload, type TransferPayload, type TransformedSpkMarkets, type UndelegateEnginePayload, type UnstakeEnginePayload, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
@@ -1322,11 +1322,11 @@ var AssetOperation = /* @__PURE__ */ ((AssetOperation2) => {
1322
1322
  async function transferSpk(payload) {
1323
1323
  const json = JSON.stringify({
1324
1324
  to: payload.to,
1325
- amount: +payload.amount * 1e3,
1325
+ amount: parseAsset(payload.amount).amount * 1e3,
1326
1326
  ...typeof payload.memo === "string" ? { memo: payload.memo } : {}
1327
1327
  });
1328
1328
  const op = {
1329
- id: payload.id,
1329
+ id: "spkcc_spk_send",
1330
1330
  json,
1331
1331
  required_auths: [payload.from],
1332
1332
  required_posting_auths: []
@@ -1337,7 +1337,7 @@ async function transferSpk(payload) {
1337
1337
  } else if (payload.type === "keychain") {
1338
1338
  return Keychain.customJson(
1339
1339
  payload.from,
1340
- payload.id,
1340
+ "spkcc_spk_send",
1341
1341
  "Active",
1342
1342
  json,
1343
1343
  payload.to
@@ -1350,7 +1350,7 @@ async function transferSpk(payload) {
1350
1350
  authority: "active",
1351
1351
  required_auths: `["${payload.from}"]`,
1352
1352
  required_posting_auths: "[]",
1353
- id: payload.id,
1353
+ id: "spkcc_spk_send",
1354
1354
  json: JSON.stringify({
1355
1355
  to: payload.to,
1356
1356
  amount: +amount * 1e3,
@@ -1429,6 +1429,48 @@ async function powerUpLarynx(payload) {
1429
1429
  );
1430
1430
  }
1431
1431
  }
1432
+ async function transferLarynx(payload) {
1433
+ const json = JSON.stringify({
1434
+ to: payload.to,
1435
+ amount: parseAsset(payload.amount).amount * 1e3,
1436
+ ...typeof payload.memo === "string" ? { memo: payload.memo } : {}
1437
+ });
1438
+ const op = {
1439
+ id: "spkcc_send",
1440
+ json,
1441
+ required_auths: [payload.from],
1442
+ required_posting_auths: []
1443
+ };
1444
+ if (payload.type === "key" && "key" in payload) {
1445
+ const { key } = payload;
1446
+ return CONFIG.hiveClient.broadcast.json(op, key);
1447
+ } else if (payload.type === "keychain") {
1448
+ return Keychain.customJson(
1449
+ payload.from,
1450
+ "spkcc_send",
1451
+ "Active",
1452
+ json,
1453
+ payload.to
1454
+ );
1455
+ } else {
1456
+ const { amount } = parseAsset(payload.amount);
1457
+ return hs.sign(
1458
+ "custom_json",
1459
+ {
1460
+ authority: "active",
1461
+ required_auths: `["${payload.from}"]`,
1462
+ required_posting_auths: "[]",
1463
+ id: "spkcc_send",
1464
+ json: JSON.stringify({
1465
+ to: payload.to,
1466
+ amount: +amount * 1e3,
1467
+ ...typeof payload.memo === "string" ? { memo: payload.memo } : {}
1468
+ })
1469
+ },
1470
+ `https://ecency.com/@${payload.from}/wallet`
1471
+ );
1472
+ }
1473
+ }
1432
1474
  function getSpkMarketsQueryOptions() {
1433
1475
  return queryOptions({
1434
1476
  queryKey: ["assets", "spk", "markets"],
@@ -1650,34 +1692,6 @@ function getHiveEngineTokensMetadataQueryOptions(tokens) {
1650
1692
  }
1651
1693
  });
1652
1694
  }
1653
-
1654
- // src/modules/wallets/consts/hive-engine-tokens.ts
1655
- var HiveEngineTokens = [
1656
- "LEO",
1657
- "ARCHON",
1658
- "WAIV",
1659
- "CHOISM",
1660
- "CCC",
1661
- "POB",
1662
- "PHOTO",
1663
- "LUV",
1664
- "ALIVE",
1665
- "LOLZ",
1666
- "CENT",
1667
- "FUN",
1668
- "VYB",
1669
- "VKBT",
1670
- "BUIDL",
1671
- "NEOXAG",
1672
- "BEE",
1673
- "PIMP",
1674
- "PEPE",
1675
- "PAY",
1676
- "SPT",
1677
- "ONEUP",
1678
- "SPORTS",
1679
- "CURE"
1680
- ];
1681
1695
  function getHiveEngineTokensBalancesQueryOptions(username) {
1682
1696
  return queryOptions({
1683
1697
  queryKey: ["assets", "hive-engine", "balances", username],
@@ -1750,20 +1764,21 @@ function getHiveEngineTokenGeneralInfoQueryOptions(username, symbol) {
1750
1764
  "[SDK][Wallets] \u2013 hive engine token or username missed"
1751
1765
  );
1752
1766
  }
1767
+ const queryClient = getQueryClient();
1753
1768
  const hiveQuery = getHiveAssetGeneralInfoQueryOptions(username);
1754
- await getQueryClient().prefetchQuery(hiveQuery);
1755
- const hiveData = getQueryClient().getQueryData(
1769
+ await queryClient.prefetchQuery(hiveQuery);
1770
+ const hiveData = queryClient.getQueryData(
1756
1771
  hiveQuery.queryKey
1757
1772
  );
1758
- const metadataQuery = getHiveEngineTokensMetadataQueryOptions(HiveEngineTokens);
1759
- await getQueryClient().prefetchQuery(metadataQuery);
1760
- const metadataList = getQueryClient().getQueryData(metadataQuery.queryKey);
1761
- const balancesQuery = getHiveEngineTokensBalancesQueryOptions(username);
1762
- await getQueryClient().prefetchQuery(balancesQuery);
1763
- const balanceList = getQueryClient().getQueryData(balancesQuery.queryKey);
1764
- const marketQuery = getHiveEngineTokensMarketQueryOptions();
1765
- await getQueryClient().prefetchQuery(marketQuery);
1766
- const marketList = getQueryClient().getQueryData(marketQuery.queryKey);
1773
+ const metadataList = await queryClient.ensureQueryData(
1774
+ getHiveEngineTokensMetadataQueryOptions([symbol])
1775
+ );
1776
+ const balanceList = await queryClient.ensureQueryData(
1777
+ getHiveEngineTokensBalancesQueryOptions(username)
1778
+ );
1779
+ const marketList = await queryClient.ensureQueryData(
1780
+ getHiveEngineTokensMarketQueryOptions()
1781
+ );
1767
1782
  const metadata = metadataList?.find((i) => i.symbol === symbol);
1768
1783
  const balance = balanceList?.find((i) => i.symbol === symbol);
1769
1784
  const market = marketList?.find((i) => i.symbol === symbol);
@@ -2886,15 +2901,14 @@ function getTronAssetGeneralInfoQueryOptions(username) {
2886
2901
 
2887
2902
  // src/modules/wallets/queries/get-account-wallet-asset-info-query-options.ts
2888
2903
  function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { refetch: false }) {
2904
+ const queryClient = getQueryClient();
2889
2905
  const fetchQuery = async (queryOptions39) => {
2890
2906
  if (options2.refetch) {
2891
- await getQueryClient().fetchQuery(queryOptions39);
2907
+ await queryClient.fetchQuery(queryOptions39);
2892
2908
  } else {
2893
- await getQueryClient().prefetchQuery(queryOptions39);
2909
+ await queryClient.prefetchQuery(queryOptions39);
2894
2910
  }
2895
- return getQueryClient().getQueryData(
2896
- queryOptions39.queryKey
2897
- );
2911
+ return queryClient.getQueryData(queryOptions39.queryKey);
2898
2912
  };
2899
2913
  return queryOptions({
2900
2914
  queryKey: ["ecency-wallets", "asset-info", username, asset],
@@ -2927,7 +2941,11 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
2927
2941
  return fetchQuery(getTonAssetGeneralInfoQueryOptions(username));
2928
2942
  } else if (asset === "TRX") {
2929
2943
  return fetchQuery(getTronAssetGeneralInfoQueryOptions(username));
2930
- } else if (HiveEngineTokens.includes(asset)) {
2944
+ }
2945
+ const balances = await queryClient.ensureQueryData(
2946
+ getHiveEngineTokensBalancesQueryOptions(username)
2947
+ );
2948
+ if (balances.some((balance) => balance.symbol === asset)) {
2931
2949
  return await fetchQuery(
2932
2950
  getHiveEngineTokenGeneralInfoQueryOptions(username, asset)
2933
2951
  );
@@ -3381,6 +3399,7 @@ var operationToFunctionMap = {
3381
3399
  ["transfer" /* Transfer */]: transferSpk
3382
3400
  },
3383
3401
  LARYNX: {
3402
+ ["transfer" /* Transfer */]: transferLarynx,
3384
3403
  ["lock" /* LockLiquidity */]: lockLarynx,
3385
3404
  ["power-up" /* PowerUp */]: powerUpLarynx
3386
3405
  }
@@ -3435,6 +3454,6 @@ function useWalletOperation(username, asset, operation) {
3435
3454
  // src/index.ts
3436
3455
  rememberScryptBsvVersion();
3437
3456
 
3438
- export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, NaiMap, PointTransactionType, Symbol2 as Symbol, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferHive, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
3457
+ export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, NaiMap, PointTransactionType, Symbol2 as Symbol, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
3439
3458
  //# sourceMappingURL=index.js.map
3440
3459
  //# sourceMappingURL=index.js.map