@meshsdk/contract 1.9.0-beta.7 → 1.9.0-beta.8

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.
Files changed (3) hide show
  1. package/dist/index.cjs +173 -42
  2. package/dist/index.js +173 -42
  3. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -30703,7 +30703,7 @@ var CustomError = function(_super) {
30703
30703
  return CustomError2;
30704
30704
  }(Error);
30705
30705
 
30706
- // ../../node_modules/@cardano-sdk/util/dist/esm/errors.js
30706
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/errors.js
30707
30707
  var formatErrorMessage = (reason, detail) => reason + (detail ? ` (${detail})` : "");
30708
30708
  var isErrorLike = (error) => {
30709
30709
  if (!error || typeof error !== "object" || !("message" in error && "stack" in error))
@@ -30751,7 +30751,7 @@ var InvalidStateError = class extends CustomError {
30751
30751
  }
30752
30752
  };
30753
30753
 
30754
- // ../../node_modules/@cardano-sdk/util/dist/esm/primitives.js
30754
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/primitives.js
30755
30755
  var import_bech32 = __toESM(require_dist(), 1);
30756
30756
  var MAX_BECH32_LENGTH_LIMIT = 1023;
30757
30757
  var isOneOf = (target, options) => Array.isArray(options) && options.includes(target) || target === options;
@@ -30799,12 +30799,8 @@ var HexBlob = (target) => typedHex(target);
30799
30799
  HexBlob.fromBytes = (bytes) => Buffer.from(bytes).toString("hex");
30800
30800
  HexBlob.fromBase64 = (rawData) => Buffer.from(rawData, "base64").toString("hex");
30801
30801
  HexBlob.toTypedBech32 = (prefix, hexString) => import_bech32.bech32.encode(prefix, import_bech32.bech32.toWords(Uint8Array.from(Buffer.from(hexString, "hex"))));
30802
- var castHexBlob = (target, expectedLength) => {
30803
- assertLength(expectedLength, target);
30804
- return target;
30805
- };
30806
30802
 
30807
- // ../../node_modules/@cardano-sdk/util/dist/esm/BigIntMath.js
30803
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/BigIntMath.js
30808
30804
  var BigIntMath = {
30809
30805
  abs(x) {
30810
30806
  return x < 0n ? -x : x;
@@ -30829,10 +30825,10 @@ var BigIntMath = {
30829
30825
  }
30830
30826
  };
30831
30827
 
30832
- // ../../node_modules/@cardano-sdk/util/dist/esm/isNotNil.js
30828
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/isNotNil.js
30833
30829
  var isNotNil = (item) => typeof item !== "undefined" && item !== null;
30834
30830
 
30835
- // ../../node_modules/@cardano-sdk/util/dist/esm/Percent.js
30831
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/Percent.js
30836
30832
  var import_sum = __toESM(require_sum(), 1);
30837
30833
  var Percent = (value3) => value3;
30838
30834
 
@@ -30840,12 +30836,82 @@ var Percent = (value3) => value3;
30840
30836
  var import_blake2b = __toESM(require_blake2b2(), 1);
30841
30837
  var import_libsodium_wrappers_sumo = __toESM(require_libsodium_wrappers(), 1);
30842
30838
 
30839
+ // ../../node_modules/@cardano-sdk/crypto/node_modules/@cardano-sdk/util/dist/esm/errors.js
30840
+ var isErrorLike2 = (error) => {
30841
+ if (!error || typeof error !== "object" || !("message" in error && "stack" in error))
30842
+ return false;
30843
+ const { message, stack } = error;
30844
+ return typeof message === "string" && typeof stack === "string";
30845
+ };
30846
+ var ComposableError2 = class _ComposableError extends CustomError {
30847
+ constructor(message, innerError) {
30848
+ let firstLineOfInnerErrorStack = "";
30849
+ let innerErrorStack = [];
30850
+ if (isErrorLike2(innerError) && innerError.stack) {
30851
+ [firstLineOfInnerErrorStack, ...innerErrorStack] = innerError.stack.split(_ComposableError.stackDelimiter);
30852
+ message = `${message} due to
30853
+ ${firstLineOfInnerErrorStack}`;
30854
+ }
30855
+ if (typeof innerError === "string")
30856
+ message = `${message} due to
30857
+ ${innerError}`;
30858
+ super(message);
30859
+ this.innerError = innerError;
30860
+ if (!this.stack || innerErrorStack.length === 0)
30861
+ return;
30862
+ const [firstLineOfStack] = this.stack.split(_ComposableError.stackDelimiter);
30863
+ Object.defineProperty(this, "stack", {
30864
+ configurable: true,
30865
+ value: `${firstLineOfStack}${innerErrorStack.join(_ComposableError.stackDelimiter)}`
30866
+ });
30867
+ }
30868
+ };
30869
+ ComposableError2.stackDelimiter = "\n at ";
30870
+ var InvalidStringError2 = class extends ComposableError2 {
30871
+ constructor(expectation, innerError) {
30872
+ super(`Invalid string: "${expectation}"`, innerError);
30873
+ }
30874
+ };
30875
+
30876
+ // ../../node_modules/@cardano-sdk/crypto/node_modules/@cardano-sdk/util/dist/esm/primitives.js
30877
+ var import_bech322 = __toESM(require_dist(), 1);
30878
+ var assertLength2 = (expectedLength, target) => {
30879
+ if (expectedLength && target.length !== expectedLength) {
30880
+ throw new InvalidStringError2(`expected length '${expectedLength}', got ${target.length}`);
30881
+ }
30882
+ };
30883
+ var assertIsHexString2 = (target, expectedLength) => {
30884
+ assertLength2(expectedLength, target);
30885
+ if (target.length > 0 && !/^[\da-f]+$/i.test(target)) {
30886
+ throw new InvalidStringError2("expected hex string");
30887
+ }
30888
+ };
30889
+ var typedHex2 = (value3, length2) => {
30890
+ assertIsHexString2(value3, length2);
30891
+ return value3;
30892
+ };
30893
+ var Base64Blob2 = (target) => {
30894
+ if (/^(?:[\d+/a-z]{4})*(?:[\d+/a-z]{2}==|[\d+/a-z]{3}=)?$/i.test(target)) {
30895
+ return target;
30896
+ }
30897
+ throw new InvalidStringError2("expected base64 string");
30898
+ };
30899
+ Base64Blob2.fromBytes = (bytes) => Buffer.from(bytes).toString("base64");
30900
+ var HexBlob2 = (target) => typedHex2(target);
30901
+ HexBlob2.fromBytes = (bytes) => Buffer.from(bytes).toString("hex");
30902
+ HexBlob2.fromBase64 = (rawData) => Buffer.from(rawData, "base64").toString("hex");
30903
+ HexBlob2.toTypedBech32 = (prefix, hexString) => import_bech322.bech32.encode(prefix, import_bech322.bech32.toWords(Uint8Array.from(Buffer.from(hexString, "hex"))));
30904
+ var castHexBlob = (target, expectedLength) => {
30905
+ assertLength2(expectedLength, target);
30906
+ return target;
30907
+ };
30908
+
30843
30909
  // ../../node_modules/@cardano-sdk/crypto/dist/esm/hexTypes.js
30844
- var Bip32PublicKeyHex = (key) => typedHex(key, 128);
30845
- var Ed25519KeyHashHex = (value3) => typedHex(value3, 56);
30846
- var Hash32ByteBase16 = (value3) => typedHex(value3, 64);
30910
+ var Bip32PublicKeyHex = (key) => typedHex2(key, 128);
30911
+ var Ed25519KeyHashHex = (value3) => typedHex2(value3, 56);
30912
+ var Hash32ByteBase16 = (value3) => typedHex2(value3, 64);
30847
30913
  Hash32ByteBase16.fromHexBlob = (value3) => castHexBlob(value3, 64);
30848
- var Hash28ByteBase16 = (value3) => typedHex(value3, 56);
30914
+ var Hash28ByteBase16 = (value3) => typedHex2(value3, 56);
30849
30915
  Hash28ByteBase16.fromEd25519KeyHashHex = (value3) => value3;
30850
30916
 
30851
30917
  // ../../node_modules/web-encoding/src/lib.mjs
@@ -31270,7 +31336,7 @@ function genBech32(encoding) {
31270
31336
  toWords
31271
31337
  };
31272
31338
  }
31273
- var bech322 = /* @__PURE__ */ genBech32("bech32");
31339
+ var bech323 = /* @__PURE__ */ genBech32("bech32");
31274
31340
 
31275
31341
  // ../../node_modules/@cardano-sdk/core/dist/esm/Cardano/Address/BaseAddress.js
31276
31342
  var __classPrivateFieldSet = function(receiver, state, value3, kind, f) {
@@ -33403,8 +33469,8 @@ PoolId.fromKeyHash = (value3) => HexBlob.toTypedBech32("pool", HexBlob(value3));
33403
33469
  var PoolIdHex = (value3) => Hash28ByteBase16(value3);
33404
33470
  var VrfVkHex = (target) => typedHex(target, 64);
33405
33471
  PoolId.toKeyHash = (poolId) => {
33406
- const { words } = bech322.decode(poolId, MAX_BECH32_LENGTH_LIMIT2);
33407
- return Ed25519KeyHashHex(HexBlob.fromBytes(bech322.fromWords(words)));
33472
+ const { words } = bech323.decode(poolId, MAX_BECH32_LENGTH_LIMIT2);
33473
+ return Ed25519KeyHashHex(HexBlob.fromBytes(bech323.fromWords(words)));
33408
33474
  };
33409
33475
 
33410
33476
  // ../../node_modules/@cardano-sdk/core/dist/esm/Cardano/types/Block.js
@@ -33432,8 +33498,8 @@ var SlotLeader = (value3) => {
33432
33498
  }
33433
33499
  };
33434
33500
  VrfVkBech32.fromHex = (value3) => {
33435
- const words = bech322.toWords(Buffer.from(value3, "hex"));
33436
- return VrfVkBech32(bech322.encode("vrf_vk", words, 1023));
33501
+ const words = bech323.toWords(Buffer.from(value3, "hex"));
33502
+ return VrfVkBech32(bech323.encode("vrf_vk", words, 1023));
33437
33503
  };
33438
33504
 
33439
33505
  // ../../node_modules/@cardano-sdk/core/dist/esm/Serialization/Scripts/NativeScript/TimelockExpiry.js
@@ -44188,16 +44254,16 @@ var Address = class _Address {
44188
44254
  return base58.encode(Buffer.from(this.toBytes(), "hex"));
44189
44255
  }
44190
44256
  toBech32() {
44191
- const words = bech322.toWords(Buffer.from(this.toBytes(), "hex"));
44257
+ const words = bech323.toWords(Buffer.from(this.toBytes(), "hex"));
44192
44258
  if (__classPrivateFieldGet99(this, _Address_props, "f").type === AddressType.Byron)
44193
44259
  throw new Error("Only Shelley addresses will be encoded in bech32");
44194
44260
  const prefix = _Address.getBech32Prefix(__classPrivateFieldGet99(this, _Address_props, "f").type, __classPrivateFieldGet99(this, _Address_props, "f").networkId);
44195
- const bech32Address = bech322.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT3);
44261
+ const bech32Address = bech323.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT3);
44196
44262
  return __classPrivateFieldGet99(this, _Address_props, "f").type === AddressType.RewardKey || __classPrivateFieldGet99(this, _Address_props, "f").type === AddressType.RewardScript ? bech32Address : bech32Address;
44197
44263
  }
44198
- static fromBech32(bech325) {
44199
- const { words } = bech322.decode(bech325, MAX_BECH32_LENGTH_LIMIT3);
44200
- return _Address.fromBytes(HexBlob.fromBytes(bech322.fromWords(words)));
44264
+ static fromBech32(bech326) {
44265
+ const { words } = bech323.decode(bech326, MAX_BECH32_LENGTH_LIMIT3);
44266
+ return _Address.fromBytes(HexBlob.fromBytes(bech323.fromWords(words)));
44201
44267
  }
44202
44268
  static fromString(address) {
44203
44269
  try {
@@ -44210,9 +44276,9 @@ var Address = class _Address {
44210
44276
  }
44211
44277
  return null;
44212
44278
  }
44213
- static isValidBech32(bech325) {
44279
+ static isValidBech32(bech326) {
44214
44280
  try {
44215
- _Address.fromBech32(bech325);
44281
+ _Address.fromBech32(bech326);
44216
44282
  } catch {
44217
44283
  return false;
44218
44284
  }
@@ -44312,8 +44378,8 @@ DRepID.cip105FromCredential = (credential) => {
44312
44378
  if (credential.type === CredentialType.ScriptHash) {
44313
44379
  prefix = "drep_script";
44314
44380
  }
44315
- const words = bech322.toWords(Buffer.from(credential.hash, "hex"));
44316
- return bech322.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT4);
44381
+ const words = bech323.toWords(Buffer.from(credential.hash, "hex"));
44382
+ return bech323.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT4);
44317
44383
  };
44318
44384
  DRepID.cip129FromCredential = (credential) => {
44319
44385
  let header = "22";
@@ -44321,12 +44387,12 @@ DRepID.cip129FromCredential = (credential) => {
44321
44387
  header = "23";
44322
44388
  }
44323
44389
  const cip129payload = `${header}${credential.hash}`;
44324
- const words = bech322.toWords(Buffer.from(cip129payload, "hex"));
44325
- return bech322.encode("drep", words, MAX_BECH32_LENGTH_LIMIT4);
44390
+ const words = bech323.toWords(Buffer.from(cip129payload, "hex"));
44391
+ return bech323.encode("drep", words, MAX_BECH32_LENGTH_LIMIT4);
44326
44392
  };
44327
44393
  DRepID.toCredential = (drepId) => {
44328
- const { words } = bech322.decode(drepId, MAX_BECH32_LENGTH_LIMIT4);
44329
- const payload = bech322.fromWords(words);
44394
+ const { words } = bech323.decode(drepId, MAX_BECH32_LENGTH_LIMIT4);
44395
+ const payload = bech323.fromWords(words);
44330
44396
  if (payload.length !== CIP_105_DREP_ID_LENGTH && payload.length !== CIP_129_DREP_ID_LENGTH) {
44331
44397
  throw new Error("Invalid DRepID payload");
44332
44398
  }
@@ -44469,12 +44535,12 @@ var Cip1854ExtendedAccountPublicKey = (value3) => {
44469
44535
  return value3;
44470
44536
  };
44471
44537
  Cip1854ExtendedAccountPublicKey.fromBip32PublicKeyHex = (value3) => {
44472
- const words = bech322.toWords(Buffer.from(value3, "hex"));
44473
- return Cip1854ExtendedAccountPublicKey(bech322.encode(bip32PublicKeyPrefix, words, MAX_BECH32_LENGTH_LIMIT5));
44538
+ const words = bech323.toWords(Buffer.from(value3, "hex"));
44539
+ return Cip1854ExtendedAccountPublicKey(bech323.encode(bip32PublicKeyPrefix, words, MAX_BECH32_LENGTH_LIMIT5));
44474
44540
  };
44475
44541
  Cip1854ExtendedAccountPublicKey.toBip32PublicKeyHex = (value3) => {
44476
- const { words } = bech322.decode(value3, MAX_BECH32_LENGTH_LIMIT5);
44477
- return Bip32PublicKeyHex(Buffer.from(bech322.fromWords(words)).toString("hex"));
44542
+ const { words } = bech323.decode(value3, MAX_BECH32_LENGTH_LIMIT5);
44543
+ return Bip32PublicKeyHex(Buffer.from(bech323.fromWords(words)).toString("hex"));
44478
44544
  };
44479
44545
 
44480
44546
  // ../../node_modules/@cardano-sdk/core/dist/esm/Cardano/util/computeImplicitCoin.js
@@ -44760,26 +44826,92 @@ __export(Cardano_exports, {
44760
44826
  util: () => util_exports
44761
44827
  });
44762
44828
 
44829
+ // ../../node_modules/@cardano-sdk/util/dist/esm/errors.js
44830
+ var isErrorLike3 = (error) => {
44831
+ if (!error || typeof error !== "object" || !("message" in error && "stack" in error))
44832
+ return false;
44833
+ const { message, stack } = error;
44834
+ return typeof message === "string" && typeof stack === "string";
44835
+ };
44836
+ var ComposableError3 = class _ComposableError extends CustomError {
44837
+ constructor(message, innerError) {
44838
+ let firstLineOfInnerErrorStack = "";
44839
+ let innerErrorStack = [];
44840
+ if (isErrorLike3(innerError) && innerError.stack) {
44841
+ [firstLineOfInnerErrorStack, ...innerErrorStack] = innerError.stack.split(_ComposableError.stackDelimiter);
44842
+ message = `${message} due to
44843
+ ${firstLineOfInnerErrorStack}`;
44844
+ }
44845
+ if (typeof innerError === "string")
44846
+ message = `${message} due to
44847
+ ${innerError}`;
44848
+ super(message);
44849
+ this.innerError = innerError;
44850
+ if (!this.stack || innerErrorStack.length === 0)
44851
+ return;
44852
+ const [firstLineOfStack] = this.stack.split(_ComposableError.stackDelimiter);
44853
+ Object.defineProperty(this, "stack", {
44854
+ configurable: true,
44855
+ value: `${firstLineOfStack}${innerErrorStack.join(_ComposableError.stackDelimiter)}`
44856
+ });
44857
+ }
44858
+ };
44859
+ ComposableError3.stackDelimiter = "\n at ";
44860
+ var InvalidStringError3 = class extends ComposableError3 {
44861
+ constructor(expectation, innerError) {
44862
+ super(`Invalid string: "${expectation}"`, innerError);
44863
+ }
44864
+ };
44865
+
44866
+ // ../../node_modules/@cardano-sdk/util/dist/esm/primitives.js
44867
+ var import_bech323 = __toESM(require_dist(), 1);
44868
+ var assertLength3 = (expectedLength, target) => {
44869
+ if (expectedLength && target.length !== expectedLength) {
44870
+ throw new InvalidStringError3(`expected length '${expectedLength}', got ${target.length}`);
44871
+ }
44872
+ };
44873
+ var assertIsHexString3 = (target, expectedLength) => {
44874
+ assertLength3(expectedLength, target);
44875
+ if (target.length > 0 && !/^[\da-f]+$/i.test(target)) {
44876
+ throw new InvalidStringError3("expected hex string");
44877
+ }
44878
+ };
44879
+ var typedHex3 = (value3, length2) => {
44880
+ assertIsHexString3(value3, length2);
44881
+ return value3;
44882
+ };
44883
+ var Base64Blob3 = (target) => {
44884
+ if (/^(?:[\d+/a-z]{4})*(?:[\d+/a-z]{2}==|[\d+/a-z]{3}=)?$/i.test(target)) {
44885
+ return target;
44886
+ }
44887
+ throw new InvalidStringError3("expected base64 string");
44888
+ };
44889
+ Base64Blob3.fromBytes = (bytes) => Buffer.from(bytes).toString("base64");
44890
+ var HexBlob3 = (target) => typedHex3(target);
44891
+ HexBlob3.fromBytes = (bytes) => Buffer.from(bytes).toString("hex");
44892
+ HexBlob3.fromBase64 = (rawData) => Buffer.from(rawData, "base64").toString("hex");
44893
+ HexBlob3.toTypedBech32 = (prefix, hexString) => import_bech323.bech32.encode(prefix, import_bech323.bech32.toWords(Uint8Array.from(Buffer.from(hexString, "hex"))));
44894
+
44763
44895
  // ../mesh-core-cst/dist/index.js
44764
44896
  var import_cbor = __toESM(require_dist5(), 1);
44765
44897
  var import_blakejs = __toESM(require_blakejs(), 1);
44766
44898
  var import_common = require("@meshsdk/common");
44767
44899
  var import_cbor2 = __toESM(require_dist5(), 1);
44768
44900
  var import_base32_encoding = __toESM(require_base32_encoding(), 1);
44769
- var import_bech322 = __toESM(require_dist(), 1);
44901
+ var import_bech324 = __toESM(require_dist(), 1);
44770
44902
  var import_common2 = require("@meshsdk/common");
44771
44903
  var import_common3 = require("@meshsdk/common");
44772
44904
  var import_base32_encoding2 = __toESM(require_base32_encoding(), 1);
44773
- var import_bech323 = __toESM(require_dist(), 1);
44905
+ var import_bech325 = __toESM(require_dist(), 1);
44774
44906
  var import_common4 = require("@meshsdk/common");
44775
44907
  var import_common5 = require("@meshsdk/common");
44776
44908
  var import_common6 = require("@meshsdk/common");
44777
44909
  var import_common7 = require("@meshsdk/common");
44778
44910
  var import_base32_encoding3 = __toESM(require_base32_encoding(), 1);
44779
- var import_bech324 = __toESM(require_dist(), 1);
44911
+ var import_bech326 = __toESM(require_dist(), 1);
44780
44912
  var import_cbor3 = __toESM(require_dist5(), 1);
44781
44913
  var import_base32_encoding4 = __toESM(require_base32_encoding(), 1);
44782
- var import_bech325 = __toESM(require_dist(), 1);
44914
+ var import_bech327 = __toESM(require_dist(), 1);
44783
44915
  var import_common8 = require("@meshsdk/common");
44784
44916
  var import_cbor4 = __toESM(require_dist5(), 1);
44785
44917
  var import_plutus_data = __toESM(require_dist9(), 1);
@@ -48234,7 +48366,6 @@ var require_hash = __commonJS2({
48234
48366
  var Slot2 = Cardano_exports.Slot;
48235
48367
  var Value2 = Serialization_exports.Value;
48236
48368
  var Transaction2 = Serialization_exports.Transaction;
48237
- var TransactionId2 = Cardano_exports.TransactionId;
48238
48369
  var TransactionBody2 = Serialization_exports.TransactionBody;
48239
48370
  var TransactionWitnessSet2 = Serialization_exports.TransactionWitnessSet;
48240
48371
  var AuxilliaryData = Serialization_exports.AuxiliaryData;
@@ -48410,7 +48541,7 @@ var fromBuilderToPlutusData = (data) => {
48410
48541
  if (data.type === "Mesh") {
48411
48542
  return toPlutusData(data.content);
48412
48543
  } else if (data.type === "CBOR") {
48413
- return PlutusData2.fromCbor(HexBlob(data.content));
48544
+ return PlutusData2.fromCbor(HexBlob3(data.content));
48414
48545
  } else if (data.type === "JSON") {
48415
48546
  let content;
48416
48547
  if (typeof data.content === "string") {
@@ -48498,7 +48629,7 @@ var fromPlutusDataToJson = (data) => {
48498
48629
  }
48499
48630
  };
48500
48631
  var datumCborToJson = (datumCbor) => {
48501
- const parsedDatum = PlutusData2.fromCbor(HexBlob(datumCbor));
48632
+ const parsedDatum = PlutusData2.fromCbor(HexBlob3(datumCbor));
48502
48633
  return fromPlutusDataToJson(parsedDatum);
48503
48634
  };
48504
48635
  var parseDatumCbor = (datumCbor) => {
package/dist/index.js CHANGED
@@ -30700,7 +30700,7 @@ var CustomError = function(_super) {
30700
30700
  return CustomError2;
30701
30701
  }(Error);
30702
30702
 
30703
- // ../../node_modules/@cardano-sdk/util/dist/esm/errors.js
30703
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/errors.js
30704
30704
  var formatErrorMessage = (reason, detail) => reason + (detail ? ` (${detail})` : "");
30705
30705
  var isErrorLike = (error) => {
30706
30706
  if (!error || typeof error !== "object" || !("message" in error && "stack" in error))
@@ -30748,7 +30748,7 @@ var InvalidStateError = class extends CustomError {
30748
30748
  }
30749
30749
  };
30750
30750
 
30751
- // ../../node_modules/@cardano-sdk/util/dist/esm/primitives.js
30751
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/primitives.js
30752
30752
  var import_bech32 = __toESM(require_dist(), 1);
30753
30753
  var MAX_BECH32_LENGTH_LIMIT = 1023;
30754
30754
  var isOneOf = (target, options) => Array.isArray(options) && options.includes(target) || target === options;
@@ -30796,12 +30796,8 @@ var HexBlob = (target) => typedHex(target);
30796
30796
  HexBlob.fromBytes = (bytes) => Buffer.from(bytes).toString("hex");
30797
30797
  HexBlob.fromBase64 = (rawData) => Buffer.from(rawData, "base64").toString("hex");
30798
30798
  HexBlob.toTypedBech32 = (prefix, hexString) => import_bech32.bech32.encode(prefix, import_bech32.bech32.toWords(Uint8Array.from(Buffer.from(hexString, "hex"))));
30799
- var castHexBlob = (target, expectedLength) => {
30800
- assertLength(expectedLength, target);
30801
- return target;
30802
- };
30803
30799
 
30804
- // ../../node_modules/@cardano-sdk/util/dist/esm/BigIntMath.js
30800
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/BigIntMath.js
30805
30801
  var BigIntMath = {
30806
30802
  abs(x) {
30807
30803
  return x < 0n ? -x : x;
@@ -30826,10 +30822,10 @@ var BigIntMath = {
30826
30822
  }
30827
30823
  };
30828
30824
 
30829
- // ../../node_modules/@cardano-sdk/util/dist/esm/isNotNil.js
30825
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/isNotNil.js
30830
30826
  var isNotNil = (item) => typeof item !== "undefined" && item !== null;
30831
30827
 
30832
- // ../../node_modules/@cardano-sdk/util/dist/esm/Percent.js
30828
+ // ../../node_modules/@cardano-sdk/core/node_modules/@cardano-sdk/util/dist/esm/Percent.js
30833
30829
  var import_sum = __toESM(require_sum(), 1);
30834
30830
  var Percent = (value3) => value3;
30835
30831
 
@@ -30837,12 +30833,82 @@ var Percent = (value3) => value3;
30837
30833
  var import_blake2b = __toESM(require_blake2b2(), 1);
30838
30834
  var import_libsodium_wrappers_sumo = __toESM(require_libsodium_wrappers(), 1);
30839
30835
 
30836
+ // ../../node_modules/@cardano-sdk/crypto/node_modules/@cardano-sdk/util/dist/esm/errors.js
30837
+ var isErrorLike2 = (error) => {
30838
+ if (!error || typeof error !== "object" || !("message" in error && "stack" in error))
30839
+ return false;
30840
+ const { message, stack } = error;
30841
+ return typeof message === "string" && typeof stack === "string";
30842
+ };
30843
+ var ComposableError2 = class _ComposableError extends CustomError {
30844
+ constructor(message, innerError) {
30845
+ let firstLineOfInnerErrorStack = "";
30846
+ let innerErrorStack = [];
30847
+ if (isErrorLike2(innerError) && innerError.stack) {
30848
+ [firstLineOfInnerErrorStack, ...innerErrorStack] = innerError.stack.split(_ComposableError.stackDelimiter);
30849
+ message = `${message} due to
30850
+ ${firstLineOfInnerErrorStack}`;
30851
+ }
30852
+ if (typeof innerError === "string")
30853
+ message = `${message} due to
30854
+ ${innerError}`;
30855
+ super(message);
30856
+ this.innerError = innerError;
30857
+ if (!this.stack || innerErrorStack.length === 0)
30858
+ return;
30859
+ const [firstLineOfStack] = this.stack.split(_ComposableError.stackDelimiter);
30860
+ Object.defineProperty(this, "stack", {
30861
+ configurable: true,
30862
+ value: `${firstLineOfStack}${innerErrorStack.join(_ComposableError.stackDelimiter)}`
30863
+ });
30864
+ }
30865
+ };
30866
+ ComposableError2.stackDelimiter = "\n at ";
30867
+ var InvalidStringError2 = class extends ComposableError2 {
30868
+ constructor(expectation, innerError) {
30869
+ super(`Invalid string: "${expectation}"`, innerError);
30870
+ }
30871
+ };
30872
+
30873
+ // ../../node_modules/@cardano-sdk/crypto/node_modules/@cardano-sdk/util/dist/esm/primitives.js
30874
+ var import_bech322 = __toESM(require_dist(), 1);
30875
+ var assertLength2 = (expectedLength, target) => {
30876
+ if (expectedLength && target.length !== expectedLength) {
30877
+ throw new InvalidStringError2(`expected length '${expectedLength}', got ${target.length}`);
30878
+ }
30879
+ };
30880
+ var assertIsHexString2 = (target, expectedLength) => {
30881
+ assertLength2(expectedLength, target);
30882
+ if (target.length > 0 && !/^[\da-f]+$/i.test(target)) {
30883
+ throw new InvalidStringError2("expected hex string");
30884
+ }
30885
+ };
30886
+ var typedHex2 = (value3, length2) => {
30887
+ assertIsHexString2(value3, length2);
30888
+ return value3;
30889
+ };
30890
+ var Base64Blob2 = (target) => {
30891
+ if (/^(?:[\d+/a-z]{4})*(?:[\d+/a-z]{2}==|[\d+/a-z]{3}=)?$/i.test(target)) {
30892
+ return target;
30893
+ }
30894
+ throw new InvalidStringError2("expected base64 string");
30895
+ };
30896
+ Base64Blob2.fromBytes = (bytes) => Buffer.from(bytes).toString("base64");
30897
+ var HexBlob2 = (target) => typedHex2(target);
30898
+ HexBlob2.fromBytes = (bytes) => Buffer.from(bytes).toString("hex");
30899
+ HexBlob2.fromBase64 = (rawData) => Buffer.from(rawData, "base64").toString("hex");
30900
+ HexBlob2.toTypedBech32 = (prefix, hexString) => import_bech322.bech32.encode(prefix, import_bech322.bech32.toWords(Uint8Array.from(Buffer.from(hexString, "hex"))));
30901
+ var castHexBlob = (target, expectedLength) => {
30902
+ assertLength2(expectedLength, target);
30903
+ return target;
30904
+ };
30905
+
30840
30906
  // ../../node_modules/@cardano-sdk/crypto/dist/esm/hexTypes.js
30841
- var Bip32PublicKeyHex = (key) => typedHex(key, 128);
30842
- var Ed25519KeyHashHex = (value3) => typedHex(value3, 56);
30843
- var Hash32ByteBase16 = (value3) => typedHex(value3, 64);
30907
+ var Bip32PublicKeyHex = (key) => typedHex2(key, 128);
30908
+ var Ed25519KeyHashHex = (value3) => typedHex2(value3, 56);
30909
+ var Hash32ByteBase16 = (value3) => typedHex2(value3, 64);
30844
30910
  Hash32ByteBase16.fromHexBlob = (value3) => castHexBlob(value3, 64);
30845
- var Hash28ByteBase16 = (value3) => typedHex(value3, 56);
30911
+ var Hash28ByteBase16 = (value3) => typedHex2(value3, 56);
30846
30912
  Hash28ByteBase16.fromEd25519KeyHashHex = (value3) => value3;
30847
30913
 
30848
30914
  // ../../node_modules/web-encoding/src/lib.mjs
@@ -31267,7 +31333,7 @@ function genBech32(encoding) {
31267
31333
  toWords
31268
31334
  };
31269
31335
  }
31270
- var bech322 = /* @__PURE__ */ genBech32("bech32");
31336
+ var bech323 = /* @__PURE__ */ genBech32("bech32");
31271
31337
 
31272
31338
  // ../../node_modules/@cardano-sdk/core/dist/esm/Cardano/Address/BaseAddress.js
31273
31339
  var __classPrivateFieldSet = function(receiver, state, value3, kind, f) {
@@ -33400,8 +33466,8 @@ PoolId.fromKeyHash = (value3) => HexBlob.toTypedBech32("pool", HexBlob(value3));
33400
33466
  var PoolIdHex = (value3) => Hash28ByteBase16(value3);
33401
33467
  var VrfVkHex = (target) => typedHex(target, 64);
33402
33468
  PoolId.toKeyHash = (poolId) => {
33403
- const { words } = bech322.decode(poolId, MAX_BECH32_LENGTH_LIMIT2);
33404
- return Ed25519KeyHashHex(HexBlob.fromBytes(bech322.fromWords(words)));
33469
+ const { words } = bech323.decode(poolId, MAX_BECH32_LENGTH_LIMIT2);
33470
+ return Ed25519KeyHashHex(HexBlob.fromBytes(bech323.fromWords(words)));
33405
33471
  };
33406
33472
 
33407
33473
  // ../../node_modules/@cardano-sdk/core/dist/esm/Cardano/types/Block.js
@@ -33429,8 +33495,8 @@ var SlotLeader = (value3) => {
33429
33495
  }
33430
33496
  };
33431
33497
  VrfVkBech32.fromHex = (value3) => {
33432
- const words = bech322.toWords(Buffer.from(value3, "hex"));
33433
- return VrfVkBech32(bech322.encode("vrf_vk", words, 1023));
33498
+ const words = bech323.toWords(Buffer.from(value3, "hex"));
33499
+ return VrfVkBech32(bech323.encode("vrf_vk", words, 1023));
33434
33500
  };
33435
33501
 
33436
33502
  // ../../node_modules/@cardano-sdk/core/dist/esm/Serialization/Scripts/NativeScript/TimelockExpiry.js
@@ -44185,16 +44251,16 @@ var Address = class _Address {
44185
44251
  return base58.encode(Buffer.from(this.toBytes(), "hex"));
44186
44252
  }
44187
44253
  toBech32() {
44188
- const words = bech322.toWords(Buffer.from(this.toBytes(), "hex"));
44254
+ const words = bech323.toWords(Buffer.from(this.toBytes(), "hex"));
44189
44255
  if (__classPrivateFieldGet99(this, _Address_props, "f").type === AddressType.Byron)
44190
44256
  throw new Error("Only Shelley addresses will be encoded in bech32");
44191
44257
  const prefix = _Address.getBech32Prefix(__classPrivateFieldGet99(this, _Address_props, "f").type, __classPrivateFieldGet99(this, _Address_props, "f").networkId);
44192
- const bech32Address = bech322.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT3);
44258
+ const bech32Address = bech323.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT3);
44193
44259
  return __classPrivateFieldGet99(this, _Address_props, "f").type === AddressType.RewardKey || __classPrivateFieldGet99(this, _Address_props, "f").type === AddressType.RewardScript ? bech32Address : bech32Address;
44194
44260
  }
44195
- static fromBech32(bech325) {
44196
- const { words } = bech322.decode(bech325, MAX_BECH32_LENGTH_LIMIT3);
44197
- return _Address.fromBytes(HexBlob.fromBytes(bech322.fromWords(words)));
44261
+ static fromBech32(bech326) {
44262
+ const { words } = bech323.decode(bech326, MAX_BECH32_LENGTH_LIMIT3);
44263
+ return _Address.fromBytes(HexBlob.fromBytes(bech323.fromWords(words)));
44198
44264
  }
44199
44265
  static fromString(address) {
44200
44266
  try {
@@ -44207,9 +44273,9 @@ var Address = class _Address {
44207
44273
  }
44208
44274
  return null;
44209
44275
  }
44210
- static isValidBech32(bech325) {
44276
+ static isValidBech32(bech326) {
44211
44277
  try {
44212
- _Address.fromBech32(bech325);
44278
+ _Address.fromBech32(bech326);
44213
44279
  } catch {
44214
44280
  return false;
44215
44281
  }
@@ -44309,8 +44375,8 @@ DRepID.cip105FromCredential = (credential) => {
44309
44375
  if (credential.type === CredentialType.ScriptHash) {
44310
44376
  prefix = "drep_script";
44311
44377
  }
44312
- const words = bech322.toWords(Buffer.from(credential.hash, "hex"));
44313
- return bech322.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT4);
44378
+ const words = bech323.toWords(Buffer.from(credential.hash, "hex"));
44379
+ return bech323.encode(prefix, words, MAX_BECH32_LENGTH_LIMIT4);
44314
44380
  };
44315
44381
  DRepID.cip129FromCredential = (credential) => {
44316
44382
  let header = "22";
@@ -44318,12 +44384,12 @@ DRepID.cip129FromCredential = (credential) => {
44318
44384
  header = "23";
44319
44385
  }
44320
44386
  const cip129payload = `${header}${credential.hash}`;
44321
- const words = bech322.toWords(Buffer.from(cip129payload, "hex"));
44322
- return bech322.encode("drep", words, MAX_BECH32_LENGTH_LIMIT4);
44387
+ const words = bech323.toWords(Buffer.from(cip129payload, "hex"));
44388
+ return bech323.encode("drep", words, MAX_BECH32_LENGTH_LIMIT4);
44323
44389
  };
44324
44390
  DRepID.toCredential = (drepId) => {
44325
- const { words } = bech322.decode(drepId, MAX_BECH32_LENGTH_LIMIT4);
44326
- const payload = bech322.fromWords(words);
44391
+ const { words } = bech323.decode(drepId, MAX_BECH32_LENGTH_LIMIT4);
44392
+ const payload = bech323.fromWords(words);
44327
44393
  if (payload.length !== CIP_105_DREP_ID_LENGTH && payload.length !== CIP_129_DREP_ID_LENGTH) {
44328
44394
  throw new Error("Invalid DRepID payload");
44329
44395
  }
@@ -44466,12 +44532,12 @@ var Cip1854ExtendedAccountPublicKey = (value3) => {
44466
44532
  return value3;
44467
44533
  };
44468
44534
  Cip1854ExtendedAccountPublicKey.fromBip32PublicKeyHex = (value3) => {
44469
- const words = bech322.toWords(Buffer.from(value3, "hex"));
44470
- return Cip1854ExtendedAccountPublicKey(bech322.encode(bip32PublicKeyPrefix, words, MAX_BECH32_LENGTH_LIMIT5));
44535
+ const words = bech323.toWords(Buffer.from(value3, "hex"));
44536
+ return Cip1854ExtendedAccountPublicKey(bech323.encode(bip32PublicKeyPrefix, words, MAX_BECH32_LENGTH_LIMIT5));
44471
44537
  };
44472
44538
  Cip1854ExtendedAccountPublicKey.toBip32PublicKeyHex = (value3) => {
44473
- const { words } = bech322.decode(value3, MAX_BECH32_LENGTH_LIMIT5);
44474
- return Bip32PublicKeyHex(Buffer.from(bech322.fromWords(words)).toString("hex"));
44539
+ const { words } = bech323.decode(value3, MAX_BECH32_LENGTH_LIMIT5);
44540
+ return Bip32PublicKeyHex(Buffer.from(bech323.fromWords(words)).toString("hex"));
44475
44541
  };
44476
44542
 
44477
44543
  // ../../node_modules/@cardano-sdk/core/dist/esm/Cardano/util/computeImplicitCoin.js
@@ -44757,13 +44823,79 @@ __export(Cardano_exports, {
44757
44823
  util: () => util_exports
44758
44824
  });
44759
44825
 
44826
+ // ../../node_modules/@cardano-sdk/util/dist/esm/errors.js
44827
+ var isErrorLike3 = (error) => {
44828
+ if (!error || typeof error !== "object" || !("message" in error && "stack" in error))
44829
+ return false;
44830
+ const { message, stack } = error;
44831
+ return typeof message === "string" && typeof stack === "string";
44832
+ };
44833
+ var ComposableError3 = class _ComposableError extends CustomError {
44834
+ constructor(message, innerError) {
44835
+ let firstLineOfInnerErrorStack = "";
44836
+ let innerErrorStack = [];
44837
+ if (isErrorLike3(innerError) && innerError.stack) {
44838
+ [firstLineOfInnerErrorStack, ...innerErrorStack] = innerError.stack.split(_ComposableError.stackDelimiter);
44839
+ message = `${message} due to
44840
+ ${firstLineOfInnerErrorStack}`;
44841
+ }
44842
+ if (typeof innerError === "string")
44843
+ message = `${message} due to
44844
+ ${innerError}`;
44845
+ super(message);
44846
+ this.innerError = innerError;
44847
+ if (!this.stack || innerErrorStack.length === 0)
44848
+ return;
44849
+ const [firstLineOfStack] = this.stack.split(_ComposableError.stackDelimiter);
44850
+ Object.defineProperty(this, "stack", {
44851
+ configurable: true,
44852
+ value: `${firstLineOfStack}${innerErrorStack.join(_ComposableError.stackDelimiter)}`
44853
+ });
44854
+ }
44855
+ };
44856
+ ComposableError3.stackDelimiter = "\n at ";
44857
+ var InvalidStringError3 = class extends ComposableError3 {
44858
+ constructor(expectation, innerError) {
44859
+ super(`Invalid string: "${expectation}"`, innerError);
44860
+ }
44861
+ };
44862
+
44863
+ // ../../node_modules/@cardano-sdk/util/dist/esm/primitives.js
44864
+ var import_bech323 = __toESM(require_dist(), 1);
44865
+ var assertLength3 = (expectedLength, target) => {
44866
+ if (expectedLength && target.length !== expectedLength) {
44867
+ throw new InvalidStringError3(`expected length '${expectedLength}', got ${target.length}`);
44868
+ }
44869
+ };
44870
+ var assertIsHexString3 = (target, expectedLength) => {
44871
+ assertLength3(expectedLength, target);
44872
+ if (target.length > 0 && !/^[\da-f]+$/i.test(target)) {
44873
+ throw new InvalidStringError3("expected hex string");
44874
+ }
44875
+ };
44876
+ var typedHex3 = (value3, length2) => {
44877
+ assertIsHexString3(value3, length2);
44878
+ return value3;
44879
+ };
44880
+ var Base64Blob3 = (target) => {
44881
+ if (/^(?:[\d+/a-z]{4})*(?:[\d+/a-z]{2}==|[\d+/a-z]{3}=)?$/i.test(target)) {
44882
+ return target;
44883
+ }
44884
+ throw new InvalidStringError3("expected base64 string");
44885
+ };
44886
+ Base64Blob3.fromBytes = (bytes) => Buffer.from(bytes).toString("base64");
44887
+ var HexBlob3 = (target) => typedHex3(target);
44888
+ HexBlob3.fromBytes = (bytes) => Buffer.from(bytes).toString("hex");
44889
+ HexBlob3.fromBase64 = (rawData) => Buffer.from(rawData, "base64").toString("hex");
44890
+ HexBlob3.toTypedBech32 = (prefix, hexString) => import_bech323.bech32.encode(prefix, import_bech323.bech32.toWords(Uint8Array.from(Buffer.from(hexString, "hex"))));
44891
+
44760
44892
  // ../mesh-core-cst/dist/index.js
44761
44893
  var import_cbor = __toESM(require_dist5(), 1);
44762
44894
  var import_blakejs = __toESM(require_blakejs(), 1);
44763
44895
  var import_cbor2 = __toESM(require_dist5(), 1);
44764
44896
  import { stringToHex } from "@meshsdk/common";
44765
44897
  var import_base32_encoding = __toESM(require_base32_encoding(), 1);
44766
- var import_bech322 = __toESM(require_dist(), 1);
44898
+ var import_bech324 = __toESM(require_dist(), 1);
44767
44899
  import {
44768
44900
  fromUTF8,
44769
44901
  mnemonicToEntropy,
@@ -44771,21 +44903,21 @@ import {
44771
44903
  } from "@meshsdk/common";
44772
44904
  import { HARDENED_KEY_START } from "@meshsdk/common";
44773
44905
  var import_base32_encoding2 = __toESM(require_base32_encoding(), 1);
44774
- var import_bech323 = __toESM(require_dist(), 1);
44906
+ var import_bech325 = __toESM(require_dist(), 1);
44775
44907
  import {
44776
44908
  toBytes as toBytes3
44777
44909
  } from "@meshsdk/common";
44778
44910
  import { toBytes } from "@meshsdk/common";
44779
44911
  import { toBytes as toBytes2 } from "@meshsdk/common";
44780
44912
  var import_base32_encoding3 = __toESM(require_base32_encoding(), 1);
44781
- var import_bech324 = __toESM(require_dist(), 1);
44913
+ var import_bech326 = __toESM(require_dist(), 1);
44782
44914
  import {
44783
44915
  pubKeyAddress,
44784
44916
  scriptAddress
44785
44917
  } from "@meshsdk/common";
44786
44918
  var import_cbor3 = __toESM(require_dist5(), 1);
44787
44919
  var import_base32_encoding4 = __toESM(require_base32_encoding(), 1);
44788
- var import_bech325 = __toESM(require_dist(), 1);
44920
+ var import_bech327 = __toESM(require_dist(), 1);
44789
44921
  import {
44790
44922
  DEFAULT_PROTOCOL_PARAMETERS,
44791
44923
  DEFAULT_V1_COST_MODEL_LIST,
@@ -48248,7 +48380,6 @@ var require_hash = __commonJS2({
48248
48380
  var Slot2 = Cardano_exports.Slot;
48249
48381
  var Value2 = Serialization_exports.Value;
48250
48382
  var Transaction2 = Serialization_exports.Transaction;
48251
- var TransactionId2 = Cardano_exports.TransactionId;
48252
48383
  var TransactionBody2 = Serialization_exports.TransactionBody;
48253
48384
  var TransactionWitnessSet2 = Serialization_exports.TransactionWitnessSet;
48254
48385
  var AuxilliaryData = Serialization_exports.AuxiliaryData;
@@ -48424,7 +48555,7 @@ var fromBuilderToPlutusData = (data) => {
48424
48555
  if (data.type === "Mesh") {
48425
48556
  return toPlutusData(data.content);
48426
48557
  } else if (data.type === "CBOR") {
48427
- return PlutusData2.fromCbor(HexBlob(data.content));
48558
+ return PlutusData2.fromCbor(HexBlob3(data.content));
48428
48559
  } else if (data.type === "JSON") {
48429
48560
  let content;
48430
48561
  if (typeof data.content === "string") {
@@ -48512,7 +48643,7 @@ var fromPlutusDataToJson = (data) => {
48512
48643
  }
48513
48644
  };
48514
48645
  var datumCborToJson = (datumCbor) => {
48515
- const parsedDatum = PlutusData2.fromCbor(HexBlob(datumCbor));
48646
+ const parsedDatum = PlutusData2.fromCbor(HexBlob3(datumCbor));
48516
48647
  return fromPlutusDataToJson(parsedDatum);
48517
48648
  };
48518
48649
  var parseDatumCbor = (datumCbor) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/contract",
3
- "version": "1.9.0-beta.7",
3
+ "version": "1.9.0-beta.8",
4
4
  "description": "List of open-source smart contracts, complete with documentation, live demos, and end-to-end source code. https://meshjs.dev/smart-contracts",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.js",
@@ -34,8 +34,8 @@
34
34
  "typescript": "^5.3.3"
35
35
  },
36
36
  "dependencies": {
37
- "@meshsdk/common": "1.9.0-beta.7",
38
- "@meshsdk/core": "1.9.0-beta.7"
37
+ "@meshsdk/common": "1.9.0-beta.8",
38
+ "@meshsdk/core": "1.9.0-beta.8"
39
39
  },
40
40
  "prettier": "@meshsdk/configs/prettier",
41
41
  "publishConfig": {