forked from TrueCloudLab/frostfs-dev-env
[#185] bin: Print human-readable errors
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
7448e2e777
commit
b725905b39
6 changed files with 65 additions and 35 deletions
|
@ -2,12 +2,21 @@
|
|||
|
||||
# Source env settings
|
||||
. .env
|
||||
source bin/helper.sh
|
||||
|
||||
# NeoGo binary path.
|
||||
NEOGO="${NEOGO:-docker exec -it morph_chain neo-go}"
|
||||
# NNS contract script hash
|
||||
NNS_ADDR=`curl -s --data '{ "id": 1, "jsonrpc": "2.0", "method": "getcontractstate", "params": [1] }' http://morph-chain.${LOCAL_DOMAIN}:30333/ | jq -r '.result.hash'`
|
||||
output=$(curl -s --data '{ "id": 1, "jsonrpc": "2.0", "method": "getcontractstate", "params": [1] }' \
|
||||
"http://morph-chain.${LOCAL_DOMAIN}:30333/") \
|
||||
|| die "Cannot fetch NNS contract state"
|
||||
|
||||
NNS_ADDR=$(jq -r '.result.hash' <<< "$output") \
|
||||
|| die "Cannot parse NNS contract hash: $NNS_ADDR"
|
||||
|
||||
${NEOGO} contract testinvokefunction \
|
||||
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
||||
${NNS_ADDR} resolve string:${1} int:16 | jq -r '.stack[0].value | if type=="array" then .[0].value else . end' | base64 -d
|
||||
-r "http://morph-chain.${LOCAL_DOMAIN}:30333" \
|
||||
"${NNS_ADDR}" resolve string:"${1}" int:16 \
|
||||
| jq -r '.stack[0].value | if type=="array" then .[0].value else . end' \
|
||||
| base64 -d \
|
||||
|| die "Cannot invoke 'NNS.resolve' $output"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue