jmcore.mempool_api
jmcore.mempool_api
Mempool.space API client for Bitcoin blockchain queries.
Classes
AddressInfo
Bases: BaseModel
Source code in jmcore/src/jmcore/mempool_api.py
22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Attributes
address: str
instance-attribute
chain_stats: AddressStats
instance-attribute
mempool_stats: AddressStats
instance-attribute
Functions
balance() -> int
Source code in jmcore/src/jmcore/mempool_api.py
33 34 | |
total_received() -> int
Source code in jmcore/src/jmcore/mempool_api.py
27 28 | |
total_sent() -> int
Source code in jmcore/src/jmcore/mempool_api.py
30 31 | |
AddressStats
Bases: BaseModel
Source code in jmcore/src/jmcore/mempool_api.py
14 15 16 17 18 19 | |
Attributes
funded_txo_count: int
instance-attribute
funded_txo_sum: int
instance-attribute
spent_txo_count: int
instance-attribute
spent_txo_sum: int
instance-attribute
tx_count: int
instance-attribute
MempoolAPI
Source code in jmcore/src/jmcore/mempool_api.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
Attributes
base_url = base_url.rstrip('/')
instance-attribute
client = httpx.AsyncClient(timeout=timeout, follow_redirects=True, **client_kwargs)
instance-attribute
socks_proxy = socks_proxy
instance-attribute
timeout = timeout
instance-attribute
Functions
__aenter__() -> MempoolAPI
async
Source code in jmcore/src/jmcore/mempool_api.py
109 110 | |
__aexit__(*args: Any) -> None
async
Source code in jmcore/src/jmcore/mempool_api.py
112 113 | |
__init__(base_url: str = 'https://mempool.space/api', timeout: float = 30.0, socks_proxy: str | None = None)
Source code in jmcore/src/jmcore/mempool_api.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
close() -> None
async
Source code in jmcore/src/jmcore/mempool_api.py
115 116 | |
get_address_info(address: str) -> AddressInfo
async
Source code in jmcore/src/jmcore/mempool_api.py
148 149 150 | |
get_block_hash(height: int) -> str
async
Source code in jmcore/src/jmcore/mempool_api.py
161 162 163 164 | |
get_block_height() -> int
async
Source code in jmcore/src/jmcore/mempool_api.py
156 157 158 159 | |
get_transaction(txid: str) -> Transaction
async
Source code in jmcore/src/jmcore/mempool_api.py
152 153 154 | |
get_utxo_confirmations(txid: str, vout: int) -> int | None
async
Source code in jmcore/src/jmcore/mempool_api.py
166 167 168 169 170 171 172 173 174 175 176 | |
get_utxo_value(txid: str, vout: int) -> int | None
async
Source code in jmcore/src/jmcore/mempool_api.py
178 179 180 181 182 183 184 185 | |
test_connection() -> bool
async
Test if the API connection works by making a simple request.
Source code in jmcore/src/jmcore/mempool_api.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
MempoolAPIError
Bases: Exception
Source code in jmcore/src/jmcore/mempool_api.py
64 65 | |
Transaction
Bases: BaseModel
Source code in jmcore/src/jmcore/mempool_api.py
52 53 54 55 56 57 58 59 60 61 | |
Attributes
fee: int
instance-attribute
locktime: int
instance-attribute
size: int
instance-attribute
status: TxStatus
instance-attribute
txid: str
instance-attribute
version: int
instance-attribute
vin: list[dict[str, Any]]
instance-attribute
vout: list[TxOut]
instance-attribute
weight: int
instance-attribute
TxOut
Bases: BaseModel
Source code in jmcore/src/jmcore/mempool_api.py
37 38 39 40 41 42 | |
Attributes
scriptpubkey: str
instance-attribute
scriptpubkey_address: str | None = None
class-attribute
instance-attribute
scriptpubkey_asm: str
instance-attribute
scriptpubkey_type: str
instance-attribute
value: int
instance-attribute
TxStatus
Bases: BaseModel
Source code in jmcore/src/jmcore/mempool_api.py
45 46 47 48 49 | |