@lucid-evolution/utils 0.1.13 → 0.1.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/index.cjs +2 -2
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -960,7 +960,7 @@ function assetsToValue(assets) {
|
|
|
960
960
|
const assetsValue = CML.MapAssetNameToCoin.new();
|
|
961
961
|
for (const unit of policyUnits) {
|
|
962
962
|
assetsValue.insert(
|
|
963
|
-
CML.AssetName.
|
|
963
|
+
CML.AssetName.from_bytes((0, import_core_utils4.fromHex)(unit.slice(56))),
|
|
964
964
|
BigInt(assets[unit])
|
|
965
965
|
);
|
|
966
966
|
}
|
|
@@ -1115,7 +1115,7 @@ var selectUTxOs = (utxos, totalAssets) => {
|
|
|
1115
1115
|
return selectedUtxos;
|
|
1116
1116
|
};
|
|
1117
1117
|
var sortUTxOs = (utxos, order = "descending") => {
|
|
1118
|
-
return utxos.
|
|
1118
|
+
return [...utxos].sort((a, b) => {
|
|
1119
1119
|
if (a.assets["lovelace"] > b.assets["lovelace"]) {
|
|
1120
1120
|
return order === "ascending" ? 1 : -1;
|
|
1121
1121
|
}
|
package/dist/index.js
CHANGED
|
@@ -845,7 +845,7 @@ function slotToUnixTime(network, slot) {
|
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
// src/value.ts
|
|
848
|
-
import {
|
|
848
|
+
import { fromHex as fromHex4, fromText } from "@lucid-evolution/core-utils";
|
|
849
849
|
function valueToAssets(value) {
|
|
850
850
|
const assets = {};
|
|
851
851
|
assets["lovelace"] = value.coin();
|
|
@@ -880,7 +880,7 @@ function assetsToValue(assets) {
|
|
|
880
880
|
const assetsValue = CML.MapAssetNameToCoin.new();
|
|
881
881
|
for (const unit of policyUnits) {
|
|
882
882
|
assetsValue.insert(
|
|
883
|
-
CML.AssetName.
|
|
883
|
+
CML.AssetName.from_bytes(fromHex4(unit.slice(56))),
|
|
884
884
|
BigInt(assets[unit])
|
|
885
885
|
);
|
|
886
886
|
}
|
|
@@ -1035,7 +1035,7 @@ var selectUTxOs = (utxos, totalAssets) => {
|
|
|
1035
1035
|
return selectedUtxos;
|
|
1036
1036
|
};
|
|
1037
1037
|
var sortUTxOs = (utxos, order = "descending") => {
|
|
1038
|
-
return utxos.
|
|
1038
|
+
return [...utxos].sort((a, b) => {
|
|
1039
1039
|
if (a.assets["lovelace"] > b.assets["lovelace"]) {
|
|
1040
1040
|
return order === "ascending" ? 1 : -1;
|
|
1041
1041
|
}
|