@lucid-evolution/utils 0.1.14 → 0.1.16
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 +10 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65,6 +65,7 @@ __export(src_exports, {
|
|
|
65
65
|
slotToUnixTime: () => slotToUnixTime,
|
|
66
66
|
sortUTxOs: () => sortUTxOs,
|
|
67
67
|
stakeCredentialOf: () => stakeCredentialOf,
|
|
68
|
+
stringify: () => stringify,
|
|
68
69
|
toLabel: () => toLabel,
|
|
69
70
|
toNativeScript: () => toNativeScript,
|
|
70
71
|
toPublicKey: () => toPublicKey,
|
|
@@ -960,7 +961,7 @@ function assetsToValue(assets) {
|
|
|
960
961
|
const assetsValue = CML.MapAssetNameToCoin.new();
|
|
961
962
|
for (const unit of policyUnits) {
|
|
962
963
|
assetsValue.insert(
|
|
963
|
-
CML.AssetName.
|
|
964
|
+
CML.AssetName.from_bytes((0, import_core_utils4.fromHex)(unit.slice(56))),
|
|
964
965
|
BigInt(assets[unit])
|
|
965
966
|
);
|
|
966
967
|
}
|
|
@@ -1126,6 +1127,13 @@ var sortUTxOs = (utxos, order = "descending") => {
|
|
|
1126
1127
|
});
|
|
1127
1128
|
};
|
|
1128
1129
|
var isEqualUTxO = (self, that) => self.txHash === that.txHash && self.outputIndex === that.outputIndex;
|
|
1130
|
+
|
|
1131
|
+
// src/objects.ts
|
|
1132
|
+
var stringify = (data) => JSON.stringify(
|
|
1133
|
+
data,
|
|
1134
|
+
(key, value) => typeof value === "bigint" ? value.toString() + "n" : value,
|
|
1135
|
+
2
|
|
1136
|
+
);
|
|
1129
1137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1130
1138
|
0 && (module.exports = {
|
|
1131
1139
|
PROTOCOL_PARAMETERS_DEFAULT,
|
|
@@ -1163,6 +1171,7 @@ var isEqualUTxO = (self, that) => self.txHash === that.txHash && self.outputInde
|
|
|
1163
1171
|
slotToUnixTime,
|
|
1164
1172
|
sortUTxOs,
|
|
1165
1173
|
stakeCredentialOf,
|
|
1174
|
+
stringify,
|
|
1166
1175
|
toLabel,
|
|
1167
1176
|
toNativeScript,
|
|
1168
1177
|
toPublicKey,
|
package/dist/index.d.cts
CHANGED
|
@@ -90,4 +90,6 @@ declare function fromUnit(unit: Unit): {
|
|
|
90
90
|
declare function toUnit(policyId: PolicyId, name?: string | null, label?: number | null): Unit;
|
|
91
91
|
declare function addAssets(...assets: Assets[]): Assets;
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
declare const stringify: (data: any) => string;
|
|
94
|
+
|
|
95
|
+
export { PROTOCOL_PARAMETERS_DEFAULT, addAssets, addressFromHexOrBech32, applyDoubleCborEncoding, applyParamsToScript, assetsToValue, coreToOutRef, coreToTxOutput, coreToUtxo, coresToOutRefs, coresToTxOutputs, coresToUtxos, createCostModels, credentialToAddress, credentialToRewardAddress, datumToHash, fromLabel, fromScriptRef, fromUnit, generatePrivateKey, generateSeedPhrase, getAddressDetails, isEqualUTxO, keyHashToCredential, mintingPolicyToId, nativeFromJson, nativeJSFromJson, nativeScriptFromJson, networkToId, paymentCredentialOf, scriptHashToCredential, selectUTxOs, slotToUnixTime, sortUTxOs, stakeCredentialOf, stringify, toLabel, toNativeScript, toPublicKey, toScriptRef, toUnit, unixTimeToSlot, utxoToCore, utxoToTransactionInput, utxoToTransactionOutput, utxosToCores, validatorToAddress, validatorToRewardAddress, validatorToScriptHash, valueToAssets };
|
package/dist/index.d.ts
CHANGED
|
@@ -90,4 +90,6 @@ declare function fromUnit(unit: Unit): {
|
|
|
90
90
|
declare function toUnit(policyId: PolicyId, name?: string | null, label?: number | null): Unit;
|
|
91
91
|
declare function addAssets(...assets: Assets[]): Assets;
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
declare const stringify: (data: any) => string;
|
|
94
|
+
|
|
95
|
+
export { PROTOCOL_PARAMETERS_DEFAULT, addAssets, addressFromHexOrBech32, applyDoubleCborEncoding, applyParamsToScript, assetsToValue, coreToOutRef, coreToTxOutput, coreToUtxo, coresToOutRefs, coresToTxOutputs, coresToUtxos, createCostModels, credentialToAddress, credentialToRewardAddress, datumToHash, fromLabel, fromScriptRef, fromUnit, generatePrivateKey, generateSeedPhrase, getAddressDetails, isEqualUTxO, keyHashToCredential, mintingPolicyToId, nativeFromJson, nativeJSFromJson, nativeScriptFromJson, networkToId, paymentCredentialOf, scriptHashToCredential, selectUTxOs, slotToUnixTime, sortUTxOs, stakeCredentialOf, stringify, toLabel, toNativeScript, toPublicKey, toScriptRef, toUnit, unixTimeToSlot, utxoToCore, utxoToTransactionInput, utxoToTransactionOutput, utxosToCores, validatorToAddress, validatorToRewardAddress, validatorToScriptHash, valueToAssets };
|
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
|
}
|
|
@@ -1046,6 +1046,13 @@ var sortUTxOs = (utxos, order = "descending") => {
|
|
|
1046
1046
|
});
|
|
1047
1047
|
};
|
|
1048
1048
|
var isEqualUTxO = (self, that) => self.txHash === that.txHash && self.outputIndex === that.outputIndex;
|
|
1049
|
+
|
|
1050
|
+
// src/objects.ts
|
|
1051
|
+
var stringify = (data) => JSON.stringify(
|
|
1052
|
+
data,
|
|
1053
|
+
(key, value) => typeof value === "bigint" ? value.toString() + "n" : value,
|
|
1054
|
+
2
|
|
1055
|
+
);
|
|
1049
1056
|
export {
|
|
1050
1057
|
PROTOCOL_PARAMETERS_DEFAULT,
|
|
1051
1058
|
addAssets,
|
|
@@ -1082,6 +1089,7 @@ export {
|
|
|
1082
1089
|
slotToUnixTime,
|
|
1083
1090
|
sortUTxOs,
|
|
1084
1091
|
stakeCredentialOf,
|
|
1092
|
+
stringify,
|
|
1085
1093
|
toLabel,
|
|
1086
1094
|
toNativeScript,
|
|
1087
1095
|
toPublicKey,
|