@meshsdk/contract 1.7.9 → 1.7.11

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
@@ -1,6 +1,6 @@
1
1
  import * as _meshsdk_common from '@meshsdk/common';
2
- import { ConStr0, PubKeyAddress, Value, ConStr1, Integer as Integer$1, CurrencySymbol, TokenName, Asset as Asset$1, UTxO as UTxO$1, BuiltinByteString as BuiltinByteString$1 } from '@meshsdk/common';
3
- import { MeshTxBuilder, IFetcher, BrowserWallet, MeshWallet, LanguageVersion, UTxO, Asset, ConStr0 as ConStr0$1, Integer, BuiltinByteString } from '@meshsdk/core';
2
+ import { ConStr0 as ConStr0$1, PubKeyAddress, Value, ConStr1, Integer as Integer$1, CurrencySymbol, TokenName, AssetMetadata, Asset as Asset$1, UTxO as UTxO$1, BuiltinByteString as BuiltinByteString$1 } from '@meshsdk/common';
3
+ import { MeshTxBuilder, IFetcher, BrowserWallet, MeshWallet, LanguageVersion, UTxO, ConStr0, BuiltinByteString, ScriptAddress, Integer, NativeScript, Data, Asset } from '@meshsdk/core';
4
4
 
5
5
  type MeshTxInitiatorInput = {
6
6
  mesh: MeshTxBuilder;
@@ -19,6 +19,7 @@ declare class MeshTxInitiator {
19
19
  version: number;
20
20
  languageVersion: LanguageVersion;
21
21
  constructor({ mesh, fetcher, wallet, networkId, stakeCredential, version, }: MeshTxInitiatorInput);
22
+ getScriptAddress: (scriptCbor: string) => string;
22
23
  protected signSubmitReset: () => Promise<string | undefined>;
23
24
  protected queryUtxos: (walletAddress: string) => Promise<UTxO[]>;
24
25
  protected getWalletDappAddress: () => Promise<string | undefined>;
@@ -35,144 +36,325 @@ declare class MeshTxInitiator {
35
36
  protected _getUtxoByTxHash: (txHash: string, scriptCbor?: string) => Promise<UTxO | undefined>;
36
37
  }
37
38
 
38
- declare const MeshEscrowBlueprint: {
39
- preamble: {
40
- title: string;
41
- description: string;
42
- version: string;
43
- plutusVersion: string;
44
- compiler: {
45
- name: string;
46
- version: string;
47
- };
48
- license: string;
39
+ type ScriptIndex = "OracleNFT" | "OracleValidator" | "ContentRegistry" | "ContentRefToken" | "OwnershipRegistry" | "OwnershipRefToken";
40
+
41
+ type OracleDatum = ConStr0<[
42
+ BuiltinByteString,
43
+ ScriptAddress,
44
+ BuiltinByteString,
45
+ ScriptAddress,
46
+ Integer,
47
+ BuiltinByteString,
48
+ ScriptAddress,
49
+ Integer,
50
+ BuiltinByteString,
51
+ BuiltinByteString
52
+ ]>;
53
+ type UpdateContent = {
54
+ ownerTokenUtxo: UTxO;
55
+ registryNumber: number;
56
+ newContentHashHex: string;
57
+ contentNumber: number;
58
+ };
59
+ type TransferContent = {
60
+ ownerTokenUtxo: UTxO;
61
+ registryNumber: number;
62
+ newOwnerAssetHex: string;
63
+ contentNumber: number;
64
+ };
65
+
66
+ /**
67
+ * Mesh Content Ownership Contract
68
+ *
69
+ * This contract is used to manage the ownership of content.
70
+ * It facilitates on-chain record of content (i.e. file on IPFS) ownership and transfer.
71
+ * While one cannot prefer others from obtaining a copy of the content, the app owner of the
72
+ * contract can serve the single source of truth of who owns the content. With the blockchain
73
+ * trace and record in place, it provides a trustless way to verify the ownership of the content
74
+ * and facilitates further application logics such as royalties, licensing, etc.
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const meshTxBuilder = new MeshTxBuilder({
79
+ * fetcher: blockchainProvider, // one of the Providers
80
+ * submitter: blockchainProvider,
81
+ * verbose: true,
82
+ * });
83
+ *
84
+ * const contract = new MeshContentOwnershipContract(
85
+ * {
86
+ * mesh: meshTxBuilder,
87
+ * fetcher: blockchainProvider,
88
+ * wallet: wallet,
89
+ * networkId: 0,
90
+ * },
91
+ * {
92
+ * operationAddress: operationAddress, // the address of the app owner, where most of the actions should be signed by the spending key of this address
93
+ * paramUtxo: { outputIndex: 0, txHash: "0000000000000000000000000000000000000000000000000000000000000000" }, // you can get this from the output of `mintOneTimeMintingPolicy()` transaction
94
+ * refScriptUtxos?: { // you can get these from the output of `sendRefScriptOnchain()` transactions
95
+ * contentRegistry: { outputIndex: 0, txHash: "0000000000000000000000000000000000000000000000000000000000000000" },
96
+ * contentRefToken: { outputIndex: 0, txHash: "0000000000000000000000000000000000000000000000000000000000000000" },
97
+ * ownershipRegistry: { outputIndex: 0, txHash: "0000000000000000000000000000000000000000000000000000000000000000" },
98
+ * ownershipRefToken: { outputIndex: 0, txHash: "0000000000000000000000000000000000000000000000000000000000000000" },
99
+ * },
100
+ * },
101
+ * );
102
+ * ```
103
+ */
104
+ declare class MeshContentOwnershipContract extends MeshTxInitiator {
105
+ paramUtxo: {
106
+ txHash: string;
107
+ outputIndex: number;
49
108
  };
50
- validators: {
51
- title: string;
52
- datum: {
53
- title: string;
54
- schema: {
55
- $ref: string;
56
- };
109
+ scriptInfo: {
110
+ oracleNFT: {
111
+ hash: string;
112
+ cbor: string;
113
+ };
114
+ oracleValidator: {
115
+ hash: string;
116
+ cbor: string;
117
+ address: string;
118
+ };
119
+ contentRegistry: {
120
+ hash: string;
121
+ cbor: string;
122
+ address: string;
123
+ };
124
+ contentRefToken: {
125
+ hash: string;
126
+ cbor: string;
127
+ };
128
+ ownershipRegistry: {
129
+ hash: string;
130
+ cbor: string;
131
+ address: string;
132
+ };
133
+ ownershipRefToken: {
134
+ hash: string;
135
+ cbor: string;
57
136
  };
58
- redeemer: {
59
- title: string;
60
- schema: {
61
- $ref: string;
62
- };
63
- };
64
- compiledCode: string;
65
- hash: string;
66
- }[];
67
- definitions: {
68
- ByteArray: {
69
- dataType: string;
70
- };
71
- Int: {
72
- dataType: string;
73
- };
74
- List$Pair$ByteArray_Int: {
75
- dataType: string;
76
- keys: {
77
- $ref: string;
78
- };
79
- values: {
80
- $ref: string;
81
- };
82
- };
83
- List$Pair$ByteArray_List$Pair$ByteArray_Int: {
84
- dataType: string;
85
- keys: {
86
- $ref: string;
87
- };
88
- values: {
89
- $ref: string;
90
- };
91
- };
92
- "Option$aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
93
- title: string;
94
- anyOf: {
95
- title: string;
96
- description: string;
97
- dataType: string;
98
- index: number;
99
- fields: {
100
- $ref: string;
101
- }[];
102
- }[];
103
- };
104
- "aiken/transaction/credential/Address": {
105
- title: string;
106
- description: string;
107
- anyOf: {
108
- title: string;
109
- dataType: string;
110
- index: number;
111
- fields: {
112
- title: string;
113
- $ref: string;
114
- }[];
115
- }[];
116
- };
117
- "aiken/transaction/credential/Credential": {
118
- title: string;
119
- description: string;
120
- anyOf: {
121
- title: string;
122
- dataType: string;
123
- index: number;
124
- fields: {
125
- $ref: string;
126
- }[];
127
- }[];
137
+ };
138
+ refScriptUtxos: {
139
+ contentRefToken: {
140
+ txHash: string;
141
+ outputIndex: number;
128
142
  };
129
- "aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
130
- title: string;
131
- description: string;
132
- anyOf: ({
133
- title: string;
134
- dataType: string;
135
- index: number;
136
- fields: {
137
- $ref: string;
138
- }[];
139
- } | {
140
- title: string;
141
- dataType: string;
142
- index: number;
143
- fields: {
144
- title: string;
145
- $ref: string;
146
- }[];
147
- })[];
143
+ ownershipRefToken: {
144
+ txHash: string;
145
+ outputIndex: number;
148
146
  };
149
- "escrow/types/EscrowDatum": {
150
- title: string;
151
- anyOf: {
152
- title: string;
153
- dataType: string;
154
- index: number;
155
- fields: {
156
- title: string;
157
- $ref: string;
158
- }[];
159
- }[];
147
+ contentRegistry: {
148
+ txHash: string;
149
+ outputIndex: number;
160
150
  };
161
- "escrow/types/EscrowRedeemer": {
162
- title: string;
163
- anyOf: {
164
- title: string;
165
- dataType: string;
166
- index: number;
167
- fields: {
168
- title: string;
169
- $ref: string;
170
- }[];
171
- }[];
151
+ ownershipRegistry: {
152
+ txHash: string;
153
+ outputIndex: number;
172
154
  };
173
155
  };
174
- };
175
- type InitiationDatum = ConStr0<[PubKeyAddress, Value]>;
156
+ operationAddress: string;
157
+ opsKey: string;
158
+ constructor(inputs: MeshTxInitiatorInput, contract: {
159
+ operationAddress: string;
160
+ paramUtxo?: UTxO["input"];
161
+ refScriptUtxos?: {
162
+ contentRegistry: UTxO["input"];
163
+ contentRefToken: UTxO["input"];
164
+ ownershipRegistry: UTxO["input"];
165
+ ownershipRefToken: UTxO["input"];
166
+ };
167
+ });
168
+ getOwnerNativeScript: () => {
169
+ nativeScript: {
170
+ type: "all" | "any";
171
+ scripts: NativeScript[];
172
+ };
173
+ scriptAddress: string;
174
+ };
175
+ /**
176
+ * [Setup phase]
177
+ * This is the first transaction you need to setup the contract.
178
+ *
179
+ * This transaction mints the one-time minting policy (a NFT) for the contract.
180
+ * It will be attached with the datum which serves as the single source of truth for the contract oracle.
181
+ *
182
+ * Note: You must save the `paramUtxo` for future transactions.
183
+ *
184
+ * @returns {Promise<{ txHexMintOneTimeMintingPolicy: string, txHexSetupOracleUtxo: string, paramUtxo: UTxO["input"] }>}
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * const { tx, paramUtxo } = await contract.mintOneTimeMintingPolicy();
189
+ * const signedTx = await wallet.signTx(tx);
190
+ * const txHash = await wallet.submitTx(signedTx);
191
+ * ```
192
+ */
193
+ mintOneTimeMintingPolicy: () => Promise<{
194
+ tx: string;
195
+ paramUtxo: {
196
+ outputIndex: number;
197
+ txHash: string;
198
+ };
199
+ }>;
200
+ /**
201
+ * [Setup phase]
202
+ * This is the second transaction you need to setup the contract.
203
+ *
204
+ * This transaction send the NFT to a oracle contract locking the datum,
205
+ * which serves as the single source of truth for the contract oracle with data integrity.
206
+ *
207
+ * Note: You must provide the `paramUtxo` from the `mintOneTimeMintingPolicy` transaction.
208
+ *
209
+ * @returns {Promise<string>}
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * const txHex = await contract.setupOracleUtxo();
214
+ * const signedTx = await wallet.signTx(txHex);
215
+ * const txHash = await wallet.submitTx(signedTx);
216
+ * ```
217
+ */
218
+ setupOracleUtxo: () => Promise<string>;
219
+ /**
220
+ * [Setup phase]
221
+ * This are the next transactions you need to setup the contract.
222
+ * You need to run once for each script, and you would likely have to run one after the previous one is confirmed.
223
+ *
224
+ * This transaction sends the reference scripts to the blockchain for later transactions,
225
+ * boosting efficiency and avoid exceeding 16kb of transaction size limits enforced by protocol parameter.
226
+ *
227
+ * Note: You must provide the `paramUtxo` from the `mintOneTimeMintingPolicy` transaction.
228
+ * Note: You must save txHash (after signed and submitted) for `ContentRegistry`, `ContentRefToken`, `OwnershipRegistry`, `OwnershipRefToken` transactions for future transactions.
229
+ *
230
+ * @param scriptIndex - "OracleNFT" | "OracleValidator" | "ContentRegistry" | "ContentRefToken" | "OwnershipRegistry" | "OwnershipRefToken"
231
+ * @returns {Promise<string>}
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * const txHexOracleNFT = await contract.sendRefScriptOnchain("OracleNFT");
236
+ * const signedTxOracleNFT = await wallet.signTx(txHexOracleNFT);
237
+ * const txHashOracleNFT = await wallet.submitTx(signedTxOracleNFT);
238
+ *
239
+ * const txHexOracleValidator = await contract.sendRefScriptOnchain("OracleValidator");
240
+ * ... // repeat for each script
241
+ *
242
+ * const txHexOwnershipRefToken = await contract.sendRefScriptOnchain("OwnershipRefToken");
243
+ * const signedTxOwnershipRefToken = await wallet.signTx(txHexOwnershipRefToken);
244
+ * const txHashOwnershipRefToken = await wallet.submitTx(signedTxOwnershipRefToken);
245
+ * ```
246
+ */
247
+ sendRefScriptOnchain: (scriptIndex: ScriptIndex) => Promise<string>;
248
+ /**
249
+ * [Setup phase]
250
+ * This is the next transaction you need to setup the contract after completing all the `sendRefScriptOnchain` transactions.
251
+ *
252
+ * This transaction creates one content registry. Each registry should comes in pair with one ownership registry and
253
+ * each pair of registry serves around 50 records of content ownership. The application can be scaled indefinitely
254
+ * according to the number of parallelization needed and volumes of content expected to be managed.
255
+ *
256
+ * Note: You must provide the `paramUtxo` from the `mintOneTimeMintingPolicy` transaction.
257
+ * Note: You must provide the txHash for `ContentRegistry`, `ContentRefToken`, `OwnershipRegistry`, `OwnershipRefToken`
258
+ *
259
+ * @returns {Promise<string>}
260
+ *
261
+ * @example
262
+ * ```typescript
263
+ * const txHex = await contract.createContentRegistry();
264
+ * const signedTx = await wallet.signTx(txHex);
265
+ * const txHash = await wallet.submitTx(signedTx);
266
+ * ```
267
+ */
268
+ createContentRegistry: () => Promise<string>;
269
+ /**
270
+ * [Setup phase]
271
+ * This is the last transaction you need to setup the contract after completing all the `sendRefScriptOnchain` transactions.
272
+ *
273
+ * This transaction creates one content registry. Each registry should comes in pair with one content registry and
274
+ * each pair of registry serves around 50 records of content ownership. The application can be scaled indefinitely
275
+ * according to the number of parallelization needed and volumes of content expected to be managed.
276
+ *
277
+ * Note: You must provide the `paramUtxo` from the `mintOneTimeMintingPolicy` transaction.
278
+ * Note: You must provide the txHash for `ContentRegistry`, `ContentRefToken`, `OwnershipRegistry`, `OwnershipRefToken`
279
+ *
280
+ * @returns {Promise<string>}
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * const txHex = await contract.createOwnershipRegistry();
285
+ * const signedTx = await wallet.signTx(txHex);
286
+ * const txHash = await wallet.submitTx(signedTx);
287
+ * ```
288
+ */
289
+ createOwnershipRegistry: () => Promise<string>;
290
+ /**
291
+ * Get the current oracle data.
292
+ *
293
+ * @returns {Promise<{
294
+ * contentNumber: number,
295
+ * ownershipNumber: number,
296
+ * }>}
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * const oracleData = await contract.getOracleData();
301
+ * ```
302
+ */
303
+ getOracleData: () => Promise<{
304
+ contentNumber: number;
305
+ ownershipNumber: number;
306
+ }>;
307
+ /**
308
+ * [User]
309
+ *
310
+ * This transaction mints a user token which can be used to represent the ownership of the content. This token is used in `createContent()` transaction.
311
+ *
312
+ * @param tokenName - The name of the token that you can specify.
313
+ * @param tokenMetadata - The metadata of the token that you can specify.
314
+ * @returns {Promise<string>}
315
+ *
316
+ * @example
317
+ * ```typescript
318
+ * const tx = await contract.mintUserToken("MeshContentOwnership", {
319
+ * name: "Mesh Content Ownership",
320
+ * description: "Demo at https://meshjs.dev/smart-contracts/content-ownership",
321
+ * });
322
+ * const signedTx = await wallet.signTx(tx, true);
323
+ * const txHash = await wallet.submitTx(signedTx);
324
+ */
325
+ mintUserToken: (tokenName: string, tokenMetadata?: {}) => Promise<string>;
326
+ /**
327
+ *
328
+ * @param ownerAssetHex
329
+ * @param contentHashHex
330
+ * @param registryNumber
331
+ * @returns
332
+ */
333
+ createContent: (ownerAssetHex: string, contentHashHex: string, registryNumber?: number) => Promise<string>;
334
+ /**
335
+ * Get the content at the registry given the registry number and content number.
336
+ * @param registryNumber
337
+ * @param contentNumber
338
+ * @returns
339
+ */
340
+ getContent: (registryNumber: number, contentNumber: number) => Promise<string>;
341
+ updateContent: ({ ownerTokenUtxo, registryNumber, newContentHashHex, contentNumber, }: UpdateContent) => Promise<string>;
342
+ transferContent: ({ ownerTokenUtxo, registryNumber, newOwnerAssetHex, contentNumber, }: TransferContent) => Promise<string>;
343
+ stopContentRegistry: (registryNumber: number) => Promise<string>;
344
+ stopOwnershipRegistry: (registryNumber: number) => Promise<string>;
345
+ stopOracle: (txInHash: string, txInId: number) => Promise<string>;
346
+ protected getCurrentOracleDatum: (utxos?: UTxO[]) => Promise<OracleDatum>;
347
+ protected getOracleDatum: (contentRegistryCount: number, ownershipRegistryCount: number) => _meshsdk_common.MConStr0<Data[]>;
348
+ protected getContentDatum: (contentArray: string[]) => _meshsdk_common.MConStr0<(number | string[])[]>;
349
+ protected getOwnershipDatum: (ownershipArray: [string, string][]) => _meshsdk_common.MConStr0<(number | [string, string][])[]>;
350
+ getScriptUtxos: (registryNumber: number, toFetch?: ("oracle" | "content" | "ownership")[]) => Promise<(UTxO | undefined)[]>;
351
+ private insertContentRegistry;
352
+ private insertOwnershipRegistry;
353
+ private updateContentRegistry;
354
+ private updateOwnershipRegistry;
355
+ }
356
+
357
+ type InitiationDatum = ConStr0$1<[PubKeyAddress, Value]>;
176
358
  declare const initiateEscrowDatum: (walletAddress: string, amount: Asset[]) => InitiationDatum;
177
359
  type ActiveEscrowDatum = ConStr1<[
178
360
  PubKeyAddress,
@@ -181,11 +363,13 @@ type ActiveEscrowDatum = ConStr1<[
181
363
  Value
182
364
  ]>;
183
365
  declare const activeEscrowDatum: (initiationDatum: InitiationDatum, walletAddress: string, amount: Asset[]) => ActiveEscrowDatum;
184
- type RecipientDepositRedeemer = ConStr0<[PubKeyAddress, Value]>;
366
+ type RecipientDepositRedeemer = ConStr0$1<[PubKeyAddress, Value]>;
185
367
  declare const recipientDepositRedeemer: (recipient: string, depositAmount: Asset[]) => InitiationDatum;
186
368
  declare class MeshEscrowContract extends MeshTxInitiator {
187
369
  scriptCbor: string;
370
+ scriptAddress: string;
188
371
  constructor(inputs: MeshTxInitiatorInput);
372
+ getScriptCbor: () => string;
189
373
  initiateEscrow: (escrowAmount: Asset[]) => Promise<string>;
190
374
  cancelEscrow: (escrowUtxo: UTxO) => Promise<string>;
191
375
  recipientDeposit: (escrowUtxo: UTxO, depositAmount: Asset[]) => Promise<string>;
@@ -196,212 +380,30 @@ declare class MeshEscrowContract extends MeshTxInitiator {
196
380
  declare class MeshGiftCardContract extends MeshTxInitiator {
197
381
  tokenNameHex: string;
198
382
  paramUtxo: UTxO["input"];
383
+ constructor(inputs: MeshTxInitiatorInput, tokenNameHex?: string, paramUtxo?: UTxO["input"]);
199
384
  giftCardCbor: (tokenNameHex: string, utxoTxHash: string, utxoTxId: number) => string;
200
385
  redeemCbor: (tokenNameHex: string, policyId: string) => string;
201
- constructor(inputs: MeshTxInitiatorInput, tokenNameHex?: string, paramUtxo?: UTxO["input"]);
202
386
  createGiftCard: (tokenName: string, giftValue: Asset[]) => Promise<string>;
203
387
  redeemGiftCard: (giftCardUtxo: UTxO) => Promise<string>;
204
388
  getUtxoByTxHash: (txHash: string) => Promise<UTxO | undefined>;
205
389
  }
206
390
 
207
- type HelloWorldDatum = ConStr0$1<[
391
+ type HelloWorldDatum = ConStr0<[
208
392
  Integer,
209
393
  BuiltinByteString,
210
394
  BuiltinByteString
211
395
  ]>;
212
- declare const MeshHelloWorldBlueprint: {
213
- preamble: {
214
- title: string;
215
- description: string;
216
- version: string;
217
- plutusVersion: string;
218
- compiler: {
219
- name: string;
220
- version: string;
221
- };
222
- license: string;
223
- };
224
- validators: {
225
- title: string;
226
- datum: {
227
- title: string;
228
- schema: {
229
- $ref: string;
230
- };
231
- };
232
- redeemer: {
233
- title: string;
234
- schema: {
235
- $ref: string;
236
- };
237
- };
238
- compiledCode: string;
239
- hash: string;
240
- }[];
241
- definitions: {
242
- ByteArray: {
243
- dataType: string;
244
- };
245
- "hello_world/Datum": {
246
- title: string;
247
- anyOf: {
248
- title: string;
249
- dataType: string;
250
- index: number;
251
- fields: {
252
- title: string;
253
- $ref: string;
254
- }[];
255
- }[];
256
- };
257
- "hello_world/Redeemer": {
258
- title: string;
259
- anyOf: {
260
- title: string;
261
- dataType: string;
262
- index: number;
263
- fields: {
264
- title: string;
265
- $ref: string;
266
- }[];
267
- }[];
268
- };
269
- };
270
- };
271
396
  declare class MeshHelloWorldContract extends MeshTxInitiator {
272
397
  scriptCbor: string;
398
+ scriptAddress: string;
273
399
  constructor(inputs: MeshTxInitiatorInput);
274
- getScript: () => {
275
- scriptAddr: string;
276
- };
400
+ getScriptCbor: () => string;
277
401
  lockAsset: (assets: Asset[]) => Promise<string>;
278
402
  unlockAsset: (scriptUtxo: UTxO, message: string) => Promise<string>;
279
403
  getUtxoByTxHash: (txHash: string) => Promise<UTxO | undefined>;
280
404
  }
281
405
 
282
- declare const MeshMarketplaceBlueprint: {
283
- preamble: {
284
- title: string;
285
- description: string;
286
- version: string;
287
- plutusVersion: string;
288
- compiler: {
289
- name: string;
290
- version: string;
291
- };
292
- license: string;
293
- };
294
- validators: {
295
- title: string;
296
- datum: {
297
- title: string;
298
- schema: {
299
- $ref: string;
300
- };
301
- };
302
- redeemer: {
303
- title: string;
304
- schema: {
305
- $ref: string;
306
- };
307
- };
308
- parameters: {
309
- title: string;
310
- schema: {
311
- $ref: string;
312
- };
313
- }[];
314
- compiledCode: string;
315
- hash: string;
316
- }[];
317
- definitions: {
318
- ByteArray: {
319
- dataType: string;
320
- };
321
- Int: {
322
- dataType: string;
323
- };
324
- "Option$aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
325
- title: string;
326
- anyOf: {
327
- title: string;
328
- description: string;
329
- dataType: string;
330
- index: number;
331
- fields: {
332
- $ref: string;
333
- }[];
334
- }[];
335
- };
336
- "aiken/transaction/credential/Address": {
337
- title: string;
338
- description: string;
339
- anyOf: {
340
- title: string;
341
- dataType: string;
342
- index: number;
343
- fields: {
344
- title: string;
345
- $ref: string;
346
- }[];
347
- }[];
348
- };
349
- "aiken/transaction/credential/Credential": {
350
- title: string;
351
- description: string;
352
- anyOf: {
353
- title: string;
354
- dataType: string;
355
- index: number;
356
- fields: {
357
- $ref: string;
358
- }[];
359
- }[];
360
- };
361
- "aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
362
- title: string;
363
- description: string;
364
- anyOf: ({
365
- title: string;
366
- dataType: string;
367
- index: number;
368
- fields: {
369
- $ref: string;
370
- }[];
371
- } | {
372
- title: string;
373
- dataType: string;
374
- index: number;
375
- fields: {
376
- title: string;
377
- $ref: string;
378
- }[];
379
- })[];
380
- };
381
- "marketplace/types/MarketplaceDatum": {
382
- title: string;
383
- anyOf: {
384
- title: string;
385
- dataType: string;
386
- index: number;
387
- fields: {
388
- title: string;
389
- $ref: string;
390
- }[];
391
- }[];
392
- };
393
- "marketplace/types/MarketplaceRedeemer": {
394
- title: string;
395
- anyOf: {
396
- title: string;
397
- dataType: string;
398
- index: number;
399
- fields: never[];
400
- }[];
401
- };
402
- };
403
- };
404
- type MarketplaceDatum = ConStr0<[
406
+ type MarketplaceDatum = ConStr0$1<[
405
407
  PubKeyAddress,
406
408
  Integer$1,
407
409
  CurrencySymbol,
@@ -412,245 +414,122 @@ declare class MeshMarketplaceContract extends MeshTxInitiator {
412
414
  ownerAddress: string;
413
415
  feePercentageBasisPoint: number;
414
416
  scriptCbor: string;
417
+ scriptAddress: string;
415
418
  constructor(inputs: MeshTxInitiatorInput, ownerAddress: string, feePercentageBasisPoint: number);
419
+ getScriptCbor: (pubKeyHash: string, stakeCredentialHash: string, feePercentageBasisPoint: number) => string;
416
420
  listAsset: (asset: string, price: number) => Promise<string>;
417
421
  delistAsset: (marketplaceUtxo: UTxO) => Promise<string>;
418
422
  purchaseAsset: (marketplaceUtxo: UTxO) => Promise<string>;
419
423
  relistAsset: (marketplaceUtxo: UTxO, newPrice: number) => Promise<string>;
420
424
  getUtxoByTxHash: (txHash: string) => Promise<UTxO | undefined>;
425
+ static getCompiledCode: (version?: number) => string;
421
426
  }
422
427
 
423
- declare const MeshPaymentSplitterBlueprint: {
424
- preamble: {
425
- title: string;
426
- description: string;
427
- version: string;
428
- plutusVersion: string;
429
- compiler: {
430
- name: string;
431
- version: string;
432
- };
433
- license: string;
434
- };
435
- validators: {
436
- title: string;
437
- datum: {
438
- title: string;
439
- schema: {
440
- $ref: string;
441
- };
442
- };
443
- redeemer: {
444
- title: string;
445
- schema: {
446
- $ref: string;
447
- };
448
- };
449
- parameters: {
450
- title: string;
451
- schema: {
452
- $ref: string;
453
- };
454
- }[];
455
- compiledCode: string;
456
- hash: string;
457
- }[];
458
- definitions: {
459
- ByteArray: {
460
- dataType: string;
461
- };
462
- List$ByteArray: {
463
- dataType: string;
464
- items: {
465
- $ref: string;
466
- };
467
- };
468
- "payment_splitter/Datum": {
469
- title: string;
470
- anyOf: {
471
- title: string;
472
- dataType: string;
473
- index: number;
474
- fields: {
475
- title: string;
476
- $ref: string;
477
- }[];
478
- }[];
479
- };
480
- "payment_splitter/Redeemer": {
481
- title: string;
482
- anyOf: {
483
- title: string;
484
- dataType: string;
485
- index: number;
486
- fields: {
487
- title: string;
488
- $ref: string;
489
- }[];
490
- }[];
491
- };
492
- };
493
- };
494
428
  declare class MeshPaymentSplitterContract extends MeshTxInitiator {
495
- wrapPayees: (payees: string[]) => _meshsdk_common.List<_meshsdk_common.BuiltinByteString>;
496
- scriptCbor: () => string;
429
+ scriptCbor: string;
430
+ scriptAddress: string;
497
431
  payees: string[];
432
+ wrapPayees: (payees: string[]) => _meshsdk_common.List<_meshsdk_common.BuiltinByteString>;
498
433
  constructor(inputs: MeshTxInitiatorInput, payees: string[]);
434
+ getScriptCbor: () => string;
499
435
  sendLovelaceToSplitter: (lovelaceAmount: number) => Promise<string>;
500
436
  triggerPayout: () => Promise<string>;
501
437
  }
502
438
 
503
- declare const MeshSwapBlueprint: {
504
- preamble: {
505
- title: string;
506
- description: string;
507
- version: string;
508
- plutusVersion: string;
509
- compiler: {
510
- name: string;
511
- version: string;
512
- };
513
- license: string;
514
- };
515
- validators: {
516
- title: string;
517
- datum: {
518
- title: string;
519
- schema: {
520
- $ref: string;
521
- };
522
- };
523
- redeemer: {
524
- title: string;
525
- schema: {
526
- $ref: string;
527
- };
528
- };
529
- compiledCode: string;
530
- hash: string;
531
- }[];
532
- definitions: {
533
- ByteArray: {
534
- dataType: string;
535
- };
536
- Int: {
537
- dataType: string;
538
- };
539
- List$Pair$ByteArray_Int: {
540
- dataType: string;
541
- keys: {
542
- $ref: string;
543
- };
544
- values: {
545
- $ref: string;
546
- };
547
- };
548
- List$Pair$ByteArray_List$Pair$ByteArray_Int: {
549
- dataType: string;
550
- keys: {
551
- $ref: string;
552
- };
553
- values: {
554
- $ref: string;
555
- };
556
- };
557
- "Option$aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
558
- title: string;
559
- anyOf: {
560
- title: string;
561
- description: string;
562
- dataType: string;
563
- index: number;
564
- fields: {
565
- $ref: string;
566
- }[];
567
- }[];
568
- };
569
- "aiken/transaction/credential/Address": {
570
- title: string;
571
- description: string;
572
- anyOf: {
573
- title: string;
574
- dataType: string;
575
- index: number;
576
- fields: {
577
- title: string;
578
- $ref: string;
579
- }[];
580
- }[];
581
- };
582
- "aiken/transaction/credential/Credential": {
583
- title: string;
584
- description: string;
585
- anyOf: {
586
- title: string;
587
- dataType: string;
588
- index: number;
589
- fields: {
590
- $ref: string;
591
- }[];
592
- }[];
593
- };
594
- "aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": {
595
- title: string;
596
- description: string;
597
- anyOf: ({
598
- title: string;
599
- dataType: string;
600
- index: number;
601
- fields: {
602
- $ref: string;
603
- }[];
604
- } | {
605
- title: string;
606
- dataType: string;
607
- index: number;
608
- fields: {
609
- title: string;
610
- $ref: string;
611
- }[];
612
- })[];
613
- };
614
- "swap/SwapDatum": {
615
- title: string;
616
- anyOf: {
617
- title: string;
618
- dataType: string;
619
- index: number;
620
- fields: {
621
- title: string;
622
- $ref: string;
623
- }[];
624
- }[];
625
- };
626
- "swap/SwapRedeemer": {
627
- title: string;
628
- anyOf: {
629
- title: string;
630
- dataType: string;
631
- index: number;
632
- fields: never[];
633
- }[];
439
+ /**
440
+ * Mesh Plutus NFT contract class
441
+ *
442
+ * This NFT minting script enables users to mint NFTs with an automatically incremented index, which increases by one for each newly minted NFT.
443
+ *
444
+ * To facilitate this process, the first step is to set up a one-time minting policy by minting an oracle token. This oracle token is essential as it holds the current state and index of the NFTs, acting as a reference for the minting sequence.
445
+ *
446
+ * With each new NFT minted, the token index within the oracle is incremented by one, ensuring a consistent and orderly progression in the numbering of the NFTs.
447
+ */
448
+ declare class MeshPlutusNFTContract extends MeshTxInitiator {
449
+ collectionName: string;
450
+ paramUtxo: UTxO["input"];
451
+ oracleAddress: string;
452
+ getOracleCbor: () => string;
453
+ getOracleNFTCbor: () => string;
454
+ getNFTCbor: () => string;
455
+ constructor(inputs: MeshTxInitiatorInput, contract: {
456
+ collectionName: string;
457
+ paramUtxo?: UTxO["input"];
458
+ });
459
+ /**
460
+ * Set up a one-time minting policy by minting an oracle token. This oracle token is essential as it holds the current state and index of the NFTs, acting as a reference for the minting sequence.
461
+ * @param lovelacePrice - Price of the NFT in lovelace
462
+ * @returns - Transaction hex and paramUtxo
463
+ *
464
+ * @example
465
+ * ```typescript
466
+ * const { tx, paramUtxo } = await contract.setupOracle(lovelacePrice);
467
+ * ```
468
+ */
469
+ setupOracle: (lovelacePrice: number) => Promise<{
470
+ tx: string;
471
+ paramUtxo: {
472
+ outputIndex: number;
473
+ txHash: string;
634
474
  };
635
- };
636
- };
637
- type SwapDatum = ConStr0<[PubKeyAddress, Value, Value]>;
475
+ }>;
476
+ /**
477
+ * Mint NFT token with an automatically incremented index, which increases by one for each newly minted NFT.
478
+ * @param assetMetadata - Asset metadata
479
+ * @returns - Transaction hex
480
+ *
481
+ * @example
482
+ * ```typescript
483
+ * const assetMetadata = {
484
+ * ...demoAssetMetadata,
485
+ * name: `Mesh Token ${oracleData.nftIndex}`,
486
+ * };
487
+ * const tx = await contract.mintPlutusNFT(assetMetadata);
488
+ * ```
489
+ */
490
+ mintPlutusNFT: (assetMetadata?: AssetMetadata) => Promise<string>;
491
+ /**
492
+ * Get the current oracle data.
493
+ *
494
+ * @returns - Oracle data
495
+ *
496
+ * @example
497
+ * ```typescript
498
+ * const oracleData = await contract.getOracleData();
499
+ * ```
500
+ */
501
+ getOracleData: () => Promise<{
502
+ nftIndex: number | bigint;
503
+ policyId: string;
504
+ lovelacePrice: number | bigint;
505
+ oracleUtxo: UTxO;
506
+ oracleNftPolicyId: string;
507
+ feeCollectorAddress: string;
508
+ feeCollectorAddressObj: _meshsdk_common.PubKeyAddress;
509
+ }>;
510
+ getUtxoByTxHash: (txHash: string) => Promise<UTxO | undefined>;
511
+ }
512
+
513
+ type SwapDatum = ConStr0$1<[PubKeyAddress, Value, Value]>;
638
514
  declare class MeshSwapContract extends MeshTxInitiator {
639
515
  scriptCbor: string;
640
516
  scriptAddress: string;
641
517
  constructor(inputs: MeshTxInitiatorInput);
518
+ getScriptCbor: () => string;
642
519
  initiateSwap: (toProvide: Asset$1[], toReceive: Asset$1[]) => Promise<string>;
643
520
  acceptSwap: (swapUtxo: UTxO$1) => Promise<string>;
644
521
  cancelSwap: (swapUtxo: UTxO$1) => Promise<string>;
645
522
  getUtxoByTxHash: (txHash: string) => Promise<UTxO$1 | undefined>;
646
523
  }
647
524
 
648
- type VestingDatum = ConStr0<[
525
+ type VestingDatum = ConStr0$1<[
649
526
  Integer$1,
650
527
  BuiltinByteString$1,
651
528
  BuiltinByteString$1
652
529
  ]>;
653
530
  declare class MeshVestingContract extends MeshTxInitiator {
531
+ scriptCbor: string;
532
+ scriptAddress: string;
654
533
  constructor(inputs: MeshTxInitiatorInput);
655
534
  getScriptCbor: () => string;
656
535
  depositFund: (amount: Asset[], lockUntilTimeStampMs: number, beneficiary: string) => Promise<string>;
@@ -658,4 +537,4 @@ declare class MeshVestingContract extends MeshTxInitiator {
658
537
  getUtxoByTxHash: (txHash: string) => Promise<UTxO | undefined>;
659
538
  }
660
539
 
661
- export { type ActiveEscrowDatum, type HelloWorldDatum, type InitiationDatum, type MarketplaceDatum, MeshEscrowBlueprint, MeshEscrowContract, MeshGiftCardContract, MeshHelloWorldBlueprint, MeshHelloWorldContract, MeshMarketplaceBlueprint, MeshMarketplaceContract, MeshPaymentSplitterBlueprint, MeshPaymentSplitterContract, MeshSwapBlueprint, MeshSwapContract, MeshVestingContract, type RecipientDepositRedeemer, type SwapDatum, type VestingDatum, activeEscrowDatum, initiateEscrowDatum, marketplaceDatum, recipientDepositRedeemer };
540
+ export { type ActiveEscrowDatum, type HelloWorldDatum, type InitiationDatum, type MarketplaceDatum, MeshContentOwnershipContract, MeshEscrowContract, MeshGiftCardContract, MeshHelloWorldContract, MeshMarketplaceContract, MeshPaymentSplitterContract, MeshPlutusNFTContract, MeshSwapContract, MeshVestingContract, type RecipientDepositRedeemer, type SwapDatum, type VestingDatum, activeEscrowDatum, initiateEscrowDatum, marketplaceDatum, recipientDepositRedeemer };