mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-02-10 06:44:38 +01:00
Migrated to postgres and added pub32 tests
This commit is contained in:
@@ -76,8 +76,10 @@ main() {
|
||||
case "${cmd}" in
|
||||
helloworld)
|
||||
# GET http://192.168.111.152:8080/helloworld
|
||||
response_to_client "Hello, world!" 0
|
||||
break
|
||||
response="Hello, world!"
|
||||
returncode=0
|
||||
# response_to_client "Hello, world!" 0
|
||||
# break
|
||||
;;
|
||||
installation_info)
|
||||
# GET http://192.168.111.152:8080/info
|
||||
@@ -86,8 +88,7 @@ main() {
|
||||
else
|
||||
response='{ "error": "missing installation data" }'
|
||||
fi
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
watch)
|
||||
# POST http://192.168.111.152:8080/watch
|
||||
@@ -96,8 +97,7 @@ main() {
|
||||
# BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","confirmedCallbackURL":"192.168.111.233:1111/callback1conf","eventMessage":"eyJib3VuY2VfYWRkcmVzcyI6IjJNdkEzeHIzOHIxNXRRZWhGblBKMVhBdXJDUFR2ZTZOamNGIiwibmJfY29uZiI6MH0K","label":"myLabel"}
|
||||
|
||||
response=$(watchrequest "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
unwatch)
|
||||
# curl (GET) 192.168.111.152:8080/unwatch/2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp
|
||||
@@ -122,16 +122,15 @@ main() {
|
||||
# Let's make it work even for a GET request (equivalent to a POST with empty json object body)
|
||||
if [ "$http_method" = "POST" ]; then
|
||||
address=$(echo "${line}" | jq -r ".address")
|
||||
unconfirmedCallbackURL=$(echo "${line}" | jq ".unconfirmedCallbackURL")
|
||||
confirmedCallbackURL=$(echo "${line}" | jq ".confirmedCallbackURL")
|
||||
unconfirmedCallbackURL=$(echo "${line}" | jq -r ".unconfirmedCallbackURL")
|
||||
confirmedCallbackURL=$(echo "${line}" | jq -r ".confirmedCallbackURL")
|
||||
watchid=$(echo "${line}" | jq ".id")
|
||||
else
|
||||
address=$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)
|
||||
fi
|
||||
|
||||
response=$(unwatchrequest "${watchid}" "${address}" "${unconfirmedCallbackURL}" "${confirmedCallbackURL}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
watchxpub)
|
||||
# POST http://192.168.111.152:8080/watchxpub
|
||||
@@ -139,43 +138,37 @@ main() {
|
||||
# curl -H "Content-Type: application/json" -d '{"label":"2219","pub32":"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb","path":"0/1/n","nstart":55,"unconfirmedCallbackURL":"192.168.111.233:1111/callback0conf","confirmedCallbackURL":"192.168.111.233:1111/callback1conf"}' proxy:8888/watchxpub
|
||||
|
||||
response=$(watchpub32request "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
unwatchxpubbyxpub)
|
||||
# GET http://192.168.111.152:8080/unwatchxpubbyxpub/tpubD6NzVbkrYhZ4YR3QK2tyfMMvBghAvqtNaNK1LTyDWcRHLcMUm3ZN2cGm5BS3MhCRCeCkXQkTXXjiJgqxpqXK7PeUSp86DTTgkLpcjMtpKWk
|
||||
|
||||
response=$(unwatchpub32request "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
unwatchxpubbylabel)
|
||||
# GET http://192.168.111.152:8080/unwatchxpubbylabel/4421
|
||||
|
||||
response=$(unwatchpub32labelrequest "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getactivewatchesbyxpub)
|
||||
# GET http://192.168.111.152:8080/getactivewatchesbyxpub/tpubD6NzVbkrYhZ4YR3QK2tyfMMvBghAvqtNaNK1LTyDWcRHLcMUm3ZN2cGm5BS3MhCRCeCkXQkTXXjiJgqxpqXK7PeUSp86DTTgkLpcjMtpKWk
|
||||
|
||||
response=$(getactivewatchesbyxpub "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getactivewatchesbylabel)
|
||||
# GET http://192.168.111.152:8080/getactivewatchesbylabel/4421
|
||||
|
||||
response=$(getactivewatchesbylabel "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getactivexpubwatches)
|
||||
# GET http://192.168.111.152:8080/getactivexpubwatches
|
||||
|
||||
response=$(getactivexpubwatches)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
watchtxid)
|
||||
# POST http://192.168.111.152:8080/watchtxid
|
||||
@@ -183,8 +176,7 @@ main() {
|
||||
# curl -H "Content-Type: application/json" -d '{"txid":"b081ca7724386f549cf0c16f71db6affeb52ff7a0d9b606fb2e5c43faffd3387","confirmedCallbackURL":"192.168.111.233:1111/callback1conf","xconfCallbackURL":"192.168.111.233:1111/callbackXconf","nbxconf":6}' proxy:8888/watchtxid
|
||||
|
||||
response=$(watchtxidrequest "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
unwatchtxid)
|
||||
# POST http://192.168.111.152:8080/unwatchtxid
|
||||
@@ -200,87 +192,76 @@ main() {
|
||||
# - id: the id returned by watchtxid
|
||||
|
||||
local txid=$(echo "${line}" | jq -r ".txid")
|
||||
local unconfirmedCallbackURL=$(echo "${line}" | jq ".unconfirmedCallbackURL")
|
||||
local confirmedCallbackURL=$(echo "${line}" | jq ".confirmedCallbackURL")
|
||||
local unconfirmedCallbackURL=$(echo "${line}" | jq -r ".unconfirmedCallbackURL")
|
||||
local confirmedCallbackURL=$(echo "${line}" | jq -r ".confirmedCallbackURL")
|
||||
local watchid=$(echo "${line}" | jq ".id")
|
||||
|
||||
response=$(unwatchtxidrequest "${watchid}" "${txid}" "${unconfirmedCallbackURL}" "${confirmedCallbackURL}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getactivewatches)
|
||||
# curl (GET) 192.168.111.152:8080/getactivewatches
|
||||
|
||||
response=$(getactivewatches)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
get_txns_by_watchlabel)
|
||||
# curl (GET) 192.168.111.152:8080/get_txns_by_watchlabel/<label>/<count>
|
||||
response=$(get_txns_by_watchlabel "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)" "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
get_unused_addresses_by_watchlabel)
|
||||
# curl (GET) 192.168.111.152:8080/get_unused_addresses_by_watchlabel/<label>/<count>
|
||||
response=$(get_unused_addresses_by_watchlabel "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)" "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
conf)
|
||||
# curl (GET) 192.168.111.152:8080/conf/b081ca7724386f549cf0c16f71db6affeb52ff7a0d9b606fb2e5c43faffd3387
|
||||
|
||||
response=$(confirmation_request "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
newblock)
|
||||
# curl (GET) 192.168.111.152:8080/newblock/000000000000005c987120f3b6f995c95749977ef1a109c89aa74ce4bba97c1f
|
||||
|
||||
response=$(newblock "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbestblockhash)
|
||||
# curl (GET) http://192.168.111.152:8080/getbestblockhash
|
||||
|
||||
response=$(get_best_block_hash)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getblockhash)
|
||||
# curl (GET) http://192.168.111.152:8080/getblockhash/522322
|
||||
|
||||
response=$(get_blockhash "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getblockinfo)
|
||||
# curl (GET) http://192.168.111.152:8080/getblockinfo/000000006f82a384c208ecfa04d05beea02d420f3f398ddda5c7f900de5718ea
|
||||
|
||||
response=$(get_block_info "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getblockchaininfo)
|
||||
# http://192.168.111.152:8080/getblockchaininfo
|
||||
|
||||
response=$(get_blockchain_info)
|
||||
response_to_client "${response}" ${?}
|
||||
returncode=$?
|
||||
;;
|
||||
gettransaction)
|
||||
# curl (GET) http://192.168.111.152:8080/gettransaction/af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648
|
||||
|
||||
response=$(get_rawtransaction "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbestblockinfo)
|
||||
# curl (GET) http://192.168.111.152:8080/getbestblockinfo
|
||||
|
||||
response=$(get_best_block_info)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
executecallbacks)
|
||||
# curl (GET) http://192.168.111.152:8080/executecallbacks
|
||||
@@ -288,43 +269,37 @@ main() {
|
||||
manage_not_imported
|
||||
manage_missed_conf
|
||||
response=$(do_callbacks)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
get_txns_spending)
|
||||
# curl (GET) http://192.168.111.152:8080/get_txns_spending/20/10
|
||||
|
||||
response=$(get_txns_spending "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)" "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbalance)
|
||||
# curl (GET) http://192.168.111.152:8080/getbalance
|
||||
|
||||
response=$(getbalance)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbalances)
|
||||
# curl (GET) http://192.168.111.152:8080/getbalances
|
||||
|
||||
response=$(getbalances)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbalancebyxpub)
|
||||
# curl (GET) http://192.168.111.152:8080/getbalancebyxpub/upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb
|
||||
|
||||
response=$(getbalancebyxpub "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbalancebyxpublabel)
|
||||
# curl (GET) http://192.168.111.152:8080/getbalancebyxpublabel/2219
|
||||
|
||||
response=$(getbalancebyxpublabel "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getnewaddress)
|
||||
# curl (GET) http://192.168.111.152:8080/getnewaddress
|
||||
@@ -346,8 +321,7 @@ main() {
|
||||
fi
|
||||
|
||||
response=$(getnewaddress "${address_type}" "${label}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
validateaddress)
|
||||
# GET http://192.168.111.152:8080/validateaddress/tb1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxqp3mvzv
|
||||
@@ -361,8 +335,7 @@ main() {
|
||||
# BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233,"eventMessage":"eyJ3aGF0ZXZlciI6MTIzfQo=","confTarget":6,"replaceable":true,"subtractfeefromamount":false}
|
||||
|
||||
response=$(spend "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
bumpfee)
|
||||
# POST http://192.168.111.152:8080/bumpfee
|
||||
@@ -370,8 +343,7 @@ main() {
|
||||
# BODY {"txid":"af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648"}
|
||||
|
||||
response=$(bumpfee "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
createbatcher)
|
||||
# POST http://192.168.111.152:8080/createbatcher
|
||||
@@ -388,8 +360,7 @@ main() {
|
||||
# NOTYET BODY {"batcherLabel":"highfees","feeRate":231.8}
|
||||
|
||||
response=$(createbatcher "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
updatebatcher)
|
||||
# POST http://192.168.111.152:8080/updatebatcher
|
||||
@@ -412,8 +383,7 @@ main() {
|
||||
# BODY {"batcherLabel":"fast","confTarget":2}
|
||||
|
||||
response=$(updatebatcher "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
addtobatch)
|
||||
# POST http://192.168.111.152:8080/addtobatch
|
||||
@@ -439,8 +409,7 @@ main() {
|
||||
# BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233,"batcherId":34,"webhookUrl":"https://myCypherApp:3000/batchExecuted"}
|
||||
|
||||
response=$(addtobatch "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
removefrombatch)
|
||||
# POST http://192.168.111.152:8080/removefrombatch
|
||||
@@ -458,8 +427,7 @@ main() {
|
||||
# BODY {"outputId":72}
|
||||
|
||||
response=$(removefrombatch "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
batchspend)
|
||||
# POST http://192.168.111.152:8080/batchspend
|
||||
@@ -511,8 +479,7 @@ main() {
|
||||
# BODY {"batcherId":411,"confTarget":6}
|
||||
|
||||
response=$(batchspend "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbatcher)
|
||||
# POST (GET) http://192.168.111.152:8080/getbatcher
|
||||
@@ -528,14 +495,13 @@ main() {
|
||||
# BODY {"batcherId":34}
|
||||
|
||||
response=$(getbatcher "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getbatchdetails)
|
||||
# POST (GET) http://192.168.111.152:8080/getbatchdetails
|
||||
#
|
||||
# args:
|
||||
# - batcherId, optional, id of the batcher, overrides batcherLabel, default batcher will be spent if not supplied
|
||||
# - batcherId, optional, id of the batcher, overrides batcherLabel, default batcher will be used if not supplied
|
||||
# - batcherLabel, optional, label of the batcher, default batcher will be used if not supplied
|
||||
# - txid, optional, if you want the details of an executed batch, supply the batch txid, will return current pending batch
|
||||
# if not supplied
|
||||
@@ -570,8 +536,7 @@ main() {
|
||||
# BODY {"batcherId":34}
|
||||
|
||||
response=$(getbatchdetails "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
listbatchers)
|
||||
# curl (GET) http://192.168.111.152:8080/listbatchers
|
||||
@@ -585,24 +550,21 @@ main() {
|
||||
# "error":null}
|
||||
|
||||
response=$(listbatchers)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
bitcoin_estimatesmartfee)
|
||||
# POST http://192.168.111.152:8080/bitcoin_estimatesmartfee
|
||||
# BODY {"confTarget":2}
|
||||
|
||||
response=$(bitcoin_estimatesmartfee "$(echo "${line}" | jq -r ".confTarget")")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
deriveindex)
|
||||
# curl GET http://192.168.111.152:8080/deriveindex/25-30
|
||||
# curl GET http://192.168.111.152:8080/deriveindex/34
|
||||
|
||||
response=$(deriveindex "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
derivepubpath)
|
||||
# POST http://192.168.111.152:8080/derivepubpath
|
||||
@@ -611,16 +573,14 @@ main() {
|
||||
# BODY {"pub32":"vpub5SLqN2bLY4WeZF3kL4VqiWF1itbf3A6oRrq9aPf16AZMVWYCuN9TxpAZwCzVgW94TNzZPNc9XAHD4As6pdnExBtCDGYRmNJrcJ4eV9hNqcv","path":"0/25-30"}
|
||||
|
||||
response=$(derivepubpath "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
deriveindex_bitcoind)
|
||||
# curl GET http://192.168.111.152:8080/deriveindex_bitcoind/25-30
|
||||
# curl GET http://192.168.111.152:8080/deriveindex_bitcoind/34
|
||||
|
||||
response=$(deriveindex_bitcoind "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
derivepubpath_bitcoind)
|
||||
# POST http://192.168.111.152:8080/derivepubpath_bitcoind
|
||||
@@ -629,45 +589,39 @@ main() {
|
||||
# BODY {"pub32":"vpub5SLqN2bLY4WeZF3kL4VqiWF1itbf3A6oRrq9aPf16AZMVWYCuN9TxpAZwCzVgW94TNzZPNc9XAHD4As6pdnExBtCDGYRmNJrcJ4eV9hNqcv","path":"0/25-30"}
|
||||
|
||||
response=$(derivepubpath_bitcoind "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
getmempoolinfo)
|
||||
# curl GET http://192.168.111.152:8080/getmempoolinfo
|
||||
|
||||
response=$(get_mempool_info)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_getinfo)
|
||||
# GET http://192.168.111.152:8080/ln_getinfo
|
||||
|
||||
response=$(ln_getinfo)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_getconnectionstring)
|
||||
# GET http://192.168.111.152:8080/ln_getconnectionstring
|
||||
|
||||
response=$(ln_get_connection_string)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_create_invoice)
|
||||
# POST http://192.168.111.152:8080/ln_create_invoice
|
||||
# BODY {"msatoshi":"10000","label":"koNCcrSvhX3dmyFhW","description":"Bylls order #10649","expiry":"900","callback_url":"http://192.168.122.159"}
|
||||
|
||||
response=$(ln_create_invoice "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_pay)
|
||||
# POST http://192.168.111.152:8080/ln_pay
|
||||
# BODY {"bolt11":"lntb1pdca82tpp5gv8mn5jqlj6xztpnt4r472zcyrwf3y2c3cvm4uzg2gqcnj90f83qdp2gf5hgcm0d9hzqnm4w3kx2apqdaexgetjyq3nwvpcxgcqp2g3d86wwdfvyxcz7kce7d3n26d2rw3wf5tzpm2m5fl2z3mm8msa3xk8nv2y32gmzlhwjved980mcmkgq83u9wafq9n4w28amnmwzujgqpmapcr3","expected_msatoshi":"10000","expected_description":"Bitcoin Outlet order #7082"}
|
||||
|
||||
response=$(ln_pay "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_listpays)
|
||||
# GET http://192.168.111.152:8080/ln_listpays
|
||||
@@ -683,8 +637,7 @@ main() {
|
||||
fi
|
||||
|
||||
response=$(ln_listpays "${bolt11}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_paystatus)
|
||||
# GET http://192.168.111.152:8080/ln_paystatus
|
||||
@@ -700,15 +653,13 @@ main() {
|
||||
fi
|
||||
|
||||
response=$(ln_paystatus "${bolt11}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_newaddr)
|
||||
# GET http://192.168.111.152:8080/ln_newaddr
|
||||
|
||||
response=$(ln_newaddr)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_connectfund)
|
||||
# POST http://192.168.111.152:8080/ln_connectfund
|
||||
@@ -716,64 +667,50 @@ main() {
|
||||
# curl -H "Content-Type: application/json" -d '{"peer":"nodeId@ip:port","msatoshi":"100000","callbackUrl":"https://callbackUrl/?channelReady=f3y2c3cvm4uzg2gq"}' proxy:8888/ln_connectfund
|
||||
|
||||
response=$(ln_connectfund "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_getinvoice)
|
||||
# GET http://192.168.111.152:8080/ln_getinvoice/label
|
||||
# GET http://192.168.111.152:8080/ln_getinvoice/koNCcrSvhX3dmyFhW
|
||||
|
||||
response=$(ln_getinvoice "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_delinvoice)
|
||||
# GET http://192.168.111.152:8080/ln_delinvoice/label
|
||||
# GET http://192.168.111.152:8080/ln_delinvoice/koNCcrSvhX3dmyFhW
|
||||
|
||||
response=$(ln_delinvoice "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_decodebolt11)
|
||||
# GET http://192.168.111.152:8080/ln_decodebolt11/bolt11
|
||||
# GET http://192.168.111.152:8080/ln_decodebolt11/lntb1pdca82tpp5gv8mn5jqlj6xztpnt4r472zcyrwf3y2c3cvm4uzg2gqcnj90f83qdp2gf5hgcm0d9hzqnm4w3kx2apqdaexgetjyq3nwvpcxgcqp2g3d86wwdfvyxcz7kce7d3n26d2rw3wf5tzpm2m5fl2z3mm8msa3xk8nv2y32gmzlhwjved980mcmkgq83u9wafq9n4w28amnmwzujgqpmapcr3
|
||||
|
||||
response=$(ln_decodebolt11 "$(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_listpeers)
|
||||
# GET http://192.168.111.152:8080/ln_listpeers
|
||||
|
||||
response=$(ln_listpeers)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_listfunds)
|
||||
# GET http://192.168.111.152:8080/ln_listfunds
|
||||
response=$(ln_listfunds)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
# ln_listpays)
|
||||
# # GET http://192.168.111.152:8080/ln_listpays
|
||||
# response=$(ln_listpays)
|
||||
# response_to_client "${response}" ${?}
|
||||
# break
|
||||
# ;;
|
||||
ln_getroute)
|
||||
# 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_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ln_withdraw)
|
||||
# POST http://192.168.111.152:8080/ln_withdraw
|
||||
# BODY {"destination":"segwitAddress","satoshi":"100000","feerate":0,all: false}
|
||||
response=$(ln_withdraw "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ots_stamp)
|
||||
# POST http://192.168.111.152:8080/ots_stamp
|
||||
@@ -782,15 +719,13 @@ main() {
|
||||
# curl -v -d "{\"hash\":\"a6ea81a46fec3d02d40815b8667b388351edecedc1cc9f97aab55b566db7aac8\"}" localhost:8888/ots_stamp
|
||||
|
||||
response=$(serve_ots_stamp "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ots_backoffice)
|
||||
# curl (GET) http://192.168.111.152:8080/ots_upgradeandcallback
|
||||
|
||||
response=$(serve_ots_backoffice)
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ots_getfile)
|
||||
# curl (GET) http://192.168.111.152:8080/ots_getfile/1ddfb769eb0b8876bc570e25580e6a53afcf973362ee1ee4b54a807da2e5eed7
|
||||
@@ -807,8 +742,7 @@ main() {
|
||||
# curl -v -d "{\"hash\":\"a6ea81a46fec3d02d40815b8667b388351edecedc1cc9f97aab55b566db7aac8\",\"base64otsfile\":\"$(cat a6ea81a46fec3d02d40815b8667b388351edecedc1cc9f97aab55b566db7aac8.ots | base64 | tr -d '\n')\"}" localhost:8888/ots_verify
|
||||
|
||||
response=$(serve_ots_verify "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
ots_info)
|
||||
# POST http://192.168.111.152:8080/ots_info
|
||||
@@ -821,10 +755,15 @@ main() {
|
||||
# curl -v -d "{\"hash\":\"a6ea81a46fec3d02d40815b8667b388351edecedc1cc9f97aab55b566db7aac8\",\"base64otsfile\":\"$(cat a6ea81a46fec3d02d40815b8667b388351edecedc1cc9f97aab55b566db7aac8.ots | base64 | tr -d '\n')\"}" localhost:8888/ots_info
|
||||
|
||||
response=$(serve_ots_info "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
returncode=$?
|
||||
;;
|
||||
*)
|
||||
response='{"error": {"code": -32601, "message": "Method not found"}, "id": "1"}'
|
||||
returncode=1
|
||||
;;
|
||||
esac
|
||||
response=$(echo "${response}" | jq -Mc)
|
||||
response_to_client "${response}" ${returncode}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user