@ecency/wallets 1.4.29 → 1.4.31
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.js +24 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +24 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +24 -1
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3593,6 +3593,16 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
|
|
|
3593
3593
|
}
|
|
3594
3594
|
});
|
|
3595
3595
|
}
|
|
3596
|
+
function normalizePartKey2(value) {
|
|
3597
|
+
return value.trim().toLowerCase().replace(/[\s-]+/g, "_");
|
|
3598
|
+
}
|
|
3599
|
+
function hasNonZeroSavingsBalance(parts) {
|
|
3600
|
+
return Boolean(
|
|
3601
|
+
parts?.some(
|
|
3602
|
+
(part) => normalizePartKey2(part.name) === "savings" && Number(part.balance) > 0
|
|
3603
|
+
)
|
|
3604
|
+
);
|
|
3605
|
+
}
|
|
3596
3606
|
function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
3597
3607
|
return reactQuery.queryOptions({
|
|
3598
3608
|
queryKey: ["wallets", "token-operations", token, username, isForOwner],
|
|
@@ -3609,7 +3619,19 @@ function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
|
3609
3619
|
const assetEntry = portfolio.wallets.find(
|
|
3610
3620
|
(assetItem) => assetItem.info.name === normalizedToken
|
|
3611
3621
|
);
|
|
3612
|
-
|
|
3622
|
+
if (!assetEntry) {
|
|
3623
|
+
return [];
|
|
3624
|
+
}
|
|
3625
|
+
const operations = assetEntry.operations ?? [];
|
|
3626
|
+
const isHiveOrHbd = ["HIVE", "HBD"].includes(
|
|
3627
|
+
assetEntry.info.name.toUpperCase()
|
|
3628
|
+
);
|
|
3629
|
+
if (isHiveOrHbd && !hasNonZeroSavingsBalance(assetEntry.info.parts)) {
|
|
3630
|
+
return operations.filter(
|
|
3631
|
+
(operation) => operation !== "withdraw-saving" /* WithdrawFromSavings */
|
|
3632
|
+
);
|
|
3633
|
+
}
|
|
3634
|
+
return operations;
|
|
3613
3635
|
} catch {
|
|
3614
3636
|
return [];
|
|
3615
3637
|
}
|
|
@@ -3967,6 +3989,7 @@ var operationToFunctionMap = {
|
|
|
3967
3989
|
["withdraw-routes" /* WithdrawRoutes */]: withdrawVestingRouteHive
|
|
3968
3990
|
},
|
|
3969
3991
|
POINTS: {
|
|
3992
|
+
["transfer" /* Transfer */]: transferPoint,
|
|
3970
3993
|
["gift" /* Gift */]: transferPoint
|
|
3971
3994
|
},
|
|
3972
3995
|
SPK: {
|