@meshsdk/common 1.9.0-beta.30 → 1.9.0-beta.31

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
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  byteString: () => byteString,
62
62
  bytesToHex: () => bytesToHex,
63
63
  castProtocol: () => castProtocol,
64
+ cloneTxBuilderBody: () => cloneTxBuilderBody,
64
65
  conStr: () => conStr,
65
66
  conStr0: () => conStr0,
66
67
  conStr1: () => conStr1,
@@ -1011,6 +1012,7 @@ var txInToUtxo = (txIn) => {
1011
1012
  var emptyTxBuilderBody = () => ({
1012
1013
  inputs: [],
1013
1014
  outputs: [],
1015
+ fee: "0",
1014
1016
  extraInputs: [],
1015
1017
  collaterals: [],
1016
1018
  requiredSignatures: [],
@@ -1030,8 +1032,16 @@ var emptyTxBuilderBody = () => ({
1030
1032
  },
1031
1033
  chainedTxs: [],
1032
1034
  inputsForEvaluation: {},
1033
- network: "mainnet"
1035
+ network: "mainnet",
1036
+ expectedNumberKeyWitnesses: 0,
1037
+ expectedByronAddressWitnesses: []
1034
1038
  });
1039
+ function cloneTxBuilderBody(body) {
1040
+ const { extraInputs, ...otherProps } = body;
1041
+ const cloned = structuredClone(otherProps);
1042
+ cloned.extraInputs = extraInputs;
1043
+ return cloned;
1044
+ }
1035
1045
  var validityRangeToObj = (validityRange) => {
1036
1046
  return {
1037
1047
  invalidBefore: validityRange.invalidBefore ?? null,
@@ -1671,6 +1681,26 @@ var MeshValue = class _MeshValue {
1671
1681
  }
1672
1682
  return BigInt(this.value[unit]) <= BigInt(other.value[unit]);
1673
1683
  };
1684
+ /**
1685
+ * Check if the value is equal to another value
1686
+ * @param other - The value to compare against
1687
+ * @returns boolean
1688
+ */
1689
+ eq = (other) => {
1690
+ return Object.keys(this.value).every((key) => this.eqUnit(key, other));
1691
+ };
1692
+ /**
1693
+ * Check if the specific unit of value is equal to that unit of another value
1694
+ * @param unit - The unit to compare
1695
+ * @param other - The value to compare against
1696
+ * @returns boolean
1697
+ */
1698
+ eqUnit = (unit, other) => {
1699
+ if (this.value[unit] === void 0 || other.value[unit] === void 0) {
1700
+ return false;
1701
+ }
1702
+ return BigInt(this.value[unit]) === BigInt(other.value[unit]);
1703
+ };
1674
1704
  /**
1675
1705
  * Check if the value is empty
1676
1706
  * @returns boolean
@@ -2059,6 +2089,7 @@ var import_bip39 = require("bip39");
2059
2089
  byteString,
2060
2090
  bytesToHex,
2061
2091
  castProtocol,
2092
+ cloneTxBuilderBody,
2062
2093
  conStr,
2063
2094
  conStr0,
2064
2095
  conStr1,
package/dist/index.d.cts CHANGED
@@ -220,19 +220,21 @@ declare const castProtocol: (data: Partial<Record<keyof Protocol, any>>) => Prot
220
220
 
221
221
  type Token = keyof typeof SUPPORTED_TOKENS;
222
222
 
223
+ type TxOutput = {
224
+ address: string;
225
+ amount: Asset[];
226
+ dataHash?: string;
227
+ plutusData?: string;
228
+ scriptRef?: string;
229
+ scriptHash?: string;
230
+ };
231
+
223
232
  type UTxO = {
224
233
  input: {
225
234
  outputIndex: number;
226
235
  txHash: string;
227
236
  };
228
- output: {
229
- address: string;
230
- amount: Asset[];
231
- dataHash?: string;
232
- plutusData?: string;
233
- scriptRef?: string;
234
- scriptHash?: string;
235
- };
237
+ output: TxOutput;
236
238
  };
237
239
 
238
240
  type TransactionInfo = {
@@ -424,6 +426,16 @@ type Anchor = {
424
426
  anchorDataHash: string;
425
427
  };
426
428
 
429
+ type MintParam = {
430
+ type: "Plutus" | "Native";
431
+ policyId: string;
432
+ mintValue: {
433
+ assetName: string;
434
+ amount: string;
435
+ }[];
436
+ redeemer?: Redeemer;
437
+ scriptSource?: ScriptSource | SimpleScriptSourceInfo;
438
+ };
427
439
  type MintItem = {
428
440
  type: "Plutus" | "Native";
429
441
  policyId: string;
@@ -548,10 +560,11 @@ type SimpleScriptWithdrawal = {
548
560
  type MeshTxBuilderBody = {
549
561
  inputs: TxIn[];
550
562
  outputs: Output[];
563
+ fee: Quantity;
551
564
  collaterals: PubKeyTxIn[];
552
565
  requiredSignatures: string[];
553
566
  referenceInputs: RefTxIn[];
554
- mints: MintItem[];
567
+ mints: MintParam[];
555
568
  changeAddress: string;
556
569
  metadata: TxMetadata;
557
570
  validityRange: ValidityRange;
@@ -567,10 +580,12 @@ type MeshTxBuilderBody = {
567
580
  };
568
581
  chainedTxs: string[];
569
582
  inputsForEvaluation: Record<string, UTxO>;
570
- fee?: string;
571
583
  network: Network | number[][];
584
+ expectedNumberKeyWitnesses: number;
585
+ expectedByronAddressWitnesses: string[];
572
586
  };
573
587
  declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
588
+ declare function cloneTxBuilderBody(body: MeshTxBuilderBody): MeshTxBuilderBody;
574
589
  type ValidityRange = {
575
590
  invalidBefore?: number;
576
591
  invalidHereafter?: number;
@@ -1476,6 +1491,19 @@ declare class MeshValue {
1476
1491
  * @returns boolean
1477
1492
  */
1478
1493
  leqUnit: (unit: string, other: MeshValue) => boolean;
1494
+ /**
1495
+ * Check if the value is equal to another value
1496
+ * @param other - The value to compare against
1497
+ * @returns boolean
1498
+ */
1499
+ eq: (other: MeshValue) => boolean;
1500
+ /**
1501
+ * Check if the specific unit of value is equal to that unit of another value
1502
+ * @param unit - The unit to compare
1503
+ * @param other - The value to compare against
1504
+ * @returns boolean
1505
+ */
1506
+ eqUnit: (unit: string, other: MeshValue) => boolean;
1479
1507
  /**
1480
1508
  * Check if the value is empty
1481
1509
  * @returns boolean
@@ -1667,8 +1695,8 @@ interface ISubmitter {
1667
1695
  }
1668
1696
 
1669
1697
  interface IMeshTxSerializer {
1670
- verbose: boolean;
1671
- serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol, balanced: Boolean): string;
1698
+ serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1699
+ serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1672
1700
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1673
1701
  resolver: IResolver;
1674
1702
  deserializer: IDeserializer;
@@ -1676,6 +1704,8 @@ interface IMeshTxSerializer {
1676
1704
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1677
1705
  serializePoolId(hash: string): string;
1678
1706
  serializeRewardAddress(stakeKeyHash: string, isScriptHash?: boolean, network_id?: 0 | 1): string;
1707
+ serializeOutput(output: Output): string;
1708
+ serializeValue(value: Asset[]): string;
1679
1709
  }
1680
1710
  interface IResolver {
1681
1711
  keys: {
@@ -1774,4 +1804,4 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1774
1804
 
1775
1805
  declare function getFile(url: string): string;
1776
1806
 
1777
- 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_FETCHER_OPTIONS, 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 Extension, type Files, type ForkNeighbor, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IFetcherOptions, 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 MScript, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MVerificationKey, 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 Pair, type Pairs, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type ProofStep, type ProofStepBranch, type ProofStepFork, type ProofStepLeaf, 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 Script, 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 VerificationKey, 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, jsonProofToPlutusData, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mCredential, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScript, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, mVerificationKey, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, pairs, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, script, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value, verificationKey };
1807
+ 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_FETCHER_OPTIONS, 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 Extension, type Files, type ForkNeighbor, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IFetcherOptions, 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 MScript, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MVerificationKey, type MaybeStakingHash, type MeshTxBuilderBody, MeshValue, type Message, type Metadata, type Metadatum, type MetadatumMap, type Mint, type MintItem, type MintParam, type NativeScript, type Network, type NonFungibleAssetMetadata, type None, type Option, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type Pair, type Pairs, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type ProofStep, type ProofStepBranch, type ProofStepFork, type ProofStepLeaf, 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 Script, 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 TxOutput, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type VerificationKey, type Vote, type VoteKind, type VoteType, type Voter, type VotingProcedure, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, castProtocol, cloneTxBuilderBody, conStr, conStr0, conStr1, conStr2, conStr3, credential, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, getFile, hashByteString, hashDrepAnchor, hexToBytes, hexToString, integer, isNetwork, jsonProofToPlutusData, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mCredential, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScript, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, mVerificationKey, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, pairs, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, script, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value, verificationKey };
package/dist/index.d.ts CHANGED
@@ -220,19 +220,21 @@ declare const castProtocol: (data: Partial<Record<keyof Protocol, any>>) => Prot
220
220
 
221
221
  type Token = keyof typeof SUPPORTED_TOKENS;
222
222
 
223
+ type TxOutput = {
224
+ address: string;
225
+ amount: Asset[];
226
+ dataHash?: string;
227
+ plutusData?: string;
228
+ scriptRef?: string;
229
+ scriptHash?: string;
230
+ };
231
+
223
232
  type UTxO = {
224
233
  input: {
225
234
  outputIndex: number;
226
235
  txHash: string;
227
236
  };
228
- output: {
229
- address: string;
230
- amount: Asset[];
231
- dataHash?: string;
232
- plutusData?: string;
233
- scriptRef?: string;
234
- scriptHash?: string;
235
- };
237
+ output: TxOutput;
236
238
  };
237
239
 
238
240
  type TransactionInfo = {
@@ -424,6 +426,16 @@ type Anchor = {
424
426
  anchorDataHash: string;
425
427
  };
426
428
 
429
+ type MintParam = {
430
+ type: "Plutus" | "Native";
431
+ policyId: string;
432
+ mintValue: {
433
+ assetName: string;
434
+ amount: string;
435
+ }[];
436
+ redeemer?: Redeemer;
437
+ scriptSource?: ScriptSource | SimpleScriptSourceInfo;
438
+ };
427
439
  type MintItem = {
428
440
  type: "Plutus" | "Native";
429
441
  policyId: string;
@@ -548,10 +560,11 @@ type SimpleScriptWithdrawal = {
548
560
  type MeshTxBuilderBody = {
549
561
  inputs: TxIn[];
550
562
  outputs: Output[];
563
+ fee: Quantity;
551
564
  collaterals: PubKeyTxIn[];
552
565
  requiredSignatures: string[];
553
566
  referenceInputs: RefTxIn[];
554
- mints: MintItem[];
567
+ mints: MintParam[];
555
568
  changeAddress: string;
556
569
  metadata: TxMetadata;
557
570
  validityRange: ValidityRange;
@@ -567,10 +580,12 @@ type MeshTxBuilderBody = {
567
580
  };
568
581
  chainedTxs: string[];
569
582
  inputsForEvaluation: Record<string, UTxO>;
570
- fee?: string;
571
583
  network: Network | number[][];
584
+ expectedNumberKeyWitnesses: number;
585
+ expectedByronAddressWitnesses: string[];
572
586
  };
573
587
  declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
588
+ declare function cloneTxBuilderBody(body: MeshTxBuilderBody): MeshTxBuilderBody;
574
589
  type ValidityRange = {
575
590
  invalidBefore?: number;
576
591
  invalidHereafter?: number;
@@ -1476,6 +1491,19 @@ declare class MeshValue {
1476
1491
  * @returns boolean
1477
1492
  */
1478
1493
  leqUnit: (unit: string, other: MeshValue) => boolean;
1494
+ /**
1495
+ * Check if the value is equal to another value
1496
+ * @param other - The value to compare against
1497
+ * @returns boolean
1498
+ */
1499
+ eq: (other: MeshValue) => boolean;
1500
+ /**
1501
+ * Check if the specific unit of value is equal to that unit of another value
1502
+ * @param unit - The unit to compare
1503
+ * @param other - The value to compare against
1504
+ * @returns boolean
1505
+ */
1506
+ eqUnit: (unit: string, other: MeshValue) => boolean;
1479
1507
  /**
1480
1508
  * Check if the value is empty
1481
1509
  * @returns boolean
@@ -1667,8 +1695,8 @@ interface ISubmitter {
1667
1695
  }
1668
1696
 
1669
1697
  interface IMeshTxSerializer {
1670
- verbose: boolean;
1671
- serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol, balanced: Boolean): string;
1698
+ serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1699
+ serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1672
1700
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1673
1701
  resolver: IResolver;
1674
1702
  deserializer: IDeserializer;
@@ -1676,6 +1704,8 @@ interface IMeshTxSerializer {
1676
1704
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1677
1705
  serializePoolId(hash: string): string;
1678
1706
  serializeRewardAddress(stakeKeyHash: string, isScriptHash?: boolean, network_id?: 0 | 1): string;
1707
+ serializeOutput(output: Output): string;
1708
+ serializeValue(value: Asset[]): string;
1679
1709
  }
1680
1710
  interface IResolver {
1681
1711
  keys: {
@@ -1774,4 +1804,4 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1774
1804
 
1775
1805
  declare function getFile(url: string): string;
1776
1806
 
1777
- 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_FETCHER_OPTIONS, 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 Extension, type Files, type ForkNeighbor, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IFetcherOptions, 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 MScript, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MVerificationKey, 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 Pair, type Pairs, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type ProofStep, type ProofStepBranch, type ProofStepFork, type ProofStepLeaf, 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 Script, 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 VerificationKey, 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, jsonProofToPlutusData, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mCredential, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScript, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, mVerificationKey, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, pairs, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, script, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value, verificationKey };
1807
+ 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_FETCHER_OPTIONS, 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 Extension, type Files, type ForkNeighbor, type FungibleAssetMetadata, type GovernanceProposalInfo, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IFetcherOptions, 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 MScript, type MScriptAddress, type MSome, type MTuple, type MTxOutRef, type MValue, type MVerificationKey, type MaybeStakingHash, type MeshTxBuilderBody, MeshValue, type Message, type Metadata, type Metadatum, type MetadatumMap, type Mint, type MintItem, type MintParam, type NativeScript, type Network, type NonFungibleAssetMetadata, type None, type Option, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type Pair, type Pairs, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type ProofStep, type ProofStepBranch, type ProofStepFork, type ProofStepLeaf, 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 Script, 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 TxOutput, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type VerificationKey, type Vote, type VoteKind, type VoteType, type Voter, type VotingProcedure, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, castProtocol, cloneTxBuilderBody, conStr, conStr0, conStr1, conStr2, conStr3, credential, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, getFile, hashByteString, hashDrepAnchor, hexToBytes, hexToString, integer, isNetwork, jsonProofToPlutusData, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mConStr3, mCredential, mMaybeStakingHash, mNone, mOption, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScript, mScriptAddress, mSome, mStringToPlutusBSArray, mTuple, mTxOutRef, mValue, mVerificationKey, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, none, option, outputReference, pairs, parseAssetUnit, plutusBSArrayToString, policyId, posixTime, pubKeyAddress, pubKeyHash, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, script, scriptAddress, scriptHash, slotToBeginUnixTime, some, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value, verificationKey };
package/dist/index.js CHANGED
@@ -860,6 +860,7 @@ var txInToUtxo = (txIn) => {
860
860
  var emptyTxBuilderBody = () => ({
861
861
  inputs: [],
862
862
  outputs: [],
863
+ fee: "0",
863
864
  extraInputs: [],
864
865
  collaterals: [],
865
866
  requiredSignatures: [],
@@ -879,8 +880,16 @@ var emptyTxBuilderBody = () => ({
879
880
  },
880
881
  chainedTxs: [],
881
882
  inputsForEvaluation: {},
882
- network: "mainnet"
883
+ network: "mainnet",
884
+ expectedNumberKeyWitnesses: 0,
885
+ expectedByronAddressWitnesses: []
883
886
  });
887
+ function cloneTxBuilderBody(body) {
888
+ const { extraInputs, ...otherProps } = body;
889
+ const cloned = structuredClone(otherProps);
890
+ cloned.extraInputs = extraInputs;
891
+ return cloned;
892
+ }
884
893
  var validityRangeToObj = (validityRange) => {
885
894
  return {
886
895
  invalidBefore: validityRange.invalidBefore ?? null,
@@ -1520,6 +1529,26 @@ var MeshValue = class _MeshValue {
1520
1529
  }
1521
1530
  return BigInt(this.value[unit]) <= BigInt(other.value[unit]);
1522
1531
  };
1532
+ /**
1533
+ * Check if the value is equal to another value
1534
+ * @param other - The value to compare against
1535
+ * @returns boolean
1536
+ */
1537
+ eq = (other) => {
1538
+ return Object.keys(this.value).every((key) => this.eqUnit(key, other));
1539
+ };
1540
+ /**
1541
+ * Check if the specific unit of value is equal to that unit of another value
1542
+ * @param unit - The unit to compare
1543
+ * @param other - The value to compare against
1544
+ * @returns boolean
1545
+ */
1546
+ eqUnit = (unit, other) => {
1547
+ if (this.value[unit] === void 0 || other.value[unit] === void 0) {
1548
+ return false;
1549
+ }
1550
+ return BigInt(this.value[unit]) === BigInt(other.value[unit]);
1551
+ };
1523
1552
  /**
1524
1553
  * Check if the value is empty
1525
1554
  * @returns boolean
@@ -1907,6 +1936,7 @@ export {
1907
1936
  byteString,
1908
1937
  bytesToHex,
1909
1938
  castProtocol,
1939
+ cloneTxBuilderBody,
1910
1940
  conStr,
1911
1941
  conStr0,
1912
1942
  conStr1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/common",
3
- "version": "1.9.0-beta.30",
3
+ "version": "1.9.0-beta.31",
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",