mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-18 21:25:06 +01:00
Make ln_listpays take opt. bolt11 arg
This commit is contained in:
@@ -462,6 +462,23 @@ ln_pay() {
|
|||||||
return ${returncode}
|
return ${returncode}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ln_listpays() {
|
||||||
|
trace "Entering ln_listpays()..."
|
||||||
|
|
||||||
|
local result
|
||||||
|
local bolt11=${1}
|
||||||
|
trace "[ln_listpays] bolt11=${bolt11}"
|
||||||
|
|
||||||
|
result=$(./lightning-cli listpays ${bolt11})
|
||||||
|
returncode=$?
|
||||||
|
trace_rc ${returncode}
|
||||||
|
trace "[ln_listpays] result=${result}"
|
||||||
|
|
||||||
|
echo "${result}"
|
||||||
|
|
||||||
|
return ${returncode}
|
||||||
|
}
|
||||||
|
|
||||||
ln_newaddr() {
|
ln_newaddr() {
|
||||||
trace "Entering ln_newaddr()..."
|
trace "Entering ln_newaddr()..."
|
||||||
|
|
||||||
@@ -498,16 +515,6 @@ ln_listfunds() {
|
|||||||
echo "${result}"
|
echo "${result}"
|
||||||
return ${returncode}
|
return ${returncode}
|
||||||
}
|
}
|
||||||
ln_listpays() {
|
|
||||||
trace "Entering ln_listpays()..."
|
|
||||||
local result
|
|
||||||
result=$(./lightning-cli listpays)
|
|
||||||
returncode=$?
|
|
||||||
trace_rc ${returncode}
|
|
||||||
trace "[ln_listpays] result=${result}"
|
|
||||||
echo "${result}"
|
|
||||||
return ${returncode}
|
|
||||||
}
|
|
||||||
ln_getroute() {
|
ln_getroute() {
|
||||||
trace "Entering ln_getroute()..."
|
trace "Entering ln_getroute()..."
|
||||||
# Defaults used from c-lightning documentation
|
# Defaults used from c-lightning documentation
|
||||||
|
|||||||
@@ -644,6 +644,23 @@ main() {
|
|||||||
response_to_client "${response}" ${?}
|
response_to_client "${response}" ${?}
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
ln_listpays)
|
||||||
|
# GET http://192.168.111.152:8080/ln_listpays
|
||||||
|
# POST http://192.168.111.152:8080/ln_listpays
|
||||||
|
# BODY {"bolt11":"lntb1pdca82tpp5gv8mn5jqlj6xztpnt4r472zcyrwf3y2c3cvm4uzg2gqcnj90f83qdp2gf5hgcm0d9hzqnm4w3kx2apqdaexgetjyq3nwvpcxgcqp2g3d86wwdfvyxcz7kce7d3n26d2rw3wf5tzpm2m5fl2z3mm8msa3xk8nv2y32gmzlhwjved980mcmkgq83u9wafq9n4w28amnmwzujgqpmapcr3"}
|
||||||
|
# BODY {}
|
||||||
|
|
||||||
|
# Let's make it work even for a GET request (equivalent to a POST with empty json object body)
|
||||||
|
if [ "$http_method" = "POST" ]; then
|
||||||
|
bolt11=$(echo "${line}" | jq -r ".bolt11 // empty")
|
||||||
|
else
|
||||||
|
bolt11=
|
||||||
|
fi
|
||||||
|
|
||||||
|
response=$(ln_listpays "${bolt11}")
|
||||||
|
response_to_client "${response}" ${?}
|
||||||
|
break
|
||||||
|
;;
|
||||||
ln_newaddr)
|
ln_newaddr)
|
||||||
# GET http://192.168.111.152:8080/ln_newaddr
|
# GET http://192.168.111.152:8080/ln_newaddr
|
||||||
|
|
||||||
@@ -697,12 +714,12 @@ main() {
|
|||||||
response_to_client "${response}" ${?}
|
response_to_client "${response}" ${?}
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
ln_listpays)
|
# ln_listpays)
|
||||||
# GET http://192.168.111.152:8080/ln_listpays
|
# # GET http://192.168.111.152:8080/ln_listpays
|
||||||
response=$(ln_listpays)
|
# response=$(ln_listpays)
|
||||||
response_to_client "${response}" ${?}
|
# response_to_client "${response}" ${?}
|
||||||
break
|
# break
|
||||||
;;
|
# ;;
|
||||||
ln_getroute)
|
ln_getroute)
|
||||||
# GET http://192.168.111.152:8080/ln_getroute/<node_id>/<msatoshi>/<riskfactor>
|
# GET http://192.168.111.152:8080/ln_getroute/<node_id>/<msatoshi>/<riskfactor>
|
||||||
response=$(ln_getroute "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)" "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4)" "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f5)")
|
response=$(ln_getroute "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)" "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4)" "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f5)")
|
||||||
|
|||||||
Reference in New Issue
Block a user