Documentation

Kanari Documentation

Move Development

Manage Move packages, tools, and smart contracts on Kanari Network.

Last updated

Move Development

Manage Move packages and tools directly from the Kanari CLI.

Usage

kanari move <COMMAND>

Commands

build

Build the current Move package in the working directory.

Usage:

kanari move build

new

Create a new Move package skeleton.

Usage:

kanari move new <NAME>

Arguments:

  • <NAME>: The name of the package to be created.

test

Run unit tests for the Move package.

Usage:

kanari move test [OPTIONS] [filter]

Arguments:

  • [filter]: An optional filter string to determine which unit tests to run. A unit test will be run only if it contains this string in its fully qualified (<addr>::<module_name>::<fn_name>) name.

Options:

  • -i, --gas-limit <gas-limit>: Bound the amount of gas used by any one test.
  • -l, --list: List all tests.
  • -t, --threads <num-threads>: Number of threads to use for running tests [default: 8].
  • -s, --statistics [<report-statistics>]: Report test statistics at the end of testing. CSV report generated if 'csv' passed.
  • --stackless: Use the stackless bytecode interpreter to run the tests and cross check its results with the execution result from Move VM.
  • --verbose: Verbose mode.
  • --coverage: Collect coverage information for later use with the various move coverage subcommands. Currently supported only in debug builds.

docgen

Generate documentation for the Move package.

Usage:

kanari move docgen

publish

Publish the Move module to the blockchain.

Usage:

kanari move publish [OPTIONS] --sender &lt;SENDER&gt;

Options:

  • --package-path &lt;PACKAGE_PATH&gt;: Path to the Move package (defaults to current directory).
  • --gas-limit &lt;GAS_LIMIT&gt;: Gas limit for the transaction [default: 100000].
  • --gas-price &lt;GAS_PRICE&gt;: Gas price in Mist [default: 100].
  • --sender &lt;SENDER&gt;: Account address publishing the module (from wallet).
  • --password &lt;PASSWORD&gt;: Wallet password (required for signing).
  • --rpc &lt;RPC_ENDPOINT&gt;: RPC endpoint.

verify

Verify Move module bytecode locally using an RPC endpoint.

Usage:

kanari move verify

call

Call a specific Move function on the blockchain.

Usage:

kanari move call [OPTIONS] --package &lt;PACKAGE&gt; --module &lt;MODULE&gt; --function &lt;FUNCTION&gt; --sender &lt;SENDER&gt;

Options:

  • --package &lt;PACKAGE&gt;: Package address (hex). Example: 0x840512ff...
  • --module &lt;MODULE&gt;: Module name (required).
  • --function &lt;FUNCTION&gt;: Function name in module.
  • --type-args &lt;TYPE_ARGS&gt;: Type arguments to the generic function being called. All must be specified. Example: 0x1::coin::KANARI
  • --args [&lt;ARGS&gt;...]: Simplified ordered args. ObjectIDs, Addresses must be hex strings. Example: 0x123 1000 true
  • --sender &lt;SENDER&gt;: Sender/Caller address (from wallet).
  • --password &lt;PASSWORD&gt;: Wallet password (required for signing).
  • --gas-limit &lt;GAS_LIMIT&gt;: Gas limit for the transaction [default: 100000].
  • --gas-price &lt;GAS_PRICE&gt;: Gas price in Mist [default: 100].
  • --rpc &lt;RPC_ENDPOINT&gt;: RPC endpoint.

Examples:

kanari move call --package 0x1 --module coin --function transfer --args "address:0x2" "u64:1000" --sender 0x1
kanari move call --package 0x1 --module game --function start --args "[\"0x1\",\"0x2\"]" --sender 0x1 --password mypass

Options

  • -h, --help: Print help information for the move command or a specific subcommand.