Interact with CLI
In this tutorial, initiad and minitiad both can be used
The both initia and minitia have a command line interface (CLI) for developing on the Initia ecosystem. This document describes how to use the initia CLI tool. To download or build the CLI , follow Download Initiad.
Building Move
The initia CLI can be used to build a Move package. The below example uses the managed_coin in initia-tutorials.
$ initiad move build --path ./move/managed_coin --devUnit Test
The initiad CLI can also be used to run uint tests locally.
$ initiad move test --path ./move/managed_coin --devThe above command will generate the following terminal output:
INCLUDING DEPENDENCY InitiaStdlib
INCLUDING DEPENDENCY MoveNursery
INCLUDING DEPENDENCY MoveStdlib
BUILDING basic_coin
Running Move unit tests
[ PASS ] 0x2::managed_coin::test_create_and_mint
Test result: OK. Total tests: 1; passed: 1; failed: 0Test Coverage
The initiad can be used to generate test coverage report.
$ initiad move test --path ./move/managed_coin --dev --coverageThe output contains the result for each test case followed by a basic coverage summary resembling.
INCLUDING DEPENDENCY InitiaStdlib
INCLUDING DEPENDENCY MoveNursery
INCLUDING DEPENDENCY MoveStdlib
BUILDING basic_coin
Running Move unit tests
[ PASS ] 0x2::managed_coin::test_create_and_mint
Test result: OK. Total tests: 1; passed: 1; failed: 0
+-------------------------+
| Move Coverage Summary |
+-------------------------+
Module 0000000000000000000000000000000000000000000000000000000000000002::managed_coin
>>> % Module coverage: 100.00
+-------------------------+
| % Move Coverage: 100.00 |
+-------------------------+
Please use `initiad move coverage -h` for more detailed source or bytecode test coverage of this packageDeploying a Move Package
Create account and get a faucet fund to do on-chain operations.
$ initiad keys add acc0
$ initiad keys parse $(initiad keys show acc0 --address)
# update your_address in ./move/managed_coin/Move.toml to 0x address
# get token from the faucet https://faucet.initia.tech/After you create the account, you can run deploy command to deploy a package to the network.
$ initiad move deploy \
--path ./move/managed_coin \
--from acc0 \
--gas-prices 0.15uinit \
--gas auto \
--gas-adjustment 1.4 \
--node ${RPC_ADDR} \
--chain-id ${CHAIN_ID}Executing an Entry Function
The following command will try to mint managed coin to the acc0 account.
$ initiad tx move execute \
$(initiad keys show acc0 --address) managed_coin mint_to \
--args "u64:100 address:$(initiad keys show acc0 --address)" \
--from acc0 \
--gas auto \
--gas-adjustment 1.4 \
--gas-prices 0.15uinit \
--node ${RPC_URL} \
--chain-id ${CHAIN_ID}Executing a View Function
Retrieve the coin Metadata address.
initiad q move view 0x1 coin metadata \
--args "address:$(initiad keys show acc0 --address) string:BASIC" \
--node ${RPC_URL}
# record METADATA=0x~~~Query minted coin balance with the Metadata.
initiad q move execute 0x1 coin balance \
--args "address:$(initiad keys show acc0 --address) address:${METADATA}" \
--node ${RPC_URL}Last updated