@lucid-evolution/utils 0.1.19 → 0.1.21

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 CHANGED
@@ -85,7 +85,7 @@ __export(src_exports, {
85
85
  module.exports = __toCommonJS(src_exports);
86
86
 
87
87
  // src/core.ts
88
- var CML = __toESM(require("@dcspark/cardano-multiplatform-lib-nodejs"), 1);
88
+ var CML = __toESM(require("@anastasia-labs/cardano-multiplatform-lib-nodejs"), 1);
89
89
 
90
90
  // src/native.ts
91
91
  var toNativeScript = (native) => {
@@ -926,6 +926,9 @@ function slotToUnixTime(network, slot) {
926
926
  return (0, import_plutus2.slotToBeginUnixTime)(slot, import_plutus2.SLOT_CONFIG_NETWORK[network]);
927
927
  }
928
928
 
929
+ // src/utxo.ts
930
+ var CSL = __toESM(require("@emurgo/cardano-serialization-lib-nodejs"), 1);
931
+
929
932
  // src/value.ts
930
933
  var import_core_utils4 = require("@lucid-evolution/core-utils");
931
934
  function valueToAssets(value) {
@@ -1051,10 +1054,16 @@ function utxosToCores(utxos) {
1051
1054
  return result;
1052
1055
  }
1053
1056
  function coreToUtxo(coreUtxo) {
1054
- const out = CML.TransactionOutput.from_cbor_hex(coreUtxo.to_cbor_hex());
1057
+ const utxoCore = CSL.TransactionUnspentOutput.from_bytes(
1058
+ coreUtxo.to_cbor_bytes()
1059
+ );
1055
1060
  const utxo = {
1056
- ...coreToOutRef(CML.TransactionInput.from_cbor_hex(coreUtxo.to_cbor_hex())),
1057
- ...coreToTxOutput(out)
1061
+ ...coreToOutRef(
1062
+ CML.TransactionInput.from_cbor_bytes(utxoCore.input().to_bytes())
1063
+ ),
1064
+ ...coreToTxOutput(
1065
+ CML.TransactionOutput.from_cbor_bytes(utxoCore.output().to_bytes())
1066
+ )
1058
1067
  };
1059
1068
  return utxo;
1060
1069
  }
@@ -1118,8 +1127,7 @@ var selectUTxOs = (utxos, totalAssets) => {
1118
1127
  break;
1119
1128
  }
1120
1129
  }
1121
- if (assetsRequired.size > 0)
1122
- return [];
1130
+ if (assetsRequired.size > 0) return [];
1123
1131
  return selectedUtxos;
1124
1132
  };
1125
1133
  var sortUTxOs = (utxos, order = "LargestFirst") => {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Native, Script, Network, Credential, RewardAddress, CertificateValidator, WithdrawalValidator, AddressDetails, CostModels, ProtocolParameters, Address, ScriptHash, KeyHash, Datum, DatumHash, PrivateKey, PublicKey, SpendingValidator, Validator, MintingPolicy, PolicyId, NativeScript, Exact, UnixTime, Slot, UTxO, OutRef, TxOutput, Assets, Unit } from '@lucid-evolution/core-types';
2
- import * as CML from '@dcspark/cardano-multiplatform-lib-nodejs';
2
+ import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
3
3
  import { Data } from '@lucid-evolution/plutus';
4
4
 
5
5
  declare const toNativeScript: (native: Native) => CML.NativeScript;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Native, Script, Network, Credential, RewardAddress, CertificateValidator, WithdrawalValidator, AddressDetails, CostModels, ProtocolParameters, Address, ScriptHash, KeyHash, Datum, DatumHash, PrivateKey, PublicKey, SpendingValidator, Validator, MintingPolicy, PolicyId, NativeScript, Exact, UnixTime, Slot, UTxO, OutRef, TxOutput, Assets, Unit } from '@lucid-evolution/core-types';
2
- import * as CML from '@dcspark/cardano-multiplatform-lib-nodejs';
2
+ import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
3
3
  import { Data } from '@lucid-evolution/plutus';
4
4
 
5
5
  declare const toNativeScript: (native: Native) => CML.NativeScript;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/core.ts
2
- import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs";
2
+ import * as CML from "@anastasia-labs/cardano-multiplatform-lib-nodejs";
3
3
 
4
4
  // src/native.ts
5
5
  var toNativeScript = (native) => {
@@ -844,6 +844,9 @@ function slotToUnixTime(network, slot) {
844
844
  return slotToBeginUnixTime(slot, SLOT_CONFIG_NETWORK[network]);
845
845
  }
846
846
 
847
+ // src/utxo.ts
848
+ import * as CSL from "@emurgo/cardano-serialization-lib-nodejs";
849
+
847
850
  // src/value.ts
848
851
  import { fromHex as fromHex4, toHex as toHex3 } from "@lucid-evolution/core-utils";
849
852
  function valueToAssets(value) {
@@ -969,10 +972,16 @@ function utxosToCores(utxos) {
969
972
  return result;
970
973
  }
971
974
  function coreToUtxo(coreUtxo) {
972
- const out = CML.TransactionOutput.from_cbor_hex(coreUtxo.to_cbor_hex());
975
+ const utxoCore = CSL.TransactionUnspentOutput.from_bytes(
976
+ coreUtxo.to_cbor_bytes()
977
+ );
973
978
  const utxo = {
974
- ...coreToOutRef(CML.TransactionInput.from_cbor_hex(coreUtxo.to_cbor_hex())),
975
- ...coreToTxOutput(out)
979
+ ...coreToOutRef(
980
+ CML.TransactionInput.from_cbor_bytes(utxoCore.input().to_bytes())
981
+ ),
982
+ ...coreToTxOutput(
983
+ CML.TransactionOutput.from_cbor_bytes(utxoCore.output().to_bytes())
984
+ )
976
985
  };
977
986
  return utxo;
978
987
  }
@@ -1036,8 +1045,7 @@ var selectUTxOs = (utxos, totalAssets) => {
1036
1045
  break;
1037
1046
  }
1038
1047
  }
1039
- if (assetsRequired.size > 0)
1040
- return [];
1048
+ if (assetsRequired.size > 0) return [];
1041
1049
  return selectedUtxos;
1042
1050
  };
1043
1051
  var sortUTxOs = (utxos, order = "LargestFirst") => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/utils",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -22,18 +22,21 @@
22
22
  "author": "",
23
23
  "license": "MIT",
24
24
  "browser": {
25
- "@dcspark/cardano-multiplatform-lib-nodejs": "@dcspark/cardano-multiplatform-lib-browser"
25
+ "@anastasia-labs/cardano-multiplatform-lib-nodejs": "@anastasia-labs/cardano-multiplatform-lib-browser",
26
+ "@emurgo/cardano-serialization-lib-nodejs": "@emurgo/cardano-serialization-lib-browser"
26
27
  },
27
28
  "dependencies": {
28
- "@dcspark/cardano-multiplatform-lib-nodejs": "^5.3.0",
29
- "@dcspark/cardano-multiplatform-lib-browser": "^5.3.0",
29
+ "@anastasia-labs/cardano-multiplatform-lib-browser": "^5.3.1-2",
30
+ "@anastasia-labs/cardano-multiplatform-lib-nodejs": "^5.3.1-2",
31
+ "@emurgo/cardano-serialization-lib-browser": "^11.5.0",
32
+ "@emurgo/cardano-serialization-lib-nodejs": "^11.5.0",
30
33
  "cborg": "^4.2.0",
31
- "@lucid-evolution/bip39": "0.2.7",
32
- "@lucid-evolution/core-types": "0.1.7",
33
- "@lucid-evolution/core-utils": "0.1.6",
34
- "@lucid-evolution/crc8": "0.1.6",
35
- "@lucid-evolution/plutus": "0.1.10",
36
- "@lucid-evolution/uplc": "0.2.6"
34
+ "@lucid-evolution/bip39": "0.2.8",
35
+ "@lucid-evolution/core-types": "0.1.8",
36
+ "@lucid-evolution/core-utils": "0.1.7",
37
+ "@lucid-evolution/crc8": "0.1.7",
38
+ "@lucid-evolution/plutus": "0.1.11",
39
+ "@lucid-evolution/uplc": "0.2.7"
37
40
  },
38
41
  "devDependencies": {
39
42
  "@types/node": "^20.12.8",