frostfs-dev-env/bin/resolve.sh
anastasia prasolova e2c169e440 [#196] Remove -i key in docker exec in bin/resolve.sh
Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
2022-07-28 19:37:09 +03:00

22 lines
738 B
Bash
Executable file

#!/usr/bin/env bash
# Source env settings
. .env
source bin/helper.sh
# NeoGo binary path.
NEOGO="${NEOGO:-docker exec -t morph_chain neo-go}"
# NNS contract script 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 \
|| die "Cannot invoke 'NNS.resolve' $output"