mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-19 12:58:13 +00:00
src/apps: make flake8 happy
This commit is contained in:
parent
6a062ec5ea
commit
736b02394f
@ -27,7 +27,7 @@ async def require_confirm_fee(ctx, spending, gas_price, gas_limit, chain_id, tok
|
|||||||
ui.NORMAL, 'Gas price:',
|
ui.NORMAL, 'Gas price:',
|
||||||
ui.BOLD, format_ethereum_amount(gas_price, None, chain_id, tx_type),
|
ui.BOLD, format_ethereum_amount(gas_price, None, chain_id, tx_type),
|
||||||
ui.NORMAL, 'Maximum fee:',
|
ui.NORMAL, 'Maximum fee:',
|
||||||
ui.BOLD, format_ethereum_amount(gas_price *gas_limit, None, chain_id, tx_type),
|
ui.BOLD, format_ethereum_amount(gas_price * gas_limit, None, chain_id, tx_type),
|
||||||
icon_color=ui.GREEN)
|
icon_color=ui.GREEN)
|
||||||
await require_hold_to_confirm(ctx, content, ButtonRequestType.SignTx)
|
await require_hold_to_confirm(ctx, content, ButtonRequestType.SignTx)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ suffixes = {
|
|||||||
|
|
||||||
|
|
||||||
def suffix_by_chain_id(chain_id, tx_type=None):
|
def suffix_by_chain_id(chain_id, tx_type=None):
|
||||||
if (tx_type==1 or tx_type==6) and (chain_id==1 or chain_id==3):
|
if tx_type in [1, 6] and chain_id in [1, 3]:
|
||||||
return"WAN"
|
return 'WAN'
|
||||||
else:
|
else:
|
||||||
return suffixes.get(chain_id, 'UNKN')
|
return suffixes.get(chain_id, 'UNKN')
|
||||||
|
@ -46,7 +46,7 @@ async def ethereum_sign_tx(ctx, msg):
|
|||||||
sha = HashWriter(sha3_256)
|
sha = HashWriter(sha3_256)
|
||||||
sha.extend(rlp.encode_length(total_length, True)) # total length
|
sha.extend(rlp.encode_length(total_length, True)) # total length
|
||||||
|
|
||||||
if not msg.tx_type is None:
|
if msg.tx_type is not None:
|
||||||
sha.extend(rlp.encode(msg.tx_type))
|
sha.extend(rlp.encode(msg.tx_type))
|
||||||
|
|
||||||
for field in [msg.nonce, msg.gas_price, msg.gas_limit, msg.to, msg.value]:
|
for field in [msg.nonce, msg.gas_price, msg.gas_limit, msg.to, msg.value]:
|
||||||
@ -75,7 +75,7 @@ async def ethereum_sign_tx(ctx, msg):
|
|||||||
|
|
||||||
def get_total_length(msg: EthereumSignTx, data_total: int) -> int:
|
def get_total_length(msg: EthereumSignTx, data_total: int) -> int:
|
||||||
length = 0
|
length = 0
|
||||||
if not msg.tx_type is None:
|
if msg.tx_type is not None:
|
||||||
length += rlp.field_length(1, [msg.tx_type])
|
length += rlp.field_length(1, [msg.tx_type])
|
||||||
|
|
||||||
for field in [msg.nonce, msg.gas_price, msg.gas_limit, msg.to, msg.value]:
|
for field in [msg.nonce, msg.gas_price, msg.gas_limit, msg.to, msg.value]:
|
||||||
@ -130,10 +130,10 @@ def node_derive(root, address_n: list):
|
|||||||
|
|
||||||
def check(msg: EthereumSignTx):
|
def check(msg: EthereumSignTx):
|
||||||
if msg.tx_type not in [1, 6, None]:
|
if msg.tx_type not in [1, 6, None]:
|
||||||
raise ValueError(FailureType.DataError, 'Txtype out of bounds')
|
raise wire.DataError('tx_type out of bounds')
|
||||||
|
|
||||||
if msg.chain_id < 0 or msg.chain_id > MAX_CHAIN_ID:
|
if msg.chain_id < 0 or msg.chain_id > MAX_CHAIN_ID:
|
||||||
raise wire.DataError('Chain id out of bounds')
|
raise wire.DataError('chain_id out of bounds')
|
||||||
|
|
||||||
if msg.data_length > 0:
|
if msg.data_length > 0:
|
||||||
if not msg.data_initial_chunk:
|
if not msg.data_initial_chunk:
|
||||||
|
@ -2,7 +2,6 @@ from trezor import config, ui, wire
|
|||||||
from trezor.crypto import bip39
|
from trezor.crypto import bip39
|
||||||
from trezor.messages.ButtonRequest import ButtonRequest
|
from trezor.messages.ButtonRequest import ButtonRequest
|
||||||
from trezor.messages.ButtonRequestType import MnemonicWordCount, MnemonicInput
|
from trezor.messages.ButtonRequestType import MnemonicWordCount, MnemonicInput
|
||||||
from trezor.messages.FailureType import ProcessError, UnexpectedMessage
|
|
||||||
from trezor.messages.Success import Success
|
from trezor.messages.Success import Success
|
||||||
from trezor.messages.wire_types import ButtonAck
|
from trezor.messages.wire_types import ButtonAck
|
||||||
from trezor.pin import pin_to_int
|
from trezor.pin import pin_to_int
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from trezor import ui, wire
|
from trezor import ui, wire
|
||||||
from trezor.crypto.curve import secp256k1
|
from trezor.crypto.curve import secp256k1
|
||||||
from trezor.messages.InputScriptType import SPENDADDRESS, SPENDP2SHWITNESS, SPENDWITNESS
|
from trezor.messages.InputScriptType import SPENDADDRESS, SPENDP2SHWITNESS, SPENDWITNESS
|
||||||
from trezor.messages.FailureType import ProcessError
|
|
||||||
from trezor.messages.MessageSignature import MessageSignature
|
from trezor.messages.MessageSignature import MessageSignature
|
||||||
from trezor.ui.text import Text
|
from trezor.ui.text import Text
|
||||||
from apps.common import coins, seed
|
from apps.common import coins, seed
|
||||||
|
Loading…
Reference in New Issue
Block a user