diff --git a/api_auth_docker/api-sample.properties b/api_auth_docker/api-sample.properties index 8fce8fc..95e3596 100644 --- a/api_auth_docker/api-sample.properties +++ b/api_auth_docker/api-sample.properties @@ -30,6 +30,7 @@ action_ln_getconnectionstring=watcher action_ln_decodebolt11=watcher # Spender can do what the watcher can do, plus: +action_getxnslist=spender action_getbalance=spender action_getbalancebyxpub=spender action_getbalancebyxpublabel=spender diff --git a/cyphernodeconf_docker/templates/gatekeeper/api.properties b/cyphernodeconf_docker/templates/gatekeeper/api.properties index f037851..335bae9 100644 --- a/cyphernodeconf_docker/templates/gatekeeper/api.properties +++ b/cyphernodeconf_docker/templates/gatekeeper/api.properties @@ -35,6 +35,7 @@ action_ln_getconnectionstring=watcher action_ln_decodebolt11=watcher # Spender can do what the watcher can do, plus: +action_gettxnslist=spender action_getbalance=spender action_getbalancebyxpub=spender action_getbalancebyxpublabel=spender diff --git a/proxy_docker/app/script/confirmation.sh b/proxy_docker/app/script/confirmation.sh index d0dd606..e2d8c54 100644 --- a/proxy_docker/app/script/confirmation.sh +++ b/proxy_docker/app/script/confirmation.sh @@ -31,7 +31,7 @@ confirmation() { local txid=${1} local tx_details # We need make sure to discard error results generated by get_transction tryin to find a watching wallet's `txn in - # spender wallet first,return code will tell if there's an actaul error. FIXME Add issue here + # spender wallet first,return code will tell if there's an actaul error. See #153 tx_details=$(get_transaction ${txid} | jq '. | select(.result != null)') returncode=$? trace_rc ${returncode} diff --git a/proxy_docker/app/script/requesthandler.sh b/proxy_docker/app/script/requesthandler.sh index 3b4ad20..25bf3bb 100644 --- a/proxy_docker/app/script/requesthandler.sh +++ b/proxy_docker/app/script/requesthandler.sh @@ -238,6 +238,13 @@ main() { response_to_client "${response}" ${?} break ;; + gettxnslist) + # curl (GET) http://192.168.111.152:8080/gettxnslist/20/10 + + response=$(gettxnslist $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3) $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4)) + response_to_client "${response}" ${?} + break + ;; getbalance) # curl (GET) http://192.168.111.152:8080/getbalance diff --git a/proxy_docker/app/script/walletoperations.sh b/proxy_docker/app/script/walletoperations.sh index 0fd45be..27a7711 100644 --- a/proxy_docker/app/script/walletoperations.sh +++ b/proxy_docker/app/script/walletoperations.sh @@ -123,6 +123,32 @@ bumpfee() { return ${returncode} } +gettxnslist() { + trace "Entering gettxnslist()... with count: $1 , skip: $2" + local count="$1" + local skip="$2" + local response + local data="{\"method\":\"listtransactions\",\"params\":[\"*\",${count:-10},${skip:-0}]}" + response=$(send_to_spender_node "${data}") + local returncode=$? + trace_rc ${returncode} + trace "[gettxnlist] response=${response}" + + if [ "${returncode}" -eq 0 ]; then + local txns=$(echo ${response} | jq -rc ".result") + trace "[gettxnlist] txns=${txns}" + + data="{\"txns\":${txns}}" + else + trace "[gettxnlist] Coudn't get txns!" + data="" + fi + + trace "[gettransactions] responding=${data}" + echo "${data}" + + return ${returncode} +} getbalance() { trace "Entering getbalance()..."