@meshsdk/transaction 1.8.13 → 1.9.0-beta.0

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
@@ -40,7 +40,7 @@ __export(index_exports, {
40
40
  module.exports = __toCommonJS(index_exports);
41
41
 
42
42
  // src/mesh-tx-builder/index.ts
43
- var import_core_csl = require("@meshsdk/core-csl");
43
+ var import_core_cst = require("@meshsdk/core-cst");
44
44
 
45
45
  // src/mesh-tx-builder/tx-builder-core.ts
46
46
  var import_json_bigint2 = __toESM(require("json-bigint"), 1);
@@ -1725,7 +1725,7 @@ var MeshTxBuilder = class extends MeshTxBuilderCore {
1725
1725
  if (serializer) {
1726
1726
  this.serializer = serializer;
1727
1727
  } else {
1728
- this.serializer = new import_core_csl.CSLSerializer();
1728
+ this.serializer = new import_core_cst.CardanoSDKSerializer();
1729
1729
  }
1730
1730
  this.serializer.verbose = verbose;
1731
1731
  if (fetcher) this.fetcher = fetcher;
@@ -1923,13 +1923,11 @@ var MeshTxBuilder = class extends MeshTxBuilderCore {
1923
1923
  `Couldn't find value information for ${input.txIn.txHash}#${input.txIn.txIndex}`
1924
1924
  );
1925
1925
  input.txIn.amount = amount;
1926
- if (input.type === "PubKey") {
1927
- if (!address || address === "")
1928
- throw Error(
1929
- `Couldn't find address information for ${input.txIn.txHash}#${input.txIn.txIndex}`
1930
- );
1931
- input.txIn.address = address;
1932
- }
1926
+ if (!address || address === "")
1927
+ throw Error(
1928
+ `Couldn't find address information for ${input.txIn.txHash}#${input.txIn.txIndex}`
1929
+ );
1930
+ input.txIn.address = address;
1933
1931
  if (utxo?.output.scriptRef) {
1934
1932
  input.txIn.scriptSize = utxo.output.scriptRef.length / 2;
1935
1933
  } else {
@@ -1996,11 +1994,11 @@ var MeshTxBuilder = class extends MeshTxBuilderCore {
1996
1994
  };
1997
1995
 
1998
1996
  // src/scripts/forge.script.ts
1999
- var import_core_cst = require("@meshsdk/core-cst");
1997
+ var import_core_cst2 = require("@meshsdk/core-cst");
2000
1998
  var ForgeScript = class {
2001
1999
  static withOneSignature(address) {
2002
- const keyHash = (0, import_core_cst.deserializeEd25519KeyHash)((0, import_core_cst.resolvePaymentKeyHash)(address));
2003
- return (0, import_core_cst.buildScriptPubkey)(keyHash).toCbor();
2000
+ const keyHash = (0, import_core_cst2.deserializeEd25519KeyHash)((0, import_core_cst2.resolvePaymentKeyHash)(address));
2001
+ return (0, import_core_cst2.buildScriptPubkey)(keyHash).toCbor();
2004
2002
  }
2005
2003
  // static withAtLeastNSignatures(
2006
2004
  // addresses: string[], minimumRequired: number,
@@ -2038,13 +2036,13 @@ var ForgeScript = class {
2038
2036
  // return csl.NativeScript.new_script_any(scriptAll).to_hex();
2039
2037
  // }
2040
2038
  static fromNativeScript(script) {
2041
- return (0, import_core_cst.toNativeScript)(script).toCbor();
2039
+ return (0, import_core_cst2.toNativeScript)(script).toCbor();
2042
2040
  }
2043
2041
  };
2044
2042
 
2045
2043
  // src/transaction/index.ts
2046
2044
  var import_common2 = require("@meshsdk/common");
2047
- var import_core_cst2 = require("@meshsdk/core-cst");
2045
+ var import_core_cst3 = require("@meshsdk/core-cst");
2048
2046
  var Transaction = class {
2049
2047
  txBuilder;
2050
2048
  initiator;
@@ -2054,26 +2052,26 @@ var Transaction = class {
2054
2052
  this.initiator = options.initiator;
2055
2053
  }
2056
2054
  static attachMetadata(cborTx, cborTxMetadata) {
2057
- const tx = (0, import_core_cst2.deserializeTx)(cborTx);
2058
- const txAuxData = tx.auxiliaryData() ?? new import_core_cst2.Serialization.AuxiliaryData();
2055
+ const tx = (0, import_core_cst3.deserializeTx)(cborTx);
2056
+ const txAuxData = tx.auxiliaryData() ?? new import_core_cst3.Serialization.AuxiliaryData();
2059
2057
  txAuxData.setMetadata(
2060
- import_core_cst2.Serialization.GeneralTransactionMetadata.fromCbor(
2061
- import_core_cst2.CardanoSDKUtil.HexBlob(cborTxMetadata)
2058
+ import_core_cst3.Serialization.GeneralTransactionMetadata.fromCbor(
2059
+ import_core_cst3.CardanoSDKUtil.HexBlob(cborTxMetadata)
2062
2060
  )
2063
2061
  );
2064
- if (import_core_cst2.Cardano.computeAuxiliaryDataHash(txAuxData.toCore())?.toString() !== tx.body().auxiliaryDataHash()?.toString()) {
2062
+ if (import_core_cst3.Cardano.computeAuxiliaryDataHash(txAuxData.toCore())?.toString() !== tx.body().auxiliaryDataHash()?.toString()) {
2065
2063
  throw new Error(
2066
2064
  "[Transaction] attachMetadata: The metadata hash does not match the auxiliary data hash."
2067
2065
  );
2068
2066
  }
2069
- return new import_core_cst2.Transaction(tx.body(), tx.witnessSet(), txAuxData).toCbor().toString();
2067
+ return new import_core_cst3.Transaction(tx.body(), tx.witnessSet(), txAuxData).toCbor().toString();
2070
2068
  }
2071
2069
  static deattachMetadata(cborTx) {
2072
- const tx = (0, import_core_cst2.deserializeTx)(cborTx);
2073
- return new import_core_cst2.Transaction(tx.body(), tx.witnessSet()).toCbor().toString();
2070
+ const tx = (0, import_core_cst3.deserializeTx)(cborTx);
2071
+ return new import_core_cst3.Transaction(tx.body(), tx.witnessSet()).toCbor().toString();
2074
2072
  }
2075
2073
  static maskMetadata(cborTx) {
2076
- const tx = (0, import_core_cst2.deserializeTx)(cborTx);
2074
+ const tx = (0, import_core_cst3.deserializeTx)(cborTx);
2077
2075
  const txMetadata = tx.auxiliaryData()?.metadata();
2078
2076
  if (txMetadata !== void 0) {
2079
2077
  const mockMetadata = /* @__PURE__ */ new Map();
@@ -2083,23 +2081,23 @@ var Transaction = class {
2083
2081
  const txAuxData = tx.auxiliaryData();
2084
2082
  txMetadata.setMetadata(mockMetadata);
2085
2083
  txAuxData?.setMetadata(txMetadata);
2086
- return new import_core_cst2.Transaction(tx.body(), tx.witnessSet(), txAuxData).toCbor().toString();
2084
+ return new import_core_cst3.Transaction(tx.body(), tx.witnessSet(), txAuxData).toCbor().toString();
2087
2085
  }
2088
2086
  return cborTx;
2089
2087
  }
2090
2088
  static readMetadata(cborTx) {
2091
- const tx = (0, import_core_cst2.deserializeTx)(cborTx);
2089
+ const tx = (0, import_core_cst3.deserializeTx)(cborTx);
2092
2090
  return tx.auxiliaryData()?.metadata()?.toCbor().toString() ?? "";
2093
2091
  }
2094
2092
  static writeMetadata(cborTx, cborTxMetadata) {
2095
- const tx = (0, import_core_cst2.deserializeTx)(cborTx);
2096
- const txAuxData = tx.auxiliaryData() ?? new import_core_cst2.Serialization.AuxiliaryData();
2093
+ const tx = (0, import_core_cst3.deserializeTx)(cborTx);
2094
+ const txAuxData = tx.auxiliaryData() ?? new import_core_cst3.Serialization.AuxiliaryData();
2097
2095
  txAuxData.setMetadata(
2098
- import_core_cst2.Serialization.GeneralTransactionMetadata.fromCbor(
2099
- import_core_cst2.CardanoSDKUtil.HexBlob(cborTxMetadata)
2096
+ import_core_cst3.Serialization.GeneralTransactionMetadata.fromCbor(
2097
+ import_core_cst3.CardanoSDKUtil.HexBlob(cborTxMetadata)
2100
2098
  )
2101
2099
  );
2102
- return new import_core_cst2.Transaction(tx.body(), tx.witnessSet(), txAuxData).toCbor().toString();
2100
+ return new import_core_cst3.Transaction(tx.body(), tx.witnessSet(), txAuxData).toCbor().toString();
2103
2101
  }
2104
2102
  /**
2105
2103
  * Adds an output to the transaction.
@@ -2259,7 +2257,7 @@ var Transaction = class {
2259
2257
  if (!script.output.scriptRef) {
2260
2258
  throw new Error("redeemValue: No script reference found in UTxO");
2261
2259
  }
2262
- const scriptRef = (0, import_core_cst2.fromScriptRef)(script.output.scriptRef);
2260
+ const scriptRef = (0, import_core_cst3.fromScriptRef)(script.output.scriptRef);
2263
2261
  if (!scriptRef || !("code" in scriptRef)) {
2264
2262
  throw new Error("redeemValue: Script reference not found");
2265
2263
  }
@@ -2294,7 +2292,7 @@ var Transaction = class {
2294
2292
  let policyId = "";
2295
2293
  switch (typeof forgeScript) {
2296
2294
  case "string":
2297
- policyId = (0, import_core_cst2.deserializeNativeScript)(forgeScript).hash().toString();
2295
+ policyId = (0, import_core_cst3.deserializeNativeScript)(forgeScript).hash().toString();
2298
2296
  this.txBuilder.mint(assetQuantity, policyId, assetNameHex).mintingScript(forgeScript);
2299
2297
  if (mint.cip68ScriptAddress) {
2300
2298
  this.txBuilder.mint(assetQuantity, policyId, referenceAssetNameHex).mintingScript(forgeScript);
@@ -2306,7 +2304,7 @@ var Transaction = class {
2306
2304
  "burnAsset: Redeemer data is required for Plutus minting"
2307
2305
  );
2308
2306
  if ("code" in forgeScript) {
2309
- policyId = (0, import_core_cst2.deserializePlutusScript)(
2307
+ policyId = (0, import_core_cst3.deserializePlutusScript)(
2310
2308
  forgeScript.code,
2311
2309
  forgeScript.version
2312
2310
  ).hash().toString();
@@ -2321,12 +2319,12 @@ var Transaction = class {
2321
2319
  if (!forgeScript.output.scriptRef) {
2322
2320
  throw new Error("mintAsset: No script reference found in UTxO");
2323
2321
  }
2324
- const script = (0, import_core_cst2.fromScriptRef)(forgeScript.output.scriptRef);
2322
+ const script = (0, import_core_cst3.fromScriptRef)(forgeScript.output.scriptRef);
2325
2323
  if (!script) {
2326
2324
  throw new Error("mintAsset: Script reference not found");
2327
2325
  }
2328
2326
  if ("code" in script) {
2329
- policyId = (0, import_core_cst2.deserializePlutusScript)(script.code, script.version).hash().toString();
2327
+ policyId = (0, import_core_cst3.deserializePlutusScript)(script.code, script.version).hash().toString();
2330
2328
  this.isCollateralNeeded = true;
2331
2329
  this.mintPlutusScript(script).mint(assetQuantity, policyId, assetNameHex).mintTxInReference(
2332
2330
  forgeScript.input.txHash,
@@ -2602,27 +2600,27 @@ var Transaction = class {
2602
2600
  };
2603
2601
  function mask(metadatum) {
2604
2602
  switch (metadatum.getKind()) {
2605
- case import_core_cst2.Serialization.TransactionMetadatumKind.Text:
2606
- return import_core_cst2.Serialization.TransactionMetadatum.newText(
2603
+ case import_core_cst3.Serialization.TransactionMetadatumKind.Text:
2604
+ return import_core_cst3.Serialization.TransactionMetadatum.newText(
2607
2605
  "0".repeat(metadatum.asText()?.length ?? 0)
2608
2606
  );
2609
- case import_core_cst2.Serialization.TransactionMetadatumKind.Bytes:
2610
- case import_core_cst2.Serialization.TransactionMetadatumKind.Integer:
2607
+ case import_core_cst3.Serialization.TransactionMetadatumKind.Bytes:
2608
+ case import_core_cst3.Serialization.TransactionMetadatumKind.Integer:
2611
2609
  return metadatum;
2612
- case import_core_cst2.Serialization.TransactionMetadatumKind.List:
2613
- const list = new import_core_cst2.Serialization.MetadatumList();
2610
+ case import_core_cst3.Serialization.TransactionMetadatumKind.List:
2611
+ const list = new import_core_cst3.Serialization.MetadatumList();
2614
2612
  for (let i = 0; i < (metadatum.asList()?.getLength() ?? 0); i++) {
2615
2613
  list.add(mask(metadatum.asList()?.get(i)));
2616
2614
  }
2617
- return import_core_cst2.Serialization.TransactionMetadatum.newList(list);
2618
- case import_core_cst2.Serialization.TransactionMetadatumKind.Map:
2619
- const map = new import_core_cst2.Serialization.MetadatumMap();
2615
+ return import_core_cst3.Serialization.TransactionMetadatum.newList(list);
2616
+ case import_core_cst3.Serialization.TransactionMetadatumKind.Map:
2617
+ const map = new import_core_cst3.Serialization.MetadatumMap();
2620
2618
  for (let i = 0; i < (metadatum.asMap()?.getLength() ?? 0); i++) {
2621
2619
  const key = metadatum.asMap()?.getKeys().get(i);
2622
2620
  const value = metadatum.asMap()?.get(key);
2623
2621
  map.insert(key, mask(value));
2624
2622
  }
2625
- return import_core_cst2.Serialization.TransactionMetadatum.newMap(map);
2623
+ return import_core_cst3.Serialization.TransactionMetadatum.newMap(map);
2626
2624
  default:
2627
2625
  throw new Error(`Unsupported metadatum kind: ${metadatum.getKind()}`);
2628
2626
  }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/mesh-tx-builder/index.ts
2
- import { CSLSerializer } from "@meshsdk/core-csl";
2
+ import { CardanoSDKSerializer } from "@meshsdk/core-cst";
3
3
 
4
4
  // src/mesh-tx-builder/tx-builder-core.ts
5
5
  import JSONBig2 from "json-bigint";
@@ -1690,7 +1690,7 @@ var MeshTxBuilder = class extends MeshTxBuilderCore {
1690
1690
  if (serializer) {
1691
1691
  this.serializer = serializer;
1692
1692
  } else {
1693
- this.serializer = new CSLSerializer();
1693
+ this.serializer = new CardanoSDKSerializer();
1694
1694
  }
1695
1695
  this.serializer.verbose = verbose;
1696
1696
  if (fetcher) this.fetcher = fetcher;
@@ -1888,13 +1888,11 @@ var MeshTxBuilder = class extends MeshTxBuilderCore {
1888
1888
  `Couldn't find value information for ${input.txIn.txHash}#${input.txIn.txIndex}`
1889
1889
  );
1890
1890
  input.txIn.amount = amount;
1891
- if (input.type === "PubKey") {
1892
- if (!address || address === "")
1893
- throw Error(
1894
- `Couldn't find address information for ${input.txIn.txHash}#${input.txIn.txIndex}`
1895
- );
1896
- input.txIn.address = address;
1897
- }
1891
+ if (!address || address === "")
1892
+ throw Error(
1893
+ `Couldn't find address information for ${input.txIn.txHash}#${input.txIn.txIndex}`
1894
+ );
1895
+ input.txIn.address = address;
1898
1896
  if (utxo?.output.scriptRef) {
1899
1897
  input.txIn.scriptSize = utxo.output.scriptRef.length / 2;
1900
1898
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/transaction",
3
- "version": "1.8.13",
3
+ "version": "1.9.0-beta.0",
4
4
  "description": "Transactions - https://meshjs.dev/apis/transaction",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.js",
@@ -35,9 +35,8 @@
35
35
  "typescript": "^5.3.3"
36
36
  },
37
37
  "dependencies": {
38
- "@meshsdk/common": "1.8.13",
39
- "@meshsdk/core-csl": "1.8.13",
40
- "@meshsdk/core-cst": "1.8.13",
38
+ "@meshsdk/common": "1.9.0-beta.0",
39
+ "@meshsdk/core-cst": "1.9.0-beta.0",
41
40
  "json-bigint": "^1.0.0"
42
41
  },
43
42
  "prettier": "@meshsdk/configs/prettier",