Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[move] Add example of user code organized into multiple packages #5676

Merged
merged 3 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sui_programmability/examples/multi_package/README.md
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).
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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module dep_package::dep_module {

public fun foo(): u64 {
42
}

}
10 changes: 10 additions & 0 deletions sui_programmability/examples/multi_package/main_package/Move.toml
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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module main_package::main_module {
use dep_package::dep_module;

fun foo(): u64 {
dep_module::foo()
}

}