DefiantLabs / cosmos-upgrades

a tool to search for scheduled cosmos upgrades
MIT License
4 stars 2 forks source link

Add example of how to filter the requests from mainnets #4

Open danbryan opened 1 year ago

danbryan commented 1 year ago

Add example of how to filter the requests from mainnets

# Define an array of networks you care about
networks=("network1" "network2" "network3" ... "network15")

# Construct the jq filter dynamically
jq_filter='.[] | select(.network | IN('
for network in "${networks[@]}"; do
    jq_filter+='"'$network'",'
done
jq_filter=${jq_filter%,}'))'  # Remove the trailing comma and close the parenthesis

# Use the constructed filter with curl and jq
curl -s -X GET \
  -H "Content-Type: application/json" \
  http://localhost:5000/mainnets | jq "$jq_filter"