diff --git a/core/src/apps/cardano/address.py b/core/src/apps/cardano/address.py index e8f9ce32a..dcb1e9fe4 100644 --- a/core/src/apps/cardano/address.py +++ b/core/src/apps/cardano/address.py @@ -1,5 +1,3 @@ -from micropython import const - from trezor import wire from trezor.crypto import base58, hashlib from trezor.messages import CardanoAddressParametersType, CardanoAddressType @@ -331,8 +329,3 @@ def _derive_reward_address( staking_key_hash = get_public_key_hash(keychain, path) return header + staking_key_hash - - -def to_account_path(path: List[int]) -> List[int]: - ACCOUNT_PATH_LENGTH = const(3) - return path[:ACCOUNT_PATH_LENGTH] diff --git a/core/src/apps/cardano/get_address.py b/core/src/apps/cardano/get_address.py index b4ded740f..622569f6d 100644 --- a/core/src/apps/cardano/get_address.py +++ b/core/src/apps/cardano/get_address.py @@ -5,8 +5,9 @@ from apps.common import paths from apps.common.layout import address_n_to_str, show_qr from . import CURVE, seed -from .address import derive_human_readable_address, to_account_path, validate_full_path +from .address import derive_human_readable_address, validate_full_path from .helpers import protocol_magics, staking_use_cases +from .helpers.utils import to_account_path from .layout import ( show_address, show_warning_address_foreign_staking_key, diff --git a/core/src/apps/cardano/helpers/staking_use_cases.py b/core/src/apps/cardano/helpers/staking_use_cases.py index 10a23d2cc..e48938850 100644 --- a/core/src/apps/cardano/helpers/staking_use_cases.py +++ b/core/src/apps/cardano/helpers/staking_use_cases.py @@ -1,7 +1,8 @@ from trezor.messages import CardanoAddressType -from ..address import get_public_key_hash, to_account_path, validate_full_path +from ..address import get_public_key_hash, validate_full_path from ..seed import is_shelley_path +from .utils import to_account_path if False: from typing import List diff --git a/core/src/apps/cardano/helpers/utils.py b/core/src/apps/cardano/helpers/utils.py index f0e872765..dd4b1378d 100644 --- a/core/src/apps/cardano/helpers/utils.py +++ b/core/src/apps/cardano/helpers/utils.py @@ -1,3 +1,6 @@ +from micropython import const + + def variable_length_encode(number: int) -> bytes: """ Used for pointer encoding in pointer address. @@ -18,3 +21,8 @@ def variable_length_encode(number: int) -> bytes: encoded.insert(0, (number & 127) + 128) return bytes(encoded) + + +def to_account_path(path: List[int]) -> List[int]: + ACCOUNT_PATH_LENGTH = const(3) + return path[:ACCOUNT_PATH_LENGTH] diff --git a/core/src/apps/cardano/sign_tx.py b/core/src/apps/cardano/sign_tx.py index eae078467..820e1d36e 100644 --- a/core/src/apps/cardano/sign_tx.py +++ b/core/src/apps/cardano/sign_tx.py @@ -15,12 +15,12 @@ from .address import ( derive_address_bytes, derive_human_readable_address, get_address_bytes_unsafe, - to_account_path, validate_full_path, validate_output_address, ) from .byron_address import get_address_attributes from .helpers import network_ids, protocol_magics, staking_use_cases +from .helpers.utils import to_account_path from .layout import ( confirm_sending, confirm_transaction,