1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

Move to_account_path() to utils

This commit is contained in:
gabrielkerekes 2020-07-27 10:32:31 +02:00 committed by Pavol Rusnak
parent e92baf5b02
commit a25444efd1
5 changed files with 13 additions and 10 deletions

View File

@ -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]

View File

@ -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,

View File

@ -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

View File

@ -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]

View File

@ -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,