@meshsdk/transaction 1.9.0-beta.26 → 1.9.0-beta.27

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,6 @@ __export(index_exports, {
40
40
  module.exports = __toCommonJS(index_exports);
41
41
 
42
42
  // src/mesh-tx-builder/index.ts
43
- var import_common2 = require("@meshsdk/common");
44
43
  var import_core_cst = require("@meshsdk/core-cst");
45
44
 
46
45
  // src/mesh-tx-builder/tx-builder-core.ts
@@ -1546,6 +1545,7 @@ var MeshTxBuilderCore = class {
1546
1545
  return red;
1547
1546
  };
1548
1547
  updateRedeemer = (meshTxBuilderBody, txEvaluation) => {
1548
+ let mintIndex = 0;
1549
1549
  txEvaluation.forEach((redeemerEvaluation) => {
1550
1550
  switch (redeemerEvaluation.tag) {
1551
1551
  case "SPEND": {
@@ -1561,7 +1561,7 @@ var MeshTxBuilderCore = class {
1561
1561
  break;
1562
1562
  }
1563
1563
  case "MINT": {
1564
- const mint = meshTxBuilderBody.mints[redeemerEvaluation.index];
1564
+ const mint = meshTxBuilderBody.mints[mintIndex];
1565
1565
  if (mint.type == "Plutus" && mint.redeemer) {
1566
1566
  let newExUnits = {
1567
1567
  mem: Math.floor(
@@ -1574,6 +1574,7 @@ var MeshTxBuilderCore = class {
1574
1574
  for (let i = redeemerEvaluation.index; i < meshTxBuilderBody.mints.length; i++) {
1575
1575
  if (meshTxBuilderBody.mints[i].policyId === mint.policyId) {
1576
1576
  meshTxBuilderBody.mints[i].redeemer.exUnits = newExUnits;
1577
+ mintIndex++;
1577
1578
  }
1578
1579
  }
1579
1580
  }
@@ -2136,16 +2137,11 @@ var MeshTxBuilder = class extends MeshTxBuilderCore {
2136
2137
  if (this.evaluator) {
2137
2138
  const txEvaluation = await this.evaluator.evaluateTx(
2138
2139
  txHex,
2139
- Object.values(this.meshTxBuilderBody.inputsForEvaluation).concat(
2140
- this.meshTxBuilderBody.inputs.map((val) => (0, import_common2.txInToUtxo)(val.txIn)),
2141
- this.meshTxBuilderBody.collaterals.map(
2142
- (val) => (0, import_common2.txInToUtxo)(val.txIn)
2143
- )
2144
- ),
2140
+ Object.values(this.meshTxBuilderBody.inputsForEvaluation),
2145
2141
  this.meshTxBuilderBody.chainedTxs
2146
2142
  ).catch((error) => {
2147
2143
  throw new Error(
2148
- `Tx evaluation failed: ${JSON.stringify(error)}
2144
+ `Tx evaluation failed: ${error.message}
2149
2145
  For txHex: ${txHex}`
2150
2146
  );
2151
2147
  });
@@ -2209,7 +2205,7 @@ var ForgeScript = class {
2209
2205
  };
2210
2206
 
2211
2207
  // src/transaction/index.ts
2212
- var import_common3 = require("@meshsdk/common");
2208
+ var import_common2 = require("@meshsdk/common");
2213
2209
  var import_core_cst3 = require("@meshsdk/core-cst");
2214
2210
  var Transaction = class {
2215
2211
  txBuilder;
@@ -2333,7 +2329,7 @@ var Transaction = class {
2333
2329
  * @see {@link https://meshjs.dev/apis/transaction#sendToken}
2334
2330
  */
2335
2331
  sendToken(recipient, ticker, amount) {
2336
- const assets = [{ unit: import_common3.SUPPORTED_TOKENS[ticker], quantity: amount }];
2332
+ const assets = [{ unit: import_common2.SUPPORTED_TOKENS[ticker], quantity: amount }];
2337
2333
  return this.sendAssets(recipient, assets);
2338
2334
  }
2339
2335
  /**
@@ -2410,7 +2406,7 @@ var Transaction = class {
2410
2406
  const { value, script, datum, redeemer } = options;
2411
2407
  const red = redeemer || {
2412
2408
  data: { alternative: 0, fields: ["mesh"] },
2413
- budget: import_common3.DEFAULT_REDEEMER_BUDGET
2409
+ budget: import_common2.DEFAULT_REDEEMER_BUDGET
2414
2410
  };
2415
2411
  if ("code" in script) {
2416
2412
  this.isCollateralNeeded = true;
@@ -2453,10 +2449,10 @@ var Transaction = class {
2453
2449
  // TODO: nuke this probably as the input type is too confusing
2454
2450
  mintAsset(forgeScript, mint, redeemer) {
2455
2451
  const assetQuantity = mint.assetQuantity;
2456
- let assetNameHex = (0, import_common3.stringToHex)(mint.assetName);
2457
- const referenceAssetNameHex = (0, import_common3.CIP68_100)(assetNameHex);
2452
+ let assetNameHex = (0, import_common2.stringToHex)(mint.assetName);
2453
+ const referenceAssetNameHex = (0, import_common2.CIP68_100)(assetNameHex);
2458
2454
  if (mint.cip68ScriptAddress) {
2459
- assetNameHex = (0, import_common3.CIP68_222)(assetNameHex);
2455
+ assetNameHex = (0, import_common2.CIP68_222)(assetNameHex);
2460
2456
  }
2461
2457
  let policyId = "";
2462
2458
  switch (typeof forgeScript) {
@@ -2528,7 +2524,7 @@ var Transaction = class {
2528
2524
  this.sendAssets(
2529
2525
  {
2530
2526
  address: mint.cip68ScriptAddress,
2531
- datum: { inline: true, value: (0, import_common3.metadataToCip68)(mint.metadata) }
2527
+ datum: { inline: true, value: (0, import_common2.metadataToCip68)(mint.metadata) }
2532
2528
  },
2533
2529
  [
2534
2530
  {
@@ -2567,7 +2563,7 @@ var Transaction = class {
2567
2563
  burnAsset(forgeScript, asset, redeemer) {
2568
2564
  const assetQuantity = "-" + asset.quantity;
2569
2565
  const mint = {
2570
- assetName: (0, import_common3.hexToString)(asset.unit.slice(import_common3.POLICY_ID_LENGTH)),
2566
+ assetName: (0, import_common2.hexToString)(asset.unit.slice(import_common2.POLICY_ID_LENGTH)),
2571
2567
  assetQuantity
2572
2568
  };
2573
2569
  try {
package/dist/index.js CHANGED
@@ -1,7 +1,4 @@
1
1
  // src/mesh-tx-builder/index.ts
2
- import {
3
- txInToUtxo
4
- } from "@meshsdk/common";
5
2
  import { CardanoSDKSerializer } from "@meshsdk/core-cst";
6
3
 
7
4
  // src/mesh-tx-builder/tx-builder-core.ts
@@ -1513,6 +1510,7 @@ var MeshTxBuilderCore = class {
1513
1510
  return red;
1514
1511
  };
1515
1512
  updateRedeemer = (meshTxBuilderBody, txEvaluation) => {
1513
+ let mintIndex = 0;
1516
1514
  txEvaluation.forEach((redeemerEvaluation) => {
1517
1515
  switch (redeemerEvaluation.tag) {
1518
1516
  case "SPEND": {
@@ -1528,7 +1526,7 @@ var MeshTxBuilderCore = class {
1528
1526
  break;
1529
1527
  }
1530
1528
  case "MINT": {
1531
- const mint = meshTxBuilderBody.mints[redeemerEvaluation.index];
1529
+ const mint = meshTxBuilderBody.mints[mintIndex];
1532
1530
  if (mint.type == "Plutus" && mint.redeemer) {
1533
1531
  let newExUnits = {
1534
1532
  mem: Math.floor(
@@ -1541,6 +1539,7 @@ var MeshTxBuilderCore = class {
1541
1539
  for (let i = redeemerEvaluation.index; i < meshTxBuilderBody.mints.length; i++) {
1542
1540
  if (meshTxBuilderBody.mints[i].policyId === mint.policyId) {
1543
1541
  meshTxBuilderBody.mints[i].redeemer.exUnits = newExUnits;
1542
+ mintIndex++;
1544
1543
  }
1545
1544
  }
1546
1545
  }
@@ -2103,16 +2102,11 @@ var MeshTxBuilder = class extends MeshTxBuilderCore {
2103
2102
  if (this.evaluator) {
2104
2103
  const txEvaluation = await this.evaluator.evaluateTx(
2105
2104
  txHex,
2106
- Object.values(this.meshTxBuilderBody.inputsForEvaluation).concat(
2107
- this.meshTxBuilderBody.inputs.map((val) => txInToUtxo(val.txIn)),
2108
- this.meshTxBuilderBody.collaterals.map(
2109
- (val) => txInToUtxo(val.txIn)
2110
- )
2111
- ),
2105
+ Object.values(this.meshTxBuilderBody.inputsForEvaluation),
2112
2106
  this.meshTxBuilderBody.chainedTxs
2113
2107
  ).catch((error) => {
2114
2108
  throw new Error(
2115
- `Tx evaluation failed: ${JSON.stringify(error)}
2109
+ `Tx evaluation failed: ${error.message}
2116
2110
  For txHex: ${txHex}`
2117
2111
  );
2118
2112
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/transaction",
3
- "version": "1.9.0-beta.26",
3
+ "version": "1.9.0-beta.27",
4
4
  "description": "Transactions - https://meshjs.dev/apis/transaction",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.js",
@@ -35,8 +35,8 @@
35
35
  "typescript": "^5.3.3"
36
36
  },
37
37
  "dependencies": {
38
- "@meshsdk/common": "1.9.0-beta.26",
39
- "@meshsdk/core-cst": "1.9.0-beta.26",
38
+ "@meshsdk/common": "1.9.0-beta.27",
39
+ "@meshsdk/core-cst": "1.9.0-beta.27",
40
40
  "json-bigint": "^1.0.0"
41
41
  },
42
42
  "prettier": "@meshsdk/configs/prettier",
@@ -51,4 +51,4 @@
51
51
  "blockchain",
52
52
  "sdk"
53
53
  ]
54
- }
54
+ }