@ecency/wallets 1.5.13 → 1.5.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.
@@ -1550,6 +1550,33 @@ async function claimInterestHive(payload, auth) {
1550
1550
  return hs.sendOperations(operations, { callback: `https://ecency.com/@${payload.from}/wallet` }, () => {
1551
1551
  });
1552
1552
  }
1553
+ async function convertHbd(payload, auth) {
1554
+ const requestid = Math.floor(Date.now() / 1e3);
1555
+ const operationPayload = {
1556
+ owner: payload.from,
1557
+ requestid,
1558
+ amount: payload.amount
1559
+ };
1560
+ const operation = ["convert", operationPayload];
1561
+ if (payload.type === "key" && "key" in payload) {
1562
+ const { key, type, ...params } = payload;
1563
+ return CONFIG.hiveClient.broadcast.sendOperations(
1564
+ [["convert", { ...params, owner: params.from, requestid }]],
1565
+ key
1566
+ );
1567
+ } else if (payload.type === "keychain" || payload.type === "hiveauth") {
1568
+ if (auth?.broadcast) {
1569
+ return auth.broadcast([operation], "active");
1570
+ }
1571
+ if (payload.type === "hiveauth") {
1572
+ return broadcastWithWalletHiveAuth(payload.from, [operation], "active");
1573
+ }
1574
+ throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1575
+ } else {
1576
+ return hs.sendOperation(operation, { callback: `https://ecency.com/@${payload.from}/wallet` }, () => {
1577
+ });
1578
+ }
1579
+ }
1553
1580
 
1554
1581
  // src/modules/assets/types/asset-operation.ts
1555
1582
  var AssetOperation = /* @__PURE__ */ ((AssetOperation2) => {
@@ -3566,6 +3593,16 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
3566
3593
  (assetItem) => assetItem.symbol.toUpperCase() === asset.toUpperCase()
3567
3594
  );
3568
3595
  if (!assetInfo) return void 0;
3596
+ const parts = [];
3597
+ if (assetInfo.liquid !== void 0 && assetInfo.liquid !== null) {
3598
+ parts.push({ name: "liquid", balance: assetInfo.liquid });
3599
+ }
3600
+ if (assetInfo.staked !== void 0 && assetInfo.staked !== null && assetInfo.staked > 0) {
3601
+ parts.push({ name: "staked", balance: assetInfo.staked });
3602
+ }
3603
+ if (assetInfo.savings !== void 0 && assetInfo.savings !== null && assetInfo.savings > 0) {
3604
+ parts.push({ name: "savings", balance: assetInfo.savings });
3605
+ }
3569
3606
  return {
3570
3607
  name: assetInfo.symbol,
3571
3608
  title: assetInfo.name,
@@ -3573,7 +3610,8 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
3573
3610
  accountBalance: assetInfo.balance,
3574
3611
  apr: assetInfo.apr?.toString(),
3575
3612
  layer: assetInfo.layer,
3576
- pendingRewards: assetInfo.pendingRewards
3613
+ pendingRewards: assetInfo.pendingRewards,
3614
+ parts
3577
3615
  };
3578
3616
  } catch (e) {
3579
3617
  return void 0;
@@ -4094,7 +4132,8 @@ var operationToFunctionMap = {
4094
4132
  ["transfer" /* Transfer */]: transferHive,
4095
4133
  ["transfer-saving" /* TransferToSavings */]: transferToSavingsHive,
4096
4134
  ["withdraw-saving" /* WithdrawFromSavings */]: transferFromSavingsHive,
4097
- ["claim-interest" /* ClaimInterest */]: claimInterestHive
4135
+ ["claim-interest" /* ClaimInterest */]: claimInterestHive,
4136
+ ["convert" /* Convert */]: convertHbd
4098
4137
  },
4099
4138
  HP: {
4100
4139
  ["power-down" /* PowerDown */]: powerDownHive,
@@ -4119,7 +4158,18 @@ var engineOperationToFunctionMap = {
4119
4158
  ["stake" /* Stake */]: stakeEngineToken,
4120
4159
  ["unstake" /* Unstake */]: unstakeEngineToken,
4121
4160
  ["delegate" /* Delegate */]: delegateEngineToken,
4122
- ["undelegate" /* Undelegate */]: undelegateEngineToken
4161
+ ["undelegate" /* Undelegate */]: undelegateEngineToken,
4162
+ ["claim" /* Claim */]: (payload, auth) => {
4163
+ return claimHiveEngineRewards(
4164
+ {
4165
+ account: payload.from,
4166
+ tokens: [payload.asset],
4167
+ type: payload.type,
4168
+ ...payload.type === "key" && payload.key ? { key: payload.key } : {}
4169
+ },
4170
+ auth
4171
+ );
4172
+ }
4123
4173
  };
4124
4174
  function useWalletOperation(username, asset, operation, auth) {
4125
4175
  const { mutateAsync: recordActivity } = EcencyAnalytics.useRecordActivity(
@@ -4185,6 +4235,6 @@ function useWalletOperation(username, asset, operation, auth) {
4185
4235
  // src/index.ts
4186
4236
  rememberScryptBsvVersion();
4187
4237
 
4188
- export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, HIVE_ACCOUNT_OPERATION_GROUPS, HIVE_OPERATION_LIST, HIVE_OPERATION_NAME_BY_ID, HIVE_OPERATION_ORDERS, HiveEngineToken, NaiMap, PointTransactionType, Symbol2 as Symbol, broadcastWithWalletHiveAuth, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, cancelHiveEngineOrder, claimHiveEngineRewards, claimInterestHive, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, formattedNumber, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllHiveEngineTokensQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineBalancesWithUsdQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHiveEngineUnclaimedRewardsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getSpkWalletQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getVisionPortfolioQueryOptions, getWallet, hasWalletHiveAuthBroadcast, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, placeHiveEngineBuyOrder, placeHiveEngineSellOrder, powerDownHive, powerUpHive, powerUpLarynx, registerWalletHiveAuthBroadcast, 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 };
4238
+ export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, HIVE_ACCOUNT_OPERATION_GROUPS, HIVE_OPERATION_LIST, HIVE_OPERATION_NAME_BY_ID, HIVE_OPERATION_ORDERS, HiveEngineToken, NaiMap, PointTransactionType, Symbol2 as Symbol, broadcastWithWalletHiveAuth, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, cancelHiveEngineOrder, claimHiveEngineRewards, claimInterestHive, convertHbd, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, formattedNumber, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllHiveEngineTokensQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineBalancesWithUsdQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHiveEngineUnclaimedRewardsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getSpkWalletQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getVisionPortfolioQueryOptions, getWallet, hasWalletHiveAuthBroadcast, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, placeHiveEngineBuyOrder, placeHiveEngineSellOrder, powerDownHive, powerUpHive, powerUpLarynx, registerWalletHiveAuthBroadcast, 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 };
4189
4239
  //# sourceMappingURL=index.mjs.map
4190
4240
  //# sourceMappingURL=index.mjs.map