forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move] Add example of user code organized into multiple packages (Mys…
…tenLabs#5676) * [move] Add example of user code organized into multiple packages * Addressed review comments * Added copyright headers
- Loading branch information
Showing
5 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
An example of how to structure your code to include another user-level package as a dependency. | ||
|
||
Make sure that the dependency name (in this example DepPackage in main_package/Move.toml file's | ||
`[dependencies]` section) is the same as the name of the package (in dep_package/Move.toml file's | ||
`[package]` section). |
9 changes: 9 additions & 0 deletions
9
sui_programmability/examples/multi_package/dep_package/Move.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "DepPackage" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
Sui = { local = "../../../../crates/sui-framework" } | ||
|
||
[addresses] | ||
dep_package = "0x0" |
10 changes: 10 additions & 0 deletions
10
sui_programmability/examples/multi_package/dep_package/sources/dep_module.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module dep_package::dep_module { | ||
|
||
public fun foo(): u64 { | ||
42 | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
sui_programmability/examples/multi_package/main_package/Move.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "MainPackage" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
Sui = { local = "../../../../crates/sui-framework" } | ||
DepPackage = { local = "../dep_package" } | ||
|
||
[addresses] | ||
main_package = "0x0" |
11 changes: 11 additions & 0 deletions
11
sui_programmability/examples/multi_package/main_package/sources/main_module.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module main_package::main_module { | ||
use dep_package::dep_module; | ||
|
||
fun foo(): u64 { | ||
dep_module::foo() | ||
} | ||
|
||
} |