From 694764f76675387d964587aace9c6d9c98eee65e Mon Sep 17 00:00:00 2001 From: Francis Pouliot Date: Fri, 17 Jan 2020 11:18:54 -0500 Subject: [PATCH 1/6] Update walletoperations.sh --- proxy_docker/app/script/walletoperations.sh | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/proxy_docker/app/script/walletoperations.sh b/proxy_docker/app/script/walletoperations.sh index e5051d6..4427fa6 100644 --- a/proxy_docker/app/script/walletoperations.sh +++ b/proxy_docker/app/script/walletoperations.sh @@ -126,6 +126,32 @@ getbalance() { return ${returncode} } +getbalances() { + trace "Entering getbalances()..." + + local response + local data='{"method":"getbalances"}' + response=$(send_to_spender_node "${data}") + local returncode=$? + trace_rc ${returncode} + trace "[getbalances] response=${response}" + + if [ "${returncode}" -eq 0 ]; then + local balances=$(echo ${response} | jq ".result") + trace "[getbalances] balances=${balances}" + + data="{\"balances\":${balances}}" + else + trace "[getbalances] Coudn't get balances!" + data="" + fi + + trace "[getbalances] responding=${data}" + echo "${data}" + + return ${returncode} +} + getbalancebyxpublabel() { trace "Entering getbalancebyxpublabel()..." From e45d3faae69e4af2969003f4c1fe475e16765487 Mon Sep 17 00:00:00 2001 From: Francis Pouliot Date: Fri, 17 Jan 2020 11:21:07 -0500 Subject: [PATCH 2/6] Update requesthandler.sh --- proxy_docker/app/script/requesthandler.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proxy_docker/app/script/requesthandler.sh b/proxy_docker/app/script/requesthandler.sh index dad4ca2..182564e 100644 --- a/proxy_docker/app/script/requesthandler.sh +++ b/proxy_docker/app/script/requesthandler.sh @@ -232,6 +232,13 @@ main() { response_to_client "${response}" ${?} break ;; + getbalance) + # curl (GET) http://192.168.111.152:8080/getbalances + + response=$(getbalances) + response_to_client "${response}" ${?} + break + ;; getbalancebyxpub) # curl (GET) http://192.168.111.152:8080/getbalancebyxpub/upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb From 60d9bb5b6d52c654835ad5afcd9541f53d827262 Mon Sep 17 00:00:00 2001 From: Francis Pouliot Date: Fri, 17 Jan 2020 11:21:45 -0500 Subject: [PATCH 3/6] Update requesthandler.sh --- proxy_docker/app/script/requesthandler.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy_docker/app/script/requesthandler.sh b/proxy_docker/app/script/requesthandler.sh index 182564e..948bf11 100644 --- a/proxy_docker/app/script/requesthandler.sh +++ b/proxy_docker/app/script/requesthandler.sh @@ -232,7 +232,7 @@ main() { response_to_client "${response}" ${?} break ;; - getbalance) + getbalances) # curl (GET) http://192.168.111.152:8080/getbalances response=$(getbalances) From a83a04360cf3ca028af6c00ca052fa85dcaad3d6 Mon Sep 17 00:00:00 2001 From: Francis Pouliot Date: Fri, 17 Jan 2020 11:31:33 -0500 Subject: [PATCH 4/6] Update api-sample.properties --- api_auth_docker/api-sample.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/api_auth_docker/api-sample.properties b/api_auth_docker/api-sample.properties index 4d59d81..083fce3 100644 --- a/api_auth_docker/api-sample.properties +++ b/api_auth_docker/api-sample.properties @@ -29,6 +29,7 @@ action_ln_decodebolt11=watcher # Spender can do what the watcher can do, plus: action_getbalance=spender +action_getbalances=spender action_getbalancebyxpub=spender action_getbalancebyxpublabel=spender action_getnewaddress=spender From f876ed87daf8e6b755938c02ca5cfa83bed40584 Mon Sep 17 00:00:00 2001 From: Francis Pouliot Date: Fri, 17 Jan 2020 11:33:00 -0500 Subject: [PATCH 5/6] Update api.properties --- cyphernodeconf_docker/templates/gatekeeper/api.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cyphernodeconf_docker/templates/gatekeeper/api.properties b/cyphernodeconf_docker/templates/gatekeeper/api.properties index f2f4739..fdbb2a6 100644 --- a/cyphernodeconf_docker/templates/gatekeeper/api.properties +++ b/cyphernodeconf_docker/templates/gatekeeper/api.properties @@ -33,6 +33,7 @@ action_ln_decodebolt11=watcher # Spender can do what the watcher can do, plus: action_getbalance=spender +action_getbalances=spender action_getbalancebyxpub=spender action_getbalancebyxpublabel=spender action_getnewaddress=spender @@ -57,4 +58,4 @@ action_ln_connectfund=spender action_conf=internal action_newblock=internal action_executecallbacks=internal -action_ots_backoffice=internal \ No newline at end of file +action_ots_backoffice=internal From 6b857cdeb483fff7912538e3d024e108fb135d95 Mon Sep 17 00:00:00 2001 From: Francis Pouliot Date: Fri, 17 Jan 2020 11:56:48 -0500 Subject: [PATCH 6/6] Update walletoperations.sh --- proxy_docker/app/script/walletoperations.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy_docker/app/script/walletoperations.sh b/proxy_docker/app/script/walletoperations.sh index 4427fa6..8cd9d7d 100644 --- a/proxy_docker/app/script/walletoperations.sh +++ b/proxy_docker/app/script/walletoperations.sh @@ -142,7 +142,7 @@ getbalances() { data="{\"balances\":${balances}}" else - trace "[getbalances] Coudn't get balances!" + trace "[getbalances] Couldn't get balances!" data="" fi