@meshsdk/common 1.9.0-beta.1 → 1.9.0-beta.100

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.ts 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 = {
@@ -250,38 +260,6 @@ type Wallet = {
250
260
  version: string;
251
261
  };
252
262
 
253
- declare const experimentalSelectUtxos: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity) => UTxO[];
254
-
255
- declare const keepRelevant: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string) => UTxO[];
256
-
257
- declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: Protocol) => UTxO[];
258
-
259
- declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: Protocol) => UTxO[];
260
-
261
- /**
262
- * All UTxO selection algorithms follows below's interface
263
- *
264
- * Supported algorithms:
265
- * - largestFirst - CIP2 suggested algorithm
266
- * - largestFirstMultiAsset - CIP2 suggested algorithm
267
- * - keepRelevant - CIP2 suggested algorithm
268
- * - experimental - The always evolving algorithm according to the latest research
269
- *
270
- * @param requestedOutputSet
271
- * @param initialUTxOSet
272
- * @returns
273
- */
274
- declare class UtxoSelection {
275
- private threshold;
276
- private includeTxFees;
277
- constructor(threshold?: string, includeTxFees?: boolean);
278
- largestFirst(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
279
- keepRelevant(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
280
- largestFirstMultiAsset(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
281
- experimental(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
282
- }
283
- type UtxoSelectionStrategy = keyof UtxoSelection;
284
-
285
263
  type BuilderData = {
286
264
  type: "Mesh";
287
265
  content: Data;
@@ -416,6 +394,16 @@ type Anchor = {
416
394
  anchorDataHash: string;
417
395
  };
418
396
 
397
+ type MintParam = {
398
+ type: "Plutus" | "Native";
399
+ policyId: string;
400
+ mintValue: {
401
+ assetName: string;
402
+ amount: string;
403
+ }[];
404
+ redeemer?: Redeemer;
405
+ scriptSource?: ScriptSource | SimpleScriptSourceInfo;
406
+ };
419
407
  type MintItem = {
420
408
  type: "Plutus" | "Native";
421
409
  policyId: string;
@@ -435,159 +423,6 @@ type Output = {
435
423
  referenceScript?: PlutusScript;
436
424
  };
437
425
 
438
- type RefTxIn = {
439
- txHash: string;
440
- txIndex: number;
441
- scriptSize?: number;
442
- };
443
- type TxInParameter = {
444
- txHash: string;
445
- txIndex: number;
446
- amount?: Asset[];
447
- address?: string;
448
- scriptSize?: number;
449
- };
450
- type TxIn = PubKeyTxIn | SimpleScriptTxIn | ScriptTxIn;
451
- type PubKeyTxIn = {
452
- type: "PubKey";
453
- txIn: TxInParameter;
454
- };
455
- type SimpleScriptTxIn = {
456
- type: "SimpleScript";
457
- txIn: TxInParameter;
458
- simpleScriptTxIn: SimpleScriptTxInParameter;
459
- };
460
- type SimpleScriptTxInParameter = {
461
- scriptSource?: SimpleScriptSourceInfo;
462
- };
463
- type ScriptTxInParameter = {
464
- scriptSource?: ScriptSource;
465
- datumSource?: DatumSource;
466
- redeemer?: Redeemer;
467
- };
468
- type ScriptTxIn = {
469
- type: "Script";
470
- txIn: TxInParameter;
471
- scriptTxIn: ScriptTxInParameter;
472
- };
473
-
474
- type Credential = {
475
- type: "ScriptHash";
476
- scriptHash: string;
477
- } | {
478
- type: "KeyHash";
479
- keyHash: string;
480
- };
481
-
482
- type Vote = BasicVote | ScriptVote | SimpleScriptVote;
483
- type BasicVote = {
484
- type: "BasicVote";
485
- vote: VoteType;
486
- };
487
- type SimpleScriptVote = {
488
- type: "SimpleScriptVote";
489
- vote: VoteType;
490
- simpleScriptSource: SimpleScriptSourceInfo;
491
- };
492
- type ScriptVote = {
493
- type: "ScriptVote";
494
- vote: VoteType;
495
- redeemer?: Redeemer;
496
- scriptSource?: ScriptSource;
497
- };
498
- type VoteType = {
499
- voter: Voter;
500
- govActionId: RefTxIn;
501
- votingProcedure: VotingProcedure;
502
- };
503
- type Voter = {
504
- type: "ConstitutionalCommittee";
505
- hotCred: Credential;
506
- } | {
507
- type: "DRep";
508
- drepId: string;
509
- } | {
510
- type: "StakingPool";
511
- keyHash: string;
512
- };
513
- type VotingProcedure = {
514
- voteKind: VoteKind;
515
- anchor?: Anchor;
516
- };
517
- type VoteKind = "Yes" | "No" | "Abstain";
518
-
519
- type Withdrawal = PubKeyWithdrawal | ScriptWithdrawal | SimpleScriptWithdrawal;
520
- type PubKeyWithdrawal = {
521
- type: "PubKeyWithdrawal";
522
- address: string;
523
- coin: string;
524
- };
525
- type ScriptWithdrawal = {
526
- type: "ScriptWithdrawal";
527
- address: string;
528
- coin: string;
529
- scriptSource?: ScriptSource;
530
- redeemer?: Redeemer;
531
- };
532
- type SimpleScriptWithdrawal = {
533
- type: "SimpleScriptWithdrawal";
534
- address: string;
535
- coin: string;
536
- scriptSource?: SimpleScriptSourceInfo;
537
- };
538
-
539
- type MeshTxBuilderBody = {
540
- inputs: TxIn[];
541
- outputs: Output[];
542
- collaterals: PubKeyTxIn[];
543
- requiredSignatures: string[];
544
- referenceInputs: RefTxIn[];
545
- mints: MintItem[];
546
- changeAddress: string;
547
- metadata: TxMetadata;
548
- validityRange: ValidityRange;
549
- certificates: Certificate[];
550
- withdrawals: Withdrawal[];
551
- votes: Vote[];
552
- signingKey: string[];
553
- extraInputs: UTxO[];
554
- selectionConfig: {
555
- threshold: string;
556
- strategy: UtxoSelectionStrategy;
557
- includeTxFees: boolean;
558
- };
559
- fee?: string;
560
- network: Network | number[][];
561
- };
562
- declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
563
- type ValidityRange = {
564
- invalidBefore?: number;
565
- invalidHereafter?: number;
566
- };
567
- type MetadatumMap = Map<Metadatum, Metadatum>;
568
- type Metadatum = bigint | number | string | Uint8Array | MetadatumMap | Metadatum[];
569
- type TxMetadata = Map<bigint, Metadatum>;
570
- type Metadata = {
571
- tag: string;
572
- metadata: string;
573
- };
574
- type RequiredWith<T, K extends keyof T> = Required<T> & {
575
- [P in K]: Required<T[P]>;
576
- };
577
- declare const validityRangeToObj: (validityRange: ValidityRange) => object;
578
-
579
- type DeserializedAddress = {
580
- pubKeyHash: string;
581
- scriptHash: string;
582
- stakeCredentialHash: string;
583
- stakeScriptCredentialHash: string;
584
- };
585
-
586
- type DeserializedScript = {
587
- scriptHash: string;
588
- scriptCbor?: string;
589
- };
590
-
591
426
  /**
592
427
  * The Mesh Data constructor object, representing custom data type
593
428
  */
@@ -662,7 +497,7 @@ type MTxOutRef = MConStr0<[MConStr0<[string]>, number]>;
662
497
  * Aiken alias
663
498
  * The Mesh Data tuple
664
499
  */
665
- type MTuple<K, V> = [K, V];
500
+ type MTuple<T extends any> = T[];
666
501
  /**
667
502
  * Aiken alias
668
503
  * The Mesh Data Option type
@@ -701,11 +536,10 @@ declare const mOutputReference: (txHash: string, index: number) => MOutputRefere
701
536
  declare const mTxOutRef: (txHash: string, index: number) => MTxOutRef;
702
537
  /**
703
538
  * The utility function to create a Mesh Data tuple in Mesh Data type
704
- * @param key The key of the tuple
705
- * @param value The value of the tuple
539
+ * @param args The arguments of the tuple
706
540
  * @returns The Mesh Data tuple object
707
541
  */
708
- declare const mTuple: <K, V>(key: K, value: V) => MTuple<K, V>;
542
+ declare const mTuple: <T extends any[]>(...args: T) => MTuple<T>;
709
543
  /**
710
544
  * The utility function to create a Mesh Data Option type in Mesh Data type
711
545
  * @param value The value of the option
@@ -724,18 +558,42 @@ declare const mSome: <T extends Data>(value: T) => MSome<T>;
724
558
  */
725
559
  declare const mNone: () => MNone;
726
560
 
561
+ /**
562
+ * The Mesh Data verification key
563
+ */
564
+ type MVerificationKey = MConStr0<[string]>;
565
+ /**
566
+ * The Mesh Data script key
567
+ */
568
+ type MScript = MConStr1<[string]>;
727
569
  /**
728
570
  * The Mesh Data staking credential
729
571
  */
730
- type MMaybeStakingHash = MConStr1<[]> | MConStr0<[MConStr0<[MConStr0<[string]>]>]> | MConStr0<[MConStr0<[MConStr1<[string]>]>]>;
572
+ type MMaybeStakingHash = MConStr1<[]> | MConStr0<[MConStr0<[MVerificationKey]>]> | MConStr0<[MConStr0<[MScript]>]>;
731
573
  /**
732
574
  * The Mesh Data public key address
733
575
  */
734
- type MPubKeyAddress = MConStr0<[MConStr0<[string]>, MMaybeStakingHash]>;
576
+ type MPubKeyAddress = MConStr0<[MVerificationKey, MMaybeStakingHash]>;
735
577
  /**
736
578
  * The Mesh Data script address
737
579
  */
738
- type MScriptAddress = MConStr0<[MConStr1<[string]>, MMaybeStakingHash]>;
580
+ type MScriptAddress = MConStr0<[MScript, MMaybeStakingHash]>;
581
+ /**
582
+ * The Mesh Data credential
583
+ */
584
+ type MCredential = MVerificationKey | MScript;
585
+ /**
586
+ * The utility function to create a Mesh Data verification key
587
+ * @param bytes The public key hash in hex
588
+ * @returns The Mesh Data verification key object
589
+ */
590
+ declare const mVerificationKey: (bytes: string) => MVerificationKey;
591
+ /**
592
+ * The utility function to create a Mesh Data script key
593
+ * @param bytes The script hash in hex
594
+ * @returns The Mesh Data script key object
595
+ */
596
+ declare const mScript: (bytes: string) => MScript;
739
597
  /**
740
598
  * The utility function to create a Mesh Data staking hash
741
599
  * @param stakeCredential The staking credential in hex
@@ -759,6 +617,13 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isStakeS
759
617
  * @returns The Mesh Data script address object
760
618
  */
761
619
  declare const mScriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => MScriptAddress;
620
+ /**
621
+ * The utility function to create a Mesh Data credential
622
+ * @param hash The pub key hash or script hash
623
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
624
+ * @returns Mesh Data credential object
625
+ */
626
+ declare const mCredential: (hash: string, isScriptCredential?: boolean) => MCredential;
762
627
 
763
628
  /**
764
629
  * The Mesh Data boolean
@@ -875,11 +740,27 @@ type AssocMapItem<K, V> = {
875
740
  v: V;
876
741
  };
877
742
  /**
743
+ * PlutusTx alias
878
744
  * The Plutus Data association map in JSON
879
745
  */
880
746
  type AssocMap<K = any, V = any> = {
881
747
  map: AssocMapItem<K, V>[];
882
748
  };
749
+ /**
750
+ * Aiken alias
751
+ * The Plutus Data association map item in JSON
752
+ */
753
+ type Pair<K, V> = {
754
+ k: K;
755
+ v: V;
756
+ };
757
+ /**
758
+ * Aiken alias
759
+ * The Plutus Data association map in JSON
760
+ */
761
+ type Pairs<K = any, V = any> = {
762
+ map: Pair<K, V>[];
763
+ };
883
764
  /**
884
765
  * The utility function to create a Plutus Data boolean in JSON
885
766
  * @param b boolean value
@@ -930,6 +811,13 @@ declare const plutusBSArrayToString: (bsArray: List<ByteString>) => string;
930
811
  * @returns The Plutus Data association map object
931
812
  */
932
813
  declare const assocMap: <K, V>(mapItems: [K, V][], validation?: boolean) => AssocMap<K, V>;
814
+ /**
815
+ * The utility function to create a Plutus Data Pairs in JSON
816
+ * @param mapItems The items map in array
817
+ * @param validation Default true - If current data construction would perform validation (introducing this flag due to possible performance issue in loop validation)
818
+ * @returns The Plutus Data Pairs object
819
+ */
820
+ declare const pairs: <K, V>(mapItems: [K, V][], validation?: boolean) => Pairs<K, V>;
933
821
 
934
822
  /**
935
823
  * All the type aliases here represent the type name used in smart contracts from PlutusTx or Aiken.
@@ -1003,8 +891,8 @@ type Dict<V> = {
1003
891
  * Aiken alias
1004
892
  * The Plutus Data tuple in JSON
1005
893
  */
1006
- type Tuple<K, V> = {
1007
- list: [K, V];
894
+ type Tuple<T extends any[]> = {
895
+ list: T;
1008
896
  };
1009
897
  /**
1010
898
  * Aiken alias
@@ -1038,7 +926,7 @@ declare const scriptHash: (bytes: string) => ScriptHash;
1038
926
  * @param bytes The script hash in hex
1039
927
  * @returns The Plutus Data script hash object
1040
928
  */
1041
- declare const pubKeyHash: (bytes: string) => ScriptHash;
929
+ declare const pubKeyHash: (bytes: string) => PubKeyHash;
1042
930
  /**
1043
931
  * The utility function to create a Plutus Data policy id in JSON
1044
932
  * @param bytes The policy id in hex
@@ -1100,11 +988,10 @@ declare const posixTime: (int: number) => POSIXTime;
1100
988
  declare const dict: <V>(itemsMap: [ByteString, V][]) => Dict<V>;
1101
989
  /**
1102
990
  * The utility function to create a Plutus Data tuple in JSON
1103
- * @param key The key of the tuple
1104
- * @param value The value of the tuple
991
+ * @param args The arguments of the tuple
1105
992
  * @returns The Plutus Data tuple object
1106
993
  */
1107
- declare const tuple: <K = PlutusData, V = PlutusData>(key: K, value: V) => Tuple<K, V>;
994
+ declare const tuple: <T extends PlutusData[]>(...args: T) => Tuple<T>;
1108
995
  /**
1109
996
  * The utility function to create a Plutus Data Option in JSON
1110
997
  * @param value The optional value of the option
@@ -1123,18 +1010,42 @@ declare const some: <T>(value: T) => Some<T>;
1123
1010
  */
1124
1011
  declare const none: () => None;
1125
1012
 
1013
+ /**
1014
+ * The Plutus Data verification key in JSON
1015
+ */
1016
+ type VerificationKey = ConStr0<[PubKeyHash]>;
1017
+ /**
1018
+ * The Plutus Data Script key in JSON
1019
+ */
1020
+ type Script = ConStr1<[ScriptHash]>;
1126
1021
  /**
1127
1022
  * The Plutus Data staking credential in JSON
1128
1023
  */
1129
- type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[ConStr0<[PubKeyHash]>]>]> | ConStr0<[ConStr0<[ConStr1<[ScriptHash]>]>]>;
1024
+ type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[VerificationKey]>]> | ConStr0<[ConStr0<[Script]>]>;
1130
1025
  /**
1131
1026
  * The Plutus Data public key address in JSON
1132
1027
  */
1133
- type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
1028
+ type PubKeyAddress = ConStr0<[VerificationKey, MaybeStakingHash]>;
1134
1029
  /**
1135
1030
  * The Plutus Data script address in JSON
1136
1031
  */
1137
- type ScriptAddress = ConStr0<[ConStr1<[ScriptHash]>, MaybeStakingHash]>;
1032
+ type ScriptAddress = ConStr0<[Script, MaybeStakingHash]>;
1033
+ /**
1034
+ * The Plutus Data credential in JSON
1035
+ */
1036
+ type Credential$1 = VerificationKey | Script;
1037
+ /**
1038
+ * The utility function to create a Plutus Data verification key in JSON
1039
+ * @param bytes The public key hash in hex
1040
+ * @returns The Plutus Data verification key object
1041
+ */
1042
+ declare const verificationKey: (bytes: string) => VerificationKey;
1043
+ /**
1044
+ * The utility function to create a Plutus Data script key in JSON
1045
+ * @param bytes The script hash in hex
1046
+ * @returns The Plutus Data script key object
1047
+ * */
1048
+ declare const script: (bytes: string) => Script;
1138
1049
  /**
1139
1050
  * The utility function to create a Plutus Data staking hash in JSON
1140
1051
  * @param stakeCredential The staking credential in hex
@@ -1158,8 +1069,41 @@ declare const pubKeyAddress: (bytes: string, stakeCredential?: string, isStakeSc
1158
1069
  * @returns The Plutus Data script address object
1159
1070
  */
1160
1071
  declare const scriptAddress: (bytes: string, stakeCredential?: string, isStakeScriptCredential?: boolean) => ScriptAddress;
1072
+ /**
1073
+ * The utility function to create a Plutus Data credential in JSON
1074
+ * @param hash The pub key hash or script hash
1075
+ * @param isScriptCredential Indicate if the credential is script hash (false for pub key hash)
1076
+ * @returns Plutus Data credential object
1077
+ */
1078
+ declare const credential: (hash: string, isScriptCredential?: boolean) => Credential$1;
1079
+
1080
+ type ProofStep = ProofStepBranch | ProofStepFork | ProofStepLeaf;
1081
+ type ProofStepBranch = ConStr0<[
1082
+ Integer,
1083
+ ByteString
1084
+ ]>;
1085
+ type ProofStepFork = ConStr1<[
1086
+ Integer,
1087
+ ForkNeighbor
1088
+ ]>;
1089
+ type ProofStepLeaf = ConStr2<[
1090
+ Integer,
1091
+ ByteString,
1092
+ ByteString
1093
+ ]>;
1094
+ type ForkNeighbor = ConStr0<[
1095
+ Integer,
1096
+ ByteString,
1097
+ ByteString
1098
+ ]>;
1099
+ /**
1100
+ * The utility function to transform a JSON proof from Aiken TS offchain library to Mesh JSON Data type
1101
+ * @param proof The proof object from Aiken TS offchain library
1102
+ * @returns The proof object in Mesh JSON Data type
1103
+ */
1104
+ declare const jsonProofToPlutusData: (proof: object) => ProofStep[];
1161
1105
 
1162
- type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
1106
+ type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | Pairs | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any>;
1163
1107
 
1164
1108
  /**
1165
1109
  * Converting bytes to hex string
@@ -1179,6 +1123,12 @@ declare const hexToBytes: (hex: string) => Buffer;
1179
1123
  * @returns The hex string
1180
1124
  */
1181
1125
  declare const stringToHex: (str: string) => string;
1126
+ /**
1127
+ * Checking if the string is a hex string
1128
+ * @param hex The string to be checked
1129
+ * @returns True if the string is a hex string, false otherwise
1130
+ */
1131
+ declare const isHexString: (hex: string) => boolean;
1182
1132
  /**
1183
1133
  * Converting hex string to utf8 string
1184
1134
  * @param hex The hex string to be converted
@@ -1281,6 +1231,12 @@ declare const mValue: (assets: Asset[]) => MValue;
1281
1231
  declare class MeshValue {
1282
1232
  value: Record<string, bigint>;
1283
1233
  constructor(value?: Record<string, bigint>);
1234
+ /**
1235
+ * Sort a Value (JSON representation) by policy ID then token name
1236
+ * @param plutusValue The Value to sort
1237
+ * @returns Sorted Value
1238
+ */
1239
+ static sortValue: (plutusValue: Value) => Value;
1284
1240
  /**
1285
1241
  * Converting assets into MeshValue
1286
1242
  * @param assets The assets to convert
@@ -1323,6 +1279,12 @@ declare class MeshValue {
1323
1279
  * @returns The quantity of the asset
1324
1280
  */
1325
1281
  get: (unit: string) => bigint;
1282
+ /**
1283
+ * Get all assets that belong to a specific policy ID
1284
+ * @param policyId The policy ID to filter by
1285
+ * @returns Array of assets that match the policy ID
1286
+ */
1287
+ getPolicyAssets: (policyId: string) => Asset[];
1326
1288
  /**
1327
1289
  * Get all asset units
1328
1290
  * @returns The asset units
@@ -1354,6 +1316,19 @@ declare class MeshValue {
1354
1316
  * @returns boolean
1355
1317
  */
1356
1318
  leqUnit: (unit: string, other: MeshValue) => boolean;
1319
+ /**
1320
+ * Check if the value is equal to another value
1321
+ * @param other - The value to compare against
1322
+ * @returns boolean
1323
+ */
1324
+ eq: (other: MeshValue) => boolean;
1325
+ /**
1326
+ * Check if the specific unit of value is equal to that unit of another value
1327
+ * @param unit - The unit to compare
1328
+ * @param other - The value to compare against
1329
+ * @returns boolean
1330
+ */
1331
+ eqUnit: (unit: string, other: MeshValue) => boolean;
1357
1332
  /**
1358
1333
  * Check if the value is empty
1359
1334
  * @returns boolean
@@ -1372,10 +1347,12 @@ declare class MeshValue {
1372
1347
  toAssets: () => Asset[];
1373
1348
  /**
1374
1349
  * Convert the MeshValue object into Cardano data Value in Mesh Data type
1350
+ * Entries are sorted by byte ordering of policy ID, then token name
1375
1351
  */
1376
1352
  toData: () => MValue;
1377
1353
  /**
1378
1354
  * Convert the MeshValue object into a JSON representation of Cardano data Value
1355
+ * Entries are sorted by byte ordering of policy ID, then token name
1379
1356
  * @returns Cardano data Value in JSON
1380
1357
  */
1381
1358
  toJSON: () => Value;
@@ -1383,6 +1360,348 @@ declare class MeshValue {
1383
1360
 
1384
1361
  type PlutusDataType = "Mesh" | "JSON" | "CBOR";
1385
1362
 
1363
+ type Credential = {
1364
+ type: "ScriptHash";
1365
+ scriptHash: string;
1366
+ } | {
1367
+ type: "KeyHash";
1368
+ keyHash: string;
1369
+ };
1370
+
1371
+ type GovernanceProposalInfo = {
1372
+ txHash: string;
1373
+ certIndex: number;
1374
+ governanceType: string;
1375
+ deposit: number;
1376
+ returnAddress: string;
1377
+ governanceDescription: string;
1378
+ ratifiedEpoch: number;
1379
+ enactedEpoch: number;
1380
+ droppedEpoch: number;
1381
+ expiredEpoch: number;
1382
+ expiration: number;
1383
+ metadata: object;
1384
+ };
1385
+ type Rational = {
1386
+ numerator: string;
1387
+ denominator: string;
1388
+ };
1389
+ type RewardAddress = string;
1390
+ type GovernanceActionId = {
1391
+ transactionId: string;
1392
+ govActionIndex: number;
1393
+ };
1394
+ type ProtocolVersion = {
1395
+ major: number;
1396
+ minor: number;
1397
+ };
1398
+ type ProtocolParamUpdate = {
1399
+ minFeeA?: string;
1400
+ minFeeB?: string;
1401
+ maxBlockBodySize?: number;
1402
+ maxTxSize?: number;
1403
+ maxBlockHeaderSize?: number;
1404
+ keyDeposit?: string;
1405
+ poolDeposit?: string;
1406
+ maxEpoch?: number;
1407
+ nOpt?: number;
1408
+ poolPledgeInfluence?: Rational;
1409
+ expansionRate?: Rational;
1410
+ treasuryGrowthRate?: Rational;
1411
+ minPoolCost?: string;
1412
+ adaPerUtxoByte?: string;
1413
+ costModels?: Record<string, number[]>;
1414
+ executionCosts?: {
1415
+ memPrice?: Rational;
1416
+ stepPrice?: Rational;
1417
+ };
1418
+ maxTxExUnits?: {
1419
+ mem: string;
1420
+ steps: string;
1421
+ };
1422
+ maxBlockExUnits?: {
1423
+ mem: string;
1424
+ steps: string;
1425
+ };
1426
+ maxValueSize?: number;
1427
+ collateralPercentage?: number;
1428
+ maxCollateralInputs?: number;
1429
+ poolVotingThresholds?: {
1430
+ motionNoConfidence?: Rational;
1431
+ committeeNormal?: Rational;
1432
+ committeeNoConfidence?: Rational;
1433
+ hardForkInitiation?: Rational;
1434
+ ppSecurityGroup?: Rational;
1435
+ };
1436
+ drepVotingThresholds?: {
1437
+ motionNoConfidence?: Rational;
1438
+ committeeNormal?: Rational;
1439
+ committeeNoConfidence?: Rational;
1440
+ updateConstitution?: Rational;
1441
+ hardForkInitiation?: Rational;
1442
+ ppNetworkGroup?: Rational;
1443
+ ppEconomicGroup?: Rational;
1444
+ ppTechnicalGroup?: Rational;
1445
+ ppGovGroup?: Rational;
1446
+ treasuryWithdrawal?: Rational;
1447
+ };
1448
+ minCommitteeSize?: number;
1449
+ committeeTermLimit?: number;
1450
+ govActionValidityPeriod?: number;
1451
+ govActionDeposit?: string;
1452
+ drepDeposit?: string;
1453
+ drepInactivityPeriod?: number;
1454
+ refScriptCostPerByte?: Rational;
1455
+ };
1456
+ type CommitteeMember = {
1457
+ stakeCredential: Credential;
1458
+ termLimit: number;
1459
+ };
1460
+ type Committee = {
1461
+ members: CommitteeMember[];
1462
+ quorumThreshold: Rational;
1463
+ };
1464
+ type Constitution = {
1465
+ anchor: Anchor;
1466
+ scriptHash?: ScriptHash;
1467
+ };
1468
+ type TreasuryWithdrawals = Record<RewardAddress, string>;
1469
+ type ParameterChangeAction = {
1470
+ govActionId?: GovernanceActionId;
1471
+ protocolParamUpdates: ProtocolParamUpdate;
1472
+ policyHash?: ScriptHash;
1473
+ };
1474
+ type HardForkInitiationAction = {
1475
+ govActionId?: GovernanceActionId;
1476
+ protocolVersion: ProtocolVersion;
1477
+ };
1478
+ type TreasuryWithdrawalsAction = {
1479
+ withdrawals: TreasuryWithdrawals;
1480
+ policyHash?: ScriptHash;
1481
+ };
1482
+ type NoConfidenceAction = {
1483
+ govActionId?: GovernanceActionId;
1484
+ };
1485
+ type UpdateCommitteeAction = {
1486
+ govActionId?: GovernanceActionId;
1487
+ committee: Committee;
1488
+ membersToRemove: Credential[];
1489
+ };
1490
+ type NewConstitutionAction = {
1491
+ govActionId?: GovernanceActionId;
1492
+ constitution: Constitution;
1493
+ };
1494
+ type InfoAction = {};
1495
+ declare enum GovernanceActionKind {
1496
+ ParameterChangeAction = "ParameterChangeAction",
1497
+ HardForkInitiationAction = "HardForkInitiationAction",
1498
+ TreasuryWithdrawalsAction = "TreasuryWithdrawalsAction",
1499
+ NoConfidenceAction = "NoConfidenceAction",
1500
+ UpdateCommitteeAction = "UpdateCommitteeAction",
1501
+ NewConstitutionAction = "NewConstitutionAction",
1502
+ InfoAction = "InfoAction"
1503
+ }
1504
+ type GovernanceAction = {
1505
+ kind: "ParameterChangeAction";
1506
+ action: ParameterChangeAction;
1507
+ } | {
1508
+ kind: "HardForkInitiationAction";
1509
+ action: HardForkInitiationAction;
1510
+ } | {
1511
+ kind: "TreasuryWithdrawalsAction";
1512
+ action: TreasuryWithdrawalsAction;
1513
+ } | {
1514
+ kind: "NoConfidenceAction";
1515
+ action: NoConfidenceAction;
1516
+ } | {
1517
+ kind: "UpdateCommitteeAction";
1518
+ action: UpdateCommitteeAction;
1519
+ } | {
1520
+ kind: "NewConstitutionAction";
1521
+ action: NewConstitutionAction;
1522
+ } | {
1523
+ kind: "InfoAction";
1524
+ action: InfoAction;
1525
+ };
1526
+
1527
+ type ProposalType = {
1528
+ governanceAction: GovernanceAction;
1529
+ anchor: Anchor;
1530
+ rewardAccount: RewardAddress;
1531
+ deposit: string;
1532
+ };
1533
+ type BasicProposal = {
1534
+ type: "BasicProposal";
1535
+ proposalType: ProposalType;
1536
+ };
1537
+ type ScriptProposal = {
1538
+ type: "ScriptProposal";
1539
+ proposalType: ProposalType;
1540
+ redeemer?: Redeemer;
1541
+ scriptSource?: ScriptSource;
1542
+ };
1543
+ type SimpleScriptProposal = {
1544
+ type: "SimpleScriptProposal";
1545
+ proposalType: ProposalType;
1546
+ simpleScriptSource?: SimpleScriptSourceInfo;
1547
+ };
1548
+ type Proposal = BasicProposal | ScriptProposal | SimpleScriptProposal;
1549
+
1550
+ type RefTxIn = {
1551
+ txHash: string;
1552
+ txIndex: number;
1553
+ scriptSize?: number;
1554
+ };
1555
+ type TxInParameter = {
1556
+ txHash: string;
1557
+ txIndex: number;
1558
+ amount?: Asset[];
1559
+ address?: string;
1560
+ scriptSize?: number;
1561
+ };
1562
+ type TxIn = PubKeyTxIn | SimpleScriptTxIn | ScriptTxIn;
1563
+ type PubKeyTxIn = {
1564
+ type: "PubKey";
1565
+ txIn: TxInParameter;
1566
+ };
1567
+ type SimpleScriptTxIn = {
1568
+ type: "SimpleScript";
1569
+ txIn: TxInParameter;
1570
+ simpleScriptTxIn: SimpleScriptTxInParameter;
1571
+ };
1572
+ type SimpleScriptTxInParameter = {
1573
+ scriptSource?: SimpleScriptSourceInfo;
1574
+ };
1575
+ type ScriptTxInParameter = {
1576
+ scriptSource?: ScriptSource;
1577
+ datumSource?: DatumSource;
1578
+ redeemer?: Redeemer;
1579
+ };
1580
+ type ScriptTxIn = {
1581
+ type: "Script";
1582
+ txIn: TxInParameter;
1583
+ scriptTxIn: ScriptTxInParameter;
1584
+ };
1585
+ declare const txInToUtxo: (txIn: TxInParameter) => UTxO;
1586
+
1587
+ type Vote = BasicVote | ScriptVote | SimpleScriptVote;
1588
+ type BasicVote = {
1589
+ type: "BasicVote";
1590
+ vote: VoteType;
1591
+ };
1592
+ type SimpleScriptVote = {
1593
+ type: "SimpleScriptVote";
1594
+ vote: VoteType;
1595
+ simpleScriptSource: SimpleScriptSourceInfo;
1596
+ };
1597
+ type ScriptVote = {
1598
+ type: "ScriptVote";
1599
+ vote: VoteType;
1600
+ redeemer?: Redeemer;
1601
+ scriptSource?: ScriptSource;
1602
+ };
1603
+ type VoteType = {
1604
+ voter: Voter;
1605
+ govActionId: RefTxIn;
1606
+ votingProcedure: VotingProcedure;
1607
+ };
1608
+ type Voter = {
1609
+ type: "ConstitutionalCommittee";
1610
+ hotCred: Credential;
1611
+ } | {
1612
+ type: "DRep";
1613
+ drepId: string;
1614
+ } | {
1615
+ type: "StakingPool";
1616
+ keyHash: string;
1617
+ };
1618
+ type VotingProcedure = {
1619
+ voteKind: VoteKind;
1620
+ anchor?: Anchor;
1621
+ };
1622
+ type VoteKind = "Yes" | "No" | "Abstain";
1623
+
1624
+ type Withdrawal = PubKeyWithdrawal | ScriptWithdrawal | SimpleScriptWithdrawal;
1625
+ type PubKeyWithdrawal = {
1626
+ type: "PubKeyWithdrawal";
1627
+ address: string;
1628
+ coin: string;
1629
+ };
1630
+ type ScriptWithdrawal = {
1631
+ type: "ScriptWithdrawal";
1632
+ address: string;
1633
+ coin: string;
1634
+ scriptSource?: ScriptSource;
1635
+ redeemer?: Redeemer;
1636
+ };
1637
+ type SimpleScriptWithdrawal = {
1638
+ type: "SimpleScriptWithdrawal";
1639
+ address: string;
1640
+ coin: string;
1641
+ scriptSource?: SimpleScriptSourceInfo;
1642
+ };
1643
+
1644
+ type MeshTxBuilderBody = {
1645
+ inputs: TxIn[];
1646
+ outputs: Output[];
1647
+ fee: Quantity;
1648
+ collaterals: PubKeyTxIn[];
1649
+ requiredSignatures: string[];
1650
+ referenceInputs: RefTxIn[];
1651
+ mints: MintParam[];
1652
+ changeAddress: string;
1653
+ metadata: TxMetadata;
1654
+ scriptMetadata: ScriptMetadata[];
1655
+ validityRange: ValidityRange;
1656
+ certificates: Certificate[];
1657
+ withdrawals: Withdrawal[];
1658
+ votes: Vote[];
1659
+ proposals: Proposal[];
1660
+ signingKey: string[];
1661
+ extraInputs: UTxO[];
1662
+ chainedTxs: string[];
1663
+ inputsForEvaluation: Record<string, UTxO>;
1664
+ network: Network | number[][];
1665
+ expectedNumberKeyWitnesses: number;
1666
+ expectedByronAddressWitnesses: string[];
1667
+ totalCollateral?: Quantity;
1668
+ collateralReturnAddress?: string;
1669
+ };
1670
+ declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
1671
+ declare function cloneTxBuilderBody(body: MeshTxBuilderBody): MeshTxBuilderBody;
1672
+ type ValidityRange = {
1673
+ invalidBefore?: number;
1674
+ invalidHereafter?: number;
1675
+ };
1676
+ type MetadatumMap = Map<Metadatum, Metadatum>;
1677
+ type Metadatum = bigint | number | string | Uint8Array | MetadatumMap | Metadatum[];
1678
+ type TxMetadata = Map<bigint, Metadatum>;
1679
+ type Metadata = {
1680
+ tag: string;
1681
+ metadata: string;
1682
+ };
1683
+ type ScriptMetadata = {
1684
+ scriptType: "PlutusV1" | "PlutusV2" | "PlutusV3" | "Native";
1685
+ scriptCbor: string;
1686
+ };
1687
+ type RequiredWith<T, K extends keyof T> = Required<T> & {
1688
+ [P in K]: Required<T[P]>;
1689
+ };
1690
+ declare const validityRangeToObj: (validityRange: ValidityRange) => object;
1691
+ declare const validityRangeFromObj: (obj: any) => ValidityRange;
1692
+
1693
+ type DeserializedAddress = {
1694
+ pubKeyHash: string;
1695
+ scriptHash: string;
1696
+ stakeCredentialHash: string;
1697
+ stakeScriptCredentialHash: string;
1698
+ };
1699
+
1700
+ type DeserializedScript = {
1701
+ scriptHash: string;
1702
+ scriptCbor?: string;
1703
+ };
1704
+
1386
1705
  interface IMintingBlueprint {
1387
1706
  version: LanguageVersion;
1388
1707
  cbor: string;
@@ -1409,28 +1728,13 @@ interface IWithdrawalBlueprint {
1409
1728
  cbor: string;
1410
1729
  hash: string;
1411
1730
  address: string;
1412
- isStakeScriptCredential: boolean;
1413
1731
  paramScript(compiledCode: string, params: string[], paramsType: PlutusDataType): this;
1414
1732
  noParamScript(compiledCode: string): this;
1415
1733
  }
1416
1734
 
1417
- type GovernanceProposalInfo = {
1418
- txHash: string;
1419
- certIndex: number;
1420
- governanceType: string;
1421
- deposit: number;
1422
- returnAddress: string;
1423
- governanceDescription: string;
1424
- ratifiedEpoch: number;
1425
- enactedEpoch: number;
1426
- droppedEpoch: number;
1427
- expiredEpoch: number;
1428
- expiration: number;
1429
- metadata: object;
1430
- };
1431
-
1432
1735
  declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
1433
1736
  declare const DREP_DEPOSIT = "500000000";
1737
+ declare const VOTING_PROPOSAL_DEPOSIT = "100000000000";
1434
1738
  declare const resolveTxFees: (txSize: number, minFeeA?: number, minFeeB?: number) => string;
1435
1739
 
1436
1740
  declare const SUPPORTED_WALLETS: string[];
@@ -1501,12 +1805,19 @@ declare const CIP68_100: (tokenNameHex: string) => string;
1501
1805
  */
1502
1806
  declare const CIP68_222: (tokenNameHex: string) => string;
1503
1807
 
1808
+ type IFetcherOptions = {
1809
+ maxPage?: number;
1810
+ order?: "asc" | "desc";
1811
+ [key: string]: any;
1812
+ };
1813
+ declare const DEFAULT_FETCHER_OPTIONS: IFetcherOptions;
1504
1814
  /**
1505
1815
  * Fetcher interface defines end points to query blockchain data.
1506
1816
  */
1507
1817
  interface IFetcher {
1508
1818
  fetchAccountInfo(address: string): Promise<AccountInfo>;
1509
1819
  fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
1820
+ fetchAddressTxs(address: string, options?: IFetcherOptions): Promise<TransactionInfo[]>;
1510
1821
  fetchAssetAddresses(asset: string): Promise<{
1511
1822
  address: string;
1512
1823
  quantity: string;
@@ -1525,11 +1836,10 @@ interface IFetcher {
1525
1836
  }
1526
1837
 
1527
1838
  interface IInitiator {
1528
- getChangeAddress(): SometimesPromise<string>;
1529
- getCollateral(): SometimesPromise<UTxO[]>;
1530
- getUtxos(): SometimesPromise<UTxO[]>;
1839
+ getChangeAddress(): Promise<string>;
1840
+ getCollateral(): Promise<UTxO[]>;
1841
+ getUtxos(): Promise<UTxO[]>;
1531
1842
  }
1532
- type SometimesPromise<T> = Promise<T> | T;
1533
1843
 
1534
1844
  interface IListener {
1535
1845
  onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
@@ -1539,16 +1849,228 @@ interface ISubmitter {
1539
1849
  submitTx(tx: string): Promise<string>;
1540
1850
  }
1541
1851
 
1852
+ /**
1853
+ * TxTester class for evaluating transactions
1854
+ */
1855
+ declare class TxTester {
1856
+ txBody: MeshTxBuilderBody;
1857
+ inputsEvaluating: TxIn[];
1858
+ outputsEvaluating: Output[];
1859
+ traces: string[];
1860
+ /**
1861
+ * Create a new TxTester instance
1862
+ * @param txBody The transaction builder body
1863
+ */
1864
+ constructor(txBody: MeshTxBuilderBody);
1865
+ /**
1866
+ * Add a trace to the TxTester
1867
+ * @param funcName The function name where the error occurred
1868
+ * @param message The error message
1869
+ */
1870
+ addTrace(funcName: string, message: string): void;
1871
+ /**
1872
+ * Check if the transaction evaluation was successful
1873
+ * @returns true if there are no errors, false otherwise
1874
+ */
1875
+ success(): boolean;
1876
+ /**
1877
+ * Get the error messages if any
1878
+ * @returns A string representation of the errors or "No errors" if there are none
1879
+ */
1880
+ errors(): string;
1881
+ /**
1882
+ * Checks if the transaction is valid after a specified timestamp.
1883
+ * @param requiredTimestamp The timestamp after which the transaction should be valid
1884
+ * @returns The TxTester instance for chaining
1885
+ */
1886
+ validAfter: (requiredTimestamp: number) => this;
1887
+ /**
1888
+ * Checks if the transaction is valid before a specified timestamp.
1889
+ * @param requiredTimestamp The timestamp before which the transaction should be valid
1890
+ * @returns The TxTester instance for chaining
1891
+ */
1892
+ validBefore: (requiredTimestamp: number) => this;
1893
+ /**
1894
+ * Checks if a specific key is signed in the transaction.
1895
+ * @param keyHash The key hash to check
1896
+ * @returns The TxTester instance for chaining
1897
+ */
1898
+ keySigned: (keyHash: string) => this;
1899
+ /**
1900
+ * Checks if any one of the specified keys is signed in the transaction.
1901
+ * @param keyHashes The array of key hashes to check
1902
+ * @returns The TxTester instance for chaining
1903
+ */
1904
+ oneOfKeysSigned: (keyHashes: string[]) => this;
1905
+ /**
1906
+ * Checks if all specified keys are signed in the transaction.
1907
+ * @param keyHashes The array of key hashes to check
1908
+ * @returns The TxTester instance for chaining
1909
+ */
1910
+ allKeysSigned: (keyHashes: string[]) => this;
1911
+ /**
1912
+ * Checks if a specific token is minted in the transaction.
1913
+ * @param policyId The policy ID of the token
1914
+ * @param assetName The asset name of the token
1915
+ * @param quantity The quantity of the token
1916
+ * @returns The TxTester instance for chaining
1917
+ */
1918
+ tokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1919
+ /**
1920
+ * Checks if a specific token is minted in the transaction and that it is the only mint.
1921
+ * @param policyId The policy ID of the token
1922
+ * @param assetName The asset name of the token
1923
+ * @param quantity The quantity of the token
1924
+ * @returns The TxTester instance for chaining
1925
+ */
1926
+ onlyTokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1927
+ /**
1928
+ * Checks if a specific token is minted in the transaction, ensuring that it is the only mint for the given policy ID.
1929
+ * @param policyId The policy ID of the token
1930
+ * @param assetName The asset name of the token
1931
+ * @param quantity The quantity of the token
1932
+ * @returns The TxTester instance for chaining
1933
+ */
1934
+ policyOnlyMintedToken: (policyId: string, assetName: string, quantity: number) => this;
1935
+ /**
1936
+ * Checks if a specific policy ID is burned in the transaction, ensuring that it is the only minting (i.e. burning item).
1937
+ * @param policyId The policy ID to check
1938
+ * @returns true if the policy is the only burn, false otherwise
1939
+ */
1940
+ checkPolicyOnlyBurn: (policyId: string) => boolean;
1941
+ /**
1942
+ * Not apply filter to inputs
1943
+ * @returns The TxTester instance for chaining
1944
+ */
1945
+ allInputs: () => this;
1946
+ /**
1947
+ * Filter inputs by address
1948
+ * @param address The address to filter by
1949
+ * @returns The TxTester instance for chaining
1950
+ */
1951
+ inputsAt: (address: string) => this;
1952
+ /**
1953
+ * Filter inputs by unit
1954
+ * @param unit The unit to filter by
1955
+ * @returns The TxTester instance for chaining
1956
+ */
1957
+ inputsWith: (unit: string) => this;
1958
+ /**
1959
+ * Filter inputs by policy ID
1960
+ * @param policyId The policy ID to filter by
1961
+ * @returns The TxTester instance for chaining
1962
+ */
1963
+ inputsWithPolicy: (policyId: string) => this;
1964
+ /**
1965
+ * Filter inputs by address and policy ID
1966
+ * @param address The address to filter by
1967
+ * @param policyId The policy ID to filter by
1968
+ * @returns The TxTester instance for chaining
1969
+ */
1970
+ inputsAtWithPolicy: (address: string, policyId: string) => this;
1971
+ /**
1972
+ * Filter inputs by address and unit
1973
+ * @param address The address to filter by
1974
+ * @param unit The unit to filter by
1975
+ * @returns The TxTester instance for chaining
1976
+ */
1977
+ inputsAtWith: (address: string, unit: string) => this;
1978
+ /**
1979
+ * Check if inputs contain the expected value.
1980
+ * *Reminder - It must be called after filtering methods for inputs*
1981
+ * @param expectedValue The expected value
1982
+ * @returns The TxTester instance for chaining
1983
+ */
1984
+ inputsValue: (expectedValue: any) => this;
1985
+ /**
1986
+ * Not apply filter to outputs
1987
+ * @returns The TxTester instance for chaining
1988
+ */
1989
+ allOutputs: () => this;
1990
+ /**
1991
+ * Filter outputs by address
1992
+ * @param address The address to filter by
1993
+ * @returns The TxTester instance for chaining
1994
+ */
1995
+ outputsAt: (address: string) => this;
1996
+ /**
1997
+ * Filter outputs by unit
1998
+ * @param unit The unit to filter by
1999
+ * @returns The TxTester instance for chaining
2000
+ */
2001
+ outputsWith: (unit: string) => this;
2002
+ /**
2003
+ * Filter outputs by policy ID
2004
+ * @param policyId The policy ID to filter by
2005
+ * @returns The TxTester instance for chaining
2006
+ */
2007
+ outputsWithPolicy: (policyId: string) => this;
2008
+ /**
2009
+ * Filter outputs by address and policy ID
2010
+ * @param address The address to filter by
2011
+ * @param policyId The policy ID to filter by
2012
+ * @returns The TxTester instance for chaining
2013
+ */
2014
+ outputsAtWithPolicy: (address: string, policyId: string) => this;
2015
+ /**
2016
+ * Filter outputs by address and unit
2017
+ * @param address The address to filter by
2018
+ * @param unit The unit to filter by
2019
+ * @returns The TxTester instance for chaining
2020
+ */
2021
+ outputsAtWith: (address: string, unit: string) => this;
2022
+ /**
2023
+ * Check if outputs contain the expected value.
2024
+ * *Reminder - It must be called after filtering methods for outputs*
2025
+ * @param expectedValue The expected value
2026
+ * @returns The TxTester instance for chaining
2027
+ */
2028
+ outputsValue: (expectedValue: MeshValue) => this;
2029
+ /**
2030
+ * Check if outputs contain a specific inline datum.
2031
+ * *Reminder - It must be called after filtering methods for outputs*
2032
+ * @param datumCbor The datum CBOR to check
2033
+ * @returns The TxTester instance for chaining
2034
+ */
2035
+ outputsInlineDatumExist: (datumCbor: string) => this;
2036
+ }
2037
+ /**
2038
+ * Internal logic to check if a key is signed
2039
+ * @param requiredSignatures The required signatures of the tx builder body
2040
+ * @param keyHash The key hash to check
2041
+ * @returns true if the key is signed, false otherwise
2042
+ */
2043
+ declare function keySignedLogic(requiredSignatures: string[], keyHash: string): boolean;
2044
+ /**
2045
+ * Internal logic to check if a token is minted
2046
+ * @param mints The mints info of the tx builder body
2047
+ * @param policyId The policy ID of the token
2048
+ * @param assetName The asset name of the token
2049
+ * @param quantity The quantity of the token
2050
+ * @returns true if the token is minted, false otherwise
2051
+ */
2052
+ declare function tokenMintedLogic(mints: MintParam[], policyId: string, assetName: string, quantity: number): boolean;
2053
+
1542
2054
  interface IMeshTxSerializer {
1543
- verbose: boolean;
1544
2055
  serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
2056
+ serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1545
2057
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1546
- resolver: IResolver;
1547
- deserializer: IDeserializer;
1548
2058
  serializeData(data: BuilderData): string;
1549
2059
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1550
2060
  serializePoolId(hash: string): string;
1551
2061
  serializeRewardAddress(stakeKeyHash: string, isScriptHash?: boolean, network_id?: 0 | 1): string;
2062
+ serializeOutput(output: Output): string;
2063
+ serializeValue(value: Asset[]): string;
2064
+ resolver: IResolver;
2065
+ deserializer: IDeserializer;
2066
+ parser: ITxParser;
2067
+ }
2068
+ interface ITxParser {
2069
+ getRequiredInputs(txHex: string): TxInput[];
2070
+ parse(txHex: string, resolvedUtxos?: UTxO[]): void;
2071
+ toTester(): TxTester;
2072
+ getBuilderBody(): MeshTxBuilderBody;
2073
+ getBuilderBodyWithoutChange(): MeshTxBuilderBody;
1552
2074
  }
1553
2075
  interface IResolver {
1554
2076
  keys: {
@@ -1561,7 +2083,7 @@ interface IResolver {
1561
2083
  resolveTxHash(txHex: string): string;
1562
2084
  };
1563
2085
  data: {
1564
- resolveDataHash(data: Data): string;
2086
+ resolveDataHash(rawData: BuilderData["content"], type?: PlutusDataType): string;
1565
2087
  };
1566
2088
  script: {
1567
2089
  resolveScriptRef(script: NativeScript | PlutusScript): string;
@@ -1582,12 +2104,12 @@ interface IDeserializer {
1582
2104
 
1583
2105
  interface ISigner {
1584
2106
  signData(payload: string, address?: string): Promise<DataSignature>;
1585
- signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
2107
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
1586
2108
  signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
1587
2109
  }
1588
2110
 
1589
2111
  interface IEvaluator {
1590
- evaluateTx(tx: string): Promise<Omit<Action, "data">[]>;
2112
+ evaluateTx(tx: string, additionalUtxos?: UTxO[], additionalTxs?: string[]): Promise<Omit<Action, "data">[]>;
1591
2113
  }
1592
2114
 
1593
2115
  interface IWallet extends IInitiator, ISigner, ISubmitter {
@@ -1647,4 +2169,36 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1647
2169
 
1648
2170
  declare function getFile(url: string): string;
1649
2171
 
1650
- 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, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
2172
+ declare const experimentalSelectUtxos: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity) => UTxO[];
2173
+
2174
+ declare const keepRelevant: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string) => UTxO[];
2175
+
2176
+ declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: Protocol) => UTxO[];
2177
+
2178
+ declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: Protocol) => UTxO[];
2179
+
2180
+ /**
2181
+ * All UTxO selection algorithms follows below's interface
2182
+ *
2183
+ * Supported algorithms:
2184
+ * - largestFirst - CIP2 suggested algorithm
2185
+ * - largestFirstMultiAsset - CIP2 suggested algorithm
2186
+ * - keepRelevant - CIP2 suggested algorithm
2187
+ * - experimental - The always evolving algorithm according to the latest research
2188
+ *
2189
+ * @param requestedOutputSet
2190
+ * @param initialUTxOSet
2191
+ * @returns
2192
+ */
2193
+ declare class UtxoSelection {
2194
+ private threshold;
2195
+ private includeTxFees;
2196
+ constructor(threshold?: string, includeTxFees?: boolean);
2197
+ largestFirst(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2198
+ keepRelevant(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2199
+ largestFirstMultiAsset(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2200
+ experimental(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2201
+ }
2202
+ type UtxoSelectionStrategy = keyof UtxoSelection;
2203
+
2204
+ export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, type BasicProposal, type BasicVote, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type CertificateType, type Committee, type CommitteeMember, type ConStr, type ConStr0, type ConStr1, type ConStr2, type ConStr3, type Constitution, type Credential$1 as 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 GovernanceAction, type GovernanceActionId, GovernanceActionKind, type GovernanceProposalInfo, HARDENED_KEY_START, type HardForkInitiationAction, 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 InfoAction, 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 NewConstitutionAction, type NoConfidenceAction, type NonFungibleAssetMetadata, type None, type Option, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type Pair, type Pairs, type ParameterChangeAction, type PlutusData, type PlutusDataType, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type ProofStep, type ProofStepBranch, type ProofStepFork, type ProofStepLeaf, type Proposal, type ProposalType, type Protocol, type ProtocolParamUpdate, type ProtocolVersion, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type PubKeyWithdrawal, type Quantity, type Rational, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RewardAddress, 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 ScriptMetadata, type ScriptProposal, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type ScriptVote, type ScriptWithdrawal, type SimpleScriptProposal, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SimpleScriptVote, type SimpleScriptWithdrawal, type SlotConfig, type Some, type Token, type TokenName, type TransactionInfo, type TreasuryWithdrawals, type TreasuryWithdrawalsAction, type Tuple, type TxIn, type TxInParameter, type TxInput, type TxMetadata, type TxOutRef, type TxOutput, TxTester, type UTxO, type Unit, type UpdateCommitteeAction, UtxoSelection, type UtxoSelectionStrategy, VOTING_PROPOSAL_DEPOSIT, 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 };