操作 SUI 的常用指令

跟api基本上是一样的,你要做一个dapp不管是前端还是后端,你要做一个应用程式,它可以跟智能合约做互动呼叫。要用到sui官方的api,这就是官方的sui的api规格。你可以跟sui官方的智能合约做互动的话,他要带什么参数,他怎么使用。哪些参数代表什么意思,这个指令代表什么意思。学这个的话对开发有好处,就可以观念更清楚。

vbnet 复制代码
$ sui client help
Client for interacting with the Sui network

Usage: sui.exe client [OPTIONS] [COMMAND]

Commands:
  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
  balance                     List the coin balance of an address
  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
  execute-combined-signed-tx  Execute a combined serialized SenderSignedData string
  faucet                      Request gas coin from faucet. By default, it will use the active address and the active network
  gas                         Obtain all gas objects owned by the address. An address' alias can be used instead of the address
  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. It also accepts an address by its alias
  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
  ptb                         Run a PTB either from file or from the provided args
  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)
  tx-block                    Get the effects of executing the given transaction block
  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
  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
  profile-transaction         Profile the gas usage of a transaction. Unless an output filepath is not specified, outputs a file
                                  `gas_profile_{tx_digest}_{unix_timestamp}.json` which can be opened in a flamegraph tool such as speedscope
  replay-transaction          Replay a given transaction to view transaction effects. Set environment variable MOVE_VM_STEP=1 to debug
  replay-batch                Replay transactions listed in a file
  replay-checkpoint           Replay all transactions in a range of checkpoints
  help                        Print this message or the help of the given subcommand(s)

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

目前你预设的地址是哪一个,使用这个指令带什么参数。

less 复制代码
$ sui client active-address -h
Default address used for commands when none specified

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

Options:
      --json     Return command outputs in json format
  -h, --help     Print help
  -V, --version  Print version

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1 (main)
$ sui client active-address
0x1c28757df401b104d8087d70ba1bb25c36ef99067a6764b45455774b545aad51

创建新的智能合约专案sui move new

arduino 复制代码
sui move new test_demo

move设定档,sources:存放智能合约档案的地方。

添加新的Sui 环境sui client new-env

先来查看该指令说明,发现需要带2个参数,一个alias,另一个是rpc alias是环境别名,rpc是他所属的网路url

Alias 环境别名 远程过程调用地址 说明
主网 fullnode.mainnet.sui.io:443 正式环境
--- --- ---
测试网 fullnode.testnet.sui.io:443 测试环境
--- --- ---
开发网 fullnode.devnet.sui.io:443 开发环境
--- --- ---
bash 复制代码
$ sui client new-env --alias testnet --rpc https://fullnode.testnet.sui.io:443
Added new Sui env [testnet] to config.

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1/test_demo (main)
$ sui client envs
╭─────────┬─────────────────────────────────────┬────────╮
│ alias   │ url                                 │ active │
├─────────┼─────────────────────────────────────┼────────┤
│ devnet  │ https://fullnode.devnet.sui.io:443  │ *      │
│ testnet │ https://fullnode.testnet.sui.io:443 │        │
╰─────────┴─────────────────────────────────────┴────────╯

列出所有Sui 环境sui client envs这边补充讲解一下devnet、testnet跟mainnet的差别

  • devnet是开发环境,可以让你随意测试及部署你的智能合约,但是因为版本会更新比较频繁,所以稳定性没那么高,然后官方每一段时间会清除devnet链上的全部资料
  • testnet是测试环境,也是可以让你随意测试及部署你的智能合约,版本更新不会很频繁,稳定性比较高,而且testnet链上资料不会每隔一段时间被清除,所以这边推荐使用testnet
  • mainnet是正式环境,是需要花真正的Sui币去部署合约及测试的环境

产生新的钱包地址sui client new-address

先来查看该指令说明,需输入加密方式{ed25519 或secp256k1 或secp256r1} 生成新的地址和密钥

javascript 复制代码
$ sui client new-address ed25519
Keys saved as Base64 with 33 bytes `flag || privkey` ($BASE64_STR). 
        To see Bech32 format encoding, use `sui keytool export $SUI_ADDRESS` where
        $SUI_ADDRESS can be found with `sui keytool list`. Or use `sui keytool convert $BASE64_STR`.
╭────────────────────────────────────────────────────────────────────────────────────────────╮
│ Created new keypair and saved it to keystore.                                              │
├────────────────┬───────────────────────────────────────────────────────────────────────────┤
│ alias          │ peaceful-diamond                                                          │
│ address        │ 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b        │
│ keyScheme      │ ed25519                                                                   │
│ recoveryPhrase │ tree diagram toss stadium blur grace pluck skull rebel height speak brisk │
╰────────────────┴───────────────────────────────────────────────────────────────────────────╯

获取客户端所有的钱包地址sui client addresses

css 复制代码
$ sui client addresses
╭──────────────────┬────────────────────────────────────────────────────────────────────┬────────────────╮
│ alias            │ address                                                            │ active address │
├──────────────────┼────────────────────────────────────────────────────────────────────┼────────────────┤
│ strange-garnet   │ 0x1c28757df401b104d8087d70ba1bb25c36ef99067a6764b45455774b545aad51 │ *              │
│ peaceful-diamond │ 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b │                │
╰──────────────────┴────────────────────────────────────────────────────────────────────┴────────────────╯

切换预设钱包预设地址

css 复制代码
$ sui client switch --address 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b
Active address switched to 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b

切换环境

bash 复制代码
$ sui client envs
╭─────────┬─────────────────────────────────────┬────────╮
│ alias   │ url                                 │ active │
├─────────┼─────────────────────────────────────┼────────┤
│ devnet  │ https://fullnode.devnet.sui.io:443  │ *      │
│ testnet │ https://fullnode.testnet.sui.io:443 │        │
╰─────────┴─────────────────────────────────────┴────────╯

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1/test_demo (main)
$ sui client switch --env testnet
Active environment switched to [testnet]

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1/test_demo (main)
$ sui client envs
╭─────────┬─────────────────────────────────────┬────────╮
│ alias   │ url                                 │ active │
├─────────┼─────────────────────────────────────┼────────┤
│ devnet  │ https://fullnode.devnet.sui.io:443  │        │
│ testnet │ https://fullnode.testnet.sui.io:443 │ *      │
╰─────────┴─────────────────────────────────────┴────────╯

获取该钱包拥有的所有gas fee物件sui client gas

<COIN_ID> 为需要做拆分的物件ID

<GAS_BUDGET> 为手续费Gas Fee的上限,通常我会设100000000

然后你可以用金额来分割,也可以用数量来分割

金额分割可以分割出你想要的金额

数量分割可以分割同等份的N数量物件

scss 复制代码
$ sui client gas
╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮
│ gasCoinId                                                          │ mistBalance (MIST) │ suiBalance (SUI) │
├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤      
│ 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713 │ 1000000000         │ 1.00             │      
│ 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e │ 1000000000         │ 1.00             │      
│ 0x8f49ace830ea2d7ab7255f3adb1377d5c7ef149f5486b5d9823a95659f430267 │ 1000000000         │ 1.00             │      
│ 0x9526e513a6a02ab543ec9a786ffcaa3aeac3bed47abca40ed90bd79e0a74263f │ 1000000000         │ 1.00             │      
│ 0xb155426669cae9dfcbadbe83363eb65772634f21cccb0d65b737571beedaef6e │ 1000000000         │ 1.00             │      
│ 0xc9732a258c14d9ed067ce94442194198f9f54f117c6bebbd40a8a91ee2f6b5aa │ 1000000000         │ 1.00             │      
╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯      

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1/test_demo (main)
$ sui client split-coin --coin-id 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713 --gas-budget 10000000 --amounts 100
Transaction Digest: 7UEwm741jr7nG8noQ3CBnnnAbru1ZueYEWKxrCFQiMTJ
╭─────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Data                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                      │
│ Gas Owner: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                   │
│ Gas Budget: 10000000 MIST                                                                       │
│ Gas Price: 1000 MIST                                                                            │
│ Gas Payment:                                                                                    │
│  ┌──                                                                                            │
│  │ ID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                       │
│  │ Version: 979295                                                                              │
│  │ Digest: EYwWFn1rGeUWTY4bjwM1anPcmkRm9gtkgrCF79UA6wyQ                                         │
│  └──                                                                                            │
│                                                                                                 │
│ Transaction Kind: Programmable                                                                  │
│ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Input Objects                                                                               │ │
│ ├─────────────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ 0   Imm/Owned Object ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713 │ │
│ │ 1   Pure Arg: Type: vector<u64>, Value: ["100"]                                             │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────────────────────────────────────────────────────────────────────╮            │
│ │ Commands                                                                         │            │
│ ├──────────────────────────────────────────────────────────────────────────────────┤            │
│ │ 0  MoveCall:                                                                     │            │
│ │  ┌                                                                               │            │
│ │  │ Function:  split_vec                                                          │            │
│ │  │ Module:    pay                                                                │            │
│ │  │ Package:   0x0000000000000000000000000000000000000000000000000000000000000002 │            │
│ │  │ Type Arguments:                                                               │            │
│ │  │   0x2::sui::SUI                                                               │            │
│ │  │ Arguments:                                                                    │            │
│ │  │   Input  0                                                                    │            │
│ │  │   Input  1                                                                    │            │
│ │  └                                                                               │            │
│ ╰──────────────────────────────────────────────────────────────────────────────────╯            │
│                                                                                                 │
│ Signatures:                                                                                     │
│    efsPZ6JjbmOxX2q7SdshkU3AN2lWnOI3SurQM6VKVw/z98B/G9xvTrNi+6A5u1RDI1njPYtYKh3vvhnbS4nfBw==     │
│                                                                                                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Effects                                                                               │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Digest: 7UEwm741jr7nG8noQ3CBnnnAbru1ZueYEWKxrCFQiMTJ                                              │
│ Status: Success                                                                                   │
│ Executed Epoch: 330                                                                               │
│                                                                                                   │
│ Created Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0xb2efce15ddeb0765536b501f7bacfbbc9529f4e53118e69678e0ec2491fdea5e                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 979296                                                                                │
│  │ Digest: 3Ev76RkCWq9YrkRt6nrpd1eRSUVRhbkNRxgiEiskpE7A                                           │
│  └──                                                                                              │
│ Mutated Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 979296                                                                                │
│  │ Digest: HYvDqthtEVB5EFxf2KT1xuEceTDnkk7KhM5MrFHVvHxG                                           │
│  └──                                                                                              │
│  ┌──                                                                                              │
│  │ ID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 979296                                                                                │
│  │ Digest: mmneRvijPfDM3FZM6YfhTipFvGVKVadABeLPxgLCduV                                            │
│  └──                                                                                              │
│ Gas Object:                                                                                       │
│  ┌──                                                                                              │
│  │ ID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 979296                                                                                │
│  │ Digest: mmneRvijPfDM3FZM6YfhTipFvGVKVadABeLPxgLCduV                                            │
│  └──                                                                                              │
│ Gas Cost Summary:                                                                                 │
│    Storage Cost: 2964000 MIST                                                                     │
│    Computation Cost: 1000000 MIST                                                                 │
│    Storage Rebate: 1956240 MIST                                                                   │
│    Non-refundable Storage Fee: 19760 MIST                                                         │
│                                                                                                   │
│ Transaction Dependencies:                                                                         │
│    4B4bKQkeEcvnVC4vs2uJWuEBaRPYau5MfPg8P35ZutuB                                                   │
│    4tcbAGm5P1rQStwxacykbPCTygK1a99wSC4KZUzqs7iV                                                   │
│    6PxS2PLSDGJscAqU14vs86Wew9q2dHPBugF3163mXZFV                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────╮
│ No transaction block events │
╰─────────────────────────────╯

╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Object Changes                                                                                   │
├──────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Created Objects:                                                                                 │
│  ┌──                                                                                             │
│  │ ObjectID: 0xb2efce15ddeb0765536b501f7bacfbbc9529f4e53118e69678e0ec2491fdea5e                  │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │
│  │ Version: 979296                                                                               │
│  │ Digest: 3Ev76RkCWq9YrkRt6nrpd1eRSUVRhbkNRxgiEiskpE7A                                          │
│  └──                                                                                             │
│ Mutated Objects:                                                                                 │
│  ┌──                                                                                             │
│  │ ObjectID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                  │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │
│  │ Version: 979296                                                                               │
│  │ Digest: HYvDqthtEVB5EFxf2KT1xuEceTDnkk7KhM5MrFHVvHxG                                          │
│  └──                                                                                             │
│  ┌──                                                                                             │
│  │ ObjectID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                  │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │
│  │ Version: 979296                                                                               │
│  │ Digest: mmneRvijPfDM3FZM6YfhTipFvGVKVadABeLPxgLCduV                                           │
│  └──                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Balance Changes                                                                                   │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│  ┌──                                                                                              │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ CoinType: 0x2::sui::SUI                                                                        │
│  │ Amount: -2007760                                                                               │
│  └──                                                                                              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯

分出100个出来

scss 复制代码
$ sui client gas
╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮
│ gasCoinId                                                          │ mistBalance (MIST) │ suiBalance (SUI) │
├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤
│ 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713 │ 999999900          │ 0.99             │
│ 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e │ 997992240          │ 0.99             │
│ 0x8f49ace830ea2d7ab7255f3adb1377d5c7ef149f5486b5d9823a95659f430267 │ 1000000000         │ 1.00             │
│ 0x9526e513a6a02ab543ec9a786ffcaa3aeac3bed47abca40ed90bd79e0a74263f │ 1000000000         │ 1.00             │
│ 0xb155426669cae9dfcbadbe83363eb65772634f21cccb0d65b737571beedaef6e │ 1000000000         │ 1.00             │
│ 0xb2efce15ddeb0765536b501f7bacfbbc9529f4e53118e69678e0ec2491fdea5e │ 100                │ 0.00             │
│ 0xc9732a258c14d9ed067ce94442194198f9f54f117c6bebbd40a8a91ee2f6b5aa │ 1000000000         │ 1.00             │
╰──

将多个硬币合并为一枚硬币sui client merge-coin

yaml 复制代码
$ sui client merge-coin --primary-coin 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713 --coin-to-merge 0xb2efce15ddeb0765536b501f7bacfbbc9529f4e53118e69678e0ec2491fdea5e --gas-budget 10000000
Transaction Digest: WM4PDdDop5YZqiebKDPpoyLj285AwyyHWcea6dTdWtB
╭─────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Data                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                      │
│ Gas Owner: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                   │
│ Gas Budget: 10000000 MIST                                                                       │
│ Gas Price: 1000 MIST                                                                            │
│ Gas Payment:                                                                                    │
│  ┌──                                                                                            │
│  │ ID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                       │
│  │ Version: 979296                                                                              │
│  │ Digest: mmneRvijPfDM3FZM6YfhTipFvGVKVadABeLPxgLCduV                                          │
│  └──                                                                                            │
│                                                                                                 │
│ Transaction Kind: Programmable                                                                  │
│ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Input Objects                                                                               │ │
│ ├─────────────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ 0   Imm/Owned Object ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713 │ │
│ │ 1   Imm/Owned Object ID: 0xb2efce15ddeb0765536b501f7bacfbbc9529f4e53118e69678e0ec2491fdea5e │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────────────────────────────────────────────────────────────────────╮            │
│ │ Commands                                                                         │            │
│ ├──────────────────────────────────────────────────────────────────────────────────┤            │
│ │ 0  MoveCall:                                                                     │            │
│ │  ┌                                                                               │            │
│ │  │ Function:  join                                                               │            │
│ │  │ Module:    pay                                                                │            │
│ │  │ Package:   0x0000000000000000000000000000000000000000000000000000000000000002 │            │
│ │  │ Type Arguments:                                                               │            │
│ │  │   0x2::sui::SUI                                                               │            │
│ │  │ Arguments:                                                                    │            │
│ │  │   Input  0                                                                    │            │
│ │  │   Input  1                                                                    │            │
│ │  └                                                                               │            │
│ ╰──────────────────────────────────────────────────────────────────────────────────╯            │
│                                                                                                 │
│ Signatures:                                                                                     │
│    3SBx8L/SICamnll8Gd5EGPXBmq+xJlRtzpKa6XVdeyssMjcvnp53NKkeTKdlgiWT25J7cxtRSzuNuq64Oz7eCg==     │
│                                                                                                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Effects                                                                               │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Digest: WM4PDdDop5YZqiebKDPpoyLj285AwyyHWcea6dTdWtB                                               │
│ Status: Success                                                                                   │
│ Executed Epoch: 330                                                                               │
│ Mutated Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 979297                                                                                │
│  │ Digest: Fu3H97kAFBoTPYK1KtBkNsbsSR6LXSHfRoDJxiGWpe8u                                           │
│  └──                                                                                              │
│  ┌──                                                                                              │
│  │ ID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 979297                                                                                │
│  │ Digest: nLRwvYnbTbTp1Bx6eQYHwsRy68EopJDhzrwBUMViu8R                                            │
│  └──                                                                                              │
│ Deleted Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0xb2efce15ddeb0765536b501f7bacfbbc9529f4e53118e69678e0ec2491fdea5e                         │
│  │ Version: 979297                                                                                │
│  │ Digest: 7gyGAp71YXQRoxmFBaHxofQXAipvgHyBKPyxmdSJxyvz                                           │
│  └──                                                                                              │
│ Gas Object:                                                                                       │
│  ┌──                                                                                              │
│  │ ID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 979297                                                                                │
│  │ Digest: nLRwvYnbTbTp1Bx6eQYHwsRy68EopJDhzrwBUMViu8R                                            │
│  └──                                                                                              │
│ Gas Cost Summary:                                                                                 │
│    Storage Cost: 1976000 MIST                                                                     │
│    Computation Cost: 1000000 MIST                                                                 │
│    Storage Rebate: 2934360 MIST                                                                   │
│    Non-refundable Storage Fee: 29640 MIST                                                         │
│                                                                                                   │
│ Transaction Dependencies:                                                                         │
│    6PxS2PLSDGJscAqU14vs86Wew9q2dHPBugF3163mXZFV                                                   │
│    7UEwm741jr7nG8noQ3CBnnnAbru1ZueYEWKxrCFQiMTJ                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────╮
│ No transaction block events │
╰─────────────────────────────╯

╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Object Changes                                                                                   │
├──────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Mutated Objects:                                                                                 │
│  ┌──                                                                                             │
│  │ ObjectID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                  │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │
│  │ Version: 979297                                                                               │
│  │ Digest: Fu3H97kAFBoTPYK1KtBkNsbsSR6LXSHfRoDJxiGWpe8u                                          │
│  └──                                                                                             │
│  ┌──                                                                                             │
│  │ ObjectID: 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e                  │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │
│  │ Version: 979297                                                                               │
│  │ Digest: nLRwvYnbTbTp1Bx6eQYHwsRy68EopJDhzrwBUMViu8R                                           │
│  └──                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Balance Changes                                                                                   │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│  ┌──                                                                                              │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ CoinType: 0x2::sui::SUI                                                                        │
│  │ Amount: -41640                                                                                 │
│  └──                                                                                              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1/test_demo (main)
$ sui client gas
╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮
│ gasCoinId                                                          │ mistBalance (MIST) │ suiBalance (SUI) │
├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤
│ 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713 │ 1000000000         │ 1.00             │
│ 0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e │ 997950600          │ 0.99             │
│ 0x8f49ace830ea2d7ab7255f3adb1377d5c7ef149f5486b5d9823a95659f430267 │ 1000000000         │ 1.00             │
│ 0x9526e513a6a02ab543ec9a786ffcaa3aeac3bed47abca40ed90bd79e0a74263f │ 1000000000         │ 1.00             │
│ 0xb155426669cae9dfcbadbe83363eb65772634f21cccb0d65b737571beedaef6e │ 1000000000         │ 1.00             │
│ 0xc9732a258c14d9ed067ce94442194198f9f54f117c6bebbd40a8a91ee2f6b5aa │ 1000000000         │ 1.00             │
╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯

编译智能合约sui move build

rust 复制代码
module smart_contract_test::smart_contract_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 client publish

yaml 复制代码
$ sui client publish --gas-budget 10000000
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING smart_contract_test
Successfully verified dependencies on-chain against source.
Transaction Digest: 5wtekawFZ6nsNMeVgGMapeVMLFaiKswdN2sqGyJdMdGB
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Data
    │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b
    │
│ Gas Owner: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b
    │
│ Gas Budget: 10000000 MIST
    │
│ Gas Price: 1000 MIST
    │
│ Gas Payment:
    │
│  ┌──
    │
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713
    │
│  │ Version: 979297
    │
│  │ Digest: Fu3H97kAFBoTPYK1KtBkNsbsSR6LXSHfRoDJxiGWpe8u
    │
│  └──
    │
│
    │
│ Transaction Kind: Programmable
    │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Input Objects
  │ │
│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ 0   Pure Arg: Type: address, Value: "0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b" │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ ╭─────────────────────────────────────────────────────────────────────────╮
    │
│ │ Commands                                                                │
    │
│ ├─────────────────────────────────────────────────────────────────────────┤
    │
│ │ 0  Publish:                                                             │
    │
│ │  ┌                                                                      │
    │
│ │  │ Dependencies:                                                        │
    │
│ │  │   0x0000000000000000000000000000000000000000000000000000000000000001 │
    │
│ │  │   0x0000000000000000000000000000000000000000000000000000000000000002 │
    │
│ │  └                                                                      │
    │
│ │                                                                         │
    │
│ │ 1  TransferObjects:                                                     │
    │
│ │  ┌                                                                      │
    │
│ │  │ Arguments:                                                           │
    │
│ │  │   Result 0                                                           │
    │
│ │  │ Address: Input  0                                                    │
    │
│ │  └                                                                      │
    │
│ ╰─────────────────────────────────────────────────────────────────────────╯
    │
│
    │
│ Signatures:
    │
│    T0d1/NZLJmTEQZLA586/jjFRQz2asz7ANUOcpOVrNNdniDwWTIyMqA0EL2oBQSEp+SustfHFSkzvOJdRtfMyDA==
    │
│
    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮      
│ Transaction Effects                                                                               │      
├───────────────────────────────────────────────────────────────────────────────────────────────────┤      
│ Digest: 5wtekawFZ6nsNMeVgGMapeVMLFaiKswdN2sqGyJdMdGB                                              │      
│ Status: Success                                                                                   │      
│ Executed Epoch: 332                                                                               │      
│                                                                                                   │      
│ Created Objects:                                                                                  │      
│  ┌──                                                                                              │      
│  │ ID: 0x8e9674cd8741e4ecddf67318cc001fe0126ea298c24e9000e53a239105303344                         │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ Version: 979298                                                                                │      
│  │ Digest: WgPEvcYFRZ5tsCBUfPUA19RKWUuEY66JvMuzY3jV8Xp                                            │      
│  └──                                                                                              │      
│  ┌──                                                                                              │      
│  │ ID: 0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5                         │      
│  │ Owner: Immutable                                                                               │      
│  │ Version: 1                                                                                     │      
│  │ Digest: 8B6HBGnPwQy16sAv2J85odLxfs84XiPAZ7LsHs4K6Csx                                           │      
│  └──                                                                                              │      
│ Mutated Objects:                                                                                  │      
│  ┌──                                                                                              │      
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ Version: 979298                                                                                │      
│  │ Digest: 2qXPCX9CWjP9rihCTgFthdxq49a2npRMgvcmdZqyKpo7                                           │      
│  └──                                                                                              │      
│ Gas Object:                                                                                       │      
│  ┌──                                                                                              │      
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ Version: 979298                                                                                │      
│  │ Digest: 2qXPCX9CWjP9rihCTgFthdxq49a2npRMgvcmdZqyKpo7                                           │      
│  └──                                                                                              │      
│ Gas Cost Summary:                                                                                 │      
│    Storage Cost: 7919200 MIST                                                                     │      
│    Computation Cost: 1000000 MIST                                                                 │      
│    Storage Rebate: 978120 MIST                                                                    │      
│    Non-refundable Storage Fee: 9880 MIST                                                          │      
│                                                                                                   │      
│ Transaction Dependencies:                                                                         │      
│    WM4PDdDop5YZqiebKDPpoyLj285AwyyHWcea6dTdWtB                                                    │      
│    6PxS2PLSDGJscAqU14vs86Wew9q2dHPBugF3163mXZFV                                                   │      
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯      
╭─────────────────────────────╮
│ No transaction block events │
╰─────────────────────────────╯

╭──────────────────────────────────────────────────────────────────────────────────────────────────╮       
│ Object Changes                                                                                   │       
├──────────────────────────────────────────────────────────────────────────────────────────────────┤       
│ Created Objects:                                                                                 │       
│  ┌──                                                                                             │       
│  │ ObjectID: 0x8e9674cd8741e4ecddf67318cc001fe0126ea298c24e9000e53a239105303344                  │       
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │       
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │       
│  │ ObjectType: 0x2::package::UpgradeCap                                                          │       
│  │ Version: 979298                                                                               │       
│  │ Digest: WgPEvcYFRZ5tsCBUfPUA19RKWUuEY66JvMuzY3jV8Xp                                           │       
│  └──                                                                                             │       
│ Mutated Objects:                                                                                 │
│  ┌──                                                                                             │       
│  │ ObjectID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                  │       
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │       
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │       
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │       
│  │ Version: 979298                                                                               │       
│  │ Digest: 2qXPCX9CWjP9rihCTgFthdxq49a2npRMgvcmdZqyKpo7                                          │       
│  └──                                                                                             │       
│ Published Objects:                                                                               │       
│  ┌──                                                                                             │       
│  │ PackageID: 0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5                 │       
│  │ Version: 1                                                                                    │       
│  │ Digest: 8B6HBGnPwQy16sAv2J85odLxfs84XiPAZ7LsHs4K6Csx                                          │       
│  │ Modules: smart_contract_test                                                                  │       
│  └──                                                                                             │       
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯       
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮      
│ Balance Changes                                                                                   │      
├───────────────────────────────────────────────────────────────────────────────────────────────────┤      
│  ┌──                                                                                              │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ CoinType: 0x2::sui::SUI                                                                        │      
│  │ Amount: -7941080                                                                               │      
│  └──                                                                                              │      
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯      

部署智能合约的专案专属id PackageID: 0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5

如果要对智能合约升级的话,我要怎么知道你是合约的拥有者: 0x8e9674cd8741e4ecddf67318cc001fe0126ea298c24e9000e53a239105303344

yaml 复制代码
│ Object Changes                                                                                   │       
├──────────────────────────────────────────────────────────────────────────────────────────────────┤       
│ Created Objects:                                                                                 │       
│  ┌──                                                                                             │       
│  │ ObjectID: 0x8e9674cd8741e4ecddf67318cc001fe0126ea298c24e9000e53a239105303344                  │       
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                    │       
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b ) │       
│  │ ObjectType: 0x2::package::UpgradeCap                                                          │       
│  │ Version: 979298                                                                               │       
│  │ Digest: WgPEvcYFRZ5tsCBUfPUA19RKWUuEY66JvMuzY3jV8Xp                                           │       
│  └──                                                             

获取该钱包地址拥有的所有物件sui client objects

ini 复制代码
sui client objects
╭───────────────────────────────────────────────────────────────────────────────────────╮
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713  │ │
│ │ version    │  979298                                                              │ │
│ │ digest     │  G0nrbNlMV3KihecO4cbGZLYNGSyNzHB2qbFmgFLqnF4=                        │ │
│ │ objectType │  0x0000..0002::coin::Coin                                            │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0x826a224c8c1e43839be2c660bae23a75853b7952641792bee65a9e73ca0b619e  │ │
│ │ version    │  979297                                                              │ │
│ │ digest     │  C50bKlmB49uuRWTqmQdg9cpDxSFgcE7kt2lKcH87wWY=                        │ │
│ │ objectType │  0x0000..0002::coin::Coin                                            │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0x8e9674cd8741e4ecddf67318cc001fe0126ea298c24e9000e53a239105303344  │ │
│ │ version    │  979298                                                              │ │
│ │ digest     │  B5pf3V55mCs4muk3JkZC2ZBey9WDomcxs60ISDonr3c=                        │ │
│ │ objectType │  0x0000..0002::package::UpgradeCap                                   │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0x8f49ace830ea2d7ab7255f3adb1377d5c7ef149f5486b5d9823a95659f430267  │ │
│ │ version    │  883878                                                              │ │
│ │ digest     │  MpCTffMBvA917qQXwYeNlV5sriPVTLQ/UP5vSAAHje0=                        │ │
│ │ objectType │  0x0000..0002::coin::Coin                                            │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0x9526e513a6a02ab543ec9a786ffcaa3aeac3bed47abca40ed90bd79e0a74263f  │ │
│ │ version    │  909705                                                              │ │
│ │ digest     │  QMMRXHyu714qT+9+5OApBvn9r765KxjJrp/zWS0TqOA=                        │ │
│ │ objectType │  0x0000..0002::coin::Coin                                            │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0xb155426669cae9dfcbadbe83363eb65772634f21cccb0d65b737571beedaef6e  │ │
│ │ version    │  688336                                                              │ │
│ │ digest     │  N2q8DHkmIqK6HdEg5PzNY8b+jF9LjM68BAB0Y/xwUdY=                        │ │
│ │ objectType │  0x0000..0002::coin::Coin                                            │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0xc9732a258c14d9ed067ce94442194198f9f54f117c6bebbd40a8a91ee2f6b5aa  │ │
│ │ version    │  1021230                                                             │ │
│ │ digest     │  yAbQYZvkpNbgRmcb34e9rkH4MrO++qvzE8SBcqKe8Zg=                        │ │
│ │ objectType │  0x0000..0002::coin::Coin                                            │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
╰───────────────────────────────────────────────────────────────────────────────────────╯

获取该物件资讯

sui client objects 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b

转移物件sui client transfer,对方地址,对应objectid物品,gas费上限

css 复制代码
$ sui client transfer --to 0x1c28757df401b104d8087d70ba1bb25c36ef99067a6764b45455774b545aad51 --object-id 0xc9732a258c14d9ed067ce94442194198f9f54f117c6bebbd40a8a91ee2f6b5aa --gas-budget 10000000

目前客户端预设钱包的地址sui client active-address

目前预设连线的环境sui client active-env

ruby 复制代码
$ sui client active-address
0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1/smart_contract_test (main)       
$ sui client active-env
testnet

YK@DESKTOP-0FOCDV2 MINGW64 ~/Desktop/SUI/letsmove/mover/ice668/code/task1/smart_contract_test (main)       
$ sui client objects 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b

呼叫智能合约内的某个功能sui client call

yaml 复制代码
$ sui client call --package 0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5 --module smart_contract_test --function create --gas-budget 10000000
Transaction Digest: HGjVN4HkqCExT63neLUBXJL5DMeCeWieaAZPfSNuPTXM
╭─────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Data                                                                            │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                  │
│ Gas Owner: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b               │
│ Gas Budget: 10000000 MIST                                                                   │
│ Gas Price: 1000 MIST                                                                        │
│ Gas Payment:                                                                                │
│  ┌──                                                                                        │
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                   │
│  │ Version: 1021234                                                                         │
│  │ Digest: 3QW5iqK5sa9g5jB9RM39FXjdSkHZuFMe4goSuDiJAXzF                                     │
│  └──                                                                                        │
│                                                                                             │
│ Transaction Kind: Programmable                                                              │
│   No input objects for this transaction                                                     │
│ ╭──────────────────────────────────────────────────────────────────────────────────╮        │
│ │ Commands                                                                         │        │
│ ├──────────────────────────────────────────────────────────────────────────────────┤        │
│ │ 0  MoveCall:                                                                     │        │
│ │  ┌                                                                               │        │
│ │  │ Function:  create                                                             │        │
│ │  │ Module:    smart_contract_test                                                │        │
│ │  │ Package:   0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5 │        │
│ │  └                                                                               │        │
│ ╰──────────────────────────────────────────────────────────────────────────────────╯        │
│                                                                                             │
│ Signatures:                                                                                 │
│    j/7awG4vrkCZQSf5dp/un96BJE9FqM9bzdK0i4UIqUrFH2NVrtSVfO74EbJfRNn0JuJ5JKKyIwzMGcTSJxRYDA== │
│                                                                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮      
│ Transaction Effects                                                                               │      
├───────────────────────────────────────────────────────────────────────────────────────────────────┤      
│ Digest: HGjVN4HkqCExT63neLUBXJL5DMeCeWieaAZPfSNuPTXM                                              │      
│ Status: Success                                                                                   │      
│ Executed Epoch: 332                                                                               │      
│                                                                                                   │      
│ Created Objects:                                                                                  │      
│  ┌──                                                                                              │      
│  │ ID: 0x2268b85613c3a6faeeafda00747d9f86de7e72e31d4af4242779330912f80a21                         │      
│  │ Owner: Object ID: ( 0x554af59bdc00b8822e2d75d8cf5dac9b5633ab9dc13125a36abdac0acc49ead2 )       │      
│  │ Version: 1021235                                                                               │      
│  │ Digest: H7aCpj7YhTnsfP7JxUvFuuDKwy3oMsG9SQDSgfG2LpbZ                                           │      
│  └──                                                                                              │      
│  ┌──                                                                                              │      
│  │ ID: 0xaff1d61e017b1cb4081f5b4eafafe0332adaabbb562f44ad622df92fbd7e3362                         │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ Version: 1021235                                                                               │      
│  │ Digest: 4MWap3yDdoM7JT6dpBJcsyAP1v23qBmNDZ7BZgCcsDQM                                           │      
│  └──                                                                                              │      
│ Mutated Objects:                                                                                  │      
│  ┌──                                                                                              │      
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ Version: 1021235                                                                               │      
│  │ Digest: 8aUiCVuuUEX8wT2kiKfLiDBehUE2DreC17NFimfttypL                                           │      
│  └──                                                                                              │      
│ Gas Object:                                                                                       │      
│  ┌──                                                                                              │      
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ Version: 1021235                                                                               │      
│  │ Digest: 8aUiCVuuUEX8wT2kiKfLiDBehUE2DreC17NFimfttypL                                           │      
│  └──                                                                                              │      
│ Gas Cost Summary:                                                                                 │      
│    Storage Cost: 4301600 MIST                                                                     │      
│    Computation Cost: 1000000 MIST                                                                 │      
│    Storage Rebate: 978120 MIST                                                                    │      
│    Non-refundable Storage Fee: 9880 MIST                                                          │      
│                                                                                                   │      
│ Transaction Dependencies:                                                                         │      
│    2e7sCfbHxx3uhc94Gn3gjxzMQTjnoVhpyrSYTDdL9kCW                                                   │      
│    5wtekawFZ6nsNMeVgGMapeVMLFaiKswdN2sqGyJdMdGB                                                   │      
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯      
╭─────────────────────────────╮
│ No transaction block events │
╰─────────────────────────────╯

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Object Changes
           │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Created Objects:
           │
│  ┌──
           │
│  │ ObjectID: 0x2268b85613c3a6faeeafda00747d9f86de7e72e31d4af4242779330912f80a21
           │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b
           │
│  │ Owner: Object ID: ( 0x554af59bdc00b8822e2d75d8cf5dac9b5633ab9dc13125a36abdac0acc49ead2 )
           │
│  │ ObjectType: 0x2::dynamic_field::Field<address, bool>
           │
│  │ Version: 1021235
           │
│  │ Digest: H7aCpj7YhTnsfP7JxUvFuuDKwy3oMsG9SQDSgfG2LpbZ
           │
│  └──
           │
│  ┌──
           │
│  │ ObjectID: 0xaff1d61e017b1cb4081f5b4eafafe0332adaabbb562f44ad622df92fbd7e3362
           │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b
           │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )
           │
│  │ ObjectType: 0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5::smart_contract_test::TestObject  │
│  │ Version: 1021235
           │
│  │ Digest: 4MWap3yDdoM7JT6dpBJcsyAP1v23qBmNDZ7BZgCcsDQM
           │
│  └──
           │
│ Mutated Objects:
           │
│  ┌──
           │
│  │ ObjectID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713
           │
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b
           │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )
           │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>
           │
│  │ Version: 1021235
           │
│  │ Digest: 8aUiCVuuUEX8wT2kiKfLiDBehUE2DreC17NFimfttypL
           │
│  └──
           │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮      
│ Balance Changes                                                                                   │      
├───────────────────────────────────────────────────────────────────────────────────────────────────┤      
│  ┌──                                                                                              │      
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │      
│  │ CoinType: 0x2::sui::SUI                                                                        │      
│  │ Amount: -4323480                                                                               │      
│  └──                                                                                              │      
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯      

dynamic_field:动态栏位 0x2268b85613c3a6faeeafda00747d9f86de7e72e31d4af4242779330912f80a21

0xaff1d61e017b1cb4081f5b4eafafe0332adaabbb562f44ad622df92fbd7e3362 smart_contractestObject,转移到来呼叫fuction钱包地址的底下

呼叫智能合约内的某个功能sui client call

yaml 复制代码
$ sui client call --package 0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5 --module smart_contract_test --function create --gas-budget 10000000
Transaction Digest: 4DD7aer5wj8nBrjRCako8zvbKzfiKmQ3o93kLQ6rh1Lq
╭─────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Data                                                                            │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                  │
│ Gas Owner: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b               │
│ Gas Budget: 10000000 MIST                                                                   │
│ Gas Price: 1000 MIST                                                                        │
│ Gas Payment:                                                                                │
│  ┌──                                                                                        │
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                   │
│  │ Version: 1021235                                                                         │
│  │ Digest: 8aUiCVuuUEX8wT2kiKfLiDBehUE2DreC17NFimfttypL                                     │
│  └──                                                                                        │
│                                                                                             │
│ Transaction Kind: Programmable                                                              │
│   No input objects for this transaction                                                     │
│ ╭──────────────────────────────────────────────────────────────────────────────────╮        │
│ │ Commands                                                                         │        │
│ ├──────────────────────────────────────────────────────────────────────────────────┤        │
│ │ 0  MoveCall:                                                                     │        │
│ │  ┌                                                                               │        │
│ │  │ Function:  create                                                             │        │
│ │  │ Module:    smart_contract_test                                                │        │
│ │  │ Package:   0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5 │        │
│ │  └                                                                               │        │
│ ╰──────────────────────────────────────────────────────────────────────────────────╯        │
│                                                                                             │
│ Signatures:                                                                                 │
│    v9auyaQh06ppy0O3TMxXEVWVgvWS2lXj5+u3sGwaaN53eB6OuZnDLDBLajqHvV5q59ncoCFI+lSvc/S7YSP0Cg== │
│                                                                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Effects                                                                               │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Digest: 4DD7aer5wj8nBrjRCako8zvbKzfiKmQ3o93kLQ6rh1Lq                                              │
│ Status: Success                                                                                   │
│ Executed Epoch: 332                                                                               │
│                                                                                                   │
│ Created Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0xfcc72d372e86c72187acc6a837c5794a73c9447b0f432d5ea54d7de0b2683b6c                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 1021236                                                                               │
│  │ Digest: oNVNWwYHEWcdFkEhTXDesRqiATqCz3tazNXQofruUVU                                            │
│  └──                                                                                              │
│  ┌──                                                                                              │
│  │ ID: 0xff18bd248e3c2b60508d32ced4668f1cf6e8beb925ec0ea8202042e26ee43633                         │
│  │ Owner: Object ID: ( 0xa9f41712728cd5fd4e0bf4fa7138a91aaac747fe837023f40dc17192b6bdbbec )       │
│  │ Version: 1021236                                                                               │
│  │ Digest: 9bcj5yxCsQRVnfjuRQ49hgWCiRm9YRNKMgviAco6MK7c                                           │
│  └──                                                                                              │
│ Mutated Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 1021236                                                                               │
│  │ Digest: Auk7kWfNjrvr8LkT2oKemoEYEkMyCoQM762vMfaCxwmr                                           │
│  └──                                                                                              │
│ Gas Object:                                                                                       │
│  ┌──                                                                                              │
│  │ ID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                         │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ Version: 1021236                                                                               │
│  │ Digest: Auk7kWfNjrvr8LkT2oKemoEYEkMyCoQM762vMfaCxwmr                                           │
│  └──                                                                                              │
│ Gas Cost Summary:                                                                                 │
│    Storage Cost: 4301600 MIST                                                                     │
│    Computation Cost: 1000000 MIST                                                                 │
│    Storage Rebate: 978120 MIST                                                                    │
│    Non-refundable Storage Fee: 9880 MIST                                                          │
│                                                                                                   │
│ Transaction Dependencies:                                                                         │
│    5wtekawFZ6nsNMeVgGMapeVMLFaiKswdN2sqGyJdMdGB                                                   │
│    HGjVN4HkqCExT63neLUBXJL5DMeCeWieaAZPfSNuPTXM                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────╮
│ No transaction block events │
╰─────────────────────────────╯

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮       
│ Object Changes                                                                                                      │       
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤       
│ Created Objects:                                                                                                    │       
│  ┌──                                                                                                                │       
│  │ ObjectID: 0xfcc72d372e86c72187acc6a837c5794a73c9447b0f432d5ea54d7de0b2683b6c                                     │       
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                                       │       
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )                    │       
│  │ ObjectType: 0xcd8894df3fcc4e01899b9bcaca0ac87dfa96ee1f75ed932aad91b2099369a8b5::smart_contract_test::TestObject  │       
│  │ Version: 1021236                                                                                                 │       
│  │ Digest: oNVNWwYHEWcdFkEhTXDesRqiATqCz3tazNXQofruUVU                                                              │       
│  └──                                                                                                                │       
│  ┌──                                                                                                                │       
│  │ ObjectID: 0xff18bd248e3c2b60508d32ced4668f1cf6e8beb925ec0ea8202042e26ee43633                                     │       
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                                       │       
│  │ Owner: Object ID: ( 0xa9f41712728cd5fd4e0bf4fa7138a91aaac747fe837023f40dc17192b6bdbbec )                         │       
│  │ ObjectType: 0x2::dynamic_field::Field<address, bool>                                                             │       
│  │ Version: 1021236                                                                                                 │       
│  │ Digest: 9bcj5yxCsQRVnfjuRQ49hgWCiRm9YRNKMgviAco6MK7c                                                             │       
│  └──                                                                                                                │       
│ Mutated Objects:                                                                                                    │       
│  ┌──                                                                                                                │       
│  │ ObjectID: 0x4c708bcc598e89e0f006f4d520dd542be3c38d61b15f863d5589695842dce713                                     │       
│  │ Sender: 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b                                       │       
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )                    │       
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                                       │       
│  │ Version: 1021236                                                                                                 │       
│  │ Digest: Auk7kWfNjrvr8LkT2oKemoEYEkMyCoQM762vMfaCxwmr                                                             │       
│  └──                                                                                                                │       
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯       
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Balance Changes                                                                                   │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│  ┌──                                                                                              │
│  │ Owner: Account Address ( 0x705cc33cfe47f0e6d721c6decca1410b3ac7893a481178e1fef08f343651d15b )  │
│  │ CoinType: 0x2::sui::SUI                                                                        │
│  │ Amount: -4323480                                                                               │
│  └──                                                                                              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
相关推荐
陈哥聊测试1 天前
软件格局在变,谁能扛起国产替代的大旗?
安全·程序员·产品
黄油饼卷咖喱鸡就味增汤拌孜然羊肉炒饭2 天前
SpringBoot如何实现缓存预热?
java·spring boot·spring·缓存·程序员
少年姜太公2 天前
从零开始详解js中的this(下)
前端·javascript·程序员
凌虚2 天前
Kubernetes APF(API 优先级和公平调度)简介
后端·程序员·kubernetes
小华同学ai2 天前
ShowDoc:Star12.3k,福利项目,个人小团队的在线文档“简单、易用、轻量化”还专门针对API文档、技术文档做了优化
前端·程序员·github
小青鱼4 天前
AI编程-Cursor从入门到精通系列之常用概念及解释(二)
人工智能·程序员
捡田螺的小男孩5 天前
参数校验的十个建议!收藏好,别再给测试机会提bug~
java·后端·程序员
哔哩哔哩技术5 天前
B站装机系统实践:从初创到规模化的演进
前端·程序员
程序员鱼皮5 天前
没事别想不开去创业!
计算机·面试·程序员·项目
绝无仅有5 天前
通用的权限管理系统的介绍与总结
面试·程序员·架构