mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-18 05:05:12 +01:00
Doc eventMessage on spend, eventMessage name in JSON instead of event_message
This commit is contained in:
@@ -9,7 +9,7 @@ Inserts the address and callbacks in the DB and imports the address to the Watch
|
||||
```http
|
||||
POST http://cyphernode:8888/watch
|
||||
with body...
|
||||
{"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","unconfirmedCallbackURL":"192.168.111.233:1111/callback0conf","confirmedCallbackURL":"192.168.111.233:1111/callback1conf","eventMessage":"eyJib3VuY2VfYWRkcmVzcyI6InRiMXE2czBwcHdrMm1zZGV3YWwzbXU5MGFoZmhweWVwYXdudzZ3ZGs4dCIsIm5iX2NvbmYiOjZ9Cg=="}
|
||||
{"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","unconfirmedCallbackURL":"192.168.111.233:1111/callback0conf","confirmedCallbackURL":"192.168.111.233:1111/callback1conf","eventMessage":"eyJib3VuY2VfYWRkcmVzcyI6IjJNdkEzeHIzOHIxNXRRZWhGblBKMVhBdXJDUFR2ZTZOamNGIiwibmJfY29uZiI6MH0K"}
|
||||
```
|
||||
|
||||
Proxy response:
|
||||
@@ -27,7 +27,7 @@ Proxy response:
|
||||
"estimatesmartfee6blocks": "0.000010",
|
||||
"estimatesmartfee36blocks": "0.000010",
|
||||
"estimatesmartfee144blocks": "0.000010",
|
||||
"eventMessage": "eyJib3VuY2VfYWRkcmVzcyI6InRiMXE2czBwcHdrMm1zZGV3YWwzbXU5MGFoZmhweWVwYXdudzZ3ZGs4dCIsIm5iX2NvbmYiOjZ9Cg=="
|
||||
"eventMessage": "eyJib3VuY2VfYWRkcmVzcyI6IjJNdkEzeHIzOHIxNXRRZWhGblBKMVhBdXJDUFR2ZTZOamNGIiwibmJfY29uZiI6MH0K"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -68,7 +68,7 @@ Proxy response:
|
||||
"unconfirmedCallbackURL":"192.168.133.233:1111/callback0conf",
|
||||
"confirmedCallbackURL":"192.168.133.233:1111/callback1conf",
|
||||
"watching_since":"2018-09-06 21:14:03",
|
||||
"eventMessage":"eyJib3VuY2VfYWRkcmVzcyI6InRiMXE2czBwcHdrMm1zZGV3YWwzbXU5MGFoZmhweWVwYXdudzZ3ZGs4dCIsIm5iX2NvbmYiOjZ9Cg=="}
|
||||
"eventMessage":"eyJib3VuY2VfYWRkcmVzcyI6IjJNdkEzeHIzOHIxNXRRZWhGblBKMVhBdXJDUFR2ZTZOamNGIiwibmJfY29uZiI6MH0K"}
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -621,12 +621,14 @@ Proxy response:
|
||||
|
||||
### Spend coins from spending wallet (called by application)
|
||||
|
||||
Calls sendtoaddress RPC on the spending wallet with supplied info.
|
||||
Calls sendtoaddress RPC on the spending wallet with supplied info. Can supply an eventMessage to be published on successful spending. eventMessage should be base64 encoded to avoid dealing with escaping special characters.
|
||||
|
||||
```http
|
||||
POST http://cyphernode:8888/spend
|
||||
with body...
|
||||
{"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233}
|
||||
or
|
||||
{"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233,"eventMessage":"eyJib3VuY2VfYWRkcmVzcyI6IjJNdkEzeHIzOHIxNXRRZWhGblBKMVhBdXJDUFR2ZTZOamNGIiwibmJfY29uZiI6MH0K"}
|
||||
```
|
||||
|
||||
Proxy response:
|
||||
|
||||
@@ -797,6 +797,9 @@ paths:
|
||||
$ref: '#/components/schemas/TypeAddressString'
|
||||
amount:
|
||||
type: "number"
|
||||
eventMessage:
|
||||
description: "Will be part of the published message on spend"
|
||||
type: "string"
|
||||
responses:
|
||||
'200':
|
||||
description: "operation successful"
|
||||
|
||||
@@ -237,7 +237,7 @@ build_callback() {
|
||||
derivation_path=$(echo -e $derivation_path | sed -En "s/n/${pub32_index}/p")
|
||||
data="${data}\"pub32_derivation_path\":\"${derivation_path}\","
|
||||
fi
|
||||
data="${data}\"event_message\":\"${event_message}\"}"
|
||||
data="${data}\"eventMessage\":\"${event_message}\"}"
|
||||
trace "[build_callback] data=${data}"
|
||||
|
||||
curl_callback "${url}" "${data}"
|
||||
|
||||
@@ -185,8 +185,8 @@ confirmation() {
|
||||
if [ -n "${event_message}" ]; then
|
||||
# There's an event message, let's publish it!
|
||||
|
||||
trace "[confirmation] mosquitto_pub -h broker -t tx_confirmation -m \"{\"txid\":\"${txid}\",\"address\":\"${address}\",\"vout_n\":${tx_vout_n},\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}\""
|
||||
response=$(mosquitto_pub -h broker -t tx_confirmation -m "{\"txid\":\"${txid}\",\"address\":\"${address}\",\"vout_n\":${tx_vout_n},\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}")
|
||||
trace "[confirmation] mosquitto_pub -h broker -t tx_confirmation -m \"{\"txid\":\"${txid}\",\"address\":\"${address}\",\"vout_n\":${tx_vout_n},\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"eventMessage\":\"${event_message}\"}\""
|
||||
response=$(mosquitto_pub -h broker -t tx_confirmation -m "{\"txid\":\"${txid}\",\"address\":\"${address}\",\"vout_n\":${tx_vout_n},\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"eventMessage\":\"${event_message}\"}")
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
fi
|
||||
|
||||
@@ -54,8 +54,8 @@ spend() {
|
||||
else
|
||||
# There's an event message, let's publish it!
|
||||
|
||||
trace "[spend] mosquitto_pub -h broker -t spend -m \"{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_amount},\"event_message\":\"${event_message}\"}\""
|
||||
response=$(mosquitto_pub -h broker -t spend -m "{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_amount},\"event_message\":\"${event_message}\"}")
|
||||
trace "[spend] mosquitto_pub -h broker -t spend -m \"{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_amount},\"eventMessage\":\"${event_message}\"}\""
|
||||
response=$(mosquitto_pub -h broker -t spend -m "{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_amount},\"eventMessage\":\"${event_message}\"}")
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
fi
|
||||
|
||||
@@ -83,7 +83,7 @@ watchrequest() {
|
||||
\"estimatesmartfee6blocks\":\"${fees6blocks}\",
|
||||
\"estimatesmartfee36blocks\":\"${fees36blocks}\",
|
||||
\"estimatesmartfee144blocks\":\"${fees144blocks}\",
|
||||
\"event_message\":\"${event_message}\"}"
|
||||
\"eventMessage\":\"${event_message}\"}"
|
||||
trace "[watchrequest] responding=${data}"
|
||||
|
||||
echo "${data}"
|
||||
|
||||
Reference in New Issue
Block a user