[#47] Add script to resolve side chain contract addresses from NNS

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-09-21 17:56:19 +03:00 committed by Alex Vanin
parent 897ac9c6dc
commit 28f9083e9f
2 changed files with 14 additions and 0 deletions

View file

@ -19,6 +19,7 @@ Make sure you have installed all of the following prerequisites on your machine:
* expect
* openssl
* jq
* base64 (coreutils)
## Quick Start

13
bin/resolve.sh Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Source env settings
. .env
# 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'`
${NEOGO} contract testinvokefunction \
-r http://morph_chain.${LOCAL_DOMAIN}:30333 \
${NNS_ADDR} resolve string:${1} int:16 | jq -r '.stack[0].value' | base64 -d