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