Last active
May 15, 2020 14:32
-
-
Save k0kk0k/036e661f18be3782d4c4ab13e3d7aa1a to your computer and use it in GitHub Desktop.
Akash auto restaking
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 | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
DELEGATOR='akash1pjf4kxeeq2vc8vtg9zmm7e6haac8at70f7630g' | |
VALIDATOR='akashvaloper1pjf4kxeeq2vc8vtg9zmm7e6haac8at70ru5hlz' | |
PASWD='your_wallet_pass' | |
DELAY=600 #in secs | |
ACC_NAME=devurandom | |
for (( ;; )); do | |
BAL=$(akashctl -o json query account ${DELEGATOR} | jq -r '.value.coins[].amount'); | |
echo -e "BALANCE: ${GREEN}${BAL}${NC} uakt\n" | |
echo -e "Claim rewards\n" | |
echo -e "${PASWD}\n${PASWD}\n" | akashctl tx distribution withdraw-rewards ${VALIDATOR} --commission --chain-id centauri --from ${ACC_NAME} -y -o json | jq . | |
for (( timer=10; timer>0; timer-- )) | |
do | |
printf "* sleep for ${RED}%02d${NC} sec\r" $timer | |
sleep 1 | |
done | |
BAL=$(akashctl -o json query account ${DELEGATOR} | jq -r '.value.coins[].amount'); | |
echo -e "BALANCE: ${GREEN}${BAL}${NC} uakt\n" | |
echo -e "Stake ALL\n" | |
echo -e "${PASWD}\n${PASWD}\n" | akashctl tx staking delegate ${VALIDATOR} ${BAL}uakt --chain-id centauri --from ${ACC_NAME} -y -o json | jq . | |
for (( timer=${DELAY}; timer>0; timer-- )) | |
do | |
printf "* sleep for ${RED}%02d${NC} sec\r" $timer | |
sleep 1 | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment