@meshsdk/common 1.9.0-beta.9 → 1.9.0-beta.91

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
  */
@@ -1326,6 +1273,12 @@ declare class MeshValue {
1326
1273
  * @returns The quantity of the asset
1327
1274
  */
1328
1275
  get: (unit: string) => bigint;
1276
+ /**
1277
+ * Get all assets that belong to a specific policy ID
1278
+ * @param policyId The policy ID to filter by
1279
+ * @returns Array of assets that match the policy ID
1280
+ */
1281
+ getPolicyAssets: (policyId: string) => Asset[];
1329
1282
  /**
1330
1283
  * Get all asset units
1331
1284
  * @returns The asset units
@@ -1357,6 +1310,19 @@ declare class MeshValue {
1357
1310
  * @returns boolean
1358
1311
  */
1359
1312
  leqUnit: (unit: string, other: MeshValue) => boolean;
1313
+ /**
1314
+ * Check if the value is equal to another value
1315
+ * @param other - The value to compare against
1316
+ * @returns boolean
1317
+ */
1318
+ eq: (other: MeshValue) => boolean;
1319
+ /**
1320
+ * Check if the specific unit of value is equal to that unit of another value
1321
+ * @param unit - The unit to compare
1322
+ * @param other - The value to compare against
1323
+ * @returns boolean
1324
+ */
1325
+ eqUnit: (unit: string, other: MeshValue) => boolean;
1360
1326
  /**
1361
1327
  * Check if the value is empty
1362
1328
  * @returns boolean
@@ -1386,6 +1352,348 @@ declare class MeshValue {
1386
1352
 
1387
1353
  type PlutusDataType = "Mesh" | "JSON" | "CBOR";
1388
1354
 
1355
+ type Credential = {
1356
+ type: "ScriptHash";
1357
+ scriptHash: string;
1358
+ } | {
1359
+ type: "KeyHash";
1360
+ keyHash: string;
1361
+ };
1362
+
1363
+ type GovernanceProposalInfo = {
1364
+ txHash: string;
1365
+ certIndex: number;
1366
+ governanceType: string;
1367
+ deposit: number;
1368
+ returnAddress: string;
1369
+ governanceDescription: string;
1370
+ ratifiedEpoch: number;
1371
+ enactedEpoch: number;
1372
+ droppedEpoch: number;
1373
+ expiredEpoch: number;
1374
+ expiration: number;
1375
+ metadata: object;
1376
+ };
1377
+ type Rational = {
1378
+ numerator: string;
1379
+ denominator: string;
1380
+ };
1381
+ type RewardAddress = string;
1382
+ type GovernanceActionId = {
1383
+ transactionId: string;
1384
+ govActionIndex: number;
1385
+ };
1386
+ type ProtocolVersion = {
1387
+ major: number;
1388
+ minor: number;
1389
+ };
1390
+ type ProtocolParamUpdate = {
1391
+ minFeeA?: string;
1392
+ minFeeB?: string;
1393
+ maxBlockBodySize?: number;
1394
+ maxTxSize?: number;
1395
+ maxBlockHeaderSize?: number;
1396
+ keyDeposit?: string;
1397
+ poolDeposit?: string;
1398
+ maxEpoch?: number;
1399
+ nOpt?: number;
1400
+ poolPledgeInfluence?: Rational;
1401
+ expansionRate?: Rational;
1402
+ treasuryGrowthRate?: Rational;
1403
+ minPoolCost?: string;
1404
+ adaPerUtxoByte?: string;
1405
+ costModels?: Record<string, number[]>;
1406
+ executionCosts?: {
1407
+ memPrice?: Rational;
1408
+ stepPrice?: Rational;
1409
+ };
1410
+ maxTxExUnits?: {
1411
+ mem: string;
1412
+ steps: string;
1413
+ };
1414
+ maxBlockExUnits?: {
1415
+ mem: string;
1416
+ steps: string;
1417
+ };
1418
+ maxValueSize?: number;
1419
+ collateralPercentage?: number;
1420
+ maxCollateralInputs?: number;
1421
+ poolVotingThresholds?: {
1422
+ motionNoConfidence?: Rational;
1423
+ committeeNormal?: Rational;
1424
+ committeeNoConfidence?: Rational;
1425
+ hardForkInitiation?: Rational;
1426
+ ppSecurityGroup?: Rational;
1427
+ };
1428
+ drepVotingThresholds?: {
1429
+ motionNoConfidence?: Rational;
1430
+ committeeNormal?: Rational;
1431
+ committeeNoConfidence?: Rational;
1432
+ updateConstitution?: Rational;
1433
+ hardForkInitiation?: Rational;
1434
+ ppNetworkGroup?: Rational;
1435
+ ppEconomicGroup?: Rational;
1436
+ ppTechnicalGroup?: Rational;
1437
+ ppGovGroup?: Rational;
1438
+ treasuryWithdrawal?: Rational;
1439
+ };
1440
+ minCommitteeSize?: number;
1441
+ committeeTermLimit?: number;
1442
+ govActionValidityPeriod?: number;
1443
+ govActionDeposit?: string;
1444
+ drepDeposit?: string;
1445
+ drepInactivityPeriod?: number;
1446
+ refScriptCostPerByte?: Rational;
1447
+ };
1448
+ type CommitteeMember = {
1449
+ stakeCredential: Credential;
1450
+ termLimit: number;
1451
+ };
1452
+ type Committee = {
1453
+ members: CommitteeMember[];
1454
+ quorumThreshold: Rational;
1455
+ };
1456
+ type Constitution = {
1457
+ anchor: Anchor;
1458
+ scriptHash?: ScriptHash;
1459
+ };
1460
+ type TreasuryWithdrawals = Record<RewardAddress, string>;
1461
+ type ParameterChangeAction = {
1462
+ govActionId?: GovernanceActionId;
1463
+ protocolParamUpdates: ProtocolParamUpdate;
1464
+ policyHash?: ScriptHash;
1465
+ };
1466
+ type HardForkInitiationAction = {
1467
+ govActionId?: GovernanceActionId;
1468
+ protocolVersion: ProtocolVersion;
1469
+ };
1470
+ type TreasuryWithdrawalsAction = {
1471
+ withdrawals: TreasuryWithdrawals;
1472
+ policyHash?: ScriptHash;
1473
+ };
1474
+ type NoConfidenceAction = {
1475
+ govActionId?: GovernanceActionId;
1476
+ };
1477
+ type UpdateCommitteeAction = {
1478
+ govActionId?: GovernanceActionId;
1479
+ committee: Committee;
1480
+ membersToRemove: Credential[];
1481
+ };
1482
+ type NewConstitutionAction = {
1483
+ govActionId?: GovernanceActionId;
1484
+ constitution: Constitution;
1485
+ };
1486
+ type InfoAction = {};
1487
+ declare enum GovernanceActionKind {
1488
+ ParameterChangeAction = "ParameterChangeAction",
1489
+ HardForkInitiationAction = "HardForkInitiationAction",
1490
+ TreasuryWithdrawalsAction = "TreasuryWithdrawalsAction",
1491
+ NoConfidenceAction = "NoConfidenceAction",
1492
+ UpdateCommitteeAction = "UpdateCommitteeAction",
1493
+ NewConstitutionAction = "NewConstitutionAction",
1494
+ InfoAction = "InfoAction"
1495
+ }
1496
+ type GovernanceAction = {
1497
+ kind: "ParameterChangeAction";
1498
+ action: ParameterChangeAction;
1499
+ } | {
1500
+ kind: "HardForkInitiationAction";
1501
+ action: HardForkInitiationAction;
1502
+ } | {
1503
+ kind: "TreasuryWithdrawalsAction";
1504
+ action: TreasuryWithdrawalsAction;
1505
+ } | {
1506
+ kind: "NoConfidenceAction";
1507
+ action: NoConfidenceAction;
1508
+ } | {
1509
+ kind: "UpdateCommitteeAction";
1510
+ action: UpdateCommitteeAction;
1511
+ } | {
1512
+ kind: "NewConstitutionAction";
1513
+ action: NewConstitutionAction;
1514
+ } | {
1515
+ kind: "InfoAction";
1516
+ action: InfoAction;
1517
+ };
1518
+
1519
+ type ProposalType = {
1520
+ governanceAction: GovernanceAction;
1521
+ anchor: Anchor;
1522
+ rewardAccount: RewardAddress;
1523
+ deposit: string;
1524
+ };
1525
+ type BasicProposal = {
1526
+ type: "BasicProposal";
1527
+ proposalType: ProposalType;
1528
+ };
1529
+ type ScriptProposal = {
1530
+ type: "ScriptProposal";
1531
+ proposalType: ProposalType;
1532
+ redeemer?: Redeemer;
1533
+ scriptSource?: ScriptSource;
1534
+ };
1535
+ type SimpleScriptProposal = {
1536
+ type: "SimpleScriptProposal";
1537
+ proposalType: ProposalType;
1538
+ simpleScriptSource?: SimpleScriptSourceInfo;
1539
+ };
1540
+ type Proposal = BasicProposal | ScriptProposal | SimpleScriptProposal;
1541
+
1542
+ type RefTxIn = {
1543
+ txHash: string;
1544
+ txIndex: number;
1545
+ scriptSize?: number;
1546
+ };
1547
+ type TxInParameter = {
1548
+ txHash: string;
1549
+ txIndex: number;
1550
+ amount?: Asset[];
1551
+ address?: string;
1552
+ scriptSize?: number;
1553
+ };
1554
+ type TxIn = PubKeyTxIn | SimpleScriptTxIn | ScriptTxIn;
1555
+ type PubKeyTxIn = {
1556
+ type: "PubKey";
1557
+ txIn: TxInParameter;
1558
+ };
1559
+ type SimpleScriptTxIn = {
1560
+ type: "SimpleScript";
1561
+ txIn: TxInParameter;
1562
+ simpleScriptTxIn: SimpleScriptTxInParameter;
1563
+ };
1564
+ type SimpleScriptTxInParameter = {
1565
+ scriptSource?: SimpleScriptSourceInfo;
1566
+ };
1567
+ type ScriptTxInParameter = {
1568
+ scriptSource?: ScriptSource;
1569
+ datumSource?: DatumSource;
1570
+ redeemer?: Redeemer;
1571
+ };
1572
+ type ScriptTxIn = {
1573
+ type: "Script";
1574
+ txIn: TxInParameter;
1575
+ scriptTxIn: ScriptTxInParameter;
1576
+ };
1577
+ declare const txInToUtxo: (txIn: TxInParameter) => UTxO;
1578
+
1579
+ type Vote = BasicVote | ScriptVote | SimpleScriptVote;
1580
+ type BasicVote = {
1581
+ type: "BasicVote";
1582
+ vote: VoteType;
1583
+ };
1584
+ type SimpleScriptVote = {
1585
+ type: "SimpleScriptVote";
1586
+ vote: VoteType;
1587
+ simpleScriptSource: SimpleScriptSourceInfo;
1588
+ };
1589
+ type ScriptVote = {
1590
+ type: "ScriptVote";
1591
+ vote: VoteType;
1592
+ redeemer?: Redeemer;
1593
+ scriptSource?: ScriptSource;
1594
+ };
1595
+ type VoteType = {
1596
+ voter: Voter;
1597
+ govActionId: RefTxIn;
1598
+ votingProcedure: VotingProcedure;
1599
+ };
1600
+ type Voter = {
1601
+ type: "ConstitutionalCommittee";
1602
+ hotCred: Credential;
1603
+ } | {
1604
+ type: "DRep";
1605
+ drepId: string;
1606
+ } | {
1607
+ type: "StakingPool";
1608
+ keyHash: string;
1609
+ };
1610
+ type VotingProcedure = {
1611
+ voteKind: VoteKind;
1612
+ anchor?: Anchor;
1613
+ };
1614
+ type VoteKind = "Yes" | "No" | "Abstain";
1615
+
1616
+ type Withdrawal = PubKeyWithdrawal | ScriptWithdrawal | SimpleScriptWithdrawal;
1617
+ type PubKeyWithdrawal = {
1618
+ type: "PubKeyWithdrawal";
1619
+ address: string;
1620
+ coin: string;
1621
+ };
1622
+ type ScriptWithdrawal = {
1623
+ type: "ScriptWithdrawal";
1624
+ address: string;
1625
+ coin: string;
1626
+ scriptSource?: ScriptSource;
1627
+ redeemer?: Redeemer;
1628
+ };
1629
+ type SimpleScriptWithdrawal = {
1630
+ type: "SimpleScriptWithdrawal";
1631
+ address: string;
1632
+ coin: string;
1633
+ scriptSource?: SimpleScriptSourceInfo;
1634
+ };
1635
+
1636
+ type MeshTxBuilderBody = {
1637
+ inputs: TxIn[];
1638
+ outputs: Output[];
1639
+ fee: Quantity;
1640
+ collaterals: PubKeyTxIn[];
1641
+ requiredSignatures: string[];
1642
+ referenceInputs: RefTxIn[];
1643
+ mints: MintParam[];
1644
+ changeAddress: string;
1645
+ metadata: TxMetadata;
1646
+ scriptMetadata: ScriptMetadata[];
1647
+ validityRange: ValidityRange;
1648
+ certificates: Certificate[];
1649
+ withdrawals: Withdrawal[];
1650
+ votes: Vote[];
1651
+ proposals: Proposal[];
1652
+ signingKey: string[];
1653
+ extraInputs: UTxO[];
1654
+ chainedTxs: string[];
1655
+ inputsForEvaluation: Record<string, UTxO>;
1656
+ network: Network | number[][];
1657
+ expectedNumberKeyWitnesses: number;
1658
+ expectedByronAddressWitnesses: string[];
1659
+ totalCollateral?: Quantity;
1660
+ collateralReturnAddress?: string;
1661
+ };
1662
+ declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
1663
+ declare function cloneTxBuilderBody(body: MeshTxBuilderBody): MeshTxBuilderBody;
1664
+ type ValidityRange = {
1665
+ invalidBefore?: number;
1666
+ invalidHereafter?: number;
1667
+ };
1668
+ type MetadatumMap = Map<Metadatum, Metadatum>;
1669
+ type Metadatum = bigint | number | string | Uint8Array | MetadatumMap | Metadatum[];
1670
+ type TxMetadata = Map<bigint, Metadatum>;
1671
+ type Metadata = {
1672
+ tag: string;
1673
+ metadata: string;
1674
+ };
1675
+ type ScriptMetadata = {
1676
+ scriptType: "PlutusV1" | "PlutusV2" | "PlutusV3" | "Native";
1677
+ scriptCbor: string;
1678
+ };
1679
+ type RequiredWith<T, K extends keyof T> = Required<T> & {
1680
+ [P in K]: Required<T[P]>;
1681
+ };
1682
+ declare const validityRangeToObj: (validityRange: ValidityRange) => object;
1683
+ declare const validityRangeFromObj: (obj: any) => ValidityRange;
1684
+
1685
+ type DeserializedAddress = {
1686
+ pubKeyHash: string;
1687
+ scriptHash: string;
1688
+ stakeCredentialHash: string;
1689
+ stakeScriptCredentialHash: string;
1690
+ };
1691
+
1692
+ type DeserializedScript = {
1693
+ scriptHash: string;
1694
+ scriptCbor?: string;
1695
+ };
1696
+
1389
1697
  interface IMintingBlueprint {
1390
1698
  version: LanguageVersion;
1391
1699
  cbor: string;
@@ -1412,28 +1720,13 @@ interface IWithdrawalBlueprint {
1412
1720
  cbor: string;
1413
1721
  hash: string;
1414
1722
  address: string;
1415
- isStakeScriptCredential: boolean;
1416
1723
  paramScript(compiledCode: string, params: string[], paramsType: PlutusDataType): this;
1417
1724
  noParamScript(compiledCode: string): this;
1418
1725
  }
1419
1726
 
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
1727
  declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
1436
1728
  declare const DREP_DEPOSIT = "500000000";
1729
+ declare const VOTING_PROPOSAL_DEPOSIT = "100000000000";
1437
1730
  declare const resolveTxFees: (txSize: number, minFeeA?: number, minFeeB?: number) => string;
1438
1731
 
1439
1732
  declare const SUPPORTED_WALLETS: string[];
@@ -1504,12 +1797,19 @@ declare const CIP68_100: (tokenNameHex: string) => string;
1504
1797
  */
1505
1798
  declare const CIP68_222: (tokenNameHex: string) => string;
1506
1799
 
1800
+ type IFetcherOptions = {
1801
+ maxPage?: number;
1802
+ order?: "asc" | "desc";
1803
+ [key: string]: any;
1804
+ };
1805
+ declare const DEFAULT_FETCHER_OPTIONS: IFetcherOptions;
1507
1806
  /**
1508
1807
  * Fetcher interface defines end points to query blockchain data.
1509
1808
  */
1510
1809
  interface IFetcher {
1511
1810
  fetchAccountInfo(address: string): Promise<AccountInfo>;
1512
1811
  fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
1812
+ fetchAddressTxs(address: string, options?: IFetcherOptions): Promise<TransactionInfo[]>;
1513
1813
  fetchAssetAddresses(asset: string): Promise<{
1514
1814
  address: string;
1515
1815
  quantity: string;
@@ -1541,16 +1841,228 @@ interface ISubmitter {
1541
1841
  submitTx(tx: string): Promise<string>;
1542
1842
  }
1543
1843
 
1844
+ /**
1845
+ * TxTester class for evaluating transactions
1846
+ */
1847
+ declare class TxTester {
1848
+ txBody: MeshTxBuilderBody;
1849
+ inputsEvaluating: TxIn[];
1850
+ outputsEvaluating: Output[];
1851
+ traces: string[];
1852
+ /**
1853
+ * Create a new TxTester instance
1854
+ * @param txBody The transaction builder body
1855
+ */
1856
+ constructor(txBody: MeshTxBuilderBody);
1857
+ /**
1858
+ * Add a trace to the TxTester
1859
+ * @param funcName The function name where the error occurred
1860
+ * @param message The error message
1861
+ */
1862
+ addTrace(funcName: string, message: string): void;
1863
+ /**
1864
+ * Check if the transaction evaluation was successful
1865
+ * @returns true if there are no errors, false otherwise
1866
+ */
1867
+ success(): boolean;
1868
+ /**
1869
+ * Get the error messages if any
1870
+ * @returns A string representation of the errors or "No errors" if there are none
1871
+ */
1872
+ errors(): string;
1873
+ /**
1874
+ * Checks if the transaction is valid after a specified timestamp.
1875
+ * @param requiredTimestamp The timestamp after which the transaction should be valid
1876
+ * @returns The TxTester instance for chaining
1877
+ */
1878
+ validAfter: (requiredTimestamp: number) => this;
1879
+ /**
1880
+ * Checks if the transaction is valid before a specified timestamp.
1881
+ * @param requiredTimestamp The timestamp before which the transaction should be valid
1882
+ * @returns The TxTester instance for chaining
1883
+ */
1884
+ validBefore: (requiredTimestamp: number) => this;
1885
+ /**
1886
+ * Checks if a specific key is signed in the transaction.
1887
+ * @param keyHash The key hash to check
1888
+ * @returns The TxTester instance for chaining
1889
+ */
1890
+ keySigned: (keyHash: string) => this;
1891
+ /**
1892
+ * Checks if any one of the specified keys is signed in the transaction.
1893
+ * @param keyHashes The array of key hashes to check
1894
+ * @returns The TxTester instance for chaining
1895
+ */
1896
+ oneOfKeysSigned: (keyHashes: string[]) => this;
1897
+ /**
1898
+ * Checks if all specified keys are signed in the transaction.
1899
+ * @param keyHashes The array of key hashes to check
1900
+ * @returns The TxTester instance for chaining
1901
+ */
1902
+ allKeysSigned: (keyHashes: string[]) => this;
1903
+ /**
1904
+ * Checks if a specific token is minted in the transaction.
1905
+ * @param policyId The policy ID of the token
1906
+ * @param assetName The asset name of the token
1907
+ * @param quantity The quantity of the token
1908
+ * @returns The TxTester instance for chaining
1909
+ */
1910
+ tokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1911
+ /**
1912
+ * Checks if a specific token is minted in the transaction and that it is the only mint.
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
+ onlyTokenMinted: (policyId: string, assetName: string, quantity: number) => this;
1919
+ /**
1920
+ * Checks if a specific token is minted in the transaction, ensuring that it is the only mint for the given policy ID.
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
+ policyOnlyMintedToken: (policyId: string, assetName: string, quantity: number) => this;
1927
+ /**
1928
+ * Checks if a specific policy ID is burned in the transaction, ensuring that it is the only minting (i.e. burning item).
1929
+ * @param policyId The policy ID to check
1930
+ * @returns true if the policy is the only burn, false otherwise
1931
+ */
1932
+ checkPolicyOnlyBurn: (policyId: string) => boolean;
1933
+ /**
1934
+ * Not apply filter to inputs
1935
+ * @returns The TxTester instance for chaining
1936
+ */
1937
+ allInputs: () => this;
1938
+ /**
1939
+ * Filter inputs by address
1940
+ * @param address The address to filter by
1941
+ * @returns The TxTester instance for chaining
1942
+ */
1943
+ inputsAt: (address: string) => this;
1944
+ /**
1945
+ * Filter inputs by unit
1946
+ * @param unit The unit to filter by
1947
+ * @returns The TxTester instance for chaining
1948
+ */
1949
+ inputsWith: (unit: string) => this;
1950
+ /**
1951
+ * Filter inputs by policy ID
1952
+ * @param policyId The policy ID to filter by
1953
+ * @returns The TxTester instance for chaining
1954
+ */
1955
+ inputsWithPolicy: (policyId: string) => this;
1956
+ /**
1957
+ * Filter inputs by address and policy ID
1958
+ * @param address The address to filter by
1959
+ * @param policyId The policy ID to filter by
1960
+ * @returns The TxTester instance for chaining
1961
+ */
1962
+ inputsAtWithPolicy: (address: string, policyId: string) => this;
1963
+ /**
1964
+ * Filter inputs by address and unit
1965
+ * @param address The address to filter by
1966
+ * @param unit The unit to filter by
1967
+ * @returns The TxTester instance for chaining
1968
+ */
1969
+ inputsAtWith: (address: string, unit: string) => this;
1970
+ /**
1971
+ * Check if inputs contain the expected value.
1972
+ * *Reminder - It must be called after filtering methods for inputs*
1973
+ * @param expectedValue The expected value
1974
+ * @returns The TxTester instance for chaining
1975
+ */
1976
+ inputsValue: (expectedValue: any) => this;
1977
+ /**
1978
+ * Not apply filter to outputs
1979
+ * @returns The TxTester instance for chaining
1980
+ */
1981
+ allOutputs: () => this;
1982
+ /**
1983
+ * Filter outputs by address
1984
+ * @param address The address to filter by
1985
+ * @returns The TxTester instance for chaining
1986
+ */
1987
+ outputsAt: (address: string) => this;
1988
+ /**
1989
+ * Filter outputs by unit
1990
+ * @param unit The unit to filter by
1991
+ * @returns The TxTester instance for chaining
1992
+ */
1993
+ outputsWith: (unit: string) => this;
1994
+ /**
1995
+ * Filter outputs by policy ID
1996
+ * @param policyId The policy ID to filter by
1997
+ * @returns The TxTester instance for chaining
1998
+ */
1999
+ outputsWithPolicy: (policyId: string) => this;
2000
+ /**
2001
+ * Filter outputs by address and policy ID
2002
+ * @param address The address to filter by
2003
+ * @param policyId The policy ID to filter by
2004
+ * @returns The TxTester instance for chaining
2005
+ */
2006
+ outputsAtWithPolicy: (address: string, policyId: string) => this;
2007
+ /**
2008
+ * Filter outputs by address and unit
2009
+ * @param address The address to filter by
2010
+ * @param unit The unit to filter by
2011
+ * @returns The TxTester instance for chaining
2012
+ */
2013
+ outputsAtWith: (address: string, unit: string) => this;
2014
+ /**
2015
+ * Check if outputs contain the expected value.
2016
+ * *Reminder - It must be called after filtering methods for outputs*
2017
+ * @param expectedValue The expected value
2018
+ * @returns The TxTester instance for chaining
2019
+ */
2020
+ outputsValue: (expectedValue: MeshValue) => this;
2021
+ /**
2022
+ * Check if outputs contain a specific inline datum.
2023
+ * *Reminder - It must be called after filtering methods for outputs*
2024
+ * @param datumCbor The datum CBOR to check
2025
+ * @returns The TxTester instance for chaining
2026
+ */
2027
+ outputsInlineDatumExist: (datumCbor: string) => this;
2028
+ }
2029
+ /**
2030
+ * Internal logic to check if a key is signed
2031
+ * @param requiredSignatures The required signatures of the tx builder body
2032
+ * @param keyHash The key hash to check
2033
+ * @returns true if the key is signed, false otherwise
2034
+ */
2035
+ declare function keySignedLogic(requiredSignatures: string[], keyHash: string): boolean;
2036
+ /**
2037
+ * Internal logic to check if a token is minted
2038
+ * @param mints The mints info of the tx builder body
2039
+ * @param policyId The policy ID of the token
2040
+ * @param assetName The asset name of the token
2041
+ * @param quantity The quantity of the token
2042
+ * @returns true if the token is minted, false otherwise
2043
+ */
2044
+ declare function tokenMintedLogic(mints: MintParam[], policyId: string, assetName: string, quantity: number): boolean;
2045
+
1544
2046
  interface IMeshTxSerializer {
1545
- verbose: boolean;
1546
- serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol, balanced: Boolean): string;
2047
+ serializeTxBody(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
2048
+ serializeTxBodyWithMockSignatures(txBuilderBody: MeshTxBuilderBody, protocolParams: Protocol): string;
1547
2049
  addSigningKeys(txHex: string, signingKeys: string[]): string;
1548
- resolver: IResolver;
1549
- deserializer: IDeserializer;
1550
2050
  serializeData(data: BuilderData): string;
1551
2051
  serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
1552
2052
  serializePoolId(hash: string): string;
1553
2053
  serializeRewardAddress(stakeKeyHash: string, isScriptHash?: boolean, network_id?: 0 | 1): string;
2054
+ serializeOutput(output: Output): string;
2055
+ serializeValue(value: Asset[]): string;
2056
+ resolver: IResolver;
2057
+ deserializer: IDeserializer;
2058
+ parser: ITxParser;
2059
+ }
2060
+ interface ITxParser {
2061
+ getRequiredInputs(txHex: string): TxInput[];
2062
+ parse(txHex: string, resolvedUtxos?: UTxO[]): void;
2063
+ toTester(): TxTester;
2064
+ getBuilderBody(): MeshTxBuilderBody;
2065
+ getBuilderBodyWithoutChange(): MeshTxBuilderBody;
1554
2066
  }
1555
2067
  interface IResolver {
1556
2068
  keys: {
@@ -1563,7 +2075,7 @@ interface IResolver {
1563
2075
  resolveTxHash(txHex: string): string;
1564
2076
  };
1565
2077
  data: {
1566
- resolveDataHash(data: Data): string;
2078
+ resolveDataHash(rawData: BuilderData["content"], type?: PlutusDataType): string;
1567
2079
  };
1568
2080
  script: {
1569
2081
  resolveScriptRef(script: NativeScript | PlutusScript): string;
@@ -1584,7 +2096,7 @@ interface IDeserializer {
1584
2096
 
1585
2097
  interface ISigner {
1586
2098
  signData(payload: string, address?: string): Promise<DataSignature>;
1587
- signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
2099
+ signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
1588
2100
  signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
1589
2101
  }
1590
2102
 
@@ -1649,4 +2161,36 @@ declare const hashDrepAnchor: (jsonLD: object) => string;
1649
2161
 
1650
2162
  declare function getFile(url: string): string;
1651
2163
 
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 };
2164
+ declare const experimentalSelectUtxos: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity) => UTxO[];
2165
+
2166
+ declare const keepRelevant: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string) => UTxO[];
2167
+
2168
+ declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: Protocol) => UTxO[];
2169
+
2170
+ declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: Protocol) => UTxO[];
2171
+
2172
+ /**
2173
+ * All UTxO selection algorithms follows below's interface
2174
+ *
2175
+ * Supported algorithms:
2176
+ * - largestFirst - CIP2 suggested algorithm
2177
+ * - largestFirstMultiAsset - CIP2 suggested algorithm
2178
+ * - keepRelevant - CIP2 suggested algorithm
2179
+ * - experimental - The always evolving algorithm according to the latest research
2180
+ *
2181
+ * @param requestedOutputSet
2182
+ * @param initialUTxOSet
2183
+ * @returns
2184
+ */
2185
+ declare class UtxoSelection {
2186
+ private threshold;
2187
+ private includeTxFees;
2188
+ constructor(threshold?: string, includeTxFees?: boolean);
2189
+ largestFirst(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2190
+ keepRelevant(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2191
+ largestFirstMultiAsset(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2192
+ experimental(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
2193
+ }
2194
+ type UtxoSelectionStrategy = keyof UtxoSelection;
2195
+
2196
+ 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 };