mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-29 10:35:21 +01:00
xpubwatch docs and more endpoints
This commit is contained in:
@@ -97,3 +97,35 @@ getactivewatchesxpub() {
|
||||
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
getactivexpubwatches() {
|
||||
trace "Entering getactivexpubwatches()..."
|
||||
|
||||
local watches
|
||||
# Let's build the string directly with sqlite instead of manipulating multiple strings afterwards, it's faster.
|
||||
# {"id":"${id}","pub32":"${pub32}","label":"${label}","derivation_path":"${derivation_path}","last_imported_n":${last_imported_n},"unconfirmedCallbackURL":"${cb0conf_url}","confirmedCallbackURL":"${cb1conf_url}","watching_since":"${timestamp}"}
|
||||
watches=$(sql "SELECT '{\"id\":\"' || id || '\",\"pub32\":\"' || pub32 || '\",\"label\":\"' || label || '\",\"derivation_path\":\"' || derivation_path || '\",\"last_imported_n\":' || last_imported_n || ',\"unconfirmedCallbackURL\":\"' || callback0conf || '\",\"confirmedCallbackURL\":\"' || callback1conf || '\",\"watching_since\":\"' || inserted_ts || '\"}' FROM watching_by_pub32 WHERE watching AND NOT calledback1conf")
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
local notfirst=false
|
||||
|
||||
echo -n "{\"watches\":["
|
||||
|
||||
local IFS=$'\n'
|
||||
for row in ${watches}
|
||||
do
|
||||
if ${notfirst}; then
|
||||
echo ","
|
||||
else
|
||||
notfirst=true
|
||||
fi
|
||||
trace "[getactivexpubwatches] row=${row}"
|
||||
|
||||
echo -n "${row}"
|
||||
done
|
||||
|
||||
echo "]}"
|
||||
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,13 @@ main()
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
;;
|
||||
getactivexpubwatches)
|
||||
# GET http://192.168.111.152:8080/getactivexpubwatches
|
||||
|
||||
response=$(getactivexpubwatches)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
;;
|
||||
getactivewatches)
|
||||
# curl (GET) 192.168.111.152:8080/getactivewatches
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ unwatchpub32labelrequest() {
|
||||
local returncode
|
||||
trace "[unwatchpub32labelrequest] Unwatch xpub label ${label}"
|
||||
|
||||
id=$(sql "SELECT id FROM watching WHERE label='${label}'")
|
||||
id=$(sql "SELECT id FROM watching_by_pub32 WHERE label='${label}'")
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
trace "[unwatchpub32labelrequest] id: ${id}"
|
||||
@@ -73,7 +73,7 @@ unwatchpub32labelrequest() {
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
data="{\"event\":\"unwatchxpubbylabel\",\"pub32\":\"${pub32}\"}"
|
||||
data="{\"event\":\"unwatchxpubbylabel\",\"label\":\"${label}\"}"
|
||||
trace "[unwatchpub32labelrequest] responding=${data}"
|
||||
|
||||
echo "${data}"
|
||||
|
||||
Reference in New Issue
Block a user