🌱
Dev Compendium
  • Ethereum
    • Solidity
      • EVM
      • Architecture
      • Execution Context
      • Transactions
      • Gas
      • Calldata, Memory & Storage
      • Gas Optimisation
      • Function Declarations
      • receive() & fallback()
      • CALL vs. DELEGATE CALL
    • Yul
      • Introduction
      • Types
      • Basic Operations
      • Storage
      • Memory
        • Arrays
        • Structs
        • Tuples, revert, keccak256
        • Logs and Events
        • Gotchas
        • abi.encode
      • Calldata
        • External Calls
        • Dynamic Length Inputs
        • Transferring Value
        • Receiving Contract Calls
      • Contracts in Yul
      • Other Yul Functions
    • Foundry
    • Security
      • Common Vulnerabilities
      • Best Practices
      • Development Workflow
      • Contract Migration
    • Auditing Tools
      • Slither
      • Mythril
      • Fuzzing
    • Upgradable Contracts
      • Upgrade Patterns
      • ERC-1967 Implementation
      • Deployment
    • MEV
    • Tooling
      • Chainlink
      • IPFS
      • Radicle
    • Frontend
      • Contract Hooks
      • Wallet Connection
        • wagmi.sh
        • Rainbow Kit
      • thirdweb
    • Protocol Research
      • Uniswap v2
      • Uniswap v3
      • Curve
      • GMX
  • Starkware
    • Fundamentals
    • Account Abstraction
    • Universal Deployer
    • Cairo 1.0
    • starknet.js
    • Security Model
  • Zero Knowledge
    • Group Theory
    • ECDSA
  • Rust
    • Basic Operations
    • Set up
    • Primitives
    • Control Flow
    • Mutability & Shadowing
    • Adding Behavior
    • Lifetimes
    • Std Library
  • SUI
    • Architecture
    • Consensus Mechanism
    • Local Node Setup
    • Sui Client CLI
    • Move Contracts
      • Move
      • Move.toml
      • Move.lock
      • Accessing Time in Sui Move
      • Set up Development Framework
      • Debug & Publish
      • Package Upgrades
      • Sui Move Library
      • Difference from Core Move
    • Object Programming
      • Object Basics
      • Using Objects
      • Immutable Objects
      • Object Wrapping
      • Dynamic Fields
      • Collections
      • Unit Testing
      • Deployment with CLI
  • NEAR
    • Architecture
    • Contract Standards
      • Fungible Token (NEP-141)
      • Non-Fungible Token (NEP-171)
      • Storage Management (NEP-145)
      • Events (NEP-297)
      • Meta-Transactions
    • Rust Contracts
      • Development Workflow
      • Smart Contract Layout
      • Storage Management
      • Events & Meta-transactions
      • Method Types
      • Upgrading Contracts
      • Unit Testing
    • NEAR Libraries
    • Environment Variables
    • Serialisation
    • Security Concepts
    • Collections
    • JS SDK
Powered by GitBook
On this page
  1. SUI
  2. Object Programming

Deployment with CLI

To call create in actual transactions, you need to start Sui and the Sui Client CLI.

Before you start, check the active address on the client as that address eventually owns the object):

sui client active-address

To publish the code on-chain, use the following command:

sui client publish $ROOT/sui_programmability/examples/objects_tutorial --gas-budget 10000

or from the root of the package folder:

sui client publish --gas-budget 10000

These examples assume that the path to the root of the repository containing Sui source code is $ROOT.

You can find the published package object ID in the Transaction Effects output:

Transaction Kind : Publish
----- Transaction Effects ----
Status : Success
Created Objects:
  - ID: 0x225019dc52210704642b76c0bcf0d05bd374b6a348080f82a30ce7f8303c1b3f , Owner: Immutable
Mutated Objects:
  - ID: 0x1b879f00b03357c95a908b7fb568712f5be862c5cb0a5894f62d06e9098de6dc , Owner: Account Address ( 0x44840a79dd5cf1f5efeff1379f5eece04c72db13512a2e31e8750f5176285446 )

Note that the exact data you see differs from the examples in this topic.

The first hex string with the Immutable owner is the package's objectID (0x79b81364676f2f700e8a5acc71ca66eef753f1e536e4480a24278f02499e8cc5). For convenience, save it to an environment variable:

export PACKAGE=0x79b81364676f2f700e8a5acc71ca66eef753f1e536e4480a24278f02499e8cc5

The mutated object is the gas object used to pay for the transaction.

You can call the function to create a color object:

sui client call --gas-budget 1000 --package $PACKAGE --module "color_object" --function "create" --args 0 255 0

In the Transaction Effects portion of the output, you see an object included in the list of Created Objects:

----- Transaction Effects ----
Status : Success
Created Objects:
  - ID: 0x44840a79dd5cf1f5efeff1379f5eece04c72db13512a2e31e8750f5176285446 , Owner: Account Address ( 0x79b81364676f2f700e8a5acc71ca66eef753f1e536e4480a24278f02499e8cc5 )
Mutated Objects:
  - ID: 0x7cd011b6dbe90a0520a8501d993e3666b9373456b588f97600fcae6e02f60aa3 , Owner: Account Address ( 0x44840a79dd5cf1f5efeff1379f5eece04c72db13512a2e31e8750f5176285446 )

To save the object ID as a variable, use:

export OBJECT=0x44840a79dd5cf1f5efeff1379f5eece04c72db13512a2e31e8750f5176285446

To inspect this object and see what kind of object it is, use:

sui client object $OBJECT

This returns the metadata of the object, including its type:

----- Move Object (0x44840a79dd5cf1f5efeff1379f5eece04c72db13512a2e31e8750f5176285446[8]) -----
Owner: Account Address ( 0x44840a79dd5cf1f5efeff1379f5eece04c72db13512a2e31e8750f5176285446 )
Version: 8
Storage Rebate: 14
Previous Transaction: HRrB6qFxQZt7VEzagEjE4nhF9rbffK2wZRxqn9pPLhMk
----- Data -----
type: 0x79b81364676f2f700e8a5acc71ca66eef753f1e536e4480a24278f02499e8cc5::color_object::ColorObject
blue: 0
green: 255
id: 0x44840a79dd5cf1f5efeff1379f5eece04c72db13512a2e31e8750f5176285446
red: 0

You can also request the content of the object in json format by adding the --json parameter:

$ sui client object $OBJECT --json
PreviousUnit TestingNextArchitecture

Last updated 2 years ago