Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script that withdraws commission and reward from the Regen network account and auto-delegates these tokens to the validator every 3 hours
echo "Enter your key password:"
read -s password
while true
do
echo "About to withdraw commission and reward"
echo "${password}" | xrncli tx distr withdraw-rewards <xrn:valoperAddress> --commission --from <key-name> --chain-id=$(cat ~/.xrnd/config/genesis.json | jq -r .chain_id) -y
sleep 60
amount=$(xrncli query account <xrn:address> --chain-id=$(cat ~/.xrnd/config/genesis.json | jq -r .chain_id) -o json --indent | jq -r '.value.coins[0].amount')
if [[ $amount > 0 && $amount != "null" ]]; then
echo "About to stake ${amount} uTREEs"
echo "${password}" | xrncli tx staking delegate xrn:valoper1c934d8gjup8e680ljmp3jxfqc5vwh28zd24t7m ${amount}tree --chain-id=$(cat ~/.xrnd/config/genesis.json | jq -r .chain_id) --trust-node --from <key-name> -y
fi
sleep 10800
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.