-
Notifications
You must be signed in to change notification settings - Fork 144
[book] massive rewrite #223
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
Changes from 3 commits
bd6260a
0ff114c
2d6c2d3
0d4339e
3475569
7ec7b88
8206a28
5793efa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| --- | ||
| description: "The Move.toml package manifest: package metadata, dependencies, named addresses, and dependency overrides explained." | ||
| --- | ||
|
|
||
| # Package Manifest | ||
|
|
||
| The `Move.toml` is a manifest file that describes the [package](./packages) and its dependencies. It | ||
|
|
@@ -22,9 +26,9 @@ published on chain, but they are used in tooling and release management; they al | |
| edition for the compiler. | ||
|
|
||
| - `name` - the name of the package when it is imported; | ||
| - `edition` - the edition of the Move language; currently, the only valid value is `2024`. | ||
|
|
||
| <!-- published-at --> | ||
| - `edition` - the edition of the Move language; currently, the only valid value is `2024`; | ||
| - `published-at` - the address the package was published at; set after publishing, it lets | ||
| dependent packages and tooling resolve the on-chain address of this package. | ||
|
|
||
| ### Dependencies | ||
|
|
||
|
|
@@ -41,14 +45,26 @@ example = { git = "https://github.com/example/example.git", subdir = "path/to/pa | |
| my_package = { 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 named addresses from their dependencies. For example, the Sui dependency adds | ||
| the `std` and `sui` addresses to the project, usable in the code in place of the full `0x1` and | ||
| `0x2` addresses. | ||
|
|
||
| Starting with version 1.45 of the Sui CLI, the Sui system packages (`std`, `sui`, `system`, | ||
| `bridge`, and `deepbook`) are automatically added as dependencies if none of them are explicitly | ||
| listed. | ||
|
|
||
| ### Addresses | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto (removed from latest pkg manager)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also already removed. |
||
|
|
||
| The `[addresses]` section declares _named addresses_: aliases that can be used in the code in place | ||
| of full addresses. The package's own name is conventionally declared here with the value `0x0`, | ||
| which is the placeholder used until the package is published: | ||
|
|
||
| ```toml | ||
| [addresses] | ||
| my_project = "0x0" | ||
| alice = "0xA11CE" | ||
| ``` | ||
|
|
||
| ### Resolving Version Conflicts with Override | ||
|
|
||
| Sometimes dependencies have conflicting versions of the same package. For example, if you have two | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,21 +4,9 @@ description: "Learn how Sui transactions work: structure, commands, gas payments | |
|
|
||
| # Transaction | ||
|
|
||
| Transaction is a fundamental concept in the blockchain world. It is a way to interact with a | ||
| blockchain. Transactions are used to change the state of the blockchain, and they are the only way | ||
| to do so. In Move, transactions are used to call functions in a package, deploy new packages, and | ||
| upgrade existing ones. | ||
|
|
||
| <!-- | ||
|
|
||
| - how user interacts with a program | ||
| - mention public functions | ||
| - give a concept of an entry / public function without getting into details | ||
| - mention that functions are called in transactions | ||
| - mention that transactions are sent by accounts | ||
| - every transaction specifies object it operates on | ||
|
|
||
| --> | ||
| A transaction is the fundamental way to interact with a blockchain. Transactions are used to | ||
| change the state of the blockchain, and they are the only way to do so. On Sui, a transaction can | ||
| call functions in published packages, deploy new packages, and upgrade existing ones. | ||
|
|
||
| ## Transaction Structure | ||
|
|
||
|
|
@@ -31,11 +19,11 @@ Transactions consist of: | |
| - command inputs - the arguments for the commands: either `pure` - simple values like numbers or | ||
| strings, or `object` - objects that the transaction will access; | ||
| - a gas object - the `Coin` object used to pay for the transaction; | ||
| - gas price and budget - the cost of the transaction; | ||
| - a gas price and budget - the cost of the transaction. | ||
|
|
||
| ## Inputs | ||
|
|
||
| Transaction inputs are the arguments for the transaction and are split between 2 types: | ||
| Transaction inputs are the arguments for the transaction, and come in two types: | ||
|
|
||
| - Pure arguments: These are mostly [primitive types](../move-basics/primitive-types) with some extra | ||
| additions. A pure argument can be: | ||
|
|
@@ -47,7 +35,7 @@ Transaction inputs are the arguments for the transaction and are split between 2 | |
| - [`std::ascii::String`](../move-basics/string#ascii-strings), ASCII strings. | ||
| - [`vector<T>`](../move-basics/vector), where `T` is a pure type. | ||
| - [`std::option::Option<T>`](../move-basics/option), where `T` is a pure type. | ||
| - [`std::object::ID`](../storage/uid-and-id), typically points to an object. See also | ||
| - [`sui::object::ID`](../storage/uid-and-id), typically points to an object. See also | ||
| [What is an Object](../object/object-model). | ||
| - Object arguments: These are objects or references of objects that the transaction will access. An | ||
| object argument needs to be either a shared object, a frozen object, or an object that the | ||
|
|
@@ -61,6 +49,12 @@ publishing a package) or a call to a function in an already published package. T | |
| executed in the order they are listed in the transaction, and they can use the results of the | ||
| previous commands, forming a chain. Transaction either succeeds or fails as a whole. | ||
|
|
||
| Any [`public`](../move-basics/visibility#public-visibility) function can be called as a command: | ||
| making a function `public` is all it takes for users to call it in a transaction, and it is the | ||
| default way to expose functionality in Move. (There is also the | ||
| [`entry`](../move-basics/visibility#entry-modifier) modifier, which creates functions callable | ||
| _only_ as transaction commands - a deliberately restricted option, covered later in the book.) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we maybe link to that? |
||
|
|
||
| Schematically, a transaction looks like this (in pseudo-code): | ||
|
|
||
| ``` | ||
|
|
@@ -81,10 +75,6 @@ In this example, the transaction consists of three commands: | |
| with the given arguments - the `payment` object; | ||
| 3. `TransferObjects` - a built-in command that transfers the object to the recipient. | ||
|
|
||
| <!-- | ||
| > There are multiple different implementations of transaction building, for example | ||
| --> | ||
|
|
||
| ## Transaction Effects | ||
|
|
||
| Transaction effects are the changes that a transaction makes to the blockchain state. More | ||
|
|
@@ -104,4 +94,10 @@ The result of the executed transaction consists of different parts: | |
| - Events - the custom [events](./../programmability/events) emitted by the transaction; | ||
| - Object Changes - the changes made to the objects, including the _change of ownership_; | ||
| - Balance Changes - the changes made to the aggregate balances of the account involved in the | ||
| transaction; | ||
| transaction. | ||
|
|
||
| ## Further Reading | ||
|
|
||
| - [Transactions](https://docs.sui.io/concepts/transactions) in the Sui Documentation. | ||
| - [Programmable Transaction Blocks](https://docs.sui.io/concepts/transactions/prog-txn-blocks) in | ||
| the Sui Documentation. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is deprecated / not recommended, do we want to include this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, one step ahead of you, was collecting other things before pushing.