@meshsdk/transaction 1.5.28

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/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # mesh-transaction
2
+
3
+ Transactions - [meshjs.dev/apis/transaction](https://meshjs.dev/apis/transaction)
4
+
5
+ [meshjs.dev](https://meshjs.dev/)
@@ -0,0 +1,594 @@
1
+ import * as _meshsdk_common from '@meshsdk/common';
2
+ import { Protocol, MintItem, TxIn, Withdrawal, PubKeyTxIn, RefTxIn, MeshTxBuilderBody, Asset, BuilderData, LanguageVersion, PoolParams, UTxO, Redeemer, Action, IFetcher, ISubmitter, IEvaluator, IMeshTxSerializer, NativeScript, IInitiator, Recipient, Token, PlutusScript, Budget, Data, Mint, Unit, Quantity } from '@meshsdk/common';
3
+
4
+ declare class MeshTxBuilderCore {
5
+ txEvaluationMultiplier: number;
6
+ private txOutput?;
7
+ private addingPlutusScriptInput;
8
+ private plutusSpendingScriptVersion;
9
+ private addingPlutusMint;
10
+ private plutusMintingScriptVersion;
11
+ private addingPlutusWithdrawal;
12
+ private plutusWithdrawalScriptVersion;
13
+ protected _protocolParams: Protocol;
14
+ protected mintItem?: MintItem;
15
+ protected txInQueueItem?: TxIn;
16
+ protected withdrawalItem?: Withdrawal;
17
+ protected collateralQueueItem?: PubKeyTxIn;
18
+ protected refScriptTxInQueueItem?: RefTxIn;
19
+ meshTxBuilderBody: MeshTxBuilderBody;
20
+ constructor();
21
+ /**
22
+ * Set the input for transaction
23
+ * @param txHash The transaction hash of the input UTxO
24
+ * @param txIndex The transaction index of the input UTxO
25
+ * @param amount The asset amount of index of the input UTxO
26
+ * @param address The address of the input UTxO
27
+ * @returns The MeshTxBuilder instance
28
+ */
29
+ txIn: (txHash: string, txIndex: number, amount?: Asset[], address?: string) => this;
30
+ /**
31
+ * Set the script for transaction input
32
+ * @param {string} scriptCbor The CborHex of the script
33
+ * @param version Optional - The Plutus script version
34
+ * @returns The MeshTxBuilder instance
35
+ */
36
+ txInScript: (scriptCbor: string) => this;
37
+ /**
38
+ * Set the input datum for transaction input
39
+ * @param datum The datum in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
40
+ * @param type The datum type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
41
+ * @returns The MeshTxBuilder instance
42
+ */
43
+ txInDatumValue: (datum: BuilderData["content"], type?: BuilderData["type"]) => this;
44
+ /**
45
+ * Tell the transaction builder that the input UTxO has inlined datum
46
+ * @returns The MeshTxBuilder instance
47
+ */
48
+ txInInlineDatumPresent: () => this;
49
+ /**
50
+ * Set the redeemer for the reference input to be spent in same transaction
51
+ * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
52
+ * @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
53
+ * @param exUnits The execution units budget for the redeemer
54
+ * @returns The MeshTxBuilder instance
55
+ */
56
+ txInRedeemerValue: (redeemer: BuilderData["content"], type?: BuilderData["type"], exUnits?: {
57
+ mem: number;
58
+ steps: number;
59
+ }) => this;
60
+ /**
61
+ * Set the output for transaction
62
+ * @param {string} address The recipient of the output
63
+ * @param {Asset[]} amount The amount of other native assets attached with UTxO
64
+ * @returns The MeshTxBuilder instance
65
+ */
66
+ txOut: (address: string, amount: Asset[]) => this;
67
+ /**
68
+ * Set the output datum hash for transaction
69
+ * @param datum The datum in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
70
+ * @param type The datum type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
71
+ * @returns The MeshTxBuilder instance
72
+ */
73
+ txOutDatumHashValue: (datum: BuilderData["content"], type?: BuilderData["type"]) => this;
74
+ /**
75
+ * Set the output inline datum for transaction
76
+ * @param datum The datum in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
77
+ * @param type The datum type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
78
+ * @returns The MeshTxBuilder instance
79
+ */
80
+ txOutInlineDatumValue: (datum: BuilderData["content"], type?: BuilderData["type"]) => this;
81
+ /**
82
+ * Set the reference script to be attached with the output
83
+ * @param scriptCbor The CBOR hex of the script to be attached to UTxO as reference script
84
+ * @param version Optional - The Plutus script version
85
+ * @returns The MeshTxBuilder instance
86
+ */
87
+ txOutReferenceScript: (scriptCbor: string, version?: LanguageVersion) => this;
88
+ /**
89
+ * Set the instruction that it is currently using V1 Plutus spending scripts
90
+ * @returns The MeshTxBuilder instance
91
+ */
92
+ spendingPlutusScriptV1: () => this;
93
+ /**
94
+ * Set the instruction that it is currently using V2 Plutus spending scripts
95
+ * @returns The MeshTxBuilder instance
96
+ */
97
+ spendingPlutusScriptV2: () => this;
98
+ /**
99
+ * Set the instruction that it is currently using V3 Plutus spending scripts
100
+ * @returns The MeshTxBuilder instance
101
+ */
102
+ spendingPlutusScriptV3: () => this;
103
+ /**
104
+ * Set the reference input where it would also be spent in the transaction
105
+ * @param txHash The transaction hash of the reference UTxO
106
+ * @param txIndex The transaction index of the reference UTxO
107
+ * @param spendingScriptHash The script hash of the spending script
108
+ * @returns The MeshTxBuilder instance
109
+ */
110
+ spendingTxInReference: (txHash: string, txIndex: number, spendingScriptHash?: string) => this;
111
+ /**
112
+ * [Alias of txInInlineDatumPresent] Set the instruction that the reference input has inline datum
113
+ * @returns The MeshTxBuilder instance
114
+ */
115
+ spendingReferenceTxInInlineDatumPresent: () => this;
116
+ /**
117
+ * [Alias of txInRedeemerValue] Set the redeemer for the reference input to be spent in same transaction
118
+ * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
119
+ * @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
120
+ * @param exUnits The execution units budget for the redeemer
121
+ * @returns The MeshTxBuilder instance
122
+ */
123
+ spendingReferenceTxInRedeemerValue: (redeemer: BuilderData["content"], type?: BuilderData["type"], exUnits?: {
124
+ mem: number;
125
+ steps: number;
126
+ }) => this;
127
+ /**
128
+ * Specify a read only reference input. This reference input is not witnessing anything it is simply provided in the plutus script context.
129
+ * @param txHash The transaction hash of the reference UTxO
130
+ * @param txIndex The transaction index of the reference UTxO
131
+ * @returns The MeshTxBuilder instance
132
+ */
133
+ readOnlyTxInReference: (txHash: string, txIndex: number) => this;
134
+ /**
135
+ * Set the instruction that it is currently using V1 Plutus minting scripts
136
+ * @returns The MeshTxBuilder instance
137
+ */
138
+ mintPlutusScriptV1: () => this;
139
+ /**
140
+ * Set the instruction that it is currently using V2 Plutus minting scripts
141
+ * @returns The MeshTxBuilder instance
142
+ */
143
+ mintPlutusScriptV2: () => this;
144
+ /**
145
+ * Set the instruction that it is currently using V3 Plutus minting scripts
146
+ * @returns The MeshTxBuilder instance
147
+ */
148
+ mintPlutusScriptV3: () => this;
149
+ /**
150
+ * Set the minting value of transaction
151
+ * @param quantity The quantity of asset to be minted
152
+ * @param policy The policy id of the asset to be minted
153
+ * @param name The hex of token name of the asset to be minted
154
+ * @returns The MeshTxBuilder instance
155
+ */
156
+ mint: (quantity: string, policy: string, name: string) => this;
157
+ /**
158
+ * Set the minting script of current mint
159
+ * @param scriptCBOR The CBOR hex of the minting policy script
160
+ * @param version Optional - The Plutus script version
161
+ * @returns The MeshTxBuilder instance
162
+ */
163
+ mintingScript: (scriptCBOR: string) => this;
164
+ /**
165
+ * Use reference script for minting
166
+ * @param txHash The transaction hash of the UTxO
167
+ * @param txIndex The transaction index of the UTxO
168
+ * @returns The MeshTxBuilder instance
169
+ */
170
+ mintTxInReference: (txHash: string, txIndex: number) => this;
171
+ /**
172
+ * Set the redeemer for minting
173
+ * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
174
+ * @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
175
+ * @param exUnits The execution units budget for the redeemer
176
+ * @returns The MeshTxBuilder instance
177
+ */
178
+ mintReferenceTxInRedeemerValue: (redeemer: BuilderData["content"], type?: BuilderData["type"], exUnits?: {
179
+ mem: number;
180
+ steps: number;
181
+ }) => this;
182
+ /**
183
+ * Set the redeemer for the reference input to be spent in same transaction
184
+ * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
185
+ * @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
186
+ * @param exUnits The execution units budget for the redeemer
187
+ * @returns The MeshTxBuilder instance
188
+ */
189
+ mintRedeemerValue: (redeemer: BuilderData["content"], type?: BuilderData["type"], exUnits?: {
190
+ mem: number;
191
+ steps: number;
192
+ }) => this;
193
+ /**
194
+ * Set the required signer of the transaction
195
+ * @param pubKeyHash The PubKeyHash of the required signer
196
+ * @returns The MeshTxBuilder instance
197
+ */
198
+ requiredSignerHash: (pubKeyHash: string) => this;
199
+ /**
200
+ * Set the collateral UTxO for the transaction
201
+ * @param txHash The transaction hash of the collateral UTxO
202
+ * @param txIndex The transaction index of the collateral UTxO
203
+ * @param amount The asset amount of index of the collateral UTxO
204
+ * @param address The address of the collateral UTxO
205
+ * @returns The MeshTxBuilder instance
206
+ */
207
+ txInCollateral: (txHash: string, txIndex: number, amount?: Asset[], address?: string) => this;
208
+ /**
209
+ * Set the instruction that it is currently using V1 Plutus withdrawal scripts
210
+ * @returns The MeshTxBuilder instance
211
+ */
212
+ withdrawalPlutusScriptV1: () => this;
213
+ /**
214
+ * Set the instruction that it is currently using V2 Plutus withdrawal scripts
215
+ * @returns The MeshTxBuilder instance
216
+ */
217
+ withdrawalPlutusScriptV2: () => this;
218
+ /**
219
+ * Set the instruction that it is currently using V3 Plutus withdrawal scripts
220
+ * @returns The MeshTxBuilder instance
221
+ */
222
+ withdrawalPlutusScriptV3: () => this;
223
+ /**
224
+ * Withdraw stake rewards in the MeshTxBuilder instance
225
+ * @param stakeAddress The address corresponding to the stake key
226
+ * @param coin The amount of lovelaces in the withdrawal
227
+ * @returns The MeshTxBuilder instance
228
+ */
229
+ withdrawal: (stakeAddress: string, coin: string) => this;
230
+ /**
231
+ * Add a withdrawal script to the MeshTxBuilder instance
232
+ * @param scriptCbor The script in CBOR format
233
+ * @param version The language version
234
+ * @returns The MeshTxBuilder instance
235
+ */
236
+ withdrawalScript: (scriptCbor: string, version: LanguageVersion) => this;
237
+ /**
238
+ * Add a withdrawal reference to the MeshTxBuilder instance
239
+ * @param txHash The transaction hash of reference UTxO
240
+ * @param txIndex The transaction index of reference UTxO
241
+ * @param withdrawalScriptHash The script hash of the withdrawal script
242
+ * @param scriptSize The script size of the withdrawal script
243
+ * @returns The MeshTxBuilder instance
244
+ */
245
+ withdrawalTxInReference: (txHash: string, txIndex: number, withdrawalScriptHash?: string, scriptSize?: string) => void;
246
+ /**
247
+ * Set the transaction withdrawal redeemer value in the MeshTxBuilder instance
248
+ * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
249
+ * @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
250
+ * @param exUnits The execution units budget for the redeemer
251
+ * @returns The MeshTxBuilder instance
252
+ */
253
+ withdrawalRedeemerValue: (redeemer: BuilderData["content"], type?: BuilderData["type"], exUnits?: {
254
+ mem: number;
255
+ steps: number;
256
+ }) => this;
257
+ /**
258
+ * Creates a pool registration certificate, and adds it to the transaction
259
+ * @param poolParams Parameters for pool registration
260
+ * @returns The MeshTxBuilder instance
261
+ */
262
+ registerPoolCertificate: (poolParams: PoolParams) => this;
263
+ /**
264
+ * Creates a stake registration certificate, and adds it to the transaction
265
+ * @param stakeKeyHash The keyHash of the stake key
266
+ * @returns The MeshTxBuilder instance
267
+ */
268
+ registerStakeCertificate: (stakeKeyHash: string) => this;
269
+ /**
270
+ * Creates a stake delegation certificate, and adds it to the transaction
271
+ * This will delegate stake from the corresponding stake address to the pool
272
+ * @param stakeKeyHash The keyHash of the stake key
273
+ * @param poolId poolId can be in either bech32 or hex form
274
+ * @returns The MeshTxBuilder instance
275
+ */
276
+ delegateStakeCertificate: (stakeKeyHash: string, poolId: string) => this;
277
+ /**
278
+ * Creates a stake deregister certificate, and adds it to the transaction
279
+ * @param stakeKeyHash The keyHash of the stake key
280
+ * @returns The MeshTxBuilder instance
281
+ */
282
+ deregisterStakeCertificate: (stakeKeyHash: string) => this;
283
+ /**
284
+ * Creates a pool retire certificate, and adds it to the transaction
285
+ * @param poolId poolId can be in either bech32 or hex form
286
+ * @param epoch The intended epoch to retire the pool
287
+ * @returns The MeshTxBuilder instance
288
+ */
289
+ retirePoolCertificate: (poolId: string, epoch: number) => this;
290
+ /**
291
+ * Configure the address to accept change UTxO
292
+ * @param addr The address to accept change UTxO
293
+ * @returns The MeshTxBuilder instance
294
+ */
295
+ changeAddress: (addr: string) => this;
296
+ /**
297
+ * Set the transaction valid interval to be valid only after the slot
298
+ * @param slot The transaction is valid only after this slot
299
+ * @returns The MeshTxBuilder instance
300
+ */
301
+ invalidBefore: (slot: number) => this;
302
+ /**
303
+ * Set the transaction valid interval to be valid only before the slot
304
+ * @param slot The transaction is valid only before this slot
305
+ * @returns The MeshTxBuilder instance
306
+ */
307
+ invalidHereafter: (slot: number) => this;
308
+ /**
309
+ * Add metadata to the transaction
310
+ * @param tag The tag of the metadata
311
+ * @param metadata The metadata in any format
312
+ * @returns The MeshTxBuilder instance
313
+ */
314
+ metadataValue: (tag: string, metadata: any) => this;
315
+ /**
316
+ * Sign the transaction with the private key
317
+ * @param skeyHex The private key in cborHex (with or without 5820 prefix, i.e. the format when generated from cardano-cli)
318
+ * @returns
319
+ */
320
+ signingKey: (skeyHex: string) => this;
321
+ /**
322
+ * EXPERIMENTAL - Selects utxos to fill output value and puts them into inputs
323
+ * @param extraInputs The inputs already placed into the object will remain, these extra inputs will be used to fill the remaining value needed
324
+ * @param threshold Extra value needed to be selected for, usually for paying fees and min UTxO value of change output
325
+ */
326
+ selectUtxosFrom: (extraInputs: UTxO[], threshold?: number) => this;
327
+ /**
328
+ * Set the protocol parameters to be used for the transaction other than the default one
329
+ * @param params (Part of) the protocol parameters to be used for the transaction
330
+ * @returns The MeshTxBuilder instance
331
+ */
332
+ protocolParams: (params: Partial<Protocol>) => this;
333
+ protected queueAllLastItem: () => void;
334
+ private queueInput;
335
+ private queueMint;
336
+ private queueWithdrawal;
337
+ protected castRawDataToJsonString: (rawData: object | string) => string;
338
+ protected castBuilderDataToRedeemer: (redeemer: BuilderData["content"], type?: BuilderData["type"], exUnits?: {
339
+ mem: number;
340
+ steps: number;
341
+ }) => Redeemer;
342
+ protected updateRedeemer: (meshTxBuilderBody: MeshTxBuilderBody, txEvaluation: Omit<Action, "data">[]) => void;
343
+ addUtxosFromSelection: () => void;
344
+ removeDuplicateInputs: () => void;
345
+ emptyTxBuilderBody: () => () => MeshTxBuilderBody;
346
+ reset: () => void;
347
+ }
348
+
349
+ interface MeshTxBuilderOptions {
350
+ fetcher?: IFetcher;
351
+ submitter?: ISubmitter;
352
+ evaluator?: IEvaluator;
353
+ serializer?: IMeshTxSerializer;
354
+ isHydra?: boolean;
355
+ params?: Partial<Protocol>;
356
+ }
357
+ declare class MeshTxBuilder extends MeshTxBuilderCore {
358
+ serializer: IMeshTxSerializer;
359
+ fetcher?: IFetcher;
360
+ submitter?: ISubmitter;
361
+ evaluator?: IEvaluator;
362
+ txHex: string;
363
+ private queriedTxHashes;
364
+ private queriedUTxOs;
365
+ constructor({ serializer, fetcher, submitter, evaluator, params, isHydra, }?: MeshTxBuilderOptions);
366
+ /**
367
+ * It builds the transaction and query the blockchain for missing information
368
+ * @param customizedTx The optional customized transaction body
369
+ * @returns The signed transaction in hex ready to submit / signed by client
370
+ */
371
+ complete: (customizedTx?: MeshTxBuilderBody) => Promise<string>;
372
+ /**
373
+ * It builds the transaction without dependencies
374
+ * @param customizedTx The optional customized transaction body
375
+ * @returns The signed transaction in hex ready to submit / signed by client
376
+ */
377
+ completeSync: (customizedTx?: MeshTxBuilderBody) => string;
378
+ /**
379
+ * Complete the signing process
380
+ * @returns The signed transaction in hex
381
+ */
382
+ completeSigning: () => string;
383
+ /**
384
+ * Submit transactions to the blockchain using the fetcher instance
385
+ * @param txHex The signed transaction in hex
386
+ * @returns
387
+ */
388
+ submitTx: (txHex: string) => Promise<string | undefined>;
389
+ /**
390
+ * Get the UTxO information from the blockchain
391
+ * @param TxHash The TxIn object that contains the txHash and txIndex, while missing amount and address information
392
+ */
393
+ private getUTxOInfo;
394
+ private queryAllTxInfo;
395
+ private completeTxInformation;
396
+ private isInputComplete;
397
+ private isInputInfoComplete;
398
+ private isRefScriptInfoComplete;
399
+ }
400
+
401
+ declare class ForgeScript {
402
+ static withOneSignature(address: string): string;
403
+ static fromNativeScript(script: NativeScript): string;
404
+ }
405
+
406
+ interface TransactionOptions extends MeshTxBuilderOptions {
407
+ initiator: IInitiator;
408
+ }
409
+ declare class Transaction {
410
+ txBuilder: MeshTxBuilder;
411
+ initiator: IInitiator;
412
+ isCollateralNeeded: boolean;
413
+ constructor(options: TransactionOptions);
414
+ /**
415
+ * Adds an output to the transaction.
416
+ *
417
+ * @param recipient The recipient of the output.
418
+ * @param assets The assets to send. Provide string for lovelace and Asset[] for tokens and/or lovelace.
419
+ * @returns The transaction builder.
420
+ * @see {@link https://meshjs.dev/apis/transaction#sendAssets}
421
+ */
422
+ sendAssets(recipient: Recipient, assets: Asset[] | string): Transaction;
423
+ /**
424
+ * Suggest deprecated - Adds a transaction output to the transaction.
425
+ * Use sendAssets instead:
426
+ * ```ts
427
+ * this.sendAssets(recipient, lovelace);
428
+ * ```
429
+ *
430
+ * Deprecation reason - Unnecessary implementation which might cause confusion.
431
+ *
432
+ * @param {Recipient} recipient The recipient of the transaction.
433
+ * @param {string} lovelace The amount of lovelace to send.
434
+ * @returns {Transaction} The Transaction object.
435
+ * @see {@link https://meshjs.dev/apis/transaction#sendAda}
436
+ */
437
+ sendLovelace(recipient: Recipient, lovelace: string): Transaction;
438
+ /**
439
+ * Suggest deprecated - Adds stable coins transaction output to the transaction.
440
+ * Please use sendAssets with helper function to obtain token unit instead:
441
+ * ```ts
442
+ * const assets = [{ unit: SUPPORTED_TOKENS.GIMBAL, quantity: "100" }]
443
+ * transaction.sendAssets(recipient, assets)
444
+ * ```
445
+ *
446
+ * Deprecation reason - Required maintenance on tokens.
447
+ *
448
+ * @param {Recipient} recipient The recipient of the transaction.
449
+ * @param {Token} ticker The ticker of the token to send.
450
+ * @param {string} amount The amount of the token to send.
451
+ * @returns {Transaction} The Transaction object.
452
+ * @see {@link https://meshjs.dev/apis/transaction#sendToken}
453
+ */
454
+ sendToken(recipient: Recipient, ticker: Token, amount: string): Transaction;
455
+ /**
456
+ * Adds an output to the transaction.
457
+ * Suggest deprecated - use sendAssets instead:
458
+ *
459
+ * ```ts
460
+ * const assets = value.output.amount;
461
+ * this.sendAssets(recipient, assets);
462
+ * ```
463
+ * Deprecation reason - Unnecessary implementation which might cause confusion.
464
+ *
465
+ * @param {Recipient} recipient The recipient of the output.
466
+ * @param {UTxO} value The UTxO value of the output.
467
+ * @returns {Transaction} The Transaction object.
468
+ */
469
+ sendValue(recipient: Recipient, value: UTxO): Transaction;
470
+ /**
471
+ * Sets the inputs for the transaction.
472
+ *
473
+ * @param {UTxO[]} inputs The inputs to set.
474
+ * @returns {Transaction} The transaction.
475
+ */
476
+ setTxInputs(inputs: UTxO[]): Transaction;
477
+ /**
478
+ * Sets the reference inputs for the transaction.
479
+ *
480
+ * @param {UTxO[]} inputs The reference inputs to set.
481
+ * @returns {Transaction} The transaction.
482
+ */
483
+ setTxRefInputs(inputs: UTxO[]): Transaction;
484
+ /**
485
+ * Sets the native script for the transaction.
486
+ * @param {NativeScript} script The native script to spend from.
487
+ * @param {UTxO} utxo The UTxO attached to the script.
488
+ * @returns {Transaction} The Transaction object.
489
+ */
490
+ setNativeScriptInput(script: NativeScript, utxo: UTxO): Transaction;
491
+ redeemValue(options: {
492
+ value: UTxO;
493
+ script: PlutusScript | UTxO;
494
+ redeemer?: Pick<Action, "data"> & {
495
+ budget?: Budget;
496
+ };
497
+ datum?: Data | UTxO;
498
+ }): Transaction;
499
+ mintAsset(forgeScript: string | PlutusScript | UTxO, mint: Mint, redeemer?: Pick<Action, "data"> & {
500
+ budget?: Budget;
501
+ }): Transaction;
502
+ burnAsset(forgeScript: string | PlutusScript | UTxO, asset: Asset, redeemer?: Pick<Action, "data"> & {
503
+ budget?: Budget;
504
+ }): Transaction;
505
+ /**
506
+ * Sets the change address for the transaction.
507
+ *
508
+ * @param {string} changeAddress The change address.
509
+ * @returns {Transaction} The Transaction object.
510
+ */
511
+ setChangeAddress(changeAddress: string): Transaction;
512
+ /**
513
+ * Sets the collateral for the transaction.
514
+ *
515
+ * @param {UTxO[]} collateral - Set the UTxO for collateral.
516
+ * @returns {Transaction} The Transaction object.
517
+ */
518
+ setCollateral(collateral: UTxO[]): Transaction;
519
+ /**
520
+ * Sets the required signers for the transaction.
521
+ *
522
+ * @param {string[]} addresses The addresses of the required signers.
523
+ * @returns {Transaction} The Transaction object.
524
+ */
525
+ setRequiredSigners(addresses: string[]): Transaction;
526
+ /**
527
+ * Set the time to live for the transaction.
528
+ *
529
+ * @param {string} slot The slot number to expire the transaction at.
530
+ * @returns {Transaction} The Transaction object.
531
+ * @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
532
+ */
533
+ setTimeToExpire(slot: string): Transaction;
534
+ /**
535
+ * Sets the start slot for the transaction.
536
+ *
537
+ * @param {string} slot The start slot for the transaction.
538
+ * @returns {Transaction} The Transaction object.
539
+ * @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
540
+ */
541
+ setTimeToStart(slot: string): Transaction;
542
+ /**
543
+ * Add a JSON metadata entry to the transaction.
544
+ *
545
+ * @param {number} key The key to use for the metadata entry.
546
+ * @param {unknown} value The value to use for the metadata entry.
547
+ * @returns {Transaction} The Transaction object.
548
+ * @see {@link https://meshjs.dev/apis/transaction#setMetadata}
549
+ */
550
+ setMetadata(key: number, value: unknown): Transaction;
551
+ withdrawRewards(rewardAddress: string, lovelace: string): Transaction;
552
+ delegateStake(rewardAddress: string, poolId: string): Transaction;
553
+ deregisterStake(rewardAddress: string): Transaction;
554
+ registerStake(rewardAddress: string): Transaction;
555
+ registerPool(params: PoolParams): Transaction;
556
+ retirePool(poolId: string, epochNo: number): Transaction;
557
+ build(): Promise<string>;
558
+ protected mintPlutusScript(script: PlutusScript): MeshTxBuilder;
559
+ protected spendingPlutusScript(script: PlutusScript): MeshTxBuilder;
560
+ private addCollateralIfNeeded;
561
+ private addTxInputsAsNeeded;
562
+ private addChangeAddress;
563
+ }
564
+
565
+ declare const keepRelevant: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string) => UTxO[];
566
+
567
+ declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: _meshsdk_common.Protocol) => UTxO[];
568
+
569
+ declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: _meshsdk_common.Protocol) => UTxO[];
570
+
571
+ declare const experimentalSelectUtxos: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity) => UTxO[];
572
+
573
+ /**
574
+ * All UTxO selection algorithms follows below's interface
575
+ *
576
+ * Supported algorithms:
577
+ * - largestFirst - CIP2 suggested algorithm
578
+ * - largestFirstMultiAsset - CIP2 suggested algorithm
579
+ * - keepRelevant - CIP2 suggested algorithm
580
+ * - experimental - The always evolving algorithm according to the latest research
581
+ *
582
+ * @param requestedOutputSet
583
+ * @param initialUTxOSet
584
+ * @returns
585
+ */
586
+ declare class UtxoSelection {
587
+ constructor();
588
+ largestFirst(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string): UTxO[];
589
+ keepRelevant(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string): UTxO[];
590
+ largestFirstMultiAsset(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity): UTxO[];
591
+ experimental(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity): UTxO[];
592
+ }
593
+
594
+ export { ForgeScript, MeshTxBuilder, type MeshTxBuilderOptions, Transaction, type TransactionOptions, UtxoSelection, experimentalSelectUtxos, keepRelevant, largestFirst, largestFirstMultiAsset };