Skip to content

Commit

Permalink
[cli] Fix PTB CLI help (MystenLabs#17919)
Browse files Browse the repository at this point in the history
## Description 

- Improve the accuracy of the help for Move call 

## Test plan 

- 👀 

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
tnowacki authored May 24, 2024
1 parent c5e71c1 commit 9839ff5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/sui/src/client_ptb/ptb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ pub fn ptb_description() -> clap::Command {
\n --assign a none\
\n --move-call std::option::is_none <u64> a"
)
.value_names(["PACKAGE::MODULE::FUNCTION", "TYPE", "FUNCTION_ARGS"]))
.value_names(["PACKAGE::MODULE::FUNCTION", "TYPE_ARGS", "FUNCTION_ARGS"]))
.arg(arg!(
--"split-coins" <SPLIT_COINS>
"Split the coin into N coins as per the given array of amounts."
Expand All @@ -362,7 +362,7 @@ pub fn ptb_description() -> clap::Command {
.long_help(
"Transfer objects to the specified address.\
\n\nExamples:\
\n --transfer-objects [obj1, obj2, obj3] @address
\n --transfer-objects [obj1, obj2, obj3] @address
\n --split-coins gas [1000, 5000, 75000]\
\n --assign new_coins # bound new_coins to result of split-coins to use next\
\n --transfer-objects [new_coins.0, new_coins.1, new_coins.2] @to_address"
Expand Down
10 changes: 5 additions & 5 deletions docs/content/references/cli/ptb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Options:
Examples:
--merge-coins @coin_object_id [@coin_obj_id1, @coin_obj_id2]
--move-call <PACKAGE::MODULE::FUNCTION> <TYPE> <FUNCTION_ARGS>
--move-call <PACKAGE::MODULE::FUNCTION> <TYPE_ARGS> <FUNCTION_ARGS>
Make a move call to a function.
Examples:
Expand Down Expand Up @@ -117,7 +117,7 @@ Options:

The main philosophy behind the CLI PTB support is to enable a user to build and execute a PTB from the command line. Bash scripts can be used to construct and execute the PTB just as you would do from the command line, providing great flexibility when it comes to automating different tasks.

Besides using existing [traditional PTB](/concepts/transactions/prog-txn-blocks/) related concepts, we introduce a few new and important concepts for this command.
Besides using existing [traditional PTB](/concepts/transactions/prog-txn-blocks/) related concepts, we introduce a few new and important concepts for this command.

:::warning

Expand Down Expand Up @@ -175,7 +175,7 @@ Use the `--assign` argument to bind values to variables. There are two ways you
- assign a value to a variable
- assign a variable to the result of the previous command

Let's look at the first case where you assign a value to a variable. You want to check if some variable's value is `none`. Call the `0x1::option::is_none` function from the Move standard library, and pass in the variable name:
Let's look at the first case where you assign a value to a variable. You want to check if some variable's value is `none`. Call the `0x1::option::is_none` function from the Move standard library, and pass in the variable name:

```bash
sui client ptb \
Expand Down Expand Up @@ -233,7 +233,7 @@ To call a specific function from a specific package, you can use the following c

### Publish

Publishing a package is one of the most important commands you need when working with Sui. While the CLI has a standalone `publish` command, PTBs also support publishing and upgrading packages. One main difference is that with `sui client ptb`, you must explicitly transfer the `UpgradeCap` object that is returned when creating a package, or destroy it with a call to [`make_immutable`](/concepts/sui-move-concepts/packages.mdx). Here is an example on how to publish a Move project on chain using the `sui client ptb` command. It makes a call to the `sui::tx_context::sender` to acquire the sender and assigns the result of that call to the `sender` variable, and then calls the publish command. The result of `publish` is bounded to `upgrade_cap` variable, and then this object is transferred to the sender.
Publishing a package is one of the most important commands you need when working with Sui. While the CLI has a standalone `publish` command, PTBs also support publishing and upgrading packages. One main difference is that with `sui client ptb`, you must explicitly transfer the `UpgradeCap` object that is returned when creating a package, or destroy it with a call to [`make_immutable`](/concepts/sui-move-concepts/packages.mdx). Here is an example on how to publish a Move project on chain using the `sui client ptb` command. It makes a call to the `sui::tx_context::sender` to acquire the sender and assigns the result of that call to the `sender` variable, and then calls the publish command. The result of `publish` is bounded to `upgrade_cap` variable, and then this object is transferred to the sender.

```bash
sui client ptb \
Expand Down Expand Up @@ -298,7 +298,7 @@ You cannot use the following words for variable names:
- `u32`
- `u64`
- `u128`
- `u256`
- `u256`

## JSON output

Expand Down

0 comments on commit 9839ff5

Please sign in to comment.