@lucid-evolution/provider 0.1.30 → 0.1.32

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
@@ -50,7 +50,7 @@ var import_utils = require("@lucid-evolution/utils");
50
50
  // package.json
51
51
  var package_default = {
52
52
  name: "@lucid-evolution/provider",
53
- version: "0.1.30",
53
+ version: "0.1.32",
54
54
  description: "",
55
55
  main: "./dist/index.js",
56
56
  types: "./dist/index.d.ts",
@@ -361,7 +361,7 @@ var import_effect = require("effect");
361
361
  var S = __toESM(require("@effect/schema/Schema"), 1);
362
362
  var JSONRPCSchema = (schema) => S.extend(
363
363
  S.Struct({
364
- jsonrpc: S.Literal("2.0"),
364
+ jsonrpc: S.String,
365
365
  method: S.String,
366
366
  id: S.NullOr(S.Number)
367
367
  }),
@@ -448,10 +448,12 @@ var KupoDelegation = S.NullOr(
448
448
  // src/kupmios/kupmios.ts
449
449
  var import_platform = require("@effect/platform");
450
450
  var KupmiosError = class extends import_effect.Data.TaggedError("KupmiosError") {
451
+ get message() {
452
+ return `${this.cause}`;
453
+ }
451
454
  };
452
- var kupmiosError = (cause, method) => new KupmiosError({
453
- cause,
454
- message: `${method} failed: ${JSON.stringify(cause)}`
455
+ var kupmiosError = (cause) => new KupmiosError({
456
+ cause: JSON.stringify(cause)
455
457
  });
456
458
  var Kupmios = class {
457
459
  kupoUrl;
@@ -569,7 +571,6 @@ var Kupmios = class {
569
571
  rewards: BigInt(delegation?.rewards?.ada?.lovelace || 0)
570
572
  };
571
573
  }
572
- //TODO: add data validation
573
574
  async getDatum(datumHash) {
574
575
  const pattern = `${this.kupoUrl}/datums/${datumHash}`;
575
576
  const schema = KupoDatumSchema;
@@ -618,7 +619,7 @@ var Kupmios = class {
618
619
  (response) => "error" in response ? import_effect.Effect.fail(response.error) : import_effect.Effect.succeed(response)
619
620
  ),
620
621
  import_effect.Effect.timeout(1e4),
621
- import_effect.Effect.catchAll((cause) => kupmiosError(cause, "submitTx"))
622
+ import_effect.Effect.catchAll(kupmiosError)
622
623
  );
623
624
  const { result } = await import_effect.Effect.runPromise(program);
624
625
  return result.transaction.id;
@@ -702,7 +703,7 @@ var toProtocolParameters = (result) => {
702
703
  var fetchOgmiosParse = (url, data, schema) => (0, import_effect.pipe)(
703
704
  import_platform.HttpClientRequest.post(url),
704
705
  import_platform.HttpClientRequest.jsonBody(data),
705
- import_effect.Effect.flatMap(import_platform.HttpClient.fetchOk),
706
+ import_effect.Effect.flatMap(import_platform.HttpClient.fetch),
706
707
  import_platform.HttpClientResponse.json,
707
708
  import_effect.Effect.flatMap(S2.decodeUnknown(schema))
708
709
  // Effect.catchTag("ParseError", (e) =>
package/dist/index.d.cts CHANGED
@@ -40,8 +40,8 @@ declare const KupmiosError_base: new <A extends Record<string, any> = {}>(args:
40
40
  } & Readonly<A>;
41
41
  declare class KupmiosError extends KupmiosError_base<{
42
42
  cause?: unknown;
43
- message?: string;
44
43
  }> {
44
+ get message(): string;
45
45
  }
46
46
  declare class Kupmios implements Provider {
47
47
  kupoUrl: string;
package/dist/index.d.ts CHANGED
@@ -40,8 +40,8 @@ declare const KupmiosError_base: new <A extends Record<string, any> = {}>(args:
40
40
  } & Readonly<A>;
41
41
  declare class KupmiosError extends KupmiosError_base<{
42
42
  cause?: unknown;
43
- message?: string;
44
43
  }> {
44
+ get message(): string;
45
45
  }
46
46
  declare class Kupmios implements Provider {
47
47
  kupoUrl: string;
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { applyDoubleCborEncoding } from "@lucid-evolution/utils";
14
14
  // package.json
15
15
  var package_default = {
16
16
  name: "@lucid-evolution/provider",
17
- version: "0.1.30",
17
+ version: "0.1.32",
18
18
  description: "",
19
19
  main: "./dist/index.js",
20
20
  types: "./dist/index.d.ts",
@@ -325,7 +325,7 @@ import { Effect, pipe, Array as _Array, Schedule, Data } from "effect";
325
325
  import * as S from "@effect/schema/Schema";
326
326
  var JSONRPCSchema = (schema) => S.extend(
327
327
  S.Struct({
328
- jsonrpc: S.Literal("2.0"),
328
+ jsonrpc: S.String,
329
329
  method: S.String,
330
330
  id: S.NullOr(S.Number)
331
331
  }),
@@ -416,10 +416,12 @@ import {
416
416
  HttpClientResponse
417
417
  } from "@effect/platform";
418
418
  var KupmiosError = class extends Data.TaggedError("KupmiosError") {
419
+ get message() {
420
+ return `${this.cause}`;
421
+ }
419
422
  };
420
- var kupmiosError = (cause, method) => new KupmiosError({
421
- cause,
422
- message: `${method} failed: ${JSON.stringify(cause)}`
423
+ var kupmiosError = (cause) => new KupmiosError({
424
+ cause: JSON.stringify(cause)
423
425
  });
424
426
  var Kupmios = class {
425
427
  kupoUrl;
@@ -537,7 +539,6 @@ var Kupmios = class {
537
539
  rewards: BigInt(delegation?.rewards?.ada?.lovelace || 0)
538
540
  };
539
541
  }
540
- //TODO: add data validation
541
542
  async getDatum(datumHash) {
542
543
  const pattern = `${this.kupoUrl}/datums/${datumHash}`;
543
544
  const schema = KupoDatumSchema;
@@ -586,7 +587,7 @@ var Kupmios = class {
586
587
  (response) => "error" in response ? Effect.fail(response.error) : Effect.succeed(response)
587
588
  ),
588
589
  Effect.timeout(1e4),
589
- Effect.catchAll((cause) => kupmiosError(cause, "submitTx"))
590
+ Effect.catchAll(kupmiosError)
590
591
  );
591
592
  const { result } = await Effect.runPromise(program);
592
593
  return result.transaction.id;
@@ -670,7 +671,7 @@ var toProtocolParameters = (result) => {
670
671
  var fetchOgmiosParse = (url, data, schema) => pipe(
671
672
  HttpClientRequest.post(url),
672
673
  HttpClientRequest.jsonBody(data),
673
- Effect.flatMap(HttpClient.fetchOk),
674
+ Effect.flatMap(HttpClient.fetch),
674
675
  HttpClientResponse.json,
675
676
  Effect.flatMap(S2.decodeUnknown(schema))
676
677
  // Effect.catchTag("ParseError", (e) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/provider",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "effect": "^3.5.6",
33
33
  "@lucid-evolution/core-types": "0.1.9",
34
34
  "@lucid-evolution/core-utils": "0.1.7",
35
- "@lucid-evolution/utils": "0.1.23"
35
+ "@lucid-evolution/utils": "0.1.25"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^20.12.8",