Contract Invoke: Argument Types
When using stellar contract invoke, each --arg-name <value> flag is parsed according to the contract's type spec. This guide shows the correct format for each supported type.
Integers (u32, i32, u64, i64)
Pass bare numeric literals directly on the command line.
stellar contract invoke --id mycontract -- my_function \
--count 42 \
--offset -7
Large Integers (u128, i128, u256, i256)
Pass bare numeric literals, just like small integers. The CLI reads the raw value as a string internally, bypassing JSON number precision limits entirely.
stellar contract invoke --id mycontract -- my_function \
--amount 340282366920938463463374607431768211455
Boolean
Pass true or false as unquoted literals.
stellar contract invoke --id mycontract -- my_function \
--is_active true \
--is_paused false
String
Bare words work for simple strings. Numbers and booleans are also accepted and are automatically converted to their string representation, so you do not need to add extra quoting. Explicit JSON quoting is also accepted.
# Bare word
stellar contract invoke --id mycontract -- my_function \
--label hello
# Number auto-converted to string "42"
stellar contract invoke --id mycontract -- my_function \
--label 42
# Boolean auto-converted to string "true"
stellar contract invoke --id mycontract -- my_function \
--label true
# Explicitly quoted JSON string
stellar contract invoke --id mycontract -- my_function \
--label '"hello world"'
Symbol
Symbols follow the same rules as String: bare words, numbers, and booleans are all accepted, and non-string JSON values are auto-converted.
stellar contract invoke --id mycontract -- my_function \
--status active
Address
You can pass either a locally known identity name (e.g. alice) or a raw Stellar strkey (G… for accounts, C… for contracts).
# Using an identity alias
stellar contract invoke --id mycontract -- my_function \
--owner alice
# Using a raw strkey
stellar contract invoke --id mycontract -- my_function \
--owner GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN
Bytes / BytesN
Pass a hex-encoded string representing the byte sequence.
stellar contract invoke --id mycontract -- my_function \
--hash "deadbeef01020304"
Optional Arguments
Simply omit the flag. The CLI will supply a void / null value for any Option<T> parameter that is not provided.
# If `--memo` is optional, leaving it out passes None
stellar contract invoke --id mycontract -- my_function \
--amount 100
Vec
Pass a JSON array, quoting the whole value so the shell does not split it.
stellar contract invoke --id mycontract -- my_function \
--recipients '["alice", "bob", "carol"]'
Map
Pass a JSON object with string keys.
stellar contract invoke --id mycontract -- my_function \
--metadata '{"key": "value", "version": "1"}'
Tuple
Pass a JSON array whose elements match the tuple's field order.
stellar contract invoke --id mycontract -- my_function \
--point '[10, 20]'
Struct (User-Defined Type)
Pass a JSON object with the struct's named fields.
stellar contract invoke --id mycontract -- my_function \
--config '{"max_supply": "1000000", "decimals": 7}'
Enum / Union (User-Defined Type)
For unit variants, pass the variant name as a plain string. For variants that carry a value, pass a JSON object with the variant name as the key.
# Unit variant
stellar contract invoke --id mycontract -- my_function \
--status "Active"
# Variant with a value
stellar contract invoke --id mycontract -- my_function \
--result '{"Ok": 42}'
File-Based Arguments
For long or complex JSON values, use the --arg-file-path flag variant to load the value from a file instead of inlining it on the command line. The flag name is derived from the argument name by appending -file-path.
# Write the JSON to a file first
echo '{"max_supply": "1000000", "decimals": 7}' > config.json
# Then reference the file
stellar contract invoke --id mycontract -- my_function \
--config-file-path config.json
For Bytes and BytesN parameters, the file's raw binary content is read directly — no hex encoding is required.
stellar contract invoke --id mycontract -- my_function \
--hash-file-path /path/to/binary.bin
Guides in this category:
📄️ Asset Management
Issue a Stellar Asset, deploy it's contract, and mint, burn, freeze, and clawback.
📄️ Add meta data to contract WASM on build
Include meta data in the contract WASM byte code on build
📄️ Contract Invoke: Argument Types
How to pass each argument type when invoking a Stellar smart contract using the CLI
📄️ Contract Lifecycle
Manage the lifecycle of a Stellar smart contract using the CLI
📄️ Deploy a contract from uploaded Wasm bytecode
Deploy an instance of a compiled contract that has already been uploaded on the network
📄️ Deploy the Stellar Asset Contract for a Stellar asset
Deploy an SAC for a Stellar asset so that it can interact with smart contracts
📄️ Extend a deployed contract instance's TTL
Use the CLI to extend the time to live (TTL) of a contract instance
📄️ Extend a deployed contract's storage entry TTL
Use the CLI to extend the time to live (TTL) of a contract's persistent storage entry
📄️ Extend a deployed contract's Wasm code TTL
Use Stellar CLI to extend contract's Wasm bytecode TTL, with or without local binary
📄️ Payments and Assets
Send XLM, stellar classic, or a soroban asset using the Stellar CLI
📄️ Restore an archived contract using the Stellar CLI
Restore an archived contract instance using the Stellar CLI
📄️ Restore archived contract data using the Stellar CLI
Restore archived contract storage entries using Stellar CLI
📄️ Stellar Keys
Manage stellar keys
📄️ Create Claimable Balance
Create claimable balances with various claim predicates using the Stellar CLI
📄️ tx Commands
Create stellar transactions using the Stellar CLI
📄️ tx op add
Create stellar transactions using the Stellar CLI
📄️ tx sign and tx send
Create stellar transactions using the Stellar CLI
📄️ Upload and deploy a smart contract
Combine the upload and deploy commands in the Stellar CLI to accomplish both tasks
📄️ Upload Wasm bytecode
Use the Stellar CLI to upload a compiled smart contract on the ledger