@lucid-evolution/provider 0.1.96 → 0.1.97

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_utils2 = require("@lucid-evolution/utils");
52
52
  // package.json
53
53
  var package_default = {
54
54
  name: "@lucid-evolution/provider",
55
- version: "0.1.96",
55
+ version: "0.1.97",
56
56
  description: "",
57
57
  main: "./dist/index.js",
58
58
  types: "./dist/index.d.ts",
@@ -527,6 +527,28 @@ var TupleNumberFromString = import_effect2.Schema.compose(
527
527
  import_effect2.Schema.split("/"),
528
528
  import_effect2.Schema.Array(import_effect2.Schema.NumberFromString)
529
529
  );
530
+ var MaxReferenceScriptsSizeSchema = import_effect2.Schema.Struct({
531
+ bytes: import_effect2.Schema.Number
532
+ });
533
+ function normalizeProtocolParameters(value) {
534
+ const legacy = value.maxReferenceScriptsSize;
535
+ const current = value.maxReferenceScriptsSizePerTransaction;
536
+ if (legacy === void 0 && current === void 0) {
537
+ return value;
538
+ }
539
+ const decode = import_effect2.Schema.decodeUnknownSync(MaxReferenceScriptsSizeSchema);
540
+ const legacyValue = legacy === void 0 ? void 0 : decode(legacy);
541
+ const currentValue = current === void 0 ? void 0 : decode(current);
542
+ if (legacyValue !== void 0 && currentValue !== void 0 && legacyValue.bytes !== currentValue.bytes) {
543
+ throw new Error(
544
+ "Conflicting Ogmios protocol parameters: maxReferenceScriptsSize and maxReferenceScriptsSizePerTransaction differ"
545
+ );
546
+ }
547
+ return {
548
+ ...value,
549
+ maxReferenceScriptsSize: legacyValue ?? currentValue
550
+ };
551
+ }
530
552
  var ProtocolParametersSchema = import_effect2.Schema.Struct({
531
553
  minFeeCoefficient: import_effect2.Schema.Number,
532
554
  minFeeReferenceScripts: import_effect2.Schema.Struct({
@@ -534,9 +556,7 @@ var ProtocolParametersSchema = import_effect2.Schema.Struct({
534
556
  range: import_effect2.Schema.Number,
535
557
  multiplier: import_effect2.Schema.Number
536
558
  }),
537
- maxReferenceScriptsSize: import_effect2.Schema.Struct({
538
- bytes: import_effect2.Schema.Number
539
- }),
559
+ maxReferenceScriptsSize: MaxReferenceScriptsSizeSchema,
540
560
  stakePoolVotingThresholds: import_effect2.Schema.Struct({
541
561
  noConfidence: TupleNumberFromString,
542
562
  constitutionalCommittee: import_effect2.Schema.Struct({
@@ -850,7 +870,7 @@ var Kupmios = class {
850
870
  id: null
851
871
  };
852
872
  const schema = JSONRPCResponseSchema(
853
- ProtocolParametersSchema
873
+ import_effect5.Schema.Record({ key: import_effect5.Schema.String, value: import_effect5.Schema.Unknown })
854
874
  );
855
875
  const response = await (0, import_effect6.pipe)(
856
876
  makePostAsJson(
@@ -865,7 +885,10 @@ var Kupmios = class {
865
885
  import_effect6.Effect.runPromise
866
886
  );
867
887
  const result = getJSONRPCResult(response);
868
- return toProtocolParameters(result);
888
+ const protocolParameters = import_effect5.Schema.decodeUnknownSync(
889
+ ProtocolParametersSchema
890
+ )(normalizeProtocolParameters(result));
891
+ return toProtocolParameters(protocolParameters);
869
892
  }
870
893
  async getTreasury() {
871
894
  const data = {
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.96",
14
+ version: "0.1.97",
15
15
  description: "",
16
16
  main: "./dist/index.js",
17
17
  types: "./dist/index.d.ts",
@@ -486,6 +486,28 @@ var TupleNumberFromString = S.compose(
486
486
  S.split("/"),
487
487
  S.Array(S.NumberFromString)
488
488
  );
489
+ var MaxReferenceScriptsSizeSchema = S.Struct({
490
+ bytes: S.Number
491
+ });
492
+ function normalizeProtocolParameters(value) {
493
+ const legacy = value.maxReferenceScriptsSize;
494
+ const current = value.maxReferenceScriptsSizePerTransaction;
495
+ if (legacy === void 0 && current === void 0) {
496
+ return value;
497
+ }
498
+ const decode = S.decodeUnknownSync(MaxReferenceScriptsSizeSchema);
499
+ const legacyValue = legacy === void 0 ? void 0 : decode(legacy);
500
+ const currentValue = current === void 0 ? void 0 : decode(current);
501
+ if (legacyValue !== void 0 && currentValue !== void 0 && legacyValue.bytes !== currentValue.bytes) {
502
+ throw new Error(
503
+ "Conflicting Ogmios protocol parameters: maxReferenceScriptsSize and maxReferenceScriptsSizePerTransaction differ"
504
+ );
505
+ }
506
+ return {
507
+ ...value,
508
+ maxReferenceScriptsSize: legacyValue ?? currentValue
509
+ };
510
+ }
489
511
  var ProtocolParametersSchema = S.Struct({
490
512
  minFeeCoefficient: S.Number,
491
513
  minFeeReferenceScripts: S.Struct({
@@ -493,9 +515,7 @@ var ProtocolParametersSchema = S.Struct({
493
515
  range: S.Number,
494
516
  multiplier: S.Number
495
517
  }),
496
- maxReferenceScriptsSize: S.Struct({
497
- bytes: S.Number
498
- }),
518
+ maxReferenceScriptsSize: MaxReferenceScriptsSizeSchema,
499
519
  stakePoolVotingThresholds: S.Struct({
500
520
  noConfidence: TupleNumberFromString,
501
521
  constitutionalCommittee: S.Struct({
@@ -814,7 +834,7 @@ var Kupmios = class {
814
834
  id: null
815
835
  };
816
836
  const schema = JSONRPCResponseSchema(
817
- ProtocolParametersSchema
837
+ S3.Record({ key: S3.String, value: S3.Unknown })
818
838
  );
819
839
  const response = await pipe3(
820
840
  makePostAsJson(
@@ -829,7 +849,10 @@ var Kupmios = class {
829
849
  Effect2.runPromise
830
850
  );
831
851
  const result = getJSONRPCResult(response);
832
- return toProtocolParameters(result);
852
+ const protocolParameters = S3.decodeUnknownSync(
853
+ ProtocolParametersSchema
854
+ )(normalizeProtocolParameters(result));
855
+ return toProtocolParameters(protocolParameters);
833
856
  }
834
857
  async getTreasury() {
835
858
  const data = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/provider",
3
- "version": "0.1.96",
3
+ "version": "0.1.97",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -30,10 +30,10 @@
30
30
  "@effect/platform": "^0.71.3",
31
31
  "@effect/schema": "^0.68.26",
32
32
  "effect": "^3.11.7",
33
- "@lucid-evolution/core-types": "0.2.1",
33
+ "@lucid-evolution/core-types": "0.2.2",
34
34
  "@lucid-evolution/core-utils": "0.1.16",
35
- "@lucid-evolution/utils": "0.1.70",
36
- "@lucid-evolution/wallet": "0.1.76"
35
+ "@lucid-evolution/utils": "0.1.71",
36
+ "@lucid-evolution/wallet": "0.1.77"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^20.12.8",