---
# System prepended metadata

title: 配置Sui Client及Sui CLI指令操作
tags: [Sui Move 學習筆記]

---

## 第一步、連接到Sui網路(Devnet)


參考文件 https://docs.sui.io/build/connect-sui-network

### 1.配置Sui客戶端

```javascript
sui client
```
在沒有 client.yaml 文件的情況下首次啟動 Sui 客戶端時，控制台會顯示以下消息：
```javascript
Config file ["<PATH-TO-FILE>/client.yaml"] doesn't exist, do you want to connect to a Sui Full node server [y/N]?
```
輸入y然後按Enter。然後請求 RPC 服務器 URL：
```javascript
Sui Full node server URL (Defaults to Sui Devnet if not specified) :
```
按Enter預設是連接到 Sui Devnet。
要使用自定義 RPC 服務器Sui Testnet 或 Sui Mainnet，請輸入正確 RPC 端點的 URL，然後按Enter 鍵。

接下來會幫你創建一個新錢包地址：
```javascript
Select key scheme to generate keypair (0 for ed25519, 1 for secp256k1, 2 for secp256r1):
```
輸入要使用的加密方式 0、1、2
本文章是使用 0

最後Sui會返回類似於以下內容的消息（取決於您選擇的密鑰方案），其中包括錢包地址(紅色框框)和該錢包地址的12個註記詞(黃色框框)：

![](https://hackmd.io/_uploads/Hyo0xRF8n.png)

### 2. 使用註記詞連接錢包

- ### 安裝 [Chrome Sui Wallet插件](https://chrome.google.com/webstore/detail/sui-wallet/opcgpfmipidbgpenhmajoajpbobppdil/related?utm_source=ext_sidebar&hl=zh-TW)

安裝完畢後會跳到這個頁面
![](https://hackmd.io/_uploads/BkzMSVFo2.png)

我們選擇第二個 Import an Existing Wallet
![](https://hackmd.io/_uploads/rkvSHVtsh.png)

把剛剛產生的註記詞，複製貼上
![](https://hackmd.io/_uploads/BkFABEKin.png)

設定密碼，這樣我們錢包就設定好了
![](https://hackmd.io/_uploads/BJKk8NFon.png)

接下來我們需要取得測試用的Token
我們先點右上角，並切換至testnet，
![](https://hackmd.io/_uploads/SkLg7rFsn.png)
![](https://hackmd.io/_uploads/HJPm7SFoh.png)
![](https://hackmd.io/_uploads/BkhNQrtoh.png)
設定完我們就返回上一頁，然後點Request Testnet SUI Tokens
取得測試用的Token
![](https://hackmd.io/_uploads/BkBFmHti2.png)

如果錢包領取測試Toekn按鈕沒辦法點的話
我們可以去官方的 [Discord](https://discord.com/invite/sui)
並在testnet-faucet頻道輸入 !faucet 錢包地址
![](https://hackmd.io/_uploads/BJ8mE_WWT.png)

## 第二步、操作 SUI 的常用指令

參考文件 https://docs.sui.io/build/cli-client

### 常用的

#### 指令的詳細說明 sui client help

實際操作
```javascript
PS D:\vscode\workspace> sui client help
sui.exe-client 
Client for interacting with the Sui network

USAGE:
    sui.exe client [OPTIONS] [SUBCOMMAND]

OPTIONS:
        --client.config <CONFIG>    Sets the file storing the state of our user accounts (an empty
                                    one will be created if missing)
    -h, --help                      Print help information
        --json                      Return command outputs in json format
    -y, --yes

SUBCOMMANDS:
    active-address           Default address used for commands when none specified
    active-env               Default environment used for commands when none specified
    addresses                Obtain the Addresses managed by the client
    call                     Call Move function
    chain-identifier         Query the chain identifier from the rpc endpoint
    dynamic-field            Query a dynamic field by its address
    envs                     List all Sui environments
    execute-signed-tx        Execute a Signed Transaction. This is useful when the user prefers
                                 to sign elsewhere and use this command to execute
    gas                      Obtain all gas objects owned by the address
    help                     Print this message or the help of the given subcommand(s)
    merge-coin               Merge two coin objects into one coin
    new-address              Generate new address and keypair with keypair scheme flag {ed25519
                                 | secp256k1 | secp256r1} with optional derivation path, default to
                                 m/44'/784'/0'/0'/0' for ed25519 or m/54'/784'/0'/0/0 for secp256k1
                                 or m/74'/784'/0'/0/0 for secp256r1. Word length can be { word12 |
                                 word15 | word18 | word21 | word24} default to word12 if not
                                 specified
    new-env                  Add new Sui environment
    object                   Get object info
    objects                  Obtain all objects owned by the address
    pay                      Pay coins to recipients following specified amounts, with input
                                 coins. Length of recipients must be the same as that of amounts
    pay-all-sui              Pay all residual SUI coins to the recipient with input coins, after
                                 deducting the gas cost. The input coins also include the coin for
                                 gas payment, so no extra gas coin is required
    pay-sui                  Pay SUI coins to recipients following following specified amounts,
                                 with input coins. Length of recipients must be the same as that of
                                 amounts. The input coins also include the coin for gas payment, so
                                 no extra gas coin is required
    publish                  Publish Move modules
    split-coin               Split a coin object into multiple coins
    switch                   Switch active address and network(e.g., devnet, local rpc server)
    transfer                 Transfer object
    transfer-sui             Transfer SUI, and pay gas with the same SUI coin object. If amount
                                 is specified, only the amount is transferred; otherwise the entire
                                 object is transferred
    tx-block                 Get the effects of executing the given transaction block
    upgrade                  Upgrade Move modules
    verify-bytecode-meter    Run the bytecode verifier on the package
    verify-source            Verify local Move packages against on-chain packages, and
                                 optionally their dependencies
```

對sui client active-address使用-h --help
```javascript
PS D:\vscode\workspace> sui client active-address -h
sui.exe-client-active-address 
Default address used for commands when none specified

USAGE:
    sui.exe client active-address [OPTIONS]

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
PS D:\vscode\workspace> sui client active-address -help
sui.exe-client-active-address 
Default address used for commands when none specified

USAGE:
    sui.exe client active-address [OPTIONS]

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```
```javascript
PS D:\vscode\workspace> sui client active-address --help
sui.exe-client-active-address 
Default address used for commands when none specified

USAGE:
    sui.exe client active-address [OPTIONS]

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

#### 創建新的智能合約專案 sui move new

先來查看該指令說明，發現需要強制帶一個參數name
```javascript
PS D:\vscode\workspace\test_demo> sui move new -h
sui.exe-move-new 
Create a new Move package with name `name` at `path`. If `path` is not provided the package will be
created in the directory `name`

USAGE:
    sui.exe move new [OPTIONS] <NAME>

ARGS:
    <NAME>    The name of the package to be created
```

實際操作
```javascript
PS D:\vscode\workspace> sui move new test_demo
```
![](https://hackmd.io/_uploads/BJY64USin.png)

![](https://hackmd.io/_uploads/SJEANISs3.png)

#### 添加新的 Sui 環境 sui client new-env

先來查看該指令說明，發現需要帶2個參數，一個alias，另一個是rpc
alias是環境別名，rpc是他所屬的網路url
<table>
    <thead>
        <tr>
            <th>Alias 環境別名</th>
            <th>RPC URL</th>
            <th>說明</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>mainnet</td>
            <td>https://fullnode.mainnet.sui.io:443</td>
            <td>正式環境</td>
        </tr>
        <tr>
            <td>testnet</td>
            <td>https://fullnode.testnet.sui.io:443</td>
            <td>測試環境</td>
        </tr>
        <tr>
            <td>devnet</td>
            <td>https://fullnode.devnet.sui.io:443</td>
            <td>開發環境</td>
        </tr>
    </tbody>
</table>

```javascript
PS D:\vscode\workspace\test_demo> sui client new-env -h
sui.exe-client-new-env 
Add new Sui environment

USAGE:
    sui.exe client new-env [OPTIONS] --alias <ALIAS> --rpc <RPC>

OPTIONS:
        --alias <ALIAS>
    -h, --help             Print help information
        --json             Return command outputs in json format
        --rpc <RPC>
        --ws <WS>
```

實際操作，我們增加testnet
```javascript
PS D:\vscode\workspace\test_demo> sui client new-env --alias testnet --rpc https://fullnode.testnet.sui.io:443
Added new Sui env [testnet] to config.
```

#### 列出所有 Sui 環境 sui client envs

- 這邊補充講解一下devnet、testnet跟mainnet的差別
- devnet是開發環境，可以讓你隨意測試及部署你的智能合約，但是因為版本會更新比較頻繁，所以穩定性沒那麼高，然後官方每一段時間會清除devnet鏈上的全部資料
- testnet是測試環境，也是可以讓你隨意測試及部署你的智能合約，版本更新不會很頻繁，穩定性比較高，而且testnet鏈上資料不會每隔一段時間被清除，所以這邊推薦使用testnet
- mainnet是正式環境，是需要花真正的Sui幣去部署合約及測試的環境

先來查看該指令說明，發現可以不必帶任何參數
```javascript
PS D:\vscode\workspace\test_demo> sui client envs -h
sui.exe-client-envs 
List all Sui environments

USAGE:
    sui.exe client envs [OPTIONS]

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client envs
devnet => https://fullnode.devnet.sui.io:443 (active)
testnet => https://fullnode.testnet.sui.io:443
```
我們發現剛剛增加的testnet已經在我們的Client端了

#### 產生新的錢包地址 sui client new-address

先來查看該指令說明，需輸入加密方式 {ed25519 或 secp256k1 或 secp256r1} 生成新的地址和密鑰
```javascript
PS D:\vscode\workspace\test_demo> sui client new-address -h
sui.exe-client-new-address 
Generate new address and keypair with keypair scheme flag {ed25519 | secp256k1 | secp256r1} with
optional derivation path, default to m/44'/784'/0'/0'/0' for ed25519 or m/54'/784'/0'/0/0 for
secp256k1 or m/74'/784'/0'/0/0 for secp256r1. Word length can be { word12 | word15 | word18 | word21
| word24} default to word12 if not specified

USAGE:
    sui.exe client new-address [OPTIONS] <KEY_SCHEME> [ARGS]

ARGS:
    <KEY_SCHEME>
    <WORD_LENGTH>
    <DERIVATION_PATH>

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client new-address ed25519
Created new keypair for address with scheme ED25519: [0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b]
Secret Recovery Phrase : [hair amount spoil enhance toe wagon offer dream twin extend life start]
```
錢包地址
0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b

12個註記詞
[hair amount spoil enhance toe wagon offer dream twin extend life start]

#### 獲取客戶端所有的錢包地址 sui client addresses

先來查看該指令說明，發現不用帶任何參數
```javascript
PS D:\vscode\workspace\test_demo> sui client addresses -h
sui.exe-client-addresses 
Obtain the Addresses managed by the client

USAGE:
    sui.exe client addresses [OPTIONS]

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client addresses
Showing 3 results.
0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b
0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a <=
```

可以看到上方有一個箭頭，他代表目前所預設使用的錢包地址
然後可以看到我們剛剛設定的錢包地址，也在上面列表內

#### 切換預設錢包或環境 sui client switch

先來查看該指令說明，可以發現我們切換address(錢包地址)，也可以切換Env(鏈上環境)
```javascript
PS D:\vscode\workspace\test_demo> sui client switch -h
sui.exe-client-switch 
Switch active address and network(e.g., devnet, local rpc server)

USAGE:
    sui.exe client switch [OPTIONS]

OPTIONS:
        --address <ADDRESS>    An Sui address to be used as the active address for subsequent
                               commands
        --env <ENV>            The RPC server URL (e.g., local rpc server, devnet rpc server, etc)
                               to be used for subsequent commands
    -h, --help                 Print help information
        --json                 Return command outputs in json format
```

- 切換錢包實際操作

我們先切換錢包地址前，先查詢目前我們所擁有哪些錢包地址，因此要用前面剛剛講解過的指令
```javascript
PS D:\vscode\workspace\test_demo> sui client addresses   
Showing 3 results.
0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b
0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a <=
```
我們可以發現目前是預設使用第三個地址，接下來我們要把第二個改成預設的地址
```javascript
PS D:\vscode\workspace\test_demo> sui client switch --address 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Active address switched to 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
```
這樣我們就切換完畢，我們可以在確認一次看看是否已經更換預設地址了
```javascript
PS D:\vscode\workspace\test_demo> sui client addresses  
Showing 3 results.
0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b
0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 <=
0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a
```

- 切換環境實際操作

我們先切換環境前，先查詢目前我們所擁有哪些鏈上環境，因此要用前面剛剛講解過的指令
```javascript
PS D:\vscode\workspace\test_demo> sui client envs
devnet => https://fullnode.devnet.sui.io:443 (active)
testnet => https://fullnode.testnet.sui.io:443
```
發現目前是用devnet環境，接下來我們要把預設鏈上環境切換成testnet
那我們切換所要帶的參數Env，帶環境別名即可，不需要帶rpc url
```javascript
PS D:\vscode\workspace\test_demo> sui client switch --env testnet
Active environment switched to [testnet]
```
檢查一下是否已經切換過去了
```javascript
PS D:\vscode\workspace\test_demo> sui client envs
devnet => https://fullnode.devnet.sui.io:443
testnet => https://fullnode.testnet.sui.io:443 (active)
```

#### 獲取該錢包擁有的所有gas fee物件 sui client gas

先來查看該指令說明，發現不用帶任何參數
```javascript
PS D:\vscode\workspace\test_demo> sui client gas -h
sui.exe-client-gas 
Obtain all gas objects owned by the address

USAGE:
    sui.exe client gas [OPTIONS] [owner_address]

ARGS:
    <owner_address>    Address owning the objects

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client gas
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
                             Object ID                              |  Gas Value 
----------------------------------------------------------------------------------
 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 |  900000000
 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532 |  907004836
```
我們目前有2個gas物件，一個有900000000，另一個有907004836

#### 將一個硬幣拆分為多個硬幣 sui client split-coin

- 補充 : 要分割一枚硬幣，至少需要 2 個硬幣物件，一個用於分割，一個用於支付手續費。

先來查看該指令說明
<COIN_ID> 為需要做拆分的物件ID
<GAS_BUDGET> 為手續費Gas Fee的上限，通常我會設 100000000
然後你可以用金額來分割，也可以用數量來分割
金額分割可以分割出你想要的金額
數量分割可以分割同等份的N數量物件

```javascript
PS D:\vscode\workspace\test_demo> sui client split-coin -h
sui.exe-client-split-coin 
Split a coin object into multiple coins

USAGE:
    sui.exe client split-coin [OPTIONS] --coin-id <COIN_ID> --gas-budget <GAS_BUDGET> <--amounts <AMOUNTS>...|--count <COUNT>>

OPTIONS:
        --amounts <AMOUNTS>...
            Specific amounts to split out from the coin

        --coin-id <COIN_ID>
            Coin to Split, in 20 bytes Hex string

        --count <COUNT>
            Count of equal-size coins to split into

        --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 call

    -h, --help
            Print help information

        --json
            Return command outputs in json format

        --serialize-signed-transaction
            Instead of executing the transaction, serialize the bcs bytes of the signed transaction
            data (SenderSignedData) using base64 encoding, and print out the string

        --serialize-unsigned-transaction
            Instead of executing the transaction, serialize the bcs bytes of the unsigned
            transaction data (TransactionData) using base64 encoding, and print out the string
```

實際操作，我們用金額來分割Token，然後我們使用第一個Gas物件地址
```javascript
PS D:\vscode\workspace\test_demo> sui client split-coin --coin-id 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 --gas-budget 100000000 --amounts 100
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
----- Transaction Digest ----
Dym6pYHS5kvCjPvesWd3q3DFptcJ6yMWoUrMuvXQS7Bp
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 114, 34, 27, 136, 149, 179, 143, 135, 217, 21, 223, 201, 254, 25, 148, 72, 0, 76, 62, 176, 12, 254, 157, 159, 117, 29, 22, 219, 39, 244, 33, 206, 23, 86, 106, 65, 127, 185, 146, 36, 184, 227, 156, 202, 4, 162, 3, 196, 99, 155, 112, 148, 108, 218, 239, 36, 132, 232, 174, 172, 248, 76, 76, 3, 58, 93, 198, 149, 185, 43, 200, 25, 187, 36, 86, 75, 17, 29, 236, 207, 160, 7, 249, 56, 181, 164, 70, 98, 118, 212, 233, 136, 158, 212, 97, 1])))]
Transaction Kind : Programmable
Inputs: [Object(ImmOrOwnedObject { object_id: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4, version: SequenceNumber(775538), digest: o#2fgw11Z72QjrvVVfgHkMPt2A4Lc3iVVHv8dSho4afMwb }), Pure(SuiPureValue { value_type: Some(Vector(U64)), value: ["100"] })]
Commands: [
  MoveCall(0x0000000000000000000000000000000000000000000000000000000000000002::pay::split_vec<0x2::sui::SUI>(Input(0),Input(1))),
]

Sender: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Payment: Object ID: 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532, version: 0xbd578, digest: 6VV35FJxVaPYDuF5KYMyFTnjmYBkaethJ6W5TjUFcJCx
Gas Owner: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Price: 1000
Gas Budget: 100000000

----- Transaction Effects ----
Status : Success
Created Objects:
  - ID: 0x15e5f4a9bbc17256179679c9402057beb9268e79004593e7353bed452ff9076b , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )
Mutated Objects:
  - ID: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )
  - ID: 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )

----- Events ----
Array []
----- Object changes ----
Array [
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4"),
        "version": String("775545"),
        "previousVersion": String("775538"),
        "digest": String("E7cfef8veoq4rtJGvNTpuxsausMmNMdmW9U67LUubsDX"),
    },
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532"),
        "version": String("775545"),
        "previousVersion": String("775544"),
        "digest": String("FKLqKge4gV9nihFAbYHEpCfGBpAUeUBLKhA9tN2R536F"),
    },
    Object {
        "type": String("created"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x15e5f4a9bbc17256179679c9402057beb9268e79004593e7353bed452ff9076b"),
        "version": String("775545"),
        "digest": String("5fafhi791eBBpbBDH47VFhbvJtvaDxohVKdx9mfE4xdF"),
    },
]
----- Balance changes ----
Array [
    Object {
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "coinType": String("0x2::sui::SUI"),
        "amount": String("-2007760"),
    },
]
```
我們來查看是否有分出100個出來
```javascript
PS D:\vscode\workspace\test_demo> sui client gas                                            
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
                             Object ID                              |  Gas Value 
----------------------------------------------------------------------------------
 0x15e5f4a9bbc17256179679c9402057beb9268e79004593e7353bed452ff9076b |     100
 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 |  899999900
 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532 |  904997076
```

#### 將多個硬幣合併為一枚硬幣 sui client merge-coin

先來查看該指令說明
<PRIMARY_COIN> 是主要合併的硬幣，該物件還會存在
<COIN_TO_MERGE> 是要被合併的硬幣，該物件會被丟棄
<GAS_BUDGET> 手續費Gas Fee上限
```javascript
PS D:\vscode\workspace\test_demo> sui client merge-coin -h
sui.exe-client-merge-coin 
Merge two coin objects into one coin

USAGE:
    sui.exe client merge-coin [OPTIONS] --primary-coin <PRIMARY_COIN> --coin-to-merge <COIN_TO_MERGE> --gas-budget <GAS_BUDGET>

OPTIONS:
        --coin-to-merge <COIN_TO_MERGE>
            Coin to be merged, in 20 bytes Hex string

        --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 call

    -h, --help
            Print help information

        --json
            Return command outputs in json format

        --primary-coin <PRIMARY_COIN>
            Coin to merge into, in 20 bytes Hex string

        --serialize-signed-transaction
            Instead of executing the transaction, serialize the bcs bytes of the signed transaction
            data (SenderSignedData) using base64 encoding, and print out the string

        --serialize-unsigned-transaction
            Instead of executing the transaction, serialize the bcs bytes of the unsigned
            transaction data (TransactionData) using base64 encoding, and print out the string
```

實際操作，我們把100金額的物件merge回去
```javascript
PS D:\vscode\workspace\test_demo> sui client merge-coin --primary-coin 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 --coin-to-merge 0x15e5f4a9bbc17256179679c9402057beb9268e79004593e7353bed452ff9076b --gas-budget 100000000
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
----- Transaction Digest ----
9Mu5VjV34RgHqfxm7Uhq3VD7Fqj3PUuDjecd6qTaFaVF
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 233, 91, 209, 255, 207, 76, 96, 33, 103, 151, 132, 100, 98, 6, 198, 16, 228, 209, 14, 138, 56, 52, 96, 173, 155, 64, 139, 241, 227, 217, 16, 121, 177, 13, 42, 45, 186, 108, 9, 61, 171, 237, 193, 39, 220, 239, 11, 6, 189, 238, 87, 208, 161, 197, 164, 20, 130, 49, 213, 213, 253, 149, 92, 13, 58, 93, 198, 149, 185, 43, 200, 25, 187, 36, 86, 75, 17, 29, 236, 207, 160, 7, 249, 56, 181, 164, 70, 98, 118, 212, 233, 136, 158, 212, 97, 1])))]
Transaction Kind : Programmable
Inputs: [Object(ImmOrOwnedObject { object_id: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4, version: SequenceNumber(775545), digest: o#E7cfef8veoq4rtJGvNTpuxsausMmNMdmW9U67LUubsDX }), Object(ImmOrOwnedObject { object_id: 0x15e5f4a9bbc17256179679c9402057beb9268e79004593e7353bed452ff9076b, version: SequenceNumber(775545), digest: o#5fafhi791eBBpbBDH47VFhbvJtvaDxohVKdx9mfE4xdF })]
Commands: [
  MoveCall(0x0000000000000000000000000000000000000000000000000000000000000002::pay::join<0x2::sui::SUI>(Input(0),Input(1))),
]

Sender: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Payment: Object ID: 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532, version: 0xbd579, digest: FKLqKge4gV9nihFAbYHEpCfGBpAUeUBLKhA9tN2R536F
Gas Owner: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Price: 1000
Gas Budget: 100000000

----- Transaction Effects ----
Status : Success
Mutated Objects:
  - ID: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )
  - ID: 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )
Deleted Objects:
  - ID: 0x15e5f4a9bbc17256179679c9402057beb9268e79004593e7353bed452ff9076b

----- Events ----
Array []
----- Object changes ----
Array [
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4"),
        "version": String("775546"),
        "previousVersion": String("775545"),
        "digest": String("CYuHnJhpYXqmySZhAtzdnEppCSLzjquWZJSay1CeRrvk"),
    },
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532"),
        "version": String("775546"),
        "previousVersion": String("775545"),
        "digest": String("3XQN44KktWunNFFpUcYNrih6oFmxjYzRtMC9Uuu21SMo"),
    },
]
----- Balance changes ----
Array [
    Object {
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "coinType": String("0x2::sui::SUI"),
        "amount": String("-41640"),
    },
]
```
查看100金額的物件是否被merge回去了
```javascript
PS D:\vscode\workspace\test_demo> sui client gas                                                                                                                                                                         
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
                             Object ID                              |  Gas Value 
----------------------------------------------------------------------------------
 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 |  900000000
 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532 |  904955436
```

#### 編譯智能合約 sui move build

進入test_demo資料夾內
```javascript
cd test_demo
```

在sources資料夾內建立一個test.move檔，撰寫一個簡易的智能合約

![](https://hackmd.io/_uploads/B1CHSUBjh.png)

```javascript=
module test_demo::test {

    use sui::object::{Self, UID};
    use sui::table::{Self, Table};
    use sui::transfer;
    use sui::tx_context::{Self, TxContext};

    struct TestObject has key, store {
        id: UID,
        table: Table<address, bool>
    }

    public entry fun create (ctx: &mut TxContext){

        let my_table = table::new(ctx);
        table::add(&mut my_table, tx_context::sender(ctx), true);

        let test_object = TestObject{
            id: object::new(ctx),
            table: my_table,
        };
        transfer::transfer(test_object, tx_context::sender(ctx));
    }
}
```

- 補充：
智能合約語法及說明，之後的影片及文件章節會教到
想先預習的同學，也可以點擊下方這個教學文件，這樣之後會聽的更懂喔~
- 智能合約語法搶先看！
[SUI Move 基本語法說明](https://hackmd.io/@T-ZlltMqS5Gto0yg81E7DQ/ByMgn6owh)
[SUI Move 中等語法說明](https://hackmd.io/v7uwvkcARqWmOUHpKT81Bw)

接下來我們一樣先來查看該指令說明，發現該指令不強制帶入任何參數
也可以在Options選擇想要帶入的參數
```javascript
PS D:\vscode\workspace\test_demo> sui move build -h
sui.exe-move-build 
Build the package at `path`. If no path is provided defaults to current directory

USAGE:
    sui.exe move build [OPTIONS]

OPTIONS:
        --abi
            Generate ABIs for packages

    -d, --dev
            Compile in 'dev' mode. The 'dev-addresses' and 'dev-dependencies' fields will be used if
            this flag is set. This flag is useful for development of packages that expose named
            addresses that are not set to a specific value

        --default-move-edition <DEFAULT_EDITION>
            Default edition for move compilation, if not specified in the package's config

        --default-move-flavor <DEFAULT_FLAVOR>
            Default flavor for move compilation, if not specified in the package's config

        --doc
            Generate documentation for packages

        --dump-bytecode-as-base64
            Whether we are printing in base64

        --fetch-deps-only
            Only fetch dependency repos to MOVE_HOME

        --force
            Force recompilation of all packages

        --generate-struct-layouts
            If true, generate struct layout schemas for all struct types passed into `entry`
            functions declared by modules in this package These layout schemas can be consumed by
            clients (e.g., the TypeScript SDK) to enable serialization/deserialization of
            transaction arguments and events

    -h, --help
            Print help information

        --install-dir <INSTALL_DIR>
            Installation directory for compiled artifacts. Defaults to current directory

        --legacy-digest
            Use the legacy digest calculation algorithm

        --lint
            If `true`, enable linters

    -p, --path <PACKAGE_PATH>
            Path to a package which the command should be run with respect to

        --skip-fetch-latest-git-deps
            Skip fetching latest git dependencies

        --test
            Compile in 'test' mode. The 'dev-addresses' and 'dev-dependencies' fields will be used
            along with any code in the 'tests' directory

        --with-unpublished-dependencies
            Include the contents of packages in dependencies that haven't been published (only
            relevant when dumping bytecode as base64)
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui move build
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING test_demo
```

#### 發布智能合約 sui client publish

先來查看該指令說明，發現該指令需要強制帶一個參數<GAS_BUDGET>
```javascript
PS D:\vscode\workspace\test_demo> sui client publish -h
sui.exe-client-publish 0.1.0
Diem Association <opensource@diem.com>
Publish Move modules

USAGE:
    sui.exe client publish [OPTIONS] --gas-budget <GAS_BUDGET> [package_path]

ARGS:
    <package_path>    Path to directory containing a Move package [default: .]

OPTIONS:
        --abi
            Generate ABIs for packages

    -d, --dev
            Compile in 'dev' mode. The 'dev-addresses' and 'dev-dependencies' fields will be used if
            this flag is set. This flag is useful for development of packages that expose named
            addresses that are not set to a specific value

        --default-move-edition <DEFAULT_EDITION>
            Default edition for move compilation, if not specified in the package's config

        --default-move-flavor <DEFAULT_FLAVOR>
            Default flavor for move compilation, if not specified in the package's config

        --doc
            Generate documentation for packages

        --fetch-deps-only
            Only fetch dependency repos to MOVE_HOME

        --force
            Force recompilation of all packages

        --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 running module initializers

    -h, --help
            Print help information

        --install-dir <INSTALL_DIR>
            Installation directory for compiled artifacts. Defaults to current directory

        --json
            Return command outputs in json format

        --lint
            If `true`, enable linters

        --serialize-signed-transaction
            Instead of executing the transaction, serialize the bcs bytes of the signed transaction
            data (SenderSignedData) using base64 encoding, and print out the string

        --serialize-unsigned-transaction
            Instead of executing the transaction, serialize the bcs bytes of the unsigned
            transaction data (TransactionData) using base64 encoding, and print out the string

        --skip-dependency-verification
            Publish the package without checking whether compiling dependencies from source results
            in bytecode matching the dependencies found on-chain

        --skip-fetch-latest-git-deps
            Skip fetching latest git dependencies

        --test
            Compile in 'test' mode. The 'dev-addresses' and 'dev-dependencies' fields will be used
            along with any code in the 'tests' directory

    -V, --version
            Print version information

        --with-unpublished-dependencies
            Also publish transitive dependencies that have not already been published
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client publish --gas-budget 100000000
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING test_demo
Successfully verified dependencies on-chain against source.
----- Transaction Digest ----
31gQ7dU8qvahzjXZZqcrDeQQWv2WzYbum1zgMk9928no
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 44, 212, 92, 91, 166, 93, 249, 144, 208, 105, 162, 83, 89, 209, 47, 104, 6, 147, 227, 37, 82, 167, 4, 231, 111, 106, 68, 46, 122, 115, 76, 1, 177, 120, 35, 179, 255, 124, 41, 92, 230, 209, 164, 247, 26, 226, 244, 197, 219, 183, 246, 117, 40, 239, 233, 151, 146, 180, 89, 107, 125, 245, 57, 1, 58, 93, 198, 149, 185, 43, 200, 25, 187, 36, 86, 75, 17, 29, 236, 207, 160, 7, 249, 56, 181, 164, 70, 98, 118, 212, 233, 136, 158, 212, 97, 1])))]
Transaction Kind : Programmable
Inputs: [Pure(SuiPureValue { value_type: Some(Address), value: "0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9" })]
Commands: [
  Publish(<modules>,0x0000000000000000000000000000000000000000000000000000000000000001,0x0000000000000000000000000000000000000000000000000000000000000002),
  TransferObjects([Result(0)],Input(0)),
]

Sender: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Payment: Object ID: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4, version: 0xbd57c, digest: BCfRuUcawTySNnC2S4PHJYhKwkPX2aqLaGx8BqdHAJ5M
Gas Owner: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Price: 1000
Gas Budget: 100000000

----- Transaction Effects ----
Status : Success
Created Objects:
  - ID: 0xb0b11666e20ca30467d5ce16c903cd5bfc497e59e7345032d53e32d09519ccb6 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )
  - ID: 0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45 , Owner: Immutable
Mutated Objects:
  - ID: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )

----- Events ----
Array []
----- Object changes ----
Array [
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4"),
        "version": String("775549"),
        "previousVersion": String("775548"),
        "digest": String("BgBzqqidGr2hASBDYT32xL77HX7WUkQmZAPHPxDjXWSY"),
    },
    Object {
        "type": String("created"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::package::UpgradeCap"),
        "objectId": String("0xb0b11666e20ca30467d5ce16c903cd5bfc497e59e7345032d53e32d09519ccb6"),
        "version": String("775549"),
        "digest": String("2drYUu8DpgQUmjJgvFzCW74483MsdVDahK9D8HXqvsSV"),
    },
    Object {
        "type": String("published"),
        "packageId": String("0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45"),
        "version": String("1"),
        "digest": String("WF4cYn6Qvj7i9VJnvkVdGRwLPxRMUrFDZwbo95hfcQy"),
        "modules": Array [
            String("test"),
        ],
    },
]
----- Balance changes ----
Array [
    Object {
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "coinType": String("0x2::sui::SUI"),
        "amount": String("-7599080"),
    },
]
```

我們可以看到，我們總共有3個物件
```javascript
----- Object changes ----
Array [
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4"),
        "version": String("775549"),
        "previousVersion": String("775548"),
        "digest": String("BgBzqqidGr2hASBDYT32xL77HX7WUkQmZAPHPxDjXWSY"),
    },
    Object {
        "type": String("created"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::package::UpgradeCap"),
        "objectId": String("0xb0b11666e20ca30467d5ce16c903cd5bfc497e59e7345032d53e32d09519ccb6"),
        "version": String("775549"),
        "digest": String("2drYUu8DpgQUmjJgvFzCW74483MsdVDahK9D8HXqvsSV"),
    },
    Object {
        "type": String("published"),
        "packageId": String("0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45"),
        "version": String("1"),
        "digest": String("WF4cYn6Qvj7i9VJnvkVdGRwLPxRMUrFDZwbo95hfcQy"),
        "modules": Array [
            String("test"),
        ],
    },
]
```

接下來我們使用[Sui Explorer](https://suiexplorer.com/)查看物件說明

第一個地址
```
0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4
```
type是mutated，代表他是被異動的
objectType是0x2::coin::Coin<0x2::sui::SUI>
這是我們剛剛部署所花費的Gas Fee物件
![](https://hackmd.io/_uploads/Sy92k2ij2.png)


第二個地址
```
0xb0b11666e20ca30467d5ce16c903cd5bfc497e59e7345032d53e32d09519ccb6
```
type是created，代表他是被建造的
如果智能合約要做升級，會需要使用到這個物件來驗證，是否為這個智能合約的所有者
![](https://hackmd.io/_uploads/HJYpyhsj2.png)


第三個地址
```
0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45
```
type是published，代表他是被部署的
這個是我們智能合約的地址，也就是我們的Package ID
![](https://hackmd.io/_uploads/Hk9Jlhsih.png)

#### 獲取該錢包地址擁有的所有物件 sui client objects

先來查看該指令說明，發現可以不用帶任何參數，也可以指定要查找哪個owner_address底下的物件
```javascript
PS D:\vscode\workspace\test_demo> sui client objects -h
sui.exe-client-objects 
Obtain all objects owned by the address

USAGE:
    sui.exe client objects [OPTIONS] [owner_address]

ARGS:
    <owner_address>    Address owning the objects Shows all objects owned by `sui client
                       active-address` if no argument is passed

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client objects
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
                 Object ID                  |  Version   |                    Digest                    |   Owner Type    |               
Object Type
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 0x22f7663d83798c9203bb4b877a9587287ab9a1b32e43ff61d647fa722c1be28e |   775544   | MmnhhVSLAyNBE90djDivqIEqS8UcuLrjF9kX2Drtzsw= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: cf854206bd3aa29279857209bd3656ffdcd3b3df6e886d30e375749743d28fe8, module: Identifier("puddle"), name: Identifier("PuddleCap"), type_params: [Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("sui"), name: Identifier("SUI"), type_params: [] })] }))))
 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85 |   775550   | uKjMTUb/mZ4IM6V6Sr3rJqxpY74oxfJmR9ynyhpmgEo= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: b2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45, module: Identifier("test"), name: Identifier("TestObject"), type_params: [] }))))
 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 |   775550   | uzBMR4pekTWaqAjp5sWDw4VU+/jrhgz5BpolOYBTnDU= |  AddressOwner   |  Some(Struct(MoveObjectType(GasCoin)))
 0x53311e9e2f05cdb6a530e345f3bc40871f59df780f93aaa58888f4a8c7fdc201 |   775548   | QboN9StKBftUc6aQm87U6EPaB4n3mVSfGx0IOFCHfFA= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: 0874c6326441dc68ccd43544d13506b88be7b7040d8b12cadf8e58d1109c0be4, module: Identifier("test"), name: Identifier("TestObject"), type_params: [] }))))
 0xa9c0921472fa795e86ed6368c592c3f2eba3e09a8d1b78797c9833d9859306d9 |    319     | Eps8LjBjUVgUKE4ijPUdhrCG3YNmTwrZ/lyV6qfHAMY= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("package"), name: Identifier("UpgradeCap"), type_params: [] }))))
 0xb0b11666e20ca30467d5ce16c903cd5bfc497e59e7345032d53e32d09519ccb6 |   775549   | GEydP2SDPSfj3ljZgwEjSH2RIaLVt/SM6aXr9ub23lY= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("package"), name: Identifier("UpgradeCap"), type_params: [] }))))
 0xc34a1f82f17fbd292e08417de9e2bf22fda47db95b562772ef25b8ac9a4afef8 |   775538   | Jf5LRrJbh5wFkEGVDwuYYqReO+C2/GUON0SNwHbPsXk= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: c4761cc514d11dddf61f74cddb281de4cf4995dc381496768abffccf4824c723, module: Identifier("puddle"), name: Identifier("PuddleShares"), type_params: [Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("sui"), name: Identifier("SUI"), type_params: [] })] }))))
 0xc37d7dba368634789a884a7661d3e6b8e369a40fcd4e7ad7637a2ef97465105e |   775547   | 06md1nmsn8+gsKJOBGvpBvn5uLopU9J9xN1h2Jljv/E= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("package"), name: Identifier("UpgradeCap"), type_params: [] }))))
 0xca6bd8b2fe9d2f2025e25cccfab0fcffabcb3ada051a6b40da9a4314152e2892 |    320     | 573Oh2wBCfcG7Xq3Os7tieAe9lJwgHmxfIcA2D6vOV4= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("package"), name: Identifier("UpgradeCap"), type_params: [] }))))
 0xcb6f68fbb369220710059c2096c5922f5ab5ae4d65f28e7286ed43129eec9532 |   775546   | JYE2+GzQHuLTLD1RXsD6T7If0cci7y+ftvt6Vw3GjUo= |  AddressOwner   |  Some(Struct(MoveObjectType(GasCoin)))
Showing 10 results.
```

#### 獲取該物件資訊 sui client object

先來查看該指令說明，需要帶入一個object_id
```javascript
PS D:\vscode\workspace\test_demo> sui client object -h 
sui.exe-client-object 
Get object info

USAGE:
    sui.exe client object [OPTIONS] <object_id>

ARGS:
    <object_id>    Object ID of the object to fetch

OPTIONS:
        --bcs     Return the bcs serialized version of the object
    -h, --help    Print help information
        --json    Return command outputs in json format
```

我們把剛剛TestObject的object_id帶入看看

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client object 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
----- 0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45::test::TestObject (0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85[0xbd57e]) -----
Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )
Version: 0xbd57e
Storage Rebate: 1603600
Previous Transaction: TransactionDigest(9kwWeLLRZpN7wPbtdVGbdkGgi5AHBg2AMDju8TWnwjeX)
----- Data -----
type: 0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45::test::TestObject
id: 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85
table:
  type: 0x2::table::Table<address, bool>
  id: 0xf760af890b48272191553136f345c5f765d5ed6a9870e715aec70c81a3a6b759
  size: 1
```

#### 轉移物件 sui client transfer

先來查看該指令說明，發現他需要TO、OBJECT_ID以及GAS_BUDGET
TO是要轉移給哪個錢包地址
OBJECT_ID是要轉移哪個物件的對應ID
GAS_BUDGET就是Gas Fee的上限
```javascript
PS D:\vscode\workspace\test_demo> sui client transfer -h
sui.exe-client-transfer 
Transfer object

USAGE:
    sui.exe client transfer [OPTIONS] --to <TO> --object-id <OBJECT_ID> --gas-budget <GAS_BUDGET>

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

    -h, --help
            Print help information

        --json
            Return command outputs in json format

        --object-id <OBJECT_ID>
            Object to transfer, in 20 bytes Hex string

        --serialize-signed-transaction
            Instead of executing the transaction, serialize the bcs bytes of the signed transaction
            data (SenderSignedData) using base64 encoding, and print out the string

        --serialize-unsigned-transaction
            Instead of executing the transaction, serialize the bcs bytes of the unsigned
            transaction data (TransactionData) using base64 encoding, and print out the string

        --to <TO>
            Recipient address
```

首先我們先來查看有管理哪些錢包地址
```javascript
PS D:\vscode\workspace\test_demo> sui client addresses 
Showing 3 results.
0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b
0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 <=
0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a
```
上方可以看到，目前我管理的帳戶有三個，然後目前預設是使用第二個，所以我們現在要來把TestObject轉給第一個地址試試看

實際操作，我們來轉移剛剛的TestObject給第一個錢包地址0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b
```javascript
PS D:\vscode\workspace\test_demo> sui client transfer --to 0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b --object-id 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85 --gas-budget 100000000
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
----- Transaction Digest ----
BMY8hYGg1VBEGNvELyrPSBYC3swVY7ZD2qJiqg9WChaY
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 89, 145, 84, 22, 5, 159, 16, 60, 33, 20, 154, 56, 197, 218, 162, 30, 212, 128, 0, 155, 53, 65, 255, 43, 145, 28, 23, 196, 210, 207, 14, 64, 126, 196, 204, 253, 200, 149, 53, 208, 8, 131, 248, 138, 156, 137, 0, 3, 178, 6, 118, 89, 179, 197, 229, 62, 127, 121, 184, 60, 46, 134, 33, 6, 237, 217, 83, 0, 35, 48, 205, 138, 190, 191, 43, 45, 28, 161, 109, 106, 32, 114, 132, 104, 131, 80, 188, 191, 215, 184, 41, 247, 113, 198, 58, 16])))]
Transaction Kind : Programmable
Inputs: [Pure(SuiPureValue { value_type: Some(Address), value: "0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b" }), Object(ImmOrOwnedObject { object_id: 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85, version: SequenceNumber(775551), digest: o#ChGVKcth2toFN6SiPEgsF23Qx3WzPfYUSPcU9K5jwYfL })]
Commands: [
  TransferObjects([Input(1)],Input(0)),
]

Sender: 0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a
Gas Payment: Object ID: 0x21bc8d6c3bb97d1459bbc8fad7802d2a4e69eafeef096e91cee0e6c28ee7bc04, version: 0x2e7f57, digest: BvaqDpedzgdZSCLPED9Ka4De81HZW5rD8YzAHkkPsEpA
Gas Owner: 0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a
Gas Price: 1000
Gas Budget: 100000000

----- Transaction Effects ----
Status : Success
Mutated Objects:
  - ID: 0x21bc8d6c3bb97d1459bbc8fad7802d2a4e69eafeef096e91cee0e6c28ee7bc04 , Owner: Account Address ( 0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a )
  - ID: 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85 , Owner: Account Address ( 0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b )

----- Events ----
Array []
----- Object changes ----
Array [
    Object {
        "type": String("mutated"),
        "sender": String("0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a"),
        "owner": Object {
            "AddressOwner": String("0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x21bc8d6c3bb97d1459bbc8fad7802d2a4e69eafeef096e91cee0e6c28ee7bc04"),
        "version": String("3047256"),
        "previousVersion": String("3047255"),
        "digest": String("4PEvLYU6JX2yiYLy4JzMDjKMCtP164XtoDPQY539xnt2"),
    },
    Object {
        "type": String("mutated"),
        "sender": String("0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a"),
        "owner": Object {
            "AddressOwner": String("0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b"),
        },
        "objectType": String("0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45::test::TestObject"),
        "objectId": String("0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85"),
        "version": String("3047256"),
        "previousVersion": String("775551"),
        "digest": String("3UHPasBEJwhQMioGS7kJKBgyKwmFPXixQBXtJzMMvutY"),
    },
]
----- Balance changes ----
Array [
    Object {
        "owner": Object {
            "AddressOwner": String("0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a"),
        },
        "coinType": String("0x2::sui::SUI"),
        "amount": String("-1025916"),
    },
]
```

轉移成功後，我們來看一下第一個錢包地址0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b是否擁有TestObject了
```javascript
PS D:\vscode\workspace\test_demo> sui client objects 0x48d6c83dec6ffcf354ad5670e2123d97ca49b8c7b0a6212bbc047d884f0dbd3b                   
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
                 Object ID                  |  Version   |                    Digest                    |   Owner Type    |               
Object Type
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85 |  3047256   | JLSWVGwVssn2c985DbkZuLmF0qR+wtHTNQeija1U/MU= |  AddressOwner   | Some(Struct(MoveObjectType(Other(StructTag { address: b2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45, module: Identifier("test"), name: Identifier("TestObject"), type_params: [] }))))
Showing 1 results.
```

- 補充 : 轉移物件sui client transfer也可以轉移Sui Coin喔~

### 補充

#### 目前客戶端預設錢包的地址 sui client active-address

先來查看該指令說明，發現不用帶任何參數
```javascript
PS D:\vscode\workspace\test_demo> sui client active-address -h
sui.exe-client-active-address 
Default address used for commands when none specified

USAGE:
    sui.exe client active-address [OPTIONS]

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client active-address   
0xb7d55662e27edb025564cdc066a02bbe91aa0daae2a8b6581bb77a7d8770263a
```

#### 目前預設連線的環境 sui client active-env

先來查看該指令說明，發現不用帶任何參數
```javascript
PS D:\vscode\workspace\test_demo> sui client active-env -h
sui.exe-client-active-env 
Default environment used for commands when none specified

USAGE:
    sui.exe client active-env [OPTIONS]

OPTIONS:
    -h, --help    Print help information
        --json    Return command outputs in json format
```

實際操作，發現目前是 devnet (開發環境)
```
PS D:\vscode\workspace\test_demo> sui client active-env
devnet
```


#### 呼叫智能合約內的某個功能 sui client call

先來查看該指令說明，可以發現我們要帶入PACKAGE、MODULE、FUNCTION以及GAS_BUDGET
```javascript
PS D:\vscode\workspace\test_demo> sui client call -h
sui.exe-client-call 
Call Move function

USAGE:
    sui.exe client call [OPTIONS] --package <PACKAGE> --module <MODULE> --function <FUNCTION> --gas-budget <GAS_BUDGET>

OPTIONS:
        --args <ARGS>...
            Simplified ordered args like in the function syntax ObjectIDs, Addresses must be hex
            strings

        --function <FUNCTION>
            Function name in module

        --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 call

    -h, --help
            Print help information

        --json
            Return command outputs in json format

        --module <MODULE>
            The name of the module in the package

        --package <PACKAGE>
            Object ID of the package, which contains the module

        --serialize-signed-transaction
            Instead of executing the transaction, serialize the bcs bytes of the signed transaction
            data (SenderSignedData) using base64 encoding, and print out the string

        --serialize-unsigned-transaction
            Instead of executing the transaction, serialize the bcs bytes of the unsigned
            transaction data (TransactionData) using base64 encoding, and print out the string

        --type-args <TYPE_ARGS>...
            Function name in module
```

![](https://hackmd.io/_uploads/BkW7Dssin.png)

    
實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client call --package 0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45 --module test --function create --gas-budget 100000000
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
----- Transaction Digest ----
9kwWeLLRZpN7wPbtdVGbdkGgi5AHBg2AMDju8TWnwjeX
----- Transaction Data ----
Transaction Signature: [Signature(Ed25519SuiSignature(Ed25519SuiSignature([0, 225, 176, 253, 224, 238, 64, 83, 33, 222, 190, 19, 49, 181, 3, 97, 214, 157, 82, 157, 170, 192, 10, 177, 201, 62, 128, 177, 89, 44, 159, 74, 163, 160, 51, 155, 16, 97, 234, 187, 71, 86, 112, 60, 37, 134, 22, 89, 222, 255, 212, 9, 46, 197, 54, 243, 90, 186, 139, 38, 230, 171, 113, 113, 6, 58, 93, 198, 149, 185, 43, 200, 25, 187, 36, 86, 75, 17, 29, 236, 207, 160, 7, 249, 56, 181, 164, 70, 98, 118, 212, 233, 136, 158, 212, 97, 1])))]
Transaction Kind : Programmable
Inputs: []
Commands: [
  MoveCall(0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45::test::create()),
]

Sender: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Payment: Object ID: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4, version: 0xbd57d, digest: BgBzqqidGr2hASBDYT32xL77HX7WUkQmZAPHPxDjXWSY
Gas Owner: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
Gas Price: 1000
Gas Budget: 100000000

----- Transaction Effects ----
Status : Success
Created Objects:
  - ID: 0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5 , Owner: Object ID: ( 0xf760af890b48272191553136f345c5f765d5ed6a9870e715aec70c81a3a6b759 )
  - ID: 0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )
Mutated Objects:
  - ID: 0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4 , Owner: Account Address ( 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9 )

----- Events ----
Array []
----- Object changes ----
Array [
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4"),
        "version": String("775550"),
        "previousVersion": String("775549"),
        "digest": String("DbhxMmEYw9q7RRtrYvJYs639yiTy2oiNhmeEjwuvAxtt"),
    },
    Object {
        "type": String("created"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "ObjectOwner": String("0xf760af890b48272191553136f345c5f765d5ed6a9870e715aec70c81a3a6b759"),
        },
        "objectType": String("0x2::dynamic_field::Field<address, bool>"),
        "objectId": String("0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5"),
        "version": String("775550"),
        "digest": String("2aFGv3Lz8WPbnjQiJTobFxW6X7mDn3hydaEUi5n51mBY"),
    },
    Object {
        "type": String("created"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45::test::TestObject"),
        "objectId": String("0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85"),
        "version": String("775550"),
        "digest": String("DRqJXkDDeNxnNFwykzRqay3XZ7UhC39wndXQdL4AT7Ym"),
    },
]
----- Balance changes ----
Array [
    Object {
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "coinType": String("0x2::sui::SUI"),
        "amount": String("-4209480"),
    },
]
```

我們主要來看Object changes
```javascript
----- Object changes ----
Array [
    Object {
        "type": String("mutated"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0x2::coin::Coin<0x2::sui::SUI>"),
        "objectId": String("0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4"),
        "version": String("775550"),
        "previousVersion": String("775549"),
        "digest": String("DbhxMmEYw9q7RRtrYvJYs639yiTy2oiNhmeEjwuvAxtt"),
    },
    Object {
        "type": String("created"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "ObjectOwner": String("0xf760af890b48272191553136f345c5f765d5ed6a9870e715aec70c81a3a6b759"),
        },
        "objectType": String("0x2::dynamic_field::Field<address, bool>"),
        "objectId": String("0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5"),
        "version": String("775550"),
        "digest": String("2aFGv3Lz8WPbnjQiJTobFxW6X7mDn3hydaEUi5n51mBY"),
    },
    Object {
        "type": String("created"),
        "sender": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        "owner": Object {
            "AddressOwner": String("0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9"),
        },
        "objectType": String("0xb2d296218e4dd6633eafcdbbdac6de77a49463f9b2c552e20430c7cee13a8d45::test::TestObject"),
        "objectId": String("0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85"),
        "version": String("775550"),
        "digest": String("DRqJXkDDeNxnNFwykzRqay3XZ7UhC39wndXQdL4AT7Ym"),
    },
]

```
第一個地址
```
0x50c9655e4f75b90d9172619caeb5bfd776648670c01b83892b8d22d31c6b42c4
```
type是mutated，代表他是被異動的
objectType是String("0x2::coin::Coin<0x2::sui::SUI>")
這是我們剛剛部署所花費的Gas Fee物件
![](https://hackmd.io/_uploads/rys_enioh.png)


第二個地址
```
0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5
```
type是created，代表他是被建造的
然後他的objectType是0x2::dynamic_field::Field<address, bool>
這個是我們剛剛創建TestObject內的Table物件
![](https://hackmd.io/_uploads/HyJeZnoi2.png)


第三個地址
```
0x2ddedc75afcd8e9708f578f02ff2d24154dc40239fdcfa210222bab45e688f85
```
type是created，代表他是被建造的
這個是我們剛剛創建TestObject，並轉移給呼叫這個方法的錢包地址
![](https://hackmd.io/_uploads/S1IZZ3jsh.png)


#### 通過id查詢動態欄位 sui client dynamic-field

先來查看該指令說明，發現他也需要帶入一個object_id，這個object_id我們需要帶入Table內的id
```javascript
PS D:\vscode\workspace\test_demo> sui client dynamic-field -h
sui.exe-client-dynamic-field 
Query a dynamic field by its address

USAGE:
    sui.exe client dynamic-field [OPTIONS] <object_id>

ARGS:
    <object_id>    The ID of the parent object

OPTIONS:
        --cursor <CURSOR>    Optional paging cursor
    -h, --help               Print help information
        --json               Return command outputs in json format
        --limit <LIMIT>      Maximum item returned per page [default: 50]
```

實際操作
```javascript
PS D:\vscode\workspace\test_demo> sui client dynamic-field 0xf760af890b48272191553136f345c5f765d5ed6a9870e715aec70c81a3a6b759
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
+-------------------------------------------------------------------------------+--------------+-------------+--------------------------------------------------------------------+---------+----------------------------------------------+
| Name                                                                          | Type         | Object Type | Object Id                  
                                        | Version | Digest                                       |
+-------------------------------------------------------------------------------+--------------+-------------+--------------------------------------------------------------------+---------+----------------------------------------------+
| address: "0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9" | DynamicField | bool        | 0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5 | 775550  | F1/+ZO1RISDR6azU41A3bD8wBkWnkAQC8u+PtuZxvnM= |
+-------------------------------------------------------------------------------+--------------+-------------+--------------------------------------------------------------------+---------+----------------------------------------------+
Showing 1 results.
Next cursor: 0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5
```

我們可以再利用查詢到的object_id去呼叫sui clinet object來查看裡面的物件資訊
```javascript
PS D:\vscode\workspace\test_demo> sui client object 0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5
[warn] Client/Server api version mismatch, client api version : 1.7.0, server api version : 1.6.2
----- 0x2::dynamic_field::Field<address, bool> (0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5[0xbd57e]) -----
Owner: Object ID: ( 0xf760af890b48272191553136f345c5f765d5ed6a9870e715aec70c81a3a6b759 )
Version: 0xbd57e
Storage Rebate: 1596000
Previous Transaction: TransactionDigest(9kwWeLLRZpN7wPbtdVGbdkGgi5AHBg2AMDju8TWnwjeX)
----- Data -----
type: 0x2::dynamic_field::Field<address, bool>
id: 0x0e198b08922240b91ebfae5d419c5874389501d53a58799fe4c69f30ef97efa5
name: 0x75886a28d7c86f86d67d06fcf4e3ef6f7bd42bb1c6e3f893d906ec6c1cbbd3f9
value: true
```
![](https://hackmd.io/_uploads/HkgFmhjs3.png)