Skip to content

Commit 7fef953

Browse files
authored
Merge pull request #44 from PiotrNap/patch-4
Update minting.mdx
2 parents b345f5e + 0fac099 commit 7fef953

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

apps/docs/content/docs/apis/txbuilder/minting.mdx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Minting and burning assets with Native Script and Plutus Script
99

1010
Minting and burning assets is a common operation in blockchain applications. In the Cardano ecosystem, minting and burning are achieved through Native Scripts and Plutus Scripts.
1111

12-
To view a video demonstration of this feature of the MeshSDK, navigate to the video guide <Link href="/apis//guides/nft-collection">Mint an NFT Collection</Link>.
12+
To view a video demonstration of this feature of the MeshSDK, navigate to the video guide <Link href="/guides/nft-collection">Mint an NFT Collection</Link>.
1313

14-
In the code snippet, you will find `txBuilder`, which is an instance of `MeshTxBuilder`, a powerful low-level APIs that allows you to build transactions. Learn how to initialize MeshTxBuilder.
14+
In the code snippet, you will find `txBuilder`, which is an instance of `MeshTxBuilder`, with powerful low-level APIs that allow you to build transactions. Here's how to initialize **MeshTxBuilder**.
1515

1616
```tsx
1717
const txBuilder = new MeshTxBuilder({
@@ -25,7 +25,7 @@ In this page, you will find the APIs to create transactions for minting and burn
2525

2626
## Minting with One Signature
2727

28-
In this section, we will see how to mint native assets with a `MeshTxBuilder`. For minting assets with smart contract, visit MeshTxBuilder - Smart Contract - Minting Assets with Smart Contract.
28+
In this section, we will see how to mint native assets with a `MeshTxBuilder`. For minting assets with a smart contract visit [this documentation](https://meshjs.dev/apis/txbuilder/smart-contracts#minting-assets-with-plutus-script).
2929

3030
Firstly, we need to define the `forgingScript` with `ForgeScript`. We use the first wallet address as the "minting address" (you can use other addresses).
3131

@@ -49,7 +49,7 @@ const tokenNameHex = stringToHex(tokenName);
4949
const metadata = { [policyId]: { [tokenName]: { ...demoAssetMetadata } } };
5050
```
5151

52-
Finally, we create a transaction and mint the asset with the lower level APIs.
52+
Finally, we create a transaction and mint the asset with the `MeshTxBuilder` lower level APIs.
5353

5454
```tsx
5555
const txBuilder = new MeshTxBuilder({
@@ -68,12 +68,13 @@ const unsignedTx = await txBuilder
6868
<Card>
6969
### Mint Asset
7070

71-
Mint an asset with a ntive script
71+
Mint an asset with a native script
7272

7373
```tsx
7474
import { MeshTxBuilder, ForgeScript, resolveScriptHash, stringToHex } from '@meshsdk/core';
7575
import type { Asset } from '@meshsdk/core';
7676

77+
// See https://meshjs.dev/apis/wallets/meshwallet for how to create a new wallet instance
7778
const utxos = await wallet.getUtxos();
7879
const changeAddress = await wallet.getChangeAddress();
7980
const forgingScript = ForgeScript.withOneSignature(changeAddress);
@@ -127,7 +128,7 @@ for (let i = 1; i < 3; i++) {
127128
}
128129
```
129130

130-
You appending the metadata into one object and pass it to `metadataValue()` method.
131+
You add the metadata object by calling the `metadataValue()` method.
131132

132133
```tsx
133134
const txBuilder = new MeshTxBuilder({
@@ -153,6 +154,7 @@ const txHash = await wallet.submitTx(signedTx);
153154
```tsx
154155
import { MeshTxBuilder, ForgeScript, resolveScriptHash, stringToHex } from '@meshsdk/core';
155156
import type { Asset } from '@meshsdk/core';
157+
import { useWallet } from "@meshsdk/react";
156158

157159
const { wallet, connected } = useWallet();
158160

@@ -202,7 +204,7 @@ const address = usedAddress[0];
202204
const forgingScript = ForgeScript.withOneSignature(address);
203205
```
204206

205-
Then, we resolve the policy ID and hex of token name, setting set `txBuilder.mint("-1", policyId, tokenNameHex)`
207+
Then, we resolve the policy ID and hex of the token name by calling `txBuilder.mint("-1", policyId, tokenNameHex)`
206208

207209
```tsx
208210
const policyId = resolveScriptHash(forgingScript);
@@ -267,17 +269,17 @@ const unsignedTx = await txBuilder
267269

268270
## Minting Assets with Native Script
269271

270-
The above minting and burning one signature are indeed the mint and burn with native script examples. Here we would explain the logic you need to know for native script minting.
272+
The minting and burning examples above demonstrate using a one-signature native script. Here we explain the underlying logic for native script minting.
271273

272-
With `MeshTxBuilder`, you just need `.mint()` and provide script to mint or burn native script tokens:
274+
With `MeshTxBuilder`, you just need to call `.mint()` and provide a script to mint or burn native script tokens:
273275

274276
```tsx
275277
txBuilder
276278
.mint("1", policyId, tokenNameHex)
277279
.mintingScript(forgingScript)
278280
```
279281

280-
On top on these 2 core logics, you can attach metadata if needed with `.metadataValue()`, and construct the transaction as needed.
282+
On top of these two core steps, you can attach metadata with .metadataValue() and then construct the transaction as needed.
281283

282284
<Card>
283285
### Mint Assets with Native Script [!toc]
@@ -333,7 +335,7 @@ On top on these 2 core logics, you can attach metadata if needed with `.metadata
333335

334336
## Minting Assets with Plutus Script
335337

336-
Minting Plutus tokens with `MeshTxBuilder` starts with anyone of the below script version indicators:
338+
Plutus script minting with `MeshTxBuilder` starts with any of the below script version indicators:
337339

338340
```tsx
339341
.mintPlutusScriptV1()
@@ -347,11 +349,11 @@ Followed by specifying the minting information:
347349
.mint(quantity: string, policy: string, name: string)
348350
```
349351

350-
Similar to unlocking assets, minting or burning Plutus tokens require providing redeemer and scripts. However, no datum information is needed in minting or burning.
352+
Similar to unlocking, minting or burning tokens, the Plutus script requires providing a redeemer and the script itself. However, no datum information is needed in minting or burning.
351353

352-
**Script of the token**
354+
**Providing a Script**
353355

354-
The actual script can be either provided by transaction builder or referenced from an UTxO onchain.
356+
The actual script can be either provided through `mintTxInReference` method by attaching an on-chain UTxO reference, or by providing a Cbor encoded script.
355357

356358
- (i) Reference script
357359
```tsx
@@ -363,7 +365,7 @@ The actual script can be either provided by transaction builder or referenced fr
363365
.mintingScript(scriptCbor: string)
364366
```
365367

366-
**Redeemer of the mint**
368+
**Minting Redeemer**
367369

368370
Redeemer can be provided in different **data types**. If your MeshTxBuilder does not include an `evaluator` instance, you can also provide your budget for the unlock with this redeemer endpoint
369371

@@ -417,7 +419,9 @@ Redeemer can be provided in different **data types**. If your MeshTxBuilder does
417419

418420
## Minting Assets with CIP-68 Metadata standard
419421

420-
Minting CIP-68 tokens with `MeshTxBuilder` means 2 consecutive sets of minting APIs. The first is to mint the 100 token, and the second is the mint the 222 tokens:
422+
Minting CIP-68 tokens with `MeshTxBuilder` means 2 consecutive sets of minting APIs. The first is to mint the token with the `100` label, and the second is to mint the token with the `222` label:
423+
424+
421425

422426
```tsx
423427
txBuilder
@@ -523,9 +527,9 @@ A side note, Mesh also provides the utility function of `CIP68_100(tokenNameHex:
523527

524528
## Minting Royalty Token
525529

526-
Royalty tokens is a special type of token that allows the creator to collect a royalty fee, this proposed standard will allow for uniform royalties' distributions across the secondary market space. Read CIP-27 for more information.
530+
Royalty tokens are a special type of token that allow the creator to collect a royalty fee. This proposed standard will allow for uniform royalty distributions across the secondary market space. Read CIP-27 for more information.
527531

528-
The implementation of royalty tokens is very simple, minting a token with `777` label, with "rate" and "addr" in the metadata.
532+
The implementation of royalty tokens is very simpleminting a token with the `777` label, with "rate", and "addr" in the metadata.
529533

530534
Here is the example of the metadata:
531535

@@ -578,4 +582,4 @@ const assetMetadata = {
578582
const signedTx = await wallet.signTx(unsignedTx);
579583
const txHash = await wallet.submitTx(signedTx);
580584
```
581-
</Card>
585+
</Card>

0 commit comments

Comments
 (0)