refactor(core): remove more global imports

pull/1610/head
matejcik 3 years ago committed by matejcik
parent 2cb379108c
commit f1a54f2108

@ -2,9 +2,8 @@ from trezor import wire
from trezor.messages import InputScriptType
from trezor.messages.HDNodeType import HDNodeType
from trezor.messages.PublicKey import PublicKey
from trezor.ui.layouts import show_xpub
from apps.common import coins, paths
from apps.common import coininfo, paths
from apps.common.keychain import get_keychain
if False:
@ -14,7 +13,7 @@ if False:
async def get_public_key(ctx: wire.Context, msg: GetPublicKey) -> PublicKey:
coin_name = msg.coin_name or "Bitcoin"
script_type = msg.script_type or InputScriptType.SPENDADDRESS
coin = coins.by_name(coin_name)
coin = coininfo.by_name(coin_name)
curve_name = msg.ecdsa_curve_name or coin.curve_name
keychain = await get_keychain(ctx, curve_name, [paths.AlwaysMatchingSchema])
@ -59,6 +58,8 @@ async def get_public_key(ctx: wire.Context, msg: GetPublicKey) -> PublicKey:
)
if msg.show_display:
from trezor.ui.layouts import show_xpub
await show_xpub(ctx, node_xpub, "XPUB", "Cancel")
return PublicKey(

@ -1,8 +1,4 @@
from trezor.ui.constants import MONO_CHARS_PER_LINE
from trezor.ui.layouts import confirm_path_warning
from . import HARDENED
from .layout import address_n_to_str
if False:
from typing import (
@ -326,6 +322,9 @@ async def validate_path(
async def show_path_warning(ctx: wire.Context, path: Bip32Path) -> None:
from trezor.ui.layouts import confirm_path_warning
from .layout import address_n_to_str
await confirm_path_warning(ctx, address_n_to_str(path))
@ -338,6 +337,9 @@ def path_is_hardened(address_n: Bip32Path) -> bool:
def break_address_n_to_lines(address_n: Bip32Path) -> list[str]:
from trezor.ui.constants import MONO_CHARS_PER_LINE
from .layout import address_n_to_str
lines = []
path_str = address_n_to_str(address_n)

@ -2,7 +2,6 @@ from micropython import const
import storage.device
from trezor import fatfs
from trezor.crypto import hmac
from trezor.sdcard import with_filesystem
from trezor.utils import consteq
@ -25,6 +24,8 @@ def is_enabled() -> bool:
def compute_auth_tag(salt: bytes, auth_key: bytes) -> bytes:
from trezor.crypto import hmac
digest = hmac(hmac.SHA256, auth_key, salt).digest()
return digest[:SD_SALT_AUTH_TAG_LEN_BYTES]

@ -1,5 +1,6 @@
from common import *
from trezor.utils import ensure
from apps.common.layout import address_n_to_str
from apps.common.paths import *

Loading…
Cancel
Save