Skip to content

Commit

Permalink
Start to fix casing in move.md, add distinction in Important note (My…
Browse files Browse the repository at this point in the history
  • Loading branch information
Clay-Mysten authored Jun 23, 2022
1 parent c240618 commit d52ddf6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions doc/src/build/move.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ more module files are located:
my_move_package
├── Move.toml
├── sources
├── M1.move
├── m1.move
```

See
Expand Down Expand Up @@ -102,6 +102,12 @@ read more about
[modules](https://github.com/move-language/move/blob/main/language/documentation/book/src/modules-and-scripts.md#modules)
in the Move book later.)

> **Important:** In Sui Move, package names are always in CamelCase, which
> the address alias is lowercase, for examples `sui = 0x2` and `std = 0x1`.
> So: Sui = name of the imported package (Sui = sui framework), sui = address
> alias of 0x2, sui::sui = module sui under the address 0x2, and
> sui::sui::SUI = type in the module above.
As we can see, when defining a module we specify the module name
(`Coin`), preceded by the name of the package where this module resides
(`Sui`). The combination of the package name and the module name
Expand Down Expand Up @@ -282,7 +288,7 @@ this package, first [install Sui binaries](install.md#binaries) and
you have the Sui repository source code in your current directory.

Refer to the code example developed for this tutorial in the
[M1.move](https://github.com/MystenLabs/sui/tree/main/sui_programmability/examples/move_tutorial/sources/m1.move) file.
[m1.move](https://github.com/MystenLabs/sui/tree/main/sui_programmability/examples/move_tutorial/sources/m1.move) file.

The directory structure used in this tutorial should at the moment
look as follows (assuming Sui has been cloned to a directory called
Expand All @@ -301,6 +307,8 @@ this tutorial, is part of your system path:
$ which sui-move
```

### Creating the directory structure

Now proceed to creating a package directory structure in the current
directory, parallel to the `sui` repository. It will contain an
empty manifest file and an empty module source file following the
Expand All @@ -327,6 +335,7 @@ current_directory
├── m1.move
```

### Defining the package

Let us assume that our module is part of an implementation of a
fantasy game set in medieval times, where heroes roam the land slaying
Expand All @@ -343,8 +352,9 @@ Let us put the following module and struct
definitions in the `m1.move` file:

``` rust
module MyFirstPackage::M1 {
module my_first_package::m1 {
use sui::id::VersionedID;
use sui::tx_context::TxContext;

struct Sword has key, store {
id: VersionedID,
Expand Down Expand Up @@ -396,12 +406,14 @@ version = "0.0.1"
Sui = { local = "../sui/crates/sui-framework" }
[addresses]
MyFirstPackage = "0x0"
my_first_package = "0x0"
```

See the [Move.toml](https://github.com/MystenLabs/sui/blob/main/sui_programmability/examples/move_tutorial/Move.toml)
file used in our [end-to-end tutorial](../explore/tutorials.md) for an example.

## Building the package

Ensure you are in the `my_move_package` directory containing your package and build it:

``` shell
Expand Down

0 comments on commit d52ddf6

Please sign in to comment.