@lucid-evolution/provider 0.1.60 → 0.1.61

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.60",
55
+ version: "0.1.61",
56
56
  description: "",
57
57
  main: "./dist/index.js",
58
58
  types: "./dist/index.d.ts",
@@ -450,7 +450,7 @@ var import_utils2 = require("@lucid-evolution/utils");
450
450
  var JSONRPCSchema = (schema) => S.extend(
451
451
  S.Struct({
452
452
  jsonrpc: S.String,
453
- method: S.String,
453
+ method: S.optional(S.String),
454
454
  id: S.NullOr(S.Number)
455
455
  }),
456
456
  S.Union(S.Struct({ result: schema }), S.Struct({ error: S.Object }))
@@ -579,10 +579,13 @@ var toOgmiosUTxOs = (utxos) => {
579
579
  };
580
580
  const toOgmiosAssets = (assets) => {
581
581
  const newAssets = {};
582
- Object.entries(assets).map(([unit, amount]) => {
582
+ Object.entries(assets).forEach(([unit, amount]) => {
583
583
  if (unit == "lovelace") return;
584
584
  const { policyId, assetName } = (0, import_utils2.fromUnit)(unit);
585
- newAssets[policyId][assetName ? assetName : ""] = Number(amount);
585
+ if (!newAssets[policyId]) {
586
+ newAssets[policyId] = {};
587
+ }
588
+ return newAssets[policyId][assetName ? assetName : ""] = Number(amount);
586
589
  });
587
590
  return newAssets;
588
591
  };
@@ -954,7 +957,7 @@ var fetchOgmiosParse = (url, data, schema) => (0, import_effect2.pipe)(
954
957
  import_platform.HttpClientRequest.jsonBody(data),
955
958
  import_effect2.Effect.flatMap(import_platform.HttpClient.fetch),
956
959
  import_platform.HttpClientResponse.json,
957
- import_effect2.Effect.flatMap(S3.decodeUnknown(schema, { onExcessProperty: "error" })),
960
+ import_effect2.Effect.flatMap(S3.decodeUnknown(schema)),
958
961
  import_effect2.Effect.catchTag(
959
962
  "ParseError",
960
963
  (e) => import_effect2.Effect.fail(import_schema.ArrayFormatter.formatErrorSync(e))
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@lucid-evolution/provider",
14
- version: "0.1.60",
14
+ version: "0.1.61",
15
15
  description: "",
16
16
  main: "./dist/index.js",
17
17
  types: "./dist/index.d.ts",
@@ -413,7 +413,7 @@ import { fromUnit } from "@lucid-evolution/utils";
413
413
  var JSONRPCSchema = (schema) => S.extend(
414
414
  S.Struct({
415
415
  jsonrpc: S.String,
416
- method: S.String,
416
+ method: S.optional(S.String),
417
417
  id: S.NullOr(S.Number)
418
418
  }),
419
419
  S.Union(S.Struct({ result: schema }), S.Struct({ error: S.Object }))
@@ -542,10 +542,13 @@ var toOgmiosUTxOs = (utxos) => {
542
542
  };
543
543
  const toOgmiosAssets = (assets) => {
544
544
  const newAssets = {};
545
- Object.entries(assets).map(([unit, amount]) => {
545
+ Object.entries(assets).forEach(([unit, amount]) => {
546
546
  if (unit == "lovelace") return;
547
547
  const { policyId, assetName } = fromUnit(unit);
548
- newAssets[policyId][assetName ? assetName : ""] = Number(amount);
548
+ if (!newAssets[policyId]) {
549
+ newAssets[policyId] = {};
550
+ }
551
+ return newAssets[policyId][assetName ? assetName : ""] = Number(amount);
549
552
  });
550
553
  return newAssets;
551
554
  };
@@ -917,7 +920,7 @@ var fetchOgmiosParse = (url, data, schema) => pipe2(
917
920
  HttpClientRequest.jsonBody(data),
918
921
  Effect.flatMap(HttpClient.fetch),
919
922
  HttpClientResponse.json,
920
- Effect.flatMap(S3.decodeUnknown(schema, { onExcessProperty: "error" })),
923
+ Effect.flatMap(S3.decodeUnknown(schema)),
921
924
  Effect.catchTag(
922
925
  "ParseError",
923
926
  (e) => Effect.fail(ArrayFormatter.formatErrorSync(e))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/provider",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -32,8 +32,8 @@
32
32
  "effect": "^3.5.6",
33
33
  "@lucid-evolution/core-types": "0.1.20",
34
34
  "@lucid-evolution/core-utils": "0.1.16",
35
- "@lucid-evolution/utils": "0.1.45",
36
- "@lucid-evolution/wallet": "0.1.51"
35
+ "@lucid-evolution/utils": "0.1.46",
36
+ "@lucid-evolution/wallet": "0.1.52"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^20.12.8",