@meshsdk/common 1.6.12 → 1.7.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
@@ -681,7 +681,7 @@ var emptyTxBuilderBody = () => ({
681
681
  withdrawals: [],
682
682
  signingKey: [],
683
683
  selectionConfig: {
684
- threshold: "5000000",
684
+ threshold: "0",
685
685
  strategy: "experimental",
686
686
  includeTxFees: true
687
687
  },
@@ -1220,7 +1220,7 @@ var MeshValue = class _MeshValue {
1220
1220
  * @returns boolean
1221
1221
  */
1222
1222
  leq = (other) => {
1223
- return Object.keys(other.value).every((key) => this.leqUnit(key, other));
1223
+ return Object.keys(this.value).every((key) => this.leqUnit(key, other));
1224
1224
  };
1225
1225
  /**
1226
1226
  * Check if the specific unit of value is less than or equal to that unit of another value
@@ -1337,9 +1337,15 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
1337
1337
  const singletons = /* @__PURE__ */ new Set();
1338
1338
  const pairs = /* @__PURE__ */ new Set();
1339
1339
  const rest = /* @__PURE__ */ new Set();
1340
+ const collaterals = /* @__PURE__ */ new Set();
1340
1341
  for (let i = 0; i < inputs.length; i++) {
1341
1342
  switch (inputs[i].output.amount.length) {
1342
1343
  case 1: {
1344
+ const quantity = inputs[i].output.amount[0]?.quantity;
1345
+ if (quantity == "5000000" || quantity == "10000000") {
1346
+ collaterals.add(i);
1347
+ break;
1348
+ }
1343
1349
  onlyLovelace.add(i);
1344
1350
  break;
1345
1351
  }
@@ -1412,6 +1418,11 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
1412
1418
  if (!assetRequired || Number(assetRequired) <= 0) break;
1413
1419
  addUtxoWithAssetAmount(inputIndex, "lovelace", rest);
1414
1420
  }
1421
+ for (const inputIndex of collaterals) {
1422
+ const assetRequired = totalRequiredAssets.get("lovelace");
1423
+ if (!assetRequired || Number(assetRequired) <= 0) break;
1424
+ addUtxoWithAssetAmount(inputIndex, "lovelace", collaterals);
1425
+ }
1415
1426
  for (const assetUnit of totalRequiredAssets.keys()) {
1416
1427
  if (Number(totalRequiredAssets.get(assetUnit)) > 0) {
1417
1428
  console.warn("Insufficient funds for", assetUnit);
package/dist/index.d.cts CHANGED
@@ -430,7 +430,7 @@ type Output = {
430
430
  address: string;
431
431
  amount: Asset[];
432
432
  datum?: {
433
- type: "Hash" | "Inline";
433
+ type: "Hash" | "Inline" | "Embedded";
434
434
  data: BuilderData;
435
435
  };
436
436
  referenceScript?: PlutusScript;
package/dist/index.d.ts CHANGED
@@ -430,7 +430,7 @@ type Output = {
430
430
  address: string;
431
431
  amount: Asset[];
432
432
  datum?: {
433
- type: "Hash" | "Inline";
433
+ type: "Hash" | "Inline" | "Embedded";
434
434
  data: BuilderData;
435
435
  };
436
436
  referenceScript?: PlutusScript;
package/dist/index.js CHANGED
@@ -552,7 +552,7 @@ var emptyTxBuilderBody = () => ({
552
552
  withdrawals: [],
553
553
  signingKey: [],
554
554
  selectionConfig: {
555
- threshold: "5000000",
555
+ threshold: "0",
556
556
  strategy: "experimental",
557
557
  includeTxFees: true
558
558
  },
@@ -1091,7 +1091,7 @@ var MeshValue = class _MeshValue {
1091
1091
  * @returns boolean
1092
1092
  */
1093
1093
  leq = (other) => {
1094
- return Object.keys(other.value).every((key) => this.leqUnit(key, other));
1094
+ return Object.keys(this.value).every((key) => this.leqUnit(key, other));
1095
1095
  };
1096
1096
  /**
1097
1097
  * Check if the specific unit of value is less than or equal to that unit of another value
@@ -1208,9 +1208,15 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
1208
1208
  const singletons = /* @__PURE__ */ new Set();
1209
1209
  const pairs = /* @__PURE__ */ new Set();
1210
1210
  const rest = /* @__PURE__ */ new Set();
1211
+ const collaterals = /* @__PURE__ */ new Set();
1211
1212
  for (let i = 0; i < inputs.length; i++) {
1212
1213
  switch (inputs[i].output.amount.length) {
1213
1214
  case 1: {
1215
+ const quantity = inputs[i].output.amount[0]?.quantity;
1216
+ if (quantity == "5000000" || quantity == "10000000") {
1217
+ collaterals.add(i);
1218
+ break;
1219
+ }
1214
1220
  onlyLovelace.add(i);
1215
1221
  break;
1216
1222
  }
@@ -1283,6 +1289,11 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
1283
1289
  if (!assetRequired || Number(assetRequired) <= 0) break;
1284
1290
  addUtxoWithAssetAmount(inputIndex, "lovelace", rest);
1285
1291
  }
1292
+ for (const inputIndex of collaterals) {
1293
+ const assetRequired = totalRequiredAssets.get("lovelace");
1294
+ if (!assetRequired || Number(assetRequired) <= 0) break;
1295
+ addUtxoWithAssetAmount(inputIndex, "lovelace", collaterals);
1296
+ }
1286
1297
  for (const assetUnit of totalRequiredAssets.keys()) {
1287
1298
  if (Number(totalRequiredAssets.get(assetUnit)) > 0) {
1288
1299
  console.warn("Insufficient funds for", assetUnit);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/common",
3
- "version": "1.6.12",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",