bitcoinwatcher 1.2.0__py3-none-any.whl → 2.1__py3-none-any.whl

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.
@@ -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)
@@ -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 = ["3P4WqXDbSLRhzo2H6MT6YFbvBKBDPLbVtQ"]
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: 1.2.0
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
@@ -1,14 +1,14 @@
1
1
  bitcoin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bitcoin/address_listener/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- bitcoin/address_listener/address_listener.py,sha256=sK0hrhPrYg8z6AC8MqNbF3UoaqvbhdhVcoyMLj8x4MQ,2223
4
- bitcoin/address_listener/simple_address_listener.py,sha256=iSMPBUzl9d4s8_ee2LAXz83zBiGfs1KhwSH_7FvxwKY,1609
3
+ bitcoin/address_listener/address_listener.py,sha256=K8SqR9oAJJJ1XrSGDbEDAamGyPB659xaPNlwtB53ed4,2252
4
+ bitcoin/address_listener/simple_address_listener.py,sha256=WG8eTrd3AdkrIs1TAGRsXe_erAtE_Ep8hidZDksGk8g,1625
5
5
  bitcoin/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  bitcoin/models/address_tx_data.py,sha256=0zIleuEHern42zk1Pp7IteR5jQqVdAM1l4Gvy6YzGe0,754
7
7
  bitcoin/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- bitcoin/tests/test_address_listener.py,sha256=oqVfJ_lQNHgRxCnDteUpkaUyHff5Wa8J2oYJnwQ-QaE,3113
9
- bitcoin/tests/test_bitcoin_utils.py,sha256=NYRHWfqaOgLO8osOYVqRudk9ksuhC3LC9HGrxj-VGu4,1213
8
+ bitcoin/tests/test_address_listener.py,sha256=USK3BMGnRsTBmCXcbnC9WkX6kF-W_sHt7RKARv39IDg,3125
9
+ bitcoin/tests/test_bitcoin_utils.py,sha256=nc5HhCNQ3kQIxesd_l8zFruE0l2OiEH0j2ukjAHtRX8,1426
10
10
  bitcoin/tests/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- bitcoin/tests/data/transactions.py,sha256=To0FCF4JDdjZTV9H900WCuV8_mGPItk5bEiYgUj0KiY,394877
11
+ bitcoin/tests/data/transactions.py,sha256=qIX9seGYguQ1lvLOCF8oe3NQhMJZP0SsBmz1iFbszhg,396279
12
12
  bitcoin/tx_listener/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  bitcoin/tx_listener/abstract_tx_listener.py,sha256=rGp9na-aOSl_aPaIqf44RTZaFF3SvrxIhZBujTnWqao,189
14
14
  bitcoin/tx_listener/zmq_listener.py,sha256=_edaee2PYj9T1jxLenv68ekZRTM8-LUN3DloDLNQ5Bc,999
@@ -19,8 +19,8 @@ bitcoin/utils/bitcoin_utils.py,sha256=mrnRPqUa2U2EMKu7rrPV_bW1sL2CJUfbAom0Zdamyd
19
19
  bitcoin/utils/constants.py,sha256=irZLlArgica2VckyckEYxH5D5KjvdF52dtBMWswqw8k,52
20
20
  bitcoin/utils/inscription_utils.py,sha256=8QbOJ1o1n1bMFsPREGLzwFjnGzfuARgJCPr6ORhP44o,193
21
21
  bitcoin/utils/tx_address_data_extractor.py,sha256=M_WvBNNXYwd2qBG6oyfu8Vn6P8F0Rt5w1FnfvFO6IZc,3321
22
- bitcoinwatcher-1.2.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
23
- bitcoinwatcher-1.2.0.dist-info/METADATA,sha256=i4U1BiZn-KQ9TQDPKGaKkctAFpgx1lRGaLywjvz5qoc,14940
24
- bitcoinwatcher-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
25
- bitcoinwatcher-1.2.0.dist-info/top_level.txt,sha256=YdUgzLdCiMlrwaKyDqHA1acEd23QFko5bv7D6nBANJ0,8
26
- bitcoinwatcher-1.2.0.dist-info/RECORD,,
22
+ bitcoinwatcher-2.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
23
+ bitcoinwatcher-2.1.dist-info/METADATA,sha256=t7GDjAoRaQmKbUSGGEuDRxbHF-kqeQirzNyyZYiIe0c,14938
24
+ bitcoinwatcher-2.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
25
+ bitcoinwatcher-2.1.dist-info/top_level.txt,sha256=YdUgzLdCiMlrwaKyDqHA1acEd23QFko5bv7D6nBANJ0,8
26
+ bitcoinwatcher-2.1.dist-info/RECORD,,