@lucid-evolution/utils 0.1.52 → 0.1.54

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
@@ -192,13 +192,14 @@ function networkToId(network) {
192
192
 
193
193
  // src/cbor.ts
194
194
  var import_core_utils = require("@lucid-evolution/core-utils");
195
- var import_cborg = require("cborg");
195
+ var cbors = __toESM(require("@stricahq/cbors"), 1);
196
+ var { Decoder, Encoder } = cbors;
196
197
  var applyDoubleCborEncoding = (script) => {
197
198
  try {
198
- (0, import_cborg.decode)((0, import_cborg.decode)((0, import_core_utils.fromHex)(script)));
199
+ Decoder.decode(Decoder.decode(Buffer.from((0, import_core_utils.fromHex)(script))).value);
199
200
  return script;
200
201
  } catch (error) {
201
- return (0, import_core_utils.toHex)((0, import_cborg.encode)((0, import_core_utils.fromHex)(script)));
202
+ return (0, import_core_utils.toHex)(Encoder.encode((0, import_core_utils.fromHex)(script)));
202
203
  }
203
204
  };
204
205
  function datumJsonToCbor(json) {
@@ -247,8 +248,9 @@ function datumJsonToCbor(json) {
247
248
  var import_plutus = require("@lucid-evolution/plutus");
248
249
  var import_uplc = require("@harmoniclabs/uplc");
249
250
  var import_core_utils2 = require("@lucid-evolution/core-utils");
250
- var import_cborg2 = require("cborg");
251
+ var cbors2 = __toESM(require("@stricahq/cbors"), 1);
251
252
  var import_plutus_data = require("@harmoniclabs/plutus-data");
253
+ var { Encoder: Encoder2, Decoder: Decoder2 } = cbors2;
252
254
  function validatorToAddress(network, validator, stakeCredential) {
253
255
  const validatorHash = validatorToScriptHash(validator);
254
256
  if (stakeCredential) {
@@ -354,7 +356,11 @@ function mintingPolicyToId(mintingPolicy) {
354
356
  }
355
357
  function applyParamsToScript(plutusScript, params, type) {
356
358
  const program = (0, import_uplc.parseUPLC)(
357
- (0, import_cborg2.decode)((0, import_cborg2.decode)((0, import_core_utils2.fromHex)(applyDoubleCborEncoding(plutusScript)))),
359
+ Decoder2.decode(
360
+ Decoder2.decode(
361
+ Buffer.from((0, import_core_utils2.fromHex)(applyDoubleCborEncoding(plutusScript)))
362
+ ).value
363
+ ).value,
358
364
  "flat"
359
365
  );
360
366
  const parameters = type ? import_plutus.Data.castTo(params, type) : params;
@@ -364,8 +370,8 @@ function applyParamsToScript(plutusScript, params, type) {
364
370
  return appliedParameter;
365
371
  }, program.body);
366
372
  return (0, import_core_utils2.toHex)(
367
- (0, import_cborg2.encode)(
368
- (0, import_cborg2.encode)(
373
+ Encoder2.encode(
374
+ Encoder2.encode(
369
375
  (0, import_uplc.encodeUPLC)(new import_uplc.UPLCProgram(program.version, appliedProgram)).toBuffer().buffer
370
376
  )
371
377
  )
package/dist/index.js CHANGED
@@ -100,13 +100,14 @@ function networkToId(network) {
100
100
 
101
101
  // src/cbor.ts
102
102
  import { fromHex, toHex } from "@lucid-evolution/core-utils";
103
- import { decode, encode } from "cborg";
103
+ import * as cbors from "@stricahq/cbors";
104
+ var { Decoder, Encoder } = cbors;
104
105
  var applyDoubleCborEncoding = (script) => {
105
106
  try {
106
- decode(decode(fromHex(script)));
107
+ Decoder.decode(Decoder.decode(Buffer.from(fromHex(script))).value);
107
108
  return script;
108
109
  } catch (error) {
109
- return toHex(encode(fromHex(script)));
110
+ return toHex(Encoder.encode(fromHex(script)));
110
111
  }
111
112
  };
112
113
  function datumJsonToCbor(json) {
@@ -161,8 +162,9 @@ import {
161
162
  UPLCProgram
162
163
  } from "@harmoniclabs/uplc";
163
164
  import { fromHex as fromHex2, toHex as toHex2 } from "@lucid-evolution/core-utils";
164
- import { decode as decode2, encode as encode2 } from "cborg";
165
+ import * as cbors2 from "@stricahq/cbors";
165
166
  import { dataFromCbor } from "@harmoniclabs/plutus-data";
167
+ var { Encoder: Encoder2, Decoder: Decoder2 } = cbors2;
166
168
  function validatorToAddress(network, validator, stakeCredential) {
167
169
  const validatorHash = validatorToScriptHash(validator);
168
170
  if (stakeCredential) {
@@ -268,7 +270,11 @@ function mintingPolicyToId(mintingPolicy) {
268
270
  }
269
271
  function applyParamsToScript(plutusScript, params, type) {
270
272
  const program = parseUPLC(
271
- decode2(decode2(fromHex2(applyDoubleCborEncoding(plutusScript)))),
273
+ Decoder2.decode(
274
+ Decoder2.decode(
275
+ Buffer.from(fromHex2(applyDoubleCborEncoding(plutusScript)))
276
+ ).value
277
+ ).value,
272
278
  "flat"
273
279
  );
274
280
  const parameters = type ? Data.castTo(params, type) : params;
@@ -278,8 +284,8 @@ function applyParamsToScript(plutusScript, params, type) {
278
284
  return appliedParameter;
279
285
  }, program.body);
280
286
  return toHex2(
281
- encode2(
282
- encode2(
287
+ Encoder2.encode(
288
+ Encoder2.encode(
283
289
  encodeUPLC(new UPLCProgram(program.version, appliedProgram)).toBuffer().buffer
284
290
  )
285
291
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/utils",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,9 +31,9 @@
31
31
  "@effect/schema": "^0.68.16",
32
32
  "@harmoniclabs/plutus-data": "^1.2.4",
33
33
  "@harmoniclabs/uplc": "^1.2.4",
34
+ "@stricahq/cbors": "^1.0.3",
34
35
  "bip39": "^3.1.0",
35
- "cborg": "^4.2.0",
36
- "effect": "^3.1.2",
36
+ "effect": "^3.10.4",
37
37
  "@lucid-evolution/core-types": "0.1.21",
38
38
  "@lucid-evolution/core-utils": "0.1.16",
39
39
  "@lucid-evolution/crc8": "0.1.8",