mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-26 09:05:13 +01:00
@@ -32,6 +32,7 @@ action_ln_decodebolt11=watcher
|
||||
# Spender can do what the watcher can do, plus:
|
||||
action_getxnslist=spender
|
||||
action_getbalance=spender
|
||||
action_getbalances=spender
|
||||
action_getbalancebyxpub=spender
|
||||
action_getbalancebyxpublabel=spender
|
||||
action_getnewaddress=spender
|
||||
|
||||
@@ -37,6 +37,7 @@ action_ln_decodebolt11=watcher
|
||||
# Spender can do what the watcher can do, plus:
|
||||
action_get_txns_spending=spender
|
||||
action_getbalance=spender
|
||||
action_getbalances=spender
|
||||
action_getbalancebyxpub=spender
|
||||
action_getbalancebyxpublabel=spender
|
||||
action_getnewaddress=spender
|
||||
|
||||
@@ -252,6 +252,13 @@ main() {
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
;;
|
||||
getbalances)
|
||||
# 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
|
||||
|
||||
|
||||
@@ -175,6 +175,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] Couldn't get balances!"
|
||||
data=""
|
||||
fi
|
||||
|
||||
trace "[getbalances] responding=${data}"
|
||||
echo "${data}"
|
||||
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
getbalancebyxpublabel() {
|
||||
trace "Entering getbalancebyxpublabel()..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user