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

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 = {
@@ -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,162 +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
- declare const txInToUtxo: (txIn: TxInParameter) => UTxO;
474
-
475
- type Credential = {
476
- type: "ScriptHash";
477
- scriptHash: string;
478
- } | {
479
- type: "KeyHash";
480
- keyHash: string;
481
- };
482
-
483
- type Vote = BasicVote | ScriptVote | SimpleScriptVote;
484
- type BasicVote = {
485
- type: "BasicVote";
486
- vote: VoteType;
487
- };
488
- type SimpleScriptVote = {
489
- type: "SimpleScriptVote";
490
- vote: VoteType;
491
- simpleScriptSource: SimpleScriptSourceInfo;
492
- };
493
- type ScriptVote = {
494
- type: "ScriptVote";
495
- vote: VoteType;
496
- redeemer?: Redeemer;
497
- scriptSource?: ScriptSource;
498
- };
499
- type VoteType = {
500
- voter: Voter;
501
- govActionId: RefTxIn;
502
- votingProcedure: VotingProcedure;
503
- };
504
- type Voter = {
505
- type: "ConstitutionalCommittee";
506
- hotCred: Credential;
507
- } | {
508
- type: "DRep";
509
- drepId: string;
510
- } | {
511
- type: "StakingPool";
512
- keyHash: string;
513
- };
514
- type VotingProcedure = {
515
- voteKind: VoteKind;
516
- anchor?: Anchor;
517
- };
518
- type VoteKind = "Yes" | "No" | "Abstain";
519
-
520
- type Withdrawal = PubKeyWithdrawal | ScriptWithdrawal | SimpleScriptWithdrawal;
521
- type PubKeyWithdrawal = {
522
- type: "PubKeyWithdrawal";
523
- address: string;
524
- coin: string;
525
- };
526
- type ScriptWithdrawal = {
527
- type: "ScriptWithdrawal";
528
- address: string;
529
- coin: string;
530
- scriptSource?: ScriptSource;
531
- redeemer?: Redeemer;
532
- };
533
- type SimpleScriptWithdrawal = {
534
- type: "SimpleScriptWithdrawal";
535
- address: string;
536
- coin: string;
537
- scriptSource?: SimpleScriptSourceInfo;
538
- };
539
-
540
- type MeshTxBuilderBody = {
541
- inputs: TxIn[];
542
- outputs: Output[];
543
- collaterals: PubKeyTxIn[];
544
- requiredSignatures: string[];
545
- referenceInputs: RefTxIn[];
546
- mints: MintItem[];
547
- changeAddress: string;
548
- metadata: TxMetadata;
549
- validityRange: ValidityRange;
550
- certificates: Certificate[];
551
- withdrawals: Withdrawal[];
552
- votes: Vote[];
553
- signingKey: string[];
554
- extraInputs: UTxO[];
555
- selectionConfig: {
556
- threshold: string;
557
- strategy: UtxoSelectionStrategy;
558
- includeTxFees: boolean;
559
- };
560
- chainedTxs: string[];
561
- inputsForEvaluation: Record<string, UTxO>;
562
- fee?: string;
563
- network: Network | number[][];
564
- };
565
- declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
566
- type ValidityRange = {
567
- invalidBefore?: number;
568
- invalidHereafter?: number;
569
- };
570
- type MetadatumMap = Map<Metadatum, Metadatum>;
571
- type Metadatum = bigint | number | string | Uint8Array | MetadatumMap | Metadatum[];
572
- type TxMetadata = Map<bigint, Metadatum>;
573
- type Metadata = {
574
- tag: string;
575
- metadata: string;
576
- };
577
- type RequiredWith<T, K extends keyof T> = Required<T> & {
578
- [P in K]: Required<T[P]>;
579
- };
580
- declare const validityRangeToObj: (validityRange: ValidityRange) => object;
581
-
582
- type DeserializedAddress = {
583
- pubKeyHash: string;
584
- scriptHash: string;
585
- stakeCredentialHash: string;
586
- stakeScriptCredentialHash: string;
587
- };
588
-
589
- type DeserializedScript = {
590
- scriptHash: string;
591
- scriptCbor?: string;
592
- };
593
-
594
426
  /**
595
427
  * The Mesh Data constructor object, representing custom data type
596
428
  */
@@ -665,7 +497,7 @@ type MTxOutRef = MConStr0<[MConStr0<[string]>, number]>;
665
497
  * Aiken alias
666
498
  * The Mesh Data tuple
667
499
  */
668
- type MTuple<K, V> = [K, V];
500
+ type MTuple<T extends any> = T[];
669
501
  /**
670
502
  * Aiken alias
671
503
  * The Mesh Data Option type
@@ -704,11 +536,10 @@ declare const mOutputReference: (txHash: string, index: number) => MOutputRefere
704
536
  declare const mTxOutRef: (txHash: string, index: number) => MTxOutRef;
705
537
  /**
706
538
  * 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
539
+ * @param args The arguments of the tuple
709
540
  * @returns The Mesh Data tuple object
710
541
  */
711
- declare const mTuple: <K, V>(key: K, value: V) => MTuple<K, V>;
542
+ declare const mTuple: <T extends any[]>(...args: T) => MTuple<T>;
712
543
  /**
713
544
  * The utility function to create a Mesh Data Option type in Mesh Data type
714
545
  * @param value The value of the option
@@ -727,18 +558,42 @@ declare const mSome: <T extends Data>(value: T) => MSome<T>;
727
558
  */
728
559
  declare const mNone: () => MNone;
729
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]>;
730
569
  /**
731
570
  * The Mesh Data staking credential
732
571
  */
733
- type MMaybeStakingHash = MConStr1<[]> | MConStr0<[MConStr0<[MConStr0<[string]>]>]> | MConStr0<[MConStr0<[MConStr1<[string]>]>]>;
572
+ type MMaybeStakingHash = MConStr1<[]> | MConStr0<[MConStr0<[MVerificationKey]>]> | MConStr0<[MConStr0<[MScript]>]>;
734
573
  /**
735
574
  * The Mesh Data public key address
736
575
  */
737
- type MPubKeyAddress = MConStr0<[MConStr0<[string]>, MMaybeStakingHash]>;
576
+ type MPubKeyAddress = MConStr0<[MVerificationKey, MMaybeStakingHash]>;
738
577
  /**
739
578
  * The Mesh Data script address
740
579
  */
741
- 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;
742
597
  /**
743
598
  * The utility function to create a Mesh Data staking hash
744
599
  * @param stakeCredential The staking credential in hex
@@ -762,6 +617,13 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isStakeS
762
617
  * @returns The Mesh Data script address object
763
618
  */
764
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;
765
627
 
766
628
  /**
767
629
  * The Mesh Data boolean
@@ -878,11 +740,27 @@ type AssocMapItem<K, V> = {
878
740
  v: V;
879
741
  };
880
742
  /**
743
+ * PlutusTx alias
881
744
  * The Plutus Data association map in JSON
882
745
  */
883
746
  type AssocMap<K = any, V = any> = {
884
747
  map: AssocMapItem<K, V>[];
885
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
+ };
886
764
  /**
887
765
  * The utility function to create a Plutus Data boolean in JSON
888
766
  * @param b boolean value
@@ -933,6 +811,13 @@ declare const plutusBSArrayToString: (bsArray: List<ByteString>) => string;
933
811
  * @returns The Plutus Data association map object
934
812
  */
935
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>;
936
821
 
937
822
  /**
938
823
  * All the type aliases here represent the type name used in smart contracts from PlutusTx or Aiken.
@@ -1006,8 +891,8 @@ type Dict<V> = {
1006
891
  * Aiken alias
1007
892
  * The Plutus Data tuple in JSON
1008
893
  */
1009
- type Tuple<K, V> = {
1010
- list: [K, V];
894
+ type Tuple<T extends any[]> = {
895
+ list: T;
1011
896
  };
1012
897
  /**
1013
898
  * Aiken alias
@@ -1041,7 +926,7 @@ declare const scriptHash: (bytes: string) => ScriptHash;
1041
926
  * @param bytes The script hash in hex
1042
927
  * @returns The Plutus Data script hash object
1043
928
  */
1044
- declare const pubKeyHash: (bytes: string) => ScriptHash;
929
+ declare const pubKeyHash: (bytes: string) => PubKeyHash;
1045
930
  /**
1046
931
  * The utility function to create a Plutus Data policy id in JSON
1047
932
  * @param bytes The policy id in hex
@@ -1103,11 +988,10 @@ declare const posixTime: (int: number) => POSIXTime;
1103
988
  declare const dict: <V>(itemsMap: [ByteString, V][]) => Dict<V>;
1104
989
  /**
1105
990
  * 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
991
+ * @param args The arguments of the tuple
1108
992
  * @returns The Plutus Data tuple object
1109
993
  */
1110
- 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>;
1111
995
  /**
1112
996
  * The utility function to create a Plutus Data Option in JSON
1113
997
  * @param value The optional value of the option
@@ -1126,18 +1010,42 @@ declare const some: <T>(value: T) => Some<T>;
1126
1010
  */
1127
1011
  declare const none: () => None;
1128
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]>;
1129
1021
  /**
1130
1022
  * The Plutus Data staking credential in JSON
1131
1023
  */
1132
- type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[ConStr0<[PubKeyHash]>]>]> | ConStr0<[ConStr0<[ConStr1<[ScriptHash]>]>]>;
1024
+ type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[VerificationKey]>]> | ConStr0<[ConStr0<[Script]>]>;
1133
1025
  /**
1134
1026
  * The Plutus Data public key address in JSON
1135
1027
  */
1136
- type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
1028
+ type PubKeyAddress = ConStr0<[VerificationKey, MaybeStakingHash]>;
1137
1029
  /**
1138
1030
  * The Plutus Data script address in JSON
1139
1031
  */
1140
- 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;
1141
1049
  /**
1142
1050
  * The utility function to create a Plutus Data staking hash in JSON
1143
1051
  * @param stakeCredential The staking credential in hex
@@ -1161,8 +1069,41 @@ declare const pubKeyAddress: (bytes: string, stakeCredential?: string, isStakeSc
1161
1069
  * @returns The Plutus Data script address object
1162
1070
  */
1163
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;
1164
1079
 
1165
- type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
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[];
1105
+
1106
+ type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | Pairs | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any>;
1166
1107
 
1167
1108
  /**
1168
1109
  * Converting bytes to hex string
@@ -1183,7 +1124,13 @@ declare const hexToBytes: (hex: string) => Buffer;
1183
1124
  */
1184
1125
  declare const stringToHex: (str: string) => string;
1185
1126
  /**
1186
- * Converting hex string to utf8 string
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;
1132
+ /**
1133
+ * Converting hex string to utf8 string
1187
1134
  * @param hex The hex string to be converted
1188
1135
  * @returns The utf8 string
1189
1136
  */
@@ -1284,6 +1231,12 @@ declare const mValue: (assets: Asset[]) => MValue;
1284
1231
  declare class MeshValue {
1285
1232
  value: Record<string, bigint>;
1286
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;
1287
1240
  /**
1288
1241
  * Converting assets into MeshValue
1289
1242
  * @param assets The assets to convert
@@ -1326,6 +1279,12 @@ declare class MeshValue {
1326
1279
  * @returns The quantity of the asset
1327
1280
  */
1328
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[];
1329
1288
  /**
1330
1289
  * Get all asset units
1331
1290
  * @returns The asset units
@@ -1357,6 +1316,19 @@ declare class MeshValue {
1357
1316
  * @returns boolean
1358
1317
  */
1359
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;
1360
1332
  /**
1361
1333
  * Check if the value is empty
1362
1334
  * @returns boolean
@@ -1375,10 +1347,12 @@ declare class MeshValue {
1375
1347
  toAssets: () => Asset[];
1376
1348
  /**
1377
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
1378
1351
  */
1379
1352
  toData: () => MValue;
1380
1353
  /**
1381
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
1382
1356
  * @returns Cardano data Value in JSON
1383
1357
  */
1384
1358
  toJSON: () => Value;
@@ -1386,6 +1360,348 @@ declare class MeshValue {
1386
1360
 
1387
1361
  type PlutusDataType = "Mesh" | "JSON" | "CBOR";
1388
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
+
1389
1705
  interface IMintingBlueprint {
1390
1706
  version: LanguageVersion;
1391
1707
  cbor: string;
@@ -1412,28 +1728,13 @@ interface IWithdrawalBlueprint {
1412
1728
  cbor: string;
1413
1729
  hash: string;
1414
1730
  address: string;
1415
- isStakeScriptCredential: boolean;
1416
1731
  paramScript(compiledCode: string, params: string[], paramsType: PlutusDataType): this;
1417
1732
  noParamScript(compiledCode: string): this;
1418
1733
  }
1419
1734
 
1420
- type GovernanceProposalInfo = {
1421
- txHash: string;
1422
- certIndex: number;
1423
- governanceType: string;
1424
- deposit: number;
1425
- returnAddress: string;
1426
- governanceDescription: string;
1427
- ratifiedEpoch: number;
1428
- enactedEpoch: number;
1429
- droppedEpoch: number;
1430
- expiredEpoch: number;
1431
- expiration: number;
1432
- metadata: object;
1433
- };
1434
-
1435
1735
  declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
1436
1736
  declare const DREP_DEPOSIT = "500000000";
1737
+ declare const VOTING_PROPOSAL_DEPOSIT = "100000000000";
1437
1738
  declare const resolveTxFees: (txSize: number, minFeeA?: number, minFeeB?: number) => string;
1438
1739
 
1439
1740
  declare const SUPPORTED_WALLETS: string[];
@@ -1504,12 +1805,19 @@ declare const CIP68_100: (tokenNameHex: string) => string;
1504
1805
  */
1505
1806
  declare const CIP68_222: (tokenNameHex: string) => string;
1506
1807
 
1808
+ type IFetcherOptions = {
1809
+ maxPage?: number;
1810
+ order?: "asc" | "desc";
1811
+ [key: string]: any;
1812
+ };
1813
+ declare const DEFAULT_FETCHER_OPTIONS: IFetcherOptions;
1507
1814
  /**
1508
1815
  * Fetcher interface defines end points to query blockchain data.
1509
1816
  */
1510
1817
  interface IFetcher {
1511
1818
  fetchAccountInfo(address: string): Promise<AccountInfo>;
1512
1819
  fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
1820
+ fetchAddressTxs(address: string, options?: IFetcherOptions): Promise<TransactionInfo[]>;
1513
1821
  fetchAssetAddresses(asset: string): Promise<{
1514
1822
  address: string;
1515
1823
  quantity: string;
@@ -1541,16 +1849,228 @@ interface ISubmitter {
1541
1849
  submitTx(tx: string): Promise<string>;
1542
1850
  }
1543
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
+
1544
2054
  interface IMeshTxSerializer {
1545
- verbose: boolean;
1546
- serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol, balanced: Boolean): string;
2055
+ serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
2056
+ serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1547
2057
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1548
- resolver: IResolver;
1549
- deserializer: IDeserializer;
1550
2058
  serializeData(data: BuilderData): string;
1551
2059
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1552
2060
  serializePoolId(hash: string): string;
1553
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;
1554
2074
  }
1555
2075
  interface IResolver {
1556
2076
  keys: {
@@ -1563,7 +2083,7 @@ interface IResolver {
1563
2083
  resolveTxHash(txHex: string): string;
1564
2084
  };
1565
2085
  data: {
1566
- resolveDataHash(data: Data): string;
2086
+ resolveDataHash(rawData: BuilderData["content"], type?: PlutusDataType): string;
1567
2087
  };
1568
2088
  script: {
1569
2089
  resolveScriptRef(script: NativeScript | PlutusScript): string;
@@ -1584,7 +2104,7 @@ interface IDeserializer {
1584
2104
 
1585
2105
  interface ISigner {
1586
2106
  signData(payload: string, address?: string): Promise<DataSignature>;
1587
- signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
2107
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
1588
2108
  signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
1589
2109
  }
1590
2110
 
@@ -1649,4 +2169,36 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1649
2169
 
1650
2170
  declare function getFile(url: string): string;
1651
2171
 
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 };
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 };