mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-18 13:14:56 +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)
|
||||
|
||||
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
|
||||
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:
|
||||
@@ -568,6 +571,12 @@ Proxy response:
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"address":"tb1ql7yvh3lmajxmaljsnsu3w8lhwczu963tvjfzpj"
|
||||
}
|
||||
```
|
||||
|
||||
### Spend coins from spending wallet (called by application)
|
||||
|
||||
Calls sendtoaddress RPC on the spending wallet with supplied info.
|
||||
|
||||
@@ -227,8 +227,9 @@ main()
|
||||
;;
|
||||
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}" ${?}
|
||||
break
|
||||
;;
|
||||
|
||||
@@ -127,8 +127,16 @@ getbalancebyxpub() {
|
||||
getnewaddress() {
|
||||
trace "Entering getnewaddress()..."
|
||||
|
||||
local address_type=${1}
|
||||
trace "[getnewaddress] address_type=${address_type}"
|
||||
|
||||
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}")
|
||||
local returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
Reference in New Issue
Block a user