@meshsdk/common 1.9.0-beta.10 → 1.9.0-beta.11

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
@@ -65,6 +65,7 @@ __export(index_exports, {
65
65
  conStr1: () => conStr1,
66
66
  conStr2: () => conStr2,
67
67
  conStr3: () => conStr3,
68
+ credential: () => credential,
68
69
  currencySymbol: () => currencySymbol,
69
70
  dict: () => dict,
70
71
  emptyTxBuilderBody: () => emptyTxBuilderBody,
@@ -90,6 +91,7 @@ __export(index_exports, {
90
91
  mConStr1: () => mConStr1,
91
92
  mConStr2: () => mConStr2,
92
93
  mConStr3: () => mConStr3,
94
+ mCredential: () => mCredential,
93
95
  mMaybeStakingHash: () => mMaybeStakingHash,
94
96
  mNone: () => mNone,
95
97
  mOption: () => mOption,
@@ -1100,6 +1102,7 @@ var mScriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) =
1100
1102
  { alternative: 1, fields: [bytes] },
1101
1103
  mMaybeStakingHash(stakeCredential || "", isStakeScriptCredential)
1102
1104
  ]);
1105
+ var mCredential = (hash, isScriptCredential = false) => isScriptCredential ? mConStr1([hash]) : mConStr0([hash]);
1103
1106
 
1104
1107
  // src/data/mesh/primitives.ts
1105
1108
  var mBool = (b) => b ? mConStr1([]) : mConStr0([]);
@@ -1264,6 +1267,7 @@ var scriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) =>
1264
1267
  conStr1([scriptHash(bytes)]),
1265
1268
  maybeStakingHash(stakeCredential || "", isStakeScriptCredential)
1266
1269
  ]);
1270
+ var credential = (hash, isScriptCredential = false) => isScriptCredential ? conStr1([scriptHash(hash)]) : conStr0([pubKeyHash(hash)]);
1267
1271
 
1268
1272
  // src/data/parser.ts
1269
1273
  var bytesToHex = (bytes) => Buffer.from(bytes).toString("hex");
@@ -1449,8 +1453,8 @@ var BigNum = class _BigNum {
1449
1453
  // src/utils/data-hash.ts
1450
1454
  var import_blakejs = require("blakejs");
1451
1455
  var hashDrepAnchor = (jsonLD) => {
1452
- const jsonHash = (0, import_blakejs.blake2bHex)(JSON.stringify(jsonLD, null, 2), void 0, 32);
1453
- return jsonHash;
1456
+ const jsonHash = (0, import_blakejs.blake2b)(JSON.stringify(jsonLD, null, 2), void 0, 32);
1457
+ return Buffer.from(jsonHash).toString("hex");
1454
1458
  };
1455
1459
 
1456
1460
  // src/utils/file.ts
@@ -2002,6 +2006,7 @@ var import_bip39 = require("bip39");
2002
2006
  conStr1,
2003
2007
  conStr2,
2004
2008
  conStr3,
2009
+ credential,
2005
2010
  currencySymbol,
2006
2011
  dict,
2007
2012
  emptyTxBuilderBody,
@@ -2027,6 +2032,7 @@ var import_bip39 = require("bip39");
2027
2032
  mConStr1,
2028
2033
  mConStr2,
2029
2034
  mConStr3,
2035
+ mCredential,
2030
2036
  mMaybeStakingHash,
2031
2037
  mNone,
2032
2038
  mOption,
package/dist/index.d.cts CHANGED
@@ -472,7 +472,7 @@ type ScriptTxIn = {
472
472
  };
473
473
  declare const txInToUtxo: (txIn: TxInParameter) => UTxO;
474
474
 
475
- type Credential = {
475
+ type Credential$1 = {
476
476
  type: "ScriptHash";
477
477
  scriptHash: string;
478
478
  } | {
@@ -503,7 +503,7 @@ type VoteType = {
503
503
  };
504
504
  type Voter = {
505
505
  type: "ConstitutionalCommittee";
506
- hotCred: Credential;
506
+ hotCred: Credential$1;
507
507
  } | {
508
508
  type: "DRep";
509
509
  drepId: string;
@@ -739,6 +739,10 @@ type MPubKeyAddress = MConStr0<[MConStr0<[string]>, MMaybeStakingHash]>;
739
739
  * The Mesh Data script address
740
740
  */
741
741
  type MScriptAddress = MConStr0<[MConStr1<[string]>, MMaybeStakingHash]>;
742
+ /**
743
+ * The Mesh Data credential
744
+ */
745
+ type MCredential = MConStr0<[string]> | MConStr1<[string]>;
742
746
  /**
743
747
  * The utility function to create a Mesh Data staking hash
744
748
  * @param stakeCredential The staking credential in hex
@@ -762,6 +766,13 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isStakeS
762
766
  * @returns The Mesh Data script address object
763
767
  */
764
768
  declare const mScriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => MScriptAddress;
769
+ /**
770
+ * The utility function to create a Mesh Data credential
771
+ * @param hash The pub key hash or script hash
772
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
773
+ * @returns Mesh Data credential object
774
+ */
775
+ declare const mCredential: (hash: string, isScriptCredential?: boolean) => MCredential;
765
776
 
766
777
  /**
767
778
  * The Mesh Data boolean
@@ -1138,6 +1149,10 @@ type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
1138
1149
  * The Plutus Data script address in JSON
1139
1150
  */
1140
1151
  type ScriptAddress = ConStr0<[ConStr1<[ScriptHash]>, MaybeStakingHash]>;
1152
+ /**
1153
+ * The Plutus Data credential in JSON
1154
+ */
1155
+ type Credential = ConStr0<[PubKeyHash]> | ConStr1<[ScriptHash]>;
1141
1156
  /**
1142
1157
  * The utility function to create a Plutus Data staking hash in JSON
1143
1158
  * @param stakeCredential The staking credential in hex
@@ -1161,6 +1176,13 @@ declare const pubKeyAddress: (bytes: string, stakeCredential?: string, isStakeSc
1161
1176
  * @returns The Plutus Data script address object
1162
1177
  */
1163
1178
  declare const scriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => ScriptAddress;
1179
+ /**
1180
+ * The utility function to create a Plutus Data credential in JSON
1181
+ * @param hash The pub key hash or script hash
1182
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
1183
+ * @returns Plutus Data credential object
1184
+ */
1185
+ declare const credential: (hash: string, isScriptCredential?: boolean) => Credential;
1164
1186
 
1165
1187
  type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
1166
1188
 
@@ -1649,4 +1671,4 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1649
1671
 
1650
1672
  declare function getFile(url: string): string;
1651
1673
 
1652
- export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, type BasicVote, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type CertificateType, type ConStr, type ConStr0, type ConStr1, type ConStr2, type ConStr3, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, DEFAULT_V3_COST_MODEL_LIST, DREP_DEPOSIT, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IMintingBlueprint, type IResolver, type ISigner, type ISpendingBlueprint, type ISubmitter, type IWallet, type IWithdrawalBlueprint, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MConStr3, type MMaybeStakingHash, type MNone, type MOption, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, MeshValue, type Message, type Metadata, type Metadatum, type MetadatumMap, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type None, type Option, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type PubKeyWithdrawal, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type ScriptVote, type ScriptWithdrawal, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SimpleScriptVote, type SimpleScriptWithdrawal, type SlotConfig, type Some, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxMetadata, type TxOutRef, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type Vote, type VoteKind, type VoteType, type Voter, type VotingProcedure, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, castProtocol, conStr, conStr0, conStr1, conStr2, conStr3, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, getFile, hashByteString, hashDrepAnchor, hexToBytes, hexToString, integer, isNetwork, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
1674
+ export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, type BasicVote, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type CertificateType, type ConStr, type ConStr0, type ConStr1, type ConStr2, type ConStr3, type Credential, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, DEFAULT_V3_COST_MODEL_LIST, DREP_DEPOSIT, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IMintingBlueprint, type IResolver, type ISigner, type ISpendingBlueprint, type ISubmitter, type IWallet, type IWithdrawalBlueprint, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MConStr3, type MCredential, type MMaybeStakingHash, type MNone, type MOption, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, MeshValue, type Message, type Metadata, type Metadatum, type MetadatumMap, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type None, type Option, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type PubKeyWithdrawal, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type ScriptVote, type ScriptWithdrawal, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SimpleScriptVote, type SimpleScriptWithdrawal, type SlotConfig, type Some, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxMetadata, type TxOutRef, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type Vote, type VoteKind, type VoteType, type Voter, type VotingProcedure, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, castProtocol, conStr, conStr0, conStr1, conStr2, conStr3, credential, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, getFile, hashByteString, hashDrepAnchor, hexToBytes, hexToString, integer, isNetwork, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mCredential, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
package/dist/index.d.ts CHANGED
@@ -472,7 +472,7 @@ type ScriptTxIn = {
472
472
  };
473
473
  declare const txInToUtxo: (txIn: TxInParameter) => UTxO;
474
474
 
475
- type Credential = {
475
+ type Credential$1 = {
476
476
  type: "ScriptHash";
477
477
  scriptHash: string;
478
478
  } | {
@@ -503,7 +503,7 @@ type VoteType = {
503
503
  };
504
504
  type Voter = {
505
505
  type: "ConstitutionalCommittee";
506
- hotCred: Credential;
506
+ hotCred: Credential$1;
507
507
  } | {
508
508
  type: "DRep";
509
509
  drepId: string;
@@ -739,6 +739,10 @@ type MPubKeyAddress = MConStr0<[MConStr0<[string]>, MMaybeStakingHash]>;
739
739
  * The Mesh Data script address
740
740
  */
741
741
  type MScriptAddress = MConStr0<[MConStr1<[string]>, MMaybeStakingHash]>;
742
+ /**
743
+ * The Mesh Data credential
744
+ */
745
+ type MCredential = MConStr0<[string]> | MConStr1<[string]>;
742
746
  /**
743
747
  * The utility function to create a Mesh Data staking hash
744
748
  * @param stakeCredential The staking credential in hex
@@ -762,6 +766,13 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isStakeS
762
766
  * @returns The Mesh Data script address object
763
767
  */
764
768
  declare const mScriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => MScriptAddress;
769
+ /**
770
+ * The utility function to create a Mesh Data credential
771
+ * @param hash The pub key hash or script hash
772
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
773
+ * @returns Mesh Data credential object
774
+ */
775
+ declare const mCredential: (hash: string, isScriptCredential?: boolean) => MCredential;
765
776
 
766
777
  /**
767
778
  * The Mesh Data boolean
@@ -1138,6 +1149,10 @@ type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
1138
1149
  * The Plutus Data script address in JSON
1139
1150
  */
1140
1151
  type ScriptAddress = ConStr0<[ConStr1<[ScriptHash]>, MaybeStakingHash]>;
1152
+ /**
1153
+ * The Plutus Data credential in JSON
1154
+ */
1155
+ type Credential = ConStr0<[PubKeyHash]> | ConStr1<[ScriptHash]>;
1141
1156
  /**
1142
1157
  * The utility function to create a Plutus Data staking hash in JSON
1143
1158
  * @param stakeCredential The staking credential in hex
@@ -1161,6 +1176,13 @@ declare const pubKeyAddress: (bytes: string, stakeCredential?: string, isStakeSc
1161
1176
  * @returns The Plutus Data script address object
1162
1177
  */
1163
1178
  declare const scriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => ScriptAddress;
1179
+ /**
1180
+ * The utility function to create a Plutus Data credential in JSON
1181
+ * @param hash The pub key hash or script hash
1182
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
1183
+ * @returns Plutus Data credential object
1184
+ */
1185
+ declare const credential: (hash: string, isScriptCredential?: boolean) => Credential;
1164
1186
 
1165
1187
  type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
1166
1188
 
@@ -1649,4 +1671,4 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1649
1671
 
1650
1672
  declare function getFile(url: string): string;
1651
1673
 
1652
- export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, type BasicVote, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type CertificateType, type ConStr, type ConStr0, type ConStr1, type ConStr2, type ConStr3, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, DEFAULT_V3_COST_MODEL_LIST, DREP_DEPOSIT, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IMintingBlueprint, type IResolver, type ISigner, type ISpendingBlueprint, type ISubmitter, type IWallet, type IWithdrawalBlueprint, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MConStr3, type MMaybeStakingHash, type MNone, type MOption, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, MeshValue, type Message, type Metadata, type Metadatum, type MetadatumMap, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type None, type Option, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type PubKeyWithdrawal, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type ScriptVote, type ScriptWithdrawal, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SimpleScriptVote, type SimpleScriptWithdrawal, type SlotConfig, type Some, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxMetadata, type TxOutRef, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type Vote, type VoteKind, type VoteType, type Voter, type VotingProcedure, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, castProtocol, conStr, conStr0, conStr1, conStr2, conStr3, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, getFile, hashByteString, hashDrepAnchor, hexToBytes, hexToString, integer, isNetwork, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
1674
+ export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, type BasicVote, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type CertificateType, type ConStr, type ConStr0, type ConStr1, type ConStr2, type ConStr3, type Credential, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, DEFAULT_V3_COST_MODEL_LIST, DREP_DEPOSIT, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IMintingBlueprint, type IResolver, type ISigner, type ISpendingBlueprint, type ISubmitter, type IWallet, type IWithdrawalBlueprint, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MConStr3, type MCredential, type MMaybeStakingHash, type MNone, type MOption, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, MeshValue, type Message, type Metadata, type Metadatum, type MetadatumMap, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type None, type Option, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type PubKeyWithdrawal, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type ScriptVote, type ScriptWithdrawal, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SimpleScriptVote, type SimpleScriptWithdrawal, type SlotConfig, type Some, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxMetadata, type TxOutRef, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type Vote, type VoteKind, type VoteType, type Voter, type VotingProcedure, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, castProtocol, conStr, conStr0, conStr1, conStr2, conStr3, credential, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, getFile, hashByteString, hashDrepAnchor, hexToBytes, hexToString, integer, isNetwork, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mCredential, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
package/dist/index.js CHANGED
@@ -958,6 +958,7 @@ var mScriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) =
958
958
  { alternative: 1, fields: [bytes] },
959
959
  mMaybeStakingHash(stakeCredential || "", isStakeScriptCredential)
960
960
  ]);
961
+ var mCredential = (hash, isScriptCredential = false) => isScriptCredential ? mConStr1([hash]) : mConStr0([hash]);
961
962
 
962
963
  // src/data/mesh/primitives.ts
963
964
  var mBool = (b) => b ? mConStr1([]) : mConStr0([]);
@@ -1122,6 +1123,7 @@ var scriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) =>
1122
1123
  conStr1([scriptHash(bytes)]),
1123
1124
  maybeStakingHash(stakeCredential || "", isStakeScriptCredential)
1124
1125
  ]);
1126
+ var credential = (hash, isScriptCredential = false) => isScriptCredential ? conStr1([scriptHash(hash)]) : conStr0([pubKeyHash(hash)]);
1125
1127
 
1126
1128
  // src/data/parser.ts
1127
1129
  var bytesToHex = (bytes) => Buffer.from(bytes).toString("hex");
@@ -1305,10 +1307,10 @@ var BigNum = class _BigNum {
1305
1307
  };
1306
1308
 
1307
1309
  // src/utils/data-hash.ts
1308
- import { blake2bHex } from "blakejs";
1310
+ import { blake2b as blake2b2 } from "blakejs";
1309
1311
  var hashDrepAnchor = (jsonLD) => {
1310
- const jsonHash = blake2bHex(JSON.stringify(jsonLD, null, 2), void 0, 32);
1311
- return jsonHash;
1312
+ const jsonHash = blake2b2(JSON.stringify(jsonLD, null, 2), void 0, 32);
1313
+ return Buffer.from(jsonHash).toString("hex");
1312
1314
  };
1313
1315
 
1314
1316
  // src/utils/file.ts
@@ -1859,6 +1861,7 @@ export {
1859
1861
  conStr1,
1860
1862
  conStr2,
1861
1863
  conStr3,
1864
+ credential,
1862
1865
  currencySymbol,
1863
1866
  dict,
1864
1867
  emptyTxBuilderBody,
@@ -1884,6 +1887,7 @@ export {
1884
1887
  mConStr1,
1885
1888
  mConStr2,
1886
1889
  mConStr3,
1890
+ mCredential,
1887
1891
  mMaybeStakingHash,
1888
1892
  mNone,
1889
1893
  mOption,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/common",
3
- "version": "1.9.0-beta.10",
3
+ "version": "1.9.0-beta.11",
4
4
  "description": "Contains constants, types and interfaces used across the SDK and different serialization libraries",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.js",