@meshsdk/common 1.7.1 → 1.7.3

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
@@ -727,12 +727,17 @@ var mAssetClass = (currencySymbolHex, tokenNameHex) => {
727
727
  return mConStr0([currencySymbolHex, tokenNameHex]);
728
728
  };
729
729
  var mOutputReference = (txHash, index) => {
730
+ if (txHash.length !== 64) {
731
+ throw new Error("Invalid transaction hash - should be 32 bytes long");
732
+ }
733
+ return mConStr0([txHash, index]);
734
+ };
735
+ var mTxOutRef = (txHash, index) => {
730
736
  if (txHash.length !== 64) {
731
737
  throw new Error("Invalid transaction hash - should be 32 bytes long");
732
738
  }
733
739
  return mConStr0([mConStr0([txHash]), index]);
734
740
  };
735
- var mTxOutRef = (txHash, index) => mOutputReference(txHash, index);
736
741
  var mTuple = (key, value2) => [key, value2];
737
742
 
738
743
  // src/data/mesh/credentials.ts
@@ -869,12 +874,17 @@ var assetName = (bytes) => {
869
874
  var tokenName = (bytes) => assetName(bytes);
870
875
  var assetClass = (currencySymbolHex, tokenNameHex) => conStr0([currencySymbol(currencySymbolHex), tokenName(tokenNameHex)]);
871
876
  var outputReference = (txHash, index) => {
877
+ if (txHash.length !== 64) {
878
+ throw new Error("Invalid transaction hash - should be 32 bytes long");
879
+ }
880
+ return conStr0([byteString(txHash), integer(index)]);
881
+ };
882
+ var txOutRef = (txHash, index) => {
872
883
  if (txHash.length !== 64) {
873
884
  throw new Error("Invalid transaction hash - should be 32 bytes long");
874
885
  }
875
886
  return conStr0([conStr0([byteString(txHash)]), integer(index)]);
876
887
  };
877
- var txOutRef = (txHash, index) => outputReference(txHash, index);
878
888
  var posixTime = (int) => ({ int });
879
889
  var dict = (itemsMap) => ({
880
890
  map: itemsMap.map(([k, v]) => ({ k, v }))
package/dist/index.d.cts CHANGED
@@ -752,7 +752,7 @@ type MAssetClass = MConStr0<[string, string]>;
752
752
  * Aiken alias
753
753
  * The Mesh Data output reference
754
754
  */
755
- type MOutputReference = MConStr0<[MConStr0<[string]>, number]>;
755
+ type MOutputReference = MConStr0<[string, number]>;
756
756
  /**
757
757
  * PlutusTx alias
758
758
  * The Mesh Data TxOutRef
@@ -1031,7 +1031,7 @@ type AssetClass = ConStr0<[CurrencySymbol, TokenName]>;
1031
1031
  * Aiken alias
1032
1032
  * The Plutus Data output reference in JSON
1033
1033
  */
1034
- type OutputReference = ConStr0<[ConStr0<[ByteString]>, Integer]>;
1034
+ type OutputReference = ConStr0<[ByteString, Integer]>;
1035
1035
  /**
1036
1036
  * PlutusTx alias
1037
1037
  * The Plutus Data TxOutRef in JSON
@@ -1114,7 +1114,9 @@ declare const tokenName: (bytes: string) => TokenName;
1114
1114
  */
1115
1115
  declare const assetClass: (currencySymbolHex: string, tokenNameHex: string) => AssetClass;
1116
1116
  /**
1117
- * The utility function to create a Plutus Data output reference in JSON
1117
+ * The utility function to create a Plutus Data output reference in JSON.
1118
+ * Note that it is updated since aiken version v1.1.0.
1119
+ * If you want to build the type before Chang, please use txOutRef instead.
1118
1120
  * @param txHash The transaction hash
1119
1121
  * @param index The index of the output
1120
1122
  * @returns The Plutus Data output reference object
package/dist/index.d.ts CHANGED
@@ -752,7 +752,7 @@ type MAssetClass = MConStr0<[string, string]>;
752
752
  * Aiken alias
753
753
  * The Mesh Data output reference
754
754
  */
755
- type MOutputReference = MConStr0<[MConStr0<[string]>, number]>;
755
+ type MOutputReference = MConStr0<[string, number]>;
756
756
  /**
757
757
  * PlutusTx alias
758
758
  * The Mesh Data TxOutRef
@@ -1031,7 +1031,7 @@ type AssetClass = ConStr0<[CurrencySymbol, TokenName]>;
1031
1031
  * Aiken alias
1032
1032
  * The Plutus Data output reference in JSON
1033
1033
  */
1034
- type OutputReference = ConStr0<[ConStr0<[ByteString]>, Integer]>;
1034
+ type OutputReference = ConStr0<[ByteString, Integer]>;
1035
1035
  /**
1036
1036
  * PlutusTx alias
1037
1037
  * The Plutus Data TxOutRef in JSON
@@ -1114,7 +1114,9 @@ declare const tokenName: (bytes: string) => TokenName;
1114
1114
  */
1115
1115
  declare const assetClass: (currencySymbolHex: string, tokenNameHex: string) => AssetClass;
1116
1116
  /**
1117
- * The utility function to create a Plutus Data output reference in JSON
1117
+ * The utility function to create a Plutus Data output reference in JSON.
1118
+ * Note that it is updated since aiken version v1.1.0.
1119
+ * If you want to build the type before Chang, please use txOutRef instead.
1118
1120
  * @param txHash The transaction hash
1119
1121
  * @param index The index of the output
1120
1122
  * @returns The Plutus Data output reference object
package/dist/index.js CHANGED
@@ -598,12 +598,17 @@ var mAssetClass = (currencySymbolHex, tokenNameHex) => {
598
598
  return mConStr0([currencySymbolHex, tokenNameHex]);
599
599
  };
600
600
  var mOutputReference = (txHash, index) => {
601
+ if (txHash.length !== 64) {
602
+ throw new Error("Invalid transaction hash - should be 32 bytes long");
603
+ }
604
+ return mConStr0([txHash, index]);
605
+ };
606
+ var mTxOutRef = (txHash, index) => {
601
607
  if (txHash.length !== 64) {
602
608
  throw new Error("Invalid transaction hash - should be 32 bytes long");
603
609
  }
604
610
  return mConStr0([mConStr0([txHash]), index]);
605
611
  };
606
- var mTxOutRef = (txHash, index) => mOutputReference(txHash, index);
607
612
  var mTuple = (key, value2) => [key, value2];
608
613
 
609
614
  // src/data/mesh/credentials.ts
@@ -740,12 +745,17 @@ var assetName = (bytes) => {
740
745
  var tokenName = (bytes) => assetName(bytes);
741
746
  var assetClass = (currencySymbolHex, tokenNameHex) => conStr0([currencySymbol(currencySymbolHex), tokenName(tokenNameHex)]);
742
747
  var outputReference = (txHash, index) => {
748
+ if (txHash.length !== 64) {
749
+ throw new Error("Invalid transaction hash - should be 32 bytes long");
750
+ }
751
+ return conStr0([byteString(txHash), integer(index)]);
752
+ };
753
+ var txOutRef = (txHash, index) => {
743
754
  if (txHash.length !== 64) {
744
755
  throw new Error("Invalid transaction hash - should be 32 bytes long");
745
756
  }
746
757
  return conStr0([conStr0([byteString(txHash)]), integer(index)]);
747
758
  };
748
- var txOutRef = (txHash, index) => outputReference(txHash, index);
749
759
  var posixTime = (int) => ({ int });
750
760
  var dict = (itemsMap) => ({
751
761
  map: itemsMap.map(([k, v]) => ({ k, v }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/common",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",