bits
Advanced tools
+2
-2
| Metadata-Version: 2.1 | ||
| Name: bits | ||
| Version: 0.1.0 | ||
| Version: 0.1.1 | ||
| Summary: bits is a cli tool and pure Python library for Bitcoin | ||
| Author-email: Jason Traub <jtraub91@gmail.com> | ||
| Project-URL: Homepage, https://github.com/jtraub91/bits | ||
| Project-URL: Source, https://github.com/jtraub91/bits | ||
| Classifier: Programming Language :: Python :: 3 :: Only | ||
@@ -8,0 +8,0 @@ Classifier: Programming Language :: Python :: 3.7 |
+3
-3
| [build-system] | ||
| requires = ["setuptools"] | ||
| requires = ["setuptools", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
@@ -7,3 +7,3 @@ | ||
| name = "bits" | ||
| version = "0.1.0" | ||
| version = "0.1.1" | ||
| authors = [{name = "Jason Traub", email = "jtraub91@gmail.com"}] | ||
@@ -25,3 +25,3 @@ description = "bits is a cli tool and pure Python library for Bitcoin" | ||
| [project.urls] | ||
| "Homepage" = "https://github.com/jtraub91/bits" | ||
| "Source" = "https://github.com/jtraub91/bits" | ||
@@ -28,0 +28,0 @@ [project.scripts] |
| Metadata-Version: 2.1 | ||
| Name: bits | ||
| Version: 0.1.0 | ||
| Version: 0.1.1 | ||
| Summary: bits is a cli tool and pure Python library for Bitcoin | ||
| Author-email: Jason Traub <jtraub91@gmail.com> | ||
| Project-URL: Homepage, https://github.com/jtraub91/bits | ||
| Project-URL: Source, https://github.com/jtraub91/bits | ||
| Classifier: Programming Language :: Python :: 3 :: Only | ||
@@ -8,0 +8,0 @@ Classifier: Programming Language :: Python :: 3.7 |
@@ -1,2 +0,2 @@ | ||
| __version__ = "0.1.0" | ||
| __version__ = "0.1.1" | ||
@@ -3,0 +3,0 @@ import json |
+16
-13
| """ | ||
| https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki | ||
| """ | ||
| from typing import List | ||
| from typing import Optional | ||
| from typing import Tuple | ||
| from typing import Union | ||
| import typing | ||
@@ -15,3 +12,3 @@ bech32_max_len = 90 | ||
| def parse_bech32(bytestring: bytes) -> Tuple[bytes]: | ||
| def parse_bech32(bytestring: bytes) -> typing.Tuple[bytes]: | ||
| """ | ||
@@ -54,3 +51,3 @@ Parse bech32 to (hrp, data) | ||
| def bech32_encode( | ||
| hrp: bytes, data: bytes, witness_version: Optional[bytes] = b"" | ||
| hrp: bytes, data: bytes, witness_version: typing.Optional[bytes] = b"" | ||
| ) -> bytes: | ||
@@ -76,3 +73,4 @@ """ | ||
| groups_of_5 = data_len * 8 // 5 | ||
| if modulo := data_len * 8 % 5: | ||
| modulo = data_len * 8 % 5 | ||
| if modulo: | ||
| groups_of_5 += 1 | ||
@@ -130,3 +128,4 @@ data_int <<= 5 - modulo | ||
| decoded |= integer | ||
| if modulo := decoded_bits % 8: | ||
| modulo = decoded_bits % 8 | ||
| if modulo: | ||
| # discard zero-padding | ||
@@ -142,3 +141,3 @@ assert ( | ||
| def decode_segwit_addr(addr: bytes) -> tuple[bytes, int, bytes]: | ||
| def decode_segwit_addr(addr: bytes) -> typing.Tuple[bytes, int, bytes]: | ||
| hrp, data = parse_bech32(addr) | ||
@@ -180,3 +179,3 @@ assert_valid_bech32(hrp, data) | ||
| ## https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#checksum | ||
| def bech32_polymod(values: List[int]) -> int: | ||
| def bech32_polymod(values: typing.List[int]) -> int: | ||
| GEN = [0x3B6A57B2, 0x26508E6D, 0x1EA119FA, 0x3D4233DD, 0x2A1462B3] | ||
@@ -192,7 +191,9 @@ chk = 1 | ||
| def bech32_hrp_expand(s: List[Union[str, bytes]]) -> List[int]: | ||
| def bech32_hrp_expand(s: typing.List[typing.Union[str, bytes]]) -> typing.List[int]: | ||
| return [ord(x) >> 5 for x in s] + [0] + [ord(x) & 31 for x in s] | ||
| def bech32_verify_checksum(hrp: List[Union[str, bytes]], data: List[int]) -> bool: | ||
| def bech32_verify_checksum( | ||
| hrp: typing.List[typing.Union[str, bytes]], data: typing.List[int] | ||
| ) -> bool: | ||
| """ | ||
@@ -205,3 +206,5 @@ Args: | ||
| def bech32_create_checksum(hrp: List[Union[str, bytes]], data: List[int]) -> List[int]: | ||
| def bech32_create_checksum( | ||
| hrp: typing.List[typing.Union[str, bytes]], data: typing.List[int] | ||
| ) -> typing.List[int]: | ||
| """ | ||
@@ -208,0 +211,0 @@ Args: |
@@ -42,3 +42,3 @@ """ | ||
| count: int, compressed_pubkey: bool = False, network: str = "regtest" | ||
| ) -> typing.Iterator[tuple[bytes, bytes]]: | ||
| ) -> typing.Iterator[typing.Tuple[bytes, bytes]]: | ||
| """ | ||
@@ -90,4 +90,4 @@ Generate keys which receive coinbase reward sent to p2pkh address | ||
| # gather raw mempool txns | ||
| mempool_txids: list[str] = bits.rpc.rpc_method("getrawmempool") | ||
| mempool_raw_txns: list[str] = [ | ||
| mempool_txids: typing.List[str] = bits.rpc.rpc_method("getrawmempool") | ||
| mempool_raw_txns: typing.List[str] = [ | ||
| bits.rpc.rpc_method("getrawtransaction", txid) for txid in mempool_txids | ||
@@ -94,0 +94,0 @@ ] |
+2
-2
@@ -58,3 +58,3 @@ """ | ||
| # https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/#tag | ||
| TAG_MAP: dict[int, str] = { | ||
| TAG_MAP: typing.Dict[int, str] = { | ||
| 0x02: "INTEGER", | ||
@@ -69,3 +69,3 @@ 0x03: "BIT STRING", | ||
| } | ||
| MAP_TAG: dict[str, int] = {value: key for key, value in TAG_MAP.items()} | ||
| MAP_TAG: typing.Dict[str, int] = {value: key for key, value in TAG_MAP.items()} | ||
| # tag classes | ||
@@ -72,0 +72,0 @@ # bit 6: 1=constructed 0=primitive |
@@ -226,3 +226,3 @@ import logging | ||
| def script(args: list[str], witness: bool = False) -> bytes: | ||
| def script(args: typing.List[str], witness: bool = False) -> bytes: | ||
| """ | ||
@@ -274,3 +274,3 @@ Generic script | ||
| scriptbytes: bytes, witness: bool = False | ||
| ) -> typing.Union[list[str], typing.Tuple[list[str], bytes]]: | ||
| ) -> typing.Union[typing.List[str], typing.Tuple[typing.List[str], bytes]]: | ||
| decoded = [] | ||
@@ -277,0 +277,0 @@ if witness: |
@@ -354,3 +354,5 @@ import hashlib | ||
| def pem_decode_key(pem_: bytes) -> typing.Union[tuple[bytes, bytes], tuple[bytes]]: | ||
| def pem_decode_key( | ||
| pem_: bytes, | ||
| ) -> typing.Union[typing.Tuple[bytes, bytes], typing.Tuple[bytes]]: | ||
| """ | ||
@@ -357,0 +359,0 @@ Decode from pem / der encoded EC private / public key |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
238208
0.05%5763
0.09%