Skip to content

Commit

Permalink
Update Wallet doc Transferring objects section as Transferring coins (M…
Browse files Browse the repository at this point in the history
…ystenLabs#1743)

* Update Wallet doc Transferring objects section as Transferring coins

Also including a TODO to clarify a related note

* changed transfer -> transfer-coin

* Update wallet.md

Add Arun's input, remove coins TODO as complete

* Update wallet.md

Add link to #calling-move-code section per Arun

Co-authored-by: patrick <[email protected]>
  • Loading branch information
Clay-Mysten and patrickkuo authored May 5, 2022
1 parent e71f61e commit 50b92dc
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions doc/src/build/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ The following commands are supported by the wallet:
split-coin Split a coin object into multiple coins
switch Switch active address
sync Synchronize client state with authorities
transfer Transfer an object
transfer-coin Transfer coin object

> **Note:** The `clear`, `echo`, `env` and `exit` commands exist only in the interactive shell.

Expand Down Expand Up @@ -525,7 +525,9 @@ Here is an example:
{"contents":{"fields":{"id":{"fields":{"id":{"fields":{"id":{"fields":{"bytes":"eea4167be074537f4a2879c7781d8ef4ffd651cc"},"type":"0x2::ID::ID"}},"type":"0x2::ID::UniqueID"},"version":0},"type":"0x2::ID::VersionedID"},"value":100000},"type":"0x2::Coin::Coin<0x2::SUI::SUI>"},"owner":{"AddressOwner":[102,175,56,152,231,85,139,121,225,21,171,97,24,74,149,132,151,209,144,90]},"tx_digest":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}
```
## Transferring objects
## Transferring coins
Coins *are* objects yet have a specific use case that allow for native commands like transfer-coin/merge-coin/split-coin to be used. This is different from non-coin objects that can only be mutated via [Move calls](#calling-move-code).
If you inspect a newly created account, you would expect the account does not own any object. Let us inspect the fresh account we create in the [Generating a new account](#generating-a-new-account) section (`C72CF3ADCC4D11C03079CEF2C8992AEA5268677A`):
Expand All @@ -536,39 +538,39 @@ Showing 0 results.
```
To add objects to the account, you can [invoke a Move function](#calling-move-code),
or you can transfer one of the existing objects from the genesis account to the new account using a dedicated wallet command.
We will explore how to transfer objects using the wallet in this section.
or you can transfer one of the existing coins from the genesis account to the new account using a dedicated wallet command.
We will explore how to transfer coins using the wallet in this section.
`transfer` command usage:
`transfer-coin` command usage:
```shell
USAGE:
transfer [FLAGS] [OPTIONS] --gas-budget <gas-budget> --object-id <object-id> --to <to>
transfer-coin [FLAGS] [OPTIONS] --gas-budget <gas-budget> --coin-object-id <coin-object-id> --to <to>
FLAGS:
-h, --help Prints help information
--json Returns command outputs in JSON format
-V, --version Prints version information
OPTIONS:
--gas <gas> ID of the gas object for gas payment, in 20 bytes Hex string If not provided, a gas
object with at least gas_budget value will be selected
--gas-budget <gas-budget> Gas budget for this transfer
--object-id <object-id> Object to transfer, in 20 bytes Hex string
--to <to> Recipient address
--gas <gas> ID of the coin object for gas payment, in 20 bytes Hex string If not provided, a coin
object with at least gas_budget value will be selected
--gas-budget <gas-budget> Gas budget for this transfer
--coin-object-id <coin-object-id> Coin to transfer, in 20 bytes Hex string
--to <to> Recipient address
```
To transfer an object to a recipient, you will need the recipient's address,
the object ID of the object that you want to transfer,
and optionally the gas object ID for the transaction fee payment. If a gas
object is not specified, one that meets the budget is picked. Gas budget sets a
To transfer a coin object to a recipient, you will need the recipient's address,
the object ID of the coin that you want to transfer,
and optionally the coin object ID for the transaction fee payment. If a gas
coin is not specified, one that meets the budget is picked. Gas budget sets a
cap for how much gas you want to spend. We are still finalizing our gas metering
mechanisms. For now, just set something large enough.

Here is an example transfer of an object to account `F456EBEF195E4A231488DF56B762AC90695BE2DD`:

```shell
$ wallet transfer --to C72CF3ADCC4D11C03079CEF2C8992AEA5268677A --object-id DA2237A9890BCCEBEEEAE0D23EC739F00D2CE2B1 --gas-budget 100
$ wallet transfer-coin --to C72CF3ADCC4D11C03079CEF2C8992AEA5268677A --coin-object-id DA2237A9890BCCEBEEEAE0D23EC739F00D2CE2B1 --gas-budget 100
```

With output like:
Expand Down Expand Up @@ -811,8 +813,8 @@ public(script) fun transfer(c: Coin::Coin<SUI>, recipient: address, _ctx: &mut T
```
Please note that there is no real need to use a Move call to transfer
objects as this can be accomplish with a built-in wallet
[command](#transferring-objects) - we chose this example due to its
coins as this can be accomplished with a built-in wallet
[command](#transferring-coins) - we chose this example due to its
simplicity.
Let us examine objects owned by address `AE6FB6036570FEC1DF71599740C132CDF5B45B9D`:
Expand Down

0 comments on commit 50b92dc

Please sign in to comment.