@lucid-evolution/utils 0.1.76 → 0.2.0

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
@@ -99,7 +99,7 @@ module.exports = __toCommonJS(index_exports);
99
99
  var S = __toESM(require("@effect/schema/Schema"), 1);
100
100
 
101
101
  // src/core.ts
102
- var CML = __toESM(require("@anastasia-labs/cardano-multiplatform-lib-nodejs"), 1);
102
+ var CML = __toESM(require("@lucid-evolution/cml"), 1);
103
103
 
104
104
  // src/native.ts
105
105
  var toCMLNativeScript = (native) => {
@@ -1820,9 +1820,13 @@ var sortCanonical = (assets) => (0, import_effect.pipe)(
1820
1820
 
1821
1821
  // src/utxo.ts
1822
1822
  var utxoToTransactionOutput = (utxo) => (0, import_core_utils6.withCMLScope)((own) => {
1823
+ const address = own(CML.Address.from_bech32(utxo.address));
1823
1824
  const value = own(assetsToValue(utxo.assets));
1824
- const builder = own(buildOutput(utxo, own).with_value(value));
1825
- return own(builder.build()).output();
1825
+ const datum = utxo.datum ? own(CML.PlutusData.from_cbor_hex(utxo.datum)) : void 0;
1826
+ const datumHash = datum && utxo.datumHash ? own(CML.hash_plutus_data(datum)) : void 0;
1827
+ const scriptRef = utxo.scriptRef ? toScriptRef(utxo.scriptRef) : void 0;
1828
+ const datumOption = datumHash ? CML.DatumOption.new_hash(datumHash) : datum ? CML.DatumOption.new_datum(datum) : void 0;
1829
+ return CML.TransactionOutput.new(address, value, datumOption, scriptRef);
1826
1830
  });
1827
1831
  var utxoToTransactionInput = (utxo) => (0, import_core_utils6.withCMLScope)(
1828
1832
  (own) => CML.TransactionInput.new(
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _effect_schema_AST from '@effect/schema/AST';
2
2
  import { Script, Native, Network, Credential, RewardAddress, AddressDetails, CertificateValidator, WithdrawalValidator, DatumJson, Datum, ProtocolParameters, CostModels, Address, KeyHash, ScriptHash, DatumHash, PrivateKey, PublicKey, Exact, MintingPolicy, PolicyId, SpendingValidator, Validator, Slot, UnixTime, UTxO, OutRef, TxOutput, Assets, Unit, RedeemerTag } from '@lucid-evolution/core-types';
3
- import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
3
+ import * as CML from '@lucid-evolution/cml';
4
4
  import { Data } from '@lucid-evolution/plutus';
5
5
 
6
6
  /**
@@ -164,6 +164,10 @@ declare class ScriptCache<V> {
164
164
  declare function unixTimeToSlot(network: Network, unixTime: UnixTime): Slot;
165
165
  declare function slotToUnixTime(network: Network, slot: Slot): UnixTime;
166
166
 
167
+ /**
168
+ * Builds the output directly rather than through `TransactionOutputBuilder`,
169
+ * whose every stage copies the datum and script; the result is the same.
170
+ */
167
171
  declare const utxoToTransactionOutput: (utxo: UTxO) => CML.TransactionOutput;
168
172
  declare const utxoToTransactionInput: (utxo: UTxO) => CML.TransactionInput;
169
173
  declare const utxoToCore: (utxo: UTxO) => CML.TransactionUnspentOutput;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _effect_schema_AST from '@effect/schema/AST';
2
2
  import { Script, Native, Network, Credential, RewardAddress, AddressDetails, CertificateValidator, WithdrawalValidator, DatumJson, Datum, ProtocolParameters, CostModels, Address, KeyHash, ScriptHash, DatumHash, PrivateKey, PublicKey, Exact, MintingPolicy, PolicyId, SpendingValidator, Validator, Slot, UnixTime, UTxO, OutRef, TxOutput, Assets, Unit, RedeemerTag } from '@lucid-evolution/core-types';
3
- import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
3
+ import * as CML from '@lucid-evolution/cml';
4
4
  import { Data } from '@lucid-evolution/plutus';
5
5
 
6
6
  /**
@@ -164,6 +164,10 @@ declare class ScriptCache<V> {
164
164
  declare function unixTimeToSlot(network: Network, unixTime: UnixTime): Slot;
165
165
  declare function slotToUnixTime(network: Network, slot: Slot): UnixTime;
166
166
 
167
+ /**
168
+ * Builds the output directly rather than through `TransactionOutputBuilder`,
169
+ * whose every stage copies the datum and script; the result is the same.
170
+ */
167
171
  declare const utxoToTransactionOutput: (utxo: UTxO) => CML.TransactionOutput;
168
172
  declare const utxoToTransactionInput: (utxo: UTxO) => CML.TransactionInput;
169
173
  declare const utxoToCore: (utxo: UTxO) => CML.TransactionUnspentOutput;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as S from "@effect/schema/Schema";
3
3
 
4
4
  // src/core.ts
5
- import * as CML from "@anastasia-labs/cardano-multiplatform-lib-nodejs";
5
+ import * as CML from "@lucid-evolution/cml";
6
6
 
7
7
  // src/native.ts
8
8
  var toCMLNativeScript = (native) => {
@@ -1737,9 +1737,13 @@ var sortCanonical = (assets) => pipe(
1737
1737
 
1738
1738
  // src/utxo.ts
1739
1739
  var utxoToTransactionOutput = (utxo) => withCMLScope4((own) => {
1740
+ const address = own(CML.Address.from_bech32(utxo.address));
1740
1741
  const value = own(assetsToValue(utxo.assets));
1741
- const builder = own(buildOutput(utxo, own).with_value(value));
1742
- return own(builder.build()).output();
1742
+ const datum = utxo.datum ? own(CML.PlutusData.from_cbor_hex(utxo.datum)) : void 0;
1743
+ const datumHash = datum && utxo.datumHash ? own(CML.hash_plutus_data(datum)) : void 0;
1744
+ const scriptRef = utxo.scriptRef ? toScriptRef(utxo.scriptRef) : void 0;
1745
+ const datumOption = datumHash ? CML.DatumOption.new_hash(datumHash) : datum ? CML.DatumOption.new_datum(datum) : void 0;
1746
+ return CML.TransactionOutput.new(address, value, datumOption, scriptRef);
1743
1747
  });
1744
1748
  var utxoToTransactionInput = (utxo) => withCMLScope4(
1745
1749
  (own) => CML.TransactionInput.new(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/utils",
3
- "version": "0.1.76",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -22,12 +22,9 @@
22
22
  "author": "",
23
23
  "license": "MIT",
24
24
  "browser": {
25
- "@anastasia-labs/cardano-multiplatform-lib-nodejs": "@anastasia-labs/cardano-multiplatform-lib-browser",
26
25
  "@emurgo/cardano-serialization-lib-nodejs": "@emurgo/cardano-serialization-lib-browser"
27
26
  },
28
27
  "dependencies": {
29
- "@anastasia-labs/cardano-multiplatform-lib-browser": "6.2.0-1",
30
- "@anastasia-labs/cardano-multiplatform-lib-nodejs": "6.2.0-1",
31
28
  "@cardano-sdk/core": "^0.46.10",
32
29
  "@effect/schema": "^0.68.16",
33
30
  "@harmoniclabs/plutus-data": "^1.2.4",
@@ -35,10 +32,11 @@
35
32
  "bip39": "^3.1.0",
36
33
  "cbor-x": "^1.6.0",
37
34
  "effect": "^3.10.4",
38
- "@lucid-evolution/core-types": "0.4.0",
39
- "@lucid-evolution/core-utils": "0.1.17",
40
35
  "@lucid-evolution/crc8": "0.1.8",
41
- "@lucid-evolution/plutus": "0.1.37",
36
+ "@lucid-evolution/core-utils": "0.2.0",
37
+ "@lucid-evolution/core-types": "0.5.0",
38
+ "@lucid-evolution/cml": "0.1.0",
39
+ "@lucid-evolution/plutus": "0.2.0",
42
40
  "@lucid-evolution/uplc": "0.3.0"
43
41
  },
44
42
  "devDependencies": {