From 8de2eec981a22448fca10540d34d6d7a83342ae7 Mon Sep 17 00:00:00 2001 From: Chief Zach <59001347+Chief-Zach@users.noreply.github.com> Date: Sat, 3 Jun 2023 01:01:01 -0400 Subject: [PATCH 01/10] Update hdwallet.py Hardened key by index is not returned. Added return statement --- hdwallet/hdwallet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdwallet/hdwallet.py b/hdwallet/hdwallet.py index a66ac84..1f94c95 100644 --- a/hdwallet/hdwallet.py +++ b/hdwallet/hdwallet.py @@ -483,7 +483,7 @@ def from_index(self, index: int, hardened: bool = False) -> "HDWallet": if hardened: self._path += ("/%d'" % index) - self._derive_key_by_index(index + BIP32KEY_HARDEN) + return self._derive_key_by_index(index + BIP32KEY_HARDEN) else: self._path += ("/%d" % index) return self._derive_key_by_index(index) From a209852ec6b89d4abfd959a1bcc9822d2b8f340c Mon Sep 17 00:00:00 2001 From: joxerx Date: Fri, 11 Aug 2023 16:01:25 +0300 Subject: [PATCH 02/10] Add BNB Smart Chain support --- hdwallet/cryptocurrencies.py | 40 ++++++++++++++++++++++++++++++++++++ hdwallet/symbols.py | 2 ++ 2 files changed, 42 insertions(+) diff --git a/hdwallet/cryptocurrencies.py b/hdwallet/cryptocurrencies.py index f36584d..a2fbf68 100644 --- a/hdwallet/cryptocurrencies.py +++ b/hdwallet/cryptocurrencies.py @@ -2153,6 +2153,46 @@ class EthereumMainnet(Cryptocurrency): WIF_SECRET_KEY = 0x80 +class BinanceSmartChainMainnet(Cryptocurrency): + + NAME = "Binance Smart Chain" + SYMBOL = "BSC" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/bnb-chain/bsc" + COIN_TYPE = CoinType({ + "INDEX": 9006, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x05 + PUBLIC_KEY_ADDRESS = 0x00 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "bc", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x0488ade4, + "P2SH": 0x0488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x0488b21e, + "P2SH": 0x0488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = None + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + class EuropeCoinMainnet(Cryptocurrency): NAME = "Europe Coin" diff --git a/hdwallet/symbols.py b/hdwallet/symbols.py index e78d379..b712c26 100644 --- a/hdwallet/symbols.py +++ b/hdwallet/symbols.py @@ -28,6 +28,8 @@ BTDX = "BTDX" # Bit Send BSD = "BSD" +# BNB Smart Chain +BSC = "BSC" # Bitcoin Cash BCH = "BCH" # Bitcoin Gold From 0a3833d09bb0898a115cec59e8985ebf48a94508 Mon Sep 17 00:00:00 2001 From: joxerx Date: Fri, 11 Aug 2023 16:15:03 +0300 Subject: [PATCH 03/10] Add Polygon support --- hdwallet/cryptocurrencies.py | 40 ++++++++++++++++++++++++++++++++++++ hdwallet/symbols.py | 4 ++++ 2 files changed, 44 insertions(+) diff --git a/hdwallet/cryptocurrencies.py b/hdwallet/cryptocurrencies.py index a2fbf68..fde0981 100644 --- a/hdwallet/cryptocurrencies.py +++ b/hdwallet/cryptocurrencies.py @@ -2193,6 +2193,46 @@ class BinanceSmartChainMainnet(Cryptocurrency): WIF_SECRET_KEY = 0x80 +class PolygonMainnet(Cryptocurrency): + + NAME = "Polygon" + SYMBOL = "MATIC" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/bnb-chain/bsc" + COIN_TYPE = CoinType({ + "INDEX": 966, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x05 + PUBLIC_KEY_ADDRESS = 0x00 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "bc", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x0488ade4, + "P2SH": 0x0488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x0488b21e, + "P2SH": 0x0488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = None + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + class EuropeCoinMainnet(Cryptocurrency): NAME = "Europe Coin" diff --git a/hdwallet/symbols.py b/hdwallet/symbols.py index b712c26..5a30ff2 100644 --- a/hdwallet/symbols.py +++ b/hdwallet/symbols.py @@ -162,6 +162,8 @@ LKR = "LKR" # Lynx LYNX = "LYNX" +# Polygon +MATIC = "MATIC" # Mazacoin MZC = "MZC" # Megacoin @@ -312,6 +314,7 @@ "BTDX", "BSD", "BCH", + "BSC", "BTG", "BTC", "BTCTEST", "XBC", @@ -381,6 +384,7 @@ "MEC", "MNX", "MONA", + "MATIC", "MONK", "XMY", "NIX", From daaf25e1a74f873c72ad5087f9da1cd076448d5f Mon Sep 17 00:00:00 2001 From: joxerx Date: Fri, 11 Aug 2023 16:30:25 +0300 Subject: [PATCH 04/10] Add Arbitrum support --- hdwallet/cryptocurrencies.py | 40 ++++++++++++++++++++++++++++++++++++ hdwallet/symbols.py | 3 +++ 2 files changed, 43 insertions(+) diff --git a/hdwallet/cryptocurrencies.py b/hdwallet/cryptocurrencies.py index fde0981..8837c88 100644 --- a/hdwallet/cryptocurrencies.py +++ b/hdwallet/cryptocurrencies.py @@ -2233,6 +2233,46 @@ class PolygonMainnet(Cryptocurrency): WIF_SECRET_KEY = 0x80 +class ArbitrumMainnet(Cryptocurrency): + + NAME = "Arbitrum" + SYMBOL = "ARB1" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/bnb-chain/bsc" + COIN_TYPE = CoinType({ + "INDEX": 9001, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x05 + PUBLIC_KEY_ADDRESS = 0x00 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "bc", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x0488ade4, + "P2SH": 0x0488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x0488b21e, + "P2SH": 0x0488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = None + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + class EuropeCoinMainnet(Cryptocurrency): NAME = "Europe Coin" diff --git a/hdwallet/symbols.py b/hdwallet/symbols.py index 5a30ff2..306449f 100644 --- a/hdwallet/symbols.py +++ b/hdwallet/symbols.py @@ -164,6 +164,8 @@ LYNX = "LYNX" # Polygon MATIC = "MATIC" +# Arbitrum +ARB1 = "ARB1" # Mazacoin MZC = "MZC" # Megacoin @@ -301,6 +303,7 @@ __all__ = [ "ANON", "AGM", + "ARB1", "XAX", "AYA", "AC", From 60e9f9452059bddb250609ebd1dbf80ac6231638 Mon Sep 17 00:00:00 2001 From: joxerx Date: Fri, 11 Aug 2023 16:34:54 +0300 Subject: [PATCH 05/10] Add zkSync support --- hdwallet/cryptocurrencies.py | 40 ++++++++++++++++++++++++++++++++++++ hdwallet/symbols.py | 3 +++ 2 files changed, 43 insertions(+) diff --git a/hdwallet/cryptocurrencies.py b/hdwallet/cryptocurrencies.py index 8837c88..1000d3c 100644 --- a/hdwallet/cryptocurrencies.py +++ b/hdwallet/cryptocurrencies.py @@ -2273,6 +2273,46 @@ class ArbitrumMainnet(Cryptocurrency): WIF_SECRET_KEY = 0x80 +class zkSyncMainnet(Cryptocurrency): + + NAME = "zkSync" + SYMBOL = "ZKS" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/bnb-chain/bsc" + COIN_TYPE = CoinType({ + "INDEX": 324, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x05 + PUBLIC_KEY_ADDRESS = 0x00 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "bc", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x0488ade4, + "P2SH": 0x0488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x0488b21e, + "P2SH": 0x0488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = None + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + class EuropeCoinMainnet(Cryptocurrency): NAME = "Europe Coin" diff --git a/hdwallet/symbols.py b/hdwallet/symbols.py index 306449f..91999ca 100644 --- a/hdwallet/symbols.py +++ b/hdwallet/symbols.py @@ -298,12 +298,15 @@ ZEC, ZECTEST = "ZEC", "ZECTEST" # Zencash ZEN = "ZEN" +# zkSync +ZKS = "ZKS" __all__ = [ "ANON", "AGM", "ARB1", + "ZKS", "XAX", "AYA", "AC", From e596129d7e53e989874e07b9d873a548e20c4a6b Mon Sep 17 00:00:00 2001 From: joxerx Date: Fri, 11 Aug 2023 16:46:05 +0300 Subject: [PATCH 06/10] Add Linea support --- hdwallet/cryptocurrencies.py | 42 +++++++++++++++++++++++++++++++++++- hdwallet/symbols.py | 3 +++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/hdwallet/cryptocurrencies.py b/hdwallet/cryptocurrencies.py index 1000d3c..aa8a83d 100644 --- a/hdwallet/cryptocurrencies.py +++ b/hdwallet/cryptocurrencies.py @@ -2280,7 +2280,47 @@ class zkSyncMainnet(Cryptocurrency): NETWORK = "mainnet" SOURCE_CODE = "https://github.com/bnb-chain/bsc" COIN_TYPE = CoinType({ - "INDEX": 324, + "INDEX": 804, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x05 + PUBLIC_KEY_ADDRESS = 0x00 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "bc", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x0488ade4, + "P2SH": 0x0488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x0488b21e, + "P2SH": 0x0488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = None + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + +class LineaMainnet(Cryptocurrency): + + NAME = "Linea" + SYMBOL = "LINEA" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/bnb-chain/bsc" + COIN_TYPE = CoinType({ + "INDEX": 59144, "HARDENED": True }) diff --git a/hdwallet/symbols.py b/hdwallet/symbols.py index 91999ca..5fc4c06 100644 --- a/hdwallet/symbols.py +++ b/hdwallet/symbols.py @@ -300,11 +300,14 @@ ZEN = "ZEN" # zkSync ZKS = "ZKS" +# Linea +LINEA = "LINEA" __all__ = [ "ANON", "AGM", + "LINEA", "ARB1", "ZKS", "XAX", From 869a8469b338bfe85a6edd0e454969062d54b724 Mon Sep 17 00:00:00 2001 From: Chun Date: Mon, 21 Aug 2023 11:14:35 +0100 Subject: [PATCH 07/10] Update derivations.py --- hdwallet/derivations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hdwallet/derivations.py b/hdwallet/derivations.py index b34a6d4..c7d290d 100644 --- a/hdwallet/derivations.py +++ b/hdwallet/derivations.py @@ -67,7 +67,7 @@ def from_path(cls, path: str) -> "Derivation": >>> from hdwallet.derivations import Derivation >>> derivation = Derivation() - >>> derivation.from_path(path="m/44'/0'/'0/0/0") + >>> derivation.from_path(path="m/44'/0'/0'/0/0") """ @@ -123,9 +123,9 @@ def clean_derivation(self) -> "Derivation": >>> from hdwallet.derivations import Derivation >>> derivation = Derivation() - >>> derivation.from_path(path="m/44'/0'/'0/0/0") + >>> derivation.from_path(path="m/44'/0'/0'/0/0") >>> str(derivation) - "m/44'/0'/'0/0/0" + "m/44'/0'/0'/0/0" >>> derivation.clean_derivation() >>> str(derivation) From e44b76b31bd441efedd022314146c0b130211156 Mon Sep 17 00:00:00 2001 From: Chun Date: Mon, 21 Aug 2023 11:15:35 +0100 Subject: [PATCH 08/10] Update hdwallet.py --- hdwallet/hdwallet.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hdwallet/hdwallet.py b/hdwallet/hdwallet.py index a66ac84..8b12dcb 100644 --- a/hdwallet/hdwallet.py +++ b/hdwallet/hdwallet.py @@ -437,7 +437,7 @@ def from_path(self, path: Union[str, Derivation]) -> "HDWallet": >>> from hdwallet.symbols import BTC >>> hdwallet = HDWallet(symbol=BTC) >>> hdwallet.from_xprivate_key(xprivate_key="xprv9s21ZrQH143K3xPGUzpogJeKtRdjHkK6muBJo8v7rEVRzT83xJgNcLpMoJXUf9wJFKfuHR4SGvfgdShh4t9VmjjrE9usBunK3LfNna31LGF") - >>> hdwallet.from_path(path="m/44'/0'/'0/0/0") + >>> hdwallet.from_path(path="m/44'/0'/0'/0/0") """ @@ -598,7 +598,7 @@ def root_xprivate_key(self, encoded: bool = True) -> Optional[str]: >>> from hdwallet.symbols import BTC >>> hdwallet = HDWallet(symbol=BTC) >>> hdwallet.from_entropy(entropy="ee535b143b0d9d1f87546f9df0d06b1a") - >>> hdwallet.from_path(path="m/44'/0'/'0/0/0") + >>> hdwallet.from_path(path="m/44'/0'/0'/0/0") >>> hdwallet.root_xprivate_key() "xprv9s21ZrQH143K3xPGUzpogJeKtRdjHkK6muBJo8v7rEVRzT83xJgNcLpMoJXUf9wJFKfuHR4SGvfgdShh4t9VmjjrE9usBunK3LfNna31LGF" """ @@ -636,7 +636,7 @@ def root_xpublic_key(self, encoded: bool = True) -> Optional[str]: >>> from hdwallet.symbols import BTC >>> hdwallet = HDWallet(symbol=BTC) >>> hdwallet.from_entropy(entropy="ee535b143b0d9d1f87546f9df0d06b1a") - >>> hdwallet.from_path(path="m/44'/0'/'0/0/0") + >>> hdwallet.from_path(path="m/44'/0'/0'/0/0") >>> hdwallet.root_xpublic_key() "xpub661MyMwAqRbcGSTjb2Mp3Sb4STUDhD2x986ubXKjQa2QsFTCVqzdA98qeZjcncHT1AaZcMSjiP1HJ16jH97q72RwyFfiNhmG8zQ6KBB5PaQ" """ @@ -679,7 +679,7 @@ def xprivate_key(self, encoded=True) -> Optional[str]: >>> from hdwallet.symbols import BTC >>> hdwallet = HDWallet(symbol=BTC) >>> hdwallet.from_entropy(entropy="ee535b143b0d9d1f87546f9df0d06b1a") - >>> hdwallet.from_path(path="m/44'/0'/'0/0/0") + >>> hdwallet.from_path(path="m/44'/0'/0'/0/0") >>> hdwallet.xprivate_key() "xprvA3BYGWQ9FmhyaNRRXB2f1LphNPnaY9T6gngw4BaTbkFtscSH4RCuJhgWUSKs9S6ciGioHd4TX4UeyUg53MkfN9Xh38xkS1j2Wb9YKsYpJHQ" """ @@ -717,7 +717,7 @@ def xpublic_key(self, encoded: bool = True) -> Optional[str]: >>> from hdwallet.symbols import BTC >>> hdwallet = HDWallet(symbol=BTC) >>> hdwallet.from_entropy(entropy="ee535b143b0d9d1f87546f9df0d06b1a") - >>> hdwallet.from_path(path="m/44'/0'/'0/0/0") + >>> hdwallet.from_path(path="m/44'/0'/0'/0/0") >>> hdwallet.xpublic_key() "xpub6GAtg1w369GGnrVtdCZfNUmRvRd4wcAx41cXrZz5A5nskQmRbxX9rVzzKiRU4JruirBrfm4KQXNSU7GfqL1tzZWpZYe9Zo4xKGJYohWoQe7" """ @@ -750,9 +750,9 @@ def clean_derivation(self) -> "HDWallet": >>> from hdwallet.symbols import BTC >>> hdwallet = HDWallet(symbol=BTC) >>> hdwallet.from_xprivate_key(xprivate_key="xprv9s21ZrQH143K3xPGUzpogJeKtRdjHkK6muBJo8v7rEVRzT83xJgNcLpMoJXUf9wJFKfuHR4SGvfgdShh4t9VmjjrE9usBunK3LfNna31LGF") - >>> hdwallet.from_path(path="m/44'/0'/'0/0/0") + >>> hdwallet.from_path(path="m/44'/0'/0'/0/0") >>> hdwallet.path() - "m/44'/0'/'0/0/0" + "m/44'/0'/0'/0/0" >>> hdwallet.clean_derivation() >>> hdwallet.path() From 0840b130f6fc0792c3f4bb4d516fe79aaa097ca4 Mon Sep 17 00:00:00 2001 From: Perry Kundert Date: Mon, 4 Nov 2024 17:20:01 -0700 Subject: [PATCH 09/10] Update requirements, packaging --- .gitignore | 2 ++ GNUmakefile | 39 ++++++++++++++++---------- MANIFEST.in | 3 +- default.nix | 62 ++++++++++++++++++++++++++++++++++++++++++ hdwallet/__init__.py | 6 +++- hdwallet/version.py | 2 ++ nixpkgs.nix | 4 +++ requirements-cli.txt | 3 ++ requirements-dev.txt | 4 +++ requirements-docs.txt | 3 ++ requirements-tests.txt | 3 ++ requirements.txt | 8 +++--- setup.py | 46 +++++++++++++++---------------- shell.nix | 19 +++++++++++++ 14 files changed, 159 insertions(+), 45 deletions(-) create mode 100644 default.nix create mode 100644 hdwallet/version.py create mode 100644 nixpkgs.nix create mode 100644 requirements-cli.txt create mode 100644 requirements-dev.txt create mode 100644 requirements-docs.txt create mode 100644 requirements-tests.txt create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore index 5d8f3a2..022fb51 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ __pycache__/ # py.test stuff .pytest_cache/ +*~ +.#* diff --git a/GNUmakefile b/GNUmakefile index 73be7d4..3b423f5 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,10 +1,17 @@ SHELL = /bin/bash PY3 ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python ) -VERSION = $(shell $(PY3) -c 'from hdwallet import __version__; print( __version__.strip("v"))') +PY3_V = $(shell $(PY3) -c "import sys; print('-'.join((next(iter(filter(None,sys.executable.split('/')))),sys.platform,sys.implementation.cache_tag)))" 2>/dev/null ) +VERSION = $(shell $(PY3) -c 'exec(open("hdwallet/version.py", "r").read()); print( __version__.strip("v"))') WHEEL = dist/hdwallet-$(VERSION)-py3-none-any.whl PY3TEST = $(PY3) -m pytest +GHUB_NAME = python-hdwallet +VENV_DIR = $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/.. ) +VENV_NAME = $(GHUB_NAME)-$(VERSION)-$(PY3_V) +VENV = $(VENV_DIR)/$(VENV_NAME) +VENV_OPTS = + .PHONY: all test build build-check wheel install-dev install clean FORCE all: build @@ -19,28 +26,30 @@ test-%: unit-%: $(PY3TEST) -k $* -build: clean wheel +nix-%: + nix-shell --pure --run "make $*" -build-check: - @$(PY3) -m build --version \ - || ( \ - echo -e "\n\n!!! Missing Python modules; run:"; \ - echo -e "\n\n $(PY3) -m pip install --upgrade pip setuptools wheel build\n"; \ - false; \ - ) +build: clean wheel wheel: $(WHEEL) -$(WHEEL): build-check FORCE +$(WHEEL): FORCE + $(PY3) -m pip install -r requirements-dev.txt $(PY3) -m build @ls -last dist -# Install from wheel, including all optional extra dependencies (except dev) -install-dev: $(WHEEL) FORCE - $(PY3) -m pip install --upgrade $<[tests] - install: $(WHEEL) FORCE - $(PY3) -m pip install --force-reinstall $<[cli,docs] + $(PY3) -m pip install --force-reinstall .[cli,docs] clean: @rm -rf build dist *.egg-info $(shell find . -name '__pycache__' ) + +venv: $(VENV) + @echo; echo "*** Activating $< VirtualEnv for Interactive $(SHELL)" + @bash --init-file $=8.1.3,<9 +click-aliases >=1.0.1,<2 +tabulate >=0.9.0,<1 diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..bc210ec --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +build +packaging +setuptools +wheel diff --git a/requirements-docs.txt b/requirements-docs.txt new file mode 100644 index 0000000..c77b246 --- /dev/null +++ b/requirements-docs.txt @@ -0,0 +1,3 @@ +sphinx >=5.3.0,<6 +furo ==2022.12.7 +sphinx-click >=4.4.0,<5 diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 0000000..7f50a1f --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1,3 @@ +pytest >=7.2.0,<8 +pytest-cov >=4.0.0,<5 +tox ==3.28.0 diff --git a/requirements.txt b/requirements.txt index 5887f80..ad55168 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -ecdsa>=0.13,<1 -mnemonic>=0.19,<1 -pycryptodome>=3.15,<4 -base58>=2.0.1,<3 +ecdsa >=0.19.0,<1 +mnemonic >=0.21,<1 +pycryptodome >=3.21,<4 +base58 >=2.1.1,<3 diff --git a/setup.py b/setup.py index 728237b..476f465 100644 --- a/setup.py +++ b/setup.py @@ -11,16 +11,27 @@ } # README.md -with open("README.md", "r", encoding="utf-8") as readme: +with open( "README.md", "r", encoding="utf-8") as readme: long_description: str = readme.read() - -# requirements.txt -with open("requirements.txt", "r") as _requirements: - requirements: list = list(map(str.strip, _requirements.read().split("\n"))) +with open( "requirements.txt" ) as r: + install_requires: list = list( r.readlines() ) +with open( "requirements-tests.txt" ) as rt: + tests_require: list = list( rt.readlines() ) +extras_require: dict = { + option: list( + # Remove whitespace, elide blank lines and comments + ''.join( r.split() ) + for r in open( f"requirements-{option}.txt" ).readlines() + if r.strip() and not r.strip().startswith( '#' ) + ) + for option in ('cli', 'tests', 'docs') +} +with open( "hdwallet/version.py" ) as vpy: + exec( vpy.read() ) setup( name="hdwallet", - version="v2.2.1", + version=__version__, description="Python-based library for the implementation of a hierarchical deterministic wallet " "generator for more than 140+ multiple cryptocurrencies.", long_description=long_description, @@ -38,24 +49,9 @@ }, python_requires=">=3.6,<4", packages=find_packages(), - install_requires=requirements, - extras_require={ - "cli": [ - "click>=8.1.3,<9", - "click-aliases>=1.0.1,<2", - "tabulate>=0.9.0,<1" - ], - "tests": [ - "pytest>=7.2.0,<8", - "pytest-cov>=4.0.0,<5", - "tox==3.28.0" - ], - "docs": [ - "sphinx>=5.3.0,<6", - "furo==2022.12.7", - "sphinx-click>=4.4.0,<5" - ] - }, + install_requires=install_requires, + extras_require=extras_require, + tests_require=tests_require, classifiers=[ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: ISC License (ISCL)", @@ -64,6 +60,8 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries :: Python Modules" ] ) diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..aab28b3 --- /dev/null +++ b/shell.nix @@ -0,0 +1,19 @@ +{ pkgs ? import ./nixpkgs.nix {} }: + +let + targets = import ./default.nix { + inherit pkgs; + }; + targeted = builtins.getEnv "TARGET"; + selected = targeted + pkgs.lib.optionalString (targeted == "") "py312"; +in + +with pkgs; + +mkShell { + buildInputs = lib.getAttrFromPath [ selected "buildInputs" ] targets; + + shellHook = '' + echo "Welcome to the Python ${selected} environment!" + ''; +} From b92f0a61920b25c7f38fa1bca3cc7d820f80a2d2 Mon Sep 17 00:00:00 2001 From: Perry Kundert Date: Tue, 5 Nov 2024 07:25:08 -0700 Subject: [PATCH 10/10] Test on python 3.12, 3.13, remove 3.7 --- .github/workflows/pythonpackage.yml | 2 +- hdwallet/version.py | 2 +- setup.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index eceed53..1cfa1af 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: python-version: [ - "3.7", "3.8", "3.9", "3.10", "3.11" + "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] steps: - uses: actions/checkout@master diff --git a/hdwallet/version.py b/hdwallet/version.py index 942a546..f934d45 100644 --- a/hdwallet/version.py +++ b/hdwallet/version.py @@ -1,2 +1,2 @@ -__version_info__ = ( 2, 2, 0 ) +__version_info__ = ( 2, 3, 0 ) __version__ = 'v' + '.'.join( map( str, __version_info__ )) diff --git a/setup.py b/setup.py index 476f465..7990ca8 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,6 @@ classifiers=[ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: ISC License (ISCL)", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10",