@ecency/wallets 1.5.13 → 1.5.14

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.
@@ -1577,6 +1577,33 @@ async function claimInterestHive(payload, auth) {
1577
1577
  return hs__default.default.sendOperations(operations, { callback: `https://ecency.com/@${payload.from}/wallet` }, () => {
1578
1578
  });
1579
1579
  }
1580
+ async function convertHbd(payload, auth) {
1581
+ const requestid = Math.floor(Date.now() / 1e3);
1582
+ const operationPayload = {
1583
+ owner: payload.from,
1584
+ requestid,
1585
+ amount: payload.amount
1586
+ };
1587
+ const operation = ["convert", operationPayload];
1588
+ if (payload.type === "key" && "key" in payload) {
1589
+ const { key, type, ...params } = payload;
1590
+ return sdk.CONFIG.hiveClient.broadcast.sendOperations(
1591
+ [["convert", { ...params, owner: params.from, requestid }]],
1592
+ key
1593
+ );
1594
+ } else if (payload.type === "keychain" || payload.type === "hiveauth") {
1595
+ if (auth?.broadcast) {
1596
+ return auth.broadcast([operation], "active");
1597
+ }
1598
+ if (payload.type === "hiveauth") {
1599
+ return broadcastWithWalletHiveAuth(payload.from, [operation], "active");
1600
+ }
1601
+ throw new Error("[SDK][Wallets] \u2013 missing broadcaster");
1602
+ } else {
1603
+ return hs__default.default.sendOperation(operation, { callback: `https://ecency.com/@${payload.from}/wallet` }, () => {
1604
+ });
1605
+ }
1606
+ }
1580
1607
 
1581
1608
  // src/modules/assets/types/asset-operation.ts
1582
1609
  var AssetOperation = /* @__PURE__ */ ((AssetOperation2) => {
@@ -4121,7 +4148,8 @@ var operationToFunctionMap = {
4121
4148
  ["transfer" /* Transfer */]: transferHive,
4122
4149
  ["transfer-saving" /* TransferToSavings */]: transferToSavingsHive,
4123
4150
  ["withdraw-saving" /* WithdrawFromSavings */]: transferFromSavingsHive,
4124
- ["claim-interest" /* ClaimInterest */]: claimInterestHive
4151
+ ["claim-interest" /* ClaimInterest */]: claimInterestHive,
4152
+ ["convert" /* Convert */]: convertHbd
4125
4153
  },
4126
4154
  HP: {
4127
4155
  ["power-down" /* PowerDown */]: powerDownHive,
@@ -4251,6 +4279,7 @@ exports.buildTronTx = buildTronTx;
4251
4279
  exports.cancelHiveEngineOrder = cancelHiveEngineOrder;
4252
4280
  exports.claimHiveEngineRewards = claimHiveEngineRewards;
4253
4281
  exports.claimInterestHive = claimInterestHive;
4282
+ exports.convertHbd = convertHbd;
4254
4283
  exports.decryptMemoWithAccounts = decryptMemoWithAccounts;
4255
4284
  exports.decryptMemoWithKeys = decryptMemoWithKeys;
4256
4285
  exports.delay = delay;