-
-
Save Bambarello/7d5c39d9b802aae996e92b12696a6668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Using: | |
# cosmos.sh PASS VALIDATOR DELEGATOR WALLET_NAME NETWORK_NAME COIN DENOMINATION | |
CLI="/root/go/bin/kvcli" | |
wallet_pass=$1 | |
validator=$2 | |
delegator=$3 | |
wallet_name=$4 | |
network=$5 | |
coin=$6 | |
denomination=$7 | |
echo -en "\033[33;7mBEFORE\033[0m\n" | |
$CLI q staking validator $validator --trust-node | |
reward=$($CLI q distribution rewards $delegator $validator | sed -n 2p | cut -d "\"" -f 2 | cut -d "." -f 1) | |
echo -en "\033[33;7mRewards:\033[0m\n" | |
echo $reward / $denomination | bc -l | |
sleep 7 | |
echo -e "$wallet_pass\n$wallet_pass\n" | $CLI tx distribution withdraw-rewards --commission $validator --from $wallet_name --chain-id $network --yes | |
sleep 8 | |
balance=$($CLI q account $delegator | sed -n 5p | cut -d "\"" -f 2) | |
echo -en "\033[33;7mBalance:\033[0m\n" | |
echo $balance / $denomination | bc -l | |
echo -e "$wallet_pass\n$wallet_pass\n" | $CLI tx staking delegate $validator $balance$coin --from $wallet_name --chain-id $network --yes | |
sleep 10 | |
echo -en "\033[33;7mAFTER\033[0m\n" | |
$CLI q staking validator $validator --trust-node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment