A command-line interface for managing StellopayCore contracts on the Stellar network.
- Deploy contracts to any Stellar network (testnet, mainnet, futurenet)
- Verify deployed WASM against a fresh source build (byte-for-byte SHA-256)
- Query contract information and details
- Configuration management with persistent settings
- Status monitoring for dependencies and contract builds
- Comprehensive logging and error handling
- Rust 1.70+ (for building from source)
- Soroban CLI (automatically checked and prompted for installation)
cd tools/cli
cargo build --releaseThe binary will be available at target/release/stellopay-cli.
# Show CLI status and check dependencies
stellopay-cli status
# Deploy a contract
stellopay-cli deploy --owner <STELLAR_ADDRESS>
# Verify deployed WASM matches source
stellopay-cli verify --contract-id <CONTRACT_ID>
# Get contract information
stellopay-cli info --contract-id <CONTRACT_ID>
# Show help
stellopay-cli --helpThe CLI uses a configuration file to store settings. By default, it's located at ~/.stellopay/config.toml.
You can specify a custom configuration file:
stellopay-cli --config /path/to/config.toml status# Network configuration
rpc_url = "https://soroban-testnet.stellar.org:443"
network_passphrase = "Test SDF Network ; September 2015"
# Optional: Default contract ID
contract_id = "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE"
# Optional: Default secret key (for deployments)
secret_key = "SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"Deploy a new StellopayCore contract:
stellopay-cli deploy --owner <STELLAR_ADDRESS>Options:
--owner <ADDRESS>: The Stellar address that will own the contract (required)--network <NETWORK>: Network to deploy to (testnet, mainnet, futurenet) [default: testnet]--wasm <PATH>: Path to the WASM file [default: auto-detected]
Examples:
# Deploy to testnet
stellopay-cli deploy --owner GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF
# Deploy to mainnet
stellopay-cli deploy --owner GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF --network mainnet
# Deploy with custom WASM
stellopay-cli deploy --owner GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF --wasm ./custom_contract.wasmGet detailed information about a deployed contract:
stellopay-cli info --contract-id <CONTRACT_ID>Options:
--contract-id <ID>: The contract ID to query (required)
Example:
stellopay-cli info --contract-id CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEShow CLI status and check system dependencies:
stellopay-cli statusThis command checks:
- ✅ Configuration file status
- ✅ Soroban CLI availability
- ✅ Contract WASM build status
- ✅ Network connectivity
Verify that a deployed contract's on-chain WASM hash matches a fresh build from the current source (byte-for-byte SHA-256):
stellopay-cli verify --contract-id <CONTRACT_ID>Options:
--contract-id <ID>: Deployed contract to check (or use config default)--network <NETWORK>: Network to query (testnet, mainnet) [default: testnet]--wasm <PATH>: Use an existing WASM file instead of building--skip-build: Skip rebuilding; use the default WASM artifact path--deployed-hash <HEX>: Compare against a known hash (skips on-chain fetch; useful for CI)
On success the command prints a clear pass message and exits 0. On mismatch it prints both the local and deployed hashes and exits with code 5 (Verification), so it can gate CI/release checks.
Examples:
# Build from source, fetch on-chain WASM, compare hashes
stellopay-cli verify --contract-id CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE
# Offline check against a known hash
stellopay-cli verify --wasm ./stello_pay_contract.wasm --deployed-hash <sha256-hex>--config <PATH>: Specify configuration file path--verbose: Enable verbose logging--help: Show help information--version: Show version information
STELLOPAY_CONFIG: Override default configuration file pathSTELLOPAY_NETWORK: Override default networkSTELLOPAY_RPC_URL: Override default RPC URL
# Run all tests
cargo test
# Run only unit tests
cargo test --lib
# Run only integration tests
cargo test --test integration_tests
# Run with verbose output
cargo test -- --nocapture# Development build
cargo build
# Release build
cargo build --release
# Build with specific features
cargo build --features "custom-feature"src/
├── lib.rs # CLI structure definitions
├── main.rs # Main entry point
├── commands.rs # Command implementations
├── config.rs # Configuration management
└── utils.rs # Utility functions
tests/
└── integration_tests.rs # Integration tests
The CLI automatically detects and uses the contract WASM from the onchain workspace:
../../onchain/target/wasm32-unknown-unknown/release/stello_pay_contract.wasm
Make sure to build the contract first:
cd ../../onchain
stellar contract buildThe CLI provides comprehensive error messages and logging:
- Configuration errors: Issues with config file or settings
- Network errors: Connection or RPC issues
- Contract errors: Deployment or interaction failures
- Validation errors: Invalid addresses or parameters
Use --verbose for detailed error information and debugging.
| Network | RPC URL | Passphrase |
|---|---|---|
| testnet | https://soroban-testnet.stellar.org:443 | Test SDF Network ; September 2015 |
| mainnet | https://soroban-mainnet.stellar.org:443 | Public Global Stellar Network ; September 2015 |
| futurenet | https://soroban-futurenet.stellar.org:443 | Test SDF Future Network ; October 2022 |
# 1. Check status
stellopay-cli status
# 2. Deploy contract
stellopay-cli deploy --owner GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF
# 3. Get contract info
stellopay-cli info --contract-id CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX# Deploy to futurenet
stellopay-cli deploy --network futurenet --owner GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF
# Use custom config for mainnet
stellopay-cli --config ./mainnet-config.toml deploy --network mainnet --owner GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF-
Soroban CLI not found
# Install Soroban CLI cargo install stellar-cli --locked -
Contract WASM not found
# Build the contract cd ../../onchain stellar contract build
-
Network connectivity issues
# Check RPC URL curl -X POST https://soroban-testnet.stellar.org:443 \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}'
-
Configuration file issues
# Reset configuration rm ~/.stellopay/config.toml stellopay-cli status # This will recreate the config
Enable verbose logging for detailed information:
stellopay-cli --verbose deploy --owner GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass:
cargo test - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
[network]
rpc_url = "https://soroban-testnet.stellar.org:443"
network_passphrase = "Test SDF Network ; September 2015"
[contract]
default_contract_id = "CONTRACT_ID_HERE"
[auth]
secret_key = "SECRET_KEY_HERE"
[defaults]
token = "TOKEN_ADDRESS_HERE"
frequency = "monthly"# Deploy new contract
stellopay-cli deploy --network testnet --owner <OWNER>
# Initialize contract
stellopay-cli contract initialize --owner <OWNER>
# Pause/unpause contract
stellopay-cli contract pause
stellopay-cli contract unpause
# Transfer ownership
stellopay-cli contract transfer-ownership --new-owner <ADDRESS>
# Get contract status
stellopay-cli contract status# List payrolls
stellopay-cli payroll list
# Create new payroll
stellopay-cli payroll create \
--employee <ADDRESS> \
--salary 5000 \
--frequency monthly \
--token <TOKEN>
# Get payroll info
stellopay-cli payroll get --employee <ADDRESS>
# Update payroll
stellopay-cli payroll update --employee <ADDRESS> --salary 6000# Process individual payment
stellopay-cli payment process --employee <ADDRESS>
# Process all eligible payments
stellopay-cli payment process-all
# Get payment history
stellopay-cli payment history --employee <ADDRESS># List supported tokens
stellopay-cli token list
# Add supported token
stellopay-cli token add --address <TOKEN_ADDRESS>
# Remove token
stellopay-cli token remove --address <TOKEN_ADDRESS> --confirm# Monitor contract health
stellopay-cli monitor health
# Watch events
stellopay-cli monitor watch --events SalaryDisbursed,PayrollCreated
# Get performance metrics
stellopay-cli monitor metrics --duration 1h
# Debug transaction
stellopay-cli monitor debug --transaction <TX_HASH># Set up test environment
stellopay-cli test setup --network testnet
# Generate test data
stellopay-cli test generate employees --count 10 --output employees.json
# Run load test
stellopay-cli test load-test --duration 5m --rate 10# 1. Deploy contract
CONTRACT_ID=$(stellopay-cli deploy --network testnet --owner $OWNER)
# 2. Add supported token
stellopay-cli -c $CONTRACT_ID token add --address $USDC_TOKEN
# 3. Create payroll for employee
stellopay-cli -c $CONTRACT_ID payroll create \
--employee $EMPLOYEE \
--salary 5000 \
--frequency monthly \
--token $USDC_TOKEN
# 4. Deposit funds
stellopay-cli -c $CONTRACT_ID deposit \
--amount 50000 \
--token $USDC_TOKEN
# 5. Process payment (when due)
stellopay-cli -c $CONTRACT_ID pay --employee $EMPLOYEE# Create employees.json with list of addresses
echo '["ADDR1", "ADDR2", "ADDR3"]' > employees.json
# Process bulk payments
stellopay-cli bulk-pay --employees employees.json --limit 50# Start health monitoring
stellopay-cli monitor health --interval 30 --threshold 5000 &
# Stream events to file
stellopay-cli stream --events all --format json > events.log &
# Generate daily report
stellopay-cli monitor analyze --from "2025-01-01" --to "2025-01-02" --output report.jsonSTELLOPAY_SECRET_KEY: Secret key for signing transactionsSTELLOPAY_CONTRACT_ID: Default contract IDSTELLOPAY_RPC_URL: RPC endpoint URLSTELLOPAY_NETWORK: Network name (testnet/mainnet)
-
"No contract ID specified"
- Set
--contract-idflag or add to config file - Set
STELLOPAY_CONTRACT_IDenvironment variable
- Set
-
"Contract not found"
- Verify contract is deployed on the specified network
- Check RPC URL is correct
-
"Unauthorized"
- Ensure secret key is set correctly
- Verify the account has the required permissions
-
"Insufficient balance"
- Deposit more funds using
stellopay-cli deposit - Check token balance with
stellopay-cli info --detailed
- Deposit more funds using
Enable verbose logging:
stellopay-cli -v <command>Or set log level:
RUST_LOG=debug stellopay-cli <command>cargo build --releasecargo test- Add command definition to
src/lib.rs - Implement command handler in
src/commands.rs - Add tests in
tests/directory
MIT License - see LICENSE file for details.