Skip to content

Commit 7b1645d

Browse files
committed
Merge branch 'skrtdev-master'
2 parents 051c00d + 64a18c8 commit 7b1645d

3 files changed

Lines changed: 38 additions & 41 deletions

File tree

bitcoinutils/hdwallet.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
from typing import Optional
1313

1414
from hdwallet import HDWallet as ext_HDWallet # type: ignore
15-
from hdwallet.symbols import BTC, BTCTEST # type: ignore
15+
from hdwallet.cryptocurrencies import Bitcoin
16+
from hdwallet.derivations import CustomDerivation
17+
from hdwallet.hds import BIP32HD
18+
from hdwallet.mnemonics import BIP39Mnemonic
1619

1720
from bitcoinutils.setup import is_mainnet
1821
from bitcoinutils.keys import PrivateKey
@@ -40,20 +43,14 @@ def __init__(
4043
):
4144
"""Instantiate a hdwallet object using the corresponding library with BTC"""
4245

43-
symbol = None
44-
if is_mainnet():
45-
symbol = BTC
46-
else:
47-
symbol = BTCTEST
48-
49-
self.hdw = ext_HDWallet(symbol)
46+
self.hdw = ext_HDWallet(cryptocurrency=Bitcoin, network='mainnet' if is_mainnet() else 'testnet', hd=BIP32HD)
5047

5148
if mnemonic:
52-
self.hdw.from_mnemonic(mnemonic=mnemonic)
49+
self.hdw.from_mnemonic(mnemonic=BIP39Mnemonic(mnemonic=mnemonic))
5350

5451
if xprivate_key and path:
5552
self.hdw.from_xprivate_key(xprivate_key=xprivate_key)
56-
self.hdw.from_path(path=path)
53+
self.hdw.from_derivation(CustomDerivation(path))
5754

5855
@classmethod
5956
def from_mnemonic(cls, mnemonic: str):
@@ -72,7 +69,7 @@ def from_path(self, path: str):
7269
"""Set/update the path"""
7370

7471
self.hdw.clean_derivation() # type: ignore
75-
self.hdw.from_path(path=path)
72+
self.hdw.from_derivation(CustomDerivation(path))
7673

7774
def get_private_key(self):
7875
"""Return a PrivateKey object used throughout bitcoinutils library"""

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
base58check>=1.0.2,<2.0
2-
ecdsa==0.18.0
2+
ecdsa==0.19.0
33
sympy>=1.2,<2.0
44
python-bitcoinrpc>=1.0,<2.0
5-
hdwallet==2.2.1
5+
hdwallet~=3.0

setup.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
from setuptools import setup
22
from bitcoinutils import __version__
33

4-
#with open('requirements.txt') as f:
4+
# with open('requirements.txt') as f:
55
# requirements = f.read().splitlines()
66

7-
#install_reqs = parse_requirements('requirements.txt', session=False)
8-
#requirements = [str(ir.req) for ir in install_reqs]
7+
# install_reqs = parse_requirements('requirements.txt', session=False)
8+
# requirements = [str(ir.req) for ir in install_reqs]
99

10-
with open('README.rst') as readme:
10+
with open("README.rst") as readme:
1111
long_description = readme.read()
1212

13-
setup(name='bitcoin-utils',
14-
version=__version__,
15-
description='Bitcoin utility functions',
16-
long_description=long_description,
17-
author='Konstantinos Karasavvas',
18-
author_email='kkarasavvas@gmail.com',
19-
url='https://github.com/karask/python-bitcoin-utils',
20-
license='MIT',
21-
keywords='bitcoin library utilities tools',
22-
install_requires=[
23-
'base58check>=1.0.2,<2.0',
24-
'ecdsa==0.18.0',
25-
'sympy>=1.2,<2.0',
26-
'python-bitcoinrpc>=1.0,<2.0',
27-
'hdwallet==2.2.1'
28-
],
29-
packages=['bitcoinutils'],
30-
#package_data={
31-
# 'bitcoinutils': ['requirements.txt']
32-
#},
33-
#include_package_data=True,
34-
zip_safe=False
35-
)
36-
13+
setup(
14+
name="bitcoin-utils",
15+
version=__version__,
16+
description="Bitcoin utility functions",
17+
long_description=long_description,
18+
author="Konstantinos Karasavvas",
19+
author_email="kkarasavvas@gmail.com",
20+
url="https://github.com/karask/python-bitcoin-utils",
21+
license="MIT",
22+
keywords="bitcoin library utilities tools",
23+
install_requires=[
24+
"base58check>=1.0.2,<2.0",
25+
"ecdsa==0.19.0",
26+
"sympy>=1.2,<2.0",
27+
"python-bitcoinrpc>=1.0,<2.0",
28+
"hdwallet~=3.0",
29+
],
30+
packages=["bitcoinutils"],
31+
# package_data={
32+
# 'bitcoinutils': ['requirements.txt']
33+
# },
34+
# include_package_data=True,
35+
zip_safe=False,
36+
)

0 commit comments

Comments
 (0)