@ecency/wallets 1.4.20 → 1.4.22

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.
@@ -898,50 +898,67 @@ var HIVE_ACCOUNT_OPERATION_GROUPS = {
898
898
  ops.comment_benefactor_reward,
899
899
  ops.liquidity_reward,
900
900
  ops.proposal_pay
901
- ]};
901
+ ],
902
+ "": []
903
+ };
904
+ var HIVE_OPERATION_LIST = Object.keys(
905
+ utils.operationOrders
906
+ );
907
+ var operationOrders = utils.operationOrders;
908
+ var HIVE_OPERATION_ORDERS = operationOrders;
909
+ var HIVE_OPERATION_NAME_BY_ID = Object.entries(operationOrders).reduce((acc, [name, id]) => {
910
+ acc[id] = name;
911
+ return acc;
912
+ }, {});
902
913
 
903
914
  // src/modules/assets/hive/queries/get-hive-asset-transactions-query-options.ts
904
- function getHiveAssetTransactionsQueryOptions(username, limit = 20, group) {
915
+ var operationOrders2 = utils.operationOrders;
916
+ function isHiveOperationName(value) {
917
+ return Object.prototype.hasOwnProperty.call(operationOrders2, value);
918
+ }
919
+ function resolveHiveOperationFilters(filters) {
920
+ const rawValues = Array.isArray(filters) ? filters : [filters];
921
+ const hasAll = rawValues.includes("");
922
+ const uniqueValues = Array.from(
923
+ new Set(
924
+ rawValues.filter(
925
+ (value) => value !== void 0 && value !== null && value !== ""
926
+ )
927
+ )
928
+ );
929
+ const filterKey = hasAll || uniqueValues.length === 0 ? "all" : uniqueValues.map((value) => value.toString()).sort().join("|");
930
+ const operationIds = /* @__PURE__ */ new Set();
931
+ if (!hasAll) {
932
+ uniqueValues.forEach((value) => {
933
+ if (value in HIVE_ACCOUNT_OPERATION_GROUPS) {
934
+ HIVE_ACCOUNT_OPERATION_GROUPS[value].forEach(
935
+ (id) => operationIds.add(id)
936
+ );
937
+ return;
938
+ }
939
+ if (isHiveOperationName(value)) {
940
+ operationIds.add(operationOrders2[value]);
941
+ }
942
+ });
943
+ }
944
+ const filterArgs = utils.makeBitMaskFilter(Array.from(operationIds));
945
+ return {
946
+ filterKey,
947
+ filterArgs
948
+ };
949
+ }
950
+ function getHiveAssetTransactionsQueryOptions(username, limit = 20, filters = []) {
951
+ const { filterArgs, filterKey } = resolveHiveOperationFilters(filters);
905
952
  return infiniteQueryOptions({
906
- queryKey: ["assets", "hive", "transactions", username, limit, group],
953
+ queryKey: ["assets", "hive", "transactions", username, limit, filterKey],
907
954
  initialData: { pages: [], pageParams: [] },
908
955
  initialPageParam: -1,
909
956
  getNextPageParam: (lastPage, __) => lastPage ? +(lastPage[lastPage.length - 1]?.num ?? 0) - 1 : -1,
910
957
  queryFn: async ({ pageParam }) => {
911
- let filters = [];
912
- switch (group) {
913
- case "transfers":
914
- filters = utils.makeBitMaskFilter(
915
- HIVE_ACCOUNT_OPERATION_GROUPS["transfers"]
916
- );
917
- break;
918
- case "market-orders":
919
- filters = utils.makeBitMaskFilter(
920
- HIVE_ACCOUNT_OPERATION_GROUPS["market-orders"]
921
- );
922
- break;
923
- case "interests":
924
- filters = utils.makeBitMaskFilter(
925
- HIVE_ACCOUNT_OPERATION_GROUPS["interests"]
926
- );
927
- break;
928
- case "stake-operations":
929
- filters = utils.makeBitMaskFilter(
930
- HIVE_ACCOUNT_OPERATION_GROUPS["stake-operations"]
931
- );
932
- break;
933
- case "rewards":
934
- filters = utils.makeBitMaskFilter(
935
- HIVE_ACCOUNT_OPERATION_GROUPS["rewards"]
936
- );
937
- break;
938
- default:
939
- filters = utils.makeBitMaskFilter([]);
940
- }
941
958
  const response = await CONFIG.hiveClient.call(
942
959
  "condenser_api",
943
960
  "get_account_history",
944
- [username, pageParam, limit, ...filters]
961
+ [username, pageParam, limit, ...filterArgs]
945
962
  );
946
963
  return response.map(
947
964
  (x) => ({
@@ -996,10 +1013,18 @@ function getHiveAssetTransactionsQueryOptions(username, limit = 20, group) {
996
1013
  })
997
1014
  });
998
1015
  }
999
- function getHivePowerAssetTransactionsQueryOptions(username, limit = 20, group) {
1016
+ function getHivePowerAssetTransactionsQueryOptions(username, limit = 20, filters = []) {
1017
+ const { filterKey } = resolveHiveOperationFilters(filters);
1000
1018
  return infiniteQueryOptions({
1001
- ...getHiveAssetTransactionsQueryOptions(username, limit, group),
1002
- queryKey: ["assets", "hive-power", "transactions", username, limit, group],
1019
+ ...getHiveAssetTransactionsQueryOptions(username, limit, filters),
1020
+ queryKey: [
1021
+ "assets",
1022
+ "hive-power",
1023
+ "transactions",
1024
+ username,
1025
+ limit,
1026
+ filterKey
1027
+ ],
1003
1028
  select: ({ pages, pageParams }) => ({
1004
1029
  pageParams,
1005
1030
  pages: pages.map(
@@ -1043,10 +1068,11 @@ function getHivePowerAssetTransactionsQueryOptions(username, limit = 20, group)
1043
1068
  })
1044
1069
  });
1045
1070
  }
1046
- function getHbdAssetTransactionsQueryOptions(username, limit = 20, group) {
1071
+ function getHbdAssetTransactionsQueryOptions(username, limit = 20, filters = []) {
1072
+ const { filterKey } = resolveHiveOperationFilters(filters);
1047
1073
  return infiniteQueryOptions({
1048
- ...getHiveAssetTransactionsQueryOptions(username, limit, group),
1049
- queryKey: ["assets", "hbd", "transactions", username, limit, group],
1074
+ ...getHiveAssetTransactionsQueryOptions(username, limit, filters),
1075
+ queryKey: ["assets", "hbd", "transactions", username, limit, filterKey],
1050
1076
  select: ({ pages, pageParams }) => ({
1051
1077
  pageParams,
1052
1078
  pages: pages.map(
@@ -3655,6 +3681,6 @@ function useWalletOperation(username, asset, operation) {
3655
3681
  // src/index.ts
3656
3682
  rememberScryptBsvVersion();
3657
3683
 
3658
- export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, NaiMap, PointTransactionType, Symbol2 as Symbol, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, claimInterestHive, 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, transferFromSavingsHive, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
3684
+ export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, HIVE_ACCOUNT_OPERATION_GROUPS, HIVE_OPERATION_LIST, HIVE_OPERATION_NAME_BY_ID, HIVE_OPERATION_ORDERS, NaiMap, PointTransactionType, Symbol2 as Symbol, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, claimInterestHive, 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, resolveHiveOperationFilters, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferFromSavingsHive, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
3659
3685
  //# sourceMappingURL=index.mjs.map
3660
3686
  //# sourceMappingURL=index.mjs.map