Initia (Closed Testnet)
  • Reminder
    • ⛔Confidentiality Disclaimer
  • WELCOME TO CLOSED TESTNET
    • Welcome to Closed Testnet
  • About Initia
    • What is the Initia Platform?
      • Architecture
        • Layer 1
        • Layer 2
      • Aligning Initia (coming soon!)
    • InitiaDEX
    • Enshrined Liquidity and Staking
  • Developers
    • Initiad
      • Download Initiad
      • Using Initiad
    • Get INIT token
    • Build your own Minitia
      • Simple Minitia Setup
      • Connect Minitia to L1
        • OPinit Stack
          • OPinit Module
          • OPinit Bots
        • Relayer
          • Fetching Oracle Prices
    • Virtual Machines
      • MoveVM
        • Interact with CLI
      • WasmVM
    • Contracts
      • Move Contracts
      • CosmWasm Contracts
      • EVM Contracts (Coming Soon)
    • Oracles
  • Initia Developer Tutorials
    • 1. Create account
    • 2. Send Move coin
    • 3. Interchain Message
    • 4. Create your own Move coin
    • 5. Create your own Move NFT
    • 6. Build and Publish Contracts
      • Move Module
      • CosmWasm Contract
  • Core Applications
    • Core Applications
      • Wallet
      • Initia App
      • Usernames
      • Initia Scan
  • Node Operators
    • Running Initia Node
      • Prerequisites
      • Oracle
      • Boot an Initia Node
      • Connect to Initia Network
      • Cosmovisor Guide
    • Configuring Initia Validator
  • References and Tools
    • Move Language
    • Rust Language (CosmWasm)
    • Closed Testnet Chain Information
    • Chain Parameters
    • Initia.js
    • API Docs
    • API Docs (minimove)
    • API Docs (miniwasm)
    • Whitelisted Tokens and Pairs
Powered by GitBook
On this page
  • Building Move
  • Unit Test
  • Test Coverage
  • Deploying a Move Package
  • Executing an Entry Function
  • Executing a View Function
  1. Developers
  2. Virtual Machines
  3. MoveVM

Interact with CLI

In this tutorial, initiad and minitiad both can be used

PreviousMoveVMNextWasmVM

Last updated 1 year ago

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 .

$ initiad move build --path ./move/managed_coin --dev

Unit Test

The initiad CLI can also be used to run uint tests locally.

$ initiad move test --path ./move/managed_coin --dev

The 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: 0

In Move.toml there are two types of address lists which are addresses and dev-addresses. If a value exists on addresses the same value cannot exist on dev-addresses simutaneously. If you want to enter the same values for both locations, addresses must have "_" for the move CLI to work.

[addresses]
initia_std = "0x1"
std = "0x1"
your_address = "_"

[dev-addresses]
your_address = "0x2"

Test Coverage

The initiad can be used to generate test coverage report.

$ initiad move test --path ./move/managed_coin --dev --coverage

The 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 package

Deploying 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}

initia-tutorials