bitcoinwatcher 1.1.0__tar.gz → 2.1__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-1.1.0 → bitcoinwatcher-2.1}/PKG-INFO +1 -1
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/address_listener/address_listener.py +2 -2
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/address_listener/simple_address_listener.py +2 -2
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/models/address_tx_data.py +1 -1
- bitcoinwatcher-2.1/bitcoin/tests/data/transactions.py +8 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/tests/test_address_listener.py +1 -1
- bitcoinwatcher-2.1/bitcoin/tests/test_bitcoin_utils.py +36 -0
- bitcoinwatcher-2.1/bitcoin/utils/__init__.py +0 -0
- bitcoinwatcher-2.1/bitcoin/utils/bitcoin_utils.py +18 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/utils/tx_address_data_extractor.py +6 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/PKG-INFO +1 -1
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/SOURCES.txt +3 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/pyproject.toml +1 -1
- bitcoinwatcher-1.1.0/bitcoin/utils/bitcoin_utils.py +0 -16
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/LICENSE +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/README.md +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/__init__.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/address_listener/__init__.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/models/__init__.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/tests/__init__.py +0 -0
- {bitcoinwatcher-1.1.0/bitcoin/tx_listener → bitcoinwatcher-2.1/bitcoin/tests/data}/__init__.py +0 -0
- {bitcoinwatcher-1.1.0/bitcoin/utils → bitcoinwatcher-2.1/bitcoin/tx_listener}/__init__.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/tx_listener/abstract_tx_listener.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/tx_listener/zmq_listener.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/utils/benchmark.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/utils/bitcoin_rpc.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/utils/constants.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/utils/inscription_utils.py +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/dependency_links.txt +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/requires.txt +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/top_level.txt +0 -0
- {bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: bitcoinwatcher
|
3
|
-
Version:
|
3
|
+
Version: 2.1
|
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
|
@@ -22,7 +22,7 @@ class AbstractAddressListener(AbstractTxListener, ABC):
|
|
22
22
|
self.addresses_to_listen = addresses_to_listen
|
23
23
|
|
24
24
|
@abstractmethod
|
25
|
-
def consume(self, subscribed_address, address_tx_data: [AddressTxData]):
|
25
|
+
def consume(self, tx_hex, subscribed_address, address_tx_data: [AddressTxData]):
|
26
26
|
pass
|
27
27
|
|
28
28
|
def filter_address_tx_data(self, address_tx_data: [AddressTxData]) -> [str]:
|
@@ -48,4 +48,4 @@ class AbstractAddressListener(AbstractTxListener, ABC):
|
|
48
48
|
address_tx_data = address_tx_data
|
49
49
|
|
50
50
|
for address in addresses_for_events:
|
51
|
-
self.consume(subscribed_address=address, address_tx_data=address_tx_data)
|
51
|
+
self.consume(tx_hex=tx.raw_hex(), subscribed_address=address, address_tx_data=address_tx_data)
|
{bitcoinwatcher-1.1.0 → bitcoinwatcher-2.1}/bitcoin/address_listener/simple_address_listener.py
RENAMED
@@ -4,7 +4,7 @@ from bitcoin.tx_listener.zmq_listener import ZMQTXListener
|
|
4
4
|
|
5
5
|
|
6
6
|
class SimpleAddressListener(AbstractAddressListener):
|
7
|
-
def consume(self, subscribed_address, address_tx_data: [AddressTxData]):
|
7
|
+
def consume(self, subscribed_address, tx_hex, address_tx_data: [AddressTxData]):
|
8
8
|
all_output = list(filter(lambda x: x.type == AddressTxType.OUTPUT and x.address == subscribed_address,
|
9
9
|
address_tx_data))
|
10
10
|
total_amount_in_output = sum(map(lambda x: x.amount_in_btc(), all_output))
|
@@ -23,7 +23,7 @@ class SimpleAddressListener(AbstractAddressListener):
|
|
23
23
|
|
24
24
|
|
25
25
|
if __name__ == '__main__':
|
26
|
-
address = ["
|
26
|
+
address = ["bc1qcq2uv5nk6hec6kvag3wyevp6574qmsm9scjxc2"]
|
27
27
|
address_watcher = SimpleAddressListener(address)
|
28
28
|
zmq_listener = ZMQTXListener(address_watcher)
|
29
29
|
zmq_listener.start()
|