bitcoinwatcher 1.2.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.2.0 → bitcoinwatcher-2.1}/PKG-INFO +1 -1
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/address_listener/address_listener.py +2 -2
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/address_listener/simple_address_listener.py +2 -2
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tests/data/transactions.py +3 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tests/test_address_listener.py +1 -1
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tests/test_bitcoin_utils.py +5 -1
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/PKG-INFO +1 -1
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/pyproject.toml +1 -1
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/LICENSE +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/README.md +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/__init__.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/address_listener/__init__.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/models/__init__.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/models/address_tx_data.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tests/__init__.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tests/data/__init__.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tx_listener/__init__.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tx_listener/abstract_tx_listener.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/tx_listener/zmq_listener.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/utils/__init__.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/utils/benchmark.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/utils/bitcoin_rpc.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/utils/bitcoin_utils.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/utils/constants.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/utils/inscription_utils.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoin/utils/tx_address_data_extractor.py +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/SOURCES.txt +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/dependency_links.txt +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/requires.txt +0 -0
- {bitcoinwatcher-1.2.0 → bitcoinwatcher-2.1}/bitcoinwatcher.egg-info/top_level.txt +0 -0
- {bitcoinwatcher-1.2.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.2.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()
|
@@ -2,4 +2,7 @@ batch_airdrop_tx_hex = "020000000001022c93d25a236c55d8d0a12e0a6a755ee169fe2f9278
|
|
2
2
|
|
3
3
|
|
4
4
|
tx_hex = "020000000001015a87df0849aaf7bcf0e5d84d10576b73f3ae7b8345fbc4b1861054bff7072b8c4100000000fdffffff0122020000000000002251209347562c8ae780ef8e924c7601d0563185e8bab04a635872018f8a68b5e70f4103406f271924ad18596d9649640f9787ceaf9fae00b76f2ef11ed8ed63cad8c25ee647dc69fd803827147cd896b385f8a28b70d84c96dfef1f9a9d988cf8f2b9a0b45b20117f692257b2331233b5705ce9c682be8719ff1b2b64cbca290bd6faeb54423eac06e31b8fdc8801750063036f7264010118746578742f706c61696e3b636861727365743d7574662d38000d3132333731352e6269746d61706821c1117f692257b2331233b5705ce9c682be8719ff1b2b64cbca290bd6faeb54423e00000000"
|
5
|
+
|
6
|
+
tx_hex_2="020000000001046fcf75197f1871bd015fdbcffc8d478cfd62979bcd3c899344d0bfb31759882e0100000000ffffffffb350552164adac07b9f4d02e6a57319b4f6c67528a55b0a4615752d5e9b0a5410900000000ffffffffb350552164adac07b9f4d02e6a57319b4f6c67528a55b0a4615752d5e9b0a5410800000000fffffffff47685239d5c93cbb1a176cc1f7d69e22a3c702cd71f7b877f3cc2d8f5fa79ea0500000000ffffffff0522020000000000002251205dd879b30a59573156dcd95c050fab7de88cae8d1ac329d4a61df0f1400368db643003000000000017a9147169efe87824cadcdf4688156a9c9959eb68d5b987643003000000000017a9147169efe87824cadcdf4688156a9c9959eb68d5b9874810000000000000160014c015c65276d5f38d599d445c4cb03aa7aa0dc365a7ad000000000000160014e408c074a8de1b8c4f9a01aa183824ca19e48aca0247304402202e3fe1f6dbcf682843c8ce20c004a1a9bf35634bb9bd152f0b39e420b6e58d720220140ac67b13dc8ed0b6b5349e194907d69b7dd76e2889e90e724d3cb329680659012103d051d878e571669939c9f308bb9a341a7273762ae4652af3d5b859bf1c58b1da014199057861bab055142fd5e41666eadbdb6d57ea35d13630258a8190b87e49ebd0e64b5fdff02d5c6def0a6e6d5562a5cf1f11593595014cebc6914fec1ddeaa6883014137da6b8ee046c65e39df20360490376f541afe41404bd67199a61686c091d1e5dd0e7bd7f3ea41c2b19aee053782aeaa6619e69eed5e1e0d0ecd99f4aeaf5f598302483045022100e7b7734f7994c78615d0175ae21cdf4b85c4d583c99a870658e5883bf41cb68902205457f0d9c278fd81a3ed7dbba1a3c7cc411358e6b9e68a453d76207974a017ba012103d051d878e571669939c9f308bb9a341a7273762ae4652af3d5b859bf1c58b1da00000000"
|
7
|
+
|
5
8
|
non_reveal_tx_hex = "0200000000010523682b59c301bb4b2b377585502cf79f99bebc8ac0c5ef24c5c9a03709a49bd80300000000ffffffff23682b59c301bb4b2b377585502cf79f99bebc8ac0c5ef24c5c9a03709a49bd80200000000ffffffff9da05c164552f4cea302e8fc079238b011b71cb97198a51ce4997c545484cbd10000000000ffffffffd9e4ab27f0956525dd97eca615d42bb1fe5a63bcb99a8fbabad3279603fc11180600000000ffffffff452dd55bd6fe71fc2935c0fb426de56bd71c45992ed0decd6f6c15b8095f4ade0000000000ffffffff07b004000000000000160014661f53dbe2d3b4f7898f5fa5e66f666ee0d1fb042202000000000000225120a26c006d5237d9db498f6749f9db0f9225d65c2e9988ebb71f095ca60780962102bd3c0000000000160014294fa4cc60e0c0a1529b1ec67f50849d412d3e52a08601000000000017a914ea6b832a05c6ca578baa3836f3f25553d41068a5875802000000000000160014661f53dbe2d3b4f7898f5fa5e66f666ee0d1fb045802000000000000160014661f53dbe2d3b4f7898f5fa5e66f666ee0d1fb04ff49040000000000160014661f53dbe2d3b4f7898f5fa5e66f666ee0d1fb040247304402207a4f456f9f5ab88902a34272da4d9cd7e2dc8693b6a700ea0d9d33e58fe75c7302202c8023708ba32af9d03d949066b179ca8d812a5c042c7af470f9146834618c7b01210311e84b24501497db44ef1910211d34decd078bc3244442a80d3098f3dc29e1980247304402207193791bb0b6a03d92ab38240b402f4b1698fa35cdf411bb6a9fad9cef50ab490220593eb0d3fd424a1169a06d45e9ba1bf1fbb19c2755651d26b81aad3ede979a1501210311e84b24501497db44ef1910211d34decd078bc3244442a80d3098f3dc29e1980141d34c88431e66b311bc7a971e8c0651a6296951b95608f4f593a15f37559fe953376928a6ba1297ce2ef554ce37ce4f034d9595687ec95110db7cbaa2e71077fe8302483045022100b2f8aa280bbbfdcbce82b12c7b970ca3f8ea22ccc626086bd63116081ed9924802204effffb9256dd0e5e221601fa1e8f63a04c097420f86f6d1b78a8c85981113b001210311e84b24501497db44ef1910211d34decd078bc3244442a80d3098f3dc29e19802483045022100d72e05e31949b279e35a1494d6b1576b2dcaead631cb8ec243ad8a1c722f7a8202200618b2fbf6b1ae5682d011e8d9e3729bdefb5d88033cf428d62585383521a35301210311e84b24501497db44ef1910211d34decd078bc3244442a80d3098f3dc29e19800000000"
|
@@ -6,7 +6,7 @@ from bitcoin.models.address_tx_data import AddressTxType
|
|
6
6
|
|
7
7
|
class DummyAddressListener(AbstractAddressListener):
|
8
8
|
|
9
|
-
def consume(self, subscribed_address, address_tx_data: [AddressTxData]):
|
9
|
+
def consume(self, subscribed_address, tx_hex:str, address_tx_data: [AddressTxData]):
|
10
10
|
pass
|
11
11
|
|
12
12
|
def __init__(self, address_to_listen: [str]):
|
@@ -2,7 +2,7 @@ from unittest import TestCase
|
|
2
2
|
|
3
3
|
from bitcoinlib.transactions import Transaction
|
4
4
|
|
5
|
-
from bitcoin.tests.data.transactions import batch_airdrop_tx_hex, tx_hex, non_reveal_tx_hex
|
5
|
+
from bitcoin.tests.data.transactions import batch_airdrop_tx_hex, tx_hex, non_reveal_tx_hex, tx_hex_2
|
6
6
|
from bitcoin.utils.bitcoin_utils import is_reveal_tx, count_reveal_inputs
|
7
7
|
|
8
8
|
|
@@ -11,6 +11,10 @@ class Test(TestCase):
|
|
11
11
|
tx = Transaction.parse_hex(tx_hex, strict=False)
|
12
12
|
self.assertTrue(is_reveal_tx(tx))
|
13
13
|
|
14
|
+
def test_tx_hex_deserialization(self):
|
15
|
+
tx=Transaction.parse_hex(tx_hex_2, strict=False)
|
16
|
+
self.assertEqual(tx.txid, "8ca9bdedffbdf7c763dc41ec313f337b92c033530a546cb9cb2be5f486c9573a")
|
17
|
+
|
14
18
|
def test_is_reveal_tx_in_second_input(self):
|
15
19
|
tx = Transaction.parse_hex(batch_airdrop_tx_hex, strict=False)
|
16
20
|
self.assertTrue(is_reveal_tx(tx))
|
@@ -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
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
5
5
|
|
6
6
|
[project]
|
7
7
|
name = "bitcoinwatcher"
|
8
|
-
version = "
|
8
|
+
version = "2.1"
|
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
|
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
|