Hi all I made this bash alias to call ppcoind rpc inside a docker container without having ppcoind locally.
The cool thing is that it gives colored json output!
It has one dependency: jq (https://stedolan.github.io/jq/)
Add (and edit the connection details) this to your .bashrc:
function rpc_request {
if [ $# -gt 3 ]
then
printf -v var "\"%s\", " "${@:4}"
params=${var::-2}
else
params=""
fi
request="{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \""$3"\", \"params\": ["$params"] }"
curl --user $2 --data-binary "${request}" -H 'content-type: text/plain;' $1 | jq -C
}
alias rpc="rpc_request localhost:9902 user:password"
note that you can create multiple aliases for different rpc servers.
Usage example (multiple parameters are supported):