mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-18 21:25:06 +01:00
Added addresstype when calling getnewaddress.
This commit is contained in:
@@ -554,10 +554,13 @@ Proxy response:
|
|||||||
|
|
||||||
### Get a new Bitcoin address from spending wallet (called by application)
|
### Get a new Bitcoin address from spending wallet (called by application)
|
||||||
|
|
||||||
Calls getnewaddress RPC on the spending wallet. Used to refill the spending wallet from cold wallet (ie Trezor).
|
Calls getnewaddress RPC on the spending wallet. Used to refill the spending wallet from cold wallet (ie Trezor). Will derive the default address type (set in your bitcoin.conf file, p2sh-segwit if not specified) or you can supply the address type like the following examples.
|
||||||
|
|
||||||
```http
|
```http
|
||||||
GET http://cyphernode:8888/getnewaddress
|
GET http://cyphernode:8888/getnewaddress
|
||||||
|
GET http://cyphernode:8888/getnewaddress/bech32
|
||||||
|
GET http://cyphernode:8888/getnewaddress/legacy
|
||||||
|
GET http://cyphernode:8888/getnewaddress/p2sh-segwit
|
||||||
```
|
```
|
||||||
|
|
||||||
Proxy response:
|
Proxy response:
|
||||||
@@ -568,6 +571,12 @@ Proxy response:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"address":"tb1ql7yvh3lmajxmaljsnsu3w8lhwczu963tvjfzpj"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Spend coins from spending wallet (called by application)
|
### 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.
|
||||||
|
|||||||
@@ -227,8 +227,9 @@ main()
|
|||||||
;;
|
;;
|
||||||
getnewaddress)
|
getnewaddress)
|
||||||
# curl (GET) http://192.168.111.152:8080/getnewaddress
|
# curl (GET) http://192.168.111.152:8080/getnewaddress
|
||||||
|
# curl (GET) http://192.168.111.152:8080/getnewaddress/bech32
|
||||||
|
|
||||||
response=$(getnewaddress)
|
response=$(getnewaddress $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3))
|
||||||
response_to_client "${response}" ${?}
|
response_to_client "${response}" ${?}
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -127,8 +127,16 @@ getbalancebyxpub() {
|
|||||||
getnewaddress() {
|
getnewaddress() {
|
||||||
trace "Entering getnewaddress()..."
|
trace "Entering getnewaddress()..."
|
||||||
|
|
||||||
|
local address_type=${1}
|
||||||
|
trace "[getnewaddress] address_type=${address_type}"
|
||||||
|
|
||||||
local response
|
local response
|
||||||
local data='{"method":"getnewaddress"}'
|
local data
|
||||||
|
if [ -z "${address_type}" ]; then
|
||||||
|
data='{"method":"getnewaddress"}'
|
||||||
|
else
|
||||||
|
data="{\"method\":\"getnewaddress\",\"params\":[\"\",\"${address_type}\"]}"
|
||||||
|
fi
|
||||||
response=$(send_to_spender_node "${data}")
|
response=$(send_to_spender_node "${data}")
|
||||||
local returncode=$?
|
local returncode=$?
|
||||||
trace_rc ${returncode}
|
trace_rc ${returncode}
|
||||||
|
|||||||
Reference in New Issue
Block a user