suideveloper
All questions
Packages

How do I call a Move function from the Sui CLI?

November 14, 2026

Use sui client call with the package ID, module name, function name and arguments: sui client call --package 0x<ID> --module counter --function increment --args 0x<COUNTER_ID>. The CLI signs with your active address, picks a gas coin, estimates the gas budget, and prints the effects. For anything beyond a single call, such as passing one call's result into another or splitting a coin first, use sui client ptb --move-call.

sui client call

Terminal
sui client call \
  --package 0x<PACKAGE_ID> \
  --module counter \
  --function increment \
  --args 0x<COUNTER_ID>

Flags:

  • --package, --module, --function: required. The package must be on your active network.
  • --args: arguments in the order of the Move signature. Object IDs and addresses are 0x hex strings. Leave out the TxContext parameter, which the runtime supplies.
  • --type-args: type arguments for a generic function, for example --type-args 0x2::sui::SUI. You have to give all of them.
  • --gas-budget: optional. Without it the CLI dry-runs first to estimate.
  • --gas: specific gas coin IDs to pay with.
  • --dry-run / --dev-inspect: simulate instead of executing.
  • --json: machine-readable output.

Pass system objects by ID. The clock is 0x6 and randomness is 0x8:

Terminal
sui client call --package 0x<PACKAGE_ID> --module game --function play \
  --args 0x<GAME_ID> 0x6 0x8

Simple values like numbers, booleans and strings go in as you'd expect. Vectors are JSON arrays, for example --args '[1,2,3]'. Quote them in zsh.

sui client ptb --move-call

sui client ptb builds a programmable transaction block. The Sui docs recommend it for building transactions because it exposes the same commands the SDKs use. Its argument syntax is different: object IDs and addresses take an @ prefix, and type arguments go in angle brackets.

Terminal
sui client ptb \
  --move-call 0x<PACKAGE_ID>::counter::increment @0x<COUNTER_ID>

Chain calls and reuse their results with --assign:

Terminal
sui client ptb \
  --split-coins gas "[1000000000]" \
  --assign payment \
  --move-call 0x<PACKAGE_ID>::shop::buy @0x<SHOP_ID> payment \
  --assign item \
  --transfer-objects "[item]" @0x<MY_ADDRESS>

More argument forms:

Terminal
--move-call 0x<PKG>::m::f '"Hello, world"'           # string (single-quote the double quotes)
--move-call 0x<PKG>::m::f vector[1, 2, 3]            # vector<u64>
--move-call 0x<PKG>::m::f some(5)                    # Option<u64>
--move-call 0x<PKG>::m::f "<0x2::sui::SUI>" @0x<ID>  # with a type argument

Add --preview to print the commands without sending anything, or --dry-run to simulate. See the PTB CLI guide for more.

Which functions you can call

A transaction can call public functions and entry functions. Private and public(package) functions can't be called from a transaction. If a function returns a value without the drop ability (an object, a coin), sui client call can't do anything with it and the transaction fails with an unused value error. Use sui client ptb and transfer or pass on the returned value. For the difference, see entry vs public functions.

Common errors

  • Function not found / linkage not found: wrong package ID, or the package isn't on the network you're connected to.
  • CommandArgumentError: wrong argument type or order, or an owned object that belongs to someone else.
  • Abort: the function hit an assert!. See why did my transaction fail.

Sources

More on packages