-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfetch
79 lines (60 loc) · 2.9 KB
/
fetch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
echo "Fetching ibc-go, Tendermint & SDK versions"
ADDRESSES=./addresses.json
OUTPUT=./versions.json
OUTPUT_NOT_IMPLEMENTED=./not_implemented.json
# clear old data if any
if [ -s $OUTPUT ]; then
rm -f $OUTPUT
touch $OUTPUT
else
touch $OUTPUT
fi
# clear old data if any
if [ -s $OUTPUT_NOT_IMPLEMENTED ]; then
rm -f $OUTPUT_NOT_IMPLEMENTED
touch $OUTPUT_NOT_IMPLEMENTED
else
touch $OUTPUT_NOT_IMPLEMENTED
fi
# select all network names with grpc address values, remove any null addresses
jq -r '.[].grpc | select (. != null)' <$ADDRESSES | while read -r ADDR; do
# accomodate for two patterns of https ports
HTTPS=443
HTTPS1=2083
if [[ "$ADDR" == *"$HTTPS" ]]; then
NODE_INFO=$(grpcurl $ADDR cosmos.base.tendermint.v1beta1.Service.GetNodeInfo)
elif [[ "$ADDR" == *"$HTTPS1" ]]; then
NODE_INFO=$(grpcurl $ADDR cosmos.base.tendermint.v1beta1.Service.GetNodeInfo)
else
NODE_INFO=$(grpcurl -plaintext $ADDR cosmos.base.tendermint.v1beta1.Service.GetNodeInfo)
fi
NETWORK_NAME=$(jq .defaultNodeInfo.network <<<"$NODE_INFO")
TENDERMINT_VERSION=$(jq .defaultNodeInfo.version <<<"$NODE_INFO")
SDK_VERSION=$(jq .applicationVersion.cosmosSdkVersion <<<"$NODE_INFO")
IBCGO_VERSION=$(grep ibc-go -A 1 <<<"$NODE_INFO")
echo $ADDR
echo {'"NETWORK_NAME"': "$NETWORK_NAME", '"SDK_VERSION"': "$SDK_VERSION", '"IBCGO_VERSION"': "{$IBCGO_VERSION}", '"TENDERMINT_VERSION"': "$TENDERMINT_VERSION"} >> $OUTPUT
done
# do the same for rest addresses
jq -r '.[].rest | select (. != null)' <$ADDRESSES | while read -r ADDR; do
NODE_INFO=$(curl -X GET -H "Content-Type: application/json" $ADDR/node_info)
NOT_IMPLEMENTED=$(jq .message <<<"$NODE_INFO")
CHECK_IMPLEMENTED="Not Implemented"
if [[ $NOT_IMPLEMENTED == *"$CHECK_IMPLEMENTED"* ]]; then
echo {'"NETWORK_NAME"': "$ADDR"} >> $OUTPUT_NOT_IMPLEMENTED
continue
fi
# controller & host query params only working with REST endpoints for now
CONTROLLER_PARAMS=$(curl -X GET -H "Content-Type: application/json" $ADDR/ibc/apps/interchain_accounts/controller/v1/params)
CONTROLLER_ENABLED=$(jq -e .params? <<<"$CONTROLLER_PARAMS")
HOST_PARAMS=$(curl -X GET -H "Content-Type: application/json" $ADDR/ibc/apps/interchain_accounts/host/v1/params)
HOST_ENABLED=$(jq -e .params? <<<"$HOST_PARAMS")
NETWORK_NAME=$(jq .node_info.network <<<"$NODE_INFO")
TENDERMINT_VERSION=$(jq .node_info.version <<<"$NODE_INFO")
SDK_VERSION=$(jq .application_version.cosmos_sdk_version <<<"$NODE_INFO")
BUILD_DEPS=$(jq .application_version.build_deps <<<"$NODE_INFO")
IBCGO_VERSION=$(printf -- '%s\n' "${BUILD_DEPS[@]}" | grep "ibc-go")
BINARY_VERSION=$(jq .application_version.version <<<"$NODE_INFO")
echo {'"NETWORK_NAME"': "$NETWORK_NAME",'"BINARY_VERSION"': "$BINARY_VERSION",'"SDK_VERSION"': "$SDK_VERSION",'"IBCGO_VERSION"': "{$IBCGO_VERSION}", '"TENDERMINT_VERSION"': "$TENDERMINT_VERSION",'"CONTROLLER_ENABLED"': "$CONTROLLER_ENABLED",'"HOST_ENABLED"': "$HOST_ENABLED"} >> $OUTPUT
done