diff --git a/latest.sh b/latest.sh index 7010d821..98c4e42b 100755 --- a/latest.sh +++ b/latest.sh @@ -31,13 +31,13 @@ for path in $pathlist; do if $include; then RPC_URL="${PROTO:-https}://$DOMAIN/$path" - if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["${blocktag}",false],"id":1}' | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then + if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",false],\"id\":1}" | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then exit 0 else - if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["${blocktag}",false],"id":1}' | jq; then + if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",false],\"id\":1}" | jq; then exit 1 else - curl -L -vv -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["${blocktag}",false],"id":1}' + curl -L -vv -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",false],\"id\":1}" fi fi fi