@lucid-evolution/provider 0.4.0 → 0.4.1
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 +608 -548
- package/dist/index.js +104 -57
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -143,7 +143,7 @@ var import_utils2 = require("@lucid-evolution/utils");
|
|
|
143
143
|
// package.json
|
|
144
144
|
var package_default = {
|
|
145
145
|
name: "@lucid-evolution/provider",
|
|
146
|
-
version: "0.4.
|
|
146
|
+
version: "0.4.1",
|
|
147
147
|
description: "",
|
|
148
148
|
main: "./dist/index.js",
|
|
149
149
|
types: "./dist/index.d.ts",
|
|
@@ -188,7 +188,8 @@ var package_default = {
|
|
|
188
188
|
};
|
|
189
189
|
|
|
190
190
|
// src/internal/blockfrost.ts
|
|
191
|
-
var
|
|
191
|
+
var Record = __toESM(require("effect/Record"), 1);
|
|
192
|
+
var import_Function = require("effect/Function");
|
|
192
193
|
var import_utils = require("@lucid-evolution/utils");
|
|
193
194
|
var toAditionalUTXOs = (utxos) => (utxos || []).map((utxo) => [
|
|
194
195
|
{
|
|
@@ -220,7 +221,7 @@ var toTxOutScript = (scriptRef) => {
|
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
};
|
|
223
|
-
var fromAssets = (assets) => (0,
|
|
224
|
+
var fromAssets = (assets) => (0, import_Function.pipe)(Record.remove(assets, "lovelace"), (nativeAssets) => {
|
|
224
225
|
const result = {};
|
|
225
226
|
for (const [unit, amount] of Object.entries(nativeAssets)) {
|
|
226
227
|
const policyId = unit.slice(0, 56);
|
|
@@ -259,16 +260,16 @@ var Blockfrost = class {
|
|
|
259
260
|
constructor(url, projectId, options = {}) {
|
|
260
261
|
this.url = url;
|
|
261
262
|
this.projectId = projectId || "";
|
|
262
|
-
const
|
|
263
|
-
if (!Number.isFinite(
|
|
263
|
+
const timeout3 = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
264
|
+
if (!Number.isFinite(timeout3) || timeout3 <= 0) {
|
|
264
265
|
throw new TypeError("requestTimeoutMs must be a positive finite number.");
|
|
265
266
|
}
|
|
266
|
-
this.requestTimeoutMs =
|
|
267
|
+
this.requestTimeoutMs = timeout3;
|
|
267
268
|
}
|
|
268
269
|
/** `fetch` bounded by the provider's request timeout, combined with any caller-supplied signal. */
|
|
269
270
|
fetch(input, init = {}) {
|
|
270
|
-
const
|
|
271
|
-
const signal = init.signal == null ?
|
|
271
|
+
const timeout3 = AbortSignal.timeout(this.requestTimeoutMs);
|
|
272
|
+
const signal = init.signal == null ? timeout3 : typeof AbortSignal.any === "function" ? AbortSignal.any([init.signal, timeout3]) : init.signal;
|
|
272
273
|
return fetch(input, { ...init, signal });
|
|
273
274
|
}
|
|
274
275
|
async getProtocolParameters() {
|
|
@@ -599,30 +600,36 @@ var lucid = package_default.version;
|
|
|
599
600
|
|
|
600
601
|
// src/kupmios.ts
|
|
601
602
|
var import_utils4 = require("@lucid-evolution/utils");
|
|
602
|
-
var
|
|
603
|
-
var
|
|
603
|
+
var S3 = __toESM(require("effect/Schema"), 1);
|
|
604
|
+
var Cause = __toESM(require("effect/Cause"), 1);
|
|
605
|
+
var Effect2 = __toESM(require("effect/Effect"), 1);
|
|
606
|
+
var Exit = __toESM(require("effect/Exit"), 1);
|
|
607
|
+
var Layer = __toESM(require("effect/Layer"), 1);
|
|
608
|
+
var _Array = __toESM(require("effect/Array"), 1);
|
|
609
|
+
var Schedule = __toESM(require("effect/Schedule"), 1);
|
|
610
|
+
var import_Function3 = require("effect/Function");
|
|
604
611
|
|
|
605
612
|
// src/internal/ogmios.ts
|
|
606
|
-
var
|
|
613
|
+
var S = __toESM(require("effect/Schema"), 1);
|
|
607
614
|
var import_utils3 = require("@lucid-evolution/utils");
|
|
608
|
-
var JSONRPCSchema = (schema) =>
|
|
609
|
-
jsonrpc:
|
|
610
|
-
method:
|
|
611
|
-
id:
|
|
615
|
+
var JSONRPCSchema = (schema) => S.Struct({
|
|
616
|
+
jsonrpc: S.String,
|
|
617
|
+
method: S.optional(S.String),
|
|
618
|
+
id: S.NullOr(S.Number),
|
|
612
619
|
result: schema
|
|
613
620
|
}).annotations({ identifier: "JSONRPCSchema" });
|
|
614
|
-
var JSONRPCErrorSchema =
|
|
615
|
-
code:
|
|
616
|
-
message:
|
|
617
|
-
data:
|
|
621
|
+
var JSONRPCErrorSchema = S.Struct({
|
|
622
|
+
code: S.Number,
|
|
623
|
+
message: S.String,
|
|
624
|
+
data: S.optional(S.Unknown)
|
|
618
625
|
});
|
|
619
|
-
var JSONRPCErrorResponseSchema =
|
|
620
|
-
jsonrpc:
|
|
621
|
-
method:
|
|
622
|
-
id:
|
|
626
|
+
var JSONRPCErrorResponseSchema = S.Struct({
|
|
627
|
+
jsonrpc: S.String,
|
|
628
|
+
method: S.optional(S.String),
|
|
629
|
+
id: S.NullOr(S.Number),
|
|
623
630
|
error: JSONRPCErrorSchema
|
|
624
631
|
});
|
|
625
|
-
var JSONRPCResponseSchema = (schema) =>
|
|
632
|
+
var JSONRPCResponseSchema = (schema) => S.Union(JSONRPCSchema(schema), JSONRPCErrorResponseSchema).annotations({
|
|
626
633
|
identifier: "JSONRPCResponseSchema"
|
|
627
634
|
});
|
|
628
635
|
var getJSONRPCResult = (response, operation, transport) => {
|
|
@@ -650,18 +657,18 @@ var getJSONRPCResult = (response, operation, transport) => {
|
|
|
650
657
|
}
|
|
651
658
|
return response.result;
|
|
652
659
|
};
|
|
653
|
-
var LovelaceAsset =
|
|
654
|
-
lovelace:
|
|
660
|
+
var LovelaceAsset = S.Struct({
|
|
661
|
+
lovelace: S.Number
|
|
655
662
|
});
|
|
656
|
-
var LovelaceAmount =
|
|
657
|
-
var TreasuryAndReservesSchema =
|
|
658
|
-
treasury:
|
|
659
|
-
ada:
|
|
663
|
+
var LovelaceAmount = S.Union(S.Number, S.String, S.BigInt);
|
|
664
|
+
var TreasuryAndReservesSchema = S.Struct({
|
|
665
|
+
treasury: S.Struct({
|
|
666
|
+
ada: S.Struct({
|
|
660
667
|
lovelace: LovelaceAmount
|
|
661
668
|
})
|
|
662
669
|
}),
|
|
663
|
-
reserves:
|
|
664
|
-
ada:
|
|
670
|
+
reserves: S.Struct({
|
|
671
|
+
ada: S.Struct({
|
|
665
672
|
lovelace: LovelaceAmount
|
|
666
673
|
})
|
|
667
674
|
})
|
|
@@ -676,12 +683,12 @@ var lovelaceAmountToBigInt = (lovelace) => {
|
|
|
676
683
|
}
|
|
677
684
|
return BigInt(lovelace);
|
|
678
685
|
};
|
|
679
|
-
var TupleNumberFromString =
|
|
680
|
-
|
|
681
|
-
|
|
686
|
+
var TupleNumberFromString = S.compose(
|
|
687
|
+
S.split("/"),
|
|
688
|
+
S.Array(S.NumberFromString)
|
|
682
689
|
);
|
|
683
|
-
var MaxReferenceScriptsSizeSchema =
|
|
684
|
-
bytes:
|
|
690
|
+
var MaxReferenceScriptsSizeSchema = S.Struct({
|
|
691
|
+
bytes: S.Number
|
|
685
692
|
});
|
|
686
693
|
function normalizeProtocolParameters(value) {
|
|
687
694
|
const legacy = value.maxReferenceScriptsSize;
|
|
@@ -689,7 +696,7 @@ function normalizeProtocolParameters(value) {
|
|
|
689
696
|
if (legacy === void 0 && current === void 0) {
|
|
690
697
|
return value;
|
|
691
698
|
}
|
|
692
|
-
const decode =
|
|
699
|
+
const decode = S.decodeUnknownSync(MaxReferenceScriptsSizeSchema);
|
|
693
700
|
const legacyValue = legacy === void 0 ? void 0 : decode(legacy);
|
|
694
701
|
const currentValue = current === void 0 ? void 0 : decode(current);
|
|
695
702
|
if (legacyValue !== void 0 && currentValue !== void 0 && legacyValue.bytes !== currentValue.bytes) {
|
|
@@ -702,34 +709,34 @@ function normalizeProtocolParameters(value) {
|
|
|
702
709
|
maxReferenceScriptsSize: legacyValue ?? currentValue
|
|
703
710
|
};
|
|
704
711
|
}
|
|
705
|
-
var ProtocolParametersSchema =
|
|
706
|
-
minFeeCoefficient:
|
|
707
|
-
minFeeReferenceScripts:
|
|
708
|
-
base:
|
|
709
|
-
range:
|
|
710
|
-
multiplier:
|
|
712
|
+
var ProtocolParametersSchema = S.Struct({
|
|
713
|
+
minFeeCoefficient: S.Number,
|
|
714
|
+
minFeeReferenceScripts: S.Struct({
|
|
715
|
+
base: S.Number,
|
|
716
|
+
range: S.Number,
|
|
717
|
+
multiplier: S.Number
|
|
711
718
|
}),
|
|
712
719
|
maxReferenceScriptsSize: MaxReferenceScriptsSizeSchema,
|
|
713
|
-
stakePoolVotingThresholds:
|
|
720
|
+
stakePoolVotingThresholds: S.Struct({
|
|
714
721
|
noConfidence: TupleNumberFromString,
|
|
715
|
-
constitutionalCommittee:
|
|
722
|
+
constitutionalCommittee: S.Struct({
|
|
716
723
|
default: TupleNumberFromString,
|
|
717
724
|
stateOfNoConfidence: TupleNumberFromString
|
|
718
725
|
}),
|
|
719
726
|
hardForkInitiation: TupleNumberFromString,
|
|
720
|
-
protocolParametersUpdate:
|
|
727
|
+
protocolParametersUpdate: S.Struct({
|
|
721
728
|
security: TupleNumberFromString
|
|
722
729
|
})
|
|
723
730
|
}),
|
|
724
|
-
delegateRepresentativeVotingThresholds:
|
|
731
|
+
delegateRepresentativeVotingThresholds: S.Struct({
|
|
725
732
|
noConfidence: TupleNumberFromString,
|
|
726
|
-
constitutionalCommittee:
|
|
733
|
+
constitutionalCommittee: S.Struct({
|
|
727
734
|
default: TupleNumberFromString,
|
|
728
735
|
stateOfNoConfidence: TupleNumberFromString
|
|
729
736
|
}),
|
|
730
737
|
constitution: TupleNumberFromString,
|
|
731
738
|
hardForkInitiation: TupleNumberFromString,
|
|
732
|
-
protocolParametersUpdate:
|
|
739
|
+
protocolParametersUpdate: S.Struct({
|
|
733
740
|
network: TupleNumberFromString,
|
|
734
741
|
economic: TupleNumberFromString,
|
|
735
742
|
technical: TupleNumberFromString,
|
|
@@ -737,71 +744,71 @@ var ProtocolParametersSchema = import_effect2.Schema.Struct({
|
|
|
737
744
|
}),
|
|
738
745
|
treasuryWithdrawals: TupleNumberFromString
|
|
739
746
|
}),
|
|
740
|
-
constitutionalCommitteeMinSize:
|
|
741
|
-
constitutionalCommitteeMaxTermLength:
|
|
742
|
-
governanceActionLifetime:
|
|
743
|
-
governanceActionDeposit:
|
|
747
|
+
constitutionalCommitteeMinSize: S.optional(S.Number),
|
|
748
|
+
constitutionalCommitteeMaxTermLength: S.Number,
|
|
749
|
+
governanceActionLifetime: S.Number,
|
|
750
|
+
governanceActionDeposit: S.Struct({
|
|
744
751
|
ada: LovelaceAsset
|
|
745
752
|
}),
|
|
746
|
-
delegateRepresentativeDeposit:
|
|
753
|
+
delegateRepresentativeDeposit: S.Struct({
|
|
747
754
|
ada: LovelaceAsset
|
|
748
755
|
}),
|
|
749
|
-
delegateRepresentativeMaxIdleTime:
|
|
750
|
-
minFeeConstant:
|
|
751
|
-
maxBlockBodySize:
|
|
752
|
-
maxBlockHeaderSize:
|
|
753
|
-
maxTransactionSize:
|
|
754
|
-
stakeCredentialDeposit:
|
|
755
|
-
stakePoolDeposit:
|
|
756
|
-
stakePoolRetirementEpochBound:
|
|
757
|
-
desiredNumberOfStakePools:
|
|
756
|
+
delegateRepresentativeMaxIdleTime: S.Number,
|
|
757
|
+
minFeeConstant: S.Struct({ ada: LovelaceAsset }),
|
|
758
|
+
maxBlockBodySize: S.Struct({ bytes: S.Number }),
|
|
759
|
+
maxBlockHeaderSize: S.Struct({ bytes: S.Number }),
|
|
760
|
+
maxTransactionSize: S.Struct({ bytes: S.Number }),
|
|
761
|
+
stakeCredentialDeposit: S.Struct({ ada: LovelaceAsset }),
|
|
762
|
+
stakePoolDeposit: S.Struct({ ada: LovelaceAsset }),
|
|
763
|
+
stakePoolRetirementEpochBound: S.Number,
|
|
764
|
+
desiredNumberOfStakePools: S.Number,
|
|
758
765
|
stakePoolPledgeInfluence: TupleNumberFromString,
|
|
759
766
|
monetaryExpansion: TupleNumberFromString,
|
|
760
767
|
treasuryExpansion: TupleNumberFromString,
|
|
761
|
-
minStakePoolCost:
|
|
762
|
-
minUtxoDepositConstant:
|
|
763
|
-
minUtxoDepositCoefficient:
|
|
764
|
-
plutusCostModels:
|
|
765
|
-
"plutus:v1":
|
|
766
|
-
"plutus:v2":
|
|
767
|
-
"plutus:v3":
|
|
768
|
+
minStakePoolCost: S.Struct({ ada: LovelaceAsset }),
|
|
769
|
+
minUtxoDepositConstant: S.Struct({ ada: LovelaceAsset }),
|
|
770
|
+
minUtxoDepositCoefficient: S.Number,
|
|
771
|
+
plutusCostModels: S.Struct({
|
|
772
|
+
"plutus:v1": S.Array(S.Number),
|
|
773
|
+
"plutus:v2": S.Array(S.Number),
|
|
774
|
+
"plutus:v3": S.Array(S.Number)
|
|
768
775
|
}),
|
|
769
|
-
scriptExecutionPrices:
|
|
776
|
+
scriptExecutionPrices: S.Struct({
|
|
770
777
|
memory: TupleNumberFromString,
|
|
771
778
|
cpu: TupleNumberFromString
|
|
772
779
|
}),
|
|
773
|
-
maxExecutionUnitsPerTransaction:
|
|
774
|
-
memory:
|
|
775
|
-
cpu:
|
|
780
|
+
maxExecutionUnitsPerTransaction: S.Struct({
|
|
781
|
+
memory: S.Number,
|
|
782
|
+
cpu: S.Number
|
|
776
783
|
}),
|
|
777
|
-
maxExecutionUnitsPerBlock:
|
|
778
|
-
maxValueSize:
|
|
779
|
-
collateralPercentage:
|
|
780
|
-
maxCollateralInputs:
|
|
781
|
-
version:
|
|
784
|
+
maxExecutionUnitsPerBlock: S.Struct({ memory: S.Number, cpu: S.Number }),
|
|
785
|
+
maxValueSize: S.Struct({ bytes: S.Number }),
|
|
786
|
+
collateralPercentage: S.Number,
|
|
787
|
+
maxCollateralInputs: S.Number,
|
|
788
|
+
version: S.Struct({ major: S.Number, minor: S.Number })
|
|
782
789
|
}).annotations({ identifier: "ProtocolParametersSchema" });
|
|
783
|
-
var RewardAccountAdaSchema =
|
|
790
|
+
var RewardAccountAdaSchema = S.Struct({
|
|
784
791
|
ada: LovelaceAsset
|
|
785
792
|
});
|
|
786
|
-
var LegacyDelegationSummarySchema =
|
|
787
|
-
delegate:
|
|
793
|
+
var LegacyDelegationSummarySchema = S.Struct({
|
|
794
|
+
delegate: S.optional(S.NullOr(S.Struct({ id: S.String }))),
|
|
788
795
|
rewards: RewardAccountAdaSchema,
|
|
789
796
|
deposit: RewardAccountAdaSchema
|
|
790
797
|
});
|
|
791
|
-
var RewardAccountSummarySchema =
|
|
792
|
-
from:
|
|
793
|
-
credential:
|
|
794
|
-
stakePool:
|
|
798
|
+
var RewardAccountSummarySchema = S.Struct({
|
|
799
|
+
from: S.optional(S.Literal("key", "verificationKey", "script")),
|
|
800
|
+
credential: S.optional(S.String),
|
|
801
|
+
stakePool: S.optional(S.NullOr(S.Struct({ id: S.String }))),
|
|
795
802
|
rewards: RewardAccountAdaSchema,
|
|
796
803
|
deposit: RewardAccountAdaSchema
|
|
797
804
|
});
|
|
798
|
-
var Delegation =
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
key:
|
|
805
|
+
var Delegation = S.Union(
|
|
806
|
+
S.Null,
|
|
807
|
+
S.Record({
|
|
808
|
+
key: S.String,
|
|
802
809
|
value: LegacyDelegationSummarySchema
|
|
803
810
|
}),
|
|
804
|
-
|
|
811
|
+
S.Array(RewardAccountSummarySchema)
|
|
805
812
|
);
|
|
806
813
|
var toOgmiosQuantity = (amount) => {
|
|
807
814
|
const quantity = Number(amount);
|
|
@@ -812,9 +819,9 @@ var toOgmiosQuantity = (amount) => {
|
|
|
812
819
|
}
|
|
813
820
|
return quantity;
|
|
814
821
|
};
|
|
815
|
-
var RedeemerSchema =
|
|
816
|
-
validator:
|
|
817
|
-
purpose:
|
|
822
|
+
var RedeemerSchema = S.Struct({
|
|
823
|
+
validator: S.Struct({
|
|
824
|
+
purpose: S.Literal(
|
|
818
825
|
"spend",
|
|
819
826
|
"mint",
|
|
820
827
|
"publish",
|
|
@@ -822,11 +829,11 @@ var RedeemerSchema = import_effect2.Schema.Struct({
|
|
|
822
829
|
"vote",
|
|
823
830
|
"propose"
|
|
824
831
|
),
|
|
825
|
-
index:
|
|
832
|
+
index: S.Int
|
|
826
833
|
}),
|
|
827
|
-
budget:
|
|
828
|
-
memory:
|
|
829
|
-
cpu:
|
|
834
|
+
budget: S.Struct({
|
|
835
|
+
memory: S.Int,
|
|
836
|
+
cpu: S.Int
|
|
830
837
|
})
|
|
831
838
|
}).annotations({ identifier: "RedeemerSchema" });
|
|
832
839
|
var toOgmiosUTxOs = (utxos) => {
|
|
@@ -884,62 +891,66 @@ var toOgmiosUTxOs = (utxos) => {
|
|
|
884
891
|
};
|
|
885
892
|
|
|
886
893
|
// src/internal/kupo.ts
|
|
887
|
-
var
|
|
888
|
-
var QuantitySchema =
|
|
889
|
-
|
|
890
|
-
|
|
894
|
+
var S2 = __toESM(require("effect/Schema"), 1);
|
|
895
|
+
var QuantitySchema = S2.Union(
|
|
896
|
+
S2.Number.pipe(S2.filter(Number.isSafeInteger)),
|
|
897
|
+
S2.String.pipe(S2.pattern(/^\d+$/))
|
|
891
898
|
);
|
|
892
|
-
var ValueSchema =
|
|
899
|
+
var ValueSchema = S2.Struct({
|
|
893
900
|
coins: QuantitySchema,
|
|
894
|
-
assets:
|
|
901
|
+
assets: S2.Record({ key: S2.String, value: QuantitySchema })
|
|
895
902
|
});
|
|
896
|
-
var PointSchema =
|
|
897
|
-
slot_no:
|
|
898
|
-
header_hash:
|
|
903
|
+
var PointSchema = S2.Struct({
|
|
904
|
+
slot_no: S2.Number,
|
|
905
|
+
header_hash: S2.String
|
|
899
906
|
});
|
|
900
|
-
var ScriptSchema =
|
|
901
|
-
|
|
902
|
-
language:
|
|
903
|
-
script:
|
|
907
|
+
var ScriptSchema = S2.NullOr(
|
|
908
|
+
S2.Struct({
|
|
909
|
+
language: S2.Literal("native", "plutus:v1", "plutus:v2", "plutus:v3"),
|
|
910
|
+
script: S2.String
|
|
904
911
|
})
|
|
905
912
|
);
|
|
906
913
|
var UTxOFields = {
|
|
907
|
-
transaction_index:
|
|
908
|
-
transaction_id:
|
|
909
|
-
output_index:
|
|
910
|
-
address:
|
|
914
|
+
transaction_index: S2.Number,
|
|
915
|
+
transaction_id: S2.String,
|
|
916
|
+
output_index: S2.Number,
|
|
917
|
+
address: S2.String,
|
|
911
918
|
value: ValueSchema,
|
|
912
|
-
datum_hash:
|
|
913
|
-
datum_type:
|
|
914
|
-
script_hash:
|
|
919
|
+
datum_hash: S2.NullOr(S2.String),
|
|
920
|
+
datum_type: S2.optional(S2.Literal("hash", "inline")),
|
|
921
|
+
script_hash: S2.NullOr(S2.String),
|
|
915
922
|
created_at: PointSchema,
|
|
916
|
-
spent_at:
|
|
923
|
+
spent_at: S2.NullOr(PointSchema)
|
|
917
924
|
};
|
|
918
|
-
var UTxOSchema =
|
|
919
|
-
var ResolvedUTxOSchema =
|
|
925
|
+
var UTxOSchema = S2.Struct(UTxOFields);
|
|
926
|
+
var ResolvedUTxOSchema = S2.Struct({
|
|
920
927
|
...UTxOFields,
|
|
921
|
-
datum:
|
|
928
|
+
datum: S2.NullOr(S2.String),
|
|
922
929
|
script: ScriptSchema
|
|
923
930
|
});
|
|
924
|
-
var DatumSchema =
|
|
925
|
-
var DelegationSchema =
|
|
926
|
-
|
|
927
|
-
key:
|
|
928
|
-
value:
|
|
929
|
-
delegate:
|
|
930
|
-
rewards:
|
|
931
|
-
deposit:
|
|
931
|
+
var DatumSchema = S2.NullOr(S2.Struct({ datum: S2.String }));
|
|
932
|
+
var DelegationSchema = S2.NullOr(
|
|
933
|
+
S2.Record({
|
|
934
|
+
key: S2.String,
|
|
935
|
+
value: S2.Struct({
|
|
936
|
+
delegate: S2.Struct({ id: S2.String }),
|
|
937
|
+
rewards: S2.Struct({ ada: S2.Struct({ lovelace: S2.Number }) }),
|
|
938
|
+
deposit: S2.Struct({ ada: S2.Struct({ lovelace: S2.Number }) })
|
|
932
939
|
})
|
|
933
940
|
})
|
|
934
941
|
);
|
|
935
942
|
|
|
936
943
|
// src/internal/HttpUtils.ts
|
|
937
|
-
var
|
|
938
|
-
var
|
|
939
|
-
var
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
944
|
+
var HttpClient = __toESM(require("@effect/platform/HttpClient"), 1);
|
|
945
|
+
var HttpClientError = __toESM(require("@effect/platform/HttpClientError"), 1);
|
|
946
|
+
var HttpClientRequest = __toESM(require("@effect/platform/HttpClientRequest"), 1);
|
|
947
|
+
var HttpClientResponse = __toESM(require("@effect/platform/HttpClientResponse"), 1);
|
|
948
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
949
|
+
var import_Function2 = require("effect/Function");
|
|
950
|
+
var filterStatusOk = (self) => self.status >= 200 && self.status < 300 ? Effect.succeed(self) : self.text.pipe(
|
|
951
|
+
Effect.flatMap(
|
|
952
|
+
(text) => Effect.fail(
|
|
953
|
+
new HttpClientError.ResponseError({
|
|
943
954
|
response: self,
|
|
944
955
|
request: self.request,
|
|
945
956
|
reason: "StatusCode",
|
|
@@ -948,56 +959,51 @@ var filterStatusOk = (self) => self.status >= 200 && self.status < 300 ? import_
|
|
|
948
959
|
)
|
|
949
960
|
)
|
|
950
961
|
);
|
|
951
|
-
var makeGet = (url, schema, headers) => (0,
|
|
962
|
+
var makeGet = (url, schema, headers) => (0, import_Function2.pipe)(
|
|
952
963
|
// Initiate a GET request to the specified URL
|
|
953
|
-
|
|
964
|
+
HttpClientRequest.get(url),
|
|
954
965
|
// Conditional bearer token authentication
|
|
955
|
-
headers ?
|
|
956
|
-
|
|
957
|
-
import_platform.HttpClient.execute,
|
|
966
|
+
headers ? HttpClientRequest.setHeaders(headers) : import_Function2.identity,
|
|
967
|
+
HttpClient.execute,
|
|
958
968
|
// Ensure only 2xx responses are treated as successes.
|
|
959
|
-
|
|
969
|
+
Effect.flatMap(filterStatusOk),
|
|
960
970
|
// Parse the response body using the provided JSON schema
|
|
961
971
|
// This validates and transforms the response to the expected type
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
// Prevents resource leaks and ensures clean request termination
|
|
965
|
-
import_effect4.Effect.scoped
|
|
972
|
+
Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)),
|
|
973
|
+
Effect.scoped
|
|
966
974
|
);
|
|
967
|
-
var makePostAsJson = (url, data, schema, headers) => (0,
|
|
975
|
+
var makePostAsJson = (url, data, schema, headers) => (0, import_Function2.pipe)(
|
|
968
976
|
// Initiate a POST request to the specified URL
|
|
969
|
-
|
|
977
|
+
HttpClientRequest.post(url),
|
|
970
978
|
// Conditional headers
|
|
971
|
-
headers ?
|
|
979
|
+
headers ? HttpClientRequest.setHeaders(headers) : import_Function2.identity,
|
|
972
980
|
// Set the request body as Json
|
|
973
|
-
|
|
981
|
+
HttpClientRequest.bodyJson(data),
|
|
974
982
|
// Execute the HTTP request and retrieve the response
|
|
975
|
-
|
|
983
|
+
Effect.flatMap(HttpClient.execute),
|
|
976
984
|
// Ensure only 2xx responses are treated as successes.
|
|
977
|
-
|
|
985
|
+
Effect.flatMap(filterStatusOk),
|
|
978
986
|
// Parse the response body using the provided JSON schema
|
|
979
987
|
// This validates and transforms the response to the expected type
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
// Prevents resource leaks and ensures clean request termination
|
|
983
|
-
import_effect4.Effect.scoped
|
|
988
|
+
Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)),
|
|
989
|
+
Effect.scoped
|
|
984
990
|
);
|
|
985
|
-
var makePostAsJsonResponse = (url, data, schema, headers) => (0,
|
|
986
|
-
|
|
987
|
-
headers ?
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
(response) => (0,
|
|
992
|
-
|
|
993
|
-
|
|
991
|
+
var makePostAsJsonResponse = (url, data, schema, headers) => (0, import_Function2.pipe)(
|
|
992
|
+
HttpClientRequest.post(url),
|
|
993
|
+
headers ? HttpClientRequest.setHeaders(headers) : import_Function2.identity,
|
|
994
|
+
HttpClientRequest.bodyJson(data),
|
|
995
|
+
Effect.flatMap(HttpClient.execute),
|
|
996
|
+
Effect.flatMap(
|
|
997
|
+
(response) => (0, import_Function2.pipe)(
|
|
998
|
+
HttpClientResponse.schemaBodyJson(schema)(response),
|
|
999
|
+
Effect.map((body) => ({
|
|
994
1000
|
body,
|
|
995
1001
|
status: response.status,
|
|
996
1002
|
headers: response.headers
|
|
997
1003
|
})),
|
|
998
|
-
|
|
999
|
-
(cause) => response.status >= 200 && response.status < 300 ?
|
|
1000
|
-
new
|
|
1004
|
+
Effect.catchAll(
|
|
1005
|
+
(cause) => response.status >= 200 && response.status < 300 ? Effect.fail(cause) : Effect.fail(
|
|
1006
|
+
new HttpClientError.ResponseError({
|
|
1001
1007
|
response,
|
|
1002
1008
|
request: response.request,
|
|
1003
1009
|
reason: "StatusCode",
|
|
@@ -1007,54 +1013,51 @@ var makePostAsJsonResponse = (url, data, schema, headers) => (0, import_effect4.
|
|
|
1007
1013
|
)
|
|
1008
1014
|
)
|
|
1009
1015
|
),
|
|
1010
|
-
|
|
1016
|
+
Effect.scoped
|
|
1011
1017
|
);
|
|
1012
|
-
var makePostAsUint8Array = (url, data, schema, headers) => (0,
|
|
1018
|
+
var makePostAsUint8Array = (url, data, schema, headers) => (0, import_Function2.pipe)(
|
|
1013
1019
|
// Initiate a POST request to the specified URL
|
|
1014
|
-
|
|
1020
|
+
HttpClientRequest.post(url),
|
|
1015
1021
|
// Conditional bearer token authentication
|
|
1016
|
-
headers ?
|
|
1022
|
+
headers ? HttpClientRequest.setHeaders(headers) : import_Function2.identity,
|
|
1017
1023
|
// Set the request body as a Uint8Array with CBOR content type
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
import_platform.HttpClient.execute,
|
|
1024
|
+
HttpClientRequest.bodyUint8Array(data, "application/cbor"),
|
|
1025
|
+
HttpClient.execute,
|
|
1021
1026
|
// Ensure only 2xx responses are treated as successes.
|
|
1022
|
-
|
|
1027
|
+
Effect.flatMap(filterStatusOk),
|
|
1023
1028
|
// Parse the response body using the provided JSON schema
|
|
1024
1029
|
// This validates and transforms the response to the expected type
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
// Prevents resource leaks and ensures clean request termination
|
|
1028
|
-
import_effect4.Effect.scoped
|
|
1030
|
+
Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)),
|
|
1031
|
+
Effect.scoped
|
|
1029
1032
|
);
|
|
1030
1033
|
|
|
1031
1034
|
// src/kupmios.ts
|
|
1032
|
-
var
|
|
1035
|
+
var FetchHttpClient = __toESM(require("@effect/platform/FetchHttpClient"), 1);
|
|
1033
1036
|
var DEFAULT_REQUEST_TIMEOUT_MS2 = 3e4;
|
|
1034
1037
|
var DEFAULT_AWAIT_TX_TIMEOUT_MS = 16e4;
|
|
1035
|
-
var validateTimeout = (name,
|
|
1036
|
-
if (!Number.isFinite(
|
|
1038
|
+
var validateTimeout = (name, timeout3) => {
|
|
1039
|
+
if (!Number.isFinite(timeout3) || timeout3 <= 0) {
|
|
1037
1040
|
throw new TypeError(`${name} must be a positive finite number.`);
|
|
1038
1041
|
}
|
|
1039
|
-
return
|
|
1042
|
+
return timeout3;
|
|
1040
1043
|
};
|
|
1041
|
-
var catchProviderError = (protocol, operation) => (effect) =>
|
|
1044
|
+
var catchProviderError = (protocol, operation) => (effect) => Effect2.catchAll(
|
|
1042
1045
|
effect,
|
|
1043
|
-
(cause) =>
|
|
1046
|
+
(cause) => Effect2.fail(toKupmiosError(cause, protocol, operation))
|
|
1044
1047
|
);
|
|
1045
1048
|
var runProviderEffect = async (effect, protocol, operation, signal) => {
|
|
1046
|
-
const exit = await
|
|
1047
|
-
if (
|
|
1049
|
+
const exit = await Effect2.runPromiseExit(effect, { signal });
|
|
1050
|
+
if (Exit.isSuccess(exit)) return exit.value;
|
|
1048
1051
|
if (signal?.aborted) {
|
|
1049
1052
|
throw new KupmiosError({
|
|
1050
1053
|
protocol,
|
|
1051
1054
|
operation,
|
|
1052
1055
|
kind: "aborted",
|
|
1053
1056
|
retryable: false,
|
|
1054
|
-
cause: signal.reason ??
|
|
1057
|
+
cause: signal.reason ?? Cause.squash(exit.cause)
|
|
1055
1058
|
});
|
|
1056
1059
|
}
|
|
1057
|
-
throw toKupmiosError(
|
|
1060
|
+
throw toKupmiosError(Cause.squash(exit.cause), protocol, operation);
|
|
1058
1061
|
};
|
|
1059
1062
|
var Kupmios = class {
|
|
1060
1063
|
kupoUrl;
|
|
@@ -1075,9 +1078,9 @@ var Kupmios = class {
|
|
|
1075
1078
|
"awaitTxTimeoutMs",
|
|
1076
1079
|
options.awaitTxTimeoutMs ?? DEFAULT_AWAIT_TX_TIMEOUT_MS
|
|
1077
1080
|
);
|
|
1078
|
-
this.httpLayer = options.fetchImpl === void 0 ?
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
+
this.httpLayer = options.fetchImpl === void 0 ? FetchHttpClient.layer : Layer.provide(
|
|
1082
|
+
FetchHttpClient.layer,
|
|
1083
|
+
Layer.succeed(FetchHttpClient.Fetch, options.fetchImpl)
|
|
1081
1084
|
);
|
|
1082
1085
|
}
|
|
1083
1086
|
async getProtocolParameters() {
|
|
@@ -1088,19 +1091,19 @@ var Kupmios = class {
|
|
|
1088
1091
|
id: null
|
|
1089
1092
|
};
|
|
1090
1093
|
const schema = JSONRPCResponseSchema(
|
|
1091
|
-
|
|
1094
|
+
S3.Record({ key: S3.String, value: S3.Unknown })
|
|
1092
1095
|
);
|
|
1093
1096
|
const response = await runProviderEffect(
|
|
1094
|
-
(0,
|
|
1097
|
+
(0, import_Function3.pipe)(
|
|
1095
1098
|
makePostAsJsonResponse(
|
|
1096
1099
|
this.ogmiosUrl,
|
|
1097
1100
|
data,
|
|
1098
1101
|
schema,
|
|
1099
1102
|
this.options.ogmiosHeader
|
|
1100
1103
|
),
|
|
1101
|
-
|
|
1104
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1102
1105
|
catchProviderError("ogmios", "queryLedgerState/protocolParameters"),
|
|
1103
|
-
|
|
1106
|
+
Effect2.provide(this.httpLayer)
|
|
1104
1107
|
),
|
|
1105
1108
|
"ogmios",
|
|
1106
1109
|
"queryLedgerState/protocolParameters"
|
|
@@ -1110,7 +1113,7 @@ var Kupmios = class {
|
|
|
1110
1113
|
data.method,
|
|
1111
1114
|
response
|
|
1112
1115
|
);
|
|
1113
|
-
const protocolParameters =
|
|
1116
|
+
const protocolParameters = S3.decodeUnknownSync(
|
|
1114
1117
|
ProtocolParametersSchema
|
|
1115
1118
|
)(normalizeProtocolParameters(result));
|
|
1116
1119
|
return toProtocolParameters(protocolParameters);
|
|
@@ -1126,16 +1129,16 @@ var Kupmios = class {
|
|
|
1126
1129
|
TreasuryAndReservesSchema
|
|
1127
1130
|
);
|
|
1128
1131
|
const response = await runProviderEffect(
|
|
1129
|
-
(0,
|
|
1132
|
+
(0, import_Function3.pipe)(
|
|
1130
1133
|
makePostAsJsonResponse(
|
|
1131
1134
|
this.ogmiosUrl,
|
|
1132
1135
|
data,
|
|
1133
1136
|
schema,
|
|
1134
1137
|
this.options.ogmiosHeader
|
|
1135
1138
|
),
|
|
1136
|
-
|
|
1139
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1137
1140
|
catchProviderError("ogmios", "queryLedgerState/treasuryAndReserves"),
|
|
1138
|
-
|
|
1141
|
+
Effect2.provide(this.httpLayer)
|
|
1139
1142
|
),
|
|
1140
1143
|
"ogmios",
|
|
1141
1144
|
"queryLedgerState/treasuryAndReserves"
|
|
@@ -1150,15 +1153,15 @@ var Kupmios = class {
|
|
|
1150
1153
|
async getUtxos(addressOrCredential) {
|
|
1151
1154
|
const isAddress = typeof addressOrCredential === "string";
|
|
1152
1155
|
const queryPredicate = isAddress ? addressOrCredential : addressOrCredential.hash;
|
|
1153
|
-
const
|
|
1154
|
-
const schema =
|
|
1156
|
+
const pattern2 = `${this.kupoUrl}/matches/${queryPredicate}${isAddress ? "" : "/*"}?unspent&resolve_hashes`;
|
|
1157
|
+
const schema = S3.Array(ResolvedUTxOSchema);
|
|
1155
1158
|
const utxos = await runProviderEffect(
|
|
1156
|
-
(0,
|
|
1157
|
-
makeGet(
|
|
1158
|
-
|
|
1159
|
-
|
|
1159
|
+
(0, import_Function3.pipe)(
|
|
1160
|
+
makeGet(pattern2, schema, this.options.kupoHeader),
|
|
1161
|
+
Effect2.map(kupmiosUtxosToUtxos),
|
|
1162
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1160
1163
|
catchProviderError("kupo", "getUtxos"),
|
|
1161
|
-
|
|
1164
|
+
Effect2.provide(this.httpLayer)
|
|
1162
1165
|
),
|
|
1163
1166
|
"kupo",
|
|
1164
1167
|
"getUtxos"
|
|
@@ -1169,15 +1172,15 @@ var Kupmios = class {
|
|
|
1169
1172
|
const isAddress = typeof addressOrCredential === "string";
|
|
1170
1173
|
const queryPredicate = isAddress ? addressOrCredential : addressOrCredential.hash;
|
|
1171
1174
|
const { policyId, assetName } = (0, import_utils4.fromUnit)(unit);
|
|
1172
|
-
const
|
|
1173
|
-
const schema =
|
|
1175
|
+
const pattern2 = `${this.kupoUrl}/matches/${queryPredicate}${isAddress ? "" : "/*"}?unspent&resolve_hashes&policy_id=${policyId}${assetName ? `&asset_name=${assetName}` : ""}`;
|
|
1176
|
+
const schema = S3.Array(ResolvedUTxOSchema);
|
|
1174
1177
|
const utxos = await runProviderEffect(
|
|
1175
|
-
(0,
|
|
1176
|
-
makeGet(
|
|
1177
|
-
|
|
1178
|
-
|
|
1178
|
+
(0, import_Function3.pipe)(
|
|
1179
|
+
makeGet(pattern2, schema, this.options.kupoHeader),
|
|
1180
|
+
Effect2.map(kupmiosUtxosToUtxos),
|
|
1181
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1179
1182
|
catchProviderError("kupo", "getUtxosWithUnit"),
|
|
1180
|
-
|
|
1183
|
+
Effect2.provide(this.httpLayer)
|
|
1181
1184
|
),
|
|
1182
1185
|
"kupo",
|
|
1183
1186
|
"getUtxosWithUnit"
|
|
@@ -1193,15 +1196,15 @@ var Kupmios = class {
|
|
|
1193
1196
|
const normalizedPolicyId = policyId.toLowerCase();
|
|
1194
1197
|
const isAddress = typeof addressOrCredential === "string";
|
|
1195
1198
|
const queryPredicate = isAddress ? addressOrCredential : addressOrCredential.hash;
|
|
1196
|
-
const
|
|
1197
|
-
const schema =
|
|
1199
|
+
const pattern2 = `${this.kupoUrl}/matches/${queryPredicate}${isAddress ? "" : "/*"}?unspent&resolve_hashes&policy_id=${normalizedPolicyId}`;
|
|
1200
|
+
const schema = S3.Array(ResolvedUTxOSchema);
|
|
1198
1201
|
return runProviderEffect(
|
|
1199
|
-
(0,
|
|
1200
|
-
makeGet(
|
|
1201
|
-
|
|
1202
|
-
|
|
1202
|
+
(0, import_Function3.pipe)(
|
|
1203
|
+
makeGet(pattern2, schema, this.options.kupoHeader),
|
|
1204
|
+
Effect2.map(kupmiosUtxosToUtxos),
|
|
1205
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1203
1206
|
catchProviderError("kupo", "getUtxosWithPolicy"),
|
|
1204
|
-
|
|
1207
|
+
Effect2.provide(this.httpLayer)
|
|
1205
1208
|
),
|
|
1206
1209
|
"kupo",
|
|
1207
1210
|
"getUtxosWithPolicy"
|
|
@@ -1209,15 +1212,15 @@ var Kupmios = class {
|
|
|
1209
1212
|
}
|
|
1210
1213
|
async getUtxoByUnit(unit) {
|
|
1211
1214
|
const { policyId, assetName } = (0, import_utils4.fromUnit)(unit);
|
|
1212
|
-
const
|
|
1213
|
-
const schema =
|
|
1215
|
+
const pattern2 = `${this.kupoUrl}/matches/${policyId}.${assetName ?? ""}?unspent&resolve_hashes`;
|
|
1216
|
+
const schema = S3.Array(ResolvedUTxOSchema);
|
|
1214
1217
|
const utxos = await runProviderEffect(
|
|
1215
|
-
(0,
|
|
1216
|
-
makeGet(
|
|
1217
|
-
|
|
1218
|
-
|
|
1218
|
+
(0, import_Function3.pipe)(
|
|
1219
|
+
makeGet(pattern2, schema, this.options.kupoHeader),
|
|
1220
|
+
Effect2.map(kupmiosUtxosToUtxos),
|
|
1221
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1219
1222
|
catchProviderError("kupo", "getUtxoByUnit"),
|
|
1220
|
-
|
|
1223
|
+
Effect2.provide(this.httpLayer)
|
|
1221
1224
|
),
|
|
1222
1225
|
"kupo",
|
|
1223
1226
|
"getUtxoByUnit"
|
|
@@ -1235,22 +1238,22 @@ var Kupmios = class {
|
|
|
1235
1238
|
...new Set(outRefs.map((outRef) => outRef.txHash))
|
|
1236
1239
|
];
|
|
1237
1240
|
const mkPattern = (txHash) => `${this.kupoUrl}/matches/*@${txHash}?unspent&resolve_hashes`;
|
|
1238
|
-
const schema =
|
|
1239
|
-
const program =
|
|
1241
|
+
const schema = S3.Array(ResolvedUTxOSchema);
|
|
1242
|
+
const program = Effect2.forEach(
|
|
1240
1243
|
queryHashes,
|
|
1241
|
-
(txHash) => (0,
|
|
1244
|
+
(txHash) => (0, import_Function3.pipe)(
|
|
1242
1245
|
makeGet(mkPattern(txHash), schema, this.options.kupoHeader),
|
|
1243
|
-
|
|
1244
|
-
|
|
1246
|
+
Effect2.map(kupmiosUtxosToUtxos),
|
|
1247
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1245
1248
|
catchProviderError("kupo", "getUtxosByOutRef")
|
|
1246
1249
|
)
|
|
1247
1250
|
);
|
|
1248
1251
|
const utxos = await runProviderEffect(
|
|
1249
|
-
(0,
|
|
1252
|
+
(0, import_Function3.pipe)(program, Effect2.provide(this.httpLayer)),
|
|
1250
1253
|
"kupo",
|
|
1251
1254
|
"getUtxosByOutRef"
|
|
1252
1255
|
);
|
|
1253
|
-
return
|
|
1256
|
+
return _Array.flatten(utxos).filter(
|
|
1254
1257
|
(utxo) => outRefs.some(
|
|
1255
1258
|
(outRef) => utxo.txHash === outRef.txHash && utxo.outputIndex === outRef.outputIndex
|
|
1256
1259
|
)
|
|
@@ -1265,15 +1268,15 @@ var Kupmios = class {
|
|
|
1265
1268
|
};
|
|
1266
1269
|
const schema = JSONRPCResponseSchema(Delegation);
|
|
1267
1270
|
const response = await runProviderEffect(
|
|
1268
|
-
(0,
|
|
1271
|
+
(0, import_Function3.pipe)(
|
|
1269
1272
|
makePostAsJsonResponse(
|
|
1270
1273
|
this.ogmiosUrl,
|
|
1271
1274
|
data,
|
|
1272
1275
|
schema,
|
|
1273
1276
|
this.options.ogmiosHeader
|
|
1274
1277
|
),
|
|
1275
|
-
|
|
1276
|
-
|
|
1278
|
+
Effect2.provide(this.httpLayer),
|
|
1279
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1277
1280
|
catchProviderError("ogmios", "queryLedgerState/rewardAccountSummaries")
|
|
1278
1281
|
),
|
|
1279
1282
|
"ogmios",
|
|
@@ -1291,14 +1294,14 @@ var Kupmios = class {
|
|
|
1291
1294
|
return { poolId, rewards };
|
|
1292
1295
|
}
|
|
1293
1296
|
async getDatum(datumHash) {
|
|
1294
|
-
const
|
|
1297
|
+
const pattern2 = `${this.kupoUrl}/datums/${datumHash}`;
|
|
1295
1298
|
const schema = DatumSchema;
|
|
1296
1299
|
const result = await runProviderEffect(
|
|
1297
|
-
(0,
|
|
1298
|
-
makeGet(
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1300
|
+
(0, import_Function3.pipe)(
|
|
1301
|
+
makeGet(pattern2, schema, this.options.kupoHeader),
|
|
1302
|
+
Effect2.provide(this.httpLayer),
|
|
1303
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1304
|
+
Effect2.flatMap(Effect2.fromNullable),
|
|
1302
1305
|
catchProviderError("kupo", "getDatum")
|
|
1303
1306
|
),
|
|
1304
1307
|
"kupo",
|
|
@@ -1307,16 +1310,16 @@ var Kupmios = class {
|
|
|
1307
1310
|
return result.datum;
|
|
1308
1311
|
}
|
|
1309
1312
|
async getTransactionStatus(txHash, options = {}) {
|
|
1310
|
-
const
|
|
1311
|
-
const schema =
|
|
1313
|
+
const pattern2 = `${this.kupoUrl}/matches/*@${txHash}`;
|
|
1314
|
+
const schema = S3.Array(UTxOSchema).annotations({
|
|
1312
1315
|
identifier: "Array<KupmiosSchema.KupoUTxO>"
|
|
1313
1316
|
});
|
|
1314
1317
|
const matches = await runProviderEffect(
|
|
1315
|
-
(0,
|
|
1316
|
-
makeGet(
|
|
1317
|
-
|
|
1318
|
+
(0, import_Function3.pipe)(
|
|
1319
|
+
makeGet(pattern2, schema, this.options.kupoHeader),
|
|
1320
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1318
1321
|
catchProviderError("kupo", "getTransactionStatus"),
|
|
1319
|
-
|
|
1322
|
+
Effect2.provide(this.httpLayer)
|
|
1320
1323
|
),
|
|
1321
1324
|
"kupo",
|
|
1322
1325
|
"getTransactionStatus",
|
|
@@ -1335,21 +1338,21 @@ var Kupmios = class {
|
|
|
1335
1338
|
};
|
|
1336
1339
|
}
|
|
1337
1340
|
async awaitTx(txHash, checkInterval = 2e4) {
|
|
1338
|
-
const
|
|
1339
|
-
const schema =
|
|
1341
|
+
const pattern2 = `${this.kupoUrl}/matches/*@${txHash}`;
|
|
1342
|
+
const schema = S3.Array(UTxOSchema).annotations({
|
|
1340
1343
|
identifier: "Array<KupmiosSchema.KupoUTxO>"
|
|
1341
1344
|
});
|
|
1342
1345
|
const result = await runProviderEffect(
|
|
1343
|
-
(0,
|
|
1344
|
-
makeGet(
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
schedule:
|
|
1346
|
+
(0, import_Function3.pipe)(
|
|
1347
|
+
makeGet(pattern2, schema, this.options.kupoHeader),
|
|
1348
|
+
Effect2.provide(this.httpLayer),
|
|
1349
|
+
Effect2.repeat({
|
|
1350
|
+
schedule: Schedule.exponential(checkInterval),
|
|
1348
1351
|
until: (result2) => result2.length > 0
|
|
1349
1352
|
}),
|
|
1350
|
-
|
|
1353
|
+
Effect2.timeout(this.awaitTxTimeoutMs),
|
|
1351
1354
|
catchProviderError("kupo", "awaitTx"),
|
|
1352
|
-
|
|
1355
|
+
Effect2.as(true)
|
|
1353
1356
|
),
|
|
1354
1357
|
"kupo",
|
|
1355
1358
|
"awaitTx"
|
|
@@ -1366,22 +1369,22 @@ var Kupmios = class {
|
|
|
1366
1369
|
id: null
|
|
1367
1370
|
};
|
|
1368
1371
|
const schema = JSONRPCResponseSchema(
|
|
1369
|
-
|
|
1370
|
-
transaction:
|
|
1371
|
-
id:
|
|
1372
|
+
S3.Struct({
|
|
1373
|
+
transaction: S3.Struct({
|
|
1374
|
+
id: S3.String
|
|
1372
1375
|
})
|
|
1373
1376
|
})
|
|
1374
1377
|
);
|
|
1375
1378
|
const response = await runProviderEffect(
|
|
1376
|
-
(0,
|
|
1379
|
+
(0, import_Function3.pipe)(
|
|
1377
1380
|
makePostAsJsonResponse(
|
|
1378
1381
|
this.ogmiosUrl,
|
|
1379
1382
|
data,
|
|
1380
1383
|
schema,
|
|
1381
1384
|
this.options.ogmiosHeader
|
|
1382
1385
|
),
|
|
1383
|
-
|
|
1384
|
-
|
|
1386
|
+
Effect2.provide(this.httpLayer),
|
|
1387
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1385
1388
|
catchProviderError("ogmios", "submitTransaction")
|
|
1386
1389
|
),
|
|
1387
1390
|
"ogmios",
|
|
@@ -1404,17 +1407,17 @@ var Kupmios = class {
|
|
|
1404
1407
|
},
|
|
1405
1408
|
id: null
|
|
1406
1409
|
};
|
|
1407
|
-
const schema = JSONRPCResponseSchema(
|
|
1410
|
+
const schema = JSONRPCResponseSchema(S3.Array(RedeemerSchema));
|
|
1408
1411
|
const response = await runProviderEffect(
|
|
1409
|
-
(0,
|
|
1412
|
+
(0, import_Function3.pipe)(
|
|
1410
1413
|
makePostAsJsonResponse(
|
|
1411
1414
|
this.ogmiosUrl,
|
|
1412
1415
|
data,
|
|
1413
1416
|
schema,
|
|
1414
1417
|
this.options.ogmiosHeader
|
|
1415
1418
|
),
|
|
1416
|
-
|
|
1417
|
-
|
|
1419
|
+
Effect2.provide(this.httpLayer),
|
|
1420
|
+
Effect2.timeout(this.requestTimeoutMs),
|
|
1418
1421
|
catchProviderError("ogmios", "evaluateTransaction")
|
|
1419
1422
|
),
|
|
1420
1423
|
"ogmios",
|
|
@@ -1524,6 +1527,53 @@ var import_utils7 = require("@lucid-evolution/utils");
|
|
|
1524
1527
|
var import_core_utils2 = require("@lucid-evolution/core-utils");
|
|
1525
1528
|
var import_wallet = require("@lucid-evolution/wallet");
|
|
1526
1529
|
|
|
1530
|
+
// src/internal/ed25519.ts
|
|
1531
|
+
var nodeCrypto = (() => {
|
|
1532
|
+
try {
|
|
1533
|
+
return globalThis.process?.getBuiltinModule?.("node:crypto");
|
|
1534
|
+
} catch {
|
|
1535
|
+
return void 0;
|
|
1536
|
+
}
|
|
1537
|
+
})();
|
|
1538
|
+
var SPKI_PREFIX = [
|
|
1539
|
+
48,
|
|
1540
|
+
42,
|
|
1541
|
+
48,
|
|
1542
|
+
5,
|
|
1543
|
+
6,
|
|
1544
|
+
3,
|
|
1545
|
+
43,
|
|
1546
|
+
101,
|
|
1547
|
+
112,
|
|
1548
|
+
3,
|
|
1549
|
+
33,
|
|
1550
|
+
0
|
|
1551
|
+
];
|
|
1552
|
+
var nativeVerifyEd25519 = (publicKey, message, signature) => {
|
|
1553
|
+
if (!nodeCrypto || publicKey.length !== 32 || signature.length !== 64) {
|
|
1554
|
+
return false;
|
|
1555
|
+
}
|
|
1556
|
+
if (publicKey.every((byte) => byte === 0)) return false;
|
|
1557
|
+
try {
|
|
1558
|
+
const spki = Buffer.alloc(SPKI_PREFIX.length + 32);
|
|
1559
|
+
spki.set(SPKI_PREFIX);
|
|
1560
|
+
spki.set(publicKey, SPKI_PREFIX.length);
|
|
1561
|
+
const key = nodeCrypto.createPublicKey({
|
|
1562
|
+
key: spki,
|
|
1563
|
+
format: "der",
|
|
1564
|
+
type: "spki"
|
|
1565
|
+
});
|
|
1566
|
+
return nodeCrypto.verify(null, message, key, signature);
|
|
1567
|
+
} catch {
|
|
1568
|
+
return false;
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
var verifyEd25519 = (publicKey, message, signature) => nativeVerifyEd25519(
|
|
1572
|
+
publicKey.to_raw_bytes(),
|
|
1573
|
+
message,
|
|
1574
|
+
signature.to_raw_bytes()
|
|
1575
|
+
) || publicKey.verify(message, signature);
|
|
1576
|
+
|
|
1527
1577
|
// src/internal/emulator-ledger.ts
|
|
1528
1578
|
var import_utils5 = require("@lucid-evolution/utils");
|
|
1529
1579
|
var isUnorderedKey = (key) => {
|
|
@@ -2035,7 +2085,11 @@ var Emulator = class {
|
|
|
2035
2085
|
const witness = own3(vkeyWitnesses.get(i));
|
|
2036
2086
|
const publicKey = own3(witness.vkey());
|
|
2037
2087
|
const keyHash = own3(publicKey.hash()).to_hex();
|
|
2038
|
-
if (!
|
|
2088
|
+
if (!verifyEd25519(
|
|
2089
|
+
publicKey,
|
|
2090
|
+
(0, import_core_utils2.fromHex)(txHash),
|
|
2091
|
+
own3(witness.ed25519_signature())
|
|
2092
|
+
)) {
|
|
2039
2093
|
throw new Error(`Invalid vkey witness. Key hash: ${keyHash}`);
|
|
2040
2094
|
}
|
|
2041
2095
|
keyHashes2.push(keyHash);
|
|
@@ -2876,210 +2930,212 @@ var import_core_utils3 = require("@lucid-evolution/core-utils");
|
|
|
2876
2930
|
var import_utils9 = require("@lucid-evolution/utils");
|
|
2877
2931
|
|
|
2878
2932
|
// src/internal/koios.ts
|
|
2879
|
-
var
|
|
2880
|
-
var
|
|
2933
|
+
var FetchHttpClient2 = __toESM(require("@effect/platform/FetchHttpClient"), 1);
|
|
2934
|
+
var Effect3 = __toESM(require("effect/Effect"), 1);
|
|
2935
|
+
var S4 = __toESM(require("effect/Schema"), 1);
|
|
2936
|
+
var import_Function4 = require("effect/Function");
|
|
2881
2937
|
var import_utils8 = require("@lucid-evolution/utils");
|
|
2882
|
-
var ProtocolParametersSchema2 =
|
|
2883
|
-
pvt_motion_no_confidence:
|
|
2884
|
-
pvt_committee_normal:
|
|
2885
|
-
pvt_committee_no_confidence:
|
|
2886
|
-
pvt_hard_fork_initiation:
|
|
2887
|
-
pvtpp_security_group:
|
|
2888
|
-
dvt_motion_no_confidence:
|
|
2889
|
-
dvt_committee_normal:
|
|
2890
|
-
dvt_committee_no_confidence:
|
|
2891
|
-
dvt_update_to_constitution:
|
|
2892
|
-
dvt_hard_fork_initiation:
|
|
2893
|
-
dvt_p_p_network_group:
|
|
2894
|
-
dvt_p_p_economic_group:
|
|
2895
|
-
dvt_p_p_technical_group:
|
|
2896
|
-
dvt_p_p_gov_group:
|
|
2897
|
-
dvt_treasury_withdrawal:
|
|
2898
|
-
committee_min_size:
|
|
2899
|
-
committee_max_term_length:
|
|
2900
|
-
gov_action_lifetime:
|
|
2901
|
-
gov_action_deposit:
|
|
2902
|
-
drep_deposit:
|
|
2903
|
-
drep_activity:
|
|
2904
|
-
min_fee_ref_script_cost_per_byte:
|
|
2905
|
-
epoch_no:
|
|
2906
|
-
min_fee_a:
|
|
2907
|
-
min_fee_b:
|
|
2908
|
-
max_block_size:
|
|
2909
|
-
max_tx_size:
|
|
2910
|
-
max_bh_size:
|
|
2911
|
-
key_deposit:
|
|
2912
|
-
pool_deposit:
|
|
2913
|
-
max_epoch:
|
|
2914
|
-
optimal_pool_count:
|
|
2915
|
-
influence:
|
|
2916
|
-
monetary_expand_rate:
|
|
2917
|
-
treasury_growth_rate:
|
|
2918
|
-
decentralisation:
|
|
2919
|
-
extra_entropy:
|
|
2920
|
-
protocol_major:
|
|
2921
|
-
protocol_minor:
|
|
2922
|
-
min_utxo_value:
|
|
2923
|
-
min_pool_cost:
|
|
2924
|
-
nonce:
|
|
2925
|
-
block_hash:
|
|
2926
|
-
cost_models:
|
|
2927
|
-
PlutusV1:
|
|
2928
|
-
PlutusV2:
|
|
2929
|
-
PlutusV3:
|
|
2938
|
+
var ProtocolParametersSchema2 = S4.Struct({
|
|
2939
|
+
pvt_motion_no_confidence: S4.Number,
|
|
2940
|
+
pvt_committee_normal: S4.Number,
|
|
2941
|
+
pvt_committee_no_confidence: S4.Number,
|
|
2942
|
+
pvt_hard_fork_initiation: S4.Number,
|
|
2943
|
+
pvtpp_security_group: S4.Number,
|
|
2944
|
+
dvt_motion_no_confidence: S4.Number,
|
|
2945
|
+
dvt_committee_normal: S4.Number,
|
|
2946
|
+
dvt_committee_no_confidence: S4.Number,
|
|
2947
|
+
dvt_update_to_constitution: S4.Number,
|
|
2948
|
+
dvt_hard_fork_initiation: S4.Number,
|
|
2949
|
+
dvt_p_p_network_group: S4.Number,
|
|
2950
|
+
dvt_p_p_economic_group: S4.Number,
|
|
2951
|
+
dvt_p_p_technical_group: S4.Number,
|
|
2952
|
+
dvt_p_p_gov_group: S4.Number,
|
|
2953
|
+
dvt_treasury_withdrawal: S4.Number,
|
|
2954
|
+
committee_min_size: S4.Number,
|
|
2955
|
+
committee_max_term_length: S4.Number,
|
|
2956
|
+
gov_action_lifetime: S4.Number,
|
|
2957
|
+
gov_action_deposit: S4.NumberFromString,
|
|
2958
|
+
drep_deposit: S4.NumberFromString,
|
|
2959
|
+
drep_activity: S4.Number,
|
|
2960
|
+
min_fee_ref_script_cost_per_byte: S4.Number,
|
|
2961
|
+
epoch_no: S4.Number,
|
|
2962
|
+
min_fee_a: S4.Number,
|
|
2963
|
+
min_fee_b: S4.Number,
|
|
2964
|
+
max_block_size: S4.Number,
|
|
2965
|
+
max_tx_size: S4.Number,
|
|
2966
|
+
max_bh_size: S4.Number,
|
|
2967
|
+
key_deposit: S4.BigInt,
|
|
2968
|
+
pool_deposit: S4.BigInt,
|
|
2969
|
+
max_epoch: S4.Number,
|
|
2970
|
+
optimal_pool_count: S4.Number,
|
|
2971
|
+
influence: S4.Number,
|
|
2972
|
+
monetary_expand_rate: S4.Number,
|
|
2973
|
+
treasury_growth_rate: S4.Number,
|
|
2974
|
+
decentralisation: S4.Number,
|
|
2975
|
+
extra_entropy: S4.NullOr(S4.String),
|
|
2976
|
+
protocol_major: S4.Number,
|
|
2977
|
+
protocol_minor: S4.Number,
|
|
2978
|
+
min_utxo_value: S4.String,
|
|
2979
|
+
min_pool_cost: S4.String,
|
|
2980
|
+
nonce: S4.String,
|
|
2981
|
+
block_hash: S4.NullOr(S4.String),
|
|
2982
|
+
cost_models: S4.Struct({
|
|
2983
|
+
PlutusV1: S4.Array(S4.Number),
|
|
2984
|
+
PlutusV2: S4.Array(S4.Number),
|
|
2985
|
+
PlutusV3: S4.Array(S4.Number)
|
|
2930
2986
|
}),
|
|
2931
|
-
price_mem:
|
|
2932
|
-
price_step:
|
|
2933
|
-
max_tx_ex_mem:
|
|
2934
|
-
max_tx_ex_steps:
|
|
2935
|
-
max_block_ex_mem:
|
|
2936
|
-
max_block_ex_steps:
|
|
2937
|
-
max_val_size:
|
|
2938
|
-
collateral_percent:
|
|
2939
|
-
max_collateral_inputs:
|
|
2940
|
-
coins_per_utxo_size:
|
|
2987
|
+
price_mem: S4.Number,
|
|
2988
|
+
price_step: S4.Number,
|
|
2989
|
+
max_tx_ex_mem: S4.BigIntFromNumber,
|
|
2990
|
+
max_tx_ex_steps: S4.BigIntFromNumber,
|
|
2991
|
+
max_block_ex_mem: S4.Number,
|
|
2992
|
+
max_block_ex_steps: S4.Number,
|
|
2993
|
+
max_val_size: S4.Number,
|
|
2994
|
+
collateral_percent: S4.Number,
|
|
2995
|
+
max_collateral_inputs: S4.Number,
|
|
2996
|
+
coins_per_utxo_size: S4.BigInt
|
|
2941
2997
|
});
|
|
2942
|
-
var TotalsSchema =
|
|
2943
|
-
treasury:
|
|
2998
|
+
var TotalsSchema = S4.Struct({
|
|
2999
|
+
treasury: S4.String
|
|
2944
3000
|
});
|
|
2945
|
-
var AssetSchema =
|
|
2946
|
-
policy_id:
|
|
2947
|
-
asset_name:
|
|
2948
|
-
fingerprint:
|
|
2949
|
-
decimals:
|
|
2950
|
-
quantity:
|
|
3001
|
+
var AssetSchema = S4.Struct({
|
|
3002
|
+
policy_id: S4.String,
|
|
3003
|
+
asset_name: S4.NullOr(S4.String),
|
|
3004
|
+
fingerprint: S4.String,
|
|
3005
|
+
decimals: S4.Number,
|
|
3006
|
+
quantity: S4.String
|
|
2951
3007
|
});
|
|
2952
|
-
var ReferenceScriptSchema =
|
|
2953
|
-
hash:
|
|
2954
|
-
size:
|
|
2955
|
-
type:
|
|
2956
|
-
bytes:
|
|
2957
|
-
value:
|
|
3008
|
+
var ReferenceScriptSchema = S4.Struct({
|
|
3009
|
+
hash: S4.NullOr(S4.String),
|
|
3010
|
+
size: S4.NullOr(S4.Number),
|
|
3011
|
+
type: S4.NullOr(S4.String),
|
|
3012
|
+
bytes: S4.NullOr(S4.String),
|
|
3013
|
+
value: S4.NullOr(S4.Object)
|
|
2958
3014
|
});
|
|
2959
|
-
var UTxOSchema2 =
|
|
2960
|
-
tx_hash:
|
|
2961
|
-
tx_index:
|
|
2962
|
-
block_time:
|
|
2963
|
-
block_height:
|
|
2964
|
-
value:
|
|
2965
|
-
datum_hash:
|
|
2966
|
-
inline_datum:
|
|
2967
|
-
|
|
2968
|
-
bytes:
|
|
2969
|
-
value:
|
|
3015
|
+
var UTxOSchema2 = S4.Struct({
|
|
3016
|
+
tx_hash: S4.String,
|
|
3017
|
+
tx_index: S4.Number,
|
|
3018
|
+
block_time: S4.Number,
|
|
3019
|
+
block_height: S4.NullOr(S4.Number),
|
|
3020
|
+
value: S4.String,
|
|
3021
|
+
datum_hash: S4.NullOr(S4.String),
|
|
3022
|
+
inline_datum: S4.NullOr(
|
|
3023
|
+
S4.Struct({
|
|
3024
|
+
bytes: S4.String,
|
|
3025
|
+
value: S4.Object
|
|
2970
3026
|
})
|
|
2971
3027
|
),
|
|
2972
|
-
reference_script:
|
|
2973
|
-
asset_list:
|
|
3028
|
+
reference_script: S4.NullOr(ReferenceScriptSchema),
|
|
3029
|
+
asset_list: S4.NullOr(S4.Array(AssetSchema))
|
|
2974
3030
|
});
|
|
2975
|
-
var AddressInfoSchema =
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
address:
|
|
2979
|
-
balance:
|
|
2980
|
-
stake_address:
|
|
2981
|
-
script_address:
|
|
2982
|
-
utxo_set:
|
|
3031
|
+
var AddressInfoSchema = S4.Array(
|
|
3032
|
+
S4.NullishOr(
|
|
3033
|
+
S4.Struct({
|
|
3034
|
+
address: S4.String,
|
|
3035
|
+
balance: S4.String,
|
|
3036
|
+
stake_address: S4.NullOr(S4.String),
|
|
3037
|
+
script_address: S4.Boolean,
|
|
3038
|
+
utxo_set: S4.Array(UTxOSchema2)
|
|
2983
3039
|
})
|
|
2984
3040
|
)
|
|
2985
3041
|
);
|
|
2986
|
-
var InputOutputSchema =
|
|
2987
|
-
payment_addr:
|
|
2988
|
-
bech32:
|
|
2989
|
-
cred:
|
|
3042
|
+
var InputOutputSchema = S4.Struct({
|
|
3043
|
+
payment_addr: S4.Struct({
|
|
3044
|
+
bech32: S4.String,
|
|
3045
|
+
cred: S4.String
|
|
2990
3046
|
}),
|
|
2991
|
-
stake_addr:
|
|
2992
|
-
tx_hash:
|
|
2993
|
-
tx_index:
|
|
2994
|
-
value:
|
|
2995
|
-
datum_hash:
|
|
2996
|
-
inline_datum:
|
|
2997
|
-
|
|
2998
|
-
bytes:
|
|
2999
|
-
value:
|
|
3047
|
+
stake_addr: S4.NullOr(S4.String),
|
|
3048
|
+
tx_hash: S4.String,
|
|
3049
|
+
tx_index: S4.Number,
|
|
3050
|
+
value: S4.String,
|
|
3051
|
+
datum_hash: S4.NullOr(S4.String),
|
|
3052
|
+
inline_datum: S4.NullOr(
|
|
3053
|
+
S4.Struct({
|
|
3054
|
+
bytes: S4.String,
|
|
3055
|
+
value: S4.Object
|
|
3000
3056
|
})
|
|
3001
3057
|
),
|
|
3002
|
-
reference_script:
|
|
3003
|
-
asset_list:
|
|
3058
|
+
reference_script: S4.NullOr(ReferenceScriptSchema),
|
|
3059
|
+
asset_list: S4.Array(AssetSchema)
|
|
3004
3060
|
});
|
|
3005
|
-
var TxInfoSchema =
|
|
3006
|
-
tx_hash:
|
|
3007
|
-
block_hash:
|
|
3008
|
-
block_height:
|
|
3009
|
-
epoch_no:
|
|
3010
|
-
epoch_slot:
|
|
3011
|
-
absolute_slot:
|
|
3012
|
-
tx_timestamp:
|
|
3013
|
-
tx_block_index:
|
|
3014
|
-
tx_size:
|
|
3015
|
-
total_output:
|
|
3016
|
-
fee:
|
|
3017
|
-
treasury_donation:
|
|
3018
|
-
deposit:
|
|
3019
|
-
invalid_before:
|
|
3020
|
-
invalid_after:
|
|
3021
|
-
collateral_inputs:
|
|
3022
|
-
collateral_output:
|
|
3023
|
-
reference_inputs:
|
|
3024
|
-
inputs:
|
|
3025
|
-
outputs:
|
|
3026
|
-
withdrawals:
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
amount:
|
|
3030
|
-
stake_addr:
|
|
3061
|
+
var TxInfoSchema = S4.Struct({
|
|
3062
|
+
tx_hash: S4.String,
|
|
3063
|
+
block_hash: S4.String,
|
|
3064
|
+
block_height: S4.Number,
|
|
3065
|
+
epoch_no: S4.Number,
|
|
3066
|
+
epoch_slot: S4.Number,
|
|
3067
|
+
absolute_slot: S4.Number,
|
|
3068
|
+
tx_timestamp: S4.Number,
|
|
3069
|
+
tx_block_index: S4.Number,
|
|
3070
|
+
tx_size: S4.Number,
|
|
3071
|
+
total_output: S4.String,
|
|
3072
|
+
fee: S4.String,
|
|
3073
|
+
treasury_donation: S4.String,
|
|
3074
|
+
deposit: S4.String,
|
|
3075
|
+
invalid_before: S4.NullOr(S4.String),
|
|
3076
|
+
invalid_after: S4.NullOr(S4.String),
|
|
3077
|
+
collateral_inputs: S4.NullOr(S4.Array(InputOutputSchema)),
|
|
3078
|
+
collateral_output: S4.NullOr(InputOutputSchema),
|
|
3079
|
+
reference_inputs: S4.NullOr(S4.Array(InputOutputSchema)),
|
|
3080
|
+
inputs: S4.Array(InputOutputSchema),
|
|
3081
|
+
outputs: S4.Array(InputOutputSchema),
|
|
3082
|
+
withdrawals: S4.NullOr(
|
|
3083
|
+
S4.Array(
|
|
3084
|
+
S4.Struct({
|
|
3085
|
+
amount: S4.String,
|
|
3086
|
+
stake_addr: S4.String
|
|
3031
3087
|
})
|
|
3032
3088
|
)
|
|
3033
3089
|
),
|
|
3034
|
-
assets_minted:
|
|
3035
|
-
metadata:
|
|
3036
|
-
certificates:
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
index:
|
|
3040
|
-
type:
|
|
3041
|
-
info:
|
|
3090
|
+
assets_minted: S4.NullOr(S4.Array(AssetSchema)),
|
|
3091
|
+
metadata: S4.NullOr(S4.Object),
|
|
3092
|
+
certificates: S4.NullOr(
|
|
3093
|
+
S4.Array(
|
|
3094
|
+
S4.Struct({
|
|
3095
|
+
index: S4.Number,
|
|
3096
|
+
type: S4.String,
|
|
3097
|
+
info: S4.NullOr(S4.Object)
|
|
3042
3098
|
})
|
|
3043
3099
|
)
|
|
3044
3100
|
),
|
|
3045
|
-
native_scripts:
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
script_hash:
|
|
3049
|
-
script_json:
|
|
3101
|
+
native_scripts: S4.NullOr(
|
|
3102
|
+
S4.Array(
|
|
3103
|
+
S4.Struct({
|
|
3104
|
+
script_hash: S4.String,
|
|
3105
|
+
script_json: S4.Object
|
|
3050
3106
|
})
|
|
3051
3107
|
)
|
|
3052
3108
|
),
|
|
3053
|
-
plutus_contracts:
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
address:
|
|
3057
|
-
spends_input:
|
|
3058
|
-
|
|
3059
|
-
tx_hash:
|
|
3060
|
-
tx_index:
|
|
3109
|
+
plutus_contracts: S4.NullOr(
|
|
3110
|
+
S4.Array(
|
|
3111
|
+
S4.Struct({
|
|
3112
|
+
address: S4.String,
|
|
3113
|
+
spends_input: S4.NullOr(
|
|
3114
|
+
S4.Struct({
|
|
3115
|
+
tx_hash: S4.String,
|
|
3116
|
+
tx_index: S4.Number
|
|
3061
3117
|
})
|
|
3062
3118
|
),
|
|
3063
|
-
script_hash:
|
|
3064
|
-
bytecode:
|
|
3065
|
-
size:
|
|
3066
|
-
valid_contract:
|
|
3067
|
-
input:
|
|
3068
|
-
redeemer:
|
|
3069
|
-
purpose:
|
|
3070
|
-
fee:
|
|
3071
|
-
unit:
|
|
3072
|
-
steps:
|
|
3073
|
-
mem:
|
|
3119
|
+
script_hash: S4.String,
|
|
3120
|
+
bytecode: S4.String,
|
|
3121
|
+
size: S4.Number,
|
|
3122
|
+
valid_contract: S4.Boolean,
|
|
3123
|
+
input: S4.Struct({
|
|
3124
|
+
redeemer: S4.Struct({
|
|
3125
|
+
purpose: S4.Literal("spend", "mint", "cert", "reward"),
|
|
3126
|
+
fee: S4.String,
|
|
3127
|
+
unit: S4.Struct({
|
|
3128
|
+
steps: S4.String,
|
|
3129
|
+
mem: S4.String
|
|
3074
3130
|
}),
|
|
3075
|
-
datum:
|
|
3076
|
-
hash:
|
|
3077
|
-
value:
|
|
3131
|
+
datum: S4.Struct({
|
|
3132
|
+
hash: S4.NullOr(S4.String),
|
|
3133
|
+
value: S4.NullOr(S4.Object)
|
|
3078
3134
|
})
|
|
3079
3135
|
}),
|
|
3080
|
-
datum:
|
|
3081
|
-
hash:
|
|
3082
|
-
value:
|
|
3136
|
+
datum: S4.Struct({
|
|
3137
|
+
hash: S4.NullOr(S4.String),
|
|
3138
|
+
value: S4.NullOr(S4.Object)
|
|
3083
3139
|
})
|
|
3084
3140
|
})
|
|
3085
3141
|
})
|
|
@@ -3087,28 +3143,28 @@ var TxInfoSchema = import_effect7.Schema.Struct({
|
|
|
3087
3143
|
),
|
|
3088
3144
|
//TODO: add S.Struct
|
|
3089
3145
|
// https://preprod.koios.rest/#post-/tx_info
|
|
3090
|
-
voting_procedures:
|
|
3146
|
+
voting_procedures: S4.Array(S4.Object),
|
|
3091
3147
|
//TODO: add S.Struct
|
|
3092
3148
|
// https://preprod.koios.rest/#post-/tx_info
|
|
3093
|
-
proposal_procedures:
|
|
3149
|
+
proposal_procedures: S4.Object
|
|
3094
3150
|
});
|
|
3095
|
-
var TxHashSchema =
|
|
3096
|
-
var AssetAddressSchema =
|
|
3097
|
-
payment_address:
|
|
3098
|
-
stake_address:
|
|
3099
|
-
quantity:
|
|
3151
|
+
var TxHashSchema = S4.String;
|
|
3152
|
+
var AssetAddressSchema = S4.Struct({
|
|
3153
|
+
payment_address: S4.String,
|
|
3154
|
+
stake_address: S4.NullOr(S4.String),
|
|
3155
|
+
quantity: S4.String
|
|
3100
3156
|
});
|
|
3101
|
-
var AccountInfoSchema =
|
|
3102
|
-
status:
|
|
3103
|
-
delegated_pool:
|
|
3104
|
-
rewards_available:
|
|
3157
|
+
var AccountInfoSchema = S4.Struct({
|
|
3158
|
+
status: S4.Literal("registered", "not registered"),
|
|
3159
|
+
delegated_pool: S4.NullOr(S4.String),
|
|
3160
|
+
rewards_available: S4.String
|
|
3105
3161
|
});
|
|
3106
|
-
var TxStatusSchema =
|
|
3107
|
-
tx_hash:
|
|
3108
|
-
num_confirmations:
|
|
3162
|
+
var TxStatusSchema = S4.Struct({
|
|
3163
|
+
tx_hash: S4.String,
|
|
3164
|
+
num_confirmations: S4.NullOr(S4.Number)
|
|
3109
3165
|
});
|
|
3110
|
-
var DatumInfo =
|
|
3111
|
-
bytes:
|
|
3166
|
+
var DatumInfo = S4.Struct({
|
|
3167
|
+
bytes: S4.String
|
|
3112
3168
|
});
|
|
3113
3169
|
var toUTxO = (koiosUTxO, address) => ({
|
|
3114
3170
|
txHash: koiosUTxO.tx_hash,
|
|
@@ -3157,23 +3213,27 @@ var getUtxosEffect = (baseUrl, addressOrCredential, headers) => {
|
|
|
3157
3213
|
_addresses: [addressOrCredential]
|
|
3158
3214
|
};
|
|
3159
3215
|
const schema = AddressInfoSchema;
|
|
3160
|
-
const result = (0,
|
|
3161
|
-
|
|
3162
|
-
onFalse: () =>
|
|
3216
|
+
const result = (0, import_Function4.pipe)(
|
|
3217
|
+
Effect3.if(typeof addressOrCredential === "string", {
|
|
3218
|
+
onFalse: () => Effect3.fail("Credential Type is not supported in Koios yet."),
|
|
3163
3219
|
onTrue: () => makePostAsJson(url, body, schema, headers)
|
|
3164
3220
|
}),
|
|
3165
|
-
|
|
3221
|
+
Effect3.map(
|
|
3166
3222
|
([result2]) => result2 ? result2.utxo_set.map((koiosUtxo) => toUTxO(koiosUtxo, result2.address)) : []
|
|
3167
3223
|
),
|
|
3168
|
-
|
|
3224
|
+
Effect3.provide(FetchHttpClient2.layer)
|
|
3169
3225
|
);
|
|
3170
3226
|
return result;
|
|
3171
3227
|
};
|
|
3172
3228
|
|
|
3173
3229
|
// src/koios.ts
|
|
3174
|
-
var
|
|
3175
|
-
var
|
|
3176
|
-
var
|
|
3230
|
+
var Data = __toESM(require("effect/Data"), 1);
|
|
3231
|
+
var Effect4 = __toESM(require("effect/Effect"), 1);
|
|
3232
|
+
var Schedule2 = __toESM(require("effect/Schedule"), 1);
|
|
3233
|
+
var S5 = __toESM(require("effect/Schema"), 1);
|
|
3234
|
+
var import_Function5 = require("effect/Function");
|
|
3235
|
+
var FetchHttpClient3 = __toESM(require("@effect/platform/FetchHttpClient"), 1);
|
|
3236
|
+
var KoiosError = class extends Data.TaggedError("KoiosError") {
|
|
3177
3237
|
get message() {
|
|
3178
3238
|
return `${this.cause}`;
|
|
3179
3239
|
}
|
|
@@ -3187,15 +3247,15 @@ var Koios = class {
|
|
|
3187
3247
|
}
|
|
3188
3248
|
async getProtocolParameters() {
|
|
3189
3249
|
const url = `${this.baseUrl}/epoch_params?limit=1`;
|
|
3190
|
-
const schema =
|
|
3250
|
+
const schema = S5.Array(ProtocolParametersSchema2);
|
|
3191
3251
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3192
|
-
const [result] = await (0,
|
|
3252
|
+
const [result] = await (0, import_Function5.pipe)(
|
|
3193
3253
|
makeGet(url, schema, bearerToken),
|
|
3194
3254
|
// Allows for dependency injection and easier testing
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3255
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3256
|
+
Effect4.timeout(1e4),
|
|
3257
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3258
|
+
Effect4.runPromise
|
|
3199
3259
|
);
|
|
3200
3260
|
return {
|
|
3201
3261
|
protocolMajorVersion: result.protocol_major,
|
|
@@ -3225,43 +3285,43 @@ var Koios = class {
|
|
|
3225
3285
|
}
|
|
3226
3286
|
async getTreasury() {
|
|
3227
3287
|
const url = `${this.baseUrl}/totals?order=epoch_no.desc&limit=1`;
|
|
3228
|
-
const schema =
|
|
3288
|
+
const schema = S5.Array(TotalsSchema);
|
|
3229
3289
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3230
|
-
const [result] = await (0,
|
|
3290
|
+
const [result] = await (0, import_Function5.pipe)(
|
|
3231
3291
|
makeGet(url, schema, bearerToken),
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
(result2) => result2.length === 0 ?
|
|
3292
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3293
|
+
Effect4.flatMap(
|
|
3294
|
+
(result2) => result2.length === 0 ? Effect4.fail("No totals found") : Effect4.succeed(result2)
|
|
3235
3295
|
),
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3296
|
+
Effect4.timeout(1e4),
|
|
3297
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3298
|
+
Effect4.runPromise
|
|
3239
3299
|
);
|
|
3240
3300
|
return BigInt(result.treasury);
|
|
3241
3301
|
}
|
|
3242
3302
|
async getUtxos(addressOrCredential) {
|
|
3243
3303
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3244
|
-
const result = await (0,
|
|
3304
|
+
const result = await (0, import_Function5.pipe)(
|
|
3245
3305
|
getUtxosEffect(this.baseUrl, addressOrCredential, bearerToken),
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3306
|
+
Effect4.timeout(1e4),
|
|
3307
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3308
|
+
Effect4.runPromise
|
|
3249
3309
|
);
|
|
3250
3310
|
return result;
|
|
3251
3311
|
}
|
|
3252
3312
|
async getUtxosWithUnit(addressOrCredential, unit) {
|
|
3253
3313
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3254
|
-
const result = await (0,
|
|
3314
|
+
const result = await (0, import_Function5.pipe)(
|
|
3255
3315
|
getUtxosEffect(this.baseUrl, addressOrCredential, bearerToken),
|
|
3256
|
-
|
|
3316
|
+
Effect4.map(
|
|
3257
3317
|
(utxos) => utxos.filter((utxo) => {
|
|
3258
3318
|
const keys = Object.keys(utxo.assets);
|
|
3259
3319
|
return keys.length > 0 && keys.includes(unit);
|
|
3260
3320
|
})
|
|
3261
3321
|
),
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3322
|
+
Effect4.timeout(1e4),
|
|
3323
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3324
|
+
Effect4.runPromise
|
|
3265
3325
|
);
|
|
3266
3326
|
return result;
|
|
3267
3327
|
}
|
|
@@ -3269,35 +3329,35 @@ var Koios = class {
|
|
|
3269
3329
|
let { policyId, assetName } = (0, import_utils9.fromUnit)(unit);
|
|
3270
3330
|
const url = `${this.baseUrl}/asset_addresses?_asset_policy=${policyId}&_asset_name=${assetName}`;
|
|
3271
3331
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3272
|
-
const result = await (0,
|
|
3273
|
-
makeGet(url,
|
|
3332
|
+
const result = await (0, import_Function5.pipe)(
|
|
3333
|
+
makeGet(url, S5.Array(AssetAddressSchema), bearerToken),
|
|
3274
3334
|
// Allows for dependency injection and easier testing
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
(adresses) => adresses.length === 0 ?
|
|
3335
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3336
|
+
Effect4.flatMap(
|
|
3337
|
+
(adresses) => adresses.length === 0 ? Effect4.fail("Unit not found") : Effect4.succeed(adresses)
|
|
3278
3338
|
),
|
|
3279
|
-
|
|
3280
|
-
(adresses) => adresses.length > 1 ?
|
|
3339
|
+
Effect4.flatMap(
|
|
3340
|
+
(adresses) => adresses.length > 1 ? Effect4.fail("Unit needs to be an NFT or only held by one address.") : Effect4.succeed(adresses[0])
|
|
3281
3341
|
),
|
|
3282
|
-
|
|
3342
|
+
Effect4.flatMap(
|
|
3283
3343
|
(address) => getUtxosEffect(
|
|
3284
3344
|
this.baseUrl,
|
|
3285
3345
|
address.payment_address,
|
|
3286
3346
|
bearerToken
|
|
3287
3347
|
)
|
|
3288
3348
|
),
|
|
3289
|
-
|
|
3349
|
+
Effect4.map(
|
|
3290
3350
|
(utxos) => utxos.filter((utxo) => {
|
|
3291
3351
|
const keys = Object.keys(utxo.assets);
|
|
3292
3352
|
return keys.length > 0 && keys.includes(unit);
|
|
3293
3353
|
})
|
|
3294
3354
|
),
|
|
3295
|
-
|
|
3296
|
-
(utxos) => utxos.length > 1 ?
|
|
3355
|
+
Effect4.flatMap(
|
|
3356
|
+
(utxos) => utxos.length > 1 ? Effect4.fail("Unit needs to be an NFT or only held by one address.") : Effect4.succeed(utxos[0])
|
|
3297
3357
|
),
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3358
|
+
Effect4.timeout(1e4),
|
|
3359
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3360
|
+
Effect4.runPromise
|
|
3301
3361
|
);
|
|
3302
3362
|
return result;
|
|
3303
3363
|
}
|
|
@@ -3308,15 +3368,15 @@ var Koios = class {
|
|
|
3308
3368
|
_assets: true,
|
|
3309
3369
|
_scripts: true
|
|
3310
3370
|
};
|
|
3311
|
-
const schema =
|
|
3371
|
+
const schema = S5.Array(TxInfoSchema);
|
|
3312
3372
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3313
|
-
const [result] = await (0,
|
|
3373
|
+
const [result] = await (0, import_Function5.pipe)(
|
|
3314
3374
|
makePostAsJson(url, body, schema, bearerToken),
|
|
3315
3375
|
// Allows for dependency injection and easier testing
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3376
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3377
|
+
Effect4.timeout(1e4),
|
|
3378
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3379
|
+
Effect4.runPromise
|
|
3320
3380
|
);
|
|
3321
3381
|
if (result) {
|
|
3322
3382
|
const utxos = result.outputs.map(
|
|
@@ -3350,18 +3410,18 @@ var Koios = class {
|
|
|
3350
3410
|
};
|
|
3351
3411
|
const url = `${this.baseUrl}/account_info`;
|
|
3352
3412
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3353
|
-
const result = await (0,
|
|
3413
|
+
const result = await (0, import_Function5.pipe)(
|
|
3354
3414
|
makePostAsJson(
|
|
3355
3415
|
url,
|
|
3356
3416
|
body,
|
|
3357
|
-
|
|
3417
|
+
S5.Array(AccountInfoSchema),
|
|
3358
3418
|
bearerToken
|
|
3359
3419
|
),
|
|
3360
3420
|
// Allows for dependency injection and easier testing
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3421
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3422
|
+
Effect4.timeout(1e4),
|
|
3423
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3424
|
+
Effect4.runPromise
|
|
3365
3425
|
);
|
|
3366
3426
|
const account = result[0];
|
|
3367
3427
|
if (!account) {
|
|
@@ -3383,21 +3443,21 @@ var Koios = class {
|
|
|
3383
3443
|
_datum_hashes: [datumHash]
|
|
3384
3444
|
};
|
|
3385
3445
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3386
|
-
const result = await (0,
|
|
3446
|
+
const result = await (0, import_Function5.pipe)(
|
|
3387
3447
|
makePostAsJson(
|
|
3388
3448
|
url,
|
|
3389
3449
|
body,
|
|
3390
|
-
|
|
3450
|
+
S5.Array(DatumInfo),
|
|
3391
3451
|
bearerToken
|
|
3392
3452
|
),
|
|
3393
3453
|
// Allows for dependency injection and easier testing
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
(result2) => result2.length === 0 ?
|
|
3454
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3455
|
+
Effect4.flatMap(
|
|
3456
|
+
(result2) => result2.length === 0 ? Effect4.fail("No Datum Found by Datum Hash") : Effect4.succeed(result2[0])
|
|
3397
3457
|
),
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3458
|
+
Effect4.timeout(1e4),
|
|
3459
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3460
|
+
Effect4.runPromise
|
|
3401
3461
|
);
|
|
3402
3462
|
return result.bytes;
|
|
3403
3463
|
}
|
|
@@ -3406,20 +3466,20 @@ var Koios = class {
|
|
|
3406
3466
|
const body = {
|
|
3407
3467
|
_tx_hashes: [txHash]
|
|
3408
3468
|
};
|
|
3409
|
-
const schema =
|
|
3469
|
+
const schema = S5.Array(TxInfoSchema);
|
|
3410
3470
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3411
|
-
const result = await (0,
|
|
3471
|
+
const result = await (0, import_Function5.pipe)(
|
|
3412
3472
|
makePostAsJson(url, body, schema, bearerToken),
|
|
3413
|
-
|
|
3414
|
-
schedule:
|
|
3473
|
+
Effect4.repeat({
|
|
3474
|
+
schedule: Schedule2.exponential(checkInterval),
|
|
3415
3475
|
until: (result2) => result2.length > 0
|
|
3416
3476
|
}),
|
|
3417
3477
|
// Allows for dependency injection and easier testing
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3478
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3479
|
+
Effect4.timeout(16e4),
|
|
3480
|
+
Effect4.orDie,
|
|
3481
|
+
Effect4.as(true),
|
|
3482
|
+
Effect4.runPromise
|
|
3423
3483
|
);
|
|
3424
3484
|
return result;
|
|
3425
3485
|
}
|
|
@@ -3439,7 +3499,7 @@ var Koios = class {
|
|
|
3439
3499
|
`Could not fetch transaction status from Koios. Received status code: ${response.status}`
|
|
3440
3500
|
);
|
|
3441
3501
|
}
|
|
3442
|
-
const result =
|
|
3502
|
+
const result = S5.decodeUnknownSync(S5.Array(TxStatusSchema))(
|
|
3443
3503
|
await response.json()
|
|
3444
3504
|
);
|
|
3445
3505
|
const status = result[0];
|
|
@@ -3460,13 +3520,13 @@ var Koios = class {
|
|
|
3460
3520
|
const body = (0, import_core_utils3.fromHex)(tx);
|
|
3461
3521
|
const schema = TxHashSchema;
|
|
3462
3522
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3463
|
-
const result = await (0,
|
|
3523
|
+
const result = await (0, import_Function5.pipe)(
|
|
3464
3524
|
makePostAsUint8Array(url, body, schema, bearerToken),
|
|
3465
3525
|
// Allows for dependency injection and easier testing
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3526
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3527
|
+
Effect4.timeout(1e4),
|
|
3528
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3529
|
+
Effect4.runPromise
|
|
3470
3530
|
);
|
|
3471
3531
|
return result;
|
|
3472
3532
|
}
|
|
@@ -3481,15 +3541,15 @@ var Koios = class {
|
|
|
3481
3541
|
},
|
|
3482
3542
|
id: null
|
|
3483
3543
|
};
|
|
3484
|
-
const schema = JSONRPCSchema(
|
|
3544
|
+
const schema = JSONRPCSchema(S5.Array(RedeemerSchema));
|
|
3485
3545
|
const bearerToken = this.token ? { Authorization: `Bearer ${this.token}` } : void 0;
|
|
3486
|
-
const { result } = await (0,
|
|
3546
|
+
const { result } = await (0, import_Function5.pipe)(
|
|
3487
3547
|
makePostAsJson(url, body, schema, bearerToken),
|
|
3488
3548
|
// Allows for dependency injection and easier testing
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3549
|
+
Effect4.provide(FetchHttpClient3.layer),
|
|
3550
|
+
Effect4.timeout(1e4),
|
|
3551
|
+
Effect4.catchAllCause((cause) => new KoiosError({ cause })),
|
|
3552
|
+
Effect4.runPromise
|
|
3493
3553
|
);
|
|
3494
3554
|
const evalRedeemers = result.map((item) => ({
|
|
3495
3555
|
ex_units: {
|