@lucid-evolution/utils 0.1.75 → 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.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) => {
@@ -104,7 +104,107 @@ function networkToId(network) {
104
104
  // src/cbor.ts
105
105
  import { fromHex, toHex } from "@lucid-evolution/core-utils";
106
106
  import { decode, encode } from "cbor-x";
107
+
108
+ // src/script-cache.ts
109
+ var SHORT_SCRIPT_LENGTH = 1024;
110
+ var SAMPLE_COUNT = 32;
111
+ var SAMPLE_WIDTH = 16;
112
+ var TAIL_WIDTH = 512;
113
+ var MAX_CHAIN = 4;
114
+ var fingerprint = (namespace, script) => {
115
+ const length = script.length;
116
+ if (length <= SHORT_SCRIPT_LENGTH) return namespace + ":" + script;
117
+ const stride = Math.floor((length - TAIL_WIDTH) / SAMPLE_COUNT);
118
+ let key = namespace + ":" + length + ":";
119
+ for (let offset = 0; offset < SAMPLE_COUNT; offset++) {
120
+ const start = offset * stride;
121
+ key += script.slice(start, start + SAMPLE_WIDTH);
122
+ }
123
+ return key + script.slice(length - TAIL_WIDTH);
124
+ };
125
+ var ScriptCache = class {
126
+ /**
127
+ * @param capacity maximum number of entries
128
+ * @param maxWeight maximum total weight, see `weigh`
129
+ * @param weigh approximate retained bytes of an entry besides its key
130
+ */
131
+ constructor(capacity, maxWeight, weigh = () => 0) {
132
+ this.capacity = capacity;
133
+ this.maxWeight = maxWeight;
134
+ this.weigh = weigh;
135
+ }
136
+ buckets = /* @__PURE__ */ new Map();
137
+ /** Insertion order, for first-in first-out eviction. */
138
+ order = /* @__PURE__ */ new Set();
139
+ totalWeight = 0;
140
+ get size() {
141
+ return this.order.size;
142
+ }
143
+ get(namespace, script) {
144
+ const bucket = this.buckets.get(fingerprint(namespace, script));
145
+ if (bucket === void 0) return void 0;
146
+ for (const entry of bucket) {
147
+ if (entry.script === script) return entry.value;
148
+ }
149
+ return void 0;
150
+ }
151
+ set(namespace, script, value) {
152
+ const weight = script.length + this.weigh(value);
153
+ if (weight > this.maxWeight) return;
154
+ const key = fingerprint(namespace, script);
155
+ const previous = this.buckets.get(key);
156
+ if (previous !== void 0) {
157
+ const existing = previous.find((entry2) => entry2.script === script);
158
+ if (existing !== void 0) this.remove(existing);
159
+ if (previous.length >= MAX_CHAIN) this.remove(previous[0]);
160
+ }
161
+ const entry = { key, script, value, weight };
162
+ const bucket = this.buckets.get(key);
163
+ if (bucket === void 0) this.buckets.set(key, [entry]);
164
+ else bucket.push(entry);
165
+ this.order.add(entry);
166
+ this.totalWeight += weight;
167
+ while (this.order.size > this.capacity || this.totalWeight > this.maxWeight) {
168
+ this.remove(this.order.values().next().value);
169
+ }
170
+ }
171
+ clear() {
172
+ this.buckets.clear();
173
+ this.order.clear();
174
+ this.totalWeight = 0;
175
+ }
176
+ remove(entry) {
177
+ const bucket = this.buckets.get(entry.key);
178
+ if (bucket !== void 0) {
179
+ const index = bucket.indexOf(entry);
180
+ if (index !== -1) bucket.splice(index, 1);
181
+ if (bucket.length === 0) this.buckets.delete(entry.key);
182
+ }
183
+ if (this.order.delete(entry)) this.totalWeight -= entry.weight;
184
+ }
185
+ /**
186
+ * Returns the cached value, or computes, stores and returns it. A `compute`
187
+ * that throws stores nothing.
188
+ */
189
+ getOrCompute(namespace, script, compute) {
190
+ const cached = this.get(namespace, script);
191
+ if (cached !== void 0) return cached;
192
+ const value = compute();
193
+ this.set(namespace, script, value);
194
+ return value;
195
+ }
196
+ };
197
+
198
+ // src/cbor.ts
107
199
  var applyDoubleCborEncoding = (script) => {
200
+ if (typeof script !== "string") return decodingDoubleCborEncoding(script);
201
+ const cached = doubleCborCache.get("", script);
202
+ if (cached !== void 0) return cached;
203
+ const encoded = doubleCborEncoding(script);
204
+ doubleCborCache.set("", script, encoded);
205
+ return encoded;
206
+ };
207
+ var decodingDoubleCborEncoding = (script) => {
108
208
  try {
109
209
  decode(decode(fromHex(script)));
110
210
  return script;
@@ -117,6 +217,75 @@ var applyDoubleCborEncoding = (script) => {
117
217
  }
118
218
  }
119
219
  };
220
+ var doubleCborEncoding = (script) => {
221
+ const layers = bytestringLayers(script);
222
+ switch (layers) {
223
+ case 2:
224
+ return script;
225
+ case 1:
226
+ return bytestringHeaderHex(script.length / 2) + script.toLowerCase();
227
+ case 0: {
228
+ const inner = bytestringHeaderHex(script.length / 2);
229
+ const innerLength = script.length / 2 + inner.length / 2;
230
+ return bytestringHeaderHex(innerLength) + inner + script.toLowerCase();
231
+ }
232
+ default:
233
+ return decodingDoubleCborEncoding(script);
234
+ }
235
+ };
236
+ var doubleCborCache = new ScriptCache(
237
+ 4096,
238
+ 64 * 1024 * 1024,
239
+ // Overcounts a script that is already double encoded, whose result is the
240
+ // key itself.
241
+ (encoded) => encoded.length
242
+ );
243
+ var NON_HEX = /[^0-9a-fA-F]/;
244
+ var hexByte = (hex, index) => parseInt(hex.slice(index * 2, index * 2 + 2), 16);
245
+ var itemHeader = (hex, offset, end) => {
246
+ if (offset >= end) return void 0;
247
+ const token = hexByte(hex, offset);
248
+ const major = token >> 5;
249
+ if (major > 2) return void 0;
250
+ const info = token & 31;
251
+ let argument;
252
+ let headerLength;
253
+ if (info < 24) {
254
+ argument = info;
255
+ headerLength = 1;
256
+ } else if (info <= 26) {
257
+ headerLength = 1 + (1 << info - 24);
258
+ if (offset + headerLength > end) return void 0;
259
+ argument = 0;
260
+ for (let index = offset + 1; index < offset + headerLength; index++) {
261
+ argument = argument * 256 + hexByte(hex, index);
262
+ }
263
+ } else {
264
+ return void 0;
265
+ }
266
+ const payload = major === 2 ? argument : 0;
267
+ return { major, span: headerLength + payload, headerLength };
268
+ };
269
+ var bytestringLayers = (script) => {
270
+ if (script.length === 0 || script.length % 2 !== 0) return void 0;
271
+ if (NON_HEX.test(script)) return void 0;
272
+ const length = script.length / 2;
273
+ const outer = itemHeader(script, 0, length);
274
+ if (outer === void 0) return void 0;
275
+ if (outer.span !== length) return 0;
276
+ if (outer.major !== 2) return 1;
277
+ if (outer.headerLength === length) return void 0;
278
+ const inner = itemHeader(script, outer.headerLength, length);
279
+ if (inner === void 0) return void 0;
280
+ return inner.span === length - outer.headerLength ? 2 : 1;
281
+ };
282
+ var bytestringHeaderHex = (length) => {
283
+ if (length < 24) return byteHex(64 + length);
284
+ if (length < 256) return "58" + byteHex(length);
285
+ if (length < 65536) return "59" + length.toString(16).padStart(4, "0");
286
+ return "5a" + length.toString(16).padStart(8, "0");
287
+ };
288
+ var byteHex = (byte) => byte.toString(16).padStart(2, "0");
120
289
  var applySingleCborEncoding = (script) => {
121
290
  try {
122
291
  decode(decode(fromHex(script)));
@@ -225,77 +394,165 @@ function validatorToAddress(network, validator, stakeCredential) {
225
394
  });
226
395
  }
227
396
  function validatorToScriptHash(validator) {
228
- return withCMLScope((own) => {
229
- switch (validator.type) {
230
- case "Native":
231
- return own(
232
- own(CML.NativeScript.from_cbor_hex(validator.script)).hash()
233
- ).to_hex();
234
- case "PlutusV1": {
235
- const script = own(
236
- CML.PlutusV1Script.from_cbor_hex(
237
- applyDoubleCborEncoding(validator.script)
238
- )
239
- );
240
- return own(own(CML.PlutusScript.from_v1(script)).hash()).to_hex();
241
- }
242
- case "PlutusV2": {
243
- const script = own(
244
- CML.PlutusV2Script.from_cbor_hex(
245
- applyDoubleCborEncoding(validator.script)
246
- )
247
- );
248
- return own(own(CML.PlutusScript.from_v2(script)).hash()).to_hex();
249
- }
250
- case "PlutusV3": {
251
- const script = own(
252
- CML.PlutusV3Script.from_cbor_hex(
253
- applyDoubleCborEncoding(validator.script)
254
- )
255
- );
256
- return own(own(CML.PlutusScript.from_v3(script)).hash()).to_hex();
257
- }
258
- default:
259
- throw new Error("No variant matched");
260
- }
261
- });
397
+ const info = tryScriptInfo(validator);
398
+ return info === void 0 ? decodingValidatorToScriptHash(validator) : info.hash;
399
+ }
400
+ function scriptCborBytes(script) {
401
+ return scriptInfo(script).bytes.slice();
262
402
  }
263
403
  function toScriptRef(script) {
404
+ const info = tryScriptInfo(script);
405
+ if (info === void 0) return decodingToScriptRef(script);
406
+ const { bytes } = info;
264
407
  return withCMLScope((own) => {
265
408
  switch (script.type) {
266
409
  case "Native":
267
410
  return CML.Script.new_native(
268
- own(CML.NativeScript.from_cbor_hex(script.script))
411
+ own(CML.NativeScript.from_cbor_bytes(bytes))
269
412
  );
270
413
  case "PlutusV1":
271
414
  return CML.Script.new_plutus_v1(
272
- own(
273
- CML.PlutusV1Script.from_cbor_hex(
274
- applyDoubleCborEncoding(script.script)
275
- )
276
- )
415
+ own(CML.PlutusV1Script.from_cbor_bytes(bytes))
277
416
  );
278
417
  case "PlutusV2":
279
418
  return CML.Script.new_plutus_v2(
280
- own(
281
- CML.PlutusV2Script.from_cbor_hex(
282
- applyDoubleCborEncoding(script.script)
283
- )
284
- )
419
+ own(CML.PlutusV2Script.from_cbor_bytes(bytes))
285
420
  );
286
421
  case "PlutusV3":
287
422
  return CML.Script.new_plutus_v3(
288
- own(
289
- CML.PlutusV3Script.from_cbor_hex(
290
- applyDoubleCborEncoding(script.script)
291
- )
292
- )
423
+ own(CML.PlutusV3Script.from_cbor_bytes(bytes))
293
424
  );
294
425
  default:
295
426
  throw new Error("No variant matched.");
296
427
  }
297
428
  });
298
429
  }
430
+ var scriptInfoCache = new ScriptCache(
431
+ 4096,
432
+ 64 * 1024 * 1024,
433
+ (info) => info.bytes.length + info.hash.length
434
+ );
435
+ var scriptInfo = (script) => scriptInfoCache.getOrCompute(
436
+ script.type,
437
+ script.script,
438
+ () => computeScriptInfo(script)
439
+ );
440
+ var tryScriptInfo = (script) => {
441
+ try {
442
+ if (typeof script.script !== "string") return void 0;
443
+ return scriptInfo(script);
444
+ } catch {
445
+ return void 0;
446
+ }
447
+ };
448
+ var computeScriptInfo = ({ type, script }) => withCMLScope((own) => {
449
+ switch (type) {
450
+ case "Native": {
451
+ const bytes = fromHex2(script);
452
+ const hash = own(
453
+ own(CML.NativeScript.from_cbor_bytes(bytes)).hash()
454
+ ).to_hex();
455
+ return { hash, bytes };
456
+ }
457
+ case "PlutusV1": {
458
+ const bytes = fromHex2(applyDoubleCborEncoding(script));
459
+ const plutus = own(
460
+ CML.PlutusScript.from_v1(
461
+ own(CML.PlutusV1Script.from_cbor_bytes(bytes))
462
+ )
463
+ );
464
+ return { hash: own(plutus.hash()).to_hex(), bytes };
465
+ }
466
+ case "PlutusV2": {
467
+ const bytes = fromHex2(applyDoubleCborEncoding(script));
468
+ const plutus = own(
469
+ CML.PlutusScript.from_v2(
470
+ own(CML.PlutusV2Script.from_cbor_bytes(bytes))
471
+ )
472
+ );
473
+ return { hash: own(plutus.hash()).to_hex(), bytes };
474
+ }
475
+ case "PlutusV3": {
476
+ const bytes = fromHex2(applyDoubleCborEncoding(script));
477
+ const plutus = own(
478
+ CML.PlutusScript.from_v3(
479
+ own(CML.PlutusV3Script.from_cbor_bytes(bytes))
480
+ )
481
+ );
482
+ return { hash: own(plutus.hash()).to_hex(), bytes };
483
+ }
484
+ default:
485
+ throw new Error("No variant matched");
486
+ }
487
+ });
488
+ var decodingValidatorToScriptHash = (validator) => withCMLScope((own) => {
489
+ switch (validator.type) {
490
+ case "Native":
491
+ return own(
492
+ own(CML.NativeScript.from_cbor_hex(validator.script)).hash()
493
+ ).to_hex();
494
+ case "PlutusV1": {
495
+ const script = own(
496
+ CML.PlutusV1Script.from_cbor_hex(
497
+ applyDoubleCborEncoding(validator.script)
498
+ )
499
+ );
500
+ return own(own(CML.PlutusScript.from_v1(script)).hash()).to_hex();
501
+ }
502
+ case "PlutusV2": {
503
+ const script = own(
504
+ CML.PlutusV2Script.from_cbor_hex(
505
+ applyDoubleCborEncoding(validator.script)
506
+ )
507
+ );
508
+ return own(own(CML.PlutusScript.from_v2(script)).hash()).to_hex();
509
+ }
510
+ case "PlutusV3": {
511
+ const script = own(
512
+ CML.PlutusV3Script.from_cbor_hex(
513
+ applyDoubleCborEncoding(validator.script)
514
+ )
515
+ );
516
+ return own(own(CML.PlutusScript.from_v3(script)).hash()).to_hex();
517
+ }
518
+ default:
519
+ throw new Error("No variant matched");
520
+ }
521
+ });
522
+ var decodingToScriptRef = (script) => withCMLScope((own) => {
523
+ switch (script.type) {
524
+ case "Native":
525
+ return CML.Script.new_native(
526
+ own(CML.NativeScript.from_cbor_hex(script.script))
527
+ );
528
+ case "PlutusV1":
529
+ return CML.Script.new_plutus_v1(
530
+ own(
531
+ CML.PlutusV1Script.from_cbor_hex(
532
+ applyDoubleCborEncoding(script.script)
533
+ )
534
+ )
535
+ );
536
+ case "PlutusV2":
537
+ return CML.Script.new_plutus_v2(
538
+ own(
539
+ CML.PlutusV2Script.from_cbor_hex(
540
+ applyDoubleCborEncoding(script.script)
541
+ )
542
+ )
543
+ );
544
+ case "PlutusV3":
545
+ return CML.Script.new_plutus_v3(
546
+ own(
547
+ CML.PlutusV3Script.from_cbor_hex(
548
+ applyDoubleCborEncoding(script.script)
549
+ )
550
+ )
551
+ );
552
+ default:
553
+ throw new Error("No variant matched.");
554
+ }
555
+ });
299
556
  function fromScriptRef(scriptRef) {
300
557
  return withCMLScope((own) => {
301
558
  const kind = scriptRef.kind();
@@ -393,12 +650,24 @@ var addressDetails = (address) => ({
393
650
  bech32: address.to_bech32(void 0),
394
651
  hex: address.to_hex()
395
652
  });
396
- function getAddressDetails(address) {
653
+ var HEX_PATTERN = /^[0-9a-fA-F]*$/;
654
+ var parseShelleyAddress = (address) => {
655
+ if (HEX_PATTERN.test(address)) {
656
+ try {
657
+ return CML.Address.from_hex(address);
658
+ } catch (_e) {
659
+ }
660
+ }
397
661
  try {
398
- return withCMLScope2((own) => {
399
- const parsedAddress = own(
400
- CML.BaseAddress.from_address(own(addressFromHexOrBech32(address)))
401
- );
662
+ return CML.Address.from_bech32(address);
663
+ } catch (_e) {
664
+ return void 0;
665
+ }
666
+ };
667
+ var shelleyAddressDetails = (address, own) => {
668
+ switch (address.kind()) {
669
+ case CML.AddressKind.Base: {
670
+ const parsedAddress = own(CML.BaseAddress.from_address(address));
402
671
  const paymentCredential = credentialDetails(
403
672
  own(parsedAddress.payment()),
404
673
  own
@@ -417,16 +686,9 @@ function getAddressDetails(address) {
417
686
  paymentCredential,
418
687
  stakeCredential
419
688
  };
420
- });
421
- } catch (_e) {
422
- }
423
- try {
424
- return withCMLScope2((own) => {
425
- const parsedAddress = own(
426
- CML.EnterpriseAddress.from_address(
427
- own(addressFromHexOrBech32(address))
428
- )
429
- );
689
+ }
690
+ case CML.AddressKind.Enterprise: {
691
+ const parsedAddress = own(CML.EnterpriseAddress.from_address(address));
430
692
  const paymentCredential = credentialDetails(
431
693
  own(parsedAddress.payment()),
432
694
  own
@@ -440,14 +702,9 @@ function getAddressDetails(address) {
440
702
  address: details,
441
703
  paymentCredential
442
704
  };
443
- });
444
- } catch (_e) {
445
- }
446
- try {
447
- return withCMLScope2((own) => {
448
- const parsedAddress = own(
449
- CML.PointerAddress.from_address(own(addressFromHexOrBech32(address)))
450
- );
705
+ }
706
+ case CML.AddressKind.Ptr: {
707
+ const parsedAddress = own(CML.PointerAddress.from_address(address));
451
708
  const paymentCredential = credentialDetails(
452
709
  own(parsedAddress.payment()),
453
710
  own
@@ -461,14 +718,9 @@ function getAddressDetails(address) {
461
718
  address: details,
462
719
  paymentCredential
463
720
  };
464
- });
465
- } catch (_e) {
466
- }
467
- try {
468
- return withCMLScope2((own) => {
469
- const parsedAddress = own(
470
- CML.RewardAddress.from_address(own(addressFromHexOrBech32(address)))
471
- );
721
+ }
722
+ case CML.AddressKind.Reward: {
723
+ const parsedAddress = own(CML.RewardAddress.from_address(address));
472
724
  const stakeCredential = credentialDetails(
473
725
  own(parsedAddress.payment()),
474
726
  own
@@ -477,36 +729,83 @@ function getAddressDetails(address) {
477
729
  own(parsedAddress.to_address())
478
730
  );
479
731
  return { type: "Reward", networkId, address: details, stakeCredential };
732
+ }
733
+ default:
734
+ return void 0;
735
+ }
736
+ };
737
+ var byronAddressDetails = (address) => withCMLScope2((own) => {
738
+ const parsedAddress = own(
739
+ ((address2) => {
740
+ if (HEX_PATTERN.test(address2)) {
741
+ try {
742
+ return CML.ByronAddress.from_cbor_hex(address2);
743
+ } catch (_e) {
744
+ }
745
+ }
746
+ try {
747
+ return CML.ByronAddress.from_base58(address2);
748
+ } catch (_e) {
749
+ return void 0;
750
+ }
751
+ })(address)
752
+ );
753
+ if (!parsedAddress) return void 0;
754
+ return {
755
+ type: "Byron",
756
+ networkId: own(parsedAddress.content()).network_id(),
757
+ address: {
758
+ bech32: "",
759
+ hex: own(parsedAddress.to_address()).to_hex()
760
+ }
761
+ };
762
+ });
763
+ var parseAddressDetails = (address) => {
764
+ try {
765
+ const details = withCMLScope2((own) => {
766
+ const parsedAddress = own(parseShelleyAddress(address));
767
+ return parsedAddress && shelleyAddressDetails(parsedAddress, own);
480
768
  });
769
+ if (details) return details;
481
770
  } catch (_e) {
482
771
  }
483
772
  try {
484
- return withCMLScope2((own) => {
485
- const parsedAddress = own(
486
- ((address2) => {
487
- try {
488
- return CML.ByronAddress.from_cbor_hex(address2);
489
- } catch (_e) {
490
- try {
491
- return CML.ByronAddress.from_base58(address2);
492
- } catch (_e2) {
493
- throw new Error("Could not deserialize address.");
494
- }
495
- }
496
- })(address)
497
- );
498
- return {
499
- type: "Byron",
500
- networkId: own(parsedAddress.content()).network_id(),
501
- address: {
502
- bech32: "",
503
- hex: own(parsedAddress.to_address()).to_hex()
504
- }
505
- };
506
- });
773
+ const details = byronAddressDetails(address);
774
+ if (details) return details;
507
775
  } catch (_e) {
508
776
  }
509
777
  throw new Error("No address type matched for: " + address);
778
+ };
779
+ var ADDRESS_DETAILS_CACHE_CAPACITY = 1e4;
780
+ var addressDetailsCache = /* @__PURE__ */ new Map();
781
+ var copyCredential = (credential) => ({
782
+ type: credential.type,
783
+ hash: credential.hash
784
+ });
785
+ var copyAddressDetails = (details) => {
786
+ const copy = {
787
+ type: details.type,
788
+ networkId: details.networkId,
789
+ address: { bech32: details.address.bech32, hex: details.address.hex }
790
+ };
791
+ if (details.paymentCredential) {
792
+ copy.paymentCredential = copyCredential(details.paymentCredential);
793
+ }
794
+ if (details.stakeCredential) {
795
+ copy.stakeCredential = copyCredential(details.stakeCredential);
796
+ }
797
+ return copy;
798
+ };
799
+ function getAddressDetails(address) {
800
+ let details = addressDetailsCache.get(address);
801
+ if (!details) {
802
+ details = parseAddressDetails(address);
803
+ if (addressDetailsCache.size >= ADDRESS_DETAILS_CACHE_CAPACITY) {
804
+ addressDetailsCache.delete(addressDetailsCache.keys().next().value);
805
+ }
806
+ addressDetailsCache.set(address, details);
807
+ }
808
+ return copyAddressDetails(details);
510
809
  }
511
810
 
512
811
  // src/cost_model.ts
@@ -1438,9 +1737,13 @@ var sortCanonical = (assets) => pipe(
1438
1737
 
1439
1738
  // src/utxo.ts
1440
1739
  var utxoToTransactionOutput = (utxo) => withCMLScope4((own) => {
1740
+ const address = own(CML.Address.from_bech32(utxo.address));
1441
1741
  const value = own(assetsToValue(utxo.assets));
1442
- const builder = own(buildOutput(utxo, own).with_value(value));
1443
- 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);
1444
1747
  });
1445
1748
  var utxoToTransactionInput = (utxo) => withCMLScope4(
1446
1749
  (own) => CML.TransactionInput.new(
@@ -1663,6 +1966,7 @@ var fromCMLRedeemerTag = (tag) => {
1663
1966
  export {
1664
1967
  CBOREncodingLevel,
1665
1968
  PROTOCOL_PARAMETERS_DEFAULT,
1969
+ ScriptCache,
1666
1970
  addAssets,
1667
1971
  addressFromHexOrBech32,
1668
1972
  applyDoubleCborEncoding,
@@ -1697,6 +2001,7 @@ export {
1697
2001
  networkToId,
1698
2002
  parseCMLNative,
1699
2003
  paymentCredentialOf,
2004
+ scriptCborBytes,
1700
2005
  scriptFromCMLNative,
1701
2006
  scriptFromNative,
1702
2007
  scriptHashToCredential,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/utils",
3
- "version": "0.1.75",
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,11 +32,12 @@
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.3.0",
39
- "@lucid-evolution/core-utils": "0.1.17",
40
35
  "@lucid-evolution/crc8": "0.1.8",
41
- "@lucid-evolution/plutus": "0.1.36",
42
- "@lucid-evolution/uplc": "0.2.24"
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",
40
+ "@lucid-evolution/uplc": "0.3.0"
43
41
  },
44
42
  "devDependencies": {
45
43
  "@types/node": "^20.12.8",