Reference simple CLI wallet for Hush Smart Chains
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.7 KiB

#!/usr/bin/env bash
# Copyright (c) 2022 Jahway603 & The Hush developers
#
# This is a Hush Smart Chain (HSC) CLI basic wallet for testing new HSC
### Config section - change if needed
hush_cli_location="./src/hush-cli"
### Checking...
if [[ $# -eq 0 ]] ; then
echo "WARNING: You didn't specify the name of your Hush Smart Chain (HSC)!"
echo "Please try ./hsc-cli -h to see the proper commands."
exit 1
fi
Help()
{
echo "This is a series of test scripts to interact with your new Hush Smart Chain (HSC)."
echo
echo "Syntax: ./hsc-cli Name-of-HSC"
echo "Start the hsc-cli for your specified HSC"
}
# Get the help options
while getopts ":h" option; do
case $option in
h) # display Help
Help
exit;;
esac
done
# Main
echo
cat <<'EOF'
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
dP dP .d88888b a88888b. a88888b. dP dP
88 88 88. "' d8' `88 d8' `88 88 88
88aaaaa88a `Y88888b. 88 88 88 88
88 88 `8b 88 88888888 88 88 88
88 88 d8' .8P Y8. .88 Y8. .88 88 88
dP dP Y88888P Y88888P' Y88888P' 88888888P dP
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
EOF
echo
echo "Welcome to this Hush Smart Chain CLI experience for $1"
echo
echo "Please select from the following options for your testing:"
select option in z_gettotalbalance z_listaddresses z_getnewaddress getinfo getwalletinfo getpeerinfo listunspent z_getbalances getchaintxstats z_shieldcoinbase
do
case $option in
"getinfo")
$hush_cli_location -ac_name=$1 getinfo
;;
"getwalletinfo")
$hush_cli_location -ac_name=$1 getwalletinfo
;;
"getpeerinfo")
$hush_cli_location -ac_name=$1 getpeerinfo
;;
"listunspent")
$hush_cli_location -ac_name=$1 listunspent
;;
"z_getbalances")
$hush_cli_location -ac_name=$1 z_getbalances
;;
"z_getnewaddress")
$hush_cli_location -ac_name=$1 z_getnewaddress
;;
"z_gettotalbalance")
$hush_cli_location -ac_name=$1 z_gettotalbalance
;;
"z_getnewaddress")
$hush_cli_location -ac_name=$1 z_getnewaddress
;;
"z_listaddresses")
$hush_cli_location -ac_name=$1 z_listaddresses
;;
"getchaintxstats")
$hush_cli_location -ac_name=$1 getchaintxstats
;;
"z_shieldcoinbase")
echo "Enter your z-addr:"
read input_zaddr
if [[ $input_zaddr == zs1* ]] ; then
echo "You entered: $input_zaddr"
$hush_cli_location -ac_name=$1 z_shieldcoinbase "*" "$input_zaddr"
fi
;;
*)
echo "Invalid entry - try again."
break
;;
esac
done