@meshsdk/common 1.9.0-beta.55 → 1.9.0-beta.57

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.d.cts CHANGED
@@ -228,12 +228,12 @@ type TxOutput = {
228
228
  scriptRef?: string;
229
229
  scriptHash?: string;
230
230
  };
231
-
231
+ type TxInput = {
232
+ txHash: string;
233
+ outputIndex: number;
234
+ };
232
235
  type UTxO = {
233
- input: {
234
- outputIndex: number;
235
- txHash: string;
236
- };
236
+ input: TxInput;
237
237
  output: TxOutput;
238
238
  };
239
239
 
@@ -603,6 +603,7 @@ type RequiredWith<T, K extends keyof T> = Required<T> & {
603
603
  [P in K]: Required<T[P]>;
604
604
  };
605
605
  declare const validityRangeToObj: (validityRange: ValidityRange) => object;
606
+ declare const validityRangeFromObj: (obj: any) => ValidityRange;
606
607
 
607
608
  type DeserializedAddress = {
608
609
  pubKeyHash: string;
@@ -1466,6 +1467,12 @@ declare class MeshValue {
1466
1467
  * @returns The quantity of the asset
1467
1468
  */
1468
1469
  get: (unit: string) => bigint;
1470
+ /**
1471
+ * Get all assets that belong to a specific policy ID
1472
+ * @param policyId The policy ID to filter by
1473
+ * @returns Array of assets that match the policy ID
1474
+ */
1475
+ getPolicyAssets: (policyId: string) => Asset[];
1469
1476
  /**
1470
1477
  * Get all asset units
1471
1478
  * @returns The asset units
@@ -1700,18 +1707,228 @@ interface ISubmitter {
1700
1707
  submitTx(tx: string): Promise<string>;
1701
1708
  }
1702
1709
 
1710
+ /**
1711
+ * TxTester class for evaluating transactions
1712
+ */
1713
+ declare class TxTester {
1714
+ txBody: MeshTxBuilderBody;
1715
+ inputsEvaluating: TxIn[];
1716
+ outputsEvaluating: Output[];
1717
+ traces: string[];
1718
+ /**
1719
+ * Create a new TxTester instance
1720
+ * @param txBody The transaction builder body
1721
+ */
1722
+ constructor(txBody: MeshTxBuilderBody);
1723
+ /**
1724
+ * Add a trace to the TxTester
1725
+ * @param funcName The function name where the error occurred
1726
+ * @param message The error message
1727
+ */
1728
+ addTrace(funcName: string, message: string): void;
1729
+ /**
1730
+ * Check if the transaction evaluation was successful
1731
+ * @returns true if there are no errors, false otherwise
1732
+ */
1733
+ success(): boolean;
1734
+ /**
1735
+ * Get the error messages if any
1736
+ * @returns A string representation of the errors or "No errors" if there are none
1737
+ */
1738
+ errors(): string;
1739
+ /**
1740
+ * Checks if the transaction is valid after a specified timestamp.
1741
+ * @param requiredTimestamp The timestamp after which the transaction should be valid
1742
+ * @returns The TxTester instance for chaining
1743
+ */
1744
+ validAfter: (requiredTimestamp: number) => this;
1745
+ /**
1746
+ * Checks if the transaction is valid before a specified timestamp.
1747
+ * @param requiredTimestamp The timestamp before which the transaction should be valid
1748
+ * @returns The TxTester instance for chaining
1749
+ */
1750
+ validBefore: (requiredTimestamp: number) => this;
1751
+ /**
1752
+ * Checks if a specific key is signed in the transaction.
1753
+ * @param keyHash The key hash to check
1754
+ * @returns The TxTester instance for chaining
1755
+ */
1756
+ keySigned: (keyHash: string) => this;
1757
+ /**
1758
+ * Checks if any one of the specified keys is signed in the transaction.
1759
+ * @param keyHashes The array of key hashes to check
1760
+ * @returns The TxTester instance for chaining
1761
+ */
1762
+ oneOfKeysSigned: (keyHashes: string[]) => this;
1763
+ /**
1764
+ * Checks if all specified keys are signed in the transaction.
1765
+ * @param keyHashes The array of key hashes to check
1766
+ * @returns The TxTester instance for chaining
1767
+ */
1768
+ allKeysSigned: (keyHashes: string[]) => this;
1769
+ /**
1770
+ * Checks if a specific token is minted in the transaction.
1771
+ * @param policyId The policy ID of the token
1772
+ * @param assetName The asset name of the token
1773
+ * @param quantity The quantity of the token
1774
+ * @returns The TxTester instance for chaining
1775
+ */
1776
+ tokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1777
+ /**
1778
+ * Checks if a specific token is minted in the transaction and that it is the only mint.
1779
+ * @param policyId The policy ID of the token
1780
+ * @param assetName The asset name of the token
1781
+ * @param quantity The quantity of the token
1782
+ * @returns The TxTester instance for chaining
1783
+ */
1784
+ onlyTokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1785
+ /**
1786
+ * Checks if a specific token is minted in the transaction, ensuring that it is the only mint for the given policy ID.
1787
+ * @param policyId The policy ID of the token
1788
+ * @param assetName The asset name of the token
1789
+ * @param quantity The quantity of the token
1790
+ * @returns The TxTester instance for chaining
1791
+ */
1792
+ policyOnlyMintedToken: (policyId: string, assetName: string, quantity: number) => this;
1793
+ /**
1794
+ * Checks if a specific policy ID is burned in the transaction, ensuring that it is the only minting (i.e. burning item).
1795
+ * @param policyId The policy ID to check
1796
+ * @returns true if the policy is the only burn, false otherwise
1797
+ */
1798
+ checkPolicyOnlyBurn: (policyId: string) => boolean;
1799
+ /**
1800
+ * Not apply filter to inputs
1801
+ * @returns The TxTester instance for chaining
1802
+ */
1803
+ allInputs: () => this;
1804
+ /**
1805
+ * Filter inputs by address
1806
+ * @param address The address to filter by
1807
+ * @returns The TxTester instance for chaining
1808
+ */
1809
+ inputsAt: (address: string) => this;
1810
+ /**
1811
+ * Filter inputs by unit
1812
+ * @param unit The unit to filter by
1813
+ * @returns The TxTester instance for chaining
1814
+ */
1815
+ inputsWith: (unit: string) => this;
1816
+ /**
1817
+ * Filter inputs by policy ID
1818
+ * @param policyId The policy ID to filter by
1819
+ * @returns The TxTester instance for chaining
1820
+ */
1821
+ inputsWithPolicy: (policyId: string) => this;
1822
+ /**
1823
+ * Filter inputs by address and policy ID
1824
+ * @param address The address to filter by
1825
+ * @param policyId The policy ID to filter by
1826
+ * @returns The TxTester instance for chaining
1827
+ */
1828
+ inputsAtWithPolicy: (address: string, policyId: string) => this;
1829
+ /**
1830
+ * Filter inputs by address and unit
1831
+ * @param address The address to filter by
1832
+ * @param unit The unit to filter by
1833
+ * @returns The TxTester instance for chaining
1834
+ */
1835
+ inputsAtWith: (address: string, unit: string) => this;
1836
+ /**
1837
+ * Check if inputs contain the expected value.
1838
+ * *Reminder - It must be called after filtering methods for inputs*
1839
+ * @param expectedValue The expected value
1840
+ * @returns The TxTester instance for chaining
1841
+ */
1842
+ inputsValue: (expectedValue: any) => this;
1843
+ /**
1844
+ * Not apply filter to outputs
1845
+ * @returns The TxTester instance for chaining
1846
+ */
1847
+ allOutputs: () => this;
1848
+ /**
1849
+ * Filter outputs by address
1850
+ * @param address The address to filter by
1851
+ * @returns The TxTester instance for chaining
1852
+ */
1853
+ outputsAt: (address: string) => this;
1854
+ /**
1855
+ * Filter outputs by unit
1856
+ * @param unit The unit to filter by
1857
+ * @returns The TxTester instance for chaining
1858
+ */
1859
+ outputsWith: (unit: string) => this;
1860
+ /**
1861
+ * Filter outputs by policy ID
1862
+ * @param policyId The policy ID to filter by
1863
+ * @returns The TxTester instance for chaining
1864
+ */
1865
+ outputsWithPolicy: (policyId: string) => this;
1866
+ /**
1867
+ * Filter outputs by address and policy ID
1868
+ * @param address The address to filter by
1869
+ * @param policyId The policy ID to filter by
1870
+ * @returns The TxTester instance for chaining
1871
+ */
1872
+ outputsAtWithPolicy: (address: string, policyId: string) => this;
1873
+ /**
1874
+ * Filter outputs by address and unit
1875
+ * @param address The address to filter by
1876
+ * @param unit The unit to filter by
1877
+ * @returns The TxTester instance for chaining
1878
+ */
1879
+ outputsAtWith: (address: string, unit: string) => this;
1880
+ /**
1881
+ * Check if outputs contain the expected value.
1882
+ * *Reminder - It must be called after filtering methods for outputs*
1883
+ * @param expectedValue The expected value
1884
+ * @returns The TxTester instance for chaining
1885
+ */
1886
+ outputsValue: (expectedValue: MeshValue) => this;
1887
+ /**
1888
+ * Check if outputs contain a specific inline datum.
1889
+ * *Reminder - It must be called after filtering methods for outputs*
1890
+ * @param datumCbor The datum CBOR to check
1891
+ * @returns The TxTester instance for chaining
1892
+ */
1893
+ outputsInlineDatumExist: (datumCbor: string) => this;
1894
+ }
1895
+ /**
1896
+ * Internal logic to check if a key is signed
1897
+ * @param requiredSignatures The required signatures of the tx builder body
1898
+ * @param keyHash The key hash to check
1899
+ * @returns true if the key is signed, false otherwise
1900
+ */
1901
+ declare function keySignedLogic(requiredSignatures: string[], keyHash: string): boolean;
1902
+ /**
1903
+ * Internal logic to check if a token is minted
1904
+ * @param mints The mints info of the tx builder body
1905
+ * @param policyId The policy ID of the token
1906
+ * @param assetName The asset name of the token
1907
+ * @param quantity The quantity of the token
1908
+ * @returns true if the token is minted, false otherwise
1909
+ */
1910
+ declare function tokenMintedLogic(mints: MintParam[], policyId: string, assetName: string, quantity: number): boolean;
1911
+
1703
1912
  interface IMeshTxSerializer {
1704
1913
  serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1705
1914
  serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1706
1915
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1707
- resolver: IResolver;
1708
- deserializer: IDeserializer;
1709
1916
  serializeData(data: BuilderData): string;
1710
1917
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1711
1918
  serializePoolId(hash: string): string;
1712
1919
  serializeRewardAddress(stakeKeyHash: string, isScriptHash?: boolean, network_id?: 0 | 1): string;
1713
1920
  serializeOutput(output: Output): string;
1714
1921
  serializeValue(value: Asset[]): string;
1922
+ resolver: IResolver;
1923
+ deserializer: IDeserializer;
1924
+ parser: ITxParser;
1925
+ }
1926
+ interface ITxParser {
1927
+ getRequiredInputs(txHex: string): TxInput[];
1928
+ parse(txHex: string, resolvedUtxos?: UTxO[]): void;
1929
+ toTester(): TxTester;
1930
+ getBuilderBody(): MeshTxBuilderBody;
1931
+ getBuilderBodyWithoutChange(): MeshTxBuilderBody;
1715
1932
  }
1716
1933
  interface IResolver {
1717
1934
  keys: {
@@ -1810,4 +2027,4 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1810
2027
 
1811
2028
  declare function getFile(url: string): string;
1812
2029
 
1813
- 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, isHexString, 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 };
2030
+ 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 ITxParser, 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 TxInput, type TxMetadata, type TxOutRef, type TxOutput, TxTester, 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, isHexString, isNetwork, jsonProofToPlutusData, keepRelevant, keySignedLogic, 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, tokenMintedLogic, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeFromObj, validityRangeToObj, value, verificationKey };
package/dist/index.d.ts CHANGED
@@ -228,12 +228,12 @@ type TxOutput = {
228
228
  scriptRef?: string;
229
229
  scriptHash?: string;
230
230
  };
231
-
231
+ type TxInput = {
232
+ txHash: string;
233
+ outputIndex: number;
234
+ };
232
235
  type UTxO = {
233
- input: {
234
- outputIndex: number;
235
- txHash: string;
236
- };
236
+ input: TxInput;
237
237
  output: TxOutput;
238
238
  };
239
239
 
@@ -603,6 +603,7 @@ type RequiredWith<T, K extends keyof T> = Required<T> & {
603
603
  [P in K]: Required<T[P]>;
604
604
  };
605
605
  declare const validityRangeToObj: (validityRange: ValidityRange) => object;
606
+ declare const validityRangeFromObj: (obj: any) => ValidityRange;
606
607
 
607
608
  type DeserializedAddress = {
608
609
  pubKeyHash: string;
@@ -1466,6 +1467,12 @@ declare class MeshValue {
1466
1467
  * @returns The quantity of the asset
1467
1468
  */
1468
1469
  get: (unit: string) => bigint;
1470
+ /**
1471
+ * Get all assets that belong to a specific policy ID
1472
+ * @param policyId The policy ID to filter by
1473
+ * @returns Array of assets that match the policy ID
1474
+ */
1475
+ getPolicyAssets: (policyId: string) => Asset[];
1469
1476
  /**
1470
1477
  * Get all asset units
1471
1478
  * @returns The asset units
@@ -1700,18 +1707,228 @@ interface ISubmitter {
1700
1707
  submitTx(tx: string): Promise<string>;
1701
1708
  }
1702
1709
 
1710
+ /**
1711
+ * TxTester class for evaluating transactions
1712
+ */
1713
+ declare class TxTester {
1714
+ txBody: MeshTxBuilderBody;
1715
+ inputsEvaluating: TxIn[];
1716
+ outputsEvaluating: Output[];
1717
+ traces: string[];
1718
+ /**
1719
+ * Create a new TxTester instance
1720
+ * @param txBody The transaction builder body
1721
+ */
1722
+ constructor(txBody: MeshTxBuilderBody);
1723
+ /**
1724
+ * Add a trace to the TxTester
1725
+ * @param funcName The function name where the error occurred
1726
+ * @param message The error message
1727
+ */
1728
+ addTrace(funcName: string, message: string): void;
1729
+ /**
1730
+ * Check if the transaction evaluation was successful
1731
+ * @returns true if there are no errors, false otherwise
1732
+ */
1733
+ success(): boolean;
1734
+ /**
1735
+ * Get the error messages if any
1736
+ * @returns A string representation of the errors or "No errors" if there are none
1737
+ */
1738
+ errors(): string;
1739
+ /**
1740
+ * Checks if the transaction is valid after a specified timestamp.
1741
+ * @param requiredTimestamp The timestamp after which the transaction should be valid
1742
+ * @returns The TxTester instance for chaining
1743
+ */
1744
+ validAfter: (requiredTimestamp: number) => this;
1745
+ /**
1746
+ * Checks if the transaction is valid before a specified timestamp.
1747
+ * @param requiredTimestamp The timestamp before which the transaction should be valid
1748
+ * @returns The TxTester instance for chaining
1749
+ */
1750
+ validBefore: (requiredTimestamp: number) => this;
1751
+ /**
1752
+ * Checks if a specific key is signed in the transaction.
1753
+ * @param keyHash The key hash to check
1754
+ * @returns The TxTester instance for chaining
1755
+ */
1756
+ keySigned: (keyHash: string) => this;
1757
+ /**
1758
+ * Checks if any one of the specified keys is signed in the transaction.
1759
+ * @param keyHashes The array of key hashes to check
1760
+ * @returns The TxTester instance for chaining
1761
+ */
1762
+ oneOfKeysSigned: (keyHashes: string[]) => this;
1763
+ /**
1764
+ * Checks if all specified keys are signed in the transaction.
1765
+ * @param keyHashes The array of key hashes to check
1766
+ * @returns The TxTester instance for chaining
1767
+ */
1768
+ allKeysSigned: (keyHashes: string[]) => this;
1769
+ /**
1770
+ * Checks if a specific token is minted in the transaction.
1771
+ * @param policyId The policy ID of the token
1772
+ * @param assetName The asset name of the token
1773
+ * @param quantity The quantity of the token
1774
+ * @returns The TxTester instance for chaining
1775
+ */
1776
+ tokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1777
+ /**
1778
+ * Checks if a specific token is minted in the transaction and that it is the only mint.
1779
+ * @param policyId The policy ID of the token
1780
+ * @param assetName The asset name of the token
1781
+ * @param quantity The quantity of the token
1782
+ * @returns The TxTester instance for chaining
1783
+ */
1784
+ onlyTokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1785
+ /**
1786
+ * Checks if a specific token is minted in the transaction, ensuring that it is the only mint for the given policy ID.
1787
+ * @param policyId The policy ID of the token
1788
+ * @param assetName The asset name of the token
1789
+ * @param quantity The quantity of the token
1790
+ * @returns The TxTester instance for chaining
1791
+ */
1792
+ policyOnlyMintedToken: (policyId: string, assetName: string, quantity: number) => this;
1793
+ /**
1794
+ * Checks if a specific policy ID is burned in the transaction, ensuring that it is the only minting (i.e. burning item).
1795
+ * @param policyId The policy ID to check
1796
+ * @returns true if the policy is the only burn, false otherwise
1797
+ */
1798
+ checkPolicyOnlyBurn: (policyId: string) => boolean;
1799
+ /**
1800
+ * Not apply filter to inputs
1801
+ * @returns The TxTester instance for chaining
1802
+ */
1803
+ allInputs: () => this;
1804
+ /**
1805
+ * Filter inputs by address
1806
+ * @param address The address to filter by
1807
+ * @returns The TxTester instance for chaining
1808
+ */
1809
+ inputsAt: (address: string) => this;
1810
+ /**
1811
+ * Filter inputs by unit
1812
+ * @param unit The unit to filter by
1813
+ * @returns The TxTester instance for chaining
1814
+ */
1815
+ inputsWith: (unit: string) => this;
1816
+ /**
1817
+ * Filter inputs by policy ID
1818
+ * @param policyId The policy ID to filter by
1819
+ * @returns The TxTester instance for chaining
1820
+ */
1821
+ inputsWithPolicy: (policyId: string) => this;
1822
+ /**
1823
+ * Filter inputs by address and policy ID
1824
+ * @param address The address to filter by
1825
+ * @param policyId The policy ID to filter by
1826
+ * @returns The TxTester instance for chaining
1827
+ */
1828
+ inputsAtWithPolicy: (address: string, policyId: string) => this;
1829
+ /**
1830
+ * Filter inputs by address and unit
1831
+ * @param address The address to filter by
1832
+ * @param unit The unit to filter by
1833
+ * @returns The TxTester instance for chaining
1834
+ */
1835
+ inputsAtWith: (address: string, unit: string) => this;
1836
+ /**
1837
+ * Check if inputs contain the expected value.
1838
+ * *Reminder - It must be called after filtering methods for inputs*
1839
+ * @param expectedValue The expected value
1840
+ * @returns The TxTester instance for chaining
1841
+ */
1842
+ inputsValue: (expectedValue: any) => this;
1843
+ /**
1844
+ * Not apply filter to outputs
1845
+ * @returns The TxTester instance for chaining
1846
+ */
1847
+ allOutputs: () => this;
1848
+ /**
1849
+ * Filter outputs by address
1850
+ * @param address The address to filter by
1851
+ * @returns The TxTester instance for chaining
1852
+ */
1853
+ outputsAt: (address: string) => this;
1854
+ /**
1855
+ * Filter outputs by unit
1856
+ * @param unit The unit to filter by
1857
+ * @returns The TxTester instance for chaining
1858
+ */
1859
+ outputsWith: (unit: string) => this;
1860
+ /**
1861
+ * Filter outputs by policy ID
1862
+ * @param policyId The policy ID to filter by
1863
+ * @returns The TxTester instance for chaining
1864
+ */
1865
+ outputsWithPolicy: (policyId: string) => this;
1866
+ /**
1867
+ * Filter outputs by address and policy ID
1868
+ * @param address The address to filter by
1869
+ * @param policyId The policy ID to filter by
1870
+ * @returns The TxTester instance for chaining
1871
+ */
1872
+ outputsAtWithPolicy: (address: string, policyId: string) => this;
1873
+ /**
1874
+ * Filter outputs by address and unit
1875
+ * @param address The address to filter by
1876
+ * @param unit The unit to filter by
1877
+ * @returns The TxTester instance for chaining
1878
+ */
1879
+ outputsAtWith: (address: string, unit: string) => this;
1880
+ /**
1881
+ * Check if outputs contain the expected value.
1882
+ * *Reminder - It must be called after filtering methods for outputs*
1883
+ * @param expectedValue The expected value
1884
+ * @returns The TxTester instance for chaining
1885
+ */
1886
+ outputsValue: (expectedValue: MeshValue) => this;
1887
+ /**
1888
+ * Check if outputs contain a specific inline datum.
1889
+ * *Reminder - It must be called after filtering methods for outputs*
1890
+ * @param datumCbor The datum CBOR to check
1891
+ * @returns The TxTester instance for chaining
1892
+ */
1893
+ outputsInlineDatumExist: (datumCbor: string) => this;
1894
+ }
1895
+ /**
1896
+ * Internal logic to check if a key is signed
1897
+ * @param requiredSignatures The required signatures of the tx builder body
1898
+ * @param keyHash The key hash to check
1899
+ * @returns true if the key is signed, false otherwise
1900
+ */
1901
+ declare function keySignedLogic(requiredSignatures: string[], keyHash: string): boolean;
1902
+ /**
1903
+ * Internal logic to check if a token is minted
1904
+ * @param mints The mints info of the tx builder body
1905
+ * @param policyId The policy ID of the token
1906
+ * @param assetName The asset name of the token
1907
+ * @param quantity The quantity of the token
1908
+ * @returns true if the token is minted, false otherwise
1909
+ */
1910
+ declare function tokenMintedLogic(mints: MintParam[], policyId: string, assetName: string, quantity: number): boolean;
1911
+
1703
1912
  interface IMeshTxSerializer {
1704
1913
  serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1705
1914
  serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1706
1915
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1707
- resolver: IResolver;
1708
- deserializer: IDeserializer;
1709
1916
  serializeData(data: BuilderData): string;
1710
1917
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1711
1918
  serializePoolId(hash: string): string;
1712
1919
  serializeRewardAddress(stakeKeyHash: string, isScriptHash?: boolean, network_id?: 0 | 1): string;
1713
1920
  serializeOutput(output: Output): string;
1714
1921
  serializeValue(value: Asset[]): string;
1922
+ resolver: IResolver;
1923
+ deserializer: IDeserializer;
1924
+ parser: ITxParser;
1925
+ }
1926
+ interface ITxParser {
1927
+ getRequiredInputs(txHex: string): TxInput[];
1928
+ parse(txHex: string, resolvedUtxos?: UTxO[]): void;
1929
+ toTester(): TxTester;
1930
+ getBuilderBody(): MeshTxBuilderBody;
1931
+ getBuilderBodyWithoutChange(): MeshTxBuilderBody;
1715
1932
  }
1716
1933
  interface IResolver {
1717
1934
  keys: {
@@ -1810,4 +2027,4 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1810
2027
 
1811
2028
  declare function getFile(url: string): string;
1812
2029
 
1813
- 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, isHexString, 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 };
2030
+ 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 ITxParser, 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 TxInput, type TxMetadata, type TxOutRef, type TxOutput, TxTester, 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, isHexString, isNetwork, jsonProofToPlutusData, keepRelevant, keySignedLogic, 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, tokenMintedLogic, tokenName, tuple, txInToUtxo, txOutRef, unixTimeToEnclosingSlot, validityRangeFromObj, validityRangeToObj, value, verificationKey };