Skip to content

Commit 8a06c0f

Browse files
committed
Add: wif_prefix parameter on init HD class
1 parent 136473f commit 8a06c0f

File tree

5 files changed

+45
-17
lines changed

5 files changed

+45
-17
lines changed

clients/bip32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# Initialize BIP32 HD
3939
bip32_hd: BIP32HD = BIP32HD(
40-
ecc=Cryptocurrency.ECC
40+
ecc=Cryptocurrency.ECC, wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX
4141
)
4242
# Update BIP32 HD root keys from seed
4343
bip32_hd.from_seed(

clients/bip44.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
)
99
from hdwallet.seeds.bip39 import BIP39Seed
1010
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
11-
from hdwallet.derivations import BIP44Derivation
11+
from hdwallet.derivations import (
12+
BIP44Derivation, CHANGES
13+
)
1214
from hdwallet.hds import BIP44HD
1315

1416

@@ -37,7 +39,12 @@
3739

3840
# Initialize BIP44 HD
3941
bip44_hd: BIP44HD = BIP44HD(
40-
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
42+
ecc=Cryptocurrency.ECC,
43+
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
44+
coin_type=Cryptocurrency.COIN_TYPE,
45+
account=0,
46+
change=CHANGES.EXTERNAL_CHAIN,
47+
address=0
4148
)
4249
# Update BIP44 HD root keys from seed
4350
bip44_hd.from_seed(
@@ -57,7 +64,7 @@
5764
coin_type=Cryptocurrency.COIN_TYPE
5865
)
5966
bip44_derivation.from_account(account=0)
60-
bip44_derivation.from_change(change="internal-chain")
67+
bip44_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
6168
bip44_derivation.from_address(address=0)
6269

6370
# Update current BIP44 HD derivation
@@ -67,7 +74,7 @@
6774
# Or update current BIP44 HD derivation by changing indexes
6875
# bip44_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
6976
# bip44_hd.from_account(account=0)
70-
# bip44_hd.from_change(change="internal-chain")
77+
# bip44_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
7178
# bip44_hd.from_address(address=0)
7279

7380
# Dump derived keys

clients/bip49.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
)
99
from hdwallet.seeds.bip39 import BIP39Seed
1010
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
11-
from hdwallet.derivations import BIP49Derivation
11+
from hdwallet.derivations import (
12+
BIP49Derivation, CHANGES
13+
)
1214
from hdwallet.hds import BIP49HD
1315

1416

@@ -37,7 +39,12 @@
3739

3840
# Initialize BIP49 HD
3941
bip49_hd: BIP49HD = BIP49HD(
40-
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
42+
ecc=Cryptocurrency.ECC,
43+
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
44+
coin_type=Cryptocurrency.COIN_TYPE,
45+
account=0,
46+
change=CHANGES.EXTERNAL_CHAIN,
47+
address=0
4148
)
4249
# Update BIP49 HD root keys from seed
4350
bip49_hd.from_seed(
@@ -57,7 +64,7 @@
5764
coin_type=Cryptocurrency.COIN_TYPE
5865
)
5966
bip49_derivation.from_account(account=0)
60-
bip49_derivation.from_change(change="internal-chain")
67+
bip49_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
6168
bip49_derivation.from_address(address=0)
6269

6370
# Update current BIP49 HD derivation
@@ -67,7 +74,7 @@
6774
# Or update current BIP49 HD derivation by changing indexes
6875
# bip49_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
6976
# bip49_hd.from_account(account=0)
70-
# bip49_hd.from_change(change="internal-chain")
77+
# bip49_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
7178
# bip49_hd.from_address(address=0)
7279

7380
# Dump derived keys

clients/bip84.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
)
99
from hdwallet.seeds.bip39 import BIP39Seed
1010
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
11-
from hdwallet.derivations import BIP84Derivation
11+
from hdwallet.derivations import (
12+
BIP84Derivation, CHANGES
13+
)
1214
from hdwallet.hds import BIP84HD
1315

1416

@@ -37,7 +39,12 @@
3739

3840
# Initialize BIP84 HD
3941
bip84_hd: BIP84HD = BIP84HD(
40-
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
42+
ecc=Cryptocurrency.ECC,
43+
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
44+
coin_type=Cryptocurrency.COIN_TYPE,
45+
account=0,
46+
change=CHANGES.EXTERNAL_CHAIN,
47+
address=0
4148
)
4249
# Update BIP84 HD root keys from seed
4350
bip84_hd.from_seed(
@@ -57,7 +64,7 @@
5764
coin_type=Cryptocurrency.COIN_TYPE
5865
)
5966
bip84_derivation.from_account(account=0)
60-
bip84_derivation.from_change(change="internal-chain")
67+
bip84_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
6168
bip84_derivation.from_address(address=0)
6269

6370
# Update current BIP84 HD derivation
@@ -67,7 +74,7 @@
6774
# Or update current BIP84 HD derivation by changing indexes
6875
# bip84_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
6976
# bip84_hd.from_account(account=0)
70-
# bip84_hd.from_change(change="internal-chain")
77+
# bip84_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
7178
# bip84_hd.from_address(address=0)
7279

7380
# Dump derived keys

clients/bip86.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
)
99
from hdwallet.seeds.bip39 import BIP39Seed
1010
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
11-
from hdwallet.derivations import BIP86Derivation
11+
from hdwallet.derivations import (
12+
BIP86Derivation, CHANGES
13+
)
1214
from hdwallet.hds import BIP86HD
1315

1416

@@ -37,7 +39,12 @@
3739

3840
# Initialize BIP86 HD
3941
bip86_hd: BIP86HD = BIP86HD(
40-
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
42+
ecc=Cryptocurrency.ECC,
43+
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
44+
coin_type=Cryptocurrency.COIN_TYPE,
45+
account=0,
46+
change=CHANGES.EXTERNAL_CHAIN,
47+
address=0
4148
)
4249
# Update BIP86 HD root keys from seed
4350
bip86_hd.from_seed(
@@ -57,7 +64,7 @@
5764
coin_type=Cryptocurrency.COIN_TYPE
5865
)
5966
bip86_derivation.from_account(account=0)
60-
bip86_derivation.from_change(change="external-chain")
67+
bip86_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
6168
bip86_derivation.from_address(address=1)
6269

6370
# Update current BIP86 HD derivation
@@ -67,7 +74,7 @@
6774
# Or update current BIP86 HD derivation by changing indexes
6875
# bip86_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
6976
# bip86_hd.from_account(account=0)
70-
# bip86_hd.from_change(change="internal-chain")
77+
# bip86_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
7178
# bip86_hd.from_address(address=0)
7279

7380
# Dump derived keys

0 commit comments

Comments
 (0)