@meshsdk/core-cst 1.9.0-beta.13 → 1.9.0-beta.15

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
@@ -5759,27 +5759,42 @@ var import_core6 = require("@cardano-sdk/core");
5759
5759
  var Crypto3 = __toESM(require("@cardano-sdk/crypto"), 1);
5760
5760
  var import_crypto8 = require("@cardano-sdk/crypto");
5761
5761
  var import_util8 = require("@cardano-sdk/util");
5762
- var CBOR_EMPTY_LIST = new Uint8Array([128]);
5763
5762
  var CBOR_EMPTY_MAP = new Uint8Array([160]);
5764
- var getCborEncodedArray = (items) => {
5763
+ var getCborEncodedRedeemers = (redeemers) => {
5765
5764
  const writer = new import_core6.Serialization.CborWriter();
5766
- writer.writeStartArray(items.length);
5767
- for (const item of items) {
5768
- writer.writeEncodedValue(Buffer.from(item.toCbor(), "hex"));
5765
+ writer.writeStartMap(redeemers.length);
5766
+ for (const redeemer of redeemers) {
5767
+ writer.writeStartArray(2);
5768
+ writer.writeInt(BigInt(redeemer.tag()));
5769
+ writer.writeInt(redeemer.index());
5770
+ writer.writeStartArray(2);
5771
+ writer.writeEncodedValue(Buffer.from(redeemer.data().toCbor(), "hex"));
5772
+ writer.writeEncodedValue(Buffer.from(redeemer.exUnits().toCbor(), "hex"));
5769
5773
  }
5770
5774
  return writer.encode();
5771
5775
  };
5776
+ var getCborEncodedDatums = (datums) => {
5777
+ const writer = new import_core6.Serialization.CborWriter();
5778
+ writer.writeTag(258);
5779
+ writer.writeStartArray();
5780
+ for (const datum of datums) {
5781
+ writer.writeEncodedValue(Buffer.from(datum.toCbor(), "hex"));
5782
+ }
5783
+ writer.writeEndArray();
5784
+ return writer.encode();
5785
+ };
5772
5786
  var hashScriptData = (costModels, redemeers, datums) => {
5773
5787
  const writer = new import_core6.Serialization.CborWriter();
5774
5788
  if (datums && datums.length > 0 && (!redemeers || redemeers.length === 0)) {
5775
- writer.writeEncodedValue(CBOR_EMPTY_LIST);
5776
- writer.writeEncodedValue(getCborEncodedArray(datums));
5789
+ writer.writeEncodedValue(CBOR_EMPTY_MAP);
5790
+ writer.writeEncodedValue(getCborEncodedDatums(datums));
5777
5791
  writer.writeEncodedValue(CBOR_EMPTY_MAP);
5778
5792
  } else {
5779
5793
  if (!redemeers || redemeers.length === 0) return void 0;
5780
- writer.writeEncodedValue(getCborEncodedArray(redemeers));
5781
- if (datums && datums.length > 0)
5782
- writer.writeEncodedValue(getCborEncodedArray(datums));
5794
+ writer.writeEncodedValue(getCborEncodedRedeemers(redemeers));
5795
+ if (datums && datums.length > 0) {
5796
+ writer.writeEncodedValue(getCborEncodedDatums(datums));
5797
+ }
5783
5798
  writer.writeEncodedValue(
5784
5799
  Buffer.from(costModels.languageViewsEncoding(), "hex")
5785
5800
  );
package/dist/index.js CHANGED
@@ -3485,7 +3485,7 @@ var require_hash = __commonJS({
3485
3485
  });
3486
3486
 
3487
3487
  // src/index.ts
3488
- import { Cardano as Cardano6, Serialization as Serialization8 } from "@cardano-sdk/core";
3488
+ import { Cardano as Cardano5, Serialization as Serialization8 } from "@cardano-sdk/core";
3489
3489
 
3490
3490
  // src/types/cardano-sdk.ts
3491
3491
  import { Cardano, Serialization } from "@cardano-sdk/core";
@@ -5611,27 +5611,42 @@ import { Serialization as Serialization5 } from "@cardano-sdk/core";
5611
5611
  import * as Crypto3 from "@cardano-sdk/crypto";
5612
5612
  import { Hash32ByteBase16 as Hash32ByteBase163 } from "@cardano-sdk/crypto";
5613
5613
  import { HexBlob as HexBlob8 } from "@cardano-sdk/util";
5614
- var CBOR_EMPTY_LIST = new Uint8Array([128]);
5615
5614
  var CBOR_EMPTY_MAP = new Uint8Array([160]);
5616
- var getCborEncodedArray = (items) => {
5615
+ var getCborEncodedRedeemers = (redeemers) => {
5617
5616
  const writer = new Serialization5.CborWriter();
5618
- writer.writeStartArray(items.length);
5619
- for (const item of items) {
5620
- writer.writeEncodedValue(Buffer.from(item.toCbor(), "hex"));
5617
+ writer.writeStartMap(redeemers.length);
5618
+ for (const redeemer of redeemers) {
5619
+ writer.writeStartArray(2);
5620
+ writer.writeInt(BigInt(redeemer.tag()));
5621
+ writer.writeInt(redeemer.index());
5622
+ writer.writeStartArray(2);
5623
+ writer.writeEncodedValue(Buffer.from(redeemer.data().toCbor(), "hex"));
5624
+ writer.writeEncodedValue(Buffer.from(redeemer.exUnits().toCbor(), "hex"));
5621
5625
  }
5622
5626
  return writer.encode();
5623
5627
  };
5628
+ var getCborEncodedDatums = (datums) => {
5629
+ const writer = new Serialization5.CborWriter();
5630
+ writer.writeTag(258);
5631
+ writer.writeStartArray();
5632
+ for (const datum of datums) {
5633
+ writer.writeEncodedValue(Buffer.from(datum.toCbor(), "hex"));
5634
+ }
5635
+ writer.writeEndArray();
5636
+ return writer.encode();
5637
+ };
5624
5638
  var hashScriptData = (costModels, redemeers, datums) => {
5625
5639
  const writer = new Serialization5.CborWriter();
5626
5640
  if (datums && datums.length > 0 && (!redemeers || redemeers.length === 0)) {
5627
- writer.writeEncodedValue(CBOR_EMPTY_LIST);
5628
- writer.writeEncodedValue(getCborEncodedArray(datums));
5641
+ writer.writeEncodedValue(CBOR_EMPTY_MAP);
5642
+ writer.writeEncodedValue(getCborEncodedDatums(datums));
5629
5643
  writer.writeEncodedValue(CBOR_EMPTY_MAP);
5630
5644
  } else {
5631
5645
  if (!redemeers || redemeers.length === 0) return void 0;
5632
- writer.writeEncodedValue(getCborEncodedArray(redemeers));
5633
- if (datums && datums.length > 0)
5634
- writer.writeEncodedValue(getCborEncodedArray(datums));
5646
+ writer.writeEncodedValue(getCborEncodedRedeemers(redemeers));
5647
+ if (datums && datums.length > 0) {
5648
+ writer.writeEncodedValue(getCborEncodedDatums(datums));
5649
+ }
5635
5650
  writer.writeEncodedValue(
5636
5651
  Buffer.from(costModels.languageViewsEncoding(), "hex")
5637
5652
  );
@@ -5644,7 +5659,7 @@ var hashScriptData = (costModels, redemeers, datums) => {
5644
5659
  };
5645
5660
 
5646
5661
  // src/utils/vote.ts
5647
- import { Cardano as Cardano5, Serialization as Serialization6 } from "@cardano-sdk/core";
5662
+ import { Cardano as Cardano4, Serialization as Serialization6 } from "@cardano-sdk/core";
5648
5663
  var toCardanoVoter = (voter) => {
5649
5664
  switch (voter.type) {
5650
5665
  case "ConstitutionalCommittee": {
@@ -5713,7 +5728,7 @@ var toCardanoVoteKind = (voteType) => {
5713
5728
  };
5714
5729
  var toCardanoGovernanceActionId = (govActionId) => {
5715
5730
  return new Serialization6.GovernanceActionId(
5716
- Cardano5.TransactionId(govActionId.txHash),
5731
+ Cardano4.TransactionId(govActionId.txHash),
5717
5732
  BigInt(govActionId.txIndex)
5718
5733
  );
5719
5734
  };
@@ -7344,7 +7359,7 @@ export {
7344
7359
  Bip32PrivateKeyHex2 as Bip32PrivateKeyHex,
7345
7360
  Bip32PublicKey2 as Bip32PublicKey,
7346
7361
  Bip32PublicKeyHex2 as Bip32PublicKeyHex,
7347
- Cardano6 as Cardano,
7362
+ Cardano5 as Cardano,
7348
7363
  CardanoSDK,
7349
7364
  CardanoSDKSerializer,
7350
7365
  CardanoSDKUtil,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/core-cst",
3
- "version": "1.9.0-beta.13",
3
+ "version": "1.9.0-beta.15",
4
4
  "description": "Types and utilities functions between Mesh and cardano-js-sdk",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "typescript": "^5.3.3"
37
37
  },
38
38
  "dependencies": {
39
- "@cardano-sdk/core": "^0.45.2",
39
+ "@cardano-sdk/core": "^0.45.5",
40
40
  "@cardano-sdk/crypto": "^0.2.2",
41
41
  "@cardano-sdk/util": "^0.15.5",
42
42
  "@harmoniclabs/bytestring": "1.0.0",
@@ -45,7 +45,7 @@
45
45
  "@harmoniclabs/pair": "1.0.0",
46
46
  "@harmoniclabs/plutus-data": "1.2.4",
47
47
  "@harmoniclabs/uplc": "1.2.4",
48
- "@meshsdk/common": "1.9.0-beta.13",
48
+ "@meshsdk/common": "1.9.0-beta.15",
49
49
  "@types/base32-encoding": "^1.0.2",
50
50
  "base32-encoding": "^1.0.0",
51
51
  "bech32": "^2.0.0",