Created
January 10, 2018 03:59
-
-
Save jaddison/c0e53de62f90e179b07bef9137834725 to your computer and use it in GitHub Desktop.
Suprnova JSON API hash/share rate & balance script
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 | |
if [[ ! -v SUPRNOVA_KEY ]] | |
then | |
echo -e "SUPRNOVA_KEY environment variable isn't set.\n\nThis should be the API key from your Suprnova account." | |
exit 1 | |
fi | |
if [[ ! -v SUPRNOVA_TARGET ]] | |
then | |
echo -e "SUPRNOVA_TARGET environment variable isn't set.\n\nThis should be 'zcl' if you are connecting to 'zcl.suprnova.cc'" | |
exit 1 | |
fi | |
if [[ ! -v SUPRNOVA_ID ]] | |
then | |
echo -e "SUPRNOVA_ID environment variable isn't set.\n\nThis should be the account ID from your Suprnova account." | |
exit 1 | |
fi | |
status=$(http "https://$SUPRNOVA_TARGET.suprnova.cc/index.php?page=api&action=getuserstatus&api_key=$SUPRNOVA_KEY&id=$SUPRNOVA_ID&pretty=1" | jq '.getuserstatus.data | {username, hashrate: (.hashrate / 1000), sharerate}') | |
balance=$(http "https://$SUPRNOVA_TARGET.suprnova.cc/index.php?page=api&action=getuserbalance&api_key=$SUPRNOVA_KEY&id=$SUPRNOVA_ID&pretty=1" | jq '.getuserbalance.data | {balance: .}') | |
echo "$status $balance" | jq -Cs add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jq
to be installed.For example, if you're mining against zen.suprnova.cc: