Change outpoint output format for cli commands (#3048)

* Change outpoint output format for cli commands

* Use lockunspent format

* update docs
This commit is contained in:
benthecarman 2021-05-08 08:15:49 -05:00 committed by GitHub
parent 9b06cdd832
commit 8e29b5c6f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View file

@ -415,7 +415,7 @@ class RoutesSpec extends AnyWordSpec with ScalatestRouteTest with MockFactory {
Get() ~> route ~> check {
assert(contentType == `application/json`)
assert(
responseAs[String] == """{"result":[{"outpoint":"000000000000000000000000000000000000000000000000000000000000000000000000","value":-1}],"error":null}""")
responseAs[String] == """{"result":[{"outpoint":{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":0},"value":-1}],"error":null}""")
}
}
@ -432,7 +432,7 @@ class RoutesSpec extends AnyWordSpec with ScalatestRouteTest with MockFactory {
Get() ~> route ~> check {
assert(contentType == `application/json`)
assert(
responseAs[String] == """{"result":[{"outpoint":"000000000000000000000000000000000000000000000000000000000000000000000000","value":-1}],"error":null}""")
responseAs[String] == """{"result":[{"outpoint":{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":0},"value":-1}],"error":null}""")
}
}

View file

@ -30,7 +30,10 @@ case class WalletRoutes(wallet: AnyHDWalletApi)(implicit
private def spendingInfoDbToJson(spendingInfoDb: SpendingInfoDb): Value = {
Obj(
"outpoint" -> Str(spendingInfoDb.outPoint.hex),
"outpoint" -> Obj(
"txid" -> Str(spendingInfoDb.txid.hex),
"vout" -> Num(spendingInfoDb.outPoint.vout.toLong.toDouble)
),
"value" -> Num(spendingInfoDb.output.value.satoshis.toLong.toDouble)
)
}

View file

@ -13,11 +13,17 @@ unreserve them with `lockunspent` or they are spent in the blockchain
bitcoin-s-cli listreservedutxos
[
{
"outpoint": "1c22634fa282e71866a8b8c6732ec89eb5c46d30f9773486b0ae32770e8109e1",
"outpoint": {
"txid": "1c22634fa282e71866a8b8c6732ec89eb5c46d30f9773486b0ae32770e8109e1",
"vout": 1,
},
"value": 2000
},
{
"outpoint": "2b12634fa282e71866a8b8c6732ec89eb5c46d30f9773486b0ae32770e810901",
"outpoint": {
"txid": "2b12634fa282e71866a8b8c6732ec89eb5c46d30f9773486b0ae32770e810901",
"vout": 0,
},
"value": 1000
}
]