Last active
March 24, 2023 07:40
-
-
Save yuhangch/c403e132e21d65a3616db1da85fdafec to your computer and use it in GitHub Desktop.
SwiftBar ETH gas price
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
#!/bin/bash | |
# <xbar.title>ETH Gas Price</xbar.title> | |
# <xbar.version>v2.0.1</xbar.version> | |
# <xbar.author>Biran Yucel</xbar.author> | |
# <xbar.author.github>biranyucel</xbar.author.github> | |
# <xbar.desc>ETH GasPrice forecast system.</xbar.desc> | |
# <xbar.image>https://i.imgur.com/f1hPKO2.png</xbar.image> | |
# <xbar.abouturl>https://ethgasstation.info/</xbar.abouturl> | |
# | |
#ETH GasPrice forecast system based on SparkPool Pending Transaction Mempool | |
# only keep slow gas price, set different color for <15 15 >20. | |
response=$(curl -s https://beaconcha.in/api/v1/execution/gasnow) | |
read code rapid fast standard slow timestamp <<<${response//[^0-9]/ } | |
gas=${slow:0:((${#slow} - 9))} | |
color=green | |
if [[ $gas -gt 15 ]] | |
then | |
color=purple | |
elif [[ $gas -gt 20 ]] | |
then | |
color=orange | |
fi | |
echo "Gas ${gas} | color=${color}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment