@meshsdk/core 1.6.0-alpha.2 → 1.6.0-alpha.4
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/common/constants.d.ts +58 -0
- package/dist/common/contracts/evaluator.d.ts +4 -0
- package/dist/common/contracts/fetcher.d.ts +22 -0
- package/dist/common/contracts/index.d.ts +7 -0
- package/dist/common/contracts/initiator.d.ts +8 -0
- package/dist/common/contracts/listener.d.ts +3 -0
- package/dist/common/contracts/signer.d.ts +8 -0
- package/dist/common/contracts/submitter.d.ts +3 -0
- package/dist/common/contracts/uploader.d.ts +3 -0
- package/dist/common/data/index.d.ts +2 -0
- package/dist/common/data/mesh.d.ts +8 -0
- package/dist/common/data/plutus.d.ts +72 -0
- package/dist/common/helpers/generateNonce.d.ts +1 -0
- package/dist/common/helpers/index.d.ts +2 -0
- package/dist/common/helpers/readPlutusData.d.ts +2 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/utils/parser.d.ts +5 -0
- package/dist/common/utils/resolver.d.ts +17 -0
- package/dist/core/CIP2.d.ts +4 -0
- package/dist/core/CIP8.d.ts +15 -0
- package/dist/index.d.ts +12 -0
- package/dist/providers/blockfrost.provider.d.ts +46 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/infura.provider.d.ts +12 -0
- package/dist/providers/koios.provider.d.ts +27 -0
- package/dist/providers/maestro.provider.d.ts +35 -0
- package/dist/providers/ogmios.provider.d.ts +12 -0
- package/dist/providers/tango.provider.d.ts +25 -0
- package/dist/scripts/forge.script.d.ts +8 -0
- package/dist/scripts/index.d.ts +1 -0
- package/dist/transaction/index.d.ts +2 -0
- package/dist/transaction/meshTxBuilder/index.d.ts +2 -0
- package/dist/transaction/meshTxBuilder/meshTxBuilder.service.d.ts +47 -0
- package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +320 -0
- package/dist/transaction/meshTxBuilder/type.d.ts +128 -0
- package/dist/transaction/transaction.service.d.ts +150 -0
- package/dist/types/Account.d.ts +5 -0
- package/dist/types/AccountInfo.d.ts +7 -0
- package/dist/types/Action.d.ts +12 -0
- package/dist/types/Asset.d.ts +6 -0
- package/dist/types/AssetExtended.d.ts +8 -0
- package/dist/types/AssetMetadata.d.ts +24 -0
- package/dist/types/BlockInfo.d.ts +17 -0
- package/dist/types/Data.d.ts +4 -0
- package/dist/types/DataSignature.d.ts +4 -0
- package/dist/types/Era.d.ts +1 -0
- package/dist/types/Mint.d.ts +10 -0
- package/dist/types/NativeScript.d.ts +14 -0
- package/dist/types/Network.d.ts +4 -0
- package/dist/types/PlutusScript.d.ts +6 -0
- package/dist/types/PoolParams.d.ts +16 -0
- package/dist/types/Protocol.d.ts +22 -0
- package/dist/types/Recipient.d.ts +11 -0
- package/dist/types/Relay.d.ts +13 -0
- package/dist/types/Token.d.ts +2 -0
- package/dist/types/TransactionInfo.d.ts +11 -0
- package/dist/types/UTxO.d.ts +15 -0
- package/dist/types/Wallet.d.ts +5 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/wallet/app.service.d.ts +36 -0
- package/dist/wallet/browser.service.d.ts +62 -0
- package/dist/wallet/embedded.service.d.ts +20 -0
- package/dist/wallet/index.d.ts +3 -0
- package/package.json +2 -3
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { Action, Asset, LanguageVersion, Protocol, UTxO, PoolParams } from '@mesh/types';
|
|
2
|
+
import { csl } from '@mesh/core';
|
|
3
|
+
import { MintItem, TxIn, PubKeyTxIn, MeshTxBuilderBody, RefTxIn, BuilderData, Certificate } from './type';
|
|
4
|
+
export declare class MeshTxBuilderCore {
|
|
5
|
+
txHex: string;
|
|
6
|
+
txBuilder: csl.TransactionBuilder;
|
|
7
|
+
txEvaluationMultiplier: number;
|
|
8
|
+
private _protocolParams;
|
|
9
|
+
private txOutput?;
|
|
10
|
+
private addingScriptInput;
|
|
11
|
+
private addingPlutusMint;
|
|
12
|
+
protected isHydra: boolean;
|
|
13
|
+
meshTxBuilderBody: MeshTxBuilderBody;
|
|
14
|
+
protected mintItem?: MintItem;
|
|
15
|
+
protected txInQueueItem?: TxIn;
|
|
16
|
+
protected collateralQueueItem?: PubKeyTxIn;
|
|
17
|
+
protected refScriptTxInQueueItem?: RefTxIn;
|
|
18
|
+
/**
|
|
19
|
+
* Reset everything in the MeshTxBuilder instance
|
|
20
|
+
* @returns The MeshTxBuilder instance
|
|
21
|
+
*/
|
|
22
|
+
reset: () => this;
|
|
23
|
+
/**
|
|
24
|
+
* Make an empty transaction body for building transaction in object
|
|
25
|
+
* @returns An empty transaction body
|
|
26
|
+
*/
|
|
27
|
+
emptyTxBuilderBody: () => MeshTxBuilderBody;
|
|
28
|
+
constructor();
|
|
29
|
+
/**
|
|
30
|
+
* Synchronous functions here
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* It builds the transaction without dependencies
|
|
34
|
+
* @param customizedTx The optional customized transaction body
|
|
35
|
+
* @returns The signed transaction in hex ready to submit / signed by client
|
|
36
|
+
*/
|
|
37
|
+
completeSync: (customizedTx?: MeshTxBuilderBody) => this;
|
|
38
|
+
/**
|
|
39
|
+
* Complete the signing process
|
|
40
|
+
* @returns The signed transaction in hex
|
|
41
|
+
*/
|
|
42
|
+
completeSigning: () => string;
|
|
43
|
+
private serializeTxBody;
|
|
44
|
+
/**
|
|
45
|
+
* Set the input for transaction
|
|
46
|
+
* @param txHash The transaction hash of the input UTxO
|
|
47
|
+
* @param txIndex The transaction index of the input UTxO
|
|
48
|
+
* @param amount The asset amount of index of the input UTxO
|
|
49
|
+
* @param address The address of the input UTxO
|
|
50
|
+
* @returns The MeshTxBuilder instance
|
|
51
|
+
*/
|
|
52
|
+
txIn: (txHash: string, txIndex: number, amount?: Asset[], address?: string) => this;
|
|
53
|
+
/**
|
|
54
|
+
* Set the script for transaction input
|
|
55
|
+
* @param {string} scriptCbor The CborHex of the script
|
|
56
|
+
* @param version Optional - The Plutus script version
|
|
57
|
+
* @returns The MeshTxBuilder instance
|
|
58
|
+
*/
|
|
59
|
+
txInScript: (scriptCbor: string, version?: LanguageVersion) => this;
|
|
60
|
+
/**
|
|
61
|
+
* Set the input datum for transaction input
|
|
62
|
+
* @param datum The datum in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
63
|
+
* @param type The datum type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
64
|
+
* @returns The MeshTxBuilder instance
|
|
65
|
+
*/
|
|
66
|
+
txInDatumValue: (datum: BuilderData['content'], type?: BuilderData['type']) => this;
|
|
67
|
+
/**
|
|
68
|
+
* Tell the transaction builder that the input UTxO has inlined datum
|
|
69
|
+
* @returns The MeshTxBuilder instance
|
|
70
|
+
*/
|
|
71
|
+
txInInlineDatumPresent: () => this;
|
|
72
|
+
/**
|
|
73
|
+
* Set the redeemer for the reference input to be spent in same transaction
|
|
74
|
+
* @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
75
|
+
* @param exUnits The execution units budget for the redeemer
|
|
76
|
+
* @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
77
|
+
* @returns The MeshTxBuilder instance
|
|
78
|
+
*/
|
|
79
|
+
txInRedeemerValue: (redeemer: BuilderData['content'], exUnits?: {
|
|
80
|
+
mem: number;
|
|
81
|
+
steps: number;
|
|
82
|
+
}, type?: BuilderData['type']) => this;
|
|
83
|
+
/**
|
|
84
|
+
* Set the output for transaction
|
|
85
|
+
* @param {string} address The recipient of the output
|
|
86
|
+
* @param {Asset[]} amount The amount of other native assets attached with UTxO
|
|
87
|
+
* @returns The MeshTxBuilder instance
|
|
88
|
+
*/
|
|
89
|
+
txOut: (address: string, amount: Asset[]) => this;
|
|
90
|
+
/**
|
|
91
|
+
* Set the output datum hash for transaction
|
|
92
|
+
* @param datum The datum in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
93
|
+
* @param type The datum type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
94
|
+
* @returns The MeshTxBuilder instance
|
|
95
|
+
*/
|
|
96
|
+
txOutDatumHashValue: (datum: BuilderData['content'], type?: BuilderData['type']) => this;
|
|
97
|
+
/**
|
|
98
|
+
* Set the output inline datum for transaction
|
|
99
|
+
* @param datum The datum in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
100
|
+
* @param type The datum type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
101
|
+
* @returns The MeshTxBuilder instance
|
|
102
|
+
*/
|
|
103
|
+
txOutInlineDatumValue: (datum: BuilderData['content'], type?: BuilderData['type']) => this;
|
|
104
|
+
/**
|
|
105
|
+
* Set the reference script to be attached with the output
|
|
106
|
+
* @param scriptCbor The CBOR hex of the script to be attached to UTxO as reference script
|
|
107
|
+
* @param version Optional - The Plutus script version
|
|
108
|
+
* @returns The MeshTxBuilder instance
|
|
109
|
+
*/
|
|
110
|
+
txOutReferenceScript: (scriptCbor: string, version?: LanguageVersion) => this;
|
|
111
|
+
/**
|
|
112
|
+
* Set the instruction that it is currently using V2 Plutus spending scripts
|
|
113
|
+
* @returns The MeshTxBuilder instance
|
|
114
|
+
*/
|
|
115
|
+
spendingPlutusScriptV2: () => this;
|
|
116
|
+
/**
|
|
117
|
+
* Set the reference input where it would also be spent in the transaction
|
|
118
|
+
* @param txHash The transaction hash of the reference UTxO
|
|
119
|
+
* @param txIndex The transaction index of the reference UTxO
|
|
120
|
+
* @param spendingScriptHash The script hash of the spending script
|
|
121
|
+
* @returns The MeshTxBuilder instance
|
|
122
|
+
*/
|
|
123
|
+
spendingTxInReference: (txHash: string, txIndex: number, spendingScriptHash?: string, version?: LanguageVersion) => this;
|
|
124
|
+
/**
|
|
125
|
+
* [Alias of txInInlineDatumPresent] Set the instruction that the reference input has inline datum
|
|
126
|
+
* @returns The MeshTxBuilder instance
|
|
127
|
+
*/
|
|
128
|
+
spendingReferenceTxInInlineDatumPresent: () => this;
|
|
129
|
+
/**
|
|
130
|
+
* [Alias of txInRedeemerValue] Set the redeemer for the reference input to be spent in same transaction
|
|
131
|
+
* @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
132
|
+
* @param exUnits The execution units budget for the redeemer
|
|
133
|
+
* @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
134
|
+
* @returns The MeshTxBuilder instance
|
|
135
|
+
*/
|
|
136
|
+
spendingReferenceTxInRedeemerValue: (redeemer: BuilderData['content'], exUnits?: {
|
|
137
|
+
mem: number;
|
|
138
|
+
steps: number;
|
|
139
|
+
}, type?: BuilderData['type']) => this;
|
|
140
|
+
/**
|
|
141
|
+
* Specify a read only reference input. This reference input is not witnessing anything it is simply provided in the plutus script context.
|
|
142
|
+
* @param txHash The transaction hash of the reference UTxO
|
|
143
|
+
* @param txIndex The transaction index of the reference UTxO
|
|
144
|
+
* @returns The MeshTxBuilder instance
|
|
145
|
+
*/
|
|
146
|
+
readOnlyTxInReference: (txHash: string, txIndex: number) => this;
|
|
147
|
+
/**
|
|
148
|
+
* Set the instruction that it is currently using V2 Plutus minting scripts
|
|
149
|
+
* @returns The MeshTxBuilder instance
|
|
150
|
+
*/
|
|
151
|
+
mintPlutusScriptV2: () => this;
|
|
152
|
+
/**
|
|
153
|
+
* Set the minting value of transaction
|
|
154
|
+
* @param quantity The quantity of asset to be minted
|
|
155
|
+
* @param policy The policy id of the asset to be minted
|
|
156
|
+
* @param name The hex of token name of the asset to be minted
|
|
157
|
+
* @returns The MeshTxBuilder instance
|
|
158
|
+
*/
|
|
159
|
+
mint: (quantity: string, policy: string, name: string) => this;
|
|
160
|
+
/**
|
|
161
|
+
* Set the minting script of current mint
|
|
162
|
+
* @param scriptCBOR The CBOR hex of the minting policy script
|
|
163
|
+
* @param version Optional - The Plutus script version
|
|
164
|
+
* @returns The MeshTxBuilder instance
|
|
165
|
+
*/
|
|
166
|
+
mintingScript: (scriptCBOR: string, version?: LanguageVersion) => this;
|
|
167
|
+
/**
|
|
168
|
+
* Use reference script for minting
|
|
169
|
+
* @param txHash The transaction hash of the UTxO
|
|
170
|
+
* @param txIndex The transaction index of the UTxO
|
|
171
|
+
* @returns The MeshTxBuilder instance
|
|
172
|
+
*/
|
|
173
|
+
mintTxInReference: (txHash: string, txIndex: number, version?: LanguageVersion) => this;
|
|
174
|
+
/**
|
|
175
|
+
* Set the redeemer for minting
|
|
176
|
+
* @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
177
|
+
* @param exUnits The execution units budget for the redeemer
|
|
178
|
+
* @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
179
|
+
* @returns The MeshTxBuilder instance
|
|
180
|
+
*/
|
|
181
|
+
mintReferenceTxInRedeemerValue: (redeemer: BuilderData['content'], exUnits?: {
|
|
182
|
+
mem: number;
|
|
183
|
+
steps: number;
|
|
184
|
+
}, type?: BuilderData['type']) => this;
|
|
185
|
+
/**
|
|
186
|
+
* Set the redeemer for the reference input to be spent in same transaction
|
|
187
|
+
* @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
188
|
+
* @param exUnits The execution units budget for the redeemer
|
|
189
|
+
* @param type The redeemer data type, either Mesh Data type, JSON in raw constructor like format, or CBOR hex string
|
|
190
|
+
* @returns The MeshTxBuilder instance
|
|
191
|
+
*/
|
|
192
|
+
mintRedeemerValue: (redeemer: BuilderData['content'], exUnits?: {
|
|
193
|
+
mem: number;
|
|
194
|
+
steps: number;
|
|
195
|
+
}, type?: BuilderData['type']) => this;
|
|
196
|
+
/**
|
|
197
|
+
* Set the required signer of the transaction
|
|
198
|
+
* @param pubKeyHash The PubKeyHash of the required signer
|
|
199
|
+
* @returns The MeshTxBuilder instance
|
|
200
|
+
*/
|
|
201
|
+
requiredSignerHash: (pubKeyHash: string) => this;
|
|
202
|
+
/**
|
|
203
|
+
* Set the collateral UTxO for the transaction
|
|
204
|
+
* @param txHash The transaction hash of the collateral UTxO
|
|
205
|
+
* @param txIndex The transaction index of the collateral UTxO
|
|
206
|
+
* @param amount The asset amount of index of the collateral UTxO
|
|
207
|
+
* @param address The address of the collateral UTxO
|
|
208
|
+
* @returns The MeshTxBuilder instance
|
|
209
|
+
*/
|
|
210
|
+
txInCollateral: (txHash: string, txIndex: number, amount?: Asset[], address?: string) => this;
|
|
211
|
+
/**
|
|
212
|
+
* Creates a pool registration certificate, and adds it to the transaction
|
|
213
|
+
* @param poolParams Parameters for pool registration
|
|
214
|
+
* @returns The MeshTxBuilder instance
|
|
215
|
+
*/
|
|
216
|
+
registerPoolCertificate: (poolParams: PoolParams) => this;
|
|
217
|
+
/**
|
|
218
|
+
* Creates a stake registration certificate, and adds it to the transaction
|
|
219
|
+
* @param stakeKeyHash The keyHash of the stake key
|
|
220
|
+
* @returns The MeshTxBuilder instance
|
|
221
|
+
*/
|
|
222
|
+
registerStakeCertificate: (stakeKeyHash: string) => this;
|
|
223
|
+
/**
|
|
224
|
+
* Creates a stake delegation certificate, and adds it to the transaction
|
|
225
|
+
* This will delegate stake from the corresponding stake address to the pool
|
|
226
|
+
* @param stakeKeyHash The keyHash of the stake key
|
|
227
|
+
* @param poolId poolId can be in either bech32 or hex form
|
|
228
|
+
* @returns The MeshTxBuilder instance
|
|
229
|
+
*/
|
|
230
|
+
delegateStakeCertificate: (stakeKeyHash: string, poolId: string) => this;
|
|
231
|
+
/**
|
|
232
|
+
* Creates a stake deregister certificate, and adds it to the transaction
|
|
233
|
+
* @param stakeKeyHash The keyHash of the stake key
|
|
234
|
+
* @returns The MeshTxBuilder instance
|
|
235
|
+
*/
|
|
236
|
+
deregisterStakeCertificate: (stakeKeyHash: string) => this;
|
|
237
|
+
/**
|
|
238
|
+
* Creates a pool retire certificate, and adds it to the transaction
|
|
239
|
+
* @param poolId poolId can be in either bech32 or hex form
|
|
240
|
+
* @param epoch The intended epoch to retire the pool
|
|
241
|
+
* @returns The MeshTxBuilder instance
|
|
242
|
+
*/
|
|
243
|
+
retirePoolCertificate: (poolId: string, epoch: number) => this;
|
|
244
|
+
/**
|
|
245
|
+
* Configure the address to accept change UTxO
|
|
246
|
+
* @param addr The address to accept change UTxO
|
|
247
|
+
* @returns The MeshTxBuilder instance
|
|
248
|
+
*/
|
|
249
|
+
changeAddress: (addr: string) => this;
|
|
250
|
+
/**
|
|
251
|
+
* Set the transaction valid interval to be valid only after the slot
|
|
252
|
+
* @param slot The transaction is valid only after this slot
|
|
253
|
+
* @returns The MeshTxBuilder instance
|
|
254
|
+
*/
|
|
255
|
+
invalidBefore: (slot: number) => this;
|
|
256
|
+
/**
|
|
257
|
+
* Set the transaction valid interval to be valid only before the slot
|
|
258
|
+
* @param slot The transaction is valid only before this slot
|
|
259
|
+
* @returns The MeshTxBuilder instance
|
|
260
|
+
*/
|
|
261
|
+
invalidHereafter: (slot: number) => this;
|
|
262
|
+
/**
|
|
263
|
+
* Add metadata to the transaction
|
|
264
|
+
* @param tag The tag of the metadata
|
|
265
|
+
* @param metadata The metadata in object format
|
|
266
|
+
* @returns The MeshTxBuilder instance
|
|
267
|
+
*/
|
|
268
|
+
metadataValue: <T extends object>(tag: string, metadata: T) => this;
|
|
269
|
+
/**
|
|
270
|
+
* Set the protocol parameters to be used for the transaction other than the default one
|
|
271
|
+
* @param params (Part of) the protocol parameters to be used for the transaction
|
|
272
|
+
* @returns The MeshTxBuilder instance
|
|
273
|
+
*/
|
|
274
|
+
protocolParams: (params: Partial<Protocol>) => this;
|
|
275
|
+
/**
|
|
276
|
+
* Sign the transaction with the private key
|
|
277
|
+
* @param skeyHex The private key in cborHex (with or without 5820 prefix, i.e. the format when generated from cardano-cli)
|
|
278
|
+
* @returns
|
|
279
|
+
*/
|
|
280
|
+
signingKey: (skeyHex: string) => this;
|
|
281
|
+
/**
|
|
282
|
+
* EXPERIMENTAL - Selects utxos to fill output value and puts them into inputs
|
|
283
|
+
* @param extraInputs The inputs already placed into the object will remain, these extra inputs will be used to fill the remaining value needed
|
|
284
|
+
* @param threshold Extra value needed to be selected for, usually for paying fees and min UTxO value of change output
|
|
285
|
+
*/
|
|
286
|
+
selectUtxosFrom: (extraInputs: UTxO[], threshold?: number) => this;
|
|
287
|
+
private addUtxosFrom;
|
|
288
|
+
private addAllSigningKeys;
|
|
289
|
+
private buildTx;
|
|
290
|
+
private queueInput;
|
|
291
|
+
private queueMint;
|
|
292
|
+
private makePlutusScriptSource;
|
|
293
|
+
protected removeDuplicateInputs: () => void;
|
|
294
|
+
private addAllInputs;
|
|
295
|
+
private addTxIn;
|
|
296
|
+
private addScriptTxIn;
|
|
297
|
+
private addAllOutputs;
|
|
298
|
+
private addOutput;
|
|
299
|
+
private addAllCollaterals;
|
|
300
|
+
private addCollateral;
|
|
301
|
+
private addCollateralReturn;
|
|
302
|
+
private addAllReferenceInputs;
|
|
303
|
+
private addReferenceInput;
|
|
304
|
+
protected addAllMints: (mints: MintItem[]) => void;
|
|
305
|
+
private addPlutusMint;
|
|
306
|
+
private addNativeMint;
|
|
307
|
+
private decimalToFraction;
|
|
308
|
+
private toPoolParams;
|
|
309
|
+
private addCertificate;
|
|
310
|
+
protected queueAllLastItem: () => void;
|
|
311
|
+
protected addAllCertificates: (allCertificates: Certificate[]) => void;
|
|
312
|
+
protected addCostModels: () => void;
|
|
313
|
+
private addChange;
|
|
314
|
+
private addValidityRange;
|
|
315
|
+
private addAllRequiredSignatures;
|
|
316
|
+
private addAllMetadata;
|
|
317
|
+
protected updateRedeemer: (meshTxBuilderBody: MeshTxBuilderBody, txEvaluation: Omit<Action, 'data'>[]) => void;
|
|
318
|
+
protected castRawDataToJsonString: (rawData: object | string) => any;
|
|
319
|
+
protected castDataToPlutusData: ({ type, content }: BuilderData) => csl.PlutusData;
|
|
320
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Asset, Budget, Data, LanguageVersion, PlutusScript, UTxO, PoolParams } from '@mesh/types';
|
|
2
|
+
export declare type MeshTxBuilderBody = {
|
|
3
|
+
inputs: TxIn[];
|
|
4
|
+
outputs: Output[];
|
|
5
|
+
extraInputs: UTxO[];
|
|
6
|
+
selectionThreshold: number;
|
|
7
|
+
collaterals: PubKeyTxIn[];
|
|
8
|
+
requiredSignatures: string[];
|
|
9
|
+
referenceInputs: RefTxIn[];
|
|
10
|
+
mints: MintItem[];
|
|
11
|
+
changeAddress: string;
|
|
12
|
+
metadata: Metadata[];
|
|
13
|
+
validityRange: ValidityRange;
|
|
14
|
+
certificates: Certificate[];
|
|
15
|
+
signingKey: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare type TxIn = PubKeyTxIn | ScriptTxIn;
|
|
18
|
+
export declare type PubKeyTxIn = {
|
|
19
|
+
type: 'PubKey';
|
|
20
|
+
txIn: TxInParameter;
|
|
21
|
+
};
|
|
22
|
+
export declare type TxInParameter = {
|
|
23
|
+
txHash: string;
|
|
24
|
+
txIndex: number;
|
|
25
|
+
amount?: Asset[];
|
|
26
|
+
address?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare type ScriptTxIn = {
|
|
29
|
+
type: 'Script';
|
|
30
|
+
txIn: TxInParameter;
|
|
31
|
+
scriptTxIn: ScriptTxInParameter;
|
|
32
|
+
};
|
|
33
|
+
export declare type ScriptTxInParameter = {
|
|
34
|
+
scriptSource?: {
|
|
35
|
+
type: 'Provided';
|
|
36
|
+
script: PlutusScript;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'Inline';
|
|
39
|
+
txInInfo: ScriptSourceInfo;
|
|
40
|
+
};
|
|
41
|
+
datumSource?: {
|
|
42
|
+
type: 'Provided';
|
|
43
|
+
data: BuilderData;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'Inline';
|
|
46
|
+
txHash: string;
|
|
47
|
+
txIndex: number;
|
|
48
|
+
};
|
|
49
|
+
redeemer?: Redeemer;
|
|
50
|
+
};
|
|
51
|
+
export declare type ScriptSourceInfo = {
|
|
52
|
+
txHash: string;
|
|
53
|
+
txIndex: number;
|
|
54
|
+
spendingScriptHash?: string;
|
|
55
|
+
version: LanguageVersion;
|
|
56
|
+
};
|
|
57
|
+
export declare type RefTxIn = {
|
|
58
|
+
txHash: string;
|
|
59
|
+
txIndex: number;
|
|
60
|
+
};
|
|
61
|
+
export declare type Output = {
|
|
62
|
+
address: string;
|
|
63
|
+
amount: Asset[];
|
|
64
|
+
datum?: {
|
|
65
|
+
type: 'Hash' | 'Inline';
|
|
66
|
+
data: BuilderData;
|
|
67
|
+
};
|
|
68
|
+
referenceScript?: PlutusScript;
|
|
69
|
+
};
|
|
70
|
+
export declare type MintItem = {
|
|
71
|
+
type: 'Plutus' | 'Native';
|
|
72
|
+
policyId: string;
|
|
73
|
+
assetName: string;
|
|
74
|
+
amount: string;
|
|
75
|
+
redeemer?: Redeemer;
|
|
76
|
+
scriptSource?: {
|
|
77
|
+
type: 'Provided';
|
|
78
|
+
script: PlutusScript;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'Reference Script';
|
|
81
|
+
txHash: string;
|
|
82
|
+
txIndex: number;
|
|
83
|
+
version: LanguageVersion;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export declare type ValidityRange = {
|
|
87
|
+
invalidBefore?: number;
|
|
88
|
+
invalidHereafter?: number;
|
|
89
|
+
};
|
|
90
|
+
export declare type BuilderData = {
|
|
91
|
+
type: 'Mesh';
|
|
92
|
+
content: Data;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'JSON';
|
|
95
|
+
content: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'CBOR';
|
|
98
|
+
content: string;
|
|
99
|
+
};
|
|
100
|
+
export declare type Redeemer = {
|
|
101
|
+
data: BuilderData;
|
|
102
|
+
exUnits: Budget;
|
|
103
|
+
};
|
|
104
|
+
export declare type Metadata = {
|
|
105
|
+
tag: string;
|
|
106
|
+
metadata: object;
|
|
107
|
+
};
|
|
108
|
+
export declare type Certificate = {
|
|
109
|
+
type: 'RegisterPool';
|
|
110
|
+
poolParams: PoolParams;
|
|
111
|
+
} | {
|
|
112
|
+
type: 'RegisterStake';
|
|
113
|
+
stakeKeyHash: string;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'DelegateStake';
|
|
116
|
+
stakeKeyHash: string;
|
|
117
|
+
poolId: string;
|
|
118
|
+
} | {
|
|
119
|
+
type: 'DeregisterStake';
|
|
120
|
+
stakeKeyHash: string;
|
|
121
|
+
} | {
|
|
122
|
+
type: 'RetirePool';
|
|
123
|
+
poolId: string;
|
|
124
|
+
epoch: number;
|
|
125
|
+
};
|
|
126
|
+
export declare type RequiredWith<T, K extends keyof T> = Required<T> & {
|
|
127
|
+
[P in K]: Required<T[P]>;
|
|
128
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { IInitiator } from '@mesh/common/contracts';
|
|
2
|
+
import type { Action, Asset, Data, Era, Mint, Protocol, PlutusScript, PoolParams, Recipient, Token, UTxO } from '@mesh/types';
|
|
3
|
+
export declare class Transaction {
|
|
4
|
+
private _changeAddress?;
|
|
5
|
+
private _txOutputs;
|
|
6
|
+
private _recipients;
|
|
7
|
+
private _totalBurns;
|
|
8
|
+
private _totalMints;
|
|
9
|
+
private readonly _era?;
|
|
10
|
+
private readonly _initiator?;
|
|
11
|
+
private readonly _mintBuilder;
|
|
12
|
+
private readonly _protocolParameters;
|
|
13
|
+
private readonly _txBuilder;
|
|
14
|
+
private readonly _txCertificates;
|
|
15
|
+
private readonly _txInputsBuilder;
|
|
16
|
+
private readonly _txWithdrawals;
|
|
17
|
+
constructor(options?: Partial<CreateTxOptions>);
|
|
18
|
+
static attachMetadata(cborTx: string, cborTxMetadata: string, era?: Era): string;
|
|
19
|
+
static deattachMetadata(cborTx: string): string;
|
|
20
|
+
static maskMetadata(cborTx: string, era?: Era): string;
|
|
21
|
+
static readMetadata(cborTx: string): string;
|
|
22
|
+
static writeMetadata(cborTx: string, cborTxMetadata: string, era?: Era): string;
|
|
23
|
+
get size(): number;
|
|
24
|
+
build(): Promise<string>;
|
|
25
|
+
burnAsset(forgeScript: string | PlutusScript | UTxO, asset: Asset, redeemer?: Partial<Action>): Transaction;
|
|
26
|
+
delegateStake(rewardAddress: string, poolId: string): Transaction;
|
|
27
|
+
deregisterStake(rewardAddress: string): Transaction;
|
|
28
|
+
mintAsset(forgeScript: string | PlutusScript | UTxO, mint: Mint, redeemer?: Partial<Action>): Transaction;
|
|
29
|
+
redeemValue(options: {
|
|
30
|
+
value: UTxO;
|
|
31
|
+
script: PlutusScript | UTxO;
|
|
32
|
+
datum?: Data | UTxO;
|
|
33
|
+
redeemer?: Action;
|
|
34
|
+
}): Transaction;
|
|
35
|
+
registerStake(rewardAddress: string): Transaction;
|
|
36
|
+
registerPool(params: PoolParams): Transaction;
|
|
37
|
+
retirePool(poolId: string, epochNo: number): Transaction;
|
|
38
|
+
/**
|
|
39
|
+
* Adds an output to the transaction.
|
|
40
|
+
*
|
|
41
|
+
* @param recipient The recipient of the output.
|
|
42
|
+
* @param assets The assets to send.
|
|
43
|
+
* @returns The transaction builder.
|
|
44
|
+
* @see {@link https://meshjs.dev/apis/transaction#sendAssets}
|
|
45
|
+
*/
|
|
46
|
+
sendAssets(recipient: Recipient, assets: Asset[]): Transaction;
|
|
47
|
+
/**
|
|
48
|
+
* Adds a transaction output to the transaction.
|
|
49
|
+
*
|
|
50
|
+
* @param {Recipient} recipient The recipient of the transaction.
|
|
51
|
+
* @param {string} lovelace The amount of lovelace to send.
|
|
52
|
+
* @returns {Transaction} The Transaction object.
|
|
53
|
+
* @see {@link https://meshjs.dev/apis/transaction#sendAda}
|
|
54
|
+
*/
|
|
55
|
+
sendLovelace(recipient: Recipient, lovelace: string): Transaction;
|
|
56
|
+
/**
|
|
57
|
+
* Adds stable coins transaction output to the transaction.
|
|
58
|
+
* @param {Recipient} recipient The recipient of the transaction.
|
|
59
|
+
* @param {Token} ticker The ticker of the token to send.
|
|
60
|
+
* @param {string} amount The amount of the token to send.
|
|
61
|
+
* @returns {Transaction} The Transaction object.
|
|
62
|
+
* @see {@link https://meshjs.dev/apis/transaction#sendToken}
|
|
63
|
+
*/
|
|
64
|
+
sendToken(recipient: Recipient, ticker: Token, amount: string): Transaction;
|
|
65
|
+
/**
|
|
66
|
+
* Adds an output to the transaction.
|
|
67
|
+
*
|
|
68
|
+
* @param {Recipient} recipient The recipient of the output.
|
|
69
|
+
* @param {UTxO} value The UTxO value of the output.
|
|
70
|
+
* @returns {Transaction} The Transaction object.
|
|
71
|
+
*/
|
|
72
|
+
sendValue(recipient: Recipient, value: UTxO): Transaction;
|
|
73
|
+
/**
|
|
74
|
+
* Sets the change address for the transaction.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} changeAddress The change address.
|
|
77
|
+
* @returns {Transaction} The Transaction object.
|
|
78
|
+
*/
|
|
79
|
+
setChangeAddress(changeAddress: string): Transaction;
|
|
80
|
+
/**
|
|
81
|
+
* Sets the collateral for the transaction.
|
|
82
|
+
*
|
|
83
|
+
* @param {UTxO[]} collateral - Set the UTxO for collateral.
|
|
84
|
+
* @returns {Transaction} The Transaction object.
|
|
85
|
+
*/
|
|
86
|
+
setCollateral(collateral: UTxO[]): Transaction;
|
|
87
|
+
/**
|
|
88
|
+
* Add a JSON metadata entry to the transaction.
|
|
89
|
+
*
|
|
90
|
+
* @param {number} key The key to use for the metadata entry.
|
|
91
|
+
* @param {unknown} value The value to use for the metadata entry.
|
|
92
|
+
* @returns {Transaction} The Transaction object.
|
|
93
|
+
* @see {@link https://meshjs.dev/apis/transaction#setMetadata}
|
|
94
|
+
*/
|
|
95
|
+
setMetadata(key: number, value: unknown): Transaction;
|
|
96
|
+
/**
|
|
97
|
+
* Sets the required signers for the transaction.
|
|
98
|
+
*
|
|
99
|
+
* @param {string[]} addresses The addresses of the required signers.
|
|
100
|
+
* @returns {Transaction} The Transaction object.
|
|
101
|
+
*/
|
|
102
|
+
setRequiredSigners(addresses: string[]): Transaction;
|
|
103
|
+
/**
|
|
104
|
+
* Sets the start slot for the transaction.
|
|
105
|
+
*
|
|
106
|
+
* @param {string} slot The start slot for the transaction.
|
|
107
|
+
* @returns {Transaction} The Transaction object.
|
|
108
|
+
* @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
|
|
109
|
+
*/
|
|
110
|
+
setTimeToStart(slot: string): Transaction;
|
|
111
|
+
/**
|
|
112
|
+
* Set the time to live for the transaction.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} slot The slot number to expire the transaction at.
|
|
115
|
+
* @returns {Transaction} The Transaction object.
|
|
116
|
+
* @see {@link https://meshjs.dev/apis/transaction#setTimeLimit}
|
|
117
|
+
*/
|
|
118
|
+
setTimeToExpire(slot: string): Transaction;
|
|
119
|
+
/**
|
|
120
|
+
* Sets the inputs for the transaction.
|
|
121
|
+
*
|
|
122
|
+
* @param {UTxO[]} inputs The inputs to set.
|
|
123
|
+
* @returns {Transaction} The transaction.
|
|
124
|
+
*/
|
|
125
|
+
setTxInputs(inputs: UTxO[]): Transaction;
|
|
126
|
+
/**
|
|
127
|
+
* Sets the reference inputs for the transaction.
|
|
128
|
+
*
|
|
129
|
+
* @param {UTxO[]} inputs The reference inputs to set.
|
|
130
|
+
* @returns {Transaction} The transaction.
|
|
131
|
+
*/
|
|
132
|
+
setTxRefInputs(inputs: UTxO[]): Transaction;
|
|
133
|
+
withdrawRewards(rewardAddress: string, lovelace: string): Transaction;
|
|
134
|
+
private addBurnInputsIfNeeded;
|
|
135
|
+
private addChangeAddress;
|
|
136
|
+
private addCollateralIfNeeded;
|
|
137
|
+
private addRequiredSignersIfNeeded;
|
|
138
|
+
private addTxInputsAsNeeded;
|
|
139
|
+
private forgeAssetsIfNeeded;
|
|
140
|
+
private filterAvailableUTxOs;
|
|
141
|
+
private addMintOutputs;
|
|
142
|
+
private notVisited;
|
|
143
|
+
private setTxOutput;
|
|
144
|
+
}
|
|
145
|
+
declare type CreateTxOptions = {
|
|
146
|
+
initiator: IInitiator;
|
|
147
|
+
parameters: Protocol;
|
|
148
|
+
era: Era;
|
|
149
|
+
};
|
|
150
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { REDEEMER_TAGS } from '@mesh/common/constants';
|
|
2
|
+
import { Data } from './Data';
|
|
3
|
+
export declare type Action = {
|
|
4
|
+
data: Data;
|
|
5
|
+
index: number;
|
|
6
|
+
budget: Budget;
|
|
7
|
+
tag: keyof typeof REDEEMER_TAGS;
|
|
8
|
+
};
|
|
9
|
+
export declare type Budget = {
|
|
10
|
+
mem: number;
|
|
11
|
+
steps: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { MetadataStandard, Files, RoyaltiesStandard } from '@mesh/core';
|
|
2
|
+
export declare type AssetMetadata = FungibleAssetMetadata | NonFungibleAssetMetadata | RoyaltiesStandard;
|
|
3
|
+
export declare type FungibleAssetMetadata = MetadataStandard & {
|
|
4
|
+
ticker: string;
|
|
5
|
+
decimals: number;
|
|
6
|
+
version: `${number}.${number}`;
|
|
7
|
+
};
|
|
8
|
+
export declare type NonFungibleAssetMetadata = AudioAssetMetadata | ImageAssetMetadata | SmartAssetMetadata | VideoAssetMetadata;
|
|
9
|
+
declare type AudioAssetMetadata = MetadataStandard & Files;
|
|
10
|
+
export declare type ImageAssetMetadata = MetadataStandard & Files & {
|
|
11
|
+
artists?: [
|
|
12
|
+
{
|
|
13
|
+
name: string;
|
|
14
|
+
twitter?: `https://twitter.com/${string}`;
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
attributes?: {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
};
|
|
20
|
+
traits?: string[];
|
|
21
|
+
};
|
|
22
|
+
declare type SmartAssetMetadata = MetadataStandard & Files;
|
|
23
|
+
declare type VideoAssetMetadata = MetadataStandard & Files;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare type BlockInfo = {
|
|
2
|
+
time: number;
|
|
3
|
+
hash: string;
|
|
4
|
+
slot: string;
|
|
5
|
+
epoch: number;
|
|
6
|
+
epochSlot: string;
|
|
7
|
+
slotLeader: string;
|
|
8
|
+
size: number;
|
|
9
|
+
txCount: number;
|
|
10
|
+
output: string;
|
|
11
|
+
fees: string;
|
|
12
|
+
previousBlock: string;
|
|
13
|
+
nextBlock: string;
|
|
14
|
+
confirmations: number;
|
|
15
|
+
operationalCertificate: string;
|
|
16
|
+
VRFKey: string;
|
|
17
|
+
};
|