Skip to content

Commit b345f5e

Browse files
authored
Merge pull request #43 from PiotrNap/patch-3
Update basics.mdx
2 parents cac487c + ce7c5f6 commit b345f5e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ icon: PaperAirplaneIcon
55
---
66
import Link from 'fumadocs-core/link';
77

8-
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**.
8+
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**.
99

1010
```tsx
1111
const txBuilder = new MeshTxBuilder({
@@ -21,7 +21,7 @@ In this page, we will cover how to initialize the `MeshTxBuilder` and the basic
2121

2222
## Initialize Tx Builder
2323

24-
To start building an customized transaction, you need to first initialize `MeshTxBuilder`:
24+
To start building a customized transaction, you need to first initialize `MeshTxBuilder`:
2525

2626
```tsx
2727
import { BlockfrostProvider, MeshTxBuilder } from "@meshsdk/core";
@@ -48,7 +48,7 @@ The `MeshTxBuilder` instance has the following signature:
4848
}
4949
```
5050

51-
There are 6 optional fields to pass in to initialized the lower level APIs instance:
51+
There are 6 optional fields to pass in when initializing a new instance:
5252

5353
- `serializer`: The default serializer is `CSLSerializer`. You can pass in your own serializer instance.
5454
- `fetcher`: When you build the transaction without sufficient fields as required by the serialization library, we would index the blockchain to fill the information for you. Affected APIs are `txIn`, `txInCollateral`, `spendingTxInReference`.
@@ -61,15 +61,15 @@ There are 6 optional fields to pass in to initialized the lower level APIs insta
6161

6262
## Send Value
6363

64-
Sending value with `MeshTxBuilder` come with the `.txOut()` endpoint:
64+
Sending value with `MeshTxBuilder` is done using the `.txOut()` endpoint:
6565

6666
```tsx
6767
.txOut(address: string, amount: Asset[])
6868
```
6969

70-
In order to send values (so as every transaction), we have to fund the transaction to do so. There are 2 ways to provide values in a transaction:
70+
To send value in a transaction, you must first fund it. There are 2 ways:
7171

72-
- Specifying which input to spend with
72+
- Specifying which input to spend
7373

7474
```tsx
7575
.txIn(txHash: string, txIndex: number, amount?: Asset[], address?: string)
@@ -82,7 +82,7 @@ In order to send values (so as every transaction), we have to fund the transacti
8282
.selectUtxosFrom(extraInputs: UTxO[])
8383
```
8484

85-
Since the input and output values might not be the same, we have to specify the address (usually own's address) to receive change:
85+
Since the input and output values might not be the same, we have to specify the address (usually the wallet's own address) to receive the change:
8686

8787
```tsx
8888
.changeAddress(addr: string)
@@ -162,7 +162,7 @@ await wallet.signTx(unsignedTx, true);
162162
<Card>
163163
### Multi-signature Transaction [!toc]
164164

165-
Create a multi-signature transaction. In this demo, we will create a transaction with two signatures, where one signature is from the user wallet and the other is from a minting wallet.
165+
Create a multi-signature transaction. In this demo, we will create a transaction with two signatures, where one signature is from the user's wallet and the other is from a minting wallet.
166166

167167
```tsx
168168
const mintingWallet = new MeshWallet({
@@ -335,21 +335,21 @@ The second parameter of `selectUtxosFrom` is the strategy to be used for selecti
335335

336336
We may introduce more strategies in the future. Check the <Link href="https://docs.meshjs.dev/"> Mesh Docs</Link> for more details.
337337

338-
The `threshold` parameter is used to specify the minimum amount of lovelace to be selected. You may specify a larger amount to if the transactions requires it.
338+
The `threshold` parameter is used to specify the minimum amount of lovelace to be selected. You may specify a larger amount too if the transactions requires it.
339339

340340
The last parameter is `includeTxFees` which is a boolean value to include transaction fees in the selection.
341341

342342

343-
## Set Metadata - Taransaction message
343+
## Set Metadata - Transaction message
344344

345-
Add messages / comments / memos as transaction metadata. This is useful for attaching additional information to a transaction. This is an example of setting metadata with transaction message.
345+
Add messages / comments / memos as transaction metadata. This is useful for attaching additional information to a transaction. This is an example of setting a metadata with transaction message.
346346

347347
```tsx
348348
txBuilder
349349
.metadataValue(label, metadata)
350350
```
351351

352-
The specification for the individual strings follow the general design specification for JSON metadata, which is already implemented and in operation on the cardano blockchain. The used metadatum label is `674`: this number was chosen because it is the T9 encoding of the string `msg`. The message content has the key `msg`: and consists of an array of individual message-strings. The number of theses message-strings must be at least one for a single message, more for multiple messages/lines. Each of theses individual message-strings array entries must be at most 64 bytes when UTF-8 encoded.
352+
The specification for individual strings follows the general JSON metadata design, which is currently used on the Cardano blockchain. The used metadatum label is `674`: this number was chosen because it is the T9 encoding of the string `msg`. The message content has the key `msg`: and consists of an array of individual message-strings. The number of theses message-strings must be at least one for a single message, more for multiple messages/lines. Each of theses individual message-strings array entries must be at most 64 bytes when UTF-8 encoded.
353353

354354
<Card>
355355
### Transaction message [!toc]
@@ -415,14 +415,14 @@ let dateTimeAdd5Min = new Date(nowDateTime.getTime() + minutes*60000);
415415
const slot = resolveSlotNo('mainnet', dateTimeAdd5Min.getTime());
416416
```
417417

418-
Next, we set the TTL with `invalidHereafter` and providing the `slot`, this means that if the transaction is submitted after after `slot` will not be valid.
418+
Next, we set the TTL by calling `invalidHereafter(slot)`. A transaction submitted after this value is invalid:
419419

420420
```tsx
421421
txBuilder
422422
.invalidHereafter(Number(slot));
423423
```
424424

425-
Likewise, we can set a "validity start interval" for the transaction, where it is the time the transaction will be valid. We can define the start time with `invalidBefore` and providing the `slot`:
425+
Likewise, we can call `invalidBefore(slot)` to specify the validity start interval. A transaction submitted before this value is invalid:
426426

427427
```tsx
428428
txBuilder
@@ -434,7 +434,7 @@ txBuilder
434434

435435
Sets the network to use, this is mainly to know the cost models to be used to calculate script integrity hash. You can set the network for the transaction with `setNetwork`.
436436

437-
`
437+
```tsx
438438
txBuilder.setNetwork(network: Network)
439439
```
440440

@@ -447,7 +447,7 @@ The network parameter is a string that can be one of the following:
447447

448448
## Set Fee
449449

450-
Set the fee for the transaction.
450+
Set the fee for the transaction in lovelace.
451451

452452
```tsx
453453
.setFee(fee: string)
@@ -476,4 +476,4 @@ const txBuilder = new MeshTxBuilder({
476476
fetcher: provider,
477477
params: pp,
478478
});
479-
```
479+
```

0 commit comments

Comments
 (0)