Skip to content

Commit

Permalink
Add: wif_prefix parameter on init HD class
Browse files Browse the repository at this point in the history
  • Loading branch information
meherett committed Dec 15, 2024
1 parent 136473f commit 8a06c0f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
2 changes: 1 addition & 1 deletion clients/bip32.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

# Initialize BIP32 HD
bip32_hd: BIP32HD = BIP32HD(
ecc=Cryptocurrency.ECC
ecc=Cryptocurrency.ECC, wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX
)
# Update BIP32 HD root keys from seed
bip32_hd.from_seed(
Expand Down
15 changes: 11 additions & 4 deletions clients/bip44.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
)
from hdwallet.seeds.bip39 import BIP39Seed
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
from hdwallet.derivations import BIP44Derivation
from hdwallet.derivations import (
BIP44Derivation, CHANGES
)
from hdwallet.hds import BIP44HD


Expand Down Expand Up @@ -37,7 +39,12 @@

# Initialize BIP44 HD
bip44_hd: BIP44HD = BIP44HD(
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
ecc=Cryptocurrency.ECC,
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
coin_type=Cryptocurrency.COIN_TYPE,
account=0,
change=CHANGES.EXTERNAL_CHAIN,
address=0
)
# Update BIP44 HD root keys from seed
bip44_hd.from_seed(
Expand All @@ -57,7 +64,7 @@
coin_type=Cryptocurrency.COIN_TYPE
)
bip44_derivation.from_account(account=0)
bip44_derivation.from_change(change="internal-chain")
bip44_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
bip44_derivation.from_address(address=0)

# Update current BIP44 HD derivation
Expand All @@ -67,7 +74,7 @@
# Or update current BIP44 HD derivation by changing indexes
# bip44_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
# bip44_hd.from_account(account=0)
# bip44_hd.from_change(change="internal-chain")
# bip44_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
# bip44_hd.from_address(address=0)

# Dump derived keys
Expand Down
15 changes: 11 additions & 4 deletions clients/bip49.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
)
from hdwallet.seeds.bip39 import BIP39Seed
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
from hdwallet.derivations import BIP49Derivation
from hdwallet.derivations import (
BIP49Derivation, CHANGES
)
from hdwallet.hds import BIP49HD


Expand Down Expand Up @@ -37,7 +39,12 @@

# Initialize BIP49 HD
bip49_hd: BIP49HD = BIP49HD(
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
ecc=Cryptocurrency.ECC,
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
coin_type=Cryptocurrency.COIN_TYPE,
account=0,
change=CHANGES.EXTERNAL_CHAIN,
address=0
)
# Update BIP49 HD root keys from seed
bip49_hd.from_seed(
Expand All @@ -57,7 +64,7 @@
coin_type=Cryptocurrency.COIN_TYPE
)
bip49_derivation.from_account(account=0)
bip49_derivation.from_change(change="internal-chain")
bip49_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
bip49_derivation.from_address(address=0)

# Update current BIP49 HD derivation
Expand All @@ -67,7 +74,7 @@
# Or update current BIP49 HD derivation by changing indexes
# bip49_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
# bip49_hd.from_account(account=0)
# bip49_hd.from_change(change="internal-chain")
# bip49_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
# bip49_hd.from_address(address=0)

# Dump derived keys
Expand Down
15 changes: 11 additions & 4 deletions clients/bip84.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
)
from hdwallet.seeds.bip39 import BIP39Seed
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
from hdwallet.derivations import BIP84Derivation
from hdwallet.derivations import (
BIP84Derivation, CHANGES
)
from hdwallet.hds import BIP84HD


Expand Down Expand Up @@ -37,7 +39,12 @@

# Initialize BIP84 HD
bip84_hd: BIP84HD = BIP84HD(
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
ecc=Cryptocurrency.ECC,
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
coin_type=Cryptocurrency.COIN_TYPE,
account=0,
change=CHANGES.EXTERNAL_CHAIN,
address=0
)
# Update BIP84 HD root keys from seed
bip84_hd.from_seed(
Expand All @@ -57,7 +64,7 @@
coin_type=Cryptocurrency.COIN_TYPE
)
bip84_derivation.from_account(account=0)
bip84_derivation.from_change(change="internal-chain")
bip84_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
bip84_derivation.from_address(address=0)

# Update current BIP84 HD derivation
Expand All @@ -67,7 +74,7 @@
# Or update current BIP84 HD derivation by changing indexes
# bip84_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
# bip84_hd.from_account(account=0)
# bip84_hd.from_change(change="internal-chain")
# bip84_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
# bip84_hd.from_address(address=0)

# Dump derived keys
Expand Down
15 changes: 11 additions & 4 deletions clients/bip86.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
)
from hdwallet.seeds.bip39 import BIP39Seed
from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency
from hdwallet.derivations import BIP86Derivation
from hdwallet.derivations import (
BIP86Derivation, CHANGES
)
from hdwallet.hds import BIP86HD


Expand Down Expand Up @@ -37,7 +39,12 @@

# Initialize BIP86 HD
bip86_hd: BIP86HD = BIP86HD(
ecc=Cryptocurrency.ECC, coin_type=Cryptocurrency.COIN_TYPE, account=0, change="external-chain", address=0
ecc=Cryptocurrency.ECC,
wif_prefix=Cryptocurrency.NETWORKS.MAINNET.WIF_PREFIX,
coin_type=Cryptocurrency.COIN_TYPE,
account=0,
change=CHANGES.EXTERNAL_CHAIN,
address=0
)
# Update BIP86 HD root keys from seed
bip86_hd.from_seed(
Expand All @@ -57,7 +64,7 @@
coin_type=Cryptocurrency.COIN_TYPE
)
bip86_derivation.from_account(account=0)
bip86_derivation.from_change(change="external-chain")
bip86_derivation.from_change(change=CHANGES.INTERNAL_CHAIN)
bip86_derivation.from_address(address=1)

# Update current BIP86 HD derivation
Expand All @@ -67,7 +74,7 @@
# Or update current BIP86 HD derivation by changing indexes
# bip86_hd.from_coin_type(coin_type=Cryptocurrency.COIN_TYPE)
# bip86_hd.from_account(account=0)
# bip86_hd.from_change(change="internal-chain")
# bip86_hd.from_change(change=CHANGES.INTERNAL_CHAIN)
# bip86_hd.from_address(address=0)

# Dump derived keys
Expand Down

0 comments on commit 8a06c0f

Please sign in to comment.