Skip to content

Instantly share code, notes, and snippets.

@ferric-sol
Created December 4, 2024 03:10
Show Gist options
  • Save ferric-sol/f35871bb4a8a88e619be43119fef7fdd to your computer and use it in GitHub Desktop.
Save ferric-sol/f35871bb4a8a88e619be43119fef7fdd to your computer and use it in GitHub Desktop.
jito tips
#!/bin/bash
if [ -z "$1" -o -z "$2" -o -n "$3" ]; then
echo "Usage: jito_tips.sh <epoch> <validator search phrase>"
exit 1
fi
COUNT=`solana-dekey -l "$2" | grep "Vote Account:" | wc -l`
if [ $COUNT -gt 1 ]; then
echo "Ambiguous key: $2"
echo "Matching keys:"
solana-dekey -l "$2"
exit 1
elif [ $COUNT -eq 0 ]; then
VOTE_ACCOUNT=$2
else
VOTE_ACCOUNT=`solana-dekey -l "$2" | grep "Vote Account:" | awk '{ print $3 }'`
fi
echo "Vote Account: $VOTE_ACCOUNT"
TIP_ACCOUNT=`solxact pda 4R3gSG8BpU4t19KYj8CfnbtRpnT8gtk4dvTHxVRwc2r7 [ string TIP_DISTRIBUTION_ACCOUNT pubkey $VOTE_ACCOUNT u64 $1 ] | cut -d '.' -f 1`
echo "Tip Account: $TIP_ACCOUNT"
echo -n "Balance: "
BALANCE=`solana balance $TIP_ACCOUNT | awk '{ print $1 }'`
echo $BALANCE
SLOT=`solana slot`
EPOCH=`dc -e "$SLOT 432000 / p"`
if [ $1 -eq $EPOCH ]; then
ESTIMATED=`dc -e "9 k $BALANCE $SLOT $EPOCH 432000 * - 432000 / / p"`
echo "Estimated: $ESTIMATED"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment