From 28f9083e9fc1c4a1bec79dd05a5d27a2d3b3bd95 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 21 Sep 2021 17:56:19 +0300 Subject: [PATCH] [#47] Add script to resolve side chain contract addresses from NNS Signed-off-by: Alex Vanin --- README.md | 1 + bin/resolve.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100755 bin/resolve.sh diff --git a/README.md b/README.md index aa73558..0254f1f 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Make sure you have installed all of the following prerequisites on your machine: * expect * openssl * jq +* base64 (coreutils) ## Quick Start diff --git a/bin/resolve.sh b/bin/resolve.sh new file mode 100755 index 0000000..e5bfdd9 --- /dev/null +++ b/bin/resolve.sh @@ -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