mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-02-23 04:54:23 +01:00
Fixed labels in watches and added tests
This commit is contained in:
@@ -332,9 +332,9 @@ main() {
|
||||
#
|
||||
# or...
|
||||
# POST http://192.168.111.152:8080/getnewaddress
|
||||
# BODY {"address_type":"bech32","label":"myLabel"}
|
||||
# BODY {"addressType":"bech32","label":"myLabel"}
|
||||
# BODY {"label":"myLabel"}
|
||||
# BODY {"address_type":"p2sh-segwit"}
|
||||
# BODY {"addressType":"p2sh-segwit"}
|
||||
# BODY {}
|
||||
|
||||
# Let's make it work even for a GET request (equivalent to a POST with empty json object body)
|
||||
|
||||
@@ -275,19 +275,20 @@ getnewaddress() {
|
||||
|
||||
local response
|
||||
local jqop
|
||||
local addedfields
|
||||
local addedfieldstoresponse
|
||||
local data='{"method":"getnewaddress"}'
|
||||
if [ -n "${address_type}" ] || [ -n "${label}" ]; then
|
||||
jqop='. += {"params":{}}'
|
||||
if [ -n "${label}" ]; then
|
||||
jqop=${jqop}' | .params += {"label":"'${label}'"}'
|
||||
addedfields=' | . += {"label":"'${label}'"}'
|
||||
addedfieldstoresponse=' | . += {"label":"'${label}'"}'
|
||||
fi
|
||||
if [ -n "${address_type}" ]; then
|
||||
jqop=${jqop}' | .params += {"address_type":"'${address_type}'"}'
|
||||
addedfields=' | . += {"address_type":"'${address_type}'"}'
|
||||
jqop=${jqop}' | .params += {"addressType":"'${address_type}'"}'
|
||||
addedfieldstoresponse=' | . += {"addressType":"'${address_type}'"}'
|
||||
fi
|
||||
trace "[getnewaddress] jqop=${jqop}"
|
||||
trace "[getnewaddress] addedfieldstoresponse=${addedfieldstoresponse}"
|
||||
|
||||
data=$(echo "${data}" | jq -rc "${jqop}")
|
||||
fi
|
||||
@@ -304,7 +305,7 @@ getnewaddress() {
|
||||
|
||||
data='{"address":'${address}'}'
|
||||
if [ -n "${jqop}" ]; then
|
||||
data=$(echo "${data}" | jq -rc "${data}${addedfields}")
|
||||
data=$(echo "${data}" | jq -rc ".${addedfieldstoresponse}")
|
||||
trace "[getnewaddress] data=${data}"
|
||||
fi
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user