@lucid-evolution/utils 0.1.46 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -48,6 +48,7 @@ __export(src_exports, {
48
48
  credentialToRewardAddress: () => credentialToRewardAddress,
49
49
  datumJsonToCbor: () => datumJsonToCbor,
50
50
  datumToHash: () => datumToHash,
51
+ fromCMLRedeemerTag: () => fromCMLRedeemerTag,
51
52
  fromLabel: () => fromLabel,
52
53
  fromScriptRef: () => fromScriptRef,
53
54
  fromUnit: () => fromUnit,
@@ -72,6 +73,7 @@ __export(src_exports, {
72
73
  stakeCredentialOf: () => stakeCredentialOf,
73
74
  stringify: () => stringify,
74
75
  toCMLNativeScript: () => toCMLNativeScript,
76
+ toCMLRedeemerTag: () => toCMLRedeemerTag,
75
77
  toLabel: () => toLabel,
76
78
  toPublicKey: () => toPublicKey,
77
79
  toScriptRef: () => toScriptRef,
@@ -1562,6 +1564,44 @@ var stringify = (data) => JSON.stringify(
1562
1564
  (key, value) => typeof value === "bigint" ? value.toString() + "n" : value,
1563
1565
  2
1564
1566
  );
1567
+
1568
+ // src/redeemer.ts
1569
+ var toCMLRedeemerTag = (tag) => {
1570
+ switch (tag) {
1571
+ case "spend":
1572
+ return CML.RedeemerTag.Spend;
1573
+ case "mint":
1574
+ return CML.RedeemerTag.Mint;
1575
+ case "publish":
1576
+ return CML.RedeemerTag.Cert;
1577
+ case "withdraw":
1578
+ return CML.RedeemerTag.Reward;
1579
+ case "vote":
1580
+ return CML.RedeemerTag.Voting;
1581
+ case "propose":
1582
+ return CML.RedeemerTag.Proposing;
1583
+ default:
1584
+ throw new Error(`Exhaustive check failed: Unhandled case ${tag}`);
1585
+ }
1586
+ };
1587
+ var fromCMLRedeemerTag = (tag) => {
1588
+ switch (tag) {
1589
+ case CML.RedeemerTag.Spend:
1590
+ return "spend";
1591
+ case CML.RedeemerTag.Mint:
1592
+ return "mint";
1593
+ case CML.RedeemerTag.Cert:
1594
+ return "publish";
1595
+ case CML.RedeemerTag.Reward:
1596
+ return "withdraw";
1597
+ case CML.RedeemerTag.Voting:
1598
+ return "vote";
1599
+ case CML.RedeemerTag.Proposing:
1600
+ return "propose";
1601
+ default:
1602
+ throw new Error(`Exhaustive check failed: Unhandled case ${tag}`);
1603
+ }
1604
+ };
1565
1605
  // Annotate the CommonJS export names for ESM import in node:
1566
1606
  0 && (module.exports = {
1567
1607
  PROTOCOL_PARAMETERS_DEFAULT,
@@ -1582,6 +1622,7 @@ var stringify = (data) => JSON.stringify(
1582
1622
  credentialToRewardAddress,
1583
1623
  datumJsonToCbor,
1584
1624
  datumToHash,
1625
+ fromCMLRedeemerTag,
1585
1626
  fromLabel,
1586
1627
  fromScriptRef,
1587
1628
  fromUnit,
@@ -1606,6 +1647,7 @@ var stringify = (data) => JSON.stringify(
1606
1647
  stakeCredentialOf,
1607
1648
  stringify,
1608
1649
  toCMLNativeScript,
1650
+ toCMLRedeemerTag,
1609
1651
  toLabel,
1610
1652
  toPublicKey,
1611
1653
  toScriptRef,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _effect_schema_AST from '@effect/schema/AST';
2
- import { Native, Script, Network, Credential, RewardAddress, CertificateValidator, WithdrawalValidator, AddressDetails, DatumJson, Datum, CostModels, ProtocolParameters, Address, ScriptHash, KeyHash, DatumHash, PrivateKey, PublicKey, SpendingValidator, Validator, MintingPolicy, PolicyId, Exact, UnixTime, Slot, UTxO, OutRef, TxOutput, Assets, Unit } from '@lucid-evolution/core-types';
2
+ import { Native, Script, Network, Credential, RewardAddress, CertificateValidator, WithdrawalValidator, AddressDetails, DatumJson, Datum, CostModels, ProtocolParameters, Address, ScriptHash, KeyHash, DatumHash, PrivateKey, PublicKey, SpendingValidator, Validator, MintingPolicy, PolicyId, Exact, UnixTime, Slot, UTxO, OutRef, TxOutput, Assets, Unit, RedeemerTag } from '@lucid-evolution/core-types';
3
3
  import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
4
4
  import { Data } from '@lucid-evolution/plutus';
5
5
 
@@ -190,4 +190,7 @@ declare const sortCanonical: (assets: Assets) => Assets;
190
190
 
191
191
  declare const stringify: (data: any) => string;
192
192
 
193
- export { type CMLNative, PROTOCOL_PARAMETERS_DEFAULT, type SortOrder, addAssets, addressFromHexOrBech32, applyDoubleCborEncoding, applyParamsToScript, assetsToValue, calculateMinLovelaceFromUTxO, coreToOutRef, coreToTxOutput, coreToUtxo, coresToOutRefs, coresToTxOutputs, coresToUtxos, createCostModels, credentialToAddress, credentialToRewardAddress, datumJsonToCbor, datumToHash, fromLabel, fromScriptRef, fromUnit, generatePrivateKey, generateSeedPhrase, getAddressDetails, getInputIndices, getUniqueTokenName, isEqualUTxO, keyHashToCredential, mintingPolicyToId, networkToId, parseCMLNative, paymentCredentialOf, scriptFromCMLNative, scriptFromNative, scriptHashToCredential, selectUTxOs, slotToUnixTime, sortCanonical, sortUTxOs, stakeCredentialOf, stringify, toCMLNativeScript, toLabel, toPublicKey, toScriptRef, toUnit, unixTimeToSlot, utxoToCore, utxoToTransactionInput, utxoToTransactionOutput, utxosToCores, validatorToAddress, validatorToRewardAddress, validatorToScriptHash, valueToAssets };
193
+ declare const toCMLRedeemerTag: (tag: string) => CML.RedeemerTag;
194
+ declare const fromCMLRedeemerTag: (tag: CML.RedeemerTag) => RedeemerTag;
195
+
196
+ export { type CMLNative, PROTOCOL_PARAMETERS_DEFAULT, type SortOrder, addAssets, addressFromHexOrBech32, applyDoubleCborEncoding, applyParamsToScript, assetsToValue, calculateMinLovelaceFromUTxO, coreToOutRef, coreToTxOutput, coreToUtxo, coresToOutRefs, coresToTxOutputs, coresToUtxos, createCostModels, credentialToAddress, credentialToRewardAddress, datumJsonToCbor, datumToHash, fromCMLRedeemerTag, fromLabel, fromScriptRef, fromUnit, generatePrivateKey, generateSeedPhrase, getAddressDetails, getInputIndices, getUniqueTokenName, isEqualUTxO, keyHashToCredential, mintingPolicyToId, networkToId, parseCMLNative, paymentCredentialOf, scriptFromCMLNative, scriptFromNative, scriptHashToCredential, selectUTxOs, slotToUnixTime, sortCanonical, sortUTxOs, stakeCredentialOf, stringify, toCMLNativeScript, toCMLRedeemerTag, toLabel, toPublicKey, toScriptRef, toUnit, unixTimeToSlot, utxoToCore, utxoToTransactionInput, utxoToTransactionOutput, utxosToCores, validatorToAddress, validatorToRewardAddress, validatorToScriptHash, valueToAssets };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _effect_schema_AST from '@effect/schema/AST';
2
- import { Native, Script, Network, Credential, RewardAddress, CertificateValidator, WithdrawalValidator, AddressDetails, DatumJson, Datum, CostModels, ProtocolParameters, Address, ScriptHash, KeyHash, DatumHash, PrivateKey, PublicKey, SpendingValidator, Validator, MintingPolicy, PolicyId, Exact, UnixTime, Slot, UTxO, OutRef, TxOutput, Assets, Unit } from '@lucid-evolution/core-types';
2
+ import { Native, Script, Network, Credential, RewardAddress, CertificateValidator, WithdrawalValidator, AddressDetails, DatumJson, Datum, CostModels, ProtocolParameters, Address, ScriptHash, KeyHash, DatumHash, PrivateKey, PublicKey, SpendingValidator, Validator, MintingPolicy, PolicyId, Exact, UnixTime, Slot, UTxO, OutRef, TxOutput, Assets, Unit, RedeemerTag } from '@lucid-evolution/core-types';
3
3
  import * as CML from '@anastasia-labs/cardano-multiplatform-lib-nodejs';
4
4
  import { Data } from '@lucid-evolution/plutus';
5
5
 
@@ -190,4 +190,7 @@ declare const sortCanonical: (assets: Assets) => Assets;
190
190
 
191
191
  declare const stringify: (data: any) => string;
192
192
 
193
- export { type CMLNative, PROTOCOL_PARAMETERS_DEFAULT, type SortOrder, addAssets, addressFromHexOrBech32, applyDoubleCborEncoding, applyParamsToScript, assetsToValue, calculateMinLovelaceFromUTxO, coreToOutRef, coreToTxOutput, coreToUtxo, coresToOutRefs, coresToTxOutputs, coresToUtxos, createCostModels, credentialToAddress, credentialToRewardAddress, datumJsonToCbor, datumToHash, fromLabel, fromScriptRef, fromUnit, generatePrivateKey, generateSeedPhrase, getAddressDetails, getInputIndices, getUniqueTokenName, isEqualUTxO, keyHashToCredential, mintingPolicyToId, networkToId, parseCMLNative, paymentCredentialOf, scriptFromCMLNative, scriptFromNative, scriptHashToCredential, selectUTxOs, slotToUnixTime, sortCanonical, sortUTxOs, stakeCredentialOf, stringify, toCMLNativeScript, toLabel, toPublicKey, toScriptRef, toUnit, unixTimeToSlot, utxoToCore, utxoToTransactionInput, utxoToTransactionOutput, utxosToCores, validatorToAddress, validatorToRewardAddress, validatorToScriptHash, valueToAssets };
193
+ declare const toCMLRedeemerTag: (tag: string) => CML.RedeemerTag;
194
+ declare const fromCMLRedeemerTag: (tag: CML.RedeemerTag) => RedeemerTag;
195
+
196
+ export { type CMLNative, PROTOCOL_PARAMETERS_DEFAULT, type SortOrder, addAssets, addressFromHexOrBech32, applyDoubleCborEncoding, applyParamsToScript, assetsToValue, calculateMinLovelaceFromUTxO, coreToOutRef, coreToTxOutput, coreToUtxo, coresToOutRefs, coresToTxOutputs, coresToUtxos, createCostModels, credentialToAddress, credentialToRewardAddress, datumJsonToCbor, datumToHash, fromCMLRedeemerTag, fromLabel, fromScriptRef, fromUnit, generatePrivateKey, generateSeedPhrase, getAddressDetails, getInputIndices, getUniqueTokenName, isEqualUTxO, keyHashToCredential, mintingPolicyToId, networkToId, parseCMLNative, paymentCredentialOf, scriptFromCMLNative, scriptFromNative, scriptHashToCredential, selectUTxOs, slotToUnixTime, sortCanonical, sortUTxOs, stakeCredentialOf, stringify, toCMLNativeScript, toCMLRedeemerTag, toLabel, toPublicKey, toScriptRef, toUnit, unixTimeToSlot, utxoToCore, utxoToTransactionInput, utxoToTransactionOutput, utxosToCores, validatorToAddress, validatorToRewardAddress, validatorToScriptHash, valueToAssets };
package/dist/index.js CHANGED
@@ -1482,6 +1482,44 @@ var stringify = (data) => JSON.stringify(
1482
1482
  (key, value) => typeof value === "bigint" ? value.toString() + "n" : value,
1483
1483
  2
1484
1484
  );
1485
+
1486
+ // src/redeemer.ts
1487
+ var toCMLRedeemerTag = (tag) => {
1488
+ switch (tag) {
1489
+ case "spend":
1490
+ return CML.RedeemerTag.Spend;
1491
+ case "mint":
1492
+ return CML.RedeemerTag.Mint;
1493
+ case "publish":
1494
+ return CML.RedeemerTag.Cert;
1495
+ case "withdraw":
1496
+ return CML.RedeemerTag.Reward;
1497
+ case "vote":
1498
+ return CML.RedeemerTag.Voting;
1499
+ case "propose":
1500
+ return CML.RedeemerTag.Proposing;
1501
+ default:
1502
+ throw new Error(`Exhaustive check failed: Unhandled case ${tag}`);
1503
+ }
1504
+ };
1505
+ var fromCMLRedeemerTag = (tag) => {
1506
+ switch (tag) {
1507
+ case CML.RedeemerTag.Spend:
1508
+ return "spend";
1509
+ case CML.RedeemerTag.Mint:
1510
+ return "mint";
1511
+ case CML.RedeemerTag.Cert:
1512
+ return "publish";
1513
+ case CML.RedeemerTag.Reward:
1514
+ return "withdraw";
1515
+ case CML.RedeemerTag.Voting:
1516
+ return "vote";
1517
+ case CML.RedeemerTag.Proposing:
1518
+ return "propose";
1519
+ default:
1520
+ throw new Error(`Exhaustive check failed: Unhandled case ${tag}`);
1521
+ }
1522
+ };
1485
1523
  export {
1486
1524
  PROTOCOL_PARAMETERS_DEFAULT,
1487
1525
  addAssets,
@@ -1501,6 +1539,7 @@ export {
1501
1539
  credentialToRewardAddress,
1502
1540
  datumJsonToCbor,
1503
1541
  datumToHash,
1542
+ fromCMLRedeemerTag,
1504
1543
  fromLabel,
1505
1544
  fromScriptRef,
1506
1545
  fromUnit,
@@ -1525,6 +1564,7 @@ export {
1525
1564
  stakeCredentialOf,
1526
1565
  stringify,
1527
1566
  toCMLNativeScript,
1567
+ toCMLRedeemerTag,
1528
1568
  toLabel,
1529
1569
  toPublicKey,
1530
1570
  toScriptRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/utils",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -34,11 +34,11 @@
34
34
  "bip39": "^3.1.0",
35
35
  "cborg": "^4.2.0",
36
36
  "effect": "^3.1.2",
37
- "@lucid-evolution/core-types": "0.1.20",
37
+ "@lucid-evolution/core-types": "0.1.21",
38
38
  "@lucid-evolution/core-utils": "0.1.16",
39
39
  "@lucid-evolution/crc8": "0.1.8",
40
- "@lucid-evolution/plutus": "0.1.26",
41
- "@lucid-evolution/uplc": "0.2.13"
40
+ "@lucid-evolution/plutus": "0.1.27",
41
+ "@lucid-evolution/uplc": "0.2.15"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^20.12.8",