From 7dfd56580af3ece937a2b991e9f53ad20277ba6a Mon Sep 17 00:00:00 2001 From: Lucas Tortora Date: Mon, 5 Aug 2024 11:15:22 -0300 Subject: [PATCH] fix(devx): apply suggestion from review. --- .../developer/getting-started/connect.mdx | 85 +++++++++---------- .../getting-started/create-a-module.mdx | 2 +- .../getting-started/create-a-package.mdx | 60 ++++++++----- 3 files changed, 80 insertions(+), 67 deletions(-) diff --git a/docs/content/developer/getting-started/connect.mdx b/docs/content/developer/getting-started/connect.mdx index aff8a70b078..9b8b8283586 100644 --- a/docs/content/developer/getting-started/connect.mdx +++ b/docs/content/developer/getting-started/connect.mdx @@ -8,48 +8,9 @@ import AlphaNet from "../../_snippets/alphanet.mdx"; # Connect to an IOTA Network -You can use the following networks to develop on IOTA. If you are still developing your application, you should use the -Devnet or Testnet, as these networks provide convenient faucets for test tokens. - -## Alphanet - -A temporary network while still in early development, used before public launch of IOTA Rebased. Will be replaced by the Testnet afterwards. - - - -## Devnet - -The latest stable release. As such, it has the latest features that were tested in the `development` branch of the -repository. - -## Testnet - -Once a release has been battle-tested in the Devnet, it moves to the Testnet. You can use this network to -test your software in real-world conditions. - - - -:::info Testnet node validators - -The IOTA Alphanet, Testnet and Devnet networks consist of four validator nodes operated by the IOTA Foundation. - -::: - -## Mainnet - -The fully operational production network, with data persistence and where tokens have real value. - - - -:::tip Local Networks - -You can also spin up a [local IOTA network](local-network.mdx) for local development. - -::: - ## IOTA CLI -IOTA provides [IOTA command line interface (CLI)](/references/cli/client.mdx) to interact with IOTA networks: +IOTA provides [IOTA command line interface (CLI)](/references/cli/client.mdx) to interact with [IOTA networks](#iota-networks): - Create and manage your private keys - Create example NFTs @@ -138,7 +99,7 @@ Secret Recovery Phrase : [hat become demise beyond history wood stage add nice l The [IOTA CLI Client](../../references/cli/client.mdx) allows you to add any number of network environments. -:::tip Check the current Network ENVs +### Check the Current Network ENVs You can easily check the currently configured environments using the following command, which will output the environment `alias` and URL, as well as indicate the currently active environment: @@ -152,7 +113,6 @@ The command outputs the available environment aliases, with `(active)` denoting localnet => http://0.0.0.0:9000 (active) alphanet => https://api.iota-rebased-alphanet.iota.cafe:443 ``` -::: @@ -171,4 +131,43 @@ You can switch the current environment using the following command: iota client switch --env ``` -* Where `` is one of your currently set environments. \ No newline at end of file +* Where `` is one of your currently set environments. + You can use the following networks to develop on IOTA. If you are still developing your application, you should use the + Devnet or Testnet, as these networks provide convenient faucets for test tokens. + +## IOTA Networks + +### Alphanet + +A temporary network while still in early development, used before public launch of IOTA Rebased. Will be replaced by the Testnet afterwards. + + + +### Devnet + +The latest stable release. As such, it has the latest features that were tested in the `development` branch of the +repository. + +### Testnet + +Once a release has been battle-tested in the Devnet, it moves to the Testnet. You can use this network to +test your software in real-world conditions. + + + +:::info Testnet node validators + +The IOTA Alphanet, Testnet and Devnet networks consist of four validator nodes operated by the IOTA Foundation. + +::: + +### Mainnet + +The fully operational production network, with data persistence and where tokens have real value. + + +:::tip Local Networks + +You can also spin up a [local IOTA network](local-network.mdx) for local development. + +::: diff --git a/docs/content/developer/getting-started/create-a-module.mdx b/docs/content/developer/getting-started/create-a-module.mdx index 7ef65af0a60..646adcfa3dc 100644 --- a/docs/content/developer/getting-started/create-a-module.mdx +++ b/docs/content/developer/getting-started/create-a-module.mdx @@ -5,7 +5,7 @@ tags: [IOTA, Move, module, smart contract, development] # Create a Move Module -A [package](create-a-package.mdx) by itself doesn't do much; its utility is defined by its modules. A module contains the logic for your package. You can create any number of modules per package. To add a module, create a `.move` file in the `sources` directory. For this guide, create a file called `my_module.move` and add the following content: +A [package](create-a-package.mdx)'s utility is defined by its modules. A module contains the logic for your package. You can create any number of modules per package. To add a module, create a `.move` file in the `sources` directory. For this guide, create a file called `my_module.move` and add the following content: :::tip Comments in `.move` files diff --git a/docs/content/developer/getting-started/create-a-package.mdx b/docs/content/developer/getting-started/create-a-package.mdx index 5666dcd414c..ad0594915a6 100644 --- a/docs/content/developer/getting-started/create-a-package.mdx +++ b/docs/content/developer/getting-started/create-a-package.mdx @@ -1,19 +1,24 @@ --- description: How to create a Move package in IOTA -tags: [Move, Package Creation, .toml, manifest] +tags: [ Move, Package Creation, .toml, manifest ] --- # Create a Move Package -Once you have [installed IOTA](iota-install.mdx), you are ready to create your first IOTA Move [package](../iota-101/iota-move-concepts/packages/packages.mdx). Use the following command to create a standard package: +Once you have [installed IOTA](iota-install.mdx), you are ready to create your first IOTA +Move [package](../iota-101/iota-move-concepts/packages/packages.mdx). In IOTA, packages are the way to organize +the [modules](create-a-module.mdx) that make up your smart contract program. When you publish a package to any IOTA +network, it will be assigned an address you can use to interact with the package by +issuing [transactions](../iota-101/transactions/transactions.mdx). + +Use the following command to create a standard package: ```shell -iota move new +iota move new my_first_package ``` -* **Where** `` is the name you want for your package. This guide uses `my_first_package`. - -The command will create and populate the `my_first_package` directory with a skeleton for an IOTA Move project, consisting of the following files and directories: +The command will create and populate the `my_first_package` directory with a skeleton for an IOTA Move project, +consisting of the following files and directories: ## `Move.toml` @@ -65,7 +70,8 @@ my_first_package = "0x0" ### Package -The `[package]` section describes the package. By default, the `iota move new` command populates only the `name` value of the metadata. +The `[package]` section describes the package. By default, the `iota move new` command populates only the `name` value +of the metadata. - `name`: The package name when it is imported. - `version`: The package version. It can be used in release management. @@ -73,9 +79,10 @@ The `[package]` section describes the package. By default, the `iota move new` c ### Dependencies -The `[dependencies]` section specifies the dependencies of the project. The dependency specification can be a git repository URL or a path to the local directory. +The `[dependencies]` section specifies the dependencies of the project. The dependency specification can be a git +repository URL or a path to the local directory. -```toml +```rust # git repository iota = { git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/testnet" } @@ -83,28 +90,36 @@ iota = { git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-f MyPackage = { local = "../my-package" } ``` -Packages also import addresses from other packages. For example, the IOTA dependency adds the `std` and `iota` addresses to the project. These addresses can be used in the code as aliases for the addresses. +Packages also import addresses from other packages. For example, the IOTA dependency adds the `std` and `iota` addresses +to the project. These addresses can be used in the code as aliases for the addresses. ### Resolving Version Conflicts with `override` -If you have two dependencies that use different versions of the same package, you can override the dependency in the `[dependencies]` section. To do so, add the `override` field to the dependency. The version specified in the `[dependencies]` section will be used instead of the one specified in the dependency itself. +If you have two dependencies that use different versions of the same package, you can override the dependency in +the `[dependencies]` section. To do so, add the `override` field to the dependency. The version specified in +the `[dependencies]` section will be used instead of the one specified in the dependency itself. -```toml +```rust [dependencies] iota = { override = true, git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/testnet" } ``` ### Dev-dependencies -You can also add a `[dev-dependencies]` section to the manifest to override dependencies in the dev and test modes. For example, if you want to use a different version of the IOTA package in dev mode, you can add a custom dependency specification to the `[dev-dependencies]` section. +You can also add a `[dev-dependencies]` section to the manifest to override dependencies in the dev and test modes. For +example, if you want to use a different version of the IOTA package in dev mode, you can add a custom dependency +specification to the `[dev-dependencies]` section. ### Addresses -The `[addresses]` section is used to add aliases for the addresses you use in your package. You can add any address in this section, and then use its alias in the code instead of the actual address. For example, if you add `alice = "0xA11CE"` to this section, you can use `alice` as `0xA11CE` in the code. +The `[addresses]` section is used to add aliases for the addresses you use in your package. You can add any address in +this section, and then use its alias in the code instead of the actual address. For example, if you +add `alice = "0xA11CE"` to this section, you can use `alice` as `0xA11CE` in the code. ### Dev-addresses -Much like the `[dev-dependencies]` section, you can also define `[dev-addresses]` to override the addresses you defined in the `[addresses]` section for test and dev modes. +Much like the `[dev-dependencies]` section, you can also define `[dev-addresses]` to override the addresses you defined +in the `[addresses]` section for test and dev modes. :::note Override Only You cannot introduce new aliases in this section, only override the ones you defined in [`[addresses]`](#addresses). @@ -112,13 +127,14 @@ You cannot introduce new aliases in this section, only override the ones you def ## TOML Styles -The TOML format supports two styles for tables: inline and multiline. The examples above use the inline style, but it is also possible to use the multiline style. You wouldn't want to use it for the `[package]` section, but it can be useful for the dependencies. +The TOML format supports two styles for tables: inline and multiline. The examples above use the inline style, but it is +also possible to use the multiline style. You wouldn't want to use it for the `[package]` section, but it can be useful +for the dependencies. -```toml -# Inline style +```move [dependencies] iota = { override = true, git = "", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/testnet" } MyPackage = { local = "../my-package" } @@ -126,18 +142,16 @@ MyPackage = { local = "../my-package" } -```toml -# Multiline style +```move [dependencies.iota] override = true git = "https://github.com/iotaledger/iota.git" subdir = "crates/iota-framework/packages/iota-framework" -rev = "framework - -/testnet" +rev = "framework/testnet" [dependencies.MyPackage] local = "../my-package" + ```