-
-
Save sl-he/39da34b827b63fc98b4d852dc61f045b 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 | |
set -e | |
vote_account="/root/solana/vote-account-keypair.json" | |
identity_account="/root/solana/validator-identity.json" | |
new_stake="/root/solana/validator-stake-keypair-$(printf '%(%Y-%m-%d)T').json" | |
min_withdraw=100 | |
available_for_withdraw=$(solana balance $vote_account | awk -F\. '{print $1}') | |
re='^[0-9]+$' | |
if ! [[ $available_for_withdraw =~ $re ]] ; then | |
echo "error: \"$available_for_withdraw\"Not a number" >&2; exit 1 | |
fi | |
if (( available_for_withdraw < $min_withdraw )); then | |
echo "too small withdraw=$available_for_withdraw"; exit 2 | |
fi | |
echo available for withdraw=$available_for_withdraw | |
solana withdraw-from-vote-account $vote_account $identity_account $available_for_withdraw --authorized-withdrawer $vote_account | |
solana create-stake-account $new_stake $available_for_withdraw | |
solana delegate-stake $new_stake $vote_account |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment