mirror of
https://github.com/fusion44/blitz_api.git
synced 2026-08-18 12:27:50 +02:00
feat: add more data to get bitcoin info response
This commit is contained in:
parent
464f22ac54
commit
54dd7b77f3
3 changed files with 50 additions and 2 deletions
|
|
@ -37,6 +37,8 @@ async def get_bitcoin_info():
|
|||
info["headers"] = r["headers"]
|
||||
info["initialblockdownload"] = r["initialblockdownload"]
|
||||
info["size_on_disk"] = r["size_on_disk"]
|
||||
info["verification_progress"] = r["verificationprogress"]
|
||||
info["pruned"] = r["pruned"]
|
||||
|
||||
return info
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from app.auth.auth_bearer import JWTBearer
|
||||
from app.repositories.bitcoin import get_bitcoin_info, handle_block_sub
|
||||
from app.routers.bitcoin_docs import blocks_sub_doc, get_bitcoin_info_desc
|
||||
from app.routers.bitcoin_docs import (blocks_sub_doc, get_bitcoin_info_desc,
|
||||
get_bitcoin_info_response_desc)
|
||||
from app.sse_starlette import EventSourceResponse
|
||||
from app.utils import bitcoin_rpc
|
||||
from fastapi import APIRouter, HTTPException, Request, status
|
||||
|
|
@ -49,7 +50,7 @@ def getblockchaininfo():
|
|||
|
||||
@router.get("/getbitcoininfo", summary="Get general information about bitcoin core",
|
||||
description=get_bitcoin_info_desc,
|
||||
response_description="A JSON String with relevant information.",
|
||||
response_description=get_bitcoin_info_response_desc,
|
||||
dependencies=[Depends(JWTBearer())],
|
||||
status_code=status.HTTP_200_OK)
|
||||
async def getbitcoininfo():
|
||||
|
|
|
|||
|
|
@ -11,3 +11,48 @@ If verbosity is 2, returns an Object with information about block <hash> and inf
|
|||
get_bitcoin_info_desc = """
|
||||
This endpoint returns a combination of various Bitcoin Core calls for easy access.
|
||||
"""
|
||||
|
||||
get_bitcoin_info_response_desc = """
|
||||
A JSON object which combines information from Bitcoin Core RPC calls `getnetworkinfo` and `getblockchaininfo`
|
||||
|
||||
```JSON
|
||||
{
|
||||
"version": 210100,
|
||||
"subversion": "/Satoshi:0.21.1/",
|
||||
"networkactive": true,
|
||||
"networks": [
|
||||
{
|
||||
"name": "ipv4",
|
||||
"limited": false,
|
||||
"reachable": true,
|
||||
"proxy": "",
|
||||
"proxy_randomize_credentials": false
|
||||
},
|
||||
{
|
||||
"name": "ipv6",
|
||||
"limited": false,
|
||||
"reachable": true,
|
||||
"proxy": "",
|
||||
"proxy_randomize_credentials": false
|
||||
},
|
||||
{
|
||||
"name": "onion",
|
||||
"limited": true,
|
||||
"reachable": false,
|
||||
"proxy": "",
|
||||
"proxy_randomize_credentials": false
|
||||
}
|
||||
],
|
||||
"connections": 3,
|
||||
"connections_in": 1,
|
||||
"connections_out": 3,
|
||||
"chain": "regtest",
|
||||
"blocks": 316,
|
||||
"headers": 316,
|
||||
"initialblockdownload": false,
|
||||
"size_on_disk": 102295,
|
||||
"verification_progress": 1,
|
||||
"pruned":false
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue