@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.
- package/dist/browser/index.d.ts +33 -24
- package/dist/browser/index.js +54 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +54 -3
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +54 -4
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -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) => {
|
|
@@ -3593,6 +3620,16 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
|
|
|
3593
3620
|
(assetItem) => assetItem.symbol.toUpperCase() === asset.toUpperCase()
|
|
3594
3621
|
);
|
|
3595
3622
|
if (!assetInfo) return void 0;
|
|
3623
|
+
const parts = [];
|
|
3624
|
+
if (assetInfo.liquid !== void 0 && assetInfo.liquid !== null) {
|
|
3625
|
+
parts.push({ name: "liquid", balance: assetInfo.liquid });
|
|
3626
|
+
}
|
|
3627
|
+
if (assetInfo.staked !== void 0 && assetInfo.staked !== null && assetInfo.staked > 0) {
|
|
3628
|
+
parts.push({ name: "staked", balance: assetInfo.staked });
|
|
3629
|
+
}
|
|
3630
|
+
if (assetInfo.savings !== void 0 && assetInfo.savings !== null && assetInfo.savings > 0) {
|
|
3631
|
+
parts.push({ name: "savings", balance: assetInfo.savings });
|
|
3632
|
+
}
|
|
3596
3633
|
return {
|
|
3597
3634
|
name: assetInfo.symbol,
|
|
3598
3635
|
title: assetInfo.name,
|
|
@@ -3600,7 +3637,8 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
|
|
|
3600
3637
|
accountBalance: assetInfo.balance,
|
|
3601
3638
|
apr: assetInfo.apr?.toString(),
|
|
3602
3639
|
layer: assetInfo.layer,
|
|
3603
|
-
pendingRewards: assetInfo.pendingRewards
|
|
3640
|
+
pendingRewards: assetInfo.pendingRewards,
|
|
3641
|
+
parts
|
|
3604
3642
|
};
|
|
3605
3643
|
} catch (e) {
|
|
3606
3644
|
return void 0;
|
|
@@ -4121,7 +4159,8 @@ var operationToFunctionMap = {
|
|
|
4121
4159
|
["transfer" /* Transfer */]: transferHive,
|
|
4122
4160
|
["transfer-saving" /* TransferToSavings */]: transferToSavingsHive,
|
|
4123
4161
|
["withdraw-saving" /* WithdrawFromSavings */]: transferFromSavingsHive,
|
|
4124
|
-
["claim-interest" /* ClaimInterest */]: claimInterestHive
|
|
4162
|
+
["claim-interest" /* ClaimInterest */]: claimInterestHive,
|
|
4163
|
+
["convert" /* Convert */]: convertHbd
|
|
4125
4164
|
},
|
|
4126
4165
|
HP: {
|
|
4127
4166
|
["power-down" /* PowerDown */]: powerDownHive,
|
|
@@ -4146,7 +4185,18 @@ var engineOperationToFunctionMap = {
|
|
|
4146
4185
|
["stake" /* Stake */]: stakeEngineToken,
|
|
4147
4186
|
["unstake" /* Unstake */]: unstakeEngineToken,
|
|
4148
4187
|
["delegate" /* Delegate */]: delegateEngineToken,
|
|
4149
|
-
["undelegate" /* Undelegate */]: undelegateEngineToken
|
|
4188
|
+
["undelegate" /* Undelegate */]: undelegateEngineToken,
|
|
4189
|
+
["claim" /* Claim */]: (payload, auth) => {
|
|
4190
|
+
return claimHiveEngineRewards(
|
|
4191
|
+
{
|
|
4192
|
+
account: payload.from,
|
|
4193
|
+
tokens: [payload.asset],
|
|
4194
|
+
type: payload.type,
|
|
4195
|
+
...payload.type === "key" && payload.key ? { key: payload.key } : {}
|
|
4196
|
+
},
|
|
4197
|
+
auth
|
|
4198
|
+
);
|
|
4199
|
+
}
|
|
4150
4200
|
};
|
|
4151
4201
|
function useWalletOperation(username, asset, operation, auth) {
|
|
4152
4202
|
const { mutateAsync: recordActivity } = sdk.EcencyAnalytics.useRecordActivity(
|
|
@@ -4251,6 +4301,7 @@ exports.buildTronTx = buildTronTx;
|
|
|
4251
4301
|
exports.cancelHiveEngineOrder = cancelHiveEngineOrder;
|
|
4252
4302
|
exports.claimHiveEngineRewards = claimHiveEngineRewards;
|
|
4253
4303
|
exports.claimInterestHive = claimInterestHive;
|
|
4304
|
+
exports.convertHbd = convertHbd;
|
|
4254
4305
|
exports.decryptMemoWithAccounts = decryptMemoWithAccounts;
|
|
4255
4306
|
exports.decryptMemoWithKeys = decryptMemoWithKeys;
|
|
4256
4307
|
exports.delay = delay;
|