@meshsdk/common 1.9.0-beta.7 → 1.9.0-beta.71

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
@@ -112,6 +112,10 @@ type DataSignature = {
112
112
 
113
113
  type Era = "ALONZO" | "BABBAGE";
114
114
 
115
+ type Extension = {
116
+ cip: number;
117
+ };
118
+
115
119
  type Message = {
116
120
  payload: string;
117
121
  externalAAD?: string;
@@ -216,6 +220,23 @@ declare const castProtocol: (data: Partial<Record<keyof Protocol, any>>) => Prot
216
220
 
217
221
  type Token = keyof typeof SUPPORTED_TOKENS;
218
222
 
223
+ type TxOutput = {
224
+ address: string;
225
+ amount: Asset[];
226
+ dataHash?: string;
227
+ plutusData?: string;
228
+ scriptRef?: string;
229
+ scriptHash?: string;
230
+ };
231
+ type TxInput = {
232
+ txHash: string;
233
+ outputIndex: number;
234
+ };
235
+ type UTxO = {
236
+ input: TxInput;
237
+ output: TxOutput;
238
+ };
239
+
219
240
  type TransactionInfo = {
220
241
  index: number;
221
242
  block: string;
@@ -226,21 +247,10 @@ type TransactionInfo = {
226
247
  deposit: string;
227
248
  invalidBefore: string;
228
249
  invalidAfter: string;
229
- };
230
-
231
- type UTxO = {
232
- input: {
233
- outputIndex: number;
234
- txHash: string;
235
- };
236
- output: {
237
- address: string;
238
- amount: Asset[];
239
- dataHash?: string;
240
- plutusData?: string;
241
- scriptRef?: string;
242
- scriptHash?: string;
243
- };
250
+ inputs: UTxO[];
251
+ outputs: UTxO[];
252
+ blockHeight?: number;
253
+ blockTime?: number;
244
254
  };
245
255
 
246
256
  type Wallet = {
@@ -416,6 +426,16 @@ type Anchor = {
416
426
  anchorDataHash: string;
417
427
  };
418
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
+ };
419
439
  type MintItem = {
420
440
  type: "Plutus" | "Native";
421
441
  policyId: string;
@@ -472,7 +492,7 @@ type ScriptTxIn = {
472
492
  };
473
493
  declare const txInToUtxo: (txIn: TxInParameter) => UTxO;
474
494
 
475
- type Credential = {
495
+ type Credential$1 = {
476
496
  type: "ScriptHash";
477
497
  scriptHash: string;
478
498
  } | {
@@ -503,7 +523,7 @@ type VoteType = {
503
523
  };
504
524
  type Voter = {
505
525
  type: "ConstitutionalCommittee";
506
- hotCred: Credential;
526
+ hotCred: Credential$1;
507
527
  } | {
508
528
  type: "DRep";
509
529
  drepId: string;
@@ -540,10 +560,11 @@ type SimpleScriptWithdrawal = {
540
560
  type MeshTxBuilderBody = {
541
561
  inputs: TxIn[];
542
562
  outputs: Output[];
563
+ fee: Quantity;
543
564
  collaterals: PubKeyTxIn[];
544
565
  requiredSignatures: string[];
545
566
  referenceInputs: RefTxIn[];
546
- mints: MintItem[];
567
+ mints: MintParam[];
547
568
  changeAddress: string;
548
569
  metadata: TxMetadata;
549
570
  validityRange: ValidityRange;
@@ -559,10 +580,14 @@ type MeshTxBuilderBody = {
559
580
  };
560
581
  chainedTxs: string[];
561
582
  inputsForEvaluation: Record<string, UTxO>;
562
- fee?: string;
563
583
  network: Network | number[][];
584
+ expectedNumberKeyWitnesses: number;
585
+ expectedByronAddressWitnesses: string[];
586
+ totalCollateral?: Quantity;
587
+ collateralReturnAddress?: string;
564
588
  };
565
589
  declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
590
+ declare function cloneTxBuilderBody(body: MeshTxBuilderBody): MeshTxBuilderBody;
566
591
  type ValidityRange = {
567
592
  invalidBefore?: number;
568
593
  invalidHereafter?: number;
@@ -578,6 +603,7 @@ type RequiredWith<T, K extends keyof T> = Required<T> & {
578
603
  [P in K]: Required<T[P]>;
579
604
  };
580
605
  declare const validityRangeToObj: (validityRange: ValidityRange) => object;
606
+ declare const validityRangeFromObj: (obj: any) => ValidityRange;
581
607
 
582
608
  type DeserializedAddress = {
583
609
  pubKeyHash: string;
@@ -665,7 +691,7 @@ type MTxOutRef = MConStr0<[MConStr0<[string]>, number]>;
665
691
  * Aiken alias
666
692
  * The Mesh Data tuple
667
693
  */
668
- type MTuple<K, V> = [K, V];
694
+ type MTuple<T extends any> = T[];
669
695
  /**
670
696
  * Aiken alias
671
697
  * The Mesh Data Option type
@@ -704,11 +730,10 @@ declare const mOutputReference: (txHash: string, index: number) => MOutputRefere
704
730
  declare const mTxOutRef: (txHash: string, index: number) => MTxOutRef;
705
731
  /**
706
732
  * The utility function to create a Mesh Data tuple in Mesh Data type
707
- * @param key The key of the tuple
708
- * @param value The value of the tuple
733
+ * @param args The arguments of the tuple
709
734
  * @returns The Mesh Data tuple object
710
735
  */
711
- declare const mTuple: <K, V>(key: K, value: V) => MTuple<K, V>;
736
+ declare const mTuple: <T extends any[]>(...args: T) => MTuple<T>;
712
737
  /**
713
738
  * The utility function to create a Mesh Data Option type in Mesh Data type
714
739
  * @param value The value of the option
@@ -727,18 +752,42 @@ declare const mSome: <T extends Data>(value: T) => MSome<T>;
727
752
  */
728
753
  declare const mNone: () => MNone;
729
754
 
755
+ /**
756
+ * The Mesh Data verification key
757
+ */
758
+ type MVerificationKey = MConStr0<[string]>;
759
+ /**
760
+ * The Mesh Data script key
761
+ */
762
+ type MScript = MConStr1<[string]>;
730
763
  /**
731
764
  * The Mesh Data staking credential
732
765
  */
733
- type MMaybeStakingHash = MConStr1<[]> | MConStr0<[MConStr0<[MConStr0<[string]>]>]> | MConStr0<[MConStr0<[MConStr1<[string]>]>]>;
766
+ type MMaybeStakingHash = MConStr1<[]> | MConStr0<[MConStr0<[MVerificationKey]>]> | MConStr0<[MConStr0<[MScript]>]>;
734
767
  /**
735
768
  * The Mesh Data public key address
736
769
  */
737
- type MPubKeyAddress = MConStr0<[MConStr0<[string]>, MMaybeStakingHash]>;
770
+ type MPubKeyAddress = MConStr0<[MVerificationKey, MMaybeStakingHash]>;
738
771
  /**
739
772
  * The Mesh Data script address
740
773
  */
741
- type MScriptAddress = MConStr0<[MConStr1<[string]>, MMaybeStakingHash]>;
774
+ type MScriptAddress = MConStr0<[MScript, MMaybeStakingHash]>;
775
+ /**
776
+ * The Mesh Data credential
777
+ */
778
+ type MCredential = MVerificationKey | MScript;
779
+ /**
780
+ * The utility function to create a Mesh Data verification key
781
+ * @param bytes The public key hash in hex
782
+ * @returns The Mesh Data verification key object
783
+ */
784
+ declare const mVerificationKey: (bytes: string) => MVerificationKey;
785
+ /**
786
+ * The utility function to create a Mesh Data script key
787
+ * @param bytes The script hash in hex
788
+ * @returns The Mesh Data script key object
789
+ */
790
+ declare const mScript: (bytes: string) => MScript;
742
791
  /**
743
792
  * The utility function to create a Mesh Data staking hash
744
793
  * @param stakeCredential The staking credential in hex
@@ -762,6 +811,13 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isStakeS
762
811
  * @returns The Mesh Data script address object
763
812
  */
764
813
  declare const mScriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => MScriptAddress;
814
+ /**
815
+ * The utility function to create a Mesh Data credential
816
+ * @param hash The pub key hash or script hash
817
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
818
+ * @returns Mesh Data credential object
819
+ */
820
+ declare const mCredential: (hash: string, isScriptCredential?: boolean) => MCredential;
765
821
 
766
822
  /**
767
823
  * The Mesh Data boolean
@@ -878,11 +934,27 @@ type AssocMapItem<K, V> = {
878
934
  v: V;
879
935
  };
880
936
  /**
937
+ * PlutusTx alias
881
938
  * The Plutus Data association map in JSON
882
939
  */
883
940
  type AssocMap<K = any, V = any> = {
884
941
  map: AssocMapItem<K, V>[];
885
942
  };
943
+ /**
944
+ * Aiken alias
945
+ * The Plutus Data association map item in JSON
946
+ */
947
+ type Pair<K, V> = {
948
+ k: K;
949
+ v: V;
950
+ };
951
+ /**
952
+ * Aiken alias
953
+ * The Plutus Data association map in JSON
954
+ */
955
+ type Pairs<K = any, V = any> = {
956
+ map: Pair<K, V>[];
957
+ };
886
958
  /**
887
959
  * The utility function to create a Plutus Data boolean in JSON
888
960
  * @param b boolean value
@@ -933,6 +1005,13 @@ declare const plutusBSArrayToString: (bsArray: List<ByteString>) => string;
933
1005
  * @returns The Plutus Data association map object
934
1006
  */
935
1007
  declare const assocMap: <K, V>(mapItems: [K, V][], validation?: boolean) => AssocMap<K, V>;
1008
+ /**
1009
+ * The utility function to create a Plutus Data Pairs in JSON
1010
+ * @param mapItems The items map in array
1011
+ * @param validation Default true - If current data construction would perform validation (introducing this flag due to possible performance issue in loop validation)
1012
+ * @returns The Plutus Data Pairs object
1013
+ */
1014
+ declare const pairs: <K, V>(mapItems: [K, V][], validation?: boolean) => Pairs<K, V>;
936
1015
 
937
1016
  /**
938
1017
  * All the type aliases here represent the type name used in smart contracts from PlutusTx or Aiken.
@@ -1006,8 +1085,8 @@ type Dict<V> = {
1006
1085
  * Aiken alias
1007
1086
  * The Plutus Data tuple in JSON
1008
1087
  */
1009
- type Tuple<K, V> = {
1010
- list: [K, V];
1088
+ type Tuple<T extends any[]> = {
1089
+ list: T;
1011
1090
  };
1012
1091
  /**
1013
1092
  * Aiken alias
@@ -1041,7 +1120,7 @@ declare const scriptHash: (bytes: string) => ScriptHash;
1041
1120
  * @param bytes The script hash in hex
1042
1121
  * @returns The Plutus Data script hash object
1043
1122
  */
1044
- declare const pubKeyHash: (bytes: string) => ScriptHash;
1123
+ declare const pubKeyHash: (bytes: string) => PubKeyHash;
1045
1124
  /**
1046
1125
  * The utility function to create a Plutus Data policy id in JSON
1047
1126
  * @param bytes The policy id in hex
@@ -1103,11 +1182,10 @@ declare const posixTime: (int: number) => POSIXTime;
1103
1182
  declare const dict: <V>(itemsMap: [ByteString, V][]) => Dict<V>;
1104
1183
  /**
1105
1184
  * The utility function to create a Plutus Data tuple in JSON
1106
- * @param key The key of the tuple
1107
- * @param value The value of the tuple
1185
+ * @param args The arguments of the tuple
1108
1186
  * @returns The Plutus Data tuple object
1109
1187
  */
1110
- declare const tuple: <K = PlutusData, V = PlutusData>(key: K, value: V) => Tuple<K, V>;
1188
+ declare const tuple: <T extends PlutusData[]>(...args: T) => Tuple<T>;
1111
1189
  /**
1112
1190
  * The utility function to create a Plutus Data Option in JSON
1113
1191
  * @param value The optional value of the option
@@ -1126,18 +1204,42 @@ declare const some: <T>(value: T) => Some<T>;
1126
1204
  */
1127
1205
  declare const none: () => None;
1128
1206
 
1207
+ /**
1208
+ * The Plutus Data verification key in JSON
1209
+ */
1210
+ type VerificationKey = ConStr0<[PubKeyHash]>;
1211
+ /**
1212
+ * The Plutus Data Script key in JSON
1213
+ */
1214
+ type Script = ConStr1<[ScriptHash]>;
1129
1215
  /**
1130
1216
  * The Plutus Data staking credential in JSON
1131
1217
  */
1132
- type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[ConStr0<[PubKeyHash]>]>]> | ConStr0<[ConStr0<[ConStr1<[ScriptHash]>]>]>;
1218
+ type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[VerificationKey]>]> | ConStr0<[ConStr0<[Script]>]>;
1133
1219
  /**
1134
1220
  * The Plutus Data public key address in JSON
1135
1221
  */
1136
- type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
1222
+ type PubKeyAddress = ConStr0<[VerificationKey, MaybeStakingHash]>;
1137
1223
  /**
1138
1224
  * The Plutus Data script address in JSON
1139
1225
  */
1140
- type ScriptAddress = ConStr0<[ConStr1<[ScriptHash]>, MaybeStakingHash]>;
1226
+ type ScriptAddress = ConStr0<[Script, MaybeStakingHash]>;
1227
+ /**
1228
+ * The Plutus Data credential in JSON
1229
+ */
1230
+ type Credential = VerificationKey | Script;
1231
+ /**
1232
+ * The utility function to create a Plutus Data verification key in JSON
1233
+ * @param bytes The public key hash in hex
1234
+ * @returns The Plutus Data verification key object
1235
+ */
1236
+ declare const verificationKey: (bytes: string) => VerificationKey;
1237
+ /**
1238
+ * The utility function to create a Plutus Data script key in JSON
1239
+ * @param bytes The script hash in hex
1240
+ * @returns The Plutus Data script key object
1241
+ * */
1242
+ declare const script: (bytes: string) => Script;
1141
1243
  /**
1142
1244
  * The utility function to create a Plutus Data staking hash in JSON
1143
1245
  * @param stakeCredential The staking credential in hex
@@ -1161,8 +1263,41 @@ declare const pubKeyAddress: (bytes: string, stakeCredential?: string, isStakeSc
1161
1263
  * @returns The Plutus Data script address object
1162
1264
  */
1163
1265
  declare const scriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => ScriptAddress;
1266
+ /**
1267
+ * The utility function to create a Plutus Data credential in JSON
1268
+ * @param hash The pub key hash or script hash
1269
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
1270
+ * @returns Plutus Data credential object
1271
+ */
1272
+ declare const credential: (hash: string, isScriptCredential?: boolean) => Credential;
1164
1273
 
1165
- type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
1274
+ type ProofStep = ProofStepBranch | ProofStepFork | ProofStepLeaf;
1275
+ type ProofStepBranch = ConStr0<[
1276
+ Integer,
1277
+ ByteString
1278
+ ]>;
1279
+ type ProofStepFork = ConStr1<[
1280
+ Integer,
1281
+ ForkNeighbor
1282
+ ]>;
1283
+ type ProofStepLeaf = ConStr2<[
1284
+ Integer,
1285
+ ByteString,
1286
+ ByteString
1287
+ ]>;
1288
+ type ForkNeighbor = ConStr0<[
1289
+ Integer,
1290
+ ByteString,
1291
+ ByteString
1292
+ ]>;
1293
+ /**
1294
+ * The utility function to transform a JSON proof from Aiken TS offchain library to Mesh JSON Data type
1295
+ * @param proof The proof object from Aiken TS offchain library
1296
+ * @returns The proof object in Mesh JSON Data type
1297
+ */
1298
+ declare const jsonProofToPlutusData: (proof: object) => ProofStep[];
1299
+
1300
+ type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | Pairs | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any>;
1166
1301
 
1167
1302
  /**
1168
1303
  * Converting bytes to hex string
@@ -1182,6 +1317,12 @@ declare const hexToBytes: (hex: string) => Buffer;
1182
1317
  * @returns The hex string
1183
1318
  */
1184
1319
  declare const stringToHex: (str: string) => string;
1320
+ /**
1321
+ * Checking if the string is a hex string
1322
+ * @param hex The string to be checked
1323
+ * @returns True if the string is a hex string, false otherwise
1324
+ */
1325
+ declare const isHexString: (hex: string) => boolean;
1185
1326
  /**
1186
1327
  * Converting hex string to utf8 string
1187
1328
  * @param hex The hex string to be converted
@@ -1326,6 +1467,12 @@ declare class MeshValue {
1326
1467
  * @returns The quantity of the asset
1327
1468
  */
1328
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[];
1329
1476
  /**
1330
1477
  * Get all asset units
1331
1478
  * @returns The asset units
@@ -1357,6 +1504,19 @@ declare class MeshValue {
1357
1504
  * @returns boolean
1358
1505
  */
1359
1506
  leqUnit: (unit: string, other: MeshValue) => boolean;
1507
+ /**
1508
+ * Check if the value is equal to another value
1509
+ * @param other - The value to compare against
1510
+ * @returns boolean
1511
+ */
1512
+ eq: (other: MeshValue) => boolean;
1513
+ /**
1514
+ * Check if the specific unit of value is equal to that unit of another value
1515
+ * @param unit - The unit to compare
1516
+ * @param other - The value to compare against
1517
+ * @returns boolean
1518
+ */
1519
+ eqUnit: (unit: string, other: MeshValue) => boolean;
1360
1520
  /**
1361
1521
  * Check if the value is empty
1362
1522
  * @returns boolean
@@ -1412,7 +1572,6 @@ interface IWithdrawalBlueprint {
1412
1572
  cbor: string;
1413
1573
  hash: string;
1414
1574
  address: string;
1415
- isStakeScriptCredential: boolean;
1416
1575
  paramScript(compiledCode: string, params: string[], paramsType: PlutusDataType): this;
1417
1576
  noParamScript(compiledCode: string): this;
1418
1577
  }
@@ -1504,12 +1663,19 @@ declare const CIP68_100: (tokenNameHex: string) => string;
1504
1663
  */
1505
1664
  declare const CIP68_222: (tokenNameHex: string) => string;
1506
1665
 
1666
+ type IFetcherOptions = {
1667
+ maxPage?: number;
1668
+ order?: "asc" | "desc";
1669
+ [key: string]: any;
1670
+ };
1671
+ declare const DEFAULT_FETCHER_OPTIONS: IFetcherOptions;
1507
1672
  /**
1508
1673
  * Fetcher interface defines end points to query blockchain data.
1509
1674
  */
1510
1675
  interface IFetcher {
1511
1676
  fetchAccountInfo(address: string): Promise<AccountInfo>;
1512
1677
  fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
1678
+ fetchAddressTxs(address: string, options?: IFetcherOptions): Promise<TransactionInfo[]>;
1513
1679
  fetchAssetAddresses(asset: string): Promise<{
1514
1680
  address: string;
1515
1681
  quantity: string;
@@ -1541,16 +1707,228 @@ interface ISubmitter {
1541
1707
  submitTx(tx: string): Promise<string>;
1542
1708
  }
1543
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
+
1544
1912
  interface IMeshTxSerializer {
1545
- verbose: boolean;
1546
- serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol, balanced: Boolean): string;
1913
+ serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1914
+ serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1547
1915
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1548
- resolver: IResolver;
1549
- deserializer: IDeserializer;
1550
1916
  serializeData(data: BuilderData): string;
1551
1917
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1552
1918
  serializePoolId(hash: string): string;
1553
1919
  serializeRewardAddress(stakeKeyHash: string, isScriptHash?: boolean, network_id?: 0 | 1): string;
1920
+ serializeOutput(output: Output): string;
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;
1554
1932
  }
1555
1933
  interface IResolver {
1556
1934
  keys: {
@@ -1563,7 +1941,7 @@ interface IResolver {
1563
1941
  resolveTxHash(txHex: string): string;
1564
1942
  };
1565
1943
  data: {
1566
- resolveDataHash(data: Data): string;
1944
+ resolveDataHash(rawData: BuilderData["content"], type?: PlutusDataType): string;
1567
1945
  };
1568
1946
  script: {
1569
1947
  resolveScriptRef(script: NativeScript | PlutusScript): string;
@@ -1649,4 +2027,4 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1649
2027
 
1650
2028
  declare function getFile(url: string): string;
1651
2029
 
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 };
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 };