Created
April 7, 2021 16:55
-
-
Save hexonaut/882ced4020036344600ad413ad516f9b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
gp() { | |
if [ $# -eq 0 ] | |
then | |
echo Gas price is $(echo $ETH_GAS_PRICE / 1000000000 | bc) Gwei | |
return | |
elif [ "$1" = "fast" ] | |
then | |
GAS_GWEI=$(curl -s "https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=APIKEY" | jq -r .result.FastGasPrice) | |
elif [ "$1" = "trade" ] | |
then | |
FAST_GAS=$(curl -s "https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=APIKEY" | jq -r .result.FastGasPrice) | |
GAS_GWEI=$(echo "$FAST_GAS + 10" | bc) | |
else | |
GAS_GWEI=$1 | |
fi | |
export ETH_GAS_PRICE=${GAS_GWEI}000000000 | |
echo Setting gas to $GAS_GWEI GWei | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment