@lucid-evolution/provider 0.1.76 → 0.1.78
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 +69 -47
- package/dist/index.js +32 -10
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -47,12 +47,12 @@ var CML = __toESM(require("@anastasia-labs/cardano-multiplatform-lib-nodejs"), 1
|
|
|
47
47
|
|
|
48
48
|
// src/blockfrost.ts
|
|
49
49
|
var import_core_utils = require("@lucid-evolution/core-utils");
|
|
50
|
-
var
|
|
50
|
+
var import_utils2 = 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.78",
|
|
56
56
|
description: "",
|
|
57
57
|
main: "./dist/index.js",
|
|
58
58
|
types: "./dist/index.d.ts",
|
|
@@ -102,6 +102,7 @@ var package_default = {
|
|
|
102
102
|
|
|
103
103
|
// src/internal/blockfrost.ts
|
|
104
104
|
var import_effect = require("effect");
|
|
105
|
+
var import_utils = require("@lucid-evolution/utils");
|
|
105
106
|
var toAditionalUTXOs = (utxos) => (utxos || []).map((utxo) => [
|
|
106
107
|
{
|
|
107
108
|
txId: utxo.txHash,
|
|
@@ -122,11 +123,11 @@ var toTxOutScript = (scriptRef) => {
|
|
|
122
123
|
if (scriptRef) {
|
|
123
124
|
switch (scriptRef.type) {
|
|
124
125
|
case "PlutusV1":
|
|
125
|
-
return { "plutus:v1": scriptRef.script };
|
|
126
|
+
return { "plutus:v1": (0, import_utils.applySingleCborEncoding)(scriptRef.script) };
|
|
126
127
|
case "PlutusV2":
|
|
127
|
-
return { "plutus:v2": scriptRef.script };
|
|
128
|
+
return { "plutus:v2": (0, import_utils.applySingleCborEncoding)(scriptRef.script) };
|
|
128
129
|
case "PlutusV3":
|
|
129
|
-
return { "plutus:v3": scriptRef.script };
|
|
130
|
+
return { "plutus:v3": (0, import_utils.applySingleCborEncoding)(scriptRef.script) };
|
|
130
131
|
default:
|
|
131
132
|
return void 0;
|
|
132
133
|
}
|
|
@@ -140,6 +141,16 @@ var fromAssets = (assets) => (0, import_effect.pipe)(
|
|
|
140
141
|
]),
|
|
141
142
|
(r) => import_effect.Record.isEmptyRecord(r) ? void 0 : r
|
|
142
143
|
);
|
|
144
|
+
var fromLegacyRedeemerTag = (redeemerTag) => {
|
|
145
|
+
switch (redeemerTag) {
|
|
146
|
+
case "certificate":
|
|
147
|
+
return "publish";
|
|
148
|
+
case "withdrawal":
|
|
149
|
+
return "withdraw";
|
|
150
|
+
default:
|
|
151
|
+
return redeemerTag;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
143
154
|
|
|
144
155
|
// src/blockfrost.ts
|
|
145
156
|
var Blockfrost = class {
|
|
@@ -365,21 +376,21 @@ var Blockfrost = class {
|
|
|
365
376
|
`${this.url}/scripts/${r.reference_script_hash}/json`,
|
|
366
377
|
{ headers: { project_id: this.projectId, lucid } }
|
|
367
378
|
).then((res) => res.json());
|
|
368
|
-
return (0,
|
|
379
|
+
return (0, import_utils2.scriptFromNative)(native);
|
|
369
380
|
case "plutusV1":
|
|
370
381
|
return {
|
|
371
382
|
type: "PlutusV1",
|
|
372
|
-
script: (0,
|
|
383
|
+
script: (0, import_utils2.applyDoubleCborEncoding)(script)
|
|
373
384
|
};
|
|
374
385
|
case "plutusV2":
|
|
375
386
|
return {
|
|
376
387
|
type: "PlutusV2",
|
|
377
|
-
script: (0,
|
|
388
|
+
script: (0, import_utils2.applyDoubleCborEncoding)(script)
|
|
378
389
|
};
|
|
379
390
|
case "plutusV3":
|
|
380
391
|
return {
|
|
381
392
|
type: "PlutusV3",
|
|
382
|
-
script: (0,
|
|
393
|
+
script: (0, import_utils2.applyDoubleCborEncoding)(script)
|
|
383
394
|
};
|
|
384
395
|
}
|
|
385
396
|
})() : void 0
|
|
@@ -419,7 +430,9 @@ var Blockfrost = class {
|
|
|
419
430
|
([redeemerPointer, data]) => {
|
|
420
431
|
const [pTag, pIndex] = redeemerPointer.split(":");
|
|
421
432
|
evalRedeemers.push({
|
|
422
|
-
redeemer_tag:
|
|
433
|
+
redeemer_tag: fromLegacyRedeemerTag(
|
|
434
|
+
pTag
|
|
435
|
+
),
|
|
423
436
|
redeemer_index: Number(pIndex),
|
|
424
437
|
ex_units: { mem: Number(data.memory), steps: Number(data.steps) }
|
|
425
438
|
});
|
|
@@ -438,7 +451,7 @@ var handleRateLimit = async (count) => {
|
|
|
438
451
|
var lucid = package_default.version;
|
|
439
452
|
|
|
440
453
|
// src/kupmios.ts
|
|
441
|
-
var
|
|
454
|
+
var import_utils4 = require("@lucid-evolution/utils");
|
|
442
455
|
var S3 = __toESM(require("@effect/schema/Schema"), 1);
|
|
443
456
|
var import_effect2 = require("effect");
|
|
444
457
|
var import_platform = require("@effect/platform");
|
|
@@ -446,7 +459,7 @@ var import_schema = require("@effect/schema");
|
|
|
446
459
|
|
|
447
460
|
// src/internal/ogmios.ts
|
|
448
461
|
var S = __toESM(require("@effect/schema/Schema"), 1);
|
|
449
|
-
var
|
|
462
|
+
var import_utils3 = require("@lucid-evolution/utils");
|
|
450
463
|
var JSONRPCSchema = (schema) => S.extend(
|
|
451
464
|
S.Struct({
|
|
452
465
|
jsonrpc: S.String,
|
|
@@ -574,11 +587,20 @@ var toOgmiosUTxOs = (utxos) => {
|
|
|
574
587
|
if (scriptRef) {
|
|
575
588
|
switch (scriptRef.type) {
|
|
576
589
|
case "PlutusV1":
|
|
577
|
-
return {
|
|
590
|
+
return {
|
|
591
|
+
language: "plutus:v1",
|
|
592
|
+
cbor: (0, import_utils3.applySingleCborEncoding)(scriptRef.script)
|
|
593
|
+
};
|
|
578
594
|
case "PlutusV2":
|
|
579
|
-
return {
|
|
595
|
+
return {
|
|
596
|
+
language: "plutus:v2",
|
|
597
|
+
cbor: (0, import_utils3.applySingleCborEncoding)(scriptRef.script)
|
|
598
|
+
};
|
|
580
599
|
case "PlutusV3":
|
|
581
|
-
return {
|
|
600
|
+
return {
|
|
601
|
+
language: "plutus:v3",
|
|
602
|
+
cbor: (0, import_utils3.applySingleCborEncoding)(scriptRef.script)
|
|
603
|
+
};
|
|
582
604
|
default:
|
|
583
605
|
return null;
|
|
584
606
|
}
|
|
@@ -588,7 +610,7 @@ var toOgmiosUTxOs = (utxos) => {
|
|
|
588
610
|
const newAssets = {};
|
|
589
611
|
Object.entries(assets).forEach(([unit, amount]) => {
|
|
590
612
|
if (unit == "lovelace") return;
|
|
591
|
-
const { policyId, assetName } = (0,
|
|
613
|
+
const { policyId, assetName } = (0, import_utils3.fromUnit)(unit);
|
|
592
614
|
if (!newAssets[policyId]) {
|
|
593
615
|
newAssets[policyId] = {};
|
|
594
616
|
}
|
|
@@ -709,7 +731,7 @@ var Kupmios = class {
|
|
|
709
731
|
async getUtxosWithUnit(addressOrCredential, unit) {
|
|
710
732
|
const isAddress = typeof addressOrCredential === "string";
|
|
711
733
|
const queryPredicate = isAddress ? addressOrCredential : addressOrCredential.hash;
|
|
712
|
-
const { policyId, assetName } = (0,
|
|
734
|
+
const { policyId, assetName } = (0, import_utils4.fromUnit)(unit);
|
|
713
735
|
const pattern = `${this.kupoUrl}/matches/${queryPredicate}${isAddress ? "" : "/*"}?unspent&policy_id=${policyId}${assetName ? `&asset_name=${assetName}` : ""}`;
|
|
714
736
|
const schema = S3.Array(UTxOSchema);
|
|
715
737
|
const program = fetchKupoParse(pattern, schema).pipe(
|
|
@@ -721,7 +743,7 @@ var Kupmios = class {
|
|
|
721
743
|
return utxos;
|
|
722
744
|
}
|
|
723
745
|
async getUtxoByUnit(unit) {
|
|
724
|
-
const { policyId, assetName } = (0,
|
|
746
|
+
const { policyId, assetName } = (0, import_utils4.fromUnit)(unit);
|
|
725
747
|
const pattern = `${this.kupoUrl}/matches/${policyId}.${assetName ? `${assetName}` : "*"}?unspent`;
|
|
726
748
|
const schema = S3.Array(UTxOSchema);
|
|
727
749
|
const program = fetchKupoParse(pattern, schema).pipe(
|
|
@@ -896,17 +918,17 @@ var getScriptEffect = (kupoUrl, script_hash) => import_effect2.Effect.gen(functi
|
|
|
896
918
|
case "plutus:v1":
|
|
897
919
|
return {
|
|
898
920
|
type: "PlutusV1",
|
|
899
|
-
script: (0,
|
|
921
|
+
script: (0, import_utils4.applyDoubleCborEncoding)(script)
|
|
900
922
|
};
|
|
901
923
|
case "plutus:v2":
|
|
902
924
|
return {
|
|
903
925
|
type: "PlutusV2",
|
|
904
|
-
script: (0,
|
|
926
|
+
script: (0, import_utils4.applyDoubleCborEncoding)(script)
|
|
905
927
|
};
|
|
906
928
|
case "plutus:v3":
|
|
907
929
|
return {
|
|
908
930
|
type: "PlutusV3",
|
|
909
|
-
script: (0,
|
|
931
|
+
script: (0, import_utils4.applyDoubleCborEncoding)(script)
|
|
910
932
|
};
|
|
911
933
|
}
|
|
912
934
|
})
|
|
@@ -1013,8 +1035,8 @@ var kupmiosUtxosToUtxos = (kupoURL, utxos) => import_effect2.Effect.forEach(
|
|
|
1013
1035
|
);
|
|
1014
1036
|
|
|
1015
1037
|
// src/emulator.ts
|
|
1016
|
-
var import_utils4 = require("@lucid-evolution/utils");
|
|
1017
1038
|
var import_utils5 = require("@lucid-evolution/utils");
|
|
1039
|
+
var import_utils6 = require("@lucid-evolution/utils");
|
|
1018
1040
|
var import_core_utils2 = require("@lucid-evolution/core-utils");
|
|
1019
1041
|
var import_wallet = require("@lucid-evolution/wallet");
|
|
1020
1042
|
async function generateEmulatorAccountFrommPrivateKey(assets) {
|
|
@@ -1033,7 +1055,7 @@ async function generateEmulatorAccountFrommPrivateKey(assets) {
|
|
|
1033
1055
|
};
|
|
1034
1056
|
}
|
|
1035
1057
|
function generateEmulatorAccount(assets) {
|
|
1036
|
-
const seedPhrase = (0,
|
|
1058
|
+
const seedPhrase = (0, import_utils5.generateSeedPhrase)();
|
|
1037
1059
|
return {
|
|
1038
1060
|
seedPhrase,
|
|
1039
1061
|
address: (0, import_wallet.walletFromSeed)(seedPhrase, {
|
|
@@ -1058,7 +1080,7 @@ var Emulator = class {
|
|
|
1058
1080
|
time;
|
|
1059
1081
|
protocolParameters;
|
|
1060
1082
|
datumTable = {};
|
|
1061
|
-
constructor(accounts, protocolParameters =
|
|
1083
|
+
constructor(accounts, protocolParameters = import_utils5.PROTOCOL_PARAMETERS_DEFAULT) {
|
|
1062
1084
|
const GENESIS_HASH = "00".repeat(32);
|
|
1063
1085
|
this.blockHeight = 0;
|
|
1064
1086
|
this.slot = 0;
|
|
@@ -1124,7 +1146,7 @@ var Emulator = class {
|
|
|
1124
1146
|
if (typeof addressOrCredential === "string") {
|
|
1125
1147
|
return addressOrCredential === utxo.address ? utxo : [];
|
|
1126
1148
|
} else {
|
|
1127
|
-
const { paymentCredential } = (0,
|
|
1149
|
+
const { paymentCredential } = (0, import_utils6.getAddressDetails)(utxo.address);
|
|
1128
1150
|
return paymentCredential?.hash === addressOrCredential.hash ? utxo : [];
|
|
1129
1151
|
}
|
|
1130
1152
|
});
|
|
@@ -1141,7 +1163,7 @@ var Emulator = class {
|
|
|
1141
1163
|
if (typeof addressOrCredential === "string") {
|
|
1142
1164
|
return addressOrCredential === utxo.address && utxo.assets[unit] > 0n ? utxo : [];
|
|
1143
1165
|
} else {
|
|
1144
|
-
const { paymentCredential } = (0,
|
|
1166
|
+
const { paymentCredential } = (0, import_utils6.getAddressDetails)(utxo.address);
|
|
1145
1167
|
return paymentCredential?.hash === addressOrCredential.hash && utxo.assets[unit] > 0n ? utxo : [];
|
|
1146
1168
|
}
|
|
1147
1169
|
});
|
|
@@ -1476,7 +1498,7 @@ It does not exist or was already spent.`
|
|
|
1476
1498
|
It does not exist or was already spent.`
|
|
1477
1499
|
);
|
|
1478
1500
|
}
|
|
1479
|
-
const { paymentCredential } = (0,
|
|
1501
|
+
const { paymentCredential } = (0, import_utils6.getAddressDetails)(entry.utxo.address);
|
|
1480
1502
|
if (paymentCredential?.type === "Script") {
|
|
1481
1503
|
throw new Error("Collateral inputs can only contain vkeys.");
|
|
1482
1504
|
}
|
|
@@ -1497,7 +1519,7 @@ It does not exist or was already spent.`
|
|
|
1497
1519
|
body.withdrawals().get(rawAddress).toString()
|
|
1498
1520
|
);
|
|
1499
1521
|
const rewardAddress = rawAddress.to_address().to_bech32(void 0);
|
|
1500
|
-
const { stakeCredential } = (0,
|
|
1522
|
+
const { stakeCredential } = (0, import_utils6.getAddressDetails)(rewardAddress);
|
|
1501
1523
|
checkAndConsumeHash(stakeCredential, "Reward", index);
|
|
1502
1524
|
if (this.chain[rewardAddress]?.delegation.rewards !== withdrawal) {
|
|
1503
1525
|
throw new Error(
|
|
@@ -1530,7 +1552,7 @@ It does not exist or was already spent.`
|
|
|
1530
1552
|
CML.NetworkInfo.testnet().network_id(),
|
|
1531
1553
|
deregistration.stake_credential()
|
|
1532
1554
|
).to_address().to_bech32(void 0);
|
|
1533
|
-
const { stakeCredential } = (0,
|
|
1555
|
+
const { stakeCredential } = (0, import_utils6.getAddressDetails)(rewardAddress);
|
|
1534
1556
|
checkAndConsumeHash(stakeCredential, "Cert", index);
|
|
1535
1557
|
if (!this.chain[rewardAddress]?.registeredStake) {
|
|
1536
1558
|
throw new Error(
|
|
@@ -1547,7 +1569,7 @@ It does not exist or was already spent.`
|
|
|
1547
1569
|
delegation.stake_credential()
|
|
1548
1570
|
).to_address().to_bech32(void 0);
|
|
1549
1571
|
const poolId = delegation.pool().to_bech32("pool");
|
|
1550
|
-
const { stakeCredential } = (0,
|
|
1572
|
+
const { stakeCredential } = (0, import_utils6.getAddressDetails)(rewardAddress);
|
|
1551
1573
|
checkAndConsumeHash(stakeCredential, "Cert", index);
|
|
1552
1574
|
if (!this.chain[rewardAddress]?.registeredStake && !certRequests.find(
|
|
1553
1575
|
(request) => request.type === "Registration" && request.rewardAddress === rewardAddress
|
|
@@ -1562,7 +1584,7 @@ It does not exist or was already spent.`
|
|
|
1562
1584
|
}
|
|
1563
1585
|
}
|
|
1564
1586
|
resolvedInputs.forEach(({ entry: { utxo } }, index) => {
|
|
1565
|
-
const { paymentCredential } = (0,
|
|
1587
|
+
const { paymentCredential } = (0, import_utils6.getAddressDetails)(utxo.address);
|
|
1566
1588
|
checkAndConsumeHash(paymentCredential, "Spend", index);
|
|
1567
1589
|
});
|
|
1568
1590
|
const outputs = (() => {
|
|
@@ -1576,7 +1598,7 @@ It does not exist or was already spent.`
|
|
|
1576
1598
|
),
|
|
1577
1599
|
output
|
|
1578
1600
|
);
|
|
1579
|
-
const utxo = (0,
|
|
1601
|
+
const utxo = (0, import_utils6.coreToUtxo)(unspentOutput);
|
|
1580
1602
|
if (utxo.datumHash) consumedHashes.add(utxo.datumHash);
|
|
1581
1603
|
collected.push({
|
|
1582
1604
|
utxo,
|
|
@@ -1673,7 +1695,7 @@ It does not exist or was already spent.`
|
|
|
1673
1695
|
steps: Number(legacyRedeemer.ex_units().steps())
|
|
1674
1696
|
},
|
|
1675
1697
|
redeemer_index: Number(legacyRedeemer.index()),
|
|
1676
|
-
redeemer_tag: (0,
|
|
1698
|
+
redeemer_tag: (0, import_utils5.fromCMLRedeemerTag)(legacyRedeemer.tag())
|
|
1677
1699
|
});
|
|
1678
1700
|
}
|
|
1679
1701
|
return evalRedeemers;
|
|
@@ -1691,7 +1713,7 @@ It does not exist or was already spent.`
|
|
|
1691
1713
|
steps: Number(redeemerVal.ex_units().steps())
|
|
1692
1714
|
},
|
|
1693
1715
|
redeemer_index: Number(key.index),
|
|
1694
|
-
redeemer_tag: (0,
|
|
1716
|
+
redeemer_tag: (0, import_utils5.fromCMLRedeemerTag)(key.tag())
|
|
1695
1717
|
});
|
|
1696
1718
|
}
|
|
1697
1719
|
}
|
|
@@ -1767,7 +1789,7 @@ ${"\u2581".repeat(60)}
|
|
|
1767
1789
|
};
|
|
1768
1790
|
|
|
1769
1791
|
// src/maestro.ts
|
|
1770
|
-
var
|
|
1792
|
+
var import_utils7 = require("@lucid-evolution/utils");
|
|
1771
1793
|
var import_core_utils3 = require("@lucid-evolution/core-utils");
|
|
1772
1794
|
var Maestro = class {
|
|
1773
1795
|
url;
|
|
@@ -2034,7 +2056,7 @@ var Maestro = class {
|
|
|
2034
2056
|
const additionalMaestroUTxOs = (additionalUTxOs || []).map((utxo) => ({
|
|
2035
2057
|
tx_hash: utxo.txHash,
|
|
2036
2058
|
index: utxo.outputIndex,
|
|
2037
|
-
txout_cbor: (0,
|
|
2059
|
+
txout_cbor: (0, import_utils7.utxoToCore)(utxo).output().to_cbor_hex()
|
|
2038
2060
|
}));
|
|
2039
2061
|
const payload = {
|
|
2040
2062
|
cbor: tx,
|
|
@@ -2062,21 +2084,21 @@ var toScriptRef = (reference_script) => {
|
|
|
2062
2084
|
if (reference_script && reference_script.bytes) {
|
|
2063
2085
|
switch (reference_script.type) {
|
|
2064
2086
|
case "native":
|
|
2065
|
-
return (0,
|
|
2087
|
+
return (0, import_utils7.scriptFromNative)(reference_script.json);
|
|
2066
2088
|
case "plutusv1":
|
|
2067
2089
|
return {
|
|
2068
2090
|
type: "PlutusV1",
|
|
2069
|
-
script: (0,
|
|
2091
|
+
script: (0, import_utils7.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2070
2092
|
};
|
|
2071
2093
|
case "plutusv2":
|
|
2072
2094
|
return {
|
|
2073
2095
|
type: "PlutusV2",
|
|
2074
|
-
script: (0,
|
|
2096
|
+
script: (0, import_utils7.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2075
2097
|
};
|
|
2076
2098
|
case "plutusv3":
|
|
2077
2099
|
return {
|
|
2078
2100
|
type: "PlutusV3",
|
|
2079
|
-
script: (0,
|
|
2101
|
+
script: (0, import_utils7.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2080
2102
|
};
|
|
2081
2103
|
default:
|
|
2082
2104
|
return void 0;
|
|
@@ -2088,13 +2110,13 @@ var lucid2 = package_default.version;
|
|
|
2088
2110
|
// src/koios.ts
|
|
2089
2111
|
var S5 = __toESM(require("@effect/schema/Schema"), 1);
|
|
2090
2112
|
var import_core_utils4 = require("@lucid-evolution/core-utils");
|
|
2091
|
-
var
|
|
2113
|
+
var import_utils9 = require("@lucid-evolution/utils");
|
|
2092
2114
|
|
|
2093
2115
|
// src/internal/koios.ts
|
|
2094
2116
|
var import_platform2 = require("@effect/platform");
|
|
2095
2117
|
var S4 = __toESM(require("@effect/schema/Schema"), 1);
|
|
2096
2118
|
var import_effect3 = require("effect");
|
|
2097
|
-
var
|
|
2119
|
+
var import_utils8 = require("@lucid-evolution/utils");
|
|
2098
2120
|
var ProtocolParametersSchema2 = S4.Struct({
|
|
2099
2121
|
pvt_motion_no_confidence: S4.Number,
|
|
2100
2122
|
pvt_committee_normal: S4.Number,
|
|
@@ -2321,7 +2343,7 @@ var DatumInfo = S4.Struct({
|
|
|
2321
2343
|
var postWithSchemaValidation = (url, data, schema) => (0, import_effect3.pipe)(
|
|
2322
2344
|
import_platform2.HttpClientRequest.post(url),
|
|
2323
2345
|
import_platform2.HttpClientRequest.jsonBody(data),
|
|
2324
|
-
import_effect3.Effect.flatMap(import_platform2.HttpClient.
|
|
2346
|
+
import_effect3.Effect.flatMap(import_platform2.HttpClient.fetch),
|
|
2325
2347
|
import_platform2.HttpClientResponse.json,
|
|
2326
2348
|
import_effect3.Effect.flatMap(S4.decodeUnknown(schema))
|
|
2327
2349
|
// Effect.scoped
|
|
@@ -2356,17 +2378,17 @@ var toScriptRef2 = (reference_script) => {
|
|
|
2356
2378
|
case "plutusV1":
|
|
2357
2379
|
return {
|
|
2358
2380
|
type: "PlutusV1",
|
|
2359
|
-
script: (0,
|
|
2381
|
+
script: (0, import_utils8.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2360
2382
|
};
|
|
2361
2383
|
case "plutusV2":
|
|
2362
2384
|
return {
|
|
2363
2385
|
type: "PlutusV2",
|
|
2364
|
-
script: (0,
|
|
2386
|
+
script: (0, import_utils8.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2365
2387
|
};
|
|
2366
2388
|
case "plutusV3":
|
|
2367
2389
|
return {
|
|
2368
2390
|
type: "PlutusV3",
|
|
2369
|
-
script: (0,
|
|
2391
|
+
script: (0, import_utils8.applyDoubleCborEncoding)(reference_script.bytes)
|
|
2370
2392
|
};
|
|
2371
2393
|
default:
|
|
2372
2394
|
return void 0;
|
|
@@ -2476,7 +2498,7 @@ var Koios = class {
|
|
|
2476
2498
|
return result;
|
|
2477
2499
|
}
|
|
2478
2500
|
async getUtxoByUnit(unit) {
|
|
2479
|
-
let { policyId, assetName } = (0,
|
|
2501
|
+
let { policyId, assetName } = (0, import_utils9.fromUnit)(unit);
|
|
2480
2502
|
const url = `${this.baseUrl}/asset_addresses?_asset_policy=${policyId}&_asset_name=${assetName}`;
|
|
2481
2503
|
const result = await (0, import_effect4.pipe)(
|
|
2482
2504
|
getWithSchemaValidation(url, S5.Array(AssetAddressSchema)),
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@lucid-evolution/provider",
|
|
14
|
-
version: "0.1.
|
|
14
|
+
version: "0.1.78",
|
|
15
15
|
description: "",
|
|
16
16
|
main: "./dist/index.js",
|
|
17
17
|
types: "./dist/index.d.ts",
|
|
@@ -61,6 +61,7 @@ var package_default = {
|
|
|
61
61
|
|
|
62
62
|
// src/internal/blockfrost.ts
|
|
63
63
|
import { pipe, Record } from "effect";
|
|
64
|
+
import { applySingleCborEncoding } from "@lucid-evolution/utils";
|
|
64
65
|
var toAditionalUTXOs = (utxos) => (utxos || []).map((utxo) => [
|
|
65
66
|
{
|
|
66
67
|
txId: utxo.txHash,
|
|
@@ -81,11 +82,11 @@ var toTxOutScript = (scriptRef) => {
|
|
|
81
82
|
if (scriptRef) {
|
|
82
83
|
switch (scriptRef.type) {
|
|
83
84
|
case "PlutusV1":
|
|
84
|
-
return { "plutus:v1": scriptRef.script };
|
|
85
|
+
return { "plutus:v1": applySingleCborEncoding(scriptRef.script) };
|
|
85
86
|
case "PlutusV2":
|
|
86
|
-
return { "plutus:v2": scriptRef.script };
|
|
87
|
+
return { "plutus:v2": applySingleCborEncoding(scriptRef.script) };
|
|
87
88
|
case "PlutusV3":
|
|
88
|
-
return { "plutus:v3": scriptRef.script };
|
|
89
|
+
return { "plutus:v3": applySingleCborEncoding(scriptRef.script) };
|
|
89
90
|
default:
|
|
90
91
|
return void 0;
|
|
91
92
|
}
|
|
@@ -99,6 +100,16 @@ var fromAssets = (assets) => pipe(
|
|
|
99
100
|
]),
|
|
100
101
|
(r) => Record.isEmptyRecord(r) ? void 0 : r
|
|
101
102
|
);
|
|
103
|
+
var fromLegacyRedeemerTag = (redeemerTag) => {
|
|
104
|
+
switch (redeemerTag) {
|
|
105
|
+
case "certificate":
|
|
106
|
+
return "publish";
|
|
107
|
+
case "withdrawal":
|
|
108
|
+
return "withdraw";
|
|
109
|
+
default:
|
|
110
|
+
return redeemerTag;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
102
113
|
|
|
103
114
|
// src/blockfrost.ts
|
|
104
115
|
var Blockfrost = class {
|
|
@@ -378,7 +389,9 @@ var Blockfrost = class {
|
|
|
378
389
|
([redeemerPointer, data]) => {
|
|
379
390
|
const [pTag, pIndex] = redeemerPointer.split(":");
|
|
380
391
|
evalRedeemers.push({
|
|
381
|
-
redeemer_tag:
|
|
392
|
+
redeemer_tag: fromLegacyRedeemerTag(
|
|
393
|
+
pTag
|
|
394
|
+
),
|
|
382
395
|
redeemer_index: Number(pIndex),
|
|
383
396
|
ex_units: { mem: Number(data.memory), steps: Number(data.steps) }
|
|
384
397
|
});
|
|
@@ -409,7 +422,7 @@ import { ArrayFormatter } from "@effect/schema";
|
|
|
409
422
|
|
|
410
423
|
// src/internal/ogmios.ts
|
|
411
424
|
import * as S from "@effect/schema/Schema";
|
|
412
|
-
import { fromUnit } from "@lucid-evolution/utils";
|
|
425
|
+
import { applySingleCborEncoding as applySingleCborEncoding2, fromUnit } from "@lucid-evolution/utils";
|
|
413
426
|
var JSONRPCSchema = (schema) => S.extend(
|
|
414
427
|
S.Struct({
|
|
415
428
|
jsonrpc: S.String,
|
|
@@ -537,11 +550,20 @@ var toOgmiosUTxOs = (utxos) => {
|
|
|
537
550
|
if (scriptRef) {
|
|
538
551
|
switch (scriptRef.type) {
|
|
539
552
|
case "PlutusV1":
|
|
540
|
-
return {
|
|
553
|
+
return {
|
|
554
|
+
language: "plutus:v1",
|
|
555
|
+
cbor: applySingleCborEncoding2(scriptRef.script)
|
|
556
|
+
};
|
|
541
557
|
case "PlutusV2":
|
|
542
|
-
return {
|
|
558
|
+
return {
|
|
559
|
+
language: "plutus:v2",
|
|
560
|
+
cbor: applySingleCborEncoding2(scriptRef.script)
|
|
561
|
+
};
|
|
543
562
|
case "PlutusV3":
|
|
544
|
-
return {
|
|
563
|
+
return {
|
|
564
|
+
language: "plutus:v3",
|
|
565
|
+
cbor: applySingleCborEncoding2(scriptRef.script)
|
|
566
|
+
};
|
|
545
567
|
default:
|
|
546
568
|
return null;
|
|
547
569
|
}
|
|
@@ -2296,7 +2318,7 @@ var DatumInfo = S4.Struct({
|
|
|
2296
2318
|
var postWithSchemaValidation = (url, data, schema) => pipe3(
|
|
2297
2319
|
HttpClientRequest2.post(url),
|
|
2298
2320
|
HttpClientRequest2.jsonBody(data),
|
|
2299
|
-
Effect2.flatMap(HttpClient2.
|
|
2321
|
+
Effect2.flatMap(HttpClient2.fetch),
|
|
2300
2322
|
HttpClientResponse2.json,
|
|
2301
2323
|
Effect2.flatMap(S4.decodeUnknown(schema))
|
|
2302
2324
|
// Effect.scoped
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-evolution/provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.78",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"effect": "^3.10.4",
|
|
33
33
|
"@lucid-evolution/core-types": "0.1.21",
|
|
34
34
|
"@lucid-evolution/core-utils": "0.1.16",
|
|
35
|
-
"@lucid-evolution/utils": "0.1.
|
|
36
|
-
"@lucid-evolution/wallet": "0.1.
|
|
35
|
+
"@lucid-evolution/utils": "0.1.59",
|
|
36
|
+
"@lucid-evolution/wallet": "0.1.65"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^20.12.8",
|