From 88c13a77c5c2204d8ed862f250e91d86772465f1 Mon Sep 17 00:00:00 2001 From: BlackcoinDev Date: Thu, 26 Sep 2024 16:39:38 +0200 Subject: [PATCH] Use Blackcoin variables --- blackcoinutils/constants.py | 2 +- blackcoinutils/hdwallet.py | 8 ++++---- blackcoinutils/utils.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blackcoinutils/constants.py b/blackcoinutils/constants.py index 7134952..8b94efc 100644 --- a/blackcoinutils/constants.py +++ b/blackcoinutils/constants.py @@ -86,7 +86,7 @@ # Monetary constants -SATOSHIS_PER_BITCOIN = 100000000 +SATOSHIS_PER_BLACKCOIN = 100000000 NEGATIVE_SATOSHI = -1 # Block diff --git a/blackcoinutils/hdwallet.py b/blackcoinutils/hdwallet.py index 9129380..9386753 100644 --- a/blackcoinutils/hdwallet.py +++ b/blackcoinutils/hdwallet.py @@ -13,7 +13,7 @@ from typing import Optional from hdwallet import HDWallet as ext_HDWallet # type: ignore -from hdwallet.symbols import BTC, BTCTEST # type: ignore +from hdwallet.symbols import BLK, BLKTEST # type: ignore from blackcoinutils.setup import is_mainnet from blackcoinutils.keys import PrivateKey @@ -39,13 +39,13 @@ def __init__( path: Optional[str] = None, mnemonic: Optional[str] = None, ): - """Instantiate a hdwallet object using the corresponding library with BTC""" + """Instantiate a hdwallet object using the corresponding library with BLK""" symbol = None if is_mainnet(): - symbol = BTC + symbol = BLK else: - symbol = BTCTEST + symbol = BLKTEST self.hdw = ext_HDWallet(symbol) diff --git a/blackcoinutils/utils.py b/blackcoinutils/utils.py index a339c11..29c92c7 100644 --- a/blackcoinutils/utils.py +++ b/blackcoinutils/utils.py @@ -21,7 +21,7 @@ import hashlib from ecdsa import ellipticcurve # type: ignore -from blackcoinutils.constants import SATOSHIS_PER_BITCOIN, LEAF_VERSION_TAPSCRIPT +from blackcoinutils.constants import SATOSHIS_PER_BLACKCOIN, LEAF_VERSION_TAPSCRIPT from blackcoinutils.schnorr import full_pubkey_gen, point_add, point_mul, G import struct @@ -179,7 +179,7 @@ def to_satoshis(num: int | float | Decimal): """ # we need to round because of how floats are stored internally: # e.g. 0.29 * 100000000 = 28999999.999999996 - return int(round(num * SATOSHIS_PER_BITCOIN)) + return int(round(num * SATOSHIS_PER_BLACKCOIN)) def prepend_compact_size(data: bytes) -> bytes: