bitcoinwatcher 2.10__tar.gz → 2.11b2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/PKG-INFO +3 -2
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_extractors/bitcoin_rpc.py +1 -1
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/utils/bitcoin_rpc.py +8 -5
- bitcoinwatcher-2.11b2/bitcoin/utils/constants.py +2 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoinwatcher.egg-info/PKG-INFO +3 -2
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/pyproject.toml +1 -1
- bitcoinwatcher-2.10/bitcoin/utils/constants.py +0 -2
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/LICENSE +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/README.md +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/address_listener/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/address_listener/address_listener.py +4 -4
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/address_listener/simple_address_listener.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/models/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/models/address_tx_data.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tests/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tests/data/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tests/data/transactions.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tests/test_address_listener.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tests/test_bitcoin_rpc.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tests/test_bitcoin_utils.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_extractors/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_extractors/abstract_extractor.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_extractors/default.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_extractors/mempool.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_listener/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_listener/abstract_tx_listener.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/tx_listener/zmq_listener.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/utils/__init__.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/utils/benchmark.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/utils/bitcoin_utils.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/utils/context_aware_logging.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/utils/inscription_utils.py +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoinwatcher.egg-info/SOURCES.txt +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoinwatcher.egg-info/dependency_links.txt +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoinwatcher.egg-info/requires.txt +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoinwatcher.egg-info/top_level.txt +0 -0
- {bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: bitcoinwatcher
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.11b2
|
4
4
|
Summary: bitcoinwatcher is a Python library that implements a ZMQ subscriber and provides abstractions to build custom address watchers. This library is designed to make it easy for developers to monitor Bitcoin addresses and react to changes in their state.
|
5
5
|
Author: twosatsmaxi
|
6
6
|
License: Apache License
|
@@ -230,6 +230,7 @@ Requires-Dist: pyzmq==25.1.2
|
|
230
230
|
Requires-Dist: python-bitcoinrpc==1.0
|
231
231
|
Requires-Dist: pytz~=2024.2
|
232
232
|
Requires-Dist: colorlog~=6.9.0
|
233
|
+
Dynamic: license-file
|
233
234
|
|
234
235
|
# bitcoinwatcher
|
235
236
|
|
@@ -20,7 +20,7 @@ class BitcoinRPCAddressDataExtractor(AbstractTxAddressDataExtractor):
|
|
20
20
|
def fetch_all_inputs(self, inputs):
|
21
21
|
unique_txids = list(set([input.prev_txid.hex() for input in inputs]))
|
22
22
|
rpc_calls = [["getrawtransaction", tx_id, True] for tx_id in unique_txids]
|
23
|
-
data = self.bitcoinrpc.
|
23
|
+
data = self.bitcoinrpc.get_new_connection().batch_(rpc_calls)
|
24
24
|
tx_id_to_data = {tx_id: current_tx for tx_id, current_tx in zip(unique_txids, data)}
|
25
25
|
list_of_vouts = []
|
26
26
|
for input in inputs:
|
@@ -13,15 +13,17 @@ class BitcoinRPC:
|
|
13
13
|
rpc_port = os.environ.get("RPC_PORT", 8332)
|
14
14
|
|
15
15
|
def __init__(self):
|
16
|
-
rpc_string = f"http://{self.rpc_user}:{self.rpc_password}@{self.rpc_host}:{self.rpc_port}"
|
17
|
-
|
16
|
+
self.rpc_string = f"http://{self.rpc_user}:{self.rpc_password}@{self.rpc_host}:{self.rpc_port}"
|
17
|
+
|
18
|
+
def get_new_connection(self):
|
19
|
+
return AuthServiceProxy(self.rpc_string)
|
18
20
|
|
19
21
|
def get_transaction(self, txid: str) -> dict:
|
20
|
-
return self.
|
22
|
+
return self.get_new_connection().getrawtransaction(txid, True)
|
21
23
|
|
22
24
|
def is_confirmed(self, txid: str) -> bool:
|
23
25
|
try:
|
24
|
-
self.
|
26
|
+
self.get_new_connection().getmempoolentry(txid)
|
25
27
|
return False
|
26
28
|
except JSONRPCException as e:
|
27
29
|
return True
|
@@ -30,10 +32,11 @@ class BitcoinRPC:
|
|
30
32
|
if __name__ == '__main__':
|
31
33
|
logger = get_logger(__name__)
|
32
34
|
rpc = BitcoinRPC()
|
33
|
-
txid = '
|
35
|
+
txid = '775c85bb56a3fc86bf6b100a1e9ff54b6d4dcc3670fb76f98365d99a32c18e53'
|
34
36
|
try:
|
35
37
|
ctx_tx.set('686d025f16d9f20353665a9d865e575e3e4d14214f6f7045149a17dd6bf0fac6')
|
36
38
|
ctx_tx_status.set('confirmed')
|
39
|
+
tx_data = rpc.get_transaction(txid)
|
37
40
|
logger.info("Transaction is confirmed")
|
38
41
|
except JSONRPCException as e:
|
39
42
|
print(f"An error occurred: {e}")
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: bitcoinwatcher
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.11b2
|
4
4
|
Summary: bitcoinwatcher is a Python library that implements a ZMQ subscriber and provides abstractions to build custom address watchers. This library is designed to make it easy for developers to monitor Bitcoin addresses and react to changes in their state.
|
5
5
|
Author: twosatsmaxi
|
6
6
|
License: Apache License
|
@@ -230,6 +230,7 @@ Requires-Dist: pyzmq==25.1.2
|
|
230
230
|
Requires-Dist: python-bitcoinrpc==1.0
|
231
231
|
Requires-Dist: pytz~=2024.2
|
232
232
|
Requires-Dist: colorlog~=6.9.0
|
233
|
+
Dynamic: license-file
|
233
234
|
|
234
235
|
# bitcoinwatcher
|
235
236
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
5
5
|
|
6
6
|
[project]
|
7
7
|
name = "bitcoinwatcher"
|
8
|
-
version = "2.
|
8
|
+
version = "2.11b2"
|
9
9
|
description = "bitcoinwatcher is a Python library that implements a ZMQ subscriber and provides abstractions to build custom address watchers. This library is designed to make it easy for developers to monitor Bitcoin addresses and react to changes in their state."
|
10
10
|
readme = "README.md"
|
11
11
|
authors = [{name = "twosatsmaxi"}]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -39,10 +39,6 @@ class AbstractAddressListener(AbstractTxListener, ABC):
|
|
39
39
|
return
|
40
40
|
logger.debug(f"Extracting default tx data")
|
41
41
|
address_tx_data = self.default_tx_extractor.extract(tx)
|
42
|
-
# filter the address we are interested in
|
43
|
-
addresses_for_events = self.filter_address_tx_data(address_tx_data)
|
44
|
-
if len(addresses_for_events) == 0:
|
45
|
-
return
|
46
42
|
# get the address tx data from mempool for full details if any address matches
|
47
43
|
try:
|
48
44
|
logger.info(f"Extracting rpc tx data")
|
@@ -50,6 +46,10 @@ class AbstractAddressListener(AbstractTxListener, ABC):
|
|
50
46
|
except Exception as e:
|
51
47
|
logger.error(f"Error in getting rpc tx data, taking defaults", exc_info=True)
|
52
48
|
address_tx_data = address_tx_data
|
49
|
+
# filter the address we are interested in
|
50
|
+
addresses_for_events = self.filter_address_tx_data(address_tx_data)
|
51
|
+
if len(addresses_for_events) == 0:
|
52
|
+
return
|
53
53
|
|
54
54
|
for address in addresses_for_events:
|
55
55
|
self.consume(tx_hex=tx.raw_hex(), subscribed_address=address, address_tx_data=address_tx_data)
|
{bitcoinwatcher-2.10 → bitcoinwatcher-2.11b2}/bitcoin/address_listener/simple_address_listener.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|