@lucid-evolution/utils 0.1.27 → 0.1.29

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
@@ -469,24 +469,18 @@ function getAddressDetails(address) {
469
469
 
470
470
  // src/cost_model.ts
471
471
  function createCostModels(costModels) {
472
- const costmdls = CML.CostModels.new();
473
- const costmdlV1 = CML.IntList.new();
472
+ const costmodel = {
473
+ 0: [],
474
+ 1: [],
475
+ 2: []
476
+ };
474
477
  for (const cost of Object.values(costModels.PlutusV1)) {
475
- const int = CML.Int.from_str(cost.toString());
476
- costmdlV1.add(int);
477
- int.free();
478
+ costmodel[0]?.push(cost);
478
479
  }
479
- costmdls.set_plutus_v1(costmdlV1);
480
- costmdlV1.free();
481
- const costmdlV2 = CML.IntList.new();
482
480
  for (const cost of Object.values(costModels.PlutusV2)) {
483
- const int = CML.Int.from_str(cost.toString());
484
- costmdlV2.add(int);
485
- int.free();
481
+ costmodel[1]?.push(cost);
486
482
  }
487
- costmdls.set_plutus_v2(costmdlV2);
488
- costmdlV2.free();
489
- return costmdls;
483
+ return CML.CostModels.from_json(JSON.stringify(costmodel));
490
484
  }
491
485
  var PROTOCOL_PARAMETERS_DEFAULT = {
492
486
  minFeeA: 44,
@@ -915,7 +909,7 @@ function datumToHash(datum) {
915
909
  }
916
910
 
917
911
  // src/keys.ts
918
- var import_bip39 = require("@lucid-evolution/bip39");
912
+ var import_bip39 = require("bip39");
919
913
  function generatePrivateKey() {
920
914
  return CML.PrivateKey.generate_ed25519().to_bech32();
921
915
  }
@@ -999,7 +993,7 @@ function assetsToValue(assets) {
999
993
  const assetsValue = CML.MapAssetNameToCoin.new();
1000
994
  for (const unit of policyUnits) {
1001
995
  assetsValue.insert(
1002
- CML.AssetName.from_bytes((0, import_core_utils4.fromHex)(unit.slice(56))),
996
+ CML.AssetName.from_hex(unit.slice(56)),
1003
997
  BigInt(assets[unit])
1004
998
  );
1005
999
  }
package/dist/index.js CHANGED
@@ -381,24 +381,18 @@ function getAddressDetails(address) {
381
381
 
382
382
  // src/cost_model.ts
383
383
  function createCostModels(costModels) {
384
- const costmdls = CML.CostModels.new();
385
- const costmdlV1 = CML.IntList.new();
384
+ const costmodel = {
385
+ 0: [],
386
+ 1: [],
387
+ 2: []
388
+ };
386
389
  for (const cost of Object.values(costModels.PlutusV1)) {
387
- const int = CML.Int.from_str(cost.toString());
388
- costmdlV1.add(int);
389
- int.free();
390
+ costmodel[0]?.push(cost);
390
391
  }
391
- costmdls.set_plutus_v1(costmdlV1);
392
- costmdlV1.free();
393
- const costmdlV2 = CML.IntList.new();
394
392
  for (const cost of Object.values(costModels.PlutusV2)) {
395
- const int = CML.Int.from_str(cost.toString());
396
- costmdlV2.add(int);
397
- int.free();
393
+ costmodel[1]?.push(cost);
398
394
  }
399
- costmdls.set_plutus_v2(costmdlV2);
400
- costmdlV2.free();
401
- return costmdls;
395
+ return CML.CostModels.from_json(JSON.stringify(costmodel));
402
396
  }
403
397
  var PROTOCOL_PARAMETERS_DEFAULT = {
404
398
  minFeeA: 44,
@@ -827,7 +821,7 @@ function datumToHash(datum) {
827
821
  }
828
822
 
829
823
  // src/keys.ts
830
- import { generateMnemonic } from "@lucid-evolution/bip39";
824
+ import { generateMnemonic } from "bip39";
831
825
  function generatePrivateKey() {
832
826
  return CML.PrivateKey.generate_ed25519().to_bech32();
833
827
  }
@@ -915,7 +909,7 @@ function assetsToValue(assets) {
915
909
  const assetsValue = CML.MapAssetNameToCoin.new();
916
910
  for (const unit of policyUnits) {
917
911
  assetsValue.insert(
918
- CML.AssetName.from_bytes(fromHex4(unit.slice(56))),
912
+ CML.AssetName.from_hex(unit.slice(56)),
919
913
  BigInt(assets[unit])
920
914
  );
921
915
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/utils",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,19 +26,19 @@
26
26
  "@emurgo/cardano-serialization-lib-nodejs": "@emurgo/cardano-serialization-lib-browser"
27
27
  },
28
28
  "dependencies": {
29
- "@anastasia-labs/cardano-multiplatform-lib-browser": "^5.3.1-2",
30
- "@anastasia-labs/cardano-multiplatform-lib-nodejs": "^5.3.1-2",
29
+ "@anastasia-labs/cardano-multiplatform-lib-browser": "^5.3.1-3",
30
+ "@anastasia-labs/cardano-multiplatform-lib-nodejs": "^5.3.1-3",
31
31
  "@effect/schema": "^0.68.16",
32
32
  "@emurgo/cardano-serialization-lib-browser": "^11.5.0",
33
33
  "@emurgo/cardano-serialization-lib-nodejs": "^11.5.0",
34
+ "bip39": "^3.1.0",
34
35
  "cborg": "^4.2.0",
35
36
  "effect": "^3.1.2",
36
- "@lucid-evolution/bip39": "0.2.10",
37
- "@lucid-evolution/core-types": "0.1.11",
38
- "@lucid-evolution/core-utils": "0.1.8",
37
+ "@lucid-evolution/core-types": "0.1.12",
38
+ "@lucid-evolution/core-utils": "0.1.10",
39
39
  "@lucid-evolution/crc8": "0.1.8",
40
- "@lucid-evolution/plutus": "0.1.14",
41
- "@lucid-evolution/uplc": "0.2.9"
40
+ "@lucid-evolution/plutus": "0.1.16",
41
+ "@lucid-evolution/uplc": "0.2.10"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^20.12.8",