@lucid-evolution/provider 0.1.50 → 0.1.51

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
@@ -52,7 +52,7 @@ var import_utils = require("@lucid-evolution/utils");
52
52
  // package.json
53
53
  var package_default = {
54
54
  name: "@lucid-evolution/provider",
55
- version: "0.1.50",
55
+ version: "0.1.51",
56
56
  description: "",
57
57
  main: "./dist/index.js",
58
58
  types: "./dist/index.d.ts",
@@ -359,7 +359,11 @@ var Blockfrost = class {
359
359
  ).then((res) => res.json());
360
360
  switch (type) {
361
361
  case "timelock":
362
- return void 0;
362
+ const { json: native } = await fetch(
363
+ `${this.url}/scripts/${r.reference_script_hash}/json`,
364
+ { headers: { project_id: this.projectId, lucid } }
365
+ ).then((res) => res.json());
366
+ return (0, import_utils.scriptFromNative)(native);
363
367
  case "plutusV1":
364
368
  return {
365
369
  type: "PlutusV1",
@@ -867,7 +871,10 @@ var getScriptEffect = (kupoUrl, script_hash) => import_effect2.Effect.gen(functi
867
871
  import_effect2.Effect.map(({ language, script }) => {
868
872
  switch (language) {
869
873
  case "native":
870
- return void 0;
874
+ return {
875
+ type: "Native",
876
+ script
877
+ };
871
878
  case "plutus:v1":
872
879
  return {
873
880
  type: "PlutusV1",
@@ -1294,6 +1301,13 @@ It does not exist or was already spent.`
1294
1301
  plutusHashesOptional.push(script.hash().to_hex());
1295
1302
  break;
1296
1303
  }
1304
+ case "PlutusV3": {
1305
+ const script = CML.PlutusScript.from_v3(
1306
+ CML.PlutusV3Script.from_cbor_bytes((0, import_core_utils2.fromHex)(scriptRef.script))
1307
+ );
1308
+ plutusHashesOptional.push(script.hash().to_hex());
1309
+ break;
1310
+ }
1297
1311
  }
1298
1312
  }
1299
1313
  if (entry.utxo.datumHash) consumedHashes.add(entry.utxo.datumHash);
@@ -2030,6 +2044,8 @@ var Maestro = class {
2030
2044
  var toScriptRef = (reference_script) => {
2031
2045
  if (reference_script && reference_script.bytes) {
2032
2046
  switch (reference_script.type) {
2047
+ case "native":
2048
+ return (0, import_utils6.scriptFromNative)(reference_script.json);
2033
2049
  case "plutusv1":
2034
2050
  return {
2035
2051
  type: "PlutusV1",
package/dist/index.js CHANGED
@@ -3,12 +3,15 @@ import * as CML from "@anastasia-labs/cardano-multiplatform-lib-nodejs";
3
3
 
4
4
  // src/blockfrost.ts
5
5
  import { fromHex, sleep } from "@lucid-evolution/core-utils";
6
- import { applyDoubleCborEncoding } from "@lucid-evolution/utils";
6
+ import {
7
+ applyDoubleCborEncoding,
8
+ scriptFromNative
9
+ } from "@lucid-evolution/utils";
7
10
 
8
11
  // package.json
9
12
  var package_default = {
10
13
  name: "@lucid-evolution/provider",
11
- version: "0.1.50",
14
+ version: "0.1.51",
12
15
  description: "",
13
16
  main: "./dist/index.js",
14
17
  types: "./dist/index.d.ts",
@@ -315,7 +318,11 @@ var Blockfrost = class {
315
318
  ).then((res) => res.json());
316
319
  switch (type) {
317
320
  case "timelock":
318
- return void 0;
321
+ const { json: native } = await fetch(
322
+ `${this.url}/scripts/${r.reference_script_hash}/json`,
323
+ { headers: { project_id: this.projectId, lucid } }
324
+ ).then((res) => res.json());
325
+ return scriptFromNative(native);
319
326
  case "plutusV1":
320
327
  return {
321
328
  type: "PlutusV1",
@@ -827,7 +834,10 @@ var getScriptEffect = (kupoUrl, script_hash) => Effect.gen(function* () {
827
834
  Effect.map(({ language, script }) => {
828
835
  switch (language) {
829
836
  case "native":
830
- return void 0;
837
+ return {
838
+ type: "Native",
839
+ script
840
+ };
831
841
  case "plutus:v1":
832
842
  return {
833
843
  type: "PlutusV1",
@@ -1257,6 +1267,13 @@ It does not exist or was already spent.`
1257
1267
  plutusHashesOptional.push(script.hash().to_hex());
1258
1268
  break;
1259
1269
  }
1270
+ case "PlutusV3": {
1271
+ const script = CML.PlutusScript.from_v3(
1272
+ CML.PlutusV3Script.from_cbor_bytes(fromHex2(scriptRef.script))
1273
+ );
1274
+ plutusHashesOptional.push(script.hash().to_hex());
1275
+ break;
1276
+ }
1260
1277
  }
1261
1278
  }
1262
1279
  if (entry.utxo.datumHash) consumedHashes.add(entry.utxo.datumHash);
@@ -1701,7 +1718,11 @@ function redeemerTagToString(tag) {
1701
1718
  }
1702
1719
 
1703
1720
  // src/maestro.ts
1704
- import { applyDoubleCborEncoding as applyDoubleCborEncoding3, utxoToCore } from "@lucid-evolution/utils";
1721
+ import {
1722
+ applyDoubleCborEncoding as applyDoubleCborEncoding3,
1723
+ scriptFromNative as scriptFromNative2,
1724
+ utxoToCore
1725
+ } from "@lucid-evolution/utils";
1705
1726
  import { fromHex as fromHex3 } from "@lucid-evolution/core-utils";
1706
1727
  var Maestro = class {
1707
1728
  url;
@@ -1993,6 +2014,8 @@ var Maestro = class {
1993
2014
  var toScriptRef = (reference_script) => {
1994
2015
  if (reference_script && reference_script.bytes) {
1995
2016
  switch (reference_script.type) {
2017
+ case "native":
2018
+ return scriptFromNative2(reference_script.json);
1996
2019
  case "plutusv1":
1997
2020
  return {
1998
2021
  type: "PlutusV1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/provider",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,8 +31,8 @@
31
31
  "@effect/schema": "^0.68.26",
32
32
  "effect": "^3.5.6",
33
33
  "@lucid-evolution/core-types": "0.1.16",
34
- "@lucid-evolution/utils": "0.1.38",
35
34
  "@lucid-evolution/core-utils": "0.1.14",
35
+ "@lucid-evolution/utils": "0.1.38",
36
36
  "@lucid-evolution/wallet": "0.1.43"
37
37
  },
38
38
  "devDependencies": {