@lucid-evolution/utils 0.1.40 → 0.1.42

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
@@ -563,6 +563,8 @@ var PROTOCOL_PARAMETERS_DEFAULT = {
563
563
  maxValSize: 5e3,
564
564
  keyDeposit: 2000000n,
565
565
  poolDeposit: 500000000n,
566
+ drepDeposit: 500000000n,
567
+ govActionDeposit: 100000000000n,
566
568
  priceMem: 0.0577,
567
569
  priceStep: 721e-7,
568
570
  maxTxExMem: 14000000n,
@@ -1282,9 +1284,6 @@ function slotToUnixTime(network, slot) {
1282
1284
  return (0, import_plutus2.slotToBeginUnixTime)(slot, import_plutus2.SLOT_CONFIG_NETWORK[network]);
1283
1285
  }
1284
1286
 
1285
- // src/utxo.ts
1286
- var CSL = __toESM(require("@emurgo/cardano-serialization-lib-nodejs"), 1);
1287
-
1288
1287
  // src/value.ts
1289
1288
  var import_core_utils4 = require("@lucid-evolution/core-utils");
1290
1289
  function valueToAssets(value) {
@@ -1354,7 +1353,12 @@ function addAssets(...assets) {
1354
1353
  return assets.reduce((a, b) => {
1355
1354
  for (const k in b) {
1356
1355
  if (Object.hasOwn(b, k)) {
1357
- a[k] = (a[k] || 0n) + b[k];
1356
+ const sum = (a[k] || 0n) + b[k];
1357
+ if (sum === 0n) {
1358
+ delete a[k];
1359
+ } else {
1360
+ a[k] = sum;
1361
+ }
1358
1362
  }
1359
1363
  }
1360
1364
  return a;
@@ -1393,16 +1397,9 @@ function utxosToCores(utxos) {
1393
1397
  return result;
1394
1398
  }
1395
1399
  function coreToUtxo(coreUtxo) {
1396
- const utxoCore = CSL.TransactionUnspentOutput.from_bytes(
1397
- coreUtxo.to_cbor_bytes()
1398
- );
1399
1400
  const utxo = {
1400
- ...coreToOutRef(
1401
- CML.TransactionInput.from_cbor_bytes(utxoCore.input().to_bytes())
1402
- ),
1403
- ...coreToTxOutput(
1404
- CML.TransactionOutput.from_cbor_bytes(utxoCore.output().to_bytes())
1405
- )
1401
+ ...coreToOutRef(coreUtxo.input()),
1402
+ ...coreToTxOutput(coreUtxo.output())
1406
1403
  };
1407
1404
  return utxo;
1408
1405
  }
package/dist/index.js CHANGED
@@ -480,6 +480,8 @@ var PROTOCOL_PARAMETERS_DEFAULT = {
480
480
  maxValSize: 5e3,
481
481
  keyDeposit: 2000000n,
482
482
  poolDeposit: 500000000n,
483
+ drepDeposit: 500000000n,
484
+ govActionDeposit: 100000000000n,
483
485
  priceMem: 0.0577,
484
486
  priceStep: 721e-7,
485
487
  maxTxExMem: 14000000n,
@@ -1203,9 +1205,6 @@ function slotToUnixTime(network, slot) {
1203
1205
  return slotToBeginUnixTime(slot, SLOT_CONFIG_NETWORK[network]);
1204
1206
  }
1205
1207
 
1206
- // src/utxo.ts
1207
- import * as CSL from "@emurgo/cardano-serialization-lib-nodejs";
1208
-
1209
1208
  // src/value.ts
1210
1209
  import { fromHex as fromHex4, toHex as toHex3 } from "@lucid-evolution/core-utils";
1211
1210
  function valueToAssets(value) {
@@ -1275,7 +1274,12 @@ function addAssets(...assets) {
1275
1274
  return assets.reduce((a, b) => {
1276
1275
  for (const k in b) {
1277
1276
  if (Object.hasOwn(b, k)) {
1278
- a[k] = (a[k] || 0n) + b[k];
1277
+ const sum = (a[k] || 0n) + b[k];
1278
+ if (sum === 0n) {
1279
+ delete a[k];
1280
+ } else {
1281
+ a[k] = sum;
1282
+ }
1279
1283
  }
1280
1284
  }
1281
1285
  return a;
@@ -1314,16 +1318,9 @@ function utxosToCores(utxos) {
1314
1318
  return result;
1315
1319
  }
1316
1320
  function coreToUtxo(coreUtxo) {
1317
- const utxoCore = CSL.TransactionUnspentOutput.from_bytes(
1318
- coreUtxo.to_cbor_bytes()
1319
- );
1320
1321
  const utxo = {
1321
- ...coreToOutRef(
1322
- CML.TransactionInput.from_cbor_bytes(utxoCore.input().to_bytes())
1323
- ),
1324
- ...coreToTxOutput(
1325
- CML.TransactionOutput.from_cbor_bytes(utxoCore.output().to_bytes())
1326
- )
1322
+ ...coreToOutRef(coreUtxo.input()),
1323
+ ...coreToTxOutput(coreUtxo.output())
1327
1324
  };
1328
1325
  return utxo;
1329
1326
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/utils",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -29,17 +29,15 @@
29
29
  "@anastasia-labs/cardano-multiplatform-lib-browser": "6.0.2-1",
30
30
  "@anastasia-labs/cardano-multiplatform-lib-nodejs": "6.0.2-1",
31
31
  "@effect/schema": "^0.68.16",
32
- "@emurgo/cardano-serialization-lib-browser": "^11.5.0",
33
- "@emurgo/cardano-serialization-lib-nodejs": "^11.5.0",
34
32
  "@harmoniclabs/plutus-data": "^1.2.4",
35
33
  "@harmoniclabs/uplc": "^1.2.4",
36
34
  "bip39": "^3.1.0",
37
35
  "cborg": "^4.2.0",
38
36
  "effect": "^3.1.2",
39
- "@lucid-evolution/core-types": "0.1.17",
37
+ "@lucid-evolution/core-types": "0.1.18",
40
38
  "@lucid-evolution/core-utils": "0.1.15",
41
39
  "@lucid-evolution/crc8": "0.1.8",
42
- "@lucid-evolution/plutus": "0.1.23",
40
+ "@lucid-evolution/plutus": "0.1.24",
43
41
  "@lucid-evolution/uplc": "0.2.12"
44
42
  },
45
43
  "devDependencies": {