soroban-cli allows you to interact with deployed contracts, set different identities to sign with, set different networks, and generate new keys.
Generate a new identity
The easiest way to get started is to generate a new identity:
soroban config identity generate alice
This will generate a new seed phrase for the identity
soroban config identity ls
Now this identity can be referenced when using other commands. For example,
soroban contract invoke --id 10 --identity alice --fn hello -- ..
All commands that relate to interactions with a contract are organized under the
soroban contract --help
Tools for smart contract developers
soroban contract <SUBCOMMAND>
-h, --help Print help information
bindings Generate code client bindings for a contract
deploy Deploy a contract
inspect Inspect a WASM file listing contract functions, meta, etc
install Install a WASM file to the ledger without creating a contract instance
invoke Invoke a contract function
optimize Optimize a WASM file
Invoking a function with arguments
Since each contract has its xdr definition embedded in the binary, it is possible to dynamically generate a custom CLI for each contract function.
Anything after the
-- is parsed as arguments to the function... and it even includes a help page!
soroban contract invoke --id 10 --identity alice --fn hello -- --help
Arguments as flags
Each argument to the contract function is parsed as flags. For example:
soroban contract invoke --id 10 --identity alice --fn hello -- --to world
world to the