Skip to content

Commit

Permalink
chore: formatting (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
damirka authored Apr 15, 2024
1 parent d2a5055 commit e9e0972
Show file tree
Hide file tree
Showing 73 changed files with 1,581 additions and 562 deletions.
10 changes: 6 additions & 4 deletions book/src/404.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ You're looking for a page that doesn't exist, or has been moved. Please check th

> Here are the links you may be looking for:
>
>- [The Move Book](/) - the main page of the book
>- [The Move Reference](/reference) - the Move Language Reference
>
> - [The Move Book](/) - the main page of the book
> - [The Move Reference](/reference) - the Move Language Reference
Recently we updated the structure of the book and some pages have been moved or renamed. If you're looking for the old version of the book, please, see the ["archive" branch in the repository](https://github.com/MystenLabs/move-book/tree/archive). Though we highly recommend using [the latest version of the book](/).
Recently we updated the structure of the book and some pages have been moved or renamed. If you're
looking for the old version of the book, please, see the
["archive" branch in the repository](https://github.com/MystenLabs/move-book/tree/archive). Though
we highly recommend using [the latest version of the book](/).
5 changes: 4 additions & 1 deletion book/src/before-we-begin/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Before we begin

Move requires an environment to run and develop applications, and in this small chapter we will cover the prerequisites for the Move language: how to set up your IDE, how to install the compiler and what is Move 2024. If you are already familiar with these topics or have a CLI installed, you can skip this chapter and proceed to [the next one](../your-first-move/hello-world.md).
Move requires an environment to run and develop applications, and in this small chapter we will
cover the prerequisites for the Move language: how to set up your IDE, how to install the compiler
and what is Move 2024. If you are already familiar with these topics or have a CLI installed, you
can skip this chapter and proceed to [the next one](../your-first-move/hello-world.md).
26 changes: 18 additions & 8 deletions book/src/before-we-begin/ide-support.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
# Set up your IDE

There are two most popular IDEs for Move development: VSCode and IntelliJ IDEA. Both of them provide basic features like syntax highlighting and error messages, though they differ in their additional features. Whatever IDE you choose, you'll need to use the terminal to run the [Move CLI](./install-sui.md).
There are two most popular IDEs for Move development: VSCode and IntelliJ IDEA. Both of them provide
basic features like syntax highlighting and error messages, though they differ in their additional
features. Whatever IDE you choose, you'll need to use the terminal to run the
[Move CLI](./install-sui.md).

> **IntelliJ Plugin does not support Move 2024 edition fully, some syntax won't get highlighted and not supported.**
> **IntelliJ Plugin does not support Move 2024 edition fully, some syntax won't get highlighted and
> not supported.**
## VSCode

- [VSCode](https://code.visualstudio.com/) is a free and open source IDE from Microsoft.
- [Move Analyzer](https://marketplace.visualstudio.com/items?itemName=move.move-analyzer) is a language server extension for Move maintained by [MystenLabs](https://mystenlabs.com).
- [Move Syntax](https://marketplace.visualstudio.com/items?itemName=damirka.move-syntax) a simple syntax highlighting extension for Move by [Damir Shamanaev](https://github.com/damirka/).
- [Move Analyzer](https://marketplace.visualstudio.com/items?itemName=move.move-analyzer) is a
language server extension for Move maintained by [MystenLabs](https://mystenlabs.com).
- [Move Syntax](https://marketplace.visualstudio.com/items?itemName=damirka.move-syntax) a simple
syntax highlighting extension for Move by [Damir Shamanaev](https://github.com/damirka/).

## IntelliJ IDEA

- [IntelliJ IDEA](https://www.jetbrains.com/idea/) is a commercial IDE from JetBrains.
- [Move Language Plugin](https://plugins.jetbrains.com/plugin/14721-move-language) provides a Move language extension for IntelliJ IDEA by [Pontem Network](https://pontem.network/).
- [Move Language Plugin](https://plugins.jetbrains.com/plugin/14721-move-language) provides a Move
language extension for IntelliJ IDEA by [Pontem Network](https://pontem.network/).

## Emacs

- [Emacs](https://www.gnu.org/software/emacs/) is a free and open source text editor.
- [move-mode](https://github.com/amnn/move-mode) is a Move mode for Emacs by [Ashok Menon](https://github.com/amnn).
- [move-mode](https://github.com/amnn/move-mode) is a Move mode for Emacs by
[Ashok Menon](https://github.com/amnn).

## Github Codespaces

The Web-based IDE from Github can be run right in the browser and provides almost a full-featured VSCode experience.
The Web-based IDE from Github can be run right in the browser and provides almost a full-featured
VSCode experience.

- [Github Codespaces](https://github.com/features/codespaces)
- [Move Syntax](https://marketplace.visualstudio.com/items?itemName=damirka.move-syntax) is also available in the extensions marketplace.
- [Move Syntax](https://marketplace.visualstudio.com/items?itemName=damirka.move-syntax) is also
available in the extensions marketplace.
3 changes: 2 additions & 1 deletion book/src/before-we-begin/install-sui.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ brew install sui

## Install using Chocolatey (Windows)

You can install Sui using the [Chocolatey](https://chocolatey.org/install) package manager for Windows.
You can install Sui using the [Chocolatey](https://chocolatey.org/install) package manager for
Windows.

```bash
choco install sui
Expand Down
5 changes: 4 additions & 1 deletion book/src/before-we-begin/move-2024.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Move 2024

Move 2024 is the new edition of the Move language maintained by Mysten Labs. All of the examples in this book are written in Move 2024. If you're used to the pre-2024 version of Move, please, refer to the [Move 2024 Migration Guide](./../guides/2024-migration-guide.md) to learn about the changes and improvements in the new edition.
Move 2024 is the new edition of the Move language maintained by Mysten Labs. All of the examples in
this book are written in Move 2024. If you're used to the pre-2024 version of Move, please, refer to
the [Move 2024 Migration Guide](./../guides/2024-migration-guide.md) to learn about the changes and
improvements in the new edition.

<!-- Notes ? -->
6 changes: 5 additions & 1 deletion book/src/concepts/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Concepts

In this chapter you will learn about the basic concepts of Sui and Move. You will learn what is a package, how to interact with it, what is an account and a transaction, and how data is stored on Sui. While this chapter is not a complete reference, and you should refer to the [Sui Documentation](https://docs.sui.io) for that, it will give you a good understanding of the basic concepts required to write Move programs on Sui.
In this chapter you will learn about the basic concepts of Sui and Move. You will learn what is a
package, how to interact with it, what is an account and a transaction, and how data is stored on
Sui. While this chapter is not a complete reference, and you should refer to the
[Sui Documentation](https://docs.sui.io) for that, it will give you a good understanding of the
basic concepts required to write Move programs on Sui.
41 changes: 32 additions & 9 deletions book/src/concepts/manifest.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Package Manifest

The `Move.toml` is a manifest file that describes the [package](./packages.md) and its dependencies. It is written in [TOML](https://toml.io/en/) format and contains multiple sections, the most important of which are `[package]`, `[dependencies]` and `[addresses]`.
The `Move.toml` is a manifest file that describes the [package](./packages.md) and its dependencies.
It is written in [TOML](https://toml.io/en/) format and contains multiple sections, the most
important of which are `[package]`, `[dependencies]` and `[addresses]`.

```toml
[package]
Expand All @@ -23,7 +25,9 @@ alice = "0xB0B"

### Package

The `[package]` section is used to describe the package. None of the fields in this section are published on chain, but they are used in tooling and release management; they also specify the Move edition for the compiler.
The `[package]` section is used to describe the package. None of the fields in this section are
published on chain, but they are used in tooling and release management; they also specify the Move
edition for the compiler.

- `name` - the name of the package when it is imported;
- `version` - the version of the package, can be used in release management;
Expand All @@ -33,7 +37,10 @@ The `[package]` section is used to describe the package. None of the fields in t

### Dependencies

The `[dependencies]` section is used to specify the dependencies of the project. Each dependency is specified as a key-value pair, where the key is the name of the dependency, and the value is the dependency specification. The dependency specification can be a git repository URL or a path to the local directory.
The `[dependencies]` section is used to specify the dependencies of the project. Each dependency is
specified as a key-value pair, where the key is the name of the dependency, and the value is the
dependency specification. The dependency specification can be a git repository URL or a path to the
local directory.

```toml
# git repository
Expand All @@ -43,11 +50,17 @@ Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-fram
MyPackage = { local = "../my-package" }
```

Packages also import addresses from other packages. For example, the Sui dependency adds the `std` and `sui` 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 Sui dependency adds the `std`
and `sui` addresses to the project. These addresses can be used in the code as aliases for the
addresses.

### Resolving version conflicts with override

Sometimes dependencies have conflicting versions of the same package. For example, if you have two dependencies that use different versions of the Sui package, you can override the dependency in the `[dependencies]` section. To do so, add the `override` field to the dependency. The version of the dependency specified in the `[dependencies]` section will be used instead of the one specified in the dependency itself.
Sometimes dependencies have conflicting versions of the same package. For example, if you have two
dependencies that use different versions of the Sui package, you can override the dependency in the
`[dependencies]` section. To do so, add the `override` field to the dependency. The version of the
dependency specified in the `[dependencies]` section will be used instead of the one specified in
the dependency itself.

```toml
[dependencies]
Expand All @@ -56,19 +69,29 @@ Sui = { override = true, git = "https://github.com/MystenLabs/sui.git", subdir =

### Dev-dependencies

It is possible to add `[dev-dependencies]` section to the manifest. It is used to override dependencies in the dev and test modes. For example, if you want to use a different version of the Sui package in the dev mode, you can add a custom dependency specification to the `[dev-dependencies]` section.
It is possible to add `[dev-dependencies]` section to the manifest. It is used to override
dependencies in the dev and test modes. For example, if you want to use a different version of the
Sui package in the 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. Any address can be specified in this section, and then used in the code as an alias. 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. Any address can be specified in
this section, and then used in the code as an alias. For example, if you add `alice = "0xA11CE"` to
this section, you can use `alice` as `0xA11CE` in the code.

### Dev-addresses

The `[dev-addresses]` section is the same as `[addresses]`, but only works for the test and dev modes. Important to note that it is impossible to introduce new aliases in this section, only override the existing ones. So in the example above, if you add `alice = "0xB0B"` to this section, the `alice` address will be `0xB0B` in the test and dev modes, and `0xA11CE` in the regular build.
The `[dev-addresses]` section is the same as `[addresses]`, but only works for the test and dev
modes. Important to note that it is impossible to introduce new aliases in this section, only
override the existing ones. So in the example above, if you add `alice = "0xB0B"` to this section,
the `alice` address will be `0xB0B` in the test and dev modes, and `0xA11CE` in the regular build.

## TOML styles

The TOML format supports two styles for tables: inline and multiline. The examples above are using 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 are using
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
Expand Down
23 changes: 17 additions & 6 deletions book/src/concepts/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
-->

Move is a language for writing smart contracts - programs that stored and run on the blockchain. A single program is organized into a package. A package is published on the blockchain and is identified by an [address](./address.md). A published package can be interacted with by sending [transactions](./what-is-a-transaction.md) calling its functions. It can also act as a dependency for other packages.
Move is a language for writing smart contracts - programs that stored and run on the blockchain. A
single program is organized into a package. A package is published on the blockchain and is
identified by an [address](./address.md). A published package can be interacted with by sending
[transactions](./what-is-a-transaction.md) calling its functions. It can also act as a dependency
for other packages.

> To create a new package, use the `sui move new` command.
> To learn more about the command, run `sui move new --help`.
> To create a new package, use the `sui move new` command. To learn more about the command, run
> `sui move new --help`.
Package consists of modules - separate scopes that contain functions, types, and other items.

Expand All @@ -35,7 +39,9 @@ package 0x...

## Package Structure

Locally, a package is a directory with a `Move.toml` file and a `sources` directory. The `Move.toml` file - called the "package manifest" - contains metadata about the package, and the `sources` directory contains the source code for the modules. Package usually looks like this:
Locally, a package is a directory with a `Move.toml` file and a `sources` directory. The `Move.toml`
file - called the "package manifest" - contains metadata about the package, and the `sources`
directory contains the source code for the modules. Package usually looks like this:

```
sources/
Expand All @@ -49,11 +55,16 @@ examples/
Move.toml
```

The `tests` directory is optional and contains tests for the package. Code placed into the `tests` directory is not published on-chain and is only availably in tests. The `examples` directory can be used for code examples, and is also not published on-chain.
The `tests` directory is optional and contains tests for the package. Code placed into the `tests`
directory is not published on-chain and is only availably in tests. The `examples` directory can be
used for code examples, and is also not published on-chain.

## Published Package

During development, package doesn't have an address and it needs to be set to `0x0`. Once a package is published, it gets a single unique [address](./address.md) on the blockchain containing its modules' bytecode. A published package becomes _immutable_ and can be interacted with by sending transactions.
During development, package doesn't have an address and it needs to be set to `0x0`. Once a package
is published, it gets a single unique [address](./address.md) on the blockchain containing its
modules' bytecode. A published package becomes _immutable_ and can be interacted with by sending
transactions.

```
0x...
Expand Down
Loading

0 comments on commit e9e0972

Please sign in to comment.