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-addressTo publish the code on-chain, use the following command:
sui client publish $ROOT/sui_programmability/examples/objects_tutorial --gas-budget 10000or from the root of the package folder:
sui client publish --gas-budget 10000These 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=0x79b81364676f2f700e8a5acc71ca66eef753f1e536e4480a24278f02499e8cc5The mutated object is the gas object used to pay for the transaction.
You can call the function to create a color object:
In the Transaction Effects portion of the output, you see an object included in the list of Created Objects:
To save the object ID as a variable, use:
To inspect this object and see what kind of object it is, use:
This returns the metadata of the object, including its type:
You can also request the content of the object in json format by adding the --json parameter:
Last updated