Skip to content

Commit

Permalink
Fix layout
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekjain23 committed Dec 17, 2024
1 parent 924165e commit 608be86
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docs/content/developer/getting-started/simple-token-transfer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ Run the following command to create a Move package
iota move new token_transfer
```

This will generate a new Move package in a folder named token-transfer.
This will generate a new Move package in a folder named token_transfer.

## Configure the IOTA CLI

To run the `mint` function from the frontend app, you must be the owner of the package; otherwise, you cannot execute the function. To become the owner, you need to publish the package, and this process can only be done through the CLI. Note that the CLI and browser wallet extension use separate accounts. In the CLI, you can update the active address and private key to match the account used in the browser wallet extension. By aligning these accounts, you ensure the same account is used in both the CLI and the wallet extension, enabling seamless transactions in your frontend app.

Before publishing the package, you need to configure your IOTA CLI with your wallet details.

### Navigate to the IOTA configuration directory
### Navigate to the IOTA Configuration Directory

```bash
cd ~/.iota/iota_config/
Expand All @@ -76,10 +76,10 @@ cd ~/.iota/iota_config/
#### [`init`](https://github.com/iota-community/token-transfer-tutorial/blob/ea71112c1156d1885567353fee0a03e09308e293/sources/token_transfer.move#L9-L13)

- Executes at the time of publication of the package.
- Takes `MY_TOKEN` as a witness and the transaction context (ctx).
- Uses the `coin::create_currency` function to create the token by specifying the name, symbol, and decimal precision of the token.
- The `coin::create_currency` function returns a TreasuryCap, which allows the owner to mint and transfer the token, and the metadata of the token.
- Transfers the metadata to the owner of the contract using `transfer::public_freeze_object(metadata)` and `transfer::public_transfer(treasury, ctx.sender())`.
- Takes `MY_TOKEN` as a witness and the transaction context ([ctx](https://docs.iota.org/references/framework/iota-framework/tx_context#0x2_tx_context_sender)).
- Uses the [`coin::create_currency`](https://docs.iota.org/references/framework/iota-framework/coin#0x2_coin_create_currency) function to create the token by specifying the name, symbol, and decimal precision of the token.
- The [`coin::create_currency`](https://docs.iota.org/references/framework/iota-framework/coin#0x2_coin_create_currency) function returns a TreasuryCap, which allows the owner to mint and transfer the token, and the metadata of the token.
- Transfers the metadata to the owner of the contract using [`transfer::public_freeze_object(metadata)`](https://docs.iota.org/references/framework/iota-framework/transfer#0x2_transfer_public_freeze_object) and [`transfer::public_transfer(treasury, ctx.sender())`](https://docs.iota.org/references/framework/iota-framework/transfer#function-public_transfer).

```move reference
https://github.com/iota-community/token-transfer-tutorial/blob/ea71112c1156d1885567353fee0a03e09308e293/sources/token_transfer.move#L9-L13
Expand All @@ -101,7 +101,7 @@ https://github.com/iota-community/token-transfer-tutorial/blob/ea71112c1156d1885

- Transfers the token from the caller address to the recipient address.
- Requires the correct token object address that is owned by the caller.
- The function first uses the `coin::split` function to split the specified amount from the token and then uses `transfer::public_transfer` to transfer the split tokens to the recipient.
- The function first uses the [`coin::split`](https://docs.iota.org/references/framework/iota-framework/coin#function-split) function to split the specified amount from the token and then uses [`transfer::public_transfer`](https://docs.iota.org/references/framework/iota-framework/transfer#function-public_transfer) to transfer the split tokens to the recipient.

```move reference
https://github.com/iota-community/token-transfer-tutorial/blob/ea71112c1156d1885567353fee0a03e09308e293/sources/token_transfer.move#L25-L33
Expand All @@ -111,7 +111,7 @@ https://github.com/iota-community/token-transfer-tutorial/blob/ea71112c1156d1885

- Returns the balance of the token for the specified owner.
- Requires passing the token address to retrieve the balance.WW
- Uses `coin::balance` to query the balance and returns the value held by the coin object.
- Uses [`coin::balance`](https://docs.iota.org/references/framework/iota-framework/coin#function-balance) to query the balance and returns the value held by the coin object.

```move reference
https://github.com/iota-community/token-transfer-tutorial/blob/ea71112c1156d1885567353fee0a03e09308e293/sources/token_transfer.move#L34-L37
Expand All @@ -123,15 +123,15 @@ Navigate to the [`source/token-transfer.move`](https://github.com/iota-community
https://github.com/iota-community/token-transfer-tutorial/blob/ea71112c1156d1885567353fee0a03e09308e293/sources/token_transfer.move#L1-L38
```

### Build the Package
### [Build the Package](https://docs.iota.org/developer/getting-started/build-test)

Once the contract is ready, build the package by running:

```bash
iota move build
```

### Publish the Package
### [Publish the Package](https://docs.iota.org/developer/getting-started/publish)

Publish the package to the IOTA testnet using the following command:

Expand Down Expand Up @@ -319,7 +319,7 @@ pnpm add @iota/dapp-kit @iota/iota-sdk @tanstack/react-query

### Code Structure

- Components: Contains the components listed below for the UI :
- Components: It contains the separate react components for different operations such as check balance, minting tokens and transfer tokens.
- [`Balance.tsx`](https://github.com/iota-community/token-transfer-tutorial/blob/3e2023a7c29aa5cf43305c6c42bd463a7a789750/frontend/src/components/Balance.tsx#L1-L27)
- [`Buttons.tsx`](https://github.com/iota-community/token-transfer-tutorial/blob/3e2023a7c29aa5cf43305c6c42bd463a7a789750/frontend/src/components/Buttons.tsx#L1-L27)
- [`Mint.tsx`](https://github.com/iota-community/token-transfer-tutorial/blob/3e2023a7c29aa5cf43305c6c42bd463a7a789750/frontend/src/components/Mint.tsx#L1-L144)
Expand Down Expand Up @@ -383,7 +383,7 @@ This component allows users to mint new tokens to a specified address. Users can
https://github.com/iota-community/token-transfer-tutorial/blob/0bbe1cc9cef5219c6f29b8cef9d1022ab0c5ddc5/frontend/src/components/Mint.tsx#L1-L79
```

## Usage example
## Usage Example

### Dashboard

Expand Down

0 comments on commit 608be86

Please sign in to comment.