@lucid-evolution/provider 0.1.45 → 0.1.47
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 +639 -687
- package/dist/index.d.cts +12 -53
- package/dist/index.d.ts +12 -53
- package/dist/index.js +627 -677
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -32,27 +32,27 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
Blockfrost: () => Blockfrost,
|
|
34
34
|
Emulator: () => Emulator,
|
|
35
|
-
FetchProvider: () => fetch_exports,
|
|
36
35
|
Koios: () => Koios,
|
|
36
|
+
KoiosError: () => KoiosError,
|
|
37
37
|
Kupmios: () => Kupmios,
|
|
38
38
|
KupmiosError: () => KupmiosError,
|
|
39
39
|
Maestro: () => Maestro,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
generateEmulatorAccount: () => generateEmulatorAccount,
|
|
41
|
+
generateEmulatorAccountFrommPrivateKey: () => generateEmulatorAccountFrommPrivateKey
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(src_exports);
|
|
44
44
|
|
|
45
45
|
// src/core.ts
|
|
46
46
|
var CML = __toESM(require("@anastasia-labs/cardano-multiplatform-lib-nodejs"), 1);
|
|
47
47
|
|
|
48
|
-
// src/blockfrost
|
|
48
|
+
// src/blockfrost.ts
|
|
49
49
|
var import_core_utils = require("@lucid-evolution/core-utils");
|
|
50
50
|
var import_utils = require("@lucid-evolution/utils");
|
|
51
51
|
|
|
52
52
|
// package.json
|
|
53
53
|
var package_default = {
|
|
54
54
|
name: "@lucid-evolution/provider",
|
|
55
|
-
version: "0.1.
|
|
55
|
+
version: "0.1.47",
|
|
56
56
|
description: "",
|
|
57
57
|
main: "./dist/index.js",
|
|
58
58
|
types: "./dist/index.d.ts",
|
|
@@ -100,8 +100,48 @@ var package_default = {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
// src/
|
|
103
|
+
// src/internal/blockfrost.ts
|
|
104
104
|
var import_effect = require("effect");
|
|
105
|
+
var toAditionalUTXOs = (utxos) => (utxos || []).map((utxo) => [
|
|
106
|
+
{
|
|
107
|
+
txId: utxo.txHash,
|
|
108
|
+
index: utxo.outputIndex
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
address: utxo.address,
|
|
112
|
+
value: {
|
|
113
|
+
coins: Number(utxo.assets["lovelace"]),
|
|
114
|
+
assets: fromAssets(utxo.assets)
|
|
115
|
+
},
|
|
116
|
+
datumHash: utxo.datumHash,
|
|
117
|
+
datum: utxo.datum,
|
|
118
|
+
script: toTxOutScript(utxo.scriptRef)
|
|
119
|
+
}
|
|
120
|
+
]);
|
|
121
|
+
var toTxOutScript = (scriptRef) => {
|
|
122
|
+
if (scriptRef) {
|
|
123
|
+
switch (scriptRef.type) {
|
|
124
|
+
case "PlutusV1":
|
|
125
|
+
return { "plutus:v1": scriptRef.script };
|
|
126
|
+
case "PlutusV2":
|
|
127
|
+
return { "plutus:v2": scriptRef.script };
|
|
128
|
+
case "PlutusV3":
|
|
129
|
+
return { "plutus:v3": scriptRef.script };
|
|
130
|
+
default:
|
|
131
|
+
return void 0;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var fromAssets = (assets) => (0, import_effect.pipe)(
|
|
136
|
+
import_effect.Record.remove(assets, "lovelace"),
|
|
137
|
+
import_effect.Record.mapEntries((amount, unit) => [
|
|
138
|
+
unit.length === 56 ? unit.slice(0, 56) : unit.slice(0, 56) + "." + unit.slice(56),
|
|
139
|
+
Number(amount)
|
|
140
|
+
]),
|
|
141
|
+
(r) => import_effect.Record.isEmptyRecord(r) ? void 0 : r
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// src/blockfrost.ts
|
|
105
145
|
var Blockfrost = class {
|
|
106
146
|
url;
|
|
107
147
|
projectId;
|
|
@@ -379,42 +419,6 @@ var Blockfrost = class {
|
|
|
379
419
|
return evalRedeemers;
|
|
380
420
|
}
|
|
381
421
|
};
|
|
382
|
-
function datumJsonToCbor(json) {
|
|
383
|
-
const convert = (json2) => {
|
|
384
|
-
if (!isNaN(json2.int)) {
|
|
385
|
-
return CML.PlutusData.new_integer(
|
|
386
|
-
CML.BigInteger.from_str(json2.int.toString())
|
|
387
|
-
);
|
|
388
|
-
} else if (json2.bytes || !isNaN(Number(json2.bytes))) {
|
|
389
|
-
return CML.PlutusData.new_bytes((0, import_core_utils.fromHex)(json2.bytes));
|
|
390
|
-
} else if (json2.map) {
|
|
391
|
-
const m = CML.PlutusMap.new();
|
|
392
|
-
json2.map.forEach(({ k, v }) => {
|
|
393
|
-
m.set(convert(k), convert(v));
|
|
394
|
-
});
|
|
395
|
-
return CML.PlutusData.new_map(m);
|
|
396
|
-
} else if (json2.list) {
|
|
397
|
-
const l = CML.PlutusDataList.new();
|
|
398
|
-
json2.list.forEach((v) => {
|
|
399
|
-
l.add(convert(v));
|
|
400
|
-
});
|
|
401
|
-
return CML.PlutusData.new_list(l);
|
|
402
|
-
} else if (!isNaN(json2.constructor)) {
|
|
403
|
-
const l = CML.PlutusDataList.new();
|
|
404
|
-
json2.fields.forEach((v) => {
|
|
405
|
-
l.add(convert(v));
|
|
406
|
-
});
|
|
407
|
-
return CML.PlutusData.new_constr_plutus_data(
|
|
408
|
-
CML.ConstrPlutusData.new(
|
|
409
|
-
CML.BigInteger.from_str(json2.constructor.toString()).as_u64(),
|
|
410
|
-
l
|
|
411
|
-
)
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
throw new Error("Unsupported type");
|
|
415
|
-
};
|
|
416
|
-
return convert(json).to_cbor_hex();
|
|
417
|
-
}
|
|
418
422
|
var handleRateLimit = async (count) => {
|
|
419
423
|
if (count % 100 === 0) {
|
|
420
424
|
await (0, import_core_utils.sleep)(5e3);
|
|
@@ -423,52 +427,17 @@ var handleRateLimit = async (count) => {
|
|
|
423
427
|
}
|
|
424
428
|
};
|
|
425
429
|
var lucid = package_default.version;
|
|
426
|
-
var toAditionalUTXOs = (utxos) => (utxos || []).map((utxo) => [
|
|
427
|
-
{
|
|
428
|
-
txId: utxo.txHash,
|
|
429
|
-
index: utxo.outputIndex
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
address: utxo.address,
|
|
433
|
-
value: {
|
|
434
|
-
coins: Number(utxo.assets["lovelace"]),
|
|
435
|
-
assets: fromAssets(utxo.assets)
|
|
436
|
-
},
|
|
437
|
-
datumHash: utxo.datumHash,
|
|
438
|
-
datum: utxo.datum,
|
|
439
|
-
script: toTxOutScript(utxo.scriptRef)
|
|
440
|
-
}
|
|
441
|
-
]);
|
|
442
|
-
var toTxOutScript = (scriptRef) => {
|
|
443
|
-
if (scriptRef) {
|
|
444
|
-
switch (scriptRef.type) {
|
|
445
|
-
case "PlutusV1":
|
|
446
|
-
return { "plutus:v1": scriptRef.script };
|
|
447
|
-
case "PlutusV2":
|
|
448
|
-
return { "plutus:v2": scriptRef.script };
|
|
449
|
-
case "PlutusV3":
|
|
450
|
-
return { "plutus:v3": scriptRef.script };
|
|
451
|
-
default:
|
|
452
|
-
return void 0;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
var fromAssets = (assets) => (0, import_effect.pipe)(
|
|
457
|
-
import_effect.Record.remove(assets, "lovelace"),
|
|
458
|
-
import_effect.Record.mapEntries((amount, unit) => [
|
|
459
|
-
unit.length === 56 ? unit.slice(0, 56) : unit.slice(0, 56) + "." + unit.slice(56),
|
|
460
|
-
Number(amount)
|
|
461
|
-
]),
|
|
462
|
-
(r) => import_effect.Record.isEmptyRecord(r) ? void 0 : r
|
|
463
|
-
);
|
|
464
430
|
|
|
465
|
-
// src/kupmios
|
|
466
|
-
var
|
|
467
|
-
var
|
|
431
|
+
// src/kupmios.ts
|
|
432
|
+
var import_utils3 = require("@lucid-evolution/utils");
|
|
433
|
+
var S3 = __toESM(require("@effect/schema/Schema"), 1);
|
|
468
434
|
var import_effect2 = require("effect");
|
|
435
|
+
var import_platform = require("@effect/platform");
|
|
436
|
+
var import_schema = require("@effect/schema");
|
|
469
437
|
|
|
470
|
-
// src/
|
|
438
|
+
// src/internal/ogmios.ts
|
|
471
439
|
var S = __toESM(require("@effect/schema/Schema"), 1);
|
|
440
|
+
var import_utils2 = require("@lucid-evolution/utils");
|
|
472
441
|
var JSONRPCSchema = (schema) => S.extend(
|
|
473
442
|
S.Struct({
|
|
474
443
|
jsonrpc: S.String,
|
|
@@ -564,59 +533,118 @@ var ProtocolParametersSchema = S.Struct({
|
|
|
564
533
|
maxCollateralInputs: S.Number,
|
|
565
534
|
version: S.Struct({ major: S.Number, minor: S.Number })
|
|
566
535
|
});
|
|
567
|
-
var
|
|
568
|
-
|
|
569
|
-
|
|
536
|
+
var Delegation = S.NullOr(
|
|
537
|
+
S.Record(
|
|
538
|
+
S.String,
|
|
539
|
+
S.Struct({
|
|
540
|
+
delegate: S.Struct({ id: S.String }),
|
|
541
|
+
rewards: S.Struct({ ada: S.Struct({ lovelace: S.Number }) }),
|
|
542
|
+
deposit: S.Struct({ ada: S.Struct({ lovelace: S.Number }) })
|
|
543
|
+
})
|
|
544
|
+
)
|
|
545
|
+
);
|
|
546
|
+
var RedeemerSchema = S.Struct({
|
|
547
|
+
validator: S.Struct({
|
|
548
|
+
purpose: S.String,
|
|
549
|
+
index: S.Int
|
|
550
|
+
}),
|
|
551
|
+
budget: S.Struct({
|
|
552
|
+
memory: S.Int,
|
|
553
|
+
cpu: S.Int
|
|
554
|
+
})
|
|
570
555
|
});
|
|
571
|
-
var
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
556
|
+
var toOgmiosUTxOs = (utxos) => {
|
|
557
|
+
const toOgmiosScript = (scriptRef) => {
|
|
558
|
+
if (scriptRef) {
|
|
559
|
+
switch (scriptRef.type) {
|
|
560
|
+
case "PlutusV1":
|
|
561
|
+
return { language: "plutus:v1", cbor: scriptRef.script };
|
|
562
|
+
case "PlutusV2":
|
|
563
|
+
return { language: "plutus:v2", cbor: scriptRef.script };
|
|
564
|
+
case "PlutusV3":
|
|
565
|
+
return { language: "plutus:v3", cbor: scriptRef.script };
|
|
566
|
+
default:
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
const toOgmiosAssets = (assets) => {
|
|
572
|
+
const newAssets = {};
|
|
573
|
+
Object.entries(assets).map(([unit, amount]) => {
|
|
574
|
+
if (unit == "lovelace") return;
|
|
575
|
+
const { policyId, assetName } = (0, import_utils2.fromUnit)(unit);
|
|
576
|
+
newAssets[policyId][assetName ? assetName : ""] = Number(amount);
|
|
577
|
+
});
|
|
578
|
+
return newAssets;
|
|
579
|
+
};
|
|
580
|
+
return (utxos || []).map(
|
|
581
|
+
(utxo) => ({
|
|
582
|
+
transaction: {
|
|
583
|
+
id: utxo.txHash
|
|
584
|
+
},
|
|
585
|
+
index: utxo.outputIndex,
|
|
586
|
+
address: utxo.address,
|
|
587
|
+
value: {
|
|
588
|
+
ada: { lovelace: Number(utxo.assets["lovelace"]) },
|
|
589
|
+
...toOgmiosAssets(utxo.assets)
|
|
590
|
+
},
|
|
591
|
+
datumHash: utxo.datumHash,
|
|
592
|
+
datum: utxo.datum,
|
|
593
|
+
script: toOgmiosScript(utxo.scriptRef)
|
|
594
|
+
})
|
|
595
|
+
);
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
// src/internal/kupo.ts
|
|
599
|
+
var S2 = __toESM(require("@effect/schema/Schema"), 1);
|
|
600
|
+
var ValueSchema = S2.Struct({
|
|
601
|
+
coins: S2.Number,
|
|
602
|
+
assets: S2.Record(S2.String, S2.Number)
|
|
603
|
+
});
|
|
604
|
+
var UTxOSchema = S2.Struct({
|
|
605
|
+
transaction_index: S2.Number,
|
|
606
|
+
transaction_id: S2.String,
|
|
607
|
+
output_index: S2.Number,
|
|
608
|
+
address: S2.String,
|
|
609
|
+
value: ValueSchema,
|
|
610
|
+
datum_hash: S2.NullOr(S2.String),
|
|
611
|
+
datum_type: S2.optional(S2.Literal("hash", "inline")),
|
|
612
|
+
script_hash: S2.NullOr(S2.String),
|
|
613
|
+
created_at: S2.Struct({
|
|
614
|
+
slot_no: S2.Number,
|
|
615
|
+
header_hash: S2.String
|
|
583
616
|
}),
|
|
584
|
-
spent_at:
|
|
585
|
-
|
|
586
|
-
slot_no:
|
|
587
|
-
header_hash:
|
|
617
|
+
spent_at: S2.NullOr(
|
|
618
|
+
S2.Struct({
|
|
619
|
+
slot_no: S2.Number,
|
|
620
|
+
header_hash: S2.String
|
|
588
621
|
})
|
|
589
622
|
)
|
|
590
623
|
});
|
|
591
|
-
var
|
|
592
|
-
|
|
593
|
-
language:
|
|
594
|
-
script:
|
|
624
|
+
var ScriptSchema = S2.NullOr(
|
|
625
|
+
S2.Struct({
|
|
626
|
+
language: S2.Literal("native", "plutus:v1", "plutus:v2", "plutus:v3"),
|
|
627
|
+
script: S2.String
|
|
595
628
|
})
|
|
596
629
|
);
|
|
597
|
-
var
|
|
598
|
-
var
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
delegate:
|
|
603
|
-
rewards:
|
|
604
|
-
deposit:
|
|
630
|
+
var DatumSchema = S2.NullOr(S2.Struct({ datum: S2.String }));
|
|
631
|
+
var DelegationSchema = S2.NullOr(
|
|
632
|
+
S2.Record(
|
|
633
|
+
S2.String,
|
|
634
|
+
S2.Struct({
|
|
635
|
+
delegate: S2.Struct({ id: S2.String }),
|
|
636
|
+
rewards: S2.Struct({ ada: S2.Struct({ lovelace: S2.Number }) }),
|
|
637
|
+
deposit: S2.Struct({ ada: S2.Struct({ lovelace: S2.Number }) })
|
|
605
638
|
})
|
|
606
639
|
)
|
|
607
640
|
);
|
|
608
641
|
|
|
609
|
-
// src/kupmios
|
|
610
|
-
var import_platform = require("@effect/platform");
|
|
611
|
-
var import_schema = require("@effect/schema");
|
|
642
|
+
// src/kupmios.ts
|
|
612
643
|
var KupmiosError = class extends import_effect2.Data.TaggedError("KupmiosError") {
|
|
613
644
|
get message() {
|
|
614
|
-
return `${this.cause}`;
|
|
645
|
+
return `${JSON.stringify(this.cause)}`;
|
|
615
646
|
}
|
|
616
647
|
};
|
|
617
|
-
var kupmiosError = (cause) => new KupmiosError({
|
|
618
|
-
cause: JSON.stringify(cause)
|
|
619
|
-
});
|
|
620
648
|
var Kupmios = class {
|
|
621
649
|
kupoUrl;
|
|
622
650
|
ogmiosUrl;
|
|
@@ -635,15 +663,13 @@ var Kupmios = class {
|
|
|
635
663
|
params: {},
|
|
636
664
|
id: null
|
|
637
665
|
};
|
|
638
|
-
const schema = JSONRPCSchema(
|
|
639
|
-
ProtocolParametersSchema
|
|
640
|
-
);
|
|
666
|
+
const schema = JSONRPCSchema(ProtocolParametersSchema);
|
|
641
667
|
const program = fetchOgmiosParse(this.ogmiosUrl, data, schema).pipe(
|
|
642
668
|
import_effect2.Effect.flatMap(
|
|
643
|
-
(response) => "error" in response ?
|
|
669
|
+
(response) => "error" in response ? import_effect2.Effect.fail(response) : import_effect2.Effect.succeed(response.result)
|
|
644
670
|
),
|
|
645
671
|
import_effect2.Effect.timeout(1e4),
|
|
646
|
-
import_effect2.Effect.catchAll(
|
|
672
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
647
673
|
);
|
|
648
674
|
const result = await import_effect2.Effect.runPromise(program);
|
|
649
675
|
return toProtocolParameters(result);
|
|
@@ -652,11 +678,11 @@ var Kupmios = class {
|
|
|
652
678
|
const isAddress = typeof addressOrCredential === "string";
|
|
653
679
|
const queryPredicate = isAddress ? addressOrCredential : addressOrCredential.hash;
|
|
654
680
|
const pattern = `${this.kupoUrl}/matches/${queryPredicate}${isAddress ? "" : "/*"}?unspent`;
|
|
655
|
-
const schema =
|
|
681
|
+
const schema = S3.Array(UTxOSchema);
|
|
656
682
|
const program = fetchKupoParse(pattern, schema).pipe(
|
|
657
683
|
import_effect2.Effect.flatMap((u) => kupmiosUtxosToUtxos(this.kupoUrl, u)),
|
|
658
684
|
import_effect2.Effect.timeout(1e4),
|
|
659
|
-
import_effect2.Effect.catchAll(
|
|
685
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
660
686
|
);
|
|
661
687
|
const utxos = await import_effect2.Effect.runPromise(program);
|
|
662
688
|
return utxos;
|
|
@@ -664,25 +690,25 @@ var Kupmios = class {
|
|
|
664
690
|
async getUtxosWithUnit(addressOrCredential, unit) {
|
|
665
691
|
const isAddress = typeof addressOrCredential === "string";
|
|
666
692
|
const queryPredicate = isAddress ? addressOrCredential : addressOrCredential.hash;
|
|
667
|
-
const { policyId, assetName } = (0,
|
|
693
|
+
const { policyId, assetName } = (0, import_utils3.fromUnit)(unit);
|
|
668
694
|
const pattern = `${this.kupoUrl}/matches/${queryPredicate}${isAddress ? "" : "/*"}?unspent&policy_id=${policyId}${assetName ? `&asset_name=${assetName}` : ""}`;
|
|
669
|
-
const schema =
|
|
695
|
+
const schema = S3.Array(UTxOSchema);
|
|
670
696
|
const program = fetchKupoParse(pattern, schema).pipe(
|
|
671
697
|
import_effect2.Effect.flatMap((u) => kupmiosUtxosToUtxos(this.kupoUrl, u)),
|
|
672
698
|
import_effect2.Effect.timeout(1e4),
|
|
673
|
-
import_effect2.Effect.catchAll(
|
|
699
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
674
700
|
);
|
|
675
701
|
const utxos = await import_effect2.Effect.runPromise(program);
|
|
676
702
|
return utxos;
|
|
677
703
|
}
|
|
678
704
|
async getUtxoByUnit(unit) {
|
|
679
|
-
const { policyId, assetName } = (0,
|
|
705
|
+
const { policyId, assetName } = (0, import_utils3.fromUnit)(unit);
|
|
680
706
|
const pattern = `${this.kupoUrl}/matches/${policyId}.${assetName ? `${assetName}` : "*"}?unspent`;
|
|
681
|
-
const schema =
|
|
707
|
+
const schema = S3.Array(UTxOSchema);
|
|
682
708
|
const program = fetchKupoParse(pattern, schema).pipe(
|
|
683
709
|
import_effect2.Effect.flatMap((u) => kupmiosUtxosToUtxos(this.kupoUrl, u)),
|
|
684
710
|
import_effect2.Effect.timeout(1e4),
|
|
685
|
-
import_effect2.Effect.catchAll(
|
|
711
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
686
712
|
);
|
|
687
713
|
const utxos = await import_effect2.Effect.runPromise(program);
|
|
688
714
|
if (utxos.length > 1) {
|
|
@@ -695,13 +721,13 @@ var Kupmios = class {
|
|
|
695
721
|
...new Set(outRefs.map((outRef) => outRef.txHash))
|
|
696
722
|
];
|
|
697
723
|
const mkPattern = (txHash) => `${this.kupoUrl}/matches/*@${txHash}?unspent`;
|
|
698
|
-
const schema =
|
|
724
|
+
const schema = S3.Array(UTxOSchema);
|
|
699
725
|
const program = import_effect2.Effect.forEach(
|
|
700
726
|
queryHashes,
|
|
701
727
|
(txHash) => fetchKupoParse(mkPattern(txHash), schema).pipe(
|
|
702
728
|
import_effect2.Effect.flatMap((u) => kupmiosUtxosToUtxos(this.kupoUrl, u)),
|
|
703
729
|
import_effect2.Effect.timeout(1e4),
|
|
704
|
-
import_effect2.Effect.catchAll(
|
|
730
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
705
731
|
)
|
|
706
732
|
);
|
|
707
733
|
const utxos = await import_effect2.Effect.runPromise(program);
|
|
@@ -718,13 +744,13 @@ var Kupmios = class {
|
|
|
718
744
|
params: { keys: [rewardAddress] },
|
|
719
745
|
id: null
|
|
720
746
|
};
|
|
721
|
-
const schema = JSONRPCSchema(
|
|
747
|
+
const schema = JSONRPCSchema(Delegation);
|
|
722
748
|
const program = fetchOgmiosParse(this.ogmiosUrl, data, schema).pipe(
|
|
723
749
|
import_effect2.Effect.flatMap(
|
|
724
|
-
(response) => "error" in response ?
|
|
750
|
+
(response) => "error" in response ? import_effect2.Effect.fail(response) : import_effect2.Effect.succeed(response.result)
|
|
725
751
|
),
|
|
726
752
|
import_effect2.Effect.timeout(1e4),
|
|
727
|
-
import_effect2.Effect.catchAll(
|
|
753
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
728
754
|
);
|
|
729
755
|
const result = await import_effect2.Effect.runPromise(program);
|
|
730
756
|
const delegation = result ? Object.values(result)[0] : null;
|
|
@@ -735,18 +761,18 @@ var Kupmios = class {
|
|
|
735
761
|
}
|
|
736
762
|
async getDatum(datumHash) {
|
|
737
763
|
const pattern = `${this.kupoUrl}/datums/${datumHash}`;
|
|
738
|
-
const schema =
|
|
764
|
+
const schema = DatumSchema;
|
|
739
765
|
const program = fetchKupoParse(pattern, schema).pipe(
|
|
740
766
|
import_effect2.Effect.timeout(1e4),
|
|
741
767
|
import_effect2.Effect.flatMap(import_effect2.Effect.fromNullable),
|
|
742
|
-
import_effect2.Effect.catchAll(
|
|
768
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
743
769
|
);
|
|
744
770
|
const result = await import_effect2.Effect.runPromise(program);
|
|
745
771
|
return result.datum;
|
|
746
772
|
}
|
|
747
773
|
async awaitTx(txHash, checkInterval = 2e4) {
|
|
748
774
|
const pattern = `${this.kupoUrl}/matches/*@${txHash}`;
|
|
749
|
-
const schema =
|
|
775
|
+
const schema = S3.Array(UTxOSchema).annotations({
|
|
750
776
|
identifier: "Array<KupmiosSchema.KupoUTxO>"
|
|
751
777
|
});
|
|
752
778
|
const program = fetchKupoParse(pattern, schema).pipe(
|
|
@@ -755,7 +781,7 @@ var Kupmios = class {
|
|
|
755
781
|
until: (result) => result.length > 0
|
|
756
782
|
}),
|
|
757
783
|
import_effect2.Effect.timeout(16e4),
|
|
758
|
-
import_effect2.Effect.catchAll(
|
|
784
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause })),
|
|
759
785
|
import_effect2.Effect.as(true)
|
|
760
786
|
);
|
|
761
787
|
return await import_effect2.Effect.runPromise(program);
|
|
@@ -770,70 +796,39 @@ var Kupmios = class {
|
|
|
770
796
|
id: null
|
|
771
797
|
};
|
|
772
798
|
const schema = JSONRPCSchema(
|
|
773
|
-
|
|
774
|
-
transaction:
|
|
775
|
-
id:
|
|
799
|
+
S3.Struct({
|
|
800
|
+
transaction: S3.Struct({
|
|
801
|
+
id: S3.String
|
|
776
802
|
})
|
|
777
803
|
})
|
|
778
804
|
);
|
|
779
805
|
const program = fetchOgmiosParse(this.ogmiosUrl, data, schema).pipe(
|
|
780
806
|
import_effect2.Effect.flatMap(
|
|
781
|
-
(response) => "error" in response ? import_effect2.Effect.fail(response
|
|
807
|
+
(response) => "error" in response ? import_effect2.Effect.fail(response) : import_effect2.Effect.succeed(response)
|
|
782
808
|
),
|
|
783
809
|
import_effect2.Effect.timeout(1e4),
|
|
784
|
-
import_effect2.Effect.catchAll(
|
|
810
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
785
811
|
);
|
|
786
812
|
const { result } = await import_effect2.Effect.runPromise(program);
|
|
787
813
|
return result.transaction.id;
|
|
788
814
|
}
|
|
789
815
|
async evaluateTx(tx, additionalUTxOs) {
|
|
790
|
-
const utxos = (additionalUTxOs || []).map((utxo) => {
|
|
791
|
-
const script = utxo.scriptRef ? {
|
|
792
|
-
language: utxo.scriptRef.type,
|
|
793
|
-
cbor: utxo.scriptRef.script
|
|
794
|
-
} : void 0;
|
|
795
|
-
return [
|
|
796
|
-
{
|
|
797
|
-
transaction: { id: utxo.txHash, output: { index: utxo.outputIndex } }
|
|
798
|
-
},
|
|
799
|
-
{
|
|
800
|
-
address: utxo.address,
|
|
801
|
-
value: {
|
|
802
|
-
coins: utxo.assets.lovelace,
|
|
803
|
-
assets: utxo.assets.restAssets
|
|
804
|
-
},
|
|
805
|
-
datumHash: utxo.datumHash,
|
|
806
|
-
datum: utxo.datum,
|
|
807
|
-
script
|
|
808
|
-
}
|
|
809
|
-
];
|
|
810
|
-
});
|
|
811
816
|
const data = {
|
|
812
817
|
jsonrpc: "2.0",
|
|
813
818
|
method: "evaluateTransaction",
|
|
814
|
-
params: {
|
|
819
|
+
params: {
|
|
820
|
+
transaction: { cbor: tx },
|
|
821
|
+
additionalUtxo: toOgmiosUTxOs(additionalUTxOs)
|
|
822
|
+
},
|
|
815
823
|
id: null
|
|
816
824
|
};
|
|
817
|
-
const schema = JSONRPCSchema(
|
|
818
|
-
S2.Array(
|
|
819
|
-
S2.Struct({
|
|
820
|
-
validator: S2.Struct({
|
|
821
|
-
purpose: S2.String,
|
|
822
|
-
index: S2.Int
|
|
823
|
-
}),
|
|
824
|
-
budget: S2.Struct({
|
|
825
|
-
memory: S2.Int,
|
|
826
|
-
cpu: S2.Int
|
|
827
|
-
})
|
|
828
|
-
})
|
|
829
|
-
)
|
|
830
|
-
);
|
|
825
|
+
const schema = JSONRPCSchema(S3.Array(RedeemerSchema));
|
|
831
826
|
const program = fetchOgmiosParse(this.ogmiosUrl, data, schema).pipe(
|
|
832
827
|
import_effect2.Effect.flatMap(
|
|
833
|
-
(response) => "error" in response ?
|
|
828
|
+
(response) => "error" in response ? import_effect2.Effect.fail(response) : import_effect2.Effect.succeed(response.result)
|
|
834
829
|
),
|
|
835
830
|
import_effect2.Effect.timeout(1e4),
|
|
836
|
-
import_effect2.Effect.catchAll(
|
|
831
|
+
import_effect2.Effect.catchAll((cause) => new KupmiosError({ cause }))
|
|
837
832
|
);
|
|
838
833
|
const result = await import_effect2.Effect.runPromise(program);
|
|
839
834
|
const evalRedeemers = result.map((item) => ({
|
|
@@ -850,7 +845,7 @@ var Kupmios = class {
|
|
|
850
845
|
var getDatumEffect = (kupoUrl, datum_type, datum_hash) => import_effect2.Effect.gen(function* () {
|
|
851
846
|
if (datum_type === "inline" && datum_hash) {
|
|
852
847
|
const pattern = `${kupoUrl}/datums/${datum_hash}`;
|
|
853
|
-
const schema =
|
|
848
|
+
const schema = DatumSchema;
|
|
854
849
|
return yield* fetchKupoParse(pattern, schema).pipe(
|
|
855
850
|
import_effect2.Effect.flatMap(import_effect2.Effect.fromNullable),
|
|
856
851
|
import_effect2.Effect.map((result) => result.datum),
|
|
@@ -861,7 +856,7 @@ var getDatumEffect = (kupoUrl, datum_type, datum_hash) => import_effect2.Effect.
|
|
|
861
856
|
var getScriptEffect = (kupoUrl, script_hash) => import_effect2.Effect.gen(function* () {
|
|
862
857
|
if (script_hash) {
|
|
863
858
|
const pattern = `${kupoUrl}/scripts/${script_hash}`;
|
|
864
|
-
const schema =
|
|
859
|
+
const schema = ScriptSchema;
|
|
865
860
|
return yield* (0, import_effect2.pipe)(
|
|
866
861
|
fetchKupoParse(pattern, schema),
|
|
867
862
|
import_effect2.Effect.flatMap(import_effect2.Effect.fromNullable),
|
|
@@ -873,12 +868,17 @@ var getScriptEffect = (kupoUrl, script_hash) => import_effect2.Effect.gen(functi
|
|
|
873
868
|
case "plutus:v1":
|
|
874
869
|
return {
|
|
875
870
|
type: "PlutusV1",
|
|
876
|
-
script: (0,
|
|
871
|
+
script: (0, import_utils3.applyDoubleCborEncoding)(script)
|
|
877
872
|
};
|
|
878
873
|
case "plutus:v2":
|
|
879
874
|
return {
|
|
880
875
|
type: "PlutusV2",
|
|
881
|
-
script: (0,
|
|
876
|
+
script: (0, import_utils3.applyDoubleCborEncoding)(script)
|
|
877
|
+
};
|
|
878
|
+
case "plutus:v3":
|
|
879
|
+
return {
|
|
880
|
+
type: "PlutusV3",
|
|
881
|
+
script: (0, import_utils3.applyDoubleCborEncoding)(script)
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
884
|
})
|
|
@@ -939,9 +939,7 @@ var fetchOgmiosParse = (url, data, schema) => (0, import_effect2.pipe)(
|
|
|
939
939
|
import_platform.HttpClientRequest.jsonBody(data),
|
|
940
940
|
import_effect2.Effect.flatMap(import_platform.HttpClient.fetch),
|
|
941
941
|
import_platform.HttpClientResponse.json,
|
|
942
|
-
import_effect2.Effect.flatMap(
|
|
943
|
-
S2.decodeUnknown(schema, { onExcessProperty: "error", errors: "first" })
|
|
944
|
-
),
|
|
942
|
+
import_effect2.Effect.flatMap(S3.decodeUnknown(schema, { onExcessProperty: "error" })),
|
|
945
943
|
import_effect2.Effect.catchTag(
|
|
946
944
|
"ParseError",
|
|
947
945
|
(e) => import_effect2.Effect.fail(import_schema.ArrayFormatter.formatErrorSync(e))
|
|
@@ -952,7 +950,7 @@ var fetchKupoParse = (url, schema) => (0, import_effect2.pipe)(
|
|
|
952
950
|
import_platform.HttpClientRequest.get(url),
|
|
953
951
|
import_platform.HttpClient.fetchOk,
|
|
954
952
|
import_platform.HttpClientResponse.json,
|
|
955
|
-
import_effect2.Effect.flatMap(
|
|
953
|
+
import_effect2.Effect.flatMap(S3.decodeUnknown(schema, { onExcessProperty: "error" })),
|
|
956
954
|
import_effect2.Effect.catchTag(
|
|
957
955
|
"ParseError",
|
|
958
956
|
(e) => import_effect2.Effect.fail(import_schema.ArrayFormatter.formatErrorSync(e))
|
|
@@ -984,13 +982,28 @@ var kupmiosUtxosToUtxos = (kupoURL, utxos) => import_effect2.Effect.forEach(
|
|
|
984
982
|
);
|
|
985
983
|
|
|
986
984
|
// src/emulator.ts
|
|
987
|
-
var import_utils3 = require("@lucid-evolution/utils");
|
|
988
985
|
var import_utils4 = require("@lucid-evolution/utils");
|
|
986
|
+
var import_utils5 = require("@lucid-evolution/utils");
|
|
989
987
|
var import_core_utils2 = require("@lucid-evolution/core-utils");
|
|
990
988
|
var import_wallet = require("@lucid-evolution/wallet");
|
|
991
989
|
var import_cardano_multiplatform_lib_nodejs = require("@anastasia-labs/cardano-multiplatform-lib-nodejs");
|
|
990
|
+
async function generateEmulatorAccountFrommPrivateKey(assets) {
|
|
991
|
+
const privateKey = CML.PrivateKey.generate_ed25519().to_bech32();
|
|
992
|
+
const priv = CML.PrivateKey.from_bech32(privateKey);
|
|
993
|
+
const pubKeyHash = priv.to_public().hash();
|
|
994
|
+
const address = CML.EnterpriseAddress.new(
|
|
995
|
+
0,
|
|
996
|
+
CML.Credential.new_pub_key(pubKeyHash)
|
|
997
|
+
).to_address().to_bech32(void 0);
|
|
998
|
+
return {
|
|
999
|
+
seedPhrase: "",
|
|
1000
|
+
address,
|
|
1001
|
+
assets,
|
|
1002
|
+
privateKey
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
992
1005
|
function generateEmulatorAccount(assets) {
|
|
993
|
-
const seedPhrase = (0,
|
|
1006
|
+
const seedPhrase = (0, import_utils4.generateSeedPhrase)();
|
|
994
1007
|
return {
|
|
995
1008
|
seedPhrase,
|
|
996
1009
|
address: (0, import_wallet.walletFromSeed)(seedPhrase, {
|
|
@@ -998,7 +1011,8 @@ function generateEmulatorAccount(assets) {
|
|
|
998
1011
|
accountIndex: 0,
|
|
999
1012
|
network: "Custom"
|
|
1000
1013
|
}).address,
|
|
1001
|
-
assets
|
|
1014
|
+
assets,
|
|
1015
|
+
privateKey: ""
|
|
1002
1016
|
};
|
|
1003
1017
|
}
|
|
1004
1018
|
var Emulator = class {
|
|
@@ -1014,7 +1028,7 @@ var Emulator = class {
|
|
|
1014
1028
|
time;
|
|
1015
1029
|
protocolParameters;
|
|
1016
1030
|
datumTable = {};
|
|
1017
|
-
constructor(accounts, protocolParameters =
|
|
1031
|
+
constructor(accounts, protocolParameters = import_utils4.PROTOCOL_PARAMETERS_DEFAULT) {
|
|
1018
1032
|
const GENESIS_HASH = "00".repeat(32);
|
|
1019
1033
|
this.blockHeight = 0;
|
|
1020
1034
|
this.slot = 0;
|
|
@@ -1080,7 +1094,7 @@ var Emulator = class {
|
|
|
1080
1094
|
if (typeof addressOrCredential === "string") {
|
|
1081
1095
|
return addressOrCredential === utxo.address ? utxo : [];
|
|
1082
1096
|
} else {
|
|
1083
|
-
const { paymentCredential } = (0,
|
|
1097
|
+
const { paymentCredential } = (0, import_utils5.getAddressDetails)(utxo.address);
|
|
1084
1098
|
return paymentCredential?.hash === addressOrCredential.hash ? utxo : [];
|
|
1085
1099
|
}
|
|
1086
1100
|
});
|
|
@@ -1097,7 +1111,7 @@ var Emulator = class {
|
|
|
1097
1111
|
if (typeof addressOrCredential === "string") {
|
|
1098
1112
|
return addressOrCredential === utxo.address && utxo.assets[unit] > 0n ? utxo : [];
|
|
1099
1113
|
} else {
|
|
1100
|
-
const { paymentCredential } = (0,
|
|
1114
|
+
const { paymentCredential } = (0, import_utils5.getAddressDetails)(utxo.address);
|
|
1101
1115
|
return paymentCredential?.hash === addressOrCredential.hash && utxo.assets[unit] > 0n ? utxo : [];
|
|
1102
1116
|
}
|
|
1103
1117
|
});
|
|
@@ -1411,7 +1425,7 @@ It does not exist or was already spent.`
|
|
|
1411
1425
|
It does not exist or was already spent.`
|
|
1412
1426
|
);
|
|
1413
1427
|
}
|
|
1414
|
-
const { paymentCredential } = (0,
|
|
1428
|
+
const { paymentCredential } = (0, import_utils5.getAddressDetails)(entry.utxo.address);
|
|
1415
1429
|
if (paymentCredential?.type === "Script") {
|
|
1416
1430
|
throw new Error("Collateral inputs can only contain vkeys.");
|
|
1417
1431
|
}
|
|
@@ -1432,7 +1446,7 @@ It does not exist or was already spent.`
|
|
|
1432
1446
|
body.withdrawals().get(rawAddress).toString()
|
|
1433
1447
|
);
|
|
1434
1448
|
const rewardAddress = rawAddress.to_address().to_bech32(void 0);
|
|
1435
|
-
const { stakeCredential } = (0,
|
|
1449
|
+
const { stakeCredential } = (0, import_utils5.getAddressDetails)(rewardAddress);
|
|
1436
1450
|
checkAndConsumeHash(stakeCredential, "Reward", index);
|
|
1437
1451
|
if (this.chain[rewardAddress]?.delegation.rewards !== withdrawal) {
|
|
1438
1452
|
throw new Error(
|
|
@@ -1465,7 +1479,7 @@ It does not exist or was already spent.`
|
|
|
1465
1479
|
CML.NetworkInfo.testnet().network_id(),
|
|
1466
1480
|
deregistration.stake_credential()
|
|
1467
1481
|
).to_address().to_bech32(void 0);
|
|
1468
|
-
const { stakeCredential } = (0,
|
|
1482
|
+
const { stakeCredential } = (0, import_utils5.getAddressDetails)(rewardAddress);
|
|
1469
1483
|
checkAndConsumeHash(stakeCredential, "Cert", index);
|
|
1470
1484
|
if (!this.chain[rewardAddress]?.registeredStake) {
|
|
1471
1485
|
throw new Error(
|
|
@@ -1482,7 +1496,7 @@ It does not exist or was already spent.`
|
|
|
1482
1496
|
delegation.stake_credential()
|
|
1483
1497
|
).to_address().to_bech32(void 0);
|
|
1484
1498
|
const poolId = delegation.pool().to_bech32("pool");
|
|
1485
|
-
const { stakeCredential } = (0,
|
|
1499
|
+
const { stakeCredential } = (0, import_utils5.getAddressDetails)(rewardAddress);
|
|
1486
1500
|
checkAndConsumeHash(stakeCredential, "Cert", index);
|
|
1487
1501
|
if (!this.chain[rewardAddress]?.registeredStake && !certRequests.find(
|
|
1488
1502
|
(request) => request.type === "Registration" && request.rewardAddress === rewardAddress
|
|
@@ -1497,7 +1511,7 @@ It does not exist or was already spent.`
|
|
|
1497
1511
|
}
|
|
1498
1512
|
}
|
|
1499
1513
|
resolvedInputs.forEach(({ entry: { utxo } }, index) => {
|
|
1500
|
-
const { paymentCredential } = (0,
|
|
1514
|
+
const { paymentCredential } = (0, import_utils5.getAddressDetails)(utxo.address);
|
|
1501
1515
|
checkAndConsumeHash(paymentCredential, "Spend", index);
|
|
1502
1516
|
});
|
|
1503
1517
|
const outputs = (() => {
|
|
@@ -1511,7 +1525,7 @@ It does not exist or was already spent.`
|
|
|
1511
1525
|
),
|
|
1512
1526
|
output
|
|
1513
1527
|
);
|
|
1514
|
-
const utxo = (0,
|
|
1528
|
+
const utxo = (0, import_utils5.coreToUtxo)(unspentOutput);
|
|
1515
1529
|
if (utxo.datumHash) consumedHashes.add(utxo.datumHash);
|
|
1516
1530
|
collected.push({
|
|
1517
1531
|
utxo,
|
|
@@ -1720,7 +1734,7 @@ function redeemerTagToString(tag) {
|
|
|
1720
1734
|
}
|
|
1721
1735
|
|
|
1722
1736
|
// src/maestro.ts
|
|
1723
|
-
var
|
|
1737
|
+
var import_utils6 = require("@lucid-evolution/utils");
|
|
1724
1738
|
var import_core_utils3 = require("@lucid-evolution/core-utils");
|
|
1725
1739
|
var Maestro = class {
|
|
1726
1740
|
url;
|
|
@@ -1980,13 +1994,13 @@ var Maestro = class {
|
|
|
1980
1994
|
}
|
|
1981
1995
|
async evaluateTx(tx, additionalUTxOs) {
|
|
1982
1996
|
const additionalMaestroUTxOs = (additionalUTxOs || []).map((utxo) => ({
|
|
1983
|
-
index: utxo.outputIndex,
|
|
1984
1997
|
tx_hash: utxo.txHash,
|
|
1985
|
-
|
|
1998
|
+
index: utxo.outputIndex,
|
|
1999
|
+
txout_cbor: (0, import_utils6.utxoToCore)(utxo).output().to_cbor_hex()
|
|
1986
2000
|
}));
|
|
1987
2001
|
const payload = {
|
|
1988
2002
|
cbor: tx,
|
|
1989
|
-
additionalMaestroUTxOs
|
|
2003
|
+
additional_utxos: additionalMaestroUTxOs
|
|
1990
2004
|
};
|
|
1991
2005
|
const res = await fetch(`${this.url}/transactions/evaluate`, {
|
|
1992
2006
|
method: "POST",
|
|
@@ -2012,17 +2026,17 @@ var toScriptRef = (reference_script) => {
|
|
|
2012
2026
|
case "plutusv1":
|
|
2013
2027
|
return {
|
|
2014
2028
|
type: "PlutusV1",
|
|
2015
|
-
script: (0,
|
|
2029
|
+
script: (0, import_utils6.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2016
2030
|
};
|
|
2017
2031
|
case "plutusv2":
|
|
2018
2032
|
return {
|
|
2019
2033
|
type: "PlutusV2",
|
|
2020
|
-
script: (0,
|
|
2034
|
+
script: (0, import_utils6.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2021
2035
|
};
|
|
2022
2036
|
case "plutusv3":
|
|
2023
2037
|
return {
|
|
2024
2038
|
type: "PlutusV3",
|
|
2025
|
-
script: (0,
|
|
2039
|
+
script: (0, import_utils6.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2026
2040
|
};
|
|
2027
2041
|
default:
|
|
2028
2042
|
return void 0;
|
|
@@ -2031,211 +2045,214 @@ var toScriptRef = (reference_script) => {
|
|
|
2031
2045
|
};
|
|
2032
2046
|
var lucid2 = package_default.version;
|
|
2033
2047
|
|
|
2034
|
-
// src/koios
|
|
2035
|
-
var
|
|
2048
|
+
// src/koios.ts
|
|
2049
|
+
var S5 = __toESM(require("@effect/schema/Schema"), 1);
|
|
2036
2050
|
var import_core_utils4 = require("@lucid-evolution/core-utils");
|
|
2037
|
-
var
|
|
2051
|
+
var import_utils8 = require("@lucid-evolution/utils");
|
|
2038
2052
|
|
|
2039
|
-
// src/koios
|
|
2040
|
-
var
|
|
2041
|
-
var
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2053
|
+
// src/internal/koios.ts
|
|
2054
|
+
var import_platform2 = require("@effect/platform");
|
|
2055
|
+
var S4 = __toESM(require("@effect/schema/Schema"), 1);
|
|
2056
|
+
var import_effect3 = require("effect");
|
|
2057
|
+
var import_utils7 = require("@lucid-evolution/utils");
|
|
2058
|
+
var ProtocolParametersSchema2 = S4.Struct({
|
|
2059
|
+
pvt_motion_no_confidence: S4.Number,
|
|
2060
|
+
pvt_committee_normal: S4.Number,
|
|
2061
|
+
pvt_committee_no_confidence: S4.Number,
|
|
2062
|
+
pvt_hard_fork_initiation: S4.Number,
|
|
2063
|
+
pvtpp_security_group: S4.Number,
|
|
2064
|
+
dvt_motion_no_confidence: S4.Number,
|
|
2065
|
+
dvt_committee_normal: S4.Number,
|
|
2066
|
+
dvt_committee_no_confidence: S4.Number,
|
|
2067
|
+
dvt_update_to_constitution: S4.Number,
|
|
2068
|
+
dvt_hard_fork_initiation: S4.Number,
|
|
2069
|
+
dvt_p_p_network_group: S4.Number,
|
|
2070
|
+
dvt_p_p_economic_group: S4.Number,
|
|
2071
|
+
dvt_p_p_technical_group: S4.Number,
|
|
2072
|
+
dvt_p_p_gov_group: S4.Number,
|
|
2073
|
+
dvt_treasury_withdrawal: S4.Number,
|
|
2074
|
+
committee_min_size: S4.Number,
|
|
2075
|
+
committee_max_term_length: S4.Number,
|
|
2076
|
+
gov_action_lifetime: S4.Number,
|
|
2077
|
+
gov_action_deposit: S4.NumberFromString,
|
|
2078
|
+
drep_deposit: S4.NumberFromString,
|
|
2079
|
+
drep_activity: S4.Number,
|
|
2080
|
+
min_fee_ref_script_cost_per_byte: S4.Number,
|
|
2081
|
+
epoch_no: S4.Number,
|
|
2082
|
+
min_fee_a: S4.Number,
|
|
2083
|
+
min_fee_b: S4.Number,
|
|
2084
|
+
max_block_size: S4.Number,
|
|
2085
|
+
max_tx_size: S4.Number,
|
|
2086
|
+
max_bh_size: S4.Number,
|
|
2087
|
+
key_deposit: S4.BigInt,
|
|
2088
|
+
pool_deposit: S4.BigInt,
|
|
2089
|
+
max_epoch: S4.Number,
|
|
2090
|
+
optimal_pool_count: S4.Number,
|
|
2091
|
+
influence: S4.Number,
|
|
2092
|
+
monetary_expand_rate: S4.Number,
|
|
2093
|
+
treasury_growth_rate: S4.Number,
|
|
2094
|
+
decentralisation: S4.Number,
|
|
2095
|
+
extra_entropy: S4.NullOr(S4.String),
|
|
2096
|
+
protocol_major: S4.Number,
|
|
2097
|
+
protocol_minor: S4.Number,
|
|
2098
|
+
min_utxo_value: S4.String,
|
|
2099
|
+
min_pool_cost: S4.String,
|
|
2100
|
+
nonce: S4.String,
|
|
2101
|
+
block_hash: S4.NullOr(S4.String),
|
|
2102
|
+
cost_models: S4.Struct({
|
|
2103
|
+
PlutusV1: S4.Array(S4.Number),
|
|
2104
|
+
PlutusV2: S4.Array(S4.Number),
|
|
2105
|
+
PlutusV3: S4.Array(S4.Number)
|
|
2089
2106
|
}),
|
|
2090
|
-
price_mem:
|
|
2091
|
-
price_step:
|
|
2092
|
-
max_tx_ex_mem:
|
|
2093
|
-
max_tx_ex_steps:
|
|
2094
|
-
max_block_ex_mem:
|
|
2095
|
-
max_block_ex_steps:
|
|
2096
|
-
max_val_size:
|
|
2097
|
-
collateral_percent:
|
|
2098
|
-
max_collateral_inputs:
|
|
2099
|
-
coins_per_utxo_size:
|
|
2107
|
+
price_mem: S4.Number,
|
|
2108
|
+
price_step: S4.Number,
|
|
2109
|
+
max_tx_ex_mem: S4.BigIntFromNumber,
|
|
2110
|
+
max_tx_ex_steps: S4.BigIntFromNumber,
|
|
2111
|
+
max_block_ex_mem: S4.Number,
|
|
2112
|
+
max_block_ex_steps: S4.Number,
|
|
2113
|
+
max_val_size: S4.Number,
|
|
2114
|
+
collateral_percent: S4.Number,
|
|
2115
|
+
max_collateral_inputs: S4.Number,
|
|
2116
|
+
coins_per_utxo_size: S4.BigInt
|
|
2100
2117
|
});
|
|
2101
|
-
var
|
|
2102
|
-
policy_id:
|
|
2103
|
-
asset_name:
|
|
2104
|
-
fingerprint:
|
|
2105
|
-
decimals:
|
|
2106
|
-
quantity:
|
|
2118
|
+
var AssetSchema = S4.Struct({
|
|
2119
|
+
policy_id: S4.String,
|
|
2120
|
+
asset_name: S4.NullOr(S4.String),
|
|
2121
|
+
fingerprint: S4.String,
|
|
2122
|
+
decimals: S4.Number,
|
|
2123
|
+
quantity: S4.String
|
|
2107
2124
|
});
|
|
2108
|
-
var ReferenceScriptSchema =
|
|
2109
|
-
hash:
|
|
2110
|
-
size:
|
|
2111
|
-
type:
|
|
2112
|
-
bytes:
|
|
2113
|
-
value:
|
|
2125
|
+
var ReferenceScriptSchema = S4.Struct({
|
|
2126
|
+
hash: S4.NullOr(S4.String),
|
|
2127
|
+
size: S4.NullOr(S4.Number),
|
|
2128
|
+
type: S4.NullOr(S4.String),
|
|
2129
|
+
bytes: S4.NullOr(S4.String),
|
|
2130
|
+
value: S4.NullOr(S4.Object)
|
|
2114
2131
|
});
|
|
2115
|
-
var
|
|
2116
|
-
tx_hash:
|
|
2117
|
-
tx_index:
|
|
2118
|
-
block_time:
|
|
2119
|
-
block_height:
|
|
2120
|
-
value:
|
|
2121
|
-
datum_hash:
|
|
2122
|
-
inline_datum:
|
|
2123
|
-
|
|
2124
|
-
bytes:
|
|
2125
|
-
value:
|
|
2132
|
+
var UTxOSchema2 = S4.Struct({
|
|
2133
|
+
tx_hash: S4.String,
|
|
2134
|
+
tx_index: S4.Number,
|
|
2135
|
+
block_time: S4.Number,
|
|
2136
|
+
block_height: S4.NullOr(S4.Number),
|
|
2137
|
+
value: S4.String,
|
|
2138
|
+
datum_hash: S4.NullOr(S4.String),
|
|
2139
|
+
inline_datum: S4.NullOr(
|
|
2140
|
+
S4.Struct({
|
|
2141
|
+
bytes: S4.String,
|
|
2142
|
+
value: S4.Object
|
|
2126
2143
|
})
|
|
2127
2144
|
),
|
|
2128
|
-
reference_script:
|
|
2129
|
-
asset_list:
|
|
2145
|
+
reference_script: S4.NullOr(ReferenceScriptSchema),
|
|
2146
|
+
asset_list: S4.NullOr(S4.Array(AssetSchema))
|
|
2130
2147
|
});
|
|
2131
|
-
var
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
address:
|
|
2135
|
-
balance:
|
|
2136
|
-
stake_address:
|
|
2137
|
-
script_address:
|
|
2138
|
-
utxo_set:
|
|
2148
|
+
var AddressInfoSchema = S4.Array(
|
|
2149
|
+
S4.NullishOr(
|
|
2150
|
+
S4.Struct({
|
|
2151
|
+
address: S4.String,
|
|
2152
|
+
balance: S4.String,
|
|
2153
|
+
stake_address: S4.NullOr(S4.String),
|
|
2154
|
+
script_address: S4.Boolean,
|
|
2155
|
+
utxo_set: S4.Array(UTxOSchema2)
|
|
2139
2156
|
})
|
|
2140
2157
|
)
|
|
2141
2158
|
);
|
|
2142
|
-
var
|
|
2143
|
-
payment_addr:
|
|
2144
|
-
bech32:
|
|
2145
|
-
cred:
|
|
2159
|
+
var InputOutputSchema = S4.Struct({
|
|
2160
|
+
payment_addr: S4.Struct({
|
|
2161
|
+
bech32: S4.String,
|
|
2162
|
+
cred: S4.String
|
|
2146
2163
|
}),
|
|
2147
|
-
stake_addr:
|
|
2148
|
-
tx_hash:
|
|
2149
|
-
tx_index:
|
|
2150
|
-
value:
|
|
2151
|
-
datum_hash:
|
|
2152
|
-
inline_datum:
|
|
2153
|
-
|
|
2154
|
-
bytes:
|
|
2155
|
-
value:
|
|
2164
|
+
stake_addr: S4.NullOr(S4.String),
|
|
2165
|
+
tx_hash: S4.String,
|
|
2166
|
+
tx_index: S4.Number,
|
|
2167
|
+
value: S4.String,
|
|
2168
|
+
datum_hash: S4.NullOr(S4.String),
|
|
2169
|
+
inline_datum: S4.NullOr(
|
|
2170
|
+
S4.Struct({
|
|
2171
|
+
bytes: S4.String,
|
|
2172
|
+
value: S4.Object
|
|
2156
2173
|
})
|
|
2157
2174
|
),
|
|
2158
|
-
reference_script:
|
|
2159
|
-
asset_list:
|
|
2175
|
+
reference_script: S4.NullOr(ReferenceScriptSchema),
|
|
2176
|
+
asset_list: S4.Array(AssetSchema)
|
|
2160
2177
|
});
|
|
2161
|
-
var
|
|
2162
|
-
tx_hash:
|
|
2163
|
-
block_hash:
|
|
2164
|
-
block_height:
|
|
2165
|
-
epoch_no:
|
|
2166
|
-
epoch_slot:
|
|
2167
|
-
absolute_slot:
|
|
2168
|
-
tx_timestamp:
|
|
2169
|
-
tx_block_index:
|
|
2170
|
-
tx_size:
|
|
2171
|
-
total_output:
|
|
2172
|
-
fee:
|
|
2173
|
-
treasury_donation:
|
|
2174
|
-
deposit:
|
|
2175
|
-
invalid_before:
|
|
2176
|
-
invalid_after:
|
|
2177
|
-
collateral_inputs:
|
|
2178
|
-
collateral_output:
|
|
2179
|
-
reference_inputs:
|
|
2180
|
-
inputs:
|
|
2181
|
-
outputs:
|
|
2182
|
-
withdrawals:
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
amount:
|
|
2186
|
-
stake_addr:
|
|
2178
|
+
var TxInfoSchema = S4.Struct({
|
|
2179
|
+
tx_hash: S4.String,
|
|
2180
|
+
block_hash: S4.String,
|
|
2181
|
+
block_height: S4.Number,
|
|
2182
|
+
epoch_no: S4.Number,
|
|
2183
|
+
epoch_slot: S4.Number,
|
|
2184
|
+
absolute_slot: S4.Number,
|
|
2185
|
+
tx_timestamp: S4.Number,
|
|
2186
|
+
tx_block_index: S4.Number,
|
|
2187
|
+
tx_size: S4.Number,
|
|
2188
|
+
total_output: S4.String,
|
|
2189
|
+
fee: S4.String,
|
|
2190
|
+
treasury_donation: S4.String,
|
|
2191
|
+
deposit: S4.String,
|
|
2192
|
+
invalid_before: S4.NullOr(S4.String),
|
|
2193
|
+
invalid_after: S4.NullOr(S4.String),
|
|
2194
|
+
collateral_inputs: S4.NullOr(S4.Array(InputOutputSchema)),
|
|
2195
|
+
collateral_output: S4.NullOr(InputOutputSchema),
|
|
2196
|
+
reference_inputs: S4.NullOr(S4.Array(InputOutputSchema)),
|
|
2197
|
+
inputs: S4.Array(InputOutputSchema),
|
|
2198
|
+
outputs: S4.Array(InputOutputSchema),
|
|
2199
|
+
withdrawals: S4.NullOr(
|
|
2200
|
+
S4.Array(
|
|
2201
|
+
S4.Struct({
|
|
2202
|
+
amount: S4.String,
|
|
2203
|
+
stake_addr: S4.String
|
|
2187
2204
|
})
|
|
2188
2205
|
)
|
|
2189
2206
|
),
|
|
2190
|
-
assets_minted:
|
|
2191
|
-
metadata:
|
|
2192
|
-
certificates:
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
index:
|
|
2196
|
-
type:
|
|
2197
|
-
info:
|
|
2207
|
+
assets_minted: S4.NullOr(S4.Array(AssetSchema)),
|
|
2208
|
+
metadata: S4.NullOr(S4.Object),
|
|
2209
|
+
certificates: S4.NullOr(
|
|
2210
|
+
S4.Array(
|
|
2211
|
+
S4.Struct({
|
|
2212
|
+
index: S4.Number,
|
|
2213
|
+
type: S4.String,
|
|
2214
|
+
info: S4.NullOr(S4.Object)
|
|
2198
2215
|
})
|
|
2199
2216
|
)
|
|
2200
2217
|
),
|
|
2201
|
-
native_scripts:
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
script_hash:
|
|
2205
|
-
script_json:
|
|
2218
|
+
native_scripts: S4.NullOr(
|
|
2219
|
+
S4.Array(
|
|
2220
|
+
S4.Struct({
|
|
2221
|
+
script_hash: S4.String,
|
|
2222
|
+
script_json: S4.Object
|
|
2206
2223
|
})
|
|
2207
2224
|
)
|
|
2208
2225
|
),
|
|
2209
|
-
plutus_contracts:
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
address:
|
|
2213
|
-
spends_input:
|
|
2214
|
-
|
|
2215
|
-
tx_hash:
|
|
2216
|
-
tx_index:
|
|
2226
|
+
plutus_contracts: S4.NullOr(
|
|
2227
|
+
S4.Array(
|
|
2228
|
+
S4.Struct({
|
|
2229
|
+
address: S4.String,
|
|
2230
|
+
spends_input: S4.NullOr(
|
|
2231
|
+
S4.Struct({
|
|
2232
|
+
tx_hash: S4.String,
|
|
2233
|
+
tx_index: S4.Number
|
|
2217
2234
|
})
|
|
2218
2235
|
),
|
|
2219
|
-
script_hash:
|
|
2220
|
-
bytecode:
|
|
2221
|
-
size:
|
|
2222
|
-
valid_contract:
|
|
2223
|
-
input:
|
|
2224
|
-
redeemer:
|
|
2225
|
-
purpose:
|
|
2226
|
-
fee:
|
|
2227
|
-
unit:
|
|
2228
|
-
steps:
|
|
2229
|
-
mem:
|
|
2236
|
+
script_hash: S4.String,
|
|
2237
|
+
bytecode: S4.String,
|
|
2238
|
+
size: S4.Number,
|
|
2239
|
+
valid_contract: S4.Boolean,
|
|
2240
|
+
input: S4.Struct({
|
|
2241
|
+
redeemer: S4.Struct({
|
|
2242
|
+
purpose: S4.Literal("spend", "mint", "cert", "reward"),
|
|
2243
|
+
fee: S4.String,
|
|
2244
|
+
unit: S4.Struct({
|
|
2245
|
+
steps: S4.String,
|
|
2246
|
+
mem: S4.String
|
|
2230
2247
|
}),
|
|
2231
|
-
datum:
|
|
2232
|
-
hash:
|
|
2233
|
-
value:
|
|
2248
|
+
datum: S4.Struct({
|
|
2249
|
+
hash: S4.NullOr(S4.String),
|
|
2250
|
+
value: S4.NullOr(S4.Object)
|
|
2234
2251
|
})
|
|
2235
2252
|
}),
|
|
2236
|
-
datum:
|
|
2237
|
-
hash:
|
|
2238
|
-
value:
|
|
2253
|
+
datum: S4.Struct({
|
|
2254
|
+
hash: S4.NullOr(S4.String),
|
|
2255
|
+
value: S4.NullOr(S4.Object)
|
|
2239
2256
|
})
|
|
2240
2257
|
})
|
|
2241
2258
|
})
|
|
@@ -2243,101 +2260,147 @@ var KoiosTxInfoSchema = S3.Struct({
|
|
|
2243
2260
|
),
|
|
2244
2261
|
//TODO: add S.Struct
|
|
2245
2262
|
// https://preprod.koios.rest/#post-/tx_info
|
|
2246
|
-
voting_procedures:
|
|
2263
|
+
voting_procedures: S4.Array(S4.Object),
|
|
2247
2264
|
//TODO: add S.Struct
|
|
2248
2265
|
// https://preprod.koios.rest/#post-/tx_info
|
|
2249
|
-
proposal_procedures:
|
|
2266
|
+
proposal_procedures: S4.Object
|
|
2250
2267
|
});
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
// src/fetch.ts
|
|
2257
|
-
var fetch_exports = {};
|
|
2258
|
-
__export(fetch_exports, {
|
|
2259
|
-
FetchError: () => FetchError,
|
|
2260
|
-
JsonError: () => JsonError,
|
|
2261
|
-
ResponseError: () => ResponseError,
|
|
2262
|
-
fetchEffect: () => fetchEffect
|
|
2268
|
+
var TxHashSchema = S4.String;
|
|
2269
|
+
var AssetAddressSchema = S4.Struct({
|
|
2270
|
+
payment_address: S4.String,
|
|
2271
|
+
stake_address: S4.NullOr(S4.String),
|
|
2272
|
+
quantity: S4.String
|
|
2263
2273
|
});
|
|
2264
|
-
var
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2274
|
+
var AccountInfoSchema = S4.Struct({
|
|
2275
|
+
delegated_pool: S4.NullOr(S4.String),
|
|
2276
|
+
rewards_available: S4.NumberFromString
|
|
2277
|
+
});
|
|
2278
|
+
var DatumInfo = S4.Struct({
|
|
2279
|
+
bytes: S4.String
|
|
2280
|
+
});
|
|
2281
|
+
var postWithSchemaValidation = (url, data, schema) => (0, import_effect3.pipe)(
|
|
2282
|
+
import_platform2.HttpClientRequest.post(url),
|
|
2283
|
+
import_platform2.HttpClientRequest.jsonBody(data),
|
|
2284
|
+
import_effect3.Effect.flatMap(import_platform2.HttpClient.fetchOk),
|
|
2285
|
+
import_platform2.HttpClientResponse.json,
|
|
2286
|
+
import_effect3.Effect.flatMap(S4.decodeUnknown(schema))
|
|
2287
|
+
// Effect.scoped
|
|
2288
|
+
);
|
|
2289
|
+
var getWithSchemaValidation = (url, schema) => (0, import_effect3.pipe)(
|
|
2290
|
+
import_platform2.HttpClientRequest.get(url),
|
|
2291
|
+
import_platform2.HttpClient.fetchOk,
|
|
2292
|
+
import_platform2.HttpClientResponse.json,
|
|
2293
|
+
import_effect3.Effect.flatMap(S4.decodeUnknown(schema))
|
|
2294
|
+
);
|
|
2295
|
+
var toUTxO = (koiosUTxO, address) => ({
|
|
2296
|
+
txHash: koiosUTxO.tx_hash,
|
|
2297
|
+
outputIndex: koiosUTxO.tx_index,
|
|
2298
|
+
assets: (() => {
|
|
2299
|
+
const a = {};
|
|
2300
|
+
if (koiosUTxO.asset_list) {
|
|
2301
|
+
koiosUTxO.asset_list.forEach((am) => {
|
|
2302
|
+
a[am.policy_id + am.asset_name] = BigInt(am.quantity);
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
a["lovelace"] = BigInt(koiosUTxO.value);
|
|
2306
|
+
return a;
|
|
2307
|
+
})(),
|
|
2308
|
+
address,
|
|
2309
|
+
datumHash: koiosUTxO.inline_datum ? void 0 : koiosUTxO.datum_hash || void 0,
|
|
2310
|
+
datum: koiosUTxO.inline_datum ? koiosUTxO.inline_datum.bytes : void 0,
|
|
2311
|
+
scriptRef: toScriptRef2(koiosUTxO.reference_script)
|
|
2312
|
+
});
|
|
2313
|
+
var toScriptRef2 = (reference_script) => {
|
|
2314
|
+
if (reference_script && reference_script.bytes && reference_script.type) {
|
|
2315
|
+
switch (reference_script.type) {
|
|
2316
|
+
case "plutusV1":
|
|
2317
|
+
return {
|
|
2318
|
+
type: "PlutusV1",
|
|
2319
|
+
script: (0, import_utils7.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2320
|
+
};
|
|
2321
|
+
case "plutusV2":
|
|
2322
|
+
return {
|
|
2323
|
+
type: "PlutusV2",
|
|
2324
|
+
script: (0, import_utils7.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2325
|
+
};
|
|
2326
|
+
case "plutusV3":
|
|
2327
|
+
return {
|
|
2328
|
+
type: "PlutusV3",
|
|
2329
|
+
script: (0, import_utils7.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2330
|
+
};
|
|
2331
|
+
default:
|
|
2332
|
+
return void 0;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2268
2335
|
};
|
|
2269
|
-
var
|
|
2336
|
+
var getUtxosEffect = (baseUrl, addressOrCredential) => {
|
|
2337
|
+
const url = `${baseUrl}/address_info`;
|
|
2338
|
+
const body = {
|
|
2339
|
+
_addresses: [addressOrCredential]
|
|
2340
|
+
};
|
|
2341
|
+
const schema = AddressInfoSchema;
|
|
2342
|
+
const result = (0, import_effect3.pipe)(
|
|
2343
|
+
import_effect3.Effect.if(typeof addressOrCredential === "string", {
|
|
2344
|
+
onFalse: () => import_effect3.Effect.fail("Credential Type is not supported in Koios yet."),
|
|
2345
|
+
onTrue: () => postWithSchemaValidation(url, body, schema)
|
|
2346
|
+
}),
|
|
2347
|
+
import_effect3.Effect.map(
|
|
2348
|
+
([result2]) => result2 ? result2.utxo_set.map((koiosUtxo) => toUTxO(koiosUtxo, result2.address)) : []
|
|
2349
|
+
)
|
|
2350
|
+
);
|
|
2351
|
+
return result;
|
|
2270
2352
|
};
|
|
2271
|
-
var fetchEffect = (input, requestInit) => (0, import_effect3.pipe)(
|
|
2272
|
-
import_effect3.Effect.tryPromise({
|
|
2273
|
-
try: () => fetch(input, requestInit),
|
|
2274
|
-
catch: (error) => new FetchError({
|
|
2275
|
-
message: `${String(error)}. Please ensure the server is operational or check the validity of the input:${input}.`
|
|
2276
|
-
})
|
|
2277
|
-
}),
|
|
2278
|
-
import_effect3.Effect.flatMap(
|
|
2279
|
-
(response) => !response.ok ? new ResponseError({
|
|
2280
|
-
message: `${response.status} ${response.statusText}`
|
|
2281
|
-
}) : import_effect3.Effect.succeed(response)
|
|
2282
|
-
),
|
|
2283
|
-
import_effect3.Effect.flatMap(
|
|
2284
|
-
(response) => import_effect3.Effect.tryPromise({
|
|
2285
|
-
try: () => response.json(),
|
|
2286
|
-
catch: (error) => new JsonError({ message: String(error) })
|
|
2287
|
-
})
|
|
2288
|
-
)
|
|
2289
|
-
);
|
|
2290
2353
|
|
|
2291
|
-
// src/koios
|
|
2354
|
+
// src/koios.ts
|
|
2355
|
+
var import_effect4 = require("effect");
|
|
2356
|
+
var KoiosError = class extends import_effect4.Data.TaggedError("KoiosError") {
|
|
2357
|
+
get message() {
|
|
2358
|
+
return `${this.cause}`;
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2292
2361
|
var Koios = class {
|
|
2293
2362
|
baseUrl;
|
|
2294
2363
|
constructor(baseUrl) {
|
|
2295
2364
|
this.baseUrl = baseUrl;
|
|
2296
2365
|
}
|
|
2297
2366
|
async getProtocolParameters() {
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2300
|
-
)
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
errors: "first"
|
|
2305
|
-
})(result[0]),
|
|
2306
|
-
import_effect4.Effect.catchTag(
|
|
2307
|
-
"ParseError",
|
|
2308
|
-
(e) => import_effect4.Effect.fail(import_schema3.ArrayFormatter.formatErrorSync(e))
|
|
2309
|
-
),
|
|
2367
|
+
const url = `${this.baseUrl}/epoch_params?limit=1`;
|
|
2368
|
+
const schema = S5.Array(ProtocolParametersSchema2);
|
|
2369
|
+
const [result] = await (0, import_effect4.pipe)(
|
|
2370
|
+
getWithSchemaValidation(url, schema),
|
|
2371
|
+
import_effect4.Effect.timeout(1e4),
|
|
2372
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2310
2373
|
import_effect4.Effect.runPromise
|
|
2311
2374
|
);
|
|
2312
2375
|
return {
|
|
2313
|
-
minFeeA:
|
|
2314
|
-
minFeeB:
|
|
2315
|
-
maxTxSize:
|
|
2316
|
-
maxValSize:
|
|
2317
|
-
keyDeposit:
|
|
2318
|
-
poolDeposit:
|
|
2319
|
-
priceMem:
|
|
2320
|
-
priceStep:
|
|
2321
|
-
maxTxExMem:
|
|
2322
|
-
maxTxExSteps:
|
|
2323
|
-
coinsPerUtxoByte:
|
|
2324
|
-
collateralPercentage:
|
|
2325
|
-
maxCollateralInputs:
|
|
2376
|
+
minFeeA: result.min_fee_a,
|
|
2377
|
+
minFeeB: result.min_fee_b,
|
|
2378
|
+
maxTxSize: result.max_tx_size,
|
|
2379
|
+
maxValSize: result.max_val_size,
|
|
2380
|
+
keyDeposit: result.key_deposit,
|
|
2381
|
+
poolDeposit: result.pool_deposit,
|
|
2382
|
+
priceMem: result.price_mem,
|
|
2383
|
+
priceStep: result.price_step,
|
|
2384
|
+
maxTxExMem: result.max_tx_ex_mem,
|
|
2385
|
+
maxTxExSteps: result.max_tx_ex_steps,
|
|
2386
|
+
coinsPerUtxoByte: result.coins_per_utxo_size,
|
|
2387
|
+
collateralPercentage: result.collateral_percent,
|
|
2388
|
+
maxCollateralInputs: result.max_collateral_inputs,
|
|
2326
2389
|
costModels: {
|
|
2327
2390
|
PlutusV1: Object.fromEntries(
|
|
2328
|
-
|
|
2391
|
+
result.cost_models.PlutusV1.map((value, index) => [
|
|
2329
2392
|
index.toString(),
|
|
2330
2393
|
value
|
|
2331
2394
|
])
|
|
2332
2395
|
),
|
|
2333
2396
|
PlutusV2: Object.fromEntries(
|
|
2334
|
-
|
|
2397
|
+
result.cost_models.PlutusV2.map((value, index) => [
|
|
2335
2398
|
index.toString(),
|
|
2336
2399
|
value
|
|
2337
2400
|
])
|
|
2338
2401
|
),
|
|
2339
2402
|
PlutusV3: Object.fromEntries(
|
|
2340
|
-
|
|
2403
|
+
result.cost_models.PlutusV3.map((value, index) => [
|
|
2341
2404
|
index.toString(),
|
|
2342
2405
|
value
|
|
2343
2406
|
])
|
|
@@ -2346,109 +2409,80 @@ var Koios = class {
|
|
|
2346
2409
|
};
|
|
2347
2410
|
}
|
|
2348
2411
|
async getUtxos(addressOrCredential) {
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
"Content-Type": "application/json"
|
|
2357
|
-
},
|
|
2358
|
-
method: "POST",
|
|
2359
|
-
body: JSON.stringify(body)
|
|
2360
|
-
}).then((res) => res.json());
|
|
2361
|
-
const [parsedResult] = await (0, import_effect4.pipe)(
|
|
2362
|
-
S4.decodeUnknown(KoiosAddressInfoSchema, {
|
|
2363
|
-
onExcessProperty: "error",
|
|
2364
|
-
errors: "first"
|
|
2365
|
-
})(result),
|
|
2366
|
-
import_effect4.Effect.catchTag(
|
|
2367
|
-
"ParseError",
|
|
2368
|
-
(e) => import_effect4.Effect.fail(import_schema3.ArrayFormatter.formatErrorSync(e))
|
|
2369
|
-
),
|
|
2370
|
-
import_effect4.Effect.runPromise
|
|
2371
|
-
);
|
|
2372
|
-
return parsedResult ? parsedResult.utxo_set.map(
|
|
2373
|
-
(koiosUTXO) => toUTxO(koiosUTXO, parsedResult.address)
|
|
2374
|
-
) : [];
|
|
2375
|
-
} else {
|
|
2376
|
-
throw Error("getUtxos by Credential Type is not supported in Koios yet.");
|
|
2377
|
-
}
|
|
2412
|
+
const result = await (0, import_effect4.pipe)(
|
|
2413
|
+
getUtxosEffect(this.baseUrl, addressOrCredential),
|
|
2414
|
+
import_effect4.Effect.timeout(1e4),
|
|
2415
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2416
|
+
import_effect4.Effect.runPromise
|
|
2417
|
+
);
|
|
2418
|
+
return result;
|
|
2378
2419
|
}
|
|
2379
2420
|
async getUtxosWithUnit(addressOrCredential, unit) {
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2421
|
+
const result = await (0, import_effect4.pipe)(
|
|
2422
|
+
getUtxosEffect(this.baseUrl, addressOrCredential),
|
|
2423
|
+
import_effect4.Effect.map(
|
|
2424
|
+
(utxos) => utxos.filter((utxo) => {
|
|
2384
2425
|
const keys = Object.keys(utxo.assets);
|
|
2385
2426
|
return keys.length > 0 && keys.includes(unit);
|
|
2386
|
-
})
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
);
|
|
2394
|
-
}
|
|
2427
|
+
})
|
|
2428
|
+
),
|
|
2429
|
+
import_effect4.Effect.timeout(1e4),
|
|
2430
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2431
|
+
import_effect4.Effect.runPromise
|
|
2432
|
+
);
|
|
2433
|
+
return result;
|
|
2395
2434
|
}
|
|
2396
2435
|
async getUtxoByUnit(unit) {
|
|
2397
|
-
let { policyId, assetName } = (0,
|
|
2398
|
-
|
|
2399
|
-
const
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2436
|
+
let { policyId, assetName } = (0, import_utils8.fromUnit)(unit);
|
|
2437
|
+
const url = `${this.baseUrl}/asset_addresses?_asset_policy=${policyId}&_asset_name=${assetName}`;
|
|
2438
|
+
const result = await (0, import_effect4.pipe)(
|
|
2439
|
+
getWithSchemaValidation(url, S5.Array(AssetAddressSchema)),
|
|
2440
|
+
import_effect4.Effect.flatMap(
|
|
2441
|
+
(adresses) => adresses.length === 0 ? import_effect4.Effect.fail("Unit not found") : import_effect4.Effect.succeed(adresses)
|
|
2442
|
+
),
|
|
2443
|
+
import_effect4.Effect.flatMap(
|
|
2444
|
+
(adresses) => adresses.length > 1 ? import_effect4.Effect.fail("Unit needs to be an NFT or only held by one address.") : import_effect4.Effect.succeed(adresses[0])
|
|
2445
|
+
),
|
|
2446
|
+
import_effect4.Effect.flatMap(
|
|
2447
|
+
(address) => getUtxosEffect(this.baseUrl, address.payment_address)
|
|
2448
|
+
),
|
|
2449
|
+
import_effect4.Effect.map(
|
|
2450
|
+
(utxos) => utxos.filter((utxo) => {
|
|
2451
|
+
const keys = Object.keys(utxo.assets);
|
|
2452
|
+
return keys.length > 0 && keys.includes(unit);
|
|
2453
|
+
})
|
|
2454
|
+
),
|
|
2455
|
+
import_effect4.Effect.flatMap(
|
|
2456
|
+
(utxos) => utxos.length > 1 ? import_effect4.Effect.fail("Unit needs to be an NFT or only held by one address.") : import_effect4.Effect.succeed(utxos[0])
|
|
2457
|
+
),
|
|
2458
|
+
import_effect4.Effect.timeout(1e4),
|
|
2459
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2460
|
+
import_effect4.Effect.runPromise
|
|
2461
|
+
);
|
|
2462
|
+
return result;
|
|
2418
2463
|
}
|
|
2419
2464
|
async getUtxosByOutRef(outRefs) {
|
|
2465
|
+
const url = `${this.baseUrl}/tx_info`;
|
|
2420
2466
|
const body = {
|
|
2421
2467
|
_tx_hashes: [...new Set(outRefs.map((outRef) => outRef.txHash))],
|
|
2422
2468
|
_assets: true,
|
|
2423
2469
|
_scripts: true
|
|
2424
2470
|
};
|
|
2425
|
-
const
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
},
|
|
2430
|
-
method: "POST",
|
|
2431
|
-
body: JSON.stringify(body)
|
|
2432
|
-
}).then((res) => res.json());
|
|
2433
|
-
const [parsedResult] = await (0, import_effect4.pipe)(
|
|
2434
|
-
S4.decodeUnknown(S4.Array(KoiosTxInfoSchema), {
|
|
2435
|
-
onExcessProperty: "error",
|
|
2436
|
-
errors: "first"
|
|
2437
|
-
})(result),
|
|
2438
|
-
import_effect4.Effect.catchTag(
|
|
2439
|
-
"ParseError",
|
|
2440
|
-
(e) => import_effect4.Effect.fail(import_schema3.ArrayFormatter.formatErrorSync(e))
|
|
2441
|
-
),
|
|
2471
|
+
const schema = S5.Array(TxInfoSchema);
|
|
2472
|
+
const [result] = await (0, import_effect4.pipe)(
|
|
2473
|
+
postWithSchemaValidation(url, body, schema),
|
|
2474
|
+
import_effect4.Effect.timeout(1e4),
|
|
2475
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2442
2476
|
import_effect4.Effect.runPromise
|
|
2443
2477
|
);
|
|
2444
|
-
if (
|
|
2445
|
-
const utxos =
|
|
2478
|
+
if (result) {
|
|
2479
|
+
const utxos = result.outputs.map(
|
|
2446
2480
|
(koiosInputOutput) => toUTxO(
|
|
2447
2481
|
{
|
|
2448
2482
|
tx_hash: koiosInputOutput.tx_hash,
|
|
2449
2483
|
tx_index: koiosInputOutput.tx_index,
|
|
2450
2484
|
block_time: 0,
|
|
2451
|
-
block_height:
|
|
2485
|
+
block_height: result.block_height,
|
|
2452
2486
|
value: koiosInputOutput.value,
|
|
2453
2487
|
datum_hash: koiosInputOutput.datum_hash,
|
|
2454
2488
|
inline_datum: koiosInputOutput.inline_datum,
|
|
@@ -2471,135 +2505,94 @@ var Koios = class {
|
|
|
2471
2505
|
const body = {
|
|
2472
2506
|
_stake_addresses: [rewardAddress]
|
|
2473
2507
|
};
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2508
|
+
const url = `${this.baseUrl}/account_info`;
|
|
2509
|
+
const result = await (0, import_effect4.pipe)(
|
|
2510
|
+
postWithSchemaValidation(
|
|
2511
|
+
url,
|
|
2512
|
+
body,
|
|
2513
|
+
S5.Array(AccountInfoSchema)
|
|
2514
|
+
),
|
|
2515
|
+
import_effect4.Effect.flatMap(
|
|
2516
|
+
(result2) => result2.length === 0 ? import_effect4.Effect.fail("No Delegation Found by Reward Address") : import_effect4.Effect.succeed(result2[0])
|
|
2517
|
+
),
|
|
2518
|
+
import_effect4.Effect.timeout(1e4),
|
|
2519
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2520
|
+
import_effect4.Effect.runPromise
|
|
2521
|
+
);
|
|
2522
|
+
return {
|
|
2523
|
+
poolId: result.delegated_pool || null,
|
|
2524
|
+
rewards: BigInt(result.rewards_available)
|
|
2525
|
+
};
|
|
2490
2526
|
}
|
|
2491
2527
|
async getDatum(datumHash) {
|
|
2528
|
+
const url = `${this.baseUrl}/datum_info`;
|
|
2492
2529
|
const body = {
|
|
2493
2530
|
_datum_hashes: [datumHash]
|
|
2494
2531
|
};
|
|
2495
|
-
const
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
"
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
} else {
|
|
2506
|
-
throw new Error("No Datum Found by Datum Hash");
|
|
2507
|
-
}
|
|
2532
|
+
const result = await (0, import_effect4.pipe)(
|
|
2533
|
+
postWithSchemaValidation(url, body, S5.Array(DatumInfo)),
|
|
2534
|
+
import_effect4.Effect.flatMap(
|
|
2535
|
+
(result2) => result2.length === 0 ? import_effect4.Effect.fail("No Datum Found by Datum Hash") : import_effect4.Effect.succeed(result2[0])
|
|
2536
|
+
),
|
|
2537
|
+
import_effect4.Effect.timeout(1e4),
|
|
2538
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2539
|
+
import_effect4.Effect.runPromise
|
|
2540
|
+
);
|
|
2541
|
+
return result.bytes;
|
|
2508
2542
|
}
|
|
2509
2543
|
async awaitTx(txHash, checkInterval = 2e4) {
|
|
2544
|
+
const url = `${this.baseUrl}/tx_info`;
|
|
2510
2545
|
const body = {
|
|
2511
2546
|
_tx_hashes: [txHash]
|
|
2512
2547
|
};
|
|
2513
|
-
const
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
"Content-Type": "application/json"
|
|
2517
|
-
},
|
|
2518
|
-
method: "POST",
|
|
2519
|
-
body: JSON.stringify(body)
|
|
2520
|
-
};
|
|
2521
|
-
const program = (0, import_effect4.pipe)(
|
|
2522
|
-
fetchEffect(`${this.baseUrl}/tx_info`, request),
|
|
2523
|
-
import_effect4.Effect.flatMap(
|
|
2524
|
-
(json) => S4.decodeUnknown(S4.Array(KoiosTxInfoSchema))(json)
|
|
2525
|
-
),
|
|
2526
|
-
import_effect4.Effect.catchTag(
|
|
2527
|
-
"ParseError",
|
|
2528
|
-
(e) => import_effect4.Effect.fail(import_schema3.ArrayFormatter.formatErrorSync(e))
|
|
2529
|
-
),
|
|
2548
|
+
const schema = S5.Array(TxInfoSchema);
|
|
2549
|
+
const result = await (0, import_effect4.pipe)(
|
|
2550
|
+
postWithSchemaValidation(url, body, schema),
|
|
2530
2551
|
import_effect4.Effect.repeat({
|
|
2531
2552
|
schedule: import_effect4.Schedule.exponential(checkInterval),
|
|
2532
|
-
until: (
|
|
2553
|
+
until: (result2) => result2.length > 0
|
|
2533
2554
|
}),
|
|
2534
2555
|
import_effect4.Effect.timeout(16e4),
|
|
2535
2556
|
import_effect4.Effect.orDie,
|
|
2536
|
-
import_effect4.Effect.as(true)
|
|
2557
|
+
import_effect4.Effect.as(true),
|
|
2558
|
+
import_effect4.Effect.runPromise
|
|
2537
2559
|
);
|
|
2538
|
-
return
|
|
2560
|
+
return result;
|
|
2539
2561
|
}
|
|
2540
2562
|
async submitTx(tx) {
|
|
2541
|
-
const
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
const isTxHash = S4.is(TxHashSchema);
|
|
2551
|
-
if (!isTxHash(result)) {
|
|
2552
|
-
throw new Error(JSON.stringify(result));
|
|
2553
|
-
}
|
|
2563
|
+
const url = `${this.baseUrl}/submittx`;
|
|
2564
|
+
const body = (0, import_core_utils4.fromHex)(tx);
|
|
2565
|
+
const schema = TxHashSchema;
|
|
2566
|
+
const result = await (0, import_effect4.pipe)(
|
|
2567
|
+
postWithSchemaValidation(url, body, schema),
|
|
2568
|
+
import_effect4.Effect.timeout(1e4),
|
|
2569
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2570
|
+
import_effect4.Effect.runPromise
|
|
2571
|
+
);
|
|
2554
2572
|
return result;
|
|
2555
2573
|
}
|
|
2556
2574
|
async evaluateTx(tx, additionalUTxOs) {
|
|
2557
|
-
const
|
|
2558
|
-
|
|
2559
|
-
language: utxo.scriptRef.type,
|
|
2560
|
-
cbor: utxo.scriptRef.script
|
|
2561
|
-
} : void 0;
|
|
2562
|
-
return [
|
|
2563
|
-
{
|
|
2564
|
-
transaction: { id: utxo.txHash, output: { index: utxo.outputIndex } }
|
|
2565
|
-
},
|
|
2566
|
-
{
|
|
2567
|
-
address: utxo.address,
|
|
2568
|
-
value: {
|
|
2569
|
-
coins: utxo.assets.lovelace,
|
|
2570
|
-
assets: utxo.assets.restAssets
|
|
2571
|
-
},
|
|
2572
|
-
datumHash: utxo.datumHash,
|
|
2573
|
-
datum: utxo.datum,
|
|
2574
|
-
script
|
|
2575
|
-
}
|
|
2576
|
-
];
|
|
2577
|
-
});
|
|
2578
|
-
const data = {
|
|
2575
|
+
const url = `${this.baseUrl}/ogmios`;
|
|
2576
|
+
const body = {
|
|
2579
2577
|
jsonrpc: "2.0",
|
|
2580
2578
|
method: "evaluateTransaction",
|
|
2581
|
-
params: {
|
|
2579
|
+
params: {
|
|
2580
|
+
transaction: { cbor: tx },
|
|
2581
|
+
additionalUtxo: toOgmiosUTxOs(additionalUTxOs)
|
|
2582
|
+
},
|
|
2582
2583
|
id: null
|
|
2583
2584
|
};
|
|
2584
|
-
const
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
if (!response.ok) {
|
|
2596
|
-
const errorBody = await response.text();
|
|
2597
|
-
throw new Error(
|
|
2598
|
-
`Request failed with status ${response.status}: ${errorBody}`
|
|
2599
|
-
);
|
|
2600
|
-
}
|
|
2601
|
-
const result = await response.json();
|
|
2602
|
-
const evalRedeemers = result.result.map((item) => ({
|
|
2585
|
+
const schema = JSONRPCSchema(S5.Array(RedeemerSchema));
|
|
2586
|
+
const result = await (0, import_effect4.pipe)(
|
|
2587
|
+
postWithSchemaValidation(url, body, schema),
|
|
2588
|
+
import_effect4.Effect.flatMap(
|
|
2589
|
+
(response) => "error" in response ? import_effect4.Effect.fail(response) : import_effect4.Effect.succeed(response.result)
|
|
2590
|
+
),
|
|
2591
|
+
import_effect4.Effect.timeout(1e4),
|
|
2592
|
+
import_effect4.Effect.catchAllCause((cause) => new KoiosError({ cause })),
|
|
2593
|
+
import_effect4.Effect.runPromise
|
|
2594
|
+
);
|
|
2595
|
+
const evalRedeemers = result.map((item) => ({
|
|
2603
2596
|
ex_units: {
|
|
2604
2597
|
mem: item.budget.memory,
|
|
2605
2598
|
steps: item.budget.cpu
|
|
@@ -2610,56 +2603,15 @@ var Koios = class {
|
|
|
2610
2603
|
return evalRedeemers;
|
|
2611
2604
|
}
|
|
2612
2605
|
};
|
|
2613
|
-
var toUTxO = (koiosUTxO, address) => ({
|
|
2614
|
-
txHash: koiosUTxO.tx_hash,
|
|
2615
|
-
outputIndex: koiosUTxO.tx_index,
|
|
2616
|
-
assets: (() => {
|
|
2617
|
-
const a = {};
|
|
2618
|
-
if (koiosUTxO.asset_list) {
|
|
2619
|
-
koiosUTxO.asset_list.forEach((am) => {
|
|
2620
|
-
a[am.policy_id + am.asset_name] = BigInt(am.quantity);
|
|
2621
|
-
});
|
|
2622
|
-
}
|
|
2623
|
-
a["lovelace"] = BigInt(koiosUTxO.value);
|
|
2624
|
-
return a;
|
|
2625
|
-
})(),
|
|
2626
|
-
address,
|
|
2627
|
-
datumHash: koiosUTxO.inline_datum ? void 0 : koiosUTxO.datum_hash || void 0,
|
|
2628
|
-
datum: koiosUTxO.inline_datum ? koiosUTxO.inline_datum.bytes : void 0,
|
|
2629
|
-
scriptRef: toScriptRef2(koiosUTxO.reference_script)
|
|
2630
|
-
});
|
|
2631
|
-
var toScriptRef2 = (reference_script) => {
|
|
2632
|
-
if (reference_script && reference_script.bytes && reference_script.type) {
|
|
2633
|
-
switch (reference_script.type) {
|
|
2634
|
-
case "plutusV1":
|
|
2635
|
-
return {
|
|
2636
|
-
type: "PlutusV1",
|
|
2637
|
-
script: (0, import_utils6.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2638
|
-
};
|
|
2639
|
-
case "plutusV2":
|
|
2640
|
-
return {
|
|
2641
|
-
type: "PlutusV2",
|
|
2642
|
-
script: (0, import_utils6.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2643
|
-
};
|
|
2644
|
-
case "plutusV3":
|
|
2645
|
-
return {
|
|
2646
|
-
type: "PlutusV3",
|
|
2647
|
-
script: (0, import_utils6.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2648
|
-
};
|
|
2649
|
-
default:
|
|
2650
|
-
return void 0;
|
|
2651
|
-
}
|
|
2652
|
-
}
|
|
2653
|
-
};
|
|
2654
2606
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2655
2607
|
0 && (module.exports = {
|
|
2656
2608
|
Blockfrost,
|
|
2657
2609
|
Emulator,
|
|
2658
|
-
FetchProvider,
|
|
2659
2610
|
Koios,
|
|
2611
|
+
KoiosError,
|
|
2660
2612
|
Kupmios,
|
|
2661
2613
|
KupmiosError,
|
|
2662
2614
|
Maestro,
|
|
2663
|
-
|
|
2664
|
-
|
|
2615
|
+
generateEmulatorAccount,
|
|
2616
|
+
generateEmulatorAccountFrommPrivateKey
|
|
2665
2617
|
});
|